:root {
  --ink: #060a14;
  --night: #0b1222;
  --text: #efe7d6;
  --dim: #a7afbf;
  --faint: rgba(239, 231, 214, 0.16);
  --sun: #ffb547;
  --sun2: #ff8a3d;
  --cyan: #62e0e6;
  --sky: #7fb0ff;
  --brick: #e0714f;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk', 'Segoe UI', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', Consolas, 'Courier New', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; color: var(--text); }
body {
  background:
    radial-gradient(1100px 760px at 18% 8%, #14234a 0%, transparent 62%),
    radial-gradient(900px 700px at 92% 96%, #1b1633 0%, transparent 60%),
    var(--ink);
  -webkit-font-smoothing: antialiased;
}
#sky { position: fixed; inset: 0; width: 100%; height: 100%; }
.grain {
  position: fixed; inset: 0; pointer-events: none; opacity: 0.06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- Stage and slides ---------- */
.stage { position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; transform-origin: 50% 50%; }
.slide {
  position: absolute; inset: 0; padding: 96px 128px;
  opacity: 0; visibility: hidden;
  transition: opacity 0.7s ease, visibility 0s linear 0.7s;
  font: 400 34px/1.42 var(--sans);
}
.slide.active { opacity: 1; visibility: visible; transition: opacity 0.7s ease; }
.slide > canvas { position: absolute; z-index: 0; pointer-events: none; }
.slide > :where(:not(canvas)) { position: relative; z-index: 1; }   /* zero-specificity, so layout classes below win */
.abs { position: absolute; margin: 0; }
aside.notes { display: none; }

/* ---------- Type ---------- */
.eyebrow { font: 500 21px/1 var(--mono); letter-spacing: 0.26em; text-transform: uppercase; color: var(--sun); margin: 0 0 26px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 340; margin: 0; letter-spacing: -0.015em; font-optical-sizing: auto; }
h1 { font-size: 172px; line-height: 0.9; }
h2 { font-size: 78px; line-height: 1.03; max-width: 1350px; }
h1 em, h2 em { font-style: italic; color: var(--sun); }
b { font-weight: 650; color: #fff6e6; }
.sun, b.sun { color: var(--sun); }
.cyan, b.cyan { color: var(--cyan); }
.sky, b.sky { color: var(--sky); }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); }
.lede { font-size: 32px; color: var(--dim); max-width: 1150px; margin: 20px 0 0; }
.say p { margin: 0 0 24px; }
.small { font-size: 28px; }
sub { font-size: 0.6em; }
sup { font-size: 0.6em; }

/* ---------- Steps ---------- */
[data-step] { opacity: 0; transform: translateY(16px); transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1); }
[data-step].on { opacity: 1; transform: none; }
.say [data-step].on:not(.current) { opacity: 0.45; }
[data-until].gone { opacity: 0 !important; transform: translateY(-10px); pointer-events: none; transition: opacity 0.35s ease, transform 0.35s ease; }
.captions { position: absolute; }
.captions > * { position: absolute; left: 0; top: 0; width: 100%; margin: 0; }

/* ---------- Cards ---------- */
.card {
  background: rgba(13, 21, 40, 0.8); border: 1px solid var(--faint); border-radius: 22px;
  padding: 24px 30px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); backdrop-filter: blur(6px);
}
.card p { margin: 0; }
.tag { display: block; font: 600 18px/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 14px; }
.calc { border-color: rgba(255, 181, 71, 0.5); }
.calc .tag { color: var(--sun); }
.check { border-color: rgba(98, 224, 230, 0.5); font-size: 28px; }
.check .tag { color: var(--cyan); }
.check .tag::before {
  content: '✓'; display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 12px;
  border-radius: 50%; background: var(--cyan); color: var(--ink); letter-spacing: 0; font-size: 17px; vertical-align: -7px;
}
.formula { font-family: var(--serif); font-size: 42px; line-height: 1.3; color: #fff3dc; }
.formula i { font-style: italic; }
.formula small { display: block; font: 400 24px/1.4 var(--sans); color: var(--dim); margin-top: 6px; }
.answer { color: var(--sun); }
.chips { display: flex; gap: 16px; flex-wrap: wrap; }
.chip { padding: 12px 24px; border-radius: 999px; border: 1px solid rgba(255, 181, 71, 0.55); font: 500 28px/1 var(--mono); color: var(--sun); }
.chip.cy { border-color: rgba(127, 176, 255, 0.55); color: var(--sky); }
.readout { font: 500 27px/1.75 var(--mono); color: var(--dim); }
.readout b { color: var(--text); font-weight: 600; }
.readout div { display: flex; justify-content: space-between; gap: 20px; }
.placeholder { color: var(--sun); border-bottom: 2px dashed rgba(255, 181, 71, 0.6); }

/* ---------- Title, hook, demo ---------- */
.options { position: absolute; left: 128px; right: 128px; top: 560px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; }
.opt { font: 400 36px/1.25 var(--serif); min-height: 200px; }
.opt .k { display: block; font: 600 24px/1 var(--mono); color: var(--sun); margin-bottom: 18px; }
.opt small { display: block; font: 400 24px/1.3 var(--sans); color: var(--dim); margin-top: 10px; }
.url { font: 500 44px/1 var(--mono); color: var(--cyan); letter-spacing: 0.02em; }
.pulse-ring { position: absolute; border-radius: 50%; border: 2px solid rgba(255, 181, 71, 0.5); animation: ring 3.6s ease-out infinite; }
.pulse-ring:nth-child(2) { animation-delay: 1.2s; }
.pulse-ring:nth-child(3) { animation-delay: 2.4s; }
@keyframes ring { from { transform: scale(0.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.demo-steps { counter-reset: s; display: grid; gap: 22px; }
.demo-steps p { margin: 0; padding-left: 66px; position: relative; }
.demo-steps p::before {
  counter-increment: s; content: counter(s); position: absolute; left: 0; top: 2px; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font: 600 22px/1 var(--mono); color: var(--ink); background: var(--sun);
}

/* ---------- Lists that light up ---------- */
.rows { display: grid; gap: 6px; }
.row { display: grid; grid-template-columns: 110px 1fr auto; align-items: baseline; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--faint); font-size: 30px; }
.row .lat { font: 500 24px/1 var(--mono); color: var(--dim); }
.row b { font-family: var(--mono); font-weight: 600; font-size: 28px; }
.row.current { color: var(--sun); }
.row.current b { color: var(--sun); }
.legend { display: grid; gap: 10px; }
.legend .item { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: center; font-size: 25px; line-height: 1.2; }
.legend .sw { width: 30px; height: 6px; border-radius: 3px; }
.legend small { display: block; font: 400 19px/1.3 var(--mono); color: var(--dim); }

/* ---------- Toolkit ---------- */
.toolkit { position: absolute; left: 128px; right: 128px; top: 290px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.toolkit .card { padding: 22px 26px; }
.toolkit .w2 { grid-column: span 2; }
.toolkit .tag { color: var(--sun); }
.toolkit .formula { font-size: 34px; }
.toolkit .formula small { font-size: 22px; }
.toolkit .warn { margin-top: 10px; font: 400 21px/1.35 var(--sans); color: var(--sky); }
.slide.active .stagger > * { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.slide.active .stagger > *:nth-child(2) { animation-delay: 0.08s; }
.slide.active .stagger > *:nth-child(3) { animation-delay: 0.16s; }
.slide.active .stagger > *:nth-child(4) { animation-delay: 0.24s; }
.slide.active .stagger > *:nth-child(5) { animation-delay: 0.32s; }
.slide.active .stagger > *:nth-child(6) { animation-delay: 0.4s; }
.slide.active .stagger > *:nth-child(7) { animation-delay: 0.48s; }
.slide.active .stagger > *:nth-child(8) { animation-delay: 0.56s; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* ---------- Bars (North Pole) ---------- */
.bars { display: grid; gap: 20px; }
.bars .lbl { font: 500 19px/1.2 var(--mono); color: var(--dim); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px; }
.bar { display: grid; grid-template-columns: 170px 1fr 120px; align-items: center; gap: 14px; margin-top: 6px; font-size: 25px; }
.bar .track { height: 26px; }
.bar .fillbar { height: 26px; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--sun2), var(--sun)); transition: width 1.3s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s; }
.bar.pole .fillbar { background: linear-gradient(90deg, #3a9fc4, var(--cyan)); }
.bar .val { font: 600 25px/1 var(--mono); text-align: right; }
.on .fillbar { width: var(--w); }

/* ---------- Your turn ---------- */
.tasks { position: absolute; left: 128px; right: 128px; top: 330px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.tasks .card { min-height: 330px; }
.tasks .n { font: 400 90px/1 var(--serif); color: var(--sun); }
.tasks h3 { font-size: 38px; margin: 10px 0 14px; }
.tasks .formula { font-size: 32px; }

/* ---------- Journey gauge ---------- */
.journey { position: absolute; right: 50px; top: 200px; width: 350px; height: 740px; }
.j-title { position: absolute; left: 150px; top: 0; font: 600 17px/1 var(--mono); letter-spacing: 0.22em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.j-track { position: absolute; left: 170px; top: 60px; width: 4px; background: rgba(239, 231, 214, 0.15); border-radius: 2px; }
.j-fill { position: absolute; left: 0; bottom: 0; width: 4px; border-radius: 2px; background: linear-gradient(var(--sun), var(--cyan)); transform-origin: 50% 100%; }
.slide.active .j-fill { animation: grow 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes grow { from { transform: scaleY(0.15); } }
.j-line { position: absolute; left: -10px; width: 24px; height: 0; border-top: 1px dashed rgba(239, 231, 214, 0.4); }
.j-line span { position: absolute; right: 34px; top: -10px; font: 400 16px/1 var(--mono); color: rgba(239, 231, 214, 0.5); white-space: nowrap; }
.j-pin { position: absolute; left: -9px; transform: translateY(50%); display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.j-dot { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(239, 231, 214, 0.4); background: var(--ink); flex: none; }
.j-text { display: grid; gap: 4px; }
.j-name { font: 600 23px/1 var(--sans); }
.j-lat { font: 500 16px/1 var(--mono); color: var(--dim); }
.j-pin.visited .j-dot { background: var(--sun); border-color: var(--sun); }
.j-pin.here .j-dot { background: var(--sun); border-color: #fff2d6; animation: pulse 1.8s ease-in-out infinite; }
.j-pin.here .j-name { color: var(--sun); }
.j-pin:not(.here):not(.visited) .j-name { color: rgba(239, 231, 214, 0.45); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(255, 181, 71, 0.25), 0 0 26px rgba(255, 181, 71, 0.7); }
  50% { box-shadow: 0 0 0 14px rgba(255, 181, 71, 0.06), 0 0 44px rgba(255, 181, 71, 0.95); }
}

/* ---------- Chrome ---------- */
.chrome { position: absolute; inset: 0; pointer-events: none; z-index: 50; }
.c-logo { position: absolute; right: 128px; top: 46px; display: flex; align-items: center; gap: 12px; font: 600 17px/1 var(--mono); letter-spacing: 0.24em; color: rgba(239, 231, 214, 0.6); }
.c-mark { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffd793, var(--sun2)); box-shadow: 0 0 16px rgba(255, 138, 61, 0.6); }
.c-page { position: absolute; right: 128px; bottom: 40px; font: 500 18px/1 var(--mono); letter-spacing: 0.12em; color: rgba(239, 231, 214, 0.45); }
.c-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(239, 231, 214, 0.06); }
.c-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sun2), var(--sun)); transition: width 0.6s ease; }

.notes-panel {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 36vh; overflow: auto; padding: 18px 28px; z-index: 100;
  background: rgba(6, 10, 20, 0.95); border-top: 1px solid var(--faint); font: 400 17px/1.55 var(--sans); color: var(--text);
  white-space: pre-wrap; transform: translateY(100%); transition: transform 0.3s ease;
}
body.show-notes .notes-panel { transform: none; }
.hint {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; pointer-events: none;
  font: 500 14px/1 var(--mono); letter-spacing: 0.08em; color: rgba(239, 231, 214, 0.6);
  background: rgba(6, 10, 20, 0.75); padding: 10px 16px; border-radius: 999px; transition: opacity 0.8s ease;
}
body.started .hint { opacity: 0; }

/* ?capture in the URL: no CSS transitions, for screenshots and PDF export. */
html.capture *, html.capture *::before { transition: none !important; animation: none !important; }
html.capture .hint { display: none; }

/* Worked calculation rows (one dot on the curve, corner triangles) */
.workrows .row { display: grid; grid-template-columns: 58px 1fr; align-items: baseline; gap: 10px; font: 400 23px/1.4 var(--mono); color: var(--text); margin: 8px 0; }
.workrows .row > i { font: italic 500 40px/1 var(--serif); color: var(--sun); }
.workrows .row > i.cy { color: var(--cyan); }
.workrows .row small { display: block; font: 400 19px/1.35 var(--sans); color: var(--dim); margin-top: 1px; }
.workrows .row b { color: #fff3dc; }
.workrows .row b.sun { color: var(--sun); }
.workrows .row b.cyan { color: var(--cyan); }
