/* ===== Gallery Grid ===== */
.gallery-section {
  max-width: 1200px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(100% / var(--gallery-columns) - 1.2rem), 1fr));
  gap: 1.2rem;
  grid-auto-flow: dense;
}

.gallery-item {
  position: relative;
  border-radius: var(--card-border-radius);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.gallery-item:nth-child(3n + 1) {
  grid-row: span 2;
  aspect-ratio: auto;
}

.gallery-item:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-item:hover img {
  transform: scale(1.08);
}

.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 60%,
    rgba(0, 0, 0, 0.15) 100%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
}

.gallery-item:hover::after {
  opacity: 1;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.4s ease;
  cursor: pointer;
}

.lightbox.active {
  opacity: 1;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox.active img {
  transform: scale(1);
}

.gallery-empty {
  text-align: center;
  grid-column: 1 / -1;
  padding: 3rem;
  color: var(--color-text-light);
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-style: italic;
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }

  .gallery-item:nth-child(3n + 1) {
    grid-row: span 1;
    aspect-ratio: 1;
  }
}
