/* ============================================
   GALLERY.CSS — Gallery Page
   ============================================ */

/* --- Gallery Header --- */
.gallery-hero {
  padding-top: calc(var(--nav-height) + var(--spacing-xl));
  padding-bottom: var(--spacing-lg);
  text-align: center;
  position: relative;
}

.gallery-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
}

.gallery-hero .section-label {
  margin-bottom: var(--spacing-xs);
}

.gallery-hero h1 {
  font-family: var(--font-display);
  font-weight: 300;
  font-style: italic;
  margin-bottom: var(--spacing-sm);
}

.gallery-hero p {
  color: var(--color-text-muted);
  max-width: 500px;
  margin: 0 auto;
  font-weight: 200;
}

/* --- Filter Tabs --- */
.gallery-filters {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-lg) 0;
  flex-wrap: wrap;
}

.filter-btn {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-text-dim);
  background: none;
  border: 1px solid transparent;
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  transition: all var(--transition-snappy);
}

.filter-btn:hover {
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.filter-btn.active {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* --- Masonry Gallery --- */
.gallery-masonry {
  column-count: 4;
  column-gap: 14px;
  padding: 0 var(--spacing-md);
  max-width: var(--max-width);
  margin: 0 auto;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  animation: masonryReveal 0.6s ease forwards;
}

@keyframes masonryReveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-item:nth-child(1) { animation-delay: 0.05s; }
.gallery-item:nth-child(2) { animation-delay: 0.1s; }
.gallery-item:nth-child(3) { animation-delay: 0.15s; }
.gallery-item:nth-child(4) { animation-delay: 0.2s; }
.gallery-item:nth-child(5) { animation-delay: 0.25s; }
.gallery-item:nth-child(6) { animation-delay: 0.3s; }
.gallery-item:nth-child(7) { animation-delay: 0.35s; }
.gallery-item:nth-child(8) { animation-delay: 0.4s; }
.gallery-item:nth-child(9) { animation-delay: 0.45s; }
.gallery-item:nth-child(10) { animation-delay: 0.5s; }
.gallery-item:nth-child(11) { animation-delay: 0.55s; }
.gallery-item:nth-child(12) { animation-delay: 0.6s; }
.gallery-item:nth-child(13) { animation-delay: 0.65s; }
.gallery-item:nth-child(14) { animation-delay: 0.7s; }
.gallery-item:nth-child(15) { animation-delay: 0.75s; }
.gallery-item:nth-child(16) { animation-delay: 0.8s; }

.gallery-item img {
  width: 100%;
  display: block;
  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.5s ease;
  filter: grayscale(15%) brightness(0.92);
}

.gallery-item:hover img {
  transform: scale(1.04);
  filter: grayscale(0%) brightness(1);
}

/* --- Lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(20, 20, 20, 0.96);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.5rem;
  transition: color var(--transition-snappy);
  z-index: 10;
}

.lightbox-close:hover {
  color: var(--color-text);
}

.lightbox-close svg {
  width: 28px;
  height: 28px;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  animation: lightboxIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes lightboxIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lightbox-caption {
  position: absolute;
  bottom: var(--spacing-md);
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.lightbox-caption h4 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--color-text);
}

.lightbox-caption span {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent);
}

/* space between the last photos and the footer */
.gallery-masonry {
  padding-bottom: var(--spacing-lg);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .gallery-masonry {
    column-count: 3;
  }
}

@media (max-width: 768px) {
  .gallery-masonry {
    column-count: 2;
    column-gap: 10px;
    padding: 0 var(--spacing-sm);
  }

  .gallery-item {
    margin-bottom: 10px;
  }

  .gallery-filters {
    gap: 0.5rem;
  }

  .filter-btn {
    padding: 0.5rem 1rem;
    font-size: 0.62rem;
  }
}

@media (max-width: 480px) {
  .gallery-masonry {
    column-count: 1;
  }
}
