/* ===================================================================
   swiftinventory.app — Stock Book
   The Red Swift house identity read as a ledger: ink navy, warm paper,
   red ink. Fraunces / Hanken Grotesk / JetBrains Mono. The wiki and the
   portal share these values via src/styles/base.css.
   =================================================================== */

:root {
  --bg:        #021622;
  --bg-2:      #041d2c;
  --bg-3:      #0a2a3a;
  --line:      rgba(244, 239, 230, 0.12);
  --line-2:    rgba(244, 239, 230, 0.24);
  --ink:       #f4efe6;
  --ink-2:     #b8beba;
  --ink-3:     #7d8a8e;
  --schematic: #9fb4c4;
  --red:       #ff0000;
  --red-dim:   rgba(255, 0, 0, 0.18);
  --paper:     #f4efe6;
  --card:      rgba(4, 29, 44, 0.55);

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --wrap: 1240px;
  --pad: clamp(20px, 5vw, 72px);
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--red); color: #fff; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }

/* --- Grid ground ---------------------------------------------------- */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 96px 96px;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 75%);
}
main, header, footer { position: relative; z-index: 1; }

/* --- Type ------------------------------------------------------------ */
.mono { font-family: var(--mono); }
.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--red); }
.eyebrow b { color: var(--ink-2); font-weight: 500; }

.h1 {
  font-family: var(--serif);
  font-size: clamp(40px, 5.4vw, 78px);
  line-height: 1.0;
  letter-spacing: -0.025em;
  font-weight: 600;
  text-wrap: balance;
}
.h1 em { font-style: italic; font-weight: 400; }
.h2 {
  font-family: var(--serif);
  font-size: clamp(30px, 3.8vw, 50px);
  line-height: 1.06;
  letter-spacing: -0.015em;
  font-weight: 600;
  text-wrap: balance;
}
.h3 { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.lead { font-size: clamp(17px, 1.6vw, 21px); color: var(--ink-2); max-width: 58ch; text-wrap: pretty; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }

/* --- Buttons --------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 12px;
  height: 48px; padding: 0 24px;
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  border: 1px solid var(--line-2); border-radius: 999px;
  color: var(--ink); background: transparent;
  transition: border-color .2s, background .2s, transform .2s;
}
.btn:hover { border-color: var(--ink-2); transform: translateY(-1px); }
.btn--primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn--primary:hover { background: #ff2e2e; border-color: #ff2e2e; }
.btn .k { font-size: 10px; opacity: .6; }

/* --- Header ---------------------------------------------------------- */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: 64px;
  display: flex; align-items: center;
  border-bottom: 1px solid transparent;
  transition: background .25s, border-color .25s, backdrop-filter .25s;
}
.header.scrolled { background: rgba(2, 22, 34, 0.88); border-color: var(--line); backdrop-filter: blur(12px); }
.header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; font-family: var(--serif); font-weight: 600; font-size: 20px; letter-spacing: -0.01em; }
.brand__mark { width: 30px; height: 30px; }
.brand__dom { color: var(--ink-2); }
.brand__dom b { color: var(--ink); font-weight: 500; }
.nav { display: flex; align-items: center; gap: 22px; }
.nav a { white-space: nowrap; font-size: 15px; font-weight: 500; color: var(--ink-2); transition: color .2s; }
.nav a:hover { color: var(--ink); }
.nav a .n { color: var(--ink-3); margin-right: 6px; }
.nav a.nav__cta { border: 1px solid var(--line-2); padding: 6px 16px; border-radius: 999px; color: var(--ink); }
.nav a.nav__cta:hover { background: var(--red); border-color: var(--red); }
.nav-toggle { display: none; width: 40px; height: 40px; position: relative; }
.nav-toggle span { position: absolute; left: 10px; right: 10px; height: 1px; background: var(--ink); transition: transform .25s, opacity .25s; }
.nav-toggle span:nth-child(1) { top: 15px; }
.nav-toggle span:nth-child(2) { top: 20px; }
.nav-toggle span:nth-child(3) { top: 25px; }
.header.menu-open .nav-toggle span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.header.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
.header.menu-open .nav-toggle span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* --- Hero ------------------------------------------------------------ */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid; align-items: center;
  padding: 120px 0 72px;
  overflow: hidden;
}
.hero__schematic {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  width: 100%; height: 100%;
  opacity: .55;
}
.hero__schematic svg { width: 100%; height: 100%; }
.hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: 1.25fr .75fr; gap: clamp(32px, 5vw, 80px); align-items: center; }
.hero__copy .lead { margin: 28px 0 36px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero__meta { margin-top: 44px; display: flex; flex-wrap: wrap; gap: 8px 28px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); letter-spacing: .04em; }
.hero__meta span::before { content: "— "; color: var(--red); }

/* --- Instrument (live readout) --------------------------------------- */
.instrument {
  position: relative;
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 22px 24px 20px;
  font-family: var(--mono);
  box-shadow: 0 30px 80px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.04);
}
.instrument::before, .instrument::after {
  content: ""; position: absolute; width: 10px; height: 10px; border: 1px solid var(--line-2);
}
.instrument::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.instrument::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.inst__head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.inst__link { display: inline-flex; align-items: center; gap: 8px; }
.inst__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; box-shadow: 0 0 0 var(--red); } }
.inst__reading { display: flex; align-items: baseline; gap: 14px; margin: 18px 0 6px; }
.inst__g { font-size: clamp(56px, 6vw, 84px); line-height: 1; letter-spacing: -0.04em; font-weight: 400; font-variant-numeric: tabular-nums; min-width: 4.2ch; }
.inst__unit { font-size: 22px; color: var(--ink-3); }
.inst__flags { display: flex; gap: 8px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.flag { padding: 4px 8px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink-3); transition: all .25s; }
.flag.is-on { border-color: var(--red); color: var(--ink); background: var(--red-dim); }
.inst__product { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line-2); font-size: 13px; color: var(--ink-2); display: grid; gap: 4px; }
.inst__product b { color: var(--ink); font-weight: 500; }
.inst__product .row { display: flex; justify-content: space-between; gap: 12px; }
.inst__product .row span:last-child { color: var(--ink-3); white-space: nowrap; }
.inst__bar { margin-top: 16px; height: 8px; border: 1px solid var(--line-2); border-radius: 2px; position: relative; overflow: hidden; }
.inst__bar i { position: absolute; inset: 0; width: 0%; background: var(--ink-2); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.inst__bar i::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 2px; background: var(--red); }
.inst__result { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; font-size: 13px; color: var(--ink-3); }
.inst__result b { font-size: 26px; color: var(--ink); font-weight: 400; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.inst__result b small { font-size: 13px; color: var(--ink-3); margin-left: 6px; }
.inst__foot { margin-top: 16px; display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); letter-spacing: .06em; }
.inst__foot .batt { display: inline-flex; align-items: center; gap: 8px; }
.batt__cell { width: 22px; height: 10px; border: 1px solid var(--ink-3); border-radius: 2px; position: relative; }
.batt__cell::after { content: ""; position: absolute; right: -4px; top: 2px; width: 2px; height: 4px; background: var(--ink-3); }
.batt__cell i { position: absolute; left: 1px; top: 1px; bottom: 1px; width: 80%; background: var(--ink-2); }

/* --- Ticker ---------------------------------------------------------- */
.ticker { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; background: rgba(12,15,18,.6); }
.ticker__track { display: flex; width: max-content; animation: ticker 48s linear infinite; }
.ticker__track:hover { animation-play-state: paused; }
.ticker__item { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); padding: 14px 28px; white-space: nowrap; display: inline-flex; align-items: center; gap: 28px; }
.ticker__item::after { content: "◆"; font-size: 7px; color: var(--red); }
@keyframes ticker { to { transform: translateX(-50%); } }

/* --- Sections -------------------------------------------------------- */
.section { padding: clamp(72px, 10vw, 140px) 0; border-top: 1px solid var(--line); position: relative; }
.section__head { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: end; margin-bottom: clamp(36px, 5vw, 64px); }
.section__head .lead { justify-self: end; }
.section__idx { position: absolute; top: 24px; right: var(--pad); font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: .12em; }

/* --- Film ------------------------------------------------------------ */
.film { --frame: #0a0c0f; }
.film__stage {
  position: relative;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  overflow: hidden;
  background: var(--frame);
  aspect-ratio: 16 / 9;
  box-shadow: 0 40px 120px rgba(0,0,0,.5);
}
.film__stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.film__stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.film__grain { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s; mix-blend-mode: multiply; }
.film__grain svg { width: 100%; height: 100%; }
.film__stage[data-era="old"] .film__grain { opacity: .9; }
.film__stage[data-era="mid"] .film__grain { opacity: .45; }
.film__stage[data-era="now"] .film__grain { opacity: 0; }
.film__vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%); opacity: 0; transition: opacity 1.2s; }
.film__stage[data-era="old"] .film__vignette, .film__stage[data-era="mid"] .film__vignette { opacity: 1; }

/* scene layer & era look. CSS filter functions interpolate; SVG url() ones don't. */
.film__scenes { position: absolute; inset: 0; transition: filter 1.6s ease; }
.film__stage[data-era="old"] .film__scenes { filter: sepia(.85) contrast(1.12) brightness(.96) saturate(.35); }
.film__stage[data-era="mid"] .film__scenes { filter: sepia(.35) contrast(1.04) saturate(.7); }
.film__stage[data-era="now"] .film__scenes { filter: none; }
.film__stage[data-era="old"] .film__scenes svg { animation: flicker .18s steps(2) infinite, jitter 1.1s steps(3) infinite; }
@keyframes flicker { 0% { opacity: 1; } 50% { opacity: .93; } 100% { opacity: .98; } }
@keyframes jitter { 0% { transform: translate(0,0); } 33% { transform: translate(0,.6px); } 66% { transform: translate(-.5px,0); } 100% { transform: translate(0,0); } }

.scene { opacity: 0; transition: opacity .9s ease; pointer-events: none; }
.scene.is-active { opacity: 1; }

/* caption (HTML, above the svg) */
.film__caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  padding: 22px 26px 18px;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  padding-top: 80px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.55) 45%, rgba(0,0,0,.82));
  color: #fff;
}
.cap__year { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; color: rgba(255,255,255,.7); text-transform: uppercase; }
.cap__title { font-family: var(--serif); font-size: clamp(18px, 2.2vw, 28px); font-weight: 500; letter-spacing: -0.02em; margin-top: 4px; }
.cap__line { font-size: 14px; color: rgba(255,255,255,.75); margin-top: 4px; max-width: 56ch; }
.cap__fade { transition: opacity .45s; }
.cap__fade.is-out { opacity: 0; }

/* controls */
.film__ctrl { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; margin-top: 18px; }
.film__play { width: 44px; height: 44px; border: 1px solid var(--line-2); border-radius: 50%; display: grid; place-items: center; transition: border-color .2s; }
.film__play:hover { border-color: var(--ink-2); }
.film__play svg { width: 14px; height: 14px; fill: var(--ink); }
.film__play .ic-pause { display: none; }
.film__play.is-playing .ic-pause { display: block; }
.film__play.is-playing .ic-play { display: none; }
.chapters { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.chapter { text-align: left; position: relative; padding-top: 12px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--ink-3); text-transform: uppercase; transition: color .2s; }
.chapter::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--line-2); }
.chapter::after { content: ""; position: absolute; top: 0; left: 0; width: 0%; height: 2px; background: var(--red); transition: width .25s linear; }
.chapter.is-done::after { width: 100%; background: var(--ink-3); }
.chapter.is-active { color: var(--ink); }
.chapter.is-active::after { width: var(--p, 0%); }
.chapter b { display: block; color: inherit; font-weight: 500; margin-top: 2px; text-transform: none; letter-spacing: 0; font-family: var(--sans); font-size: 13px; }
.film__note { margin-top: 20px; font-size: 13px; color: var(--ink-3); font-family: var(--mono); }

/* --- How it works: signal path --------------------------------------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; background: rgba(17,21,26,.6); }
.step { padding: 32px 30px 34px; border-right: 1px solid var(--line-2); position: relative; }
.step:last-child { border-right: 0; }
.step__num { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--red); }
.step__icon { margin: 20px 0 22px; height: 84px; }
.step__icon svg { height: 84px; width: auto; overflow: visible; }
.step__title { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 10px; }
.step__text { color: var(--ink-2); font-size: 15.5px; }
.step__io { margin-top: 18px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); display: grid; gap: 4px; }
.step__io span b { color: var(--ink-2); font-weight: 500; }
.step::after { content: "→"; position: absolute; right: -11px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; background: var(--bg-3); border: 1px solid var(--line-2); font-size: 11px; display: grid; place-items: center; color: var(--ink-2); z-index: 2; }
.step:last-child::after { display: none; }

.formula { margin-top: 28px; display: grid; grid-template-columns: 1.2fr .8fr; gap: 32px; align-items: start; }
.formula pre { font-family: var(--mono); font-size: 14px; line-height: 1.8; color: var(--ink-2); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 22px 24px; overflow-x: auto; }
.formula pre b { color: var(--ink); font-weight: 500; }
.formula pre i { color: var(--ink-3); font-style: normal; }
.formula pre .r { color: var(--red); }
.formula__notes { font-size: 15px; color: var(--ink-2); display: grid; gap: 14px; }
.formula__notes li { padding-left: 18px; position: relative; }
.formula__notes li::before { content: ""; position: absolute; left: 0; top: 10px; width: 8px; height: 1px; background: var(--red); }

/* --- Ecosystem ------------------------------------------------------- */
.eco { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.eco__card { padding: 24px 24px 22px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); display: grid; gap: 10px; align-content: start; transition: border-color .2s, transform .2s; }
.eco__card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.eco__k { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); display: flex; justify-content: space-between; }
.eco__k i { font-style: normal; color: var(--red); }
.eco__t { font-family: var(--serif); font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
.eco__d { font-size: 14.5px; color: var(--ink-2); }
.eco__dom { font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.rule { margin-top: 28px; padding: 18px 22px; border-left: 2px solid var(--red); font-size: 15px; color: var(--ink-2); max-width: 70ch; }
.rule b { color: var(--ink); font-weight: 500; }

/* --- Access ---------------------------------------------------------- */
.access { text-align: left; }
.access__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.access__form { display: grid; gap: 12px; }
.access__row { display: flex; gap: 10px; }
.access input { flex: 1; height: 48px; padding: 0 16px; font-family: var(--mono); font-size: 14px; color: var(--ink); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); outline: none; }
.access input:focus { border-color: var(--ink-2); }
.access__hint { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.access__hint a { color: var(--ink-2); border-bottom: 1px solid var(--line-2); }
.stores { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.store { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 10px 14px; border: 1px dashed var(--line-2); border-radius: var(--radius); }

/* --- Footer ---------------------------------------------------------- */
.footer { border-top: 1px solid var(--line); padding: 40px 0 48px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; align-items: center; }
.footer a { color: var(--ink-2); }
.footer a:hover { color: var(--ink); }
.footer__brand { display: inline-flex; align-items: center; gap: 10px; }
.footer__brand svg { width: 22px; height: 22px; }

/* --- Reveal ---------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s ease; }
.reveal.is-in { opacity: 1; transform: none; }

/* --- Schematic line animation ---------------------------------------- */
.flow { stroke-dasharray: 4 10; animation: flow 1.4s linear infinite; }
.flow--slow { animation-duration: 2.6s; }
@keyframes flow { to { stroke-dashoffset: -28; } }
.blink { animation: blink 2.4s steps(1) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.spin { transform-origin: center; transform-box: fill-box; animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Responsive ------------------------------------------------------ */
@media (max-width: 1200px) {
  .brand__dom span { display: none; }
}
@media (max-width: 1024px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .section__head { grid-template-columns: 1fr; }
  .section__head .lead { justify-self: start; }
  .steps { grid-template-columns: 1fr; }
  .step { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .step:last-child { border-bottom: 0; }
  .step::after { right: auto; left: 30px; top: auto; bottom: -11px; transform: rotate(90deg); }
  .formula, .access__grid { grid-template-columns: 1fr; }
  .eco { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav { position: fixed; inset: 64px 0 0; background: var(--bg); flex-direction: column; align-items: flex-start; padding: 32px var(--pad); gap: 22px; transform: translateX(100%); transition: transform .3s; }
  .nav.is-open { transform: none; }
  .nav a { font-size: 15px; }
  .nav-toggle { display: block; }
  .hero { padding-top: 100px; }
  .chapters { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .chapter b { display: none; }
  .eco { grid-template-columns: 1fr; }
  .film__caption { padding: 14px 16px 12px; }
  .cap__line { display: none; }
  .brand__dom span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .flow, .blink, .spin, .ticker__track, .inst__dot { animation: none !important; }
  .film__stage[data-era="old"] .film__scenes svg { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ===================================================================
   Film scene choreography. Animations start when .is-active lands.
   =================================================================== */
.scene .s1-w { width: 0; }
.scene.is-active .s1-w { animation: s1write 1.1s var(--d, 0s) linear forwards; }
@keyframes s1write { to { width: 380px; } }
.scene .s1-pen { transform: translate(-360px, 70px); }
.scene.is-active .s1-pen { animation: s1pen 9s linear forwards; }
@keyframes s1pen {
  0%   { transform: translate(-360px, 70px); }
  7%   { transform: translate(-360px, 70px); }
  19%  { transform: translate(-60px, 70px); }
  21%  { transform: translate(-360px, 104px); }
  32%  { transform: translate(-80px, 104px); }
  34%  { transform: translate(-360px, 138px); }
  45%  { transform: translate(-30px, 138px); }
  47%  { transform: translate(-360px, 172px); }
  58%  { transform: translate(-60px, 172px); }
  62%  { transform: translate(20px, 70px); }
  73%  { transform: translate(300px, 70px); }
  74%  { transform: translate(20px, 104px); }
  84%  { transform: translate(330px, 104px); }
  85%  { transform: translate(20px, 138px); }
  90%  { transform: translate(90px, 138px); }
  100% { transform: translate(120px, 120px); }
}
.s1-flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flame .35s ease-in-out infinite alternate; }
@keyframes flame { from { transform: scale(1, 1); } to { transform: scale(.9, 1.12) translateX(1px); } }

.scene .s2-guess { opacity: 0; }
.scene.is-active .s2-guess { animation: s2guess 1.6s var(--d, 0s) ease forwards; }
@keyframes s2guess { 0% { opacity: 0; transform: translateX(-10px); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; } }
.scene .s2-q { opacity: 0; transform-box: fill-box; transform-origin: center; }
.scene.is-active .s2-q { animation: s2q 1.4s 5.4s cubic-bezier(.2,1.4,.4,1) forwards; }
@keyframes s2q { from { opacity: 0; transform: scale(.4) rotate(-12deg); } to { opacity: 1; transform: none; } }
.s2-rays { animation: rays 2.2s ease-in-out infinite alternate; }
@keyframes rays { to { opacity: .25; } }
.scene .s2-hold { transform-box: fill-box; transform-origin: 90% 100%; }
.scene.is-active .s2-hold { animation: s2hold 7s ease-in-out infinite alternate; }
@keyframes s2hold { from { transform: rotate(-1deg); } to { transform: rotate(1.2deg); } }

.scene .s3-bottle { transform-box: view-box; transform-origin: 700px 280px; transform: rotate(50deg) translate(0, 40px); opacity: 0; }
.scene.is-active .s3-bottle { animation: s3tilt 1.6s .3s cubic-bezier(.3,.7,.2,1) forwards; }
@keyframes s3tilt { to { transform: none; opacity: 1; } }
.scene .s3-stream { stroke-dasharray: 600; stroke-dashoffset: 600; }
.scene.is-active .s3-stream { animation: s3stream 1s 1.7s linear forwards, s3streamOut .6s 5.8s linear forwards; }
@keyframes s3stream { to { stroke-dashoffset: 0; } }
@keyframes s3streamOut { to { stroke-dashoffset: -600; } }
.scene .s3-fill { y: 710px; height: 0; }
.scene.is-active .s3-fill { animation: s3fill 3.6s 2.2s ease-out forwards; }
@keyframes s3fill { to { y: 452px; height: 258px; } }
.scene .s3-read, .scene .s3-read2 { opacity: 0; }
.scene.is-active .s3-read { animation: fadeIn .5s 5.6s forwards; }
.scene.is-active .s3-read2 { animation: fadeIn .5s 7.2s forwards; }
@keyframes fadeIn { to { opacity: 1; } }

.s4-tube { animation: tube 3s steps(1) infinite; }
@keyframes tube { 0%,100% { opacity: 1; } 43% { opacity: .75; } 45% { opacity: 1; } 71% { opacity: .85; } 72% { opacity: 1; } }
.scene .s4-tick { stroke-dasharray: 60; stroke-dashoffset: 60; }
.scene.is-active .s4-tick { animation: s4tick .5s var(--d, 0s) ease-out forwards; }
@keyframes s4tick { to { stroke-dashoffset: 0; } }
.scene .s4-scribble { opacity: 0; }
.scene.is-active .s4-scribble { animation: fadeIn .4s calc(5.6s + var(--d, 0s)) forwards; }
.scene .s4-calc { transform-box: fill-box; transform-origin: center; }
.scene.is-active .s4-calc { animation: calc 6.6s steps(1) forwards; }
@keyframes calc { 0%,90% { transform: none; } 92% { transform: rotate(1deg); } 94% { transform: none; } }

.scene .s5-bottle { transform: translateY(-140px); opacity: 0; }
.scene.is-active .s5-bottle { animation: s5drop 1.2s .4s cubic-bezier(.3,.8,.3,1) forwards; }
@keyframes s5drop { to { transform: none; opacity: 1; } }
.scene .s5-scale { transform-box: fill-box; transform-origin: center; }
.scene.is-active .s5-scale { animation: s5press .5s 1.5s ease-out; }
@keyframes s5press { 40% { transform: translateY(2px); } }
.scene .s5-ble path { opacity: 0; }
.scene.is-active .s5-ble path { animation: bleOut 1.6s 1.8s ease-out infinite; }
.scene.is-active .s5-ble path:nth-child(2) { animation-delay: 2.1s; }
.scene.is-active .s5-ble path:nth-child(3) { animation-delay: 2.4s; }
@keyframes bleOut { 0% { opacity: 0; } 30% { opacity: .9; } 100% { opacity: 0; } }
.scene .s5-tablet { opacity: 0; transform: translateX(20px); }
.scene.is-active .s5-tablet { animation: s5tab .8s .9s ease-out forwards; }
@keyframes s5tab { to { opacity: 1; transform: none; } }
.s5-led { animation: pulse 1.6s ease-in-out infinite; }
.gauge { animation: gauge 2.4s ease-in-out infinite alternate; }
@keyframes gauge { to { opacity: .35; } }


/* --- Paper sections: the ledger page ---------------------------------- */
.section--paper {
  --ink: #021622;
  --ink-2: rgba(2, 22, 34, 0.74);
  --ink-3: rgba(2, 22, 34, 0.58);
  --line: rgba(2, 22, 34, 0.12);
  --line-2: rgba(2, 22, 34, 0.26);
  --bg-2: #ece4d6;
  --bg-3: #e3d9c6;
  --card: #fbf8f2;
  --red: #c40000;
  background: var(--paper);
  color: var(--ink);
}
.section--paper .section__head { border-top: 3px double var(--ink); padding-top: 28px; }
.section--paper .btn--primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.section--paper .btn--primary:hover { background: #0a2a3a; border-color: #0a2a3a; }
.hero__actions .btn--quiet { border-color: transparent; padding: 0 8px; text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 5px; }
