/* ============================================================
   act2.css — "Act II": everything BELOW the scroll-film hero.
   The film is Act I. This makes the rest of the page feel like the
   same film continuing — declarative, data-attribute driven, and
   graceful under prefers-reduced-motion.

   Pairs with js/act2.js. The signature "tell" (grid substrate,
   captions grammar, wordmark, scroll ritual) lives in chrome.css and
   is NEVER touched here — this only adds the motion layer around it.

   Reduced-motion contract (critical): every initial-hidden state is
   wrapped in @media (prefers-reduced-motion: no-preference) AND gated
   on html.a2-js. So if motion is reduced, or JS/GSAP never loads, all
   content is fully visible and static — no invisible sections, ever.
   ============================================================ */

/* ---------- 0. Film grain: the whole page shares one emulsion ---------- */
/* A static, GPU-cheap overlay so stills + sections read as one graded film.
   Static (no animation) so it's safe under reduced-motion as-is. */
body::after {
  content: "";
  /* z-index 35: over the film + all content (grades them as one emulsion) but UNDER the
     fixed chrome — nav (40), mobile menu (45/46), cursor-still (55) — which floats above the grade. */
  position: fixed; inset: 0; z-index: 35; pointer-events: none;
  opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}
html[data-theme="dark"] body::after { opacity: .08; mix-blend-mode: soft-light; }

/* ---------- 1. Reveal system (entrances) ---------- */
/* Default resting state is VISIBLE. The hidden pre-state below only exists
   when motion is welcome and the JS layer is live. */
@media (prefers-reduced-motion: no-preference) {
  html.a2-js [data-reveal] { opacity: 0; will-change: transform, opacity; }
  html.a2-js [data-reveal="up"],
  html.a2-js [data-reveal=""],
  html.a2-js [data-reveal]:not([data-reveal="left"]):not([data-reveal="right"]):not([data-reveal="wipe"]):not([data-reveal="fade"]) {
    transform: translateY(30px);
  }
  html.a2-js [data-reveal="left"]  { transform: translateX(-40px); }
  html.a2-js [data-reveal="right"] { transform: translateX(40px); }
  html.a2-js [data-reveal="fade"]  { transform: none; }
  /* image wipe: the media clips in from the bottom edge */
  html.a2-js [data-reveal="wipe"] { opacity: 1; }
  html.a2-js [data-reveal="wipe"] .still__canvas,
  html.a2-js [data-reveal="wipe"] .still__img,
  html.a2-js [data-reveal="wipe"] img {
    clip-path: inset(100% 0 0 0);
    transform: scale(1.06);
    will-change: clip-path, transform;
  }
}

/* ---------- 2. Stills (procedural placeholders or real film-graded webp) ---------- */
.still {
  position: relative; margin: 0; overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-elev); border: 1px solid var(--line);
}
.still::after { /* keep every still inside the film's grade */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.28));
  mix-blend-mode: multiply;
}
html[data-theme="dark"] .still::after { background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,.55)); }
.still__canvas, .still__img, .still img {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
}
.still[data-aspect] { aspect-ratio: var(--a, 16/10); }
.still .still__cap {
  position: absolute; left: 14px; bottom: 12px; z-index: 2;
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em;
  text-transform: uppercase; color: #fff; mix-blend-mode: difference;
}

/* ---------- 3. Stats band (count-up) ---------- */
.stats-band {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(24px, 4vw, 56px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: clamp(40px, 7vh, 80px) 0;
}
.stat__num {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.stat__label {
  display: block; margin-top: 10px;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint);
}

/* ---------- 4. Pin-split (sticky image, text scrolls past) ---------- */
.pin-split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 80px); align-items: start; }
/* inverse actually flips the sides via order, so authoring stays media-first everywhere */
.pin-split[data-pin-split="inverse"] .pin-split__media { order: 2; }
.pin-split[data-pin-split="inverse"] .pin-split__flow { order: 1; }
.pin-split__media { position: relative; }
.pin-split__flow > * + * { margin-top: clamp(48px, 12vh, 160px); }
.pin-split__flow .lede { max-width: 26ch; }
.pin-split__flow p { color: var(--ink-soft); max-width: 46ch; }
@media (max-width: 860px) {
  .pin-split, .pin-split[data-pin-split="inverse"] { grid-template-columns: 1fr; }
  .pin-split__flow > * + * { margin-top: 40px; }
}

/* ---------- 5. Horizontal gallery (pinned; vertical scroll drives X) ---------- */
.hgallery { position: relative; }
.hgallery__head { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 28px; }
/* Base (and reduced-motion / no-JS) state: native horizontal swipe.
   JS upgrades this to a pinned scroll-scrub when motion is welcome. */
.hgallery__track {
  display: flex; gap: clamp(16px, 2vw, 28px);
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 8px; -webkit-overflow-scrolling: touch;
}
html.a2-js .hgallery__track { scrollbar-width: none; }
html.a2-js .hgallery__track::-webkit-scrollbar { display: none; }
.hpanel {
  flex: 0 0 min(78vw, 480px); scroll-snap-align: start;
}
.hpanel .still { aspect-ratio: 4/5; }
.hpanel .hpanel__meta {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 14px;
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em; color: var(--ink-soft);
}
.hpanel .hpanel__meta .num { color: var(--accent); }

/* ---------- 6. Cursor-reveal list (floating still follows the pointer) ---------- */
.cursor-list { border-top: 1px solid var(--line); }
.cursor-list__row {
  position: relative; display: grid; grid-template-columns: 64px 1fr auto; gap: 24px;
  align-items: baseline; padding: clamp(22px, 3.4vh, 40px) 0;
  border-bottom: 1px solid var(--line); cursor: pointer;
  transition: padding-left .35s cubic-bezier(.2,.8,.2,1), color .3s;
}
.cursor-list__row .num { font-family: var(--font-mono); color: var(--accent); font-size: .8rem; }
.cursor-list__row h3 { font-family: var(--font-display); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.cursor-list__row p { grid-column: 2; color: var(--ink-soft); margin: 8px 0 0; max-width: 48ch; }
.cursor-list__row .tag { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .cursor-list__row:hover { padding-left: 20px; }
  .cursor-list__row:hover h3 { transform: translateX(4px); }
  .cursor-list__row.is-dim { opacity: .38; }
}
.cursor-still {
  position: fixed; top: 0; left: 0; z-index: 55; pointer-events: none;
  width: clamp(200px, 22vw, 320px); aspect-ratio: 4/5;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line-strong); box-shadow: 0 24px 60px rgba(0,0,0,.35);
  opacity: 0; transform: translate3d(-50%,-50%,0) scale(.9);
  will-change: transform, opacity;
}
.cursor-still.is-visible { opacity: 1; }
.cursor-still canvas, .cursor-still img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Touch fallback: an inline still that toggles open under the row */
.cursor-list__row .row-inline {
  grid-column: 1 / -1; height: 0; overflow: hidden; opacity: 0;
  transition: height .4s ease, opacity .4s ease, margin .4s ease;
}
.cursor-list__row.is-open .row-inline { height: auto; opacity: 1; margin-top: 18px; }
.cursor-list__row .row-inline .still { aspect-ratio: 16/9; }

/* ---------- 7. Marquee (editorial ticker) ---------- */
.marquee {
  overflow: hidden; white-space: nowrap;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: clamp(18px, 3vh, 30px) 0;
}
.marquee__track { display: inline-flex; gap: 0; will-change: transform; }
.marquee__track > * {
  font-family: var(--font-display); font-size: clamp(1.6rem, 4vw, 3rem);
  letter-spacing: -0.01em; padding: 0 .5em; color: var(--ink);
}
.marquee__track .sep { color: var(--accent); font-family: var(--font-mono); font-size: .6em; align-self: center; }
/* Reduced-motion / no-JS: strip is static, first items just show and clip. */

/* ---------- 8. Hover ignition (links + rows come alive on hover) ---------- */
.ignite {
  position: relative; display: inline-block;
  font-family: var(--font-mono); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
}
.ignite::after {
  content: ""; position: absolute; left: 0; bottom: -3px; height: 1px; width: 100%;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
@media (prefers-reduced-motion: no-preference) {
  .ignite:hover::after { transform: scaleX(1); transform-origin: left; }
}
/* number "flip" on ignition rows */
.num-flip { display: inline-block; overflow: hidden; height: 1em; line-height: 1; }
.num-flip span { display: block; transition: transform .4s cubic-bezier(.2,.8,.2,1); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .cursor-list__row:hover .num-flip span, .stack-list .row:hover .num-flip span { transform: translateY(-1em); }
}

/* ---------- 9. Closing frame (the footer IS the film's last frame) ---------- */
.closing {
  position: relative; z-index: 1; overflow: hidden;
  min-height: min(92vh, 780px); display: grid; align-items: end;
  border-top: 1px solid var(--line);
}
.closing__still { position: absolute; inset: 0; z-index: 0; }
.closing__still canvas, .closing__still img { width: 100%; height: 100%; object-fit: cover; display: block; }
.closing__still::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, transparent 30%, rgba(0,0,0,.72) 100%);
}
.closing__inner {
  position: relative; z-index: 2; width: 100%;
  padding: clamp(48px, 9vh, 120px) var(--pad); color: #fff;
  max-width: var(--maxw); margin: 0 auto;
}
.closing__caption { max-width: 20ch; }
.closing__caption .claim {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2rem, 5.5vw, 4rem); line-height: 1.02; letter-spacing: -0.02em;
}
.closing__caption .qual {
  font-family: var(--font-mono); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255,255,255,.72); margin-top: 14px;
}
.closing__credits {
  margin-top: clamp(40px, 8vh, 88px);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 24px 40px;
  border-top: 1px solid rgba(255,255,255,.18); padding-top: 28px;
}
.closing__credits .col span { display: block; }
.closing__credits .k { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.5); }
.closing__credits .v { margin-top: 6px; color: rgba(255,255,255,.92); }
.closing__credits .v a { border-bottom: 1px solid rgba(255,255,255,.3); }
.closing__wordmark {
  display: flex; align-items: center; gap: 12px;
  margin-top: clamp(40px, 8vh, 88px);
  font-family: var(--font-mono); font-weight: 700; letter-spacing: .04em; color: #fff;
}
.closing__wordmark .mark {
  width: 20px; height: 20px; border-radius: 50%;
  background: conic-gradient(#fff 0 50%, transparent 50% 100%); border: 1.5px solid #fff;
}
.closing__wordmark .exit { margin-left: auto; font-weight: 400; letter-spacing: .16em; color: rgba(255,255,255,.55); font-size: .72rem; }

/* ---------- 10. Section rhythm helpers used by Act II ---------- */
[data-handoff] {
  position: relative; z-index: 5; background: var(--bg);
  margin-top: calc(var(--handoff-overlap, clamp(56px, 11vh, 130px)) * -1);
}
[data-handoff]::before { /* soft seam so the film "hands off" instead of hard-cutting */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 40vh; pointer-events: none;
  background: linear-gradient(180deg, var(--bg) 0%, transparent 100%);
  transform: translateY(-100%);
}
.section--flush { padding-top: clamp(40px, 6vh, 80px); }
.eyebrow-accent { color: var(--accent); }

/* ---------- 11. Ambient sound toggle (subtle corner control) ---------- */
/* Fixed, above the grade, below nothing that matters. Hidden until a track
   exists (ambient.js manages [hidden]). Off by default. */
.sound-toggle {
  position: fixed; right: var(--pad); bottom: 22px; z-index: 46;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: 100px;
  background: color-mix(in srgb, var(--bg-elev) 82%, transparent);
  border: 1px solid var(--line-strong); color: var(--ink);
  font-family: var(--font-mono); font-size: .64rem; letter-spacing: .18em; text-transform: uppercase;
  cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: opacity .3s ease, transform .3s ease, border-color .3s ease;
}
.sound-toggle[hidden] { display: none; }
.sound-toggle:hover { transform: translateY(-1px); border-color: var(--accent); }
.sound-toggle__label { opacity: .7; }
.sound-toggle.is-on .sound-toggle__label { opacity: 1; }
.sound-toggle.is-on { border-color: var(--accent); }

/* equalizer bars: flat when off, dancing when on */
.sound-toggle .eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.sound-toggle .eq i {
  width: 2px; height: 4px; background: var(--ink-soft); border-radius: 1px;
  transform-origin: bottom;
}
.sound-toggle.is-on .eq i { background: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .sound-toggle.is-on .eq i { animation: eqBounce .9s ease-in-out infinite; }
  .sound-toggle.is-on .eq i:nth-child(2) { animation-duration: .62s; }
  .sound-toggle.is-on .eq i:nth-child(3) { animation-duration: 1.1s; }
  .sound-toggle.is-on .eq i:nth-child(4) { animation-duration: .78s; }
}
@keyframes eqBounce { 0%,100% { height: 4px; } 50% { height: 14px; } }
@media (max-width: 720px) { .sound-toggle { bottom: 14px; padding: 8px 12px; } .sound-toggle__label { display: none; } }
