/* ============================================================
   page-gallery.css
   Photography gallery — /gallery
   ============================================================ */

/* ============================================================
   Page header
   ============================================================ */

.gallery-header {
  padding: var(--ac-sp-9) var(--ac-page-pad) var(--ac-sp-7);
  max-width: var(--ac-max-width);
  margin: 0 auto;
  border-bottom: 1px solid var(--ac-hair);
}

.gallery-header__eyebrow {
  font-family: var(--ac-font-mono);
  font-size: var(--ac-text-label);
  font-weight: 500;
  letter-spacing: var(--ac-ls-label);
  text-transform: uppercase;
  color: var(--ac-muted);
  margin-bottom: var(--ac-sp-4);
}

.gallery-header__headline {
  font-size: var(--ac-text-h1);
  font-weight: 300;
  line-height: var(--ac-lh-h1);
  letter-spacing: var(--ac-ls-h1);
  margin-bottom: var(--ac-sp-5);
}

.gallery-header__sub {
  font-size: var(--ac-text-body-lg);
  color: var(--ac-muted);
  max-width: 52ch;
  margin: 0;
}

/* ============================================================
   Filter strip
   ============================================================ */

.gallery-filters {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--ac-bg);
  border-bottom: 1px solid var(--ac-hair);
}

.gallery-filters__inner {
  max-width: var(--ac-max-width);
  margin: 0 auto;
  padding: 0 var(--ac-page-pad);
  display: flex;
  align-items: center;
  gap: var(--ac-sp-2);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.gallery-filters__inner::-webkit-scrollbar {
  display: none;
}

.gallery-filter-btn {
  flex-shrink: 0;
  font-family: var(--ac-font-mono);
  font-size: var(--ac-text-label);
  font-weight: 500;
  letter-spacing: var(--ac-ls-label);
  text-transform: uppercase;
  color: var(--ac-muted);
  background: none;
  border: none;
  padding: var(--ac-sp-4) var(--ac-sp-2);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 180ms var(--ac-ease), border-color 180ms var(--ac-ease);
  line-height: 1;
  margin-bottom: -1px; /* sit on the border-bottom of the strip */
}

.gallery-filter-btn:hover {
  color: var(--ac-ink);
}

.gallery-filter-btn[aria-pressed="true"] {
  color: var(--ac-ink);
  border-bottom-color: var(--ac-ink);
}

.gallery-filter-btn:focus-visible {
  outline: 2px solid var(--ac-accent);
  outline-offset: 2px;
}

/* ============================================================
   Masonry grid
   ============================================================ */

.gallery-section {
  padding: var(--ac-sp-6) var(--ac-page-pad);
  max-width: var(--ac-max-width);
  margin: 0 auto;
}

.gallery-grid {
  columns: 3 260px;
  column-gap: 16px;
  padding: 4px 4px 24px;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 16px;
  display: block;
  cursor: pointer;
  position: relative;
  background-color: var(--ac-paper);
  transition: box-shadow 250ms var(--ac-ease), transform 250ms var(--ac-ease);
}

.gallery-item:hover {
  box-shadow: 0 4px 20px oklch(18% 0.012 60 / 0.08);
  transform: translateY(-2px);
}

.gallery-item[hidden] {
  display: none;
}

.gallery-item__img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 350ms var(--ac-ease), filter 350ms var(--ac-ease);
}

/* Caption overlay — removed: images carry composition name visually */

.gallery-item:focus-visible {
  outline: 2px solid var(--ac-accent);
  outline-offset: 2px;
}

/* Empty state */

.gallery-empty {
  display: none;
  text-align: center;
  padding: var(--ac-sp-10) 0;
  color: var(--ac-muted);
  font-size: var(--ac-text-body);
}

.gallery-empty[data-visible] {
  display: block;
}

/* ============================================================
   Lightbox
   ============================================================ */

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: oklch(8% 0.01 60 / 0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ac-ease);
}

.gallery-lightbox[data-open] {
  opacity: 1;
  pointer-events: auto;
}

.gallery-lightbox__img-wrap {
  position: relative;
  max-width: calc(100vw - 120px);
  max-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 2px;
}

.gallery-lightbox__caption {
  position: absolute;
  bottom: calc(-1 * var(--ac-sp-6));
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--ac-font-mono);
  font-size: var(--ac-text-label);
  font-weight: 500;
  letter-spacing: var(--ac-ls-label);
  text-transform: uppercase;
  color: oklch(65% 0.01 60);
}

/* Navigation buttons */

.gallery-lightbox__btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: oklch(97% 0.008 80 / 0.08);
  border: 1px solid oklch(97% 0.008 80 / 0.15);
  color: oklch(97% 0.008 80);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 180ms var(--ac-ease);
  z-index: 9001;
}

.gallery-lightbox__btn:hover {
  background-color: oklch(97% 0.008 80 / 0.16);
}

.gallery-lightbox__btn:focus-visible {
  outline: 2px solid var(--ac-accent);
  outline-offset: 2px;
}

.gallery-lightbox__btn--prev { left: var(--ac-sp-5); }
.gallery-lightbox__btn--next { right: var(--ac-sp-5); }

.gallery-lightbox__btn svg {
  width: 20px;
  height: 20px;
}

/* Close button */

.gallery-lightbox__close {
  position: fixed;
  top: var(--ac-sp-5);
  right: var(--ac-sp-5);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: oklch(97% 0.008 80 / 0.08);
  border: 1px solid oklch(97% 0.008 80 / 0.15);
  color: oklch(97% 0.008 80);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: background-color 180ms var(--ac-ease);
  z-index: 9001;
}

.gallery-lightbox__close:hover {
  background-color: oklch(97% 0.008 80 / 0.16);
}

/* Counter */

.gallery-lightbox__counter {
  position: fixed;
  top: var(--ac-sp-5);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--ac-font-mono);
  font-size: var(--ac-text-label);
  letter-spacing: var(--ac-ls-label);
  color: oklch(55% 0.01 60);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
  .gallery-grid {
    columns: 2 200px;
    column-gap: 10px;
  }

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

  .gallery-lightbox__img-wrap {
    max-width: calc(100vw - 24px);
  }

  .gallery-lightbox__btn--prev { left: var(--ac-sp-3); }
  .gallery-lightbox__btn--next { right: var(--ac-sp-3); }

  .gallery-header__headline {
    font-size: var(--ac-text-h2);
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    columns: 1;
  }

  .gallery-lightbox__btn {
    display: none;
  }
}
