/* ============================================================
   GALLERY PAGE — gallery.css
   Herons gold + charcoal + white · story-deck hero + masonry
   ============================================================ */

.nav__link--active {
  color: var(--gold);
  font-weight: 700;
}

/* ============================================================
   GALLERY HERO — dark stage with drifting story deck
   ============================================================ */
.gal-hero {
  padding-top: 80px;
  background: #111111;
  color: #fff;
  overflow: hidden;
  position: relative;
}

.gal-hero::before {
  content: "";
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 720px;
  height: 420px;
  background: radial-gradient(ellipse at center, rgba(255, 204, 0, .13) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.gal-hero__inner {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1.25rem, 5vw, 4rem) clamp(1rem, 2vw, 1.5rem);
  text-align: center;
  position: relative;
  z-index: 2;
}

.gal-hero__eyebrow {
  display: inline-block;
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.1rem;
  background: rgba(255, 204, 0, .1);
  padding: .35rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 204, 0, .25);
}

.gal-hero__heading {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 500;
  line-height: 1.12;
  margin-bottom: 1.2rem;
  color: #fff;
  letter-spacing: -.02em;
}

.gal-hero__heading em {
  font-style: italic;
  color: var(--gold);
}

.gal-hero__sub {
  font-family: var(--sans);
  font-size: clamp(.95rem, 2vw, 1.1rem);
  line-height: 1.75;
  color: rgba(255, 255, 255, .65);
  max-width: 520px;
  margin: 0 auto;
}

/* --- Story deck: an infinite wall of tilted cards.
       Two copies of the same set; a rAF loop translates the track and
       wraps it modulo half its width, so it scrolls forever. Drag it
       (with momentum), or leave it to drift on its own. The browser
       only composites ONE transformed layer — cheap & smooth. */
.gal-deck {
  position: relative;
  z-index: 1;
  height: clamp(200px, 30vw, 320px);
  margin-top: clamp(1rem, 2.5vw, 2rem);
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y; /* vertical swipes still scroll the page */
  /* soft fade at both edges */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.gal-deck.is-dragging {
  cursor: grabbing;
}

.gal-deck.is-dragging .gal-deck__card {
  pointer-events: none; /* no hover pop mid-drag */
}

.gal-deck__track {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: clamp(.6rem, 1.6vw, 1.25rem);
  width: max-content;
  padding: 0 .5rem;
  will-change: transform;
}

.gal-deck__card {
  flex: 0 0 auto;
  width: clamp(130px, 17vw, 210px);
  border-radius: 16px;
  overflow: hidden;
  background: #1d1d1d;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45);
  transform: rotate(var(--tilt, 0deg)) translateY(var(--dy, 0px));
  transition: transform .4s var(--ease), box-shadow .4s;
  cursor: pointer;
  border: 3px solid rgba(255, 255, 255, .92);
}

.gal-deck__card:hover {
  transform: rotate(0deg) translateY(calc(var(--dy, 0px) - 8px)) scale(1.05);
  box-shadow: 0 22px 48px rgba(0, 0, 0, .55), 0 0 0 3px rgba(255, 204, 0, .55);
  z-index: 3;
}

.gal-deck__card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 3 / 4;
}

.gal-deck__card:nth-child(even) img {
  aspect-ratio: 4 / 3.4;
}

/* ============================================================
   GALLERY MAIN
   ============================================================ */
.gal-main {
  background: var(--light);
  padding-bottom: clamp(4rem, 8vw, 7rem);
}

.gal-main__inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem);
}

/* ============================================================
   FILTER TABS
   ============================================================ */
.gal-tabs {
  display: flex;
  gap: clamp(1.25rem, 3.5vw, 2.5rem);
  padding: clamp(1.25rem, 2.5vw, 1.75rem) 0 0;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
  position: sticky;
  top: 68px;
  z-index: 50;
  background: var(--light);
  border-bottom: 1px solid #e2dfd8;
  overflow-x: auto;
  scrollbar-width: none;
}

.gal-tabs::-webkit-scrollbar {
  display: none;
}

.gal-tab {
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .5rem 0 .95rem;
  border: none;
  background: none;
  color: #8f8b83;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: color .2s;
}

.gal-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s var(--ease);
}

.gal-tab:hover {
  color: #111;
}

.gal-tab.is-active {
  color: #111;
}

.gal-tab.is-active::after {
  transform: scaleX(1);
}

.gal-tab__n {
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: 0;
  color: #b3aea4;
  vertical-align: super;
  margin-left: .3rem;
}

.gal-tab.is-active .gal-tab__n {
  color: #c49f00;
}

/* ============================================================
   CATEGORY SECTIONS (All view)
   ============================================================ */
.gal-sections {
  display: flex;
  flex-direction: column;
  gap: clamp(3rem, 6vw, 5rem);
}

.gal-section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.gal-section__eyebrow {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #b28f00;
  margin: 0 0 .3rem;
}

.gal-section__title {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
  font-weight: 500;
  color: #111;
  margin: 0;
  letter-spacing: -.01em;
}

.gal-section__count {
  font-family: var(--sans);
  font-size: .85rem;
  color: #999;
  margin: .3rem 0 0;
}

.gal-section__cta {
  font-family: var(--sans);
  font-size: .85rem;
  font-weight: 700;
  padding: .6rem 1.35rem;
  border-radius: 999px;
  border: 2px solid #222;
  background: transparent;
  color: #222;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .2s;
  white-space: nowrap;
}

.gal-section__cta:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: #111;
  transform: translateY(-2px);
}

/* ============================================================
   MASONRY GRID
   True masonry via CSS grid: dense 8px rows, each card spans
   rows computed in JS from the photo's real aspect ratio
   (dimensions ship in the manifest, so zero layout shift).
   ============================================================ */
.gal-masonry {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), 1fr);
  grid-auto-rows: 8px;
  gap: 0 14px;
}

/* ============================================================
   PHOTO CARDS
   ============================================================ */
.gal-card {
  position: relative;
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background: #e9e7e2;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
  transition: transform .3s var(--ease), box-shadow .3s;
  /* scroll reveal */
  opacity: 0;
  transform: translateY(18px);
}

.gal-card.in-view {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .55s ease, transform .55s var(--ease), box-shadow .3s;
}

.gal-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 38px rgba(0, 0, 0, .16);
  z-index: 2;
}

@media (prefers-reduced-motion: reduce) {
  .gal-card {
    opacity: 1;
    transform: none;
  }
}

/* shimmer placeholder until the image decodes */
.gal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, .5) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: galShimmer 1.4s infinite;
  z-index: 1;
  pointer-events: none;
}

.gal-card.is-loaded::before {
  display: none;
}

@keyframes galShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.gal-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .4s ease, transform .45s var(--ease);
}

.gal-card.is-loaded img {
  opacity: 1;
}

.gal-card:hover img {
  transform: scale(1.045);
}

.gal-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .5) 100%);
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
  z-index: 2;
}

.gal-card:hover .gal-card__overlay {
  opacity: 1;
}

.gal-card__badge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: var(--gold);
  color: #111;
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .25rem .65rem;
  border-radius: 20px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .25s, transform .25s;
  z-index: 3;
}

.gal-card:hover .gal-card__badge {
  opacity: 1;
  transform: translateY(0);
}

.gal-card:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* ============================================================
   LOAD MORE
   ============================================================ */
.gal-load-more {
  display: flex;
  justify-content: center;
  margin-top: 2.5rem;
  min-height: 48px;
}

.gal-load-btn {
  font-family: var(--sans);
  font-size: .92rem;
  font-weight: 700;
  padding: .8rem 2.2rem;
  border-radius: 999px;
  border: 2px solid #222;
  background: transparent;
  color: #222;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .2s;
  letter-spacing: .03em;
}

.gal-load-btn:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: #111;
  transform: translateY(-2px);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.gal-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 1rem;
  color: #888;
  font-family: var(--sans);
}

.gal-empty svg {
  width: 56px;
  height: 56px;
  opacity: .3;
  margin: 0 auto 1.2rem;
  display: block;
}

.gal-empty p {
  font-size: 1rem;
  margin: 0;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lb {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(8, 8, 8, .97);
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  backdrop-filter: blur(4px);
}

.lb[hidden] {
  display: none;
}

.lb__stage {
  max-width: min(92vw, 1200px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .85rem;
  animation: lbIn .25s ease;
}

@keyframes lbIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

.lb__img {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .8);
  object-fit: contain;
  transition: opacity .18s ease;
}

.lb__img.is-switching {
  opacity: 0;
}

.lb__caption {
  font-family: var(--sans);
  font-size: .82rem;
  color: rgba(255, 255, 255, .5);
  text-align: center;
  letter-spacing: .03em;
}

.lb__close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .2);
  font-size: 1.5rem;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .25s;
  z-index: 10000;
}

.lb__close:hover {
  background: rgba(255, 204, 0, .2);
  border-color: var(--gold);
  color: var(--gold);
  transform: rotate(90deg);
}

.lb__prev,
.lb__next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, border-color .2s, color .2s;
  z-index: 10000;
}

.lb__prev { left: 1.25rem; }
.lb__next { right: 1.25rem; }

.lb__prev:hover,
.lb__next:hover {
  background: rgba(255, 204, 0, .15);
  border-color: var(--gold);
  color: var(--gold);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 760px) {
  .gal-masonry {
    gap: 0 10px;
  }

  .gal-card {
    border-radius: 11px;
  }

  .gal-deck__card {
    border-width: 2px;
    border-radius: 12px;
  }
}

@media (max-width: 500px) {
  .gal-masonry {
    gap: 0 8px;
  }

  .lb__prev { left: .5rem; }
  .lb__next { right: .5rem; }

  .lb__prev,
  .lb__next {
    width: 42px;
    height: 42px;
    background: rgba(0, 0, 0, .35);
  }
}
