/* ==========================================================================
   AKSO — Photos Page
   An editorial, exhibition-style gallery: a perfectly aligned 4:5 grid
   (never masonry), sticky category filtering, and a full-screen lightbox
   showing each image at its true, uncropped aspect ratio.
   ========================================================================== */

/* ---------------------------------------------------------------------
   1. PAGE HEADER
   --------------------------------------------------------------------- */
.photos-header {
  padding-bottom: var(--space-5);
}

.photos-header .section-header {
  margin-bottom: 0;
  max-width: 60ch;
}

/* ---------------------------------------------------------------------
   2. FILTER BAR — sticky, sits just below the floating nav pill
   --------------------------------------------------------------------- */
.filter-bar {
  position: sticky;
  top: calc(var(--space-3) * 2 + 56px);
  z-index: var(--z-nav);
  margin-bottom: var(--space-6);
}

.filter-bar__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: var(--space-2);
  border-radius: 999px;
  background-color: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid rgba(245, 245, 243, 0.08);
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;

  /* Hide scrollbar on the rare viewport where the filter row overflows,
     while keeping it fully scrollable by touch/trackpad. */
  scrollbar-width: none;
}

.filter-bar__inner::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  flex: 0 0 auto;
  padding: var(--space-2) var(--space-3);
  border-radius: 999px;
  font-size: var(--text-nav);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-secondary);
  transition: color var(--duration-fast) var(--ease-standard),
              background-color var(--duration-fast) var(--ease-standard);
  white-space: nowrap;
}

.filter-btn:hover,
.filter-btn:focus-visible {
  color: var(--color-text-primary);
}

.filter-btn.is-active {
  color: var(--color-inverse-text);
  background-color: var(--color-text-primary);
}

@media (max-width: 640px) {
  .filter-bar {
    top: calc(var(--space-2) * 2 + 52px);
  }

  .filter-bar__inner {
    justify-content: flex-start;
    margin-inline: calc(var(--section-padding-x) * -1);
    padding-inline: var(--space-3);
    border-radius: 0;
    background-color: rgba(10, 10, 10, 0.7);
    border-inline: none;
    width: 100vw;
    max-width: 100vw;
  }
}

/* ---------------------------------------------------------------------
   3. GALLERY GRID
   Perfectly aligned 4:5 portrait thumbnails — 3 columns desktop,
   2 tablet, 1 mobile. No rounded corners, no shadows.
   --------------------------------------------------------------------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5) var(--space-4);
}

@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4) var(--space-3);
  }
}

@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
}

.gallery-item {
  position: relative;
}

.gallery-item__trigger {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background-color: var(--color-bg-elevated);
}

.gallery-item__trigger img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out),
              opacity var(--duration-base) var(--ease-standard);
}

.gallery-item__trigger:hover img,
.gallery-item__trigger:focus-visible img {
  transform: scale(1.035);
  opacity: 0.88;
}

.gallery-item__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: var(--space-3);
  background: linear-gradient(to top, rgba(10, 10, 10, 0.55) 0%, rgba(10, 10, 10, 0) 45%);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--duration-base) var(--ease-standard),
              transform var(--duration-base) var(--ease-out);
}

.gallery-item__trigger:hover .gallery-item__overlay,
.gallery-item__trigger:focus-visible .gallery-item__overlay {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item__title {
  color: var(--color-text-primary);
}

/* Hidden-by-filter state: fully removed from layout + tab order once
   filter.js's exit animation completes (see modules/filter.js). This
   selector is a safety net matching the JS-applied end state. */
.gallery-item[hidden] {
  display: none;
}

.gallery-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding-block: var(--space-7);
}

/* ---------------------------------------------------------------------
   4. LIGHTBOX
   Full-screen, shows the image at its true (uncropped) aspect ratio.
   --------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox);
  display: flex;
  flex-direction: column;
  background-color: rgba(8, 8, 8, 0.97);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-standard),
              visibility 0s linear var(--duration-base);
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity var(--duration-base) var(--ease-standard),
              visibility 0s linear 0s;
}

.lightbox__stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: var(--space-7) var(--space-6) var(--space-3);
}

.lightbox__image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity var(--duration-base) var(--ease-standard),
              transform var(--duration-base) var(--ease-out);
}

.lightbox__image.is-visible {
  opacity: 1;
  transform: scale(1);
}

.lightbox__caption {
  flex-shrink: 0;
  text-align: center;
  padding: 0 var(--space-4) var(--space-5);
  max-width: 60ch;
  margin-inline: auto;
}


.lightbox__counter {
  color: var(--color-text-muted);
  font-size: var(--text-caption);
  letter-spacing: var(--tracking-wide);
  margin-top: var(--space-2);
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: fixed;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--color-text-primary);
  transition: opacity var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
}

.lightbox__close svg,
.lightbox__prev svg,
.lightbox__next svg {
  width: 20px;
  height: 20px;
}

.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover {
  opacity: 0.65;
}

.lightbox__close {
  top: var(--space-3);
  right: var(--space-3);
}

.lightbox__prev {
  top: 50%;
  left: var(--space-3);
  transform: translateY(-50%);
}

.lightbox__next {
  top: 50%;
  right: var(--space-3);
  transform: translateY(-50%);
}

.lightbox__prev:hover {
  transform: translateY(-50%) translateX(-3px);
}

.lightbox__next:hover {
  transform: translateY(-50%) translateX(3px);
}

@media (max-width: 768px) {
  .lightbox__stage {
    padding: var(--space-6) var(--space-3) var(--space-2);
  }

  .lightbox__prev,
  .lightbox__next {
    width: 36px;
    height: 36px;
  }

  .lightbox__prev {
    left: var(--space-1);
  }

  .lightbox__next {
    right: var(--space-1);
  }

}
