/* ============================================================
   Manuscript Noir — Design System (the constant DNA)
   warm-dark editorial · sharp edges · hairline rules
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Manrope:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&family=Noto+Serif+SC:wght@700;900&family=Space+Mono:wght@400;700&display=swap');

:root {
  /* ---- palette (oklch) ---- */
  --bg:         oklch(0.15 0.012 60);
  --surface:    oklch(0.19 0.015 60);
  --ink:        oklch(0.93 0.015 85);
  --ink-muted:  oklch(0.66 0.02 75);
  --line:       oklch(0.93 0.015 85 / 0.14);
  --accent:     oklch(0.78 0.13 65);   /* ember gold */
  --accent-2:   oklch(0.58 0.16 25);   /* ink red */

  /* ---- typography ---- */
  --font-display: "Instrument Serif", "Noto Serif SC", serif;
  --font-cjk-display: "Noto Serif SC", "Instrument Serif", serif;
  --font-body: "Manrope", "Noto Sans SC", sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;

  /* ---- 8px spacing scale ---- */
  --s1: 8px;  --s2: 16px; --s3: 24px; --s4: 32px;
  --s5: 48px; --s6: 64px; --s7: 96px; --s8: 128px; --s9: 192px;

  --radius: 2px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ============================================================
   Runtime stage — fixed 1920x1080, JS-scaled, letterboxed
   ============================================================ */
#viewport {
  position: fixed; inset: 0;
  background: oklch(0.09 0.008 60);
  display: flex; align-items: center; justify-content: center;
}
.stage {
  position: relative;
  flex: 0 0 auto;
  width: 1920px; height: 1080px;
  transform-origin: center center;
  background: var(--bg);
  overflow: hidden;
}

.slide {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden;
  pointer-events: none;
  transition: opacity 0.55s ease;
}
.slide.is-active {
  opacity: 1; visibility: visible;
  pointer-events: auto;
}

/* per-slide screen label (mono kicker, shared primitive) */
.screen-label {
  position: absolute; top: var(--s5); left: var(--s7);
  font-family: var(--font-mono); font-size: 15px;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--ink-muted);
}
.screen-mark {
  position: absolute; top: var(--s5); right: var(--s7);
  font-family: var(--font-mono); font-size: 15px;
  letter-spacing: 0.28em; color: var(--accent);
  opacity: 0.85;
}

/* ============================================================
   Ambient layers (focal slides only) — grain + light pool
   ============================================================ */
.grain {
  position: absolute; inset: 0; pointer-events: none;
  opacity: 0.5; mix-blend-mode: overlay;
  background-image:
    repeating-linear-gradient(0deg,
      oklch(1 0 0 / 0.015) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg,
      oklch(0 0 0 / 0.02) 0 1px, transparent 1px 3px);
}
.lightpool {
  position: absolute; inset: -20%; pointer-events: none;
  background: radial-gradient(closest-side,
    oklch(0.78 0.13 65 / 0.16), oklch(0.78 0.13 65 / 0) 70%);
  width: 1100px; height: 1100px;
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift {
  0%   { transform: translate(8%, 4%)  scale(1);   }
  50%  { transform: translate(46%, 22%) scale(1.18); }
  100% { transform: translate(28%, 40%) scale(1.05); }
}

/* ============================================================
   Nav controls — OUTSIDE the scaled stage (fixed)
   ============================================================ */
.nav {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--s3);
  z-index: 100;
  font-family: var(--font-mono);
}
.nav button {
  appearance: none; cursor: pointer;
  background: oklch(0.19 0.015 60 / 0.85);
  border: 1px solid var(--line);
  color: var(--ink);
  width: 46px; height: 46px;
  font-size: 18px; line-height: 1;
  border-radius: var(--radius);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  backdrop-filter: blur(8px);
}
.nav button:hover { border-color: var(--accent); color: var(--accent); }
.nav .counter {
  color: var(--ink-muted); font-size: 14px;
  letter-spacing: 0.18em; min-width: 92px; text-align: center;
}
.nav .counter b { color: var(--ink); font-weight: 700; }

/* ============================================================
   Entrance motion primitives (declared vocabulary)
   ============================================================ */
.reveal { opacity: 0; transform: translateY(22px); }
.slide.is-active .reveal {
  animation: fadeUp 0.85s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* char-by-char title reveal */
.char {
  display: inline-block; opacity: 0;
  transform: translateY(0.32em) rotate(2deg);
}
.slide.is-active .char {
  animation: charIn 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: calc(var(--ci, 0) * 0.085s + 0.15s);
}
@keyframes charIn {
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  .lightpool { animation: none; }
  .slide.is-active .reveal,
  .slide.is-active .char { animation: none; }
  .reveal { opacity: 1; transform: none; }
  .char   { opacity: 1; transform: none; }
}

/* ============================================================
   SLIDE 01 — Cover / manifesto hero
   ============================================================ */
.cover {
  padding: var(--s7);
  display: flex; flex-direction: column; justify-content: center;
  height: 100%;
}
.cover .kicker {
  font-family: var(--font-mono); font-size: 16px;
  letter-spacing: 0.38em; text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--s4);
}
.cover h1 {
  font-family: var(--font-cjk-display); font-weight: 900;
  font-size: 250px; line-height: 0.88;
  letter-spacing: 0.005em; color: var(--ink);
  margin-left: -8px; max-width: 1080px;
}
.cover .subtitle {
  font-family: var(--font-body); font-weight: 300;
  font-size: 35px; line-height: 1.55; color: var(--ink-muted);
  max-width: 980px; margin-top: var(--s5);
}
.cover .subtitle em {
  font-style: normal; color: var(--ink);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
}
.cover .rule {
  position: absolute; left: var(--s7); bottom: var(--s7);
  width: 220px; height: 1px; background: var(--accent);
}

/* ============================================================
   SLIDE 02 — Stat / pull-number grid
   ============================================================ */
.stat { padding: var(--s8) var(--s7) var(--s7); }
.stat h2 {
  font-family: var(--font-cjk-display); font-weight: 700;
  font-size: 84px; line-height: 1; color: var(--ink);
  margin-top: var(--s5); margin-bottom: var(--s8);
}
.stat h2 .dot { color: var(--accent); }
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.stat-cell {
  padding: 0 var(--s5);
  border-left: 1px solid var(--line);
}
.stat-cell:first-child { padding-left: 0; border-left: none; }
.stat-num {
  font-family: var(--font-display); font-weight: 400;
  font-size: 230px; line-height: 0.86; color: var(--accent);
  font-feature-settings: "tnum";
}
.stat-unit {
  font-family: var(--font-cjk-display); font-weight: 700;
  font-size: 46px; color: var(--ink); margin-top: var(--s2);
}
.stat-label {
  font-family: var(--font-mono); font-size: 16px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-muted); margin-top: var(--s3);
}

/* ============================================================
   SLIDE 03 — Timeline / vertical editorial steps
   ============================================================ */
.timeline {
  padding: var(--s6) var(--s7) var(--s5) 0;
  display: flex; flex-direction: column; height: 100%;
}
.timeline .head { padding-left: var(--s7); }
.timeline h2 {
  font-family: var(--font-cjk-display); font-weight: 700;
  font-size: 64px; line-height: 1; color: var(--ink);
  margin-top: var(--s4); margin-bottom: var(--s4);
}
.tl-track {
  position: relative; padding-left: var(--s7);
  flex: 1; display: flex; flex-direction: column;
  justify-content: center;
}
.tl-line {
  position: absolute; left: calc(var(--s7) + 130px);
  top: 56px; bottom: 56px; width: 1px;
  background: linear-gradient(var(--line), var(--accent), var(--line));
}
.tl-row {
  display: grid; grid-template-columns: 200px 1fr;
  align-items: center; gap: var(--s6);
  padding: var(--s3) 0;
}
.tl-num {
  font-family: var(--font-display); font-weight: 400;
  font-size: 104px; line-height: 0.8; color: var(--accent);
  text-align: left; position: relative;
}
.tl-num::after {
  content: ""; position: absolute; right: -36px; top: 50%;
  transform: translateY(-50%);
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--bg), 0 0 0 6px var(--line);
}
.tl-body { padding-left: var(--s5); }
.tl-name {
  font-family: var(--font-cjk-display); font-weight: 700;
  font-size: 50px; color: var(--ink); line-height: 1.1;
}
.tl-meta {
  font-family: var(--font-body); font-weight: 400;
  font-size: 25px; color: var(--ink-muted);
  margin-top: var(--s1); letter-spacing: 0.02em;
}
.tl-meta b { color: var(--accent); font-weight: 600; }

/* ============================================================
   SLIDE 04 — Split / manifesto statement
   ============================================================ */
.split {
  display: grid; grid-template-columns: 1.2fr 0.8fr;
  height: 100%;
}
.split .left {
  padding: var(--s9) var(--s6) var(--s7) var(--s7);
  display: flex; flex-direction: column; justify-content: center;
  border-right: 1px solid var(--line);
}
.split .kicker {
  font-family: var(--font-mono); font-size: 16px;
  letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--s5);
}
.split h2 {
  font-family: var(--font-cjk-display); font-weight: 900;
  font-size: 168px; line-height: 1.06; color: var(--ink);
  letter-spacing: 0.01em;
}
.split h2 .hl {
  color: var(--accent-2);
  position: relative;
}
.split h2 .hl::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 8px;
  height: 14px; background: oklch(0.78 0.13 65 / 0.22); z-index: -1;
}
.split .right {
  padding: var(--s9) var(--s7) var(--s7) var(--s6);
  display: flex; flex-direction: column; justify-content: center;
  gap: var(--s6);
}
.point { position: relative; padding-top: var(--s4); }
.point:not(:first-child) { border-top: 1px solid var(--line); }
.point .idx {
  font-family: var(--font-mono); font-size: 15px;
  letter-spacing: 0.24em; color: var(--accent);
  margin-bottom: var(--s3);
}
.point p {
  font-family: var(--font-cjk-display); font-weight: 700;
  font-size: 52px; line-height: 1.32; color: var(--ink);
}
.point p .q { color: var(--accent); }
