.gallery {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.gallery-cards {
  display: flex;
  flex-wrap: wrap; /* wiersze jeśli brak miejsca */
  justify-content: center;
  gap: 20px;
}

.flip-card {
  background-color: transparent;
  width: 300px;
  height: 300px;
  perspective: 1000px;
  border-radius: 10px;
  overflow: hidden; /* przycina wszystko, co wychodzi */
  padding: 10px;
  cursor: pointer;
}

.flip-card-title {
  position: absolute;
  bottom: 10px; /* odległość od dołu obrazka */
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background-color: rgba(0, 0, 0, 0.4);
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: bold;
  text-align: center;
  max-width: 90%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  border: 2px solid var(--main-color);
  border-radius: 10px;
  box-sizing: border-box; /* aby border nie zwiększał wymiarów */
}

.flip-card-inner.unavailable img {
  filter: grayscale(100%) blur(2px);
  opacity: 0.6;
}

.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 10px;
  overflow: hidden;
}

.flip-card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.flip-card-back {
  background-color: #1b1b1b;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  transform: rotateY(180deg);
}

/* Zoom efekt przy kliknięciu */
@keyframes zoomCard {
  0% {
    transform: scale(1) rotateY(0deg);
  }
  50% {
    transform: scale(1.3) rotateY(0deg);
  }
  100% {
    transform: scale(1.3) rotateY(0deg);
    opacity: 0;
  }
}

.flip-card.zoom {
  position: absolute;
  z-index: 999;
  transition: transform 0.6s ease, top 0.6s ease, left 0.6s ease;
}
