/* ═══════════════════════════════════════════════════════════════════
   JAY AT 40 · Gallery page only
   Cinematic editorial photo journal — scoped entirely to .gallery-page
   so the header, footer, and every other page keep the global system.
   Type: Barlow Condensed (controls) · Instrument Serif (editorial)
         · Inter (body). Accents: restrained brass + warm saddle.
═══════════════════════════════════════════════════════════════════ */

.gallery-page {
  --font-display:   'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-editorial: 'Instrument Serif', Georgia, serif;
  --font-g-body:    'Inter', system-ui, sans-serif;

  --g-brass:       #7D5F30;
  --g-brass-hi:    #D2B37E;
  --g-brass-line:  rgba(143, 113, 61, 0.42);
  --g-saddle:      #7A4C2D;
  --g-gap:         clamp(8px, 1vw, 12px);
  --g-radius:      4px;
}

/* ── Page-scoped type primitives ───────────────────────────────── */
.gallery-page .gallery-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(0.8rem, 1vw, 1rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--g-brass);
}
.gallery-page .gallery-title {
  font-family: var(--font-editorial);
  font-weight: 400;
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: 0.95;
  letter-spacing: 0.005em;
  color: var(--text);
  text-wrap: balance;
}
.gallery-page .gallery-section-title {
  font-family: var(--font-editorial);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
  color: var(--text);
  text-wrap: balance;
}
.gallery-page .gallery-body,
.gallery-page .gallery-stage p {
  font-family: var(--font-g-body);
  font-weight: 400;
  font-size: clamp(1rem, 1.2vw, 1.125rem);
  line-height: 1.65;
  color: var(--text-dim);
  max-width: 46ch;
  text-wrap: pretty;
}
.gallery-page .gallery-fineprint {
  font-family: var(--font-g-body);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-faint);
}
/* Gallery buttons keep the sitewide .btn shape but speak Barlow. */
.gallery-page .btn { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.14em; }

/* ── Gallery hero ──────────────────────────────────────────────── */
.gallery-page .gallery-hero {
  max-width: 80rem;
  padding-bottom: var(--space-l);
}
.gallery-page .gallery-hero .gallery-label { display: block; margin-bottom: var(--space-xs); font-weight: 600; }
.gallery-page .gallery-hero .gallery-title { margin-bottom: 0.8rem; max-width: 14ch; font-weight: 400; }
.gallery-page .gallery-hero .gallery-body { margin-bottom: var(--space-m); }
.gallery-page .gallery-hero-cta {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-xs) var(--space-s);
}
.gallery-page .gallery-count {
  color: var(--text-faint);
  font-weight: 500;
}
.gallery-page .gallery-hairline {
  border: 0; height: 1px; max-width: 80rem;
  background: linear-gradient(90deg, var(--g-brass-line), transparent 70%);
  margin-bottom: var(--space-s);
}

/* ── Status / empty / error (Inter) ────────────────────────────── */
.gallery-page .gallery-status {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--g-brass);
  opacity: 0.8;
}
.gallery-page .gallery-note {
  font-family: var(--font-g-body);
  max-width: 40rem;
  padding: 1.1rem 1.3rem;
  border: 1px solid var(--g-brass-line);
  border-radius: var(--g-radius);
  background: rgba(179, 145, 90, 0.05);
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.65;
}
.gallery-page .gallery-note.is-error { border-color: rgba(224, 138, 138, 0.4); color: var(--error); }

/* ── Editorial masonry ─────────────────────────────────────────── */
.gallery-page .gallery-stage {
  max-width: 80rem;
  padding-top: 0;
}
.gallery-page .g-masonry {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: 8px;          /* row unit; JS sets per-item spans */
  grid-auto-flow: row dense;
  gap: var(--g-gap);
}
@media (min-width: 480px)  { .gallery-page .g-masonry { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .gallery-page .g-masonry { grid-template-columns: repeat(3, 1fr); } }

.gallery-page .g-item {
  grid-row: span var(--span, 34);
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--g-radius);
  background: none;
  border: 0;
  padding: 0;
  cursor: zoom-in;
}
@media (min-width: 480px) {
  .gallery-page .g-item--feature { grid-column: span 2; }
}
.gallery-page .g-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-page .g-item::after {
  /* whisper of saddle warmth + hairline on hover — no card chrome */
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px transparent;
  background: linear-gradient(to top, rgba(138, 90, 51, 0.16), transparent 42%);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out), box-shadow var(--dur-base);
  pointer-events: none;
}
.gallery-page .g-item:hover::after,
.gallery-page .g-item:focus-visible::after {
  opacity: 1;
  box-shadow: inset 0 0 0 1px var(--g-brass-line);
}
.gallery-page .g-item:focus-visible { outline: 2px solid var(--g-brass-hi); outline-offset: 2px; }

/* Cinematic reveal — every photo plays the same beat: fade + rise while
   the image sharpens from a blur and eases down from a slight zoom. Text
   holds until the image has visibly settled, then rises in after it. */
.gallery-page .g-item { opacity: 0; transform: translateY(28px); }
.gallery-page .g-item img { transform: scale(1.08); filter: blur(14px) brightness(0.92); }
.gallery-page .g-item,
.gallery-page .g-item img {
  transition: opacity 900ms var(--ease-out), transform 1100ms var(--ease-out),
              filter 1100ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.gallery-page .g-item.in { opacity: 1; transform: none; }
.gallery-page .g-item.in img { transform: scale(1); filter: blur(0) brightness(1); }
.gallery-page .g-item.in:hover img { filter: blur(0) brightness(1.06); transition-delay: 0ms; }

.gallery-page .g-item .g-caption {
  position: absolute;
  z-index: 1;
  inset: auto 0 0 0;
  padding: 1.4rem 1rem 0.9rem;
  font-family: var(--font-editorial);
  font-size: clamp(0.95rem, 1.1vw, 1.15rem);
  line-height: 1.35;
  color: var(--ivory);
  text-align: left;
  background: linear-gradient(to top, rgba(11, 11, 13, 0.72), transparent 85%);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
  transition-delay: 0ms;
  pointer-events: none;
}
.gallery-page .g-item.in .g-caption {
  opacity: 1;
  transform: none;
  transition-delay: calc(var(--reveal-delay, 0ms) + 750ms);
}

/* ── Lightbox ──────────────────────────────────────────────────── */
.gallery-page .lightbox {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  background: rgba(11, 11, 13, 0.97);
  opacity: 0;
  transition: opacity 280ms var(--ease-out);
}
.gallery-page .lightbox[hidden] { display: none; }
.gallery-page .lightbox.is-open { opacity: 1; }
.gallery-page .lb-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(3.25rem, 8vh, 4.5rem) clamp(0.75rem, 4vw, 4.5rem);
}
.gallery-page .lb-figure {
  margin: 0; max-width: 100%; max-height: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 0.7rem;
}
.gallery-page .lb-figure img {
  max-width: 100%;
  max-height: calc(100vh - clamp(6.5rem, 16vh, 9rem));
  width: auto; height: auto;          /* original aspect ratio */
  object-fit: contain;
  border-radius: 2px;
  opacity: 1;
  transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out);
}
.gallery-page .lightbox.lb-switching .lb-figure img { opacity: 0; transform: scale(0.992); }
.gallery-page .lb-caption {
  font-family: var(--font-editorial);
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  line-height: 1.4;
  color: var(--ivory);
  text-align: center;
  max-width: 60ch;
}
.gallery-page .lb-caption:empty { display: none; }

.gallery-page .lb-ctrl {
  position: absolute; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.9rem; height: 2.9rem;
  background: rgba(11, 11, 13, 0.55);
  border: 1px solid var(--g-brass-line);
  border-radius: 50%;
  color: var(--ivory);
  cursor: pointer;
  transition: opacity 400ms var(--ease-out), border-color var(--dur-fast),
              color var(--dur-fast), background var(--dur-fast);
}
.gallery-page .lb-ctrl:hover,
.gallery-page .lb-ctrl:focus-visible { border-color: var(--g-brass-hi); color: var(--g-brass-hi); }
.gallery-page .lb-ctrl svg { width: 1.15rem; height: 1.15rem; }
.gallery-page .lb-close { top: clamp(0.75rem, 2.5vh, 1.5rem); right: clamp(0.75rem, 2.5vw, 1.5rem); }
.gallery-page .lb-prev  { left:  clamp(0.4rem, 2.5vw, 1.5rem); top: 50%; transform: translateY(-50%); }
.gallery-page .lb-next  { right: clamp(0.4rem, 2.5vw, 1.5rem); top: 50%; transform: translateY(-50%); }
.gallery-page .lb-counter {
  position: absolute; z-index: 2;
  bottom: clamp(0.85rem, 2.5vh, 1.5rem); left: 50%; transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  color: var(--g-brass-hi);
  font-variant-numeric: tabular-nums;
  transition: opacity 400ms var(--ease-out);
}
/* Controls fade when the viewer goes idle; focus always brings them back. */
.gallery-page .lightbox.lb-idle .lb-ctrl,
.gallery-page .lightbox.lb-idle .lb-counter { opacity: 0; }
.gallery-page .lightbox.lb-idle .lb-ctrl:focus-visible { opacity: 1; }
@media (max-width: 719.9px) {
  .gallery-page .lb-prev, .gallery-page .lb-next {
    top: auto; bottom: clamp(0.85rem, 2.5vh, 1.5rem); transform: none;
  }
  .gallery-page .lb-prev { left: clamp(0.85rem, 6vw, 2rem); }
  .gallery-page .lb-next { right: clamp(0.85rem, 6vw, 2rem); }
}
body.lb-lock { overflow: hidden; }

/* ── Upload section ────────────────────────────────────────────── */
.gallery-page .gallery-upload {
  max-width: 80rem;
  text-align: center;
  padding-top: var(--space-l);
}
.gallery-page .gallery-upload .gallery-hairline {
  margin-inline: auto;
  margin-bottom: var(--space-l);
  background: linear-gradient(90deg, transparent, var(--g-brass-line), transparent);
}
.gallery-page .gallery-upload .gallery-label { display: block; margin-bottom: 0.6rem; }
.gallery-page .gallery-upload .gallery-section-title { margin-bottom: var(--space-xs); }
.gallery-page .gallery-upload .gallery-body { margin-inline: auto; margin-bottom: var(--space-m); }
.gallery-page .gallery-upload .gallery-fineprint { margin-top: var(--space-s); }

/* ── Reduced motion ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .gallery-page .g-item,
  .gallery-page .g-item img,
  .gallery-page .g-caption,
  .gallery-page .lightbox,
  .gallery-page .lb-figure img,
  .gallery-page .lb-ctrl,
  .gallery-page .lb-counter { transition: none; }
  .gallery-page .g-item { opacity: 1; transform: none; }
  .gallery-page .g-item img { transform: none; filter: none; }
  .gallery-page .g-caption { opacity: 1; transform: none; }
  .gallery-page .lightbox { opacity: 1; }
}

/* ── Night mode — lift the brass so labels stay legible on black ─── */
:root[data-theme="night"] .gallery-page {
  --g-brass:      #C2A15F;
  --g-brass-hi:   #E0C489;
  --g-brass-line: rgba(194, 161, 95, 0.34);
  --g-saddle:     #8A5A33;
}
