/* =========================================================
   Gallery Page — Video Hero + Bento Grid
   ========================================================= */

/* ---------- Video Hero ---------- */
.gallery-hero {
  position: relative;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  background: var(--ink-deep);
}

.gallery-hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.gallery-hero__overlay {
  position: absolute;
  inset: 0;
  background: oklch(17% 0.022 42 / 0.40);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--section) var(--gutter);
}

.gallery-hero__overlay .eyebrow {
  margin-bottom: clamp(12px, 1.5vw, 20px);
  color: var(--ink-on-dark-muted);
}

.gallery-hero__overlay .h-display {
  color: var(--ink-on-dark);
  max-width: 16ch;
  line-height: 1.04;
}

@media (min-width: 721px) {
  .gallery-hero__overlay .h-display {
    display: none;
  }
}

/* ---------- Bento Grid ---------- */
.gallery-bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: clamp(300px, 30vw, 460px);
  gap: var(--grid-gap);
  padding: var(--section) var(--gutter) clamp(28px, 4vw, 56px);
  background: var(--cream-warm);
}

/* Cell sizing */
.bento-cell {
  overflow: hidden;
  position: relative;
  cursor: zoom-in;
}

.bento-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--gallery-focus, center 58%);
  display: block;
  transition: transform 800ms var(--ease-out-soft);
}

.gallery-bento .bento-cell:nth-child(1) { --gallery-focus: 68% 54%; }
.gallery-bento .bento-cell:nth-child(2) { --gallery-focus: center 68%; }
.gallery-bento .bento-cell:nth-child(3) { --gallery-focus: center 74%; }
.gallery-bento .bento-cell:nth-child(4) { --gallery-focus: center 76%; }
.gallery-bento .bento-cell:nth-child(5) { --gallery-focus: center bottom; }
.gallery-bento .bento-cell:nth-child(6) { --gallery-focus: center 58%; }
.gallery-bento .bento-cell:nth-child(7) { --gallery-focus: center 78%; }
.gallery-bento .bento-cell:nth-child(8) { --gallery-focus: center 82%; }
.gallery-bento .bento-cell:nth-child(9) { --gallery-focus: center 86%; }

.bento-cell:hover img {
  transform: scale(1.03);
}

.bento-cell:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 4px;
}

/* Column spans */
.bento-cell--8 { grid-column: span 8; }
.bento-cell--6 { grid-column: span 6; }
.bento-cell--4 { grid-column: span 4; }

/* Row spans */
.bento-cell--tall { grid-row: span 2; }

/* Caption overlay */
.bento-cell figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 14px;
  background: linear-gradient(to top, oklch(17% 0.022 42 / 0.70), transparent);
  color: var(--ink-on-dark-muted);
  font-family: var(--body);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity var(--t-base) var(--ease-out);
}

.bento-cell:hover figcaption {
  opacity: 1;
}

/* Initial hidden state — GSAP overrides this on scroll */
.bento-cell {
  will-change: transform, opacity;
}

/* ---------- Gallery Intro Line ---------- */
.gallery-intro {
  padding: var(--section-tight) var(--gutter) 0;
  background: var(--cream-warm);
}

.gallery-intro__rule {
  width: 100%;
  height: 1px;
  background: var(--rule-cream);
  margin-bottom: var(--section-tight);
}

/* ---------- CTA Strip ---------- */
.gallery-cta {
  padding: 0 var(--gutter) clamp(64px, 8vw, 120px);
  background: var(--cream-warm);
  display: flex;
  justify-content: center;
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .gallery-bento {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    padding: var(--section-tight) var(--gutter) clamp(22px, 7vw, 38px);
    gap: clamp(8px, 2vw, 14px);
  }

  .gallery-bento .bento-cell:first-child {
    --gallery-focus: center center;
  }

  .bento-cell--8,
  .bento-cell--6,
  .bento-cell--4 {
    grid-column: 1 / -1;
  }

  .bento-cell--tall {
    grid-row: auto;
  }

  .bento-cell img {
    height: auto;
    object-fit: contain;
    object-position: center center;
  }

  .bento-cell figcaption {
    opacity: 1;
  }

  .gallery-hero__overlay {
    padding: var(--section-tight) var(--gutter);
  }

  .gallery-cta {
    padding-bottom: clamp(56px, 16vw, 88px);
  }
}

/* ---------- Lightbox ---------- */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: 1fr auto;
  background: oklch(12% 0.022 42 / 0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms var(--ease-out);
}

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

.gallery-lightbox__track {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  touch-action: pan-x;
}

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

.gallery-lightbox__slide {
  flex: 0 0 100%;
  min-width: 100%;
  min-height: 0;
  margin: 0;
  scroll-snap-align: center;
  display: grid;
  place-items: center;
  padding: clamp(56px, 7vw, 92px) var(--gutter) clamp(24px, 5vw, 48px);
}

.gallery-lightbox__slide img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 1500px);
  max-height: min(78svh, 900px);
  object-fit: contain;
}

.gallery-lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px var(--gutter) 22px;
  color: var(--ink-on-dark);
  border-top: 1px solid oklch(52% 0.088 128 / 0.22);
}

.gallery-lightbox__caption {
  margin: 0;
  color: var(--ink-on-dark-muted);
  font-family: var(--body);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.gallery-lightbox__count {
  color: var(--ink-on-dark-muted);
  font-family: var(--body);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
}

.gallery-lightbox__button {
  position: fixed;
  z-index: 82;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid oklch(52% 0.088 128 / 0.34);
  border-radius: 50%;
  background: oklch(17% 0.022 42 / 0.68);
  color: var(--ink-on-dark);
  font: 400 22px/1 var(--body);
  cursor: pointer;
  transition: background var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}

.gallery-lightbox__button:hover {
  background: oklch(25% 0.028 44 / 0.86);
  transform: translateY(-1px);
}

.gallery-lightbox__button:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

.gallery-lightbox__close {
  top: 20px;
  right: 20px;
}

.gallery-lightbox__prev,
.gallery-lightbox__next {
  top: 50%;
  transform: translateY(-50%);
}

.gallery-lightbox__prev:hover,
.gallery-lightbox__next:hover {
  transform: translateY(calc(-50% - 1px));
}

.gallery-lightbox__prev { left: 20px; }
.gallery-lightbox__next { right: 20px; }

body.gallery-lightbox-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .gallery-lightbox__slide {
    padding: 60px 0 18px;
  }

  .gallery-lightbox__slide img {
    width: 100%;
    max-height: 78svh;
  }

  .gallery-lightbox__bar {
    padding: 13px 18px 18px;
  }

  .gallery-lightbox__prev,
  .gallery-lightbox__next {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-lightbox,
  .gallery-lightbox__button {
    transition: none;
  }

  .gallery-lightbox__track {
    scroll-behavior: auto;
  }
}

@media (max-width: 420px) {
  .gallery-bento {
    gap: 10px;
  }
}
