/* Cinematic layer shared by every product page: night palette, three type roles, cover, acts, scroll scenes, figures and tables. Loaded after landing.css. */

:root {
  --ink: #07080c;
  --ink-2: #0c0e14;
  --graphite: #12141b;
  --paper: #f1ede4;
  --paper-2: #e3ddd0;
  --text: #f1ede4;
  --muted: #9aa1ae;
  --faint: #838a99;
  --line: rgba(241, 237, 228, 0.1);
  --line-strong: rgba(241, 237, 228, 0.2);
  --blue: #ff5b1f;
  --blue-deep: #1a0700;
  --blue-text: #ff7a45;
  --ember: #ff5b1f;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Source Serif Pro", Georgia, serif;
  --wrap: 1200px;
}

body { background: var(--ink); color: var(--text); }
::selection { background: var(--ember); color: var(--blue-deep); }
.nav { background: rgba(7, 8, 12, 0.66); }
.nav-links a { white-space: nowrap; }
@media (min-width: 901px) and (max-width: 1180px) { .nav-links { gap: 16px; font-size: 13.5px; } }
@media (max-width: 900px) { .nav-links { background: rgba(7, 8, 12, 0.97); } }
.btn-primary:hover { background: #ff7a45; }
.eyebrow, .kicker { color: var(--ember); font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 500; }
.sec-head p.eyebrow, .sec-head p.kicker { font-size: 12px; color: var(--ember); margin-top: 0; max-width: none; }
.kicker { display: inline-flex; gap: 12px; align-items: center; }
.sec-head h2, .final h2, .act h2, .cover h1, .pin-copy h2 { font-family: var(--display); font-weight: 500; letter-spacing: -0.02em; }
.sec-head h2 { font-size: clamp(34px, 4.6vw, 64px); line-height: 1.02; }
.sec-head h2 span { color: var(--muted); font-style: italic; }
.final h2 { font-size: clamp(46px, 8.4vw, 116px); }
.sec + section.sec[aria-labelledby] { padding-top: 0; }
.sec-alt { background: linear-gradient(180deg, var(--ink) 0%, #0b0c12 18%, #0b0c12 82%, var(--ink) 100%); }
.card, .panel, .tile, .stage, .term, .code, .entry, .builder, .proto > div, .fact, .track-item { border-color: var(--line) !important; }
.card, .panel, .builder, .term, .code { background: rgba(241, 237, 228, 0.025); }
.link { color: var(--ember); }
.chip { border-color: var(--line-strong); color: var(--muted); }
.note { color: var(--faint); }
.bar-fill { background: var(--ember); }
.fact b, .card-k { font-family: var(--display); font-weight: 400; }
.fact b { color: var(--ember); letter-spacing: -0.02em; }

/* Former paper sections now sit on the night ground: lift their dark-on-light details. */
.shift, .shift-row, .facts, .fact, .fact + .fact { border-color: var(--line) !important; }
.shift-row > :first-child { color: var(--faint); text-decoration-color: rgba(241, 237, 228, 0.3); }
.shift-labels { color: var(--faint); }
.panel > p, .fact p, .nums span { color: var(--muted); }
.bar-group > b { color: var(--faint); }
.bar-track { background: rgba(241, 237, 228, 0.08); }
.shot-paper { border-color: var(--line); box-shadow: 0 40px 90px -50px rgba(255, 91, 31, 0.25); }
.shot-paper figcaption { color: var(--faint); border-top-color: var(--line); }

/* Cover: one screen, big title, act index as jump menu, scroll cue. */
.cover { position: relative; min-height: 100svh; display: grid; align-items: end; padding: 120px 0 clamp(48px, 7vh, 88px); overflow: hidden; isolation: isolate; }
.cover > canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: 0.85; }
.cover::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(90deg, rgba(7, 8, 12, 0.82) 0%, rgba(7, 8, 12, 0.5) 38%, transparent 62%), radial-gradient(120% 80% at 70% 30%, transparent 40%, var(--ink) 92%), linear-gradient(180deg, transparent 55%, var(--ink)); }
.cover h1 { font-size: clamp(46px, min(10.5vw, 13svh), 156px); line-height: 0.92; margin-top: 22px; max-width: 13ch; }
.cover h1 em { font-style: italic; color: var(--ember); }
.cover-sub { margin-top: 26px; max-width: 640px; color: var(--muted); font-size: clamp(17px, 1.6vw, 20px); }
.cover .hero-cta { margin-top: 30px; }
.acts-index { margin-top: clamp(28px, 5vh, 64px); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-strong); }
.acts-index a { display: grid; gap: 6px; padding: 16px 18px 4px 0; text-decoration: none; color: var(--muted); border-top: 2px solid transparent; margin-top: -1px; transition: color 0.25s, border-color 0.25s; }
.acts-index a:hover, .acts-index a:focus-visible { color: var(--text); border-top-color: var(--ember); }
.roman { font-family: var(--display); font-style: italic; color: var(--ember); font-size: 22px; line-height: 1; }
.acts-index span:last-child { font-size: 14px; line-height: 1.35; }
.scroll-cue { position: absolute; right: var(--gutter); bottom: clamp(48px, 7vh, 88px); display: grid; justify-items: center; gap: 10px; font: 500 11px/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); text-decoration: none; writing-mode: vertical-rl; }
.scroll-cue i { width: 1px; height: 64px; background: linear-gradient(var(--ember), transparent); animation: cue 2.4s ease-in-out infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* Act openers: numeral, kicker, display title and a hairline that fills with the act's scroll progress. */
.act { position: relative; padding: clamp(120px, 18vh, 200px) 0 clamp(36px, 6vh, 64px); }
.act-in { display: grid; grid-template-columns: minmax(0, 0.32fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 64px); align-items: end; }
.act-num { font-family: var(--display); font-style: italic; font-size: clamp(96px, 16vw, 230px); line-height: 0.8; color: transparent; -webkit-text-stroke: 1px rgba(255, 91, 31, 0.7); }
.act h2 { font-size: clamp(40px, 6.2vw, 92px); line-height: 0.98; margin-top: 14px; max-width: 14ch; }
.act-lead { margin-top: 20px; color: var(--muted); max-width: 620px; font-size: clamp(17px, 1.5vw, 19px); }
.act-line { margin-top: clamp(36px, 6vh, 60px); height: 1px; background: var(--line-strong); position: relative; overflow: hidden; }
.act-line::after { content: ""; position: absolute; inset: 0; background: var(--ember); transform-origin: left; transform: scaleX(var(--p, 0)); }

/* Act rail: fixed position indicator generated from the act openers. */
.rail { position: fixed; left: var(--gutter); bottom: 22px; z-index: 40; display: flex; gap: 12px; align-items: center; font: 500 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); opacity: 0; transform: translateY(8px); transition: opacity 0.4s, transform 0.4s; pointer-events: none; background: rgba(7, 8, 12, 0.78); backdrop-filter: blur(10px); padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); max-width: calc(100% - 2 * var(--gutter)); }
.rail.on { opacity: 1; transform: none; }
.rail b { font: italic 500 16px/1 var(--display); color: var(--ember); letter-spacing: 0; }
.rail span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-bar { flex: none; width: 72px; height: 2px; background: var(--line-strong); position: relative; }
.rail-bar i { position: absolute; inset: 0; background: var(--ember); transform-origin: left; transform: scaleX(var(--p, 0)); }

/* Pinned scroll scene: a tall section whose sticky stage draws with --p (0..1). */
.scene { position: relative; height: var(--len, 260vh); }
.scene-stick { position: sticky; top: 0; height: 100svh; display: grid; align-items: center; overflow: hidden; }
.scene-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(24px, 5vw, 72px); align-items: center; }
.scene-cv { width: 100%; aspect-ratio: 1 / 1; max-height: 78svh; }
.scene-copy h2 { font-family: var(--display); font-weight: 500; font-size: clamp(32px, 4.2vw, 58px); line-height: 1.02; margin-top: 16px; }
.scene-copy h2 span { color: var(--muted); font-style: italic; }
.scene-copy > p:not(.scene-figure) { margin-top: 18px; color: var(--muted); max-width: 520px; }
.scene-beats { margin: 28px 0 0; padding: 0; display: grid; gap: 10px; }
.scene-beats li { list-style: none; padding-left: 18px; border-left: 2px solid var(--line-strong); color: var(--faint); transition: color 0.35s, border-color 0.35s; }
.scene-beats li.on { color: var(--text); border-left-color: var(--ember); }
.scene-figure { margin-top: 26px; font: 400 clamp(54px, 7vw, 104px)/0.9 var(--display); color: var(--ember); font-variant-numeric: tabular-nums lining-nums; }
.scene-figure + small { display: block; margin-top: 10px; font: 500 11px/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* Screenshot scene: real product views that swap with the active beat; a framed still for single views. */
.scene-shots { position: relative; aspect-ratio: 16 / 10; }
.scene-shots > figure { position: absolute; inset: 0; margin: 0; opacity: 0; transform: translateY(14px) scale(0.985); transition: opacity 0.5s ease, transform 0.6s ease; }
.scene-shots > figure.on { opacity: 1; transform: none; }
.frame { margin: 0; border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden; background: #0d0f15; box-shadow: 0 50px 120px -60px rgba(255, 91, 31, 0.35); }
.frame img, .frame video { display: block; width: 100%; height: auto; }
.frame figcaption { padding: 10px 14px; font: 500 11px/1.4 var(--mono); letter-spacing: 0.06em; color: var(--faint); border-top: 1px solid var(--line); }
.scene-shots .frame img { aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; }
.static .scene-shots { aspect-ratio: auto; display: grid; gap: 18px; }
.static .scene-shots > figure { position: relative; opacity: 1; transform: none; }

/* Oversized figures with captions; counters climb with scroll. */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: clamp(36px, 5vw, 56px); }
.figure { background: var(--ink); padding: clamp(22px, 3vw, 34px); }
.figure b { display: block; font: 400 clamp(56px, 7.4vw, 108px)/0.9 var(--display); letter-spacing: -0.03em; color: var(--text); font-variant-numeric: tabular-nums lining-nums; }
.figure b.ember { color: var(--ember); }
.figure span { display: block; margin-top: 14px; color: var(--muted); font-size: 15px; max-width: 30ch; }

b[data-count] > span, p[data-count] > span { display: inline; margin: 0; font: inherit; color: inherit; letter-spacing: inherit; max-width: none; }

/* Equation rows: A × B = C with captions under each term. */
.eq { display: flex; flex-wrap: wrap; align-items: flex-start; gap: clamp(12px, 2.4vw, 30px); margin-top: clamp(36px, 5vw, 56px); padding: clamp(22px, 3vw, 36px) 0; border-block: 1px solid var(--line); }
.eq > i { font: 400 clamp(32px, 4.4vw, 64px)/1 var(--display); color: var(--ember); align-self: flex-start; margin-top: clamp(2px, 0.6vw, 8px); }
.eq-t { display: grid; gap: 10px; min-width: 0; }
.eq-t b { font: 400 clamp(36px, 5.4vw, 80px)/0.95 var(--display); letter-spacing: -0.02em; }
.eq-t small { font: 500 11px/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); max-width: 22ch; }
.eq-t.res b { color: var(--ember); }
.eq-note { margin-top: 14px; color: var(--faint); font-size: 14px; }

/* Comparison table and split cards for two paths. */
.compare { width: 100%; border-collapse: collapse; margin-top: clamp(32px, 4vw, 48px); font-size: 15.5px; }
.compare th, .compare td { text-align: left; vertical-align: top; padding: 18px 18px 18px 0; border-bottom: 1px solid var(--line); }
.compare thead th { font: 500 11px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.compare td:first-child { color: var(--faint); width: 22%; }
.compare td:nth-child(2) { color: var(--muted); }
.compare td:last-child { color: var(--text); }
.compare td:last-child::before { content: "→ "; color: var(--ember); }
.compare.plain td:last-child::before { content: none; }
.compare.plain td:nth-child(2) { color: var(--text); }
.split2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: clamp(32px, 4vw, 48px); }
.split2 > div { background: var(--ink); padding: clamp(24px, 3.4vw, 42px); }
.split2 h2, .split2 h3 { font: 500 clamp(24px, 2.6vw, 34px)/1.1 var(--display); margin-top: 14px; }
.split2 p { margin-top: 14px; color: var(--muted); }
.split2 ol { margin: 18px 0 0; padding-left: 20px; color: var(--muted); display: grid; gap: 6px; }
.split2 > div:last-child .kicker { color: var(--text); }

/* Blockquote set as a pull line. */
.pull { margin: clamp(56px, 8vw, 110px) auto 0; max-width: 980px; text-align: center; }
.pull p { font: italic 400 clamp(28px, 4vw, 54px)/1.14 var(--display); letter-spacing: -0.01em; }
.pull p::before { content: "“"; color: var(--ember); }
.pull p::after { content: "”"; color: var(--ember); }
.pull cite { display: block; margin-top: 20px; font: 500 11px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); font-style: normal; }

/* Scroll-linked rise: an element fades up as its own --p moves from 0 to 1. */
.js .rise { opacity: min(1, calc(var(--p, 0) * 2)); transform: translateY(calc((1 - min(1, var(--p, 0) * 2)) * 28px)); }

@media (max-width: 900px) {
  .acts-index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .act-in, .scene-grid { grid-template-columns: 1fr; }
  .act-num { font-size: 96px; }
  .scene-cv { max-height: 38svh; aspect-ratio: auto; height: 38svh; }
  .scene-stick { align-items: start; padding-top: 84px; }
  .cover > canvas { opacity: 0.4; }
  .scene-copy > p:not(.scene-figure):not(.kicker) { font-size: 14px; margin-top: 8px; }
  .scene-copy h2 { font-size: 28px; margin-top: 8px; }
  .scene-beats { margin-top: 12px; gap: 6px; }
  .scene-beats li { font-size: 14px; }
  .scene-figure { margin-top: 12px; font-size: 52px; }
  .split2 { grid-template-columns: 1fr; }
  .compare thead { display: none; }
  .compare tr { display: grid; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .compare td { border: 0; padding: 3px 0; width: auto !important; }
  .scroll-cue { display: none; }
  .scene-shots .frame figcaption { display: none; }
  .rail { bottom: 12px; }
}

/* Short phone screens: scenes scroll as normal sections and still draw with their passing progress. */
@media (max-width: 900px) and (max-height: 700px) {
  .scene { height: auto; }
  .scene-stick { position: relative; height: auto; padding-block: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-cue i { animation: none; }
  .js .rise { opacity: 1; transform: none; }
  .scene { height: auto; }
  .scene-stick { position: relative; height: auto; padding-block: 72px; }
  .act-line::after { transform: none; }
  .rail, .scene-beats li { transition: none; }
}
