/* Signals — a lab notebook of financial models.
   One shared stylesheet, no external fonts, no scripts needed.
   Text pages use body.sg-page. Archived volume pages (Vol 1-3) use body.sg-vol and only
   pick up the banner, the frame and the injected footer, so the generated page's own
   styles stay in charge of its tables. Vol 4 is a text page (body.sg-page main.sg-wrap). */

:root {
  --paper: #f7f4ec;
  --paper-2: #fffdf8;
  --paper-3: #efe9db;
  --ink: #16130f;
  --muted: #554f47;
  --line: #ddd5c3;
  --grid: rgba(22, 19, 15, 0.055);
  --accent: #ff4f1a;          /* big type, fills, decoration */
  --accent-ink: #b3320a;      /* accent as small text on paper (AA) */
  --on-accent: #16130f;
  --fail: #b3320a;
  --dead: #16130f;
  --next: #0d6a52;
  --glow: #0a8f7a;            /* screen glow, decorative */
  --glow-ink: #076b5c;        /* glow as small text on paper (AA) */
  --screen: #0e1b1d;
  --warn: #8a5a00;
  --bar-bg: #16130f;
  --bar-fg: #f3eee3;
  --bar-hot: #ff7a4d;
  --shadow: 0 1px 0 rgba(22, 19, 15, 0.06), 0 12px 32px -18px rgba(22, 19, 15, 0.35);
  --radius: 14px;
  --max: 1140px;
  --gutter: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121110;
    --paper-2: #1b1a17;
    --paper-3: #24221e;
    --ink: #f3efe6;
    --muted: #b6ad9f;
    --line: #34302a;
    --grid: rgba(243, 239, 230, 0.05);
    --accent: #ff6a3d;
    --accent-ink: #ff8a63;
    --on-accent: #16130f;
    --fail: #ff8a63;
    --dead: #f3efe6;
    --next: #5fd3a8;
    --glow: #3ee6c1;
    --glow-ink: #5ef0cf;
    --screen: #0b1517;
    --warn: #e3b55f;
    --bar-bg: #23201c;
    --bar-fg: #f3efe6;
    --bar-hot: #ff8a63;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 14px 34px -18px rgba(0, 0, 0, 0.8);
  }
}

@media (min-width: 720px) { :root { --gutter: 28px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.6 var(--font);
  overflow-wrap: break-word;
}
body.sg-page { overflow-x: hidden; }
body.sg-page main { overflow-x: clip; }

/* ---------- Focus + skip link ---------- */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; border-radius: 8px;
  font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- Compliance bar (every page, same markup on every page) ---------- */
.sg-banner {
  background: var(--bar-bg);
  color: var(--bar-fg);
  border-bottom: 3px solid var(--accent);
  font: 0.8rem/1.5 var(--font);
  position: relative;
  z-index: 50;
}
.sg-banner-in {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.5rem var(--gutter);
  display: flex;
  gap: 0.3rem 1rem;
  flex-wrap: wrap;
  align-items: baseline;
}
.sg-banner a { color: inherit; }
.sg-banner .sg-home {
  font: 800 0.78rem/1.5 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.sg-banner .sg-home::before {
  content: "";
  width: 0.6rem; height: 0.6rem; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 79, 26, 0.25);
}
.sg-banner .sg-home:hover { text-decoration: underline; }
.sg-banner p { margin: 0; flex: 1 1 22rem; max-width: none; color: var(--bar-fg); }
.sg-banner strong { color: var(--bar-hot); }
@media (min-width: 720px) {
  .sg-banner { position: sticky; top: 0; }
}
@media (max-width: 519px) {
  .sg-banner { font-size: 0.74rem; }
}

/* ---------- Site header / nav (text pages) ---------- */
.site-head {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  color: var(--ink); text-decoration: none;
  font-weight: 850; font-size: 1.2rem; letter-spacing: -0.02em;
}
.brand img { width: 30px; height: 30px; }
.brand small {
  font: 600 0.68rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); padding: 0.3rem 0.45rem; border-radius: 999px;
}
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; }
.site-nav a {
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.95rem;
  padding: 0.2rem 0; border-bottom: 2px solid transparent;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { border-bottom-color: var(--accent); }

/* ---------- Layout helpers ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.section + .section { border-top: 1px solid var(--line); }
.graph {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 112px 28px;
}
.eyebrow {
  font: 700 0.78rem/1.3 var(--mono);
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 1rem;
}
.section-title {
  font-size: clamp(2rem, 5.2vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 850;
  margin: 0 0 1rem;
  max-width: 18ch;
}
.section-lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--muted); max-width: 60ch; margin: 0 0 2.5rem; }
.hl { color: var(--accent); }
.mono { font-family: var(--mono); }

/* ---------- Buttons ---------- */
.btns { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 2rem 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 1.3rem; border-radius: 999px;
  font-weight: 750; text-decoration: none; font-size: 1rem;
  border: 2px solid var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn:hover { transform: translateY(-2px); box-shadow: 4px 4px 0 var(--ink); }
.btn-ghost:hover { background: var(--paper-2); }

/* ---------- Stamps (the lab-notebook motif) ---------- */
.stamp {
  display: inline-block;
  font: 800 0.78rem/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.45rem 0.6rem 0.4rem;
  border: 2.5px solid currentColor;
  border-radius: 6px;
  transform: rotate(-6deg);
  white-space: nowrap;
  box-shadow: inset 0 0 0 1.5px var(--paper-2);
  outline: 1.5px solid currentColor;
  outline-offset: -5px;
}
.stamp-big {
  font-size: clamp(1.05rem, 2.8vw, 1.45rem);
  padding: 0.55rem 0.75rem 0.5rem;
  border-width: 3.5px;
  transform: rotate(-11deg);
  filter: url(#rough);
  background: var(--paper-2);
}
.stamp-fail { color: var(--fail); }
.stamp-dead { color: var(--dead); background: transparent; }
.stamp-next { color: var(--next); transform: rotate(4deg); }
.stamp-goal { color: var(--accent-ink); transform: rotate(-3deg); }

/* ---------- Hero ---------- */
.hero { padding: clamp(1.75rem, 4vw, 3rem) 0 clamp(3rem, 7vw, 5.5rem); position: relative; }
.hero-grid { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.35fr 1fr; gap: 3.5rem; } }
.hero { overflow: hidden; isolation: isolate; }
.hero::before, .hero::after {
  content: ""; position: absolute; z-index: -1; border-radius: 50%;
  opacity: 0.5; pointer-events: none;
}
.hero::before { width: 46vmax; height: 46vmax; left: -14vmax; top: -18vmax; background: radial-gradient(closest-side, rgba(255, 79, 26, 0.9), rgba(255, 79, 26, 0)); }
.hero::after { width: 40vmax; height: 40vmax; right: -14vmax; bottom: -20vmax; background: radial-gradient(closest-side, rgba(255, 197, 51, 0.9), rgba(255, 197, 51, 0)); }
@media (prefers-color-scheme: dark) { .hero::before, .hero::after { opacity: 0.32; } }
.hero h1 {
  font-size: clamp(2.6rem, 15vw, 6.6rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
  font-weight: 900;
  margin: 0 0 1.4rem;
}
.hero h1 .op {
  display: block; width: fit-content; max-width: 100%;
  font: 800 clamp(0.95rem, 2.2vw, 1.35rem)/1 var(--mono);
  letter-spacing: 0.14em; text-transform: uppercase;
  background: var(--ink); color: var(--paper);
  padding: 0.45rem 0.7rem 0.4rem; border-radius: 6px;
  transform: rotate(-2deg); margin-bottom: 0.9rem;
}
.hero h1 .mil {
  display: block;
  color: var(--accent);
  text-shadow: 4px 4px 0 var(--ink);
}
@media (prefers-color-scheme: dark) { .hero h1 .mil { text-shadow: 4px 4px 0 #000; } }
.hero h1 .ter { display: block; font-size: 0.48em; letter-spacing: -0.03em; margin-top: 0.5rem; }
.hero h1 .ter span { display: inline-block; }
.hero h1 .ter span:nth-child(2) { color: var(--accent-ink); text-decoration: line-through; text-decoration-thickness: 0.09em; }
.hero-sub { font-size: clamp(1.1rem, 2vw, 1.4rem); line-height: 1.45; margin: 0; max-width: 36ch; color: var(--muted); }
.hero-sub strong { color: var(--ink); }
.wink {
  display: inline-block; margin: 1.2rem 0 0;
  font: 800 clamp(0.95rem, 1.8vw, 1.15rem)/1.35 var(--mono);
  background: #ffe27a; color: #16130f;
  padding: 0.55rem 0.8rem; border-radius: 4px;
  transform: rotate(-1.5deg);
  box-shadow: 3px 3px 0 var(--ink);
  max-width: 100%;
}

.goal-card {
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 1.6rem 1.4rem 1.4rem;
  box-shadow: 8px 8px 0 var(--ink);
  position: relative;
}
.goal-card .stamp { position: absolute; top: -0.9rem; right: 1rem; background: var(--paper-2); }
.goal-label { font: 700 0.75rem/1.2 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0; }
.goal-num {
  font-size: clamp(2.6rem, 11vw, 4.4rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin: 0.35rem 0 0.5rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.goal-note { margin: 0 0 1.3rem; color: var(--muted); font-size: 0.95rem; }
.score { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 0; border-top: 2px dashed var(--line); padding-top: 1.1rem; }
.score div { text-align: left; }
.score dt { font: 700 0.68rem/1.3 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.score dd { margin: 0.2rem 0 0; font-size: clamp(2rem, 6vw, 2.6rem); font-weight: 900; line-height: 1; letter-spacing: -0.03em; }
.score .s-fail { color: var(--fail); }
.score .s-next { color: var(--next); }
.goal-foot { margin: 1.1rem 0 0; font-size: 0.85rem; color: var(--muted); font-style: italic; }

/* ---------- Ticker strip ---------- */
.ticker {
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  border-block: 3px solid var(--accent);
  white-space: nowrap;
}
.ticker-track { display: inline-flex; gap: 0; padding: 0.85rem 0; }
.ticker-track span {
  font: 800 0.95rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 1.4rem;
}
.ticker-track .t-fail { color: var(--bar-hot); }
.ticker-track .t-next { color: #6fe0b4; }
@media (prefers-color-scheme: dark) {
  .ticker { background: var(--paper-3); color: var(--ink); }
}

/* ---------- How I test ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; counter-reset: step; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .steps { grid-template-columns: repeat(5, 1fr); } }
.steps li {
  counter-increment: step;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem 1.2rem;
  position: relative;
}
.steps li::before {
  content: "0" counter(step);
  display: block;
  font: 900 2.2rem/1 var(--font);
  letter-spacing: -0.04em;
  color: var(--accent);
  margin-bottom: 0.8rem;
}
.steps h3 { margin: 0 0 0.4rem; font-size: 1.1rem; letter-spacing: -0.01em; }
.steps p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.more { margin: 2rem 0 0; font-weight: 700; }
.more a, .text-link { color: var(--accent-ink); text-underline-offset: 3px; }

/* ---------- Model cards ---------- */
.models { display: grid; gap: 1.5rem; }
@media (min-width: 820px) { .models { grid-template-columns: repeat(2, 1fr); } }
.model {
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 1.5rem 1.4rem 1.4rem;
  display: flex; flex-direction: column;
  position: relative;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.model:hover { transform: translateY(-3px); box-shadow: 6px 6px 0 var(--ink); }
.model-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.8rem; }
.model-no { font: 700 0.75rem/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0; }
.model-no b { color: var(--accent-ink); font-size: 0.95rem; }
.model h3 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 0.9rem; font-weight: 850; }
.hyp {
  margin: 0 0 1.2rem;
  font-size: 1.08rem;
  line-height: 1.45;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--paper);
  border-radius: 0 8px 8px 0;
}
.hyp .lbl { display: block; font: 700 0.68rem/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.2rem; }
.facts { margin: 0 0 1.2rem; display: grid; gap: 0.75rem; }
.facts dt { font: 700 0.7rem/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0.1rem 0 0; font-size: 0.96rem; }
.facts .res dd { font-weight: 600; }
.big-num { font-size: 1.6rem; font-weight: 900; letter-spacing: -0.03em; color: var(--fail); }
.model-link { margin-top: auto; font-weight: 750; color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 4px; align-self: flex-start; }
.model-link:hover { color: var(--accent-ink); }
.model--next {
  border-style: dashed;
  background:
    repeating-linear-gradient(-45deg, transparent 0 14px, var(--grid) 14px 15px),
    var(--paper-2);
}
@media (min-width: 820px) { .model--next { grid-column: 1 / -1; } }
.model--next .hyp { border-left-color: var(--next); }
.soon {
  margin-top: auto; align-self: flex-start;
  display: inline-flex; align-items: center; gap: 0.55rem;
  font: 800 0.8rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--next); border: 2px solid currentColor; border-radius: 999px; padding: 0.55rem 0.9rem;
}
.soon::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: currentColor; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 0.55rem; top: 0.4rem; bottom: 0.4rem;
  width: 3px; background: linear-gradient(var(--accent), var(--accent) 85%, transparent);
  border-radius: 3px;
}
.timeline li { position: relative; padding: 0 0 1.8rem 2.4rem; }
.timeline li::before {
  content: ""; position: absolute; left: 0; top: 0.3rem;
  width: 1.15rem; height: 1.15rem; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--accent);
}
.timeline li.t-next::before { border-color: var(--next); border-style: dashed; }
.timeline time, .timeline .when { font: 700 0.78rem/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); }
.timeline li.t-next .when { color: var(--next); }
.timeline h3 { margin: 0.15rem 0 0.25rem; font-size: 1.2rem; letter-spacing: -0.015em; }
.timeline p { margin: 0; color: var(--muted); max-width: 62ch; }
@media (min-width: 900px) {
  .tl-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 3rem; align-items: start; }
  .tl-grid .section-title { position: sticky; top: 4.5rem; }
}

/* ---------- Lessons ---------- */
.lessons { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
@media (min-width: 720px) { .lessons { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .lessons { grid-template-columns: repeat(3, 1fr); } }
.lessons li {
  border-top: 4px solid var(--ink);
  padding: 1.1rem 0 0.4rem;
}
.lessons h3 { font-size: 1.3rem; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.5rem; }
.lessons p { margin: 0; color: var(--muted); }
.lessons .src { display: block; margin-top: 0.6rem; font: 600 0.75rem/1.4 var(--mono); color: var(--muted); }
.lessons .src a { color: var(--accent-ink); }

/* ---------- Archive ---------- */
.vols { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
@media (min-width: 720px) { .vols { grid-template-columns: repeat(2, 1fr); } }
.vols li { display: flex; }
.vol-card {
  flex: 1;
  display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 1.1rem; align-content: start;
  padding: 1.2rem 1.2rem; border-radius: var(--radius);
  background: var(--paper-2); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.vol-card:hover { border-color: var(--ink); transform: translateY(-2px); }
.vol-n {
  grid-row: span 3;
  font: 900 2.4rem/1 var(--font); letter-spacing: -0.05em; color: var(--accent);
  min-width: 2.6rem;
}
.vol-n small { display: block; font: 700 0.65rem/1.6 var(--mono); letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }
.vol-t { font-weight: 800; font-size: 1.05rem; line-height: 1.3; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.vol-m { font: 600 0.78rem/1.5 var(--mono); color: var(--muted); }
.vol-d { font-size: 0.93rem; color: var(--muted); }
.note { color: var(--muted); font-size: 0.92rem; margin: 1.2rem 0 0; }

/* ---------- Next / follow along ---------- */
.next-band { background: var(--accent); color: var(--on-accent); }
.next-band .eyebrow { color: var(--on-accent); }
.next-band .eyebrow::before { color: var(--on-accent); }
.next-band .section-title { max-width: 20ch; }
.next-band p { font-size: clamp(1.05rem, 1.6vw, 1.25rem); max-width: 56ch; margin: 0 0 1rem; }
.next-band .fine { font-size: 0.95rem; margin-top: 1.5rem; font-weight: 600; }
.next-band .btn { border-color: var(--on-accent); color: var(--on-accent); }
.next-band .btn:hover { box-shadow: 4px 4px 0 var(--on-accent); background: rgba(255, 255, 255, 0.15); }

/* ---------- Footer (text pages and the injected volume footer) ---------- */
.sg-footer {
  background: var(--bar-bg);
  color: var(--bar-fg);
  font: 0.9rem/1.6 var(--font);
  border-top: 3px solid var(--accent);
}
.sg-footer-in { max-width: var(--max); margin: 0 auto; padding: 2rem var(--gutter) 2.5rem; }
.sg-footer p { margin: 0.35rem 0; max-width: 80ch; }
.sg-footer a { color: var(--bar-fg); text-decoration-color: var(--bar-hot); text-underline-offset: 3px; }
.sg-footer a:hover { color: var(--bar-hot); }
.sg-footer strong { color: var(--bar-hot); }
.foot-grid { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; align-items: flex-start; }
.foot-brand { font-weight: 850; font-size: 1.15rem; letter-spacing: -0.02em; margin: 0 0 0.3rem; }
.foot-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; }
.foot-nav a { font-weight: 650; }
.sg-disclosure .sg-footer-in { padding: 1.4rem var(--gutter) 1.8rem; }

/* ---------- Prose pages: Method, Disclaimer, Vol 4 ---------- */
.page-hero { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(1.5rem, 4vw, 2.5rem); border-bottom: 1px solid var(--line); }
.page-hero h1 {
  font-size: clamp(2.4rem, 6.5vw, 4.6rem);
  line-height: 1; letter-spacing: -0.045em; font-weight: 900;
  margin: 0 0 1rem; max-width: 16ch;
}
.page-hero .sg-lead { font-size: clamp(1.05rem, 1.8vw, 1.3rem); color: var(--muted); max-width: 60ch; margin: 0; }
.release {
  display: inline-block; margin: 1.4rem 0 0;
  font: 700 0.85rem/1.5 var(--mono);
  padding: 0.6rem 0.9rem; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper-2);
  max-width: 100%;
}
.release b { color: var(--accent-ink); }
.toc-inline { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 1.6rem 0 0; }
.toc-inline a {
  display: inline-block; padding: 0.4rem 0.8rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper-2);
  color: var(--ink); text-decoration: none; font-weight: 650; font-size: 0.9rem;
}
.toc-inline a:hover { border-color: var(--ink); }

.prose-wrap { padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(3rem, 7vw, 5rem); }
.panel {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 3vw, 2rem);
  margin: 0 0 1.25rem;
}
.panel h2 { margin-top: 0; }
.panel-kicker { font: 700 0.72rem/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 0.5rem; }
.panel--accent { border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.panel--later { border-style: dashed; }
.disc-grid { display: grid; gap: 1.25rem; }
@media (min-width: 820px) { .disc-grid { grid-template-columns: repeat(2, 1fr); } .disc-grid .panel { margin: 0; } }

.prose h2, .sg-page .sg-wrap h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.15; letter-spacing: -0.025em; margin: 2.2rem 0 0.7rem; font-weight: 850; }
.prose h3, .sg-page .sg-wrap h3 { font-size: 1.2rem; line-height: 1.25; letter-spacing: -0.01em; margin: 1.8rem 0 0.5rem; }
.prose h4, .sg-page .sg-wrap h4 { font-size: 1.02rem; margin: 1.4rem 0 0.4rem; }
.prose p, .prose li, .sg-page .sg-wrap p, .sg-page .sg-wrap li { max-width: 74ch; }
.prose ul, .sg-page .sg-wrap ul { padding-left: 1.2rem; }
.prose li, .sg-page .sg-wrap li { margin: 0.35rem 0; }
.prose li::marker, .sg-page .sg-wrap li::marker { color: var(--accent); }
.prose a, .sg-page .sg-wrap a { color: var(--accent-ink); text-underline-offset: 3px; }
.sg-muted { color: var(--muted); }

/* Vol 4 (archived research notes) — its own markup, restyled */
.sg-page .sg-wrap { max-width: 900px; margin: 0 auto; padding: clamp(2rem, 5vw, 3.5rem) var(--gutter) 4rem; }
.sg-page .sg-wrap > h1 {
  font-size: clamp(2rem, 5.5vw, 3.6rem); line-height: 1.02; letter-spacing: -0.04em; font-weight: 900;
  margin: 0.4rem 0 1rem;
}
.sg-page .sg-wrap > .sg-kicker {
  font: 700 0.78rem/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-ink); margin: 0;
}
.sg-lead { color: var(--muted); font-size: 1.1rem; }
.sg-toc {
  background: var(--paper-2); border: 2px solid var(--ink); border-radius: var(--radius);
  padding: 1rem 1.3rem; box-shadow: 6px 6px 0 var(--ink); margin: 1.5rem 0 2rem;
}
.sg-toc ol { margin: 0.4rem 0 0; padding-left: 1.3rem; }
.sg-doc { border-top: 3px solid var(--ink); margin-top: 3rem; padding-top: 0.8rem; }
.sg-docmeta { color: var(--muted); font: 600 0.78rem/1.5 var(--mono); font-variant-numeric: tabular-nums; }
.sg-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.sg-page table { border-collapse: collapse; width: 100%; font-size: 0.88rem; margin: 0.8rem 0 1.2rem; font-variant-numeric: tabular-nums; }
.sg-page th, .sg-page td { border-bottom: 1px solid var(--line); padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; }
.sg-page th { font-weight: 750; background: var(--paper-3); }
.sg-page code { font-family: var(--mono); font-size: 0.86em; background: var(--paper-3); border-radius: 4px; padding: 0.05em 0.3em; overflow-wrap: anywhere; }
.sg-page pre { background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.78rem; line-height: 1.45; max-width: 100%; }
.sg-page pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.sg-page blockquote { margin: 1rem 0; padding: 0.3rem 1rem; border-left: 4px solid var(--accent); color: var(--muted); background: var(--paper-2); border-radius: 0 8px 8px 0; }
.sg-page hr { border: 0; border-top: 1px dashed var(--line); margin: 2rem 0; }

/* ---------- Archived volume pages (Vol 1-3) ---------- */
body.sg-vol { background: var(--paper); }
.sg-vol-frame { padding: 12px; }


/* =====================================================================
   Over-the-top layer: art, coins, confetti, odometer, graveyard, road, tips
   ===================================================================== */
.vh {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Hero art */
.art { position: relative; max-width: 520px; width: 100%; margin: 0 auto 1.5rem; }
.hero-art { display: block; width: 100%; height: auto; }
.a-blob { fill: var(--paper-3); }
.a-grid { stroke: var(--line); stroke-width: 1; }
.a-rain { fill: var(--glow); font: 700 13px/1 var(--mono); opacity: 0.45; }
.a-bezel { fill: #16130f; stroke: var(--ink); stroke-width: 3; }
.a-stand { fill: #16130f; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.a-screen { fill: var(--screen); }
.a-led1 { fill: #ff6a3d; }
.a-led2 { fill: #ffc533; }
.a-led3 { fill: #3ee6c1; }
.a-dim { fill: #9cbab4; font: 700 11px/1 var(--mono); }
.a-axis { fill: none; stroke: #2f5c55; stroke-width: 1.5; }
.a-dot { fill: #3ee6c1; }
.a-fit { fill: none; stroke: #ff7a4d; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 7 5; }
.a-bar { fill: #3ee6c1; }
.a-swick { stroke: #9cbab4; stroke-width: 2; }
.a-cup { fill: #3ee6c1; }
.a-cdown { fill: #ff7a4d; }
.a-term { fill: #d5ece8; font: 700 12px/1 var(--mono); }
.a-term-hot { fill: #ff8a63; }
.a-cursor { fill: #3ee6c1; }
.a-db { fill: var(--paper-2); stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; }
.a-dbtop { fill: var(--accent); stroke: var(--ink); stroke-width: 4; }
.a-dbline { fill: none; stroke: var(--ink); stroke-width: 3; }
.a-line { fill: none; stroke: var(--next); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.a-crash { fill: none; stroke: var(--fail); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.a-boom { fill: var(--paper-2); stroke: var(--fail); stroke-width: 4; }
.a-boomx { stroke: var(--fail); stroke-width: 5; stroke-linecap: round; }
.a-note { fill: #ffe27a; stroke: #16130f; stroke-width: 2.5; }
.a-notetext { fill: #16130f; font: 800 17px/1 var(--mono); }
.a-notetext-s { fill: #5c4300; font: 700 12px/1 var(--mono); letter-spacing: 0.06em; }
.a-tape { fill: rgba(255, 255, 255, 0.6); }
.a-spark { fill: var(--glow); }
.a-shadow { fill: var(--line); }
.f-handle { fill: none; stroke: #16130f; stroke-width: 6; stroke-linecap: round; }
.f-label { fill: #16130f; font: 800 15px/1 var(--mono); letter-spacing: 0.12em; }

.coin {
  position: absolute; width: 18%; max-width: 92px; aspect-ratio: 1;
}
.coin svg { display: block; width: 100%; height: 100%; }
.coin-1 { top: 33%; left: 0; }
.coin-2 { top: 40%; right: 0; width: 13%; }
.coin-3 { bottom: 10%; left: 4%; width: 11%; }
.c-shadow { fill: #16130f; }
.c-face { fill: #ffc533; stroke: #16130f; stroke-width: 5; }
.c-rim { fill: none; stroke: #9a6a00; stroke-width: 3; stroke-dasharray: 4 5; }
.c-sym { fill: #16130f; font: 900 52px/1 var(--font); }

/* Confetti */
.confetti { position: absolute; left: 0; right: 0; top: -10px; height: 0; pointer-events: none; }
.confetti i {
  position: absolute; top: 0; width: 9px; height: 14px; border-radius: 2px;
  background: var(--accent); transform: rotate(20deg);
}
.confetti i:nth-child(2n) { background: #ffc533; width: 8px; height: 8px; border-radius: 50%; }
.confetti i:nth-child(3n) { background: var(--next); }
.confetti i:nth-child(5n) { background: var(--ink); }
.confetti i:nth-child(1) { left: 6%; top: -12px; }
.confetti i:nth-child(2) { left: 18%; top: -26px; }
.confetti i:nth-child(3) { left: 31%; top: -8px; }
.confetti i:nth-child(4) { left: 44%; top: -22px; }
.confetti i:nth-child(5) { left: 57%; top: -14px; }
.confetti i:nth-child(6) { left: 69%; top: -30px; }
.confetti i:nth-child(7) { left: 80%; top: -6px; }
.confetti i:nth-child(8) { left: 92%; top: -20px; }

/* Odometer: models tried */
.odo { display: inline-block; height: 1em; overflow: hidden; line-height: 1; vertical-align: top; }
.odo-strip { display: flex; flex-direction: column; transform: translateY(-4em); }
.odo-strip span { display: block; height: 1em; line-height: 1; }

/* Squiggle dividers */
.squiggle { display: block; width: 100%; height: 40px; color: var(--accent); overflow: visible; }
.squiggle path { fill: none; stroke: currentColor; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }

/* Model card icons */
.model-head { display: flex; gap: 0.9rem; align-items: center; }
.model-icon {
  width: 3.2rem; height: 3.2rem; flex: none;
  display: grid; place-items: center;
  border: 2px solid var(--ink); border-radius: 12px;
  background: var(--paper); color: var(--ink);
  box-shadow: 3px 3px 0 var(--accent);
}
.model-icon svg { width: 1.9rem; height: 1.9rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.model--next .model-icon { box-shadow: 3px 3px 0 var(--next); }

/* Graveyard of hypotheses */
.tombs { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.6rem 1.2rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.tomb {
  position: relative;
  background: linear-gradient(180deg, #ddd7ca, #c3bba9);
  color: #16130f;
  border: 3px solid #16130f;
  border-radius: 999px 999px 10px 10px;
  padding: 2.1rem 0.8rem 1.2rem;
  text-align: center;
  width: 100%; max-width: 280px; justify-self: center;
  box-shadow: 6px 6px 0 #16130f;
  transform-origin: bottom center;
}
.tomb:nth-child(2) { transform: rotate(2deg); }
.tomb:nth-child(3) { transform: rotate(-1.5deg); }
.tomb:nth-child(4) { transform: rotate(1deg); }
.tomb::before {
  content: "RIP"; display: block;
  font: 900 1.6rem/1 var(--font); letter-spacing: 0.08em; margin-bottom: 0.4rem; color: #16130f;
}
.tomb h3 { font-size: 1.05rem; line-height: 1.2; margin: 0 0 0.5rem; }
.tomb p { margin: 0.2rem 0; font-size: 0.86rem; }
.tomb .epi { font-style: italic; margin-top: 0.6rem; }
.tomb .cause { font: 700 0.75rem/1.35 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: #7a2104; }
.tomb-reserved {
  background: transparent; color: var(--ink);
  border: 3px dashed var(--next); box-shadow: none; border-radius: 12px;
}
.tomb-reserved::before { content: "PLOT 05"; color: var(--next); font-size: 1.1rem; }
.tomb-reserved .cause { color: var(--next); }
.grass { display: block; width: 100%; height: 40px; margin-top: -6px; }
.grass path { fill: var(--next); }

/* Road to the goal */
.road-wrap { position: relative; isolation: isolate; }
.road { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.2rem; position: relative; }
.road li {
  position: relative;
  background: var(--paper-2); border: 2px solid var(--ink); border-radius: var(--radius);
  padding: 1.1rem 1rem 1.1rem;
}
.road .flag { font: 900 1.5rem/1.05 var(--font); letter-spacing: -0.03em; display: block; margin: 0.45rem 0 0.35rem; }
.road h3 { margin: 0 0 0.3rem; font-size: 1.02rem; line-height: 1.25; }
.road p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.road .tag {
  display: inline-block; font: 800 0.66rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  border: 2px solid currentColor; border-radius: 999px; padding: 0.3rem 0.5rem; color: var(--muted);
}
.road .here { background: var(--ink); color: var(--paper); }
.road .here .tag { color: #ffe27a; }
.road .here p, .road .here h3 { color: var(--paper); }
.road .summit { background: var(--accent); color: var(--on-accent); border-color: var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.road .summit p, .road .summit .tag { color: var(--on-accent); }
.road .summit .flag { font-size: clamp(1.6rem, 2.6vw, 2.1rem); }
.road .summit .confetti { top: -6px; }
.pin {
  position: absolute; top: -0.9rem; right: 0.8rem;
  font: 800 0.7rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
  background: #ffe27a; color: #16130f; border: 2px solid #16130f; border-radius: 999px; padding: 0.35rem 0.55rem;
}
@media (min-width: 960px) {
  .road { grid-template-columns: repeat(5, 1fr); align-items: end; padding-top: 2rem; }
  .road li:nth-child(2) { margin-bottom: 2.5rem; }
  .road li:nth-child(3) { margin-bottom: 5rem; }
  .road li:nth-child(4) { margin-bottom: 7.5rem; }
  .road li:nth-child(5) { margin-bottom: 10rem; }
  .road::before {
    content: ""; position: absolute; left: 6%; right: 6%; bottom: 2rem; height: 11rem; z-index: -1;
    background: linear-gradient(to top right, transparent calc(50% - 2px), var(--accent) calc(50% - 2px), var(--accent) calc(50% + 2px), transparent calc(50% + 2px));
    opacity: 0.7;
  }
}
.goal-disclaimer { margin: 1.8rem 0 0; font-weight: 650; color: var(--muted); max-width: 70ch; }

/* Tip jar: Fuel the experiment */
.btn-tip { background: #ffc533; color: #16130f; border-color: #16130f; }
.btn-tip:hover { box-shadow: 4px 4px 0 var(--ink); }
.nav-tip {
  background: #ffc533; color: #16130f !important; border: 2px solid #16130f !important;
  border-radius: 999px; padding: 0.2rem 0.7rem !important;
}
.tip-note { margin: 0.7rem 0 0; font-size: 0.88rem; color: var(--muted); font-weight: 600; }
.fuel { background: #ffc533; color: #16130f; position: relative; overflow: hidden; isolation: isolate; }
.fuel .eyebrow { color: #16130f; }
.fuel .eyebrow::before { color: #16130f; }
.fuel .section-lead { color: #2b2620; }
.fuel-grid { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 900px) { .fuel-grid { grid-template-columns: 1.4fr 1fr; } }
.fuel .btn { border-color: #16130f; color: #16130f; }
.fuel .btn-primary { background: #16130f; color: #ffc533; }
.fuel .btn:hover { box-shadow: 4px 4px 0 #16130f; }
.fuel .tip-note { color: #2b2620; }
.fuel-list { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 0.5rem; }
.fuel-list li { font-weight: 650; display: flex; gap: 0.6rem; align-items: baseline; }
.fuel-list li::before { content: "\2192"; font-weight: 900; color: #b3320a; }
.fuel-art { width: 100%; max-width: 300px; margin: 0 auto; display: block; }
.f-cup { fill: #fffdf8; stroke: #16130f; stroke-width: 6; stroke-linejoin: round; }
.f-coffee { fill: #6b3b1f; }
.f-steam { fill: none; stroke: #16130f; stroke-width: 5; stroke-linecap: round; }
.f-rocket { fill: #ff4f1a; stroke: #16130f; stroke-width: 5; stroke-linejoin: round; }
.f-flame { fill: #fffdf8; stroke: #16130f; stroke-width: 4; stroke-linejoin: round; }
.f-window { fill: #fffdf8; stroke: #16130f; stroke-width: 4; }

/* Pages: small hero art */
.page-hero { position: relative; overflow: hidden; }
.page-hero .mini-art { position: absolute; right: var(--gutter); top: 50%; width: 140px; transform: translateY(-50%) rotate(8deg); display: none; }
@media (min-width: 900px) { .page-hero .mini-art { display: block; } .page-hero h1, .page-hero .sg-lead { padding-right: 170px; max-width: calc(60ch + 170px); } }

/* ---------- Motion (CSS only, opt-in) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .ticker-track { animation: ticker 36s linear infinite; }
  .hero h1, .hero-sub, .hero .btns { animation: rise 0.7s cubic-bezier(.2, .7, .2, 1) both; }
  .hero-sub { animation-delay: 0.08s; }
  .wink { animation: rise-wink 0.7s 0.16s cubic-bezier(.2, .7, .2, 1) both; }
  .hero .btns { animation-delay: 0.24s; }
  .goal-card { animation: rise 0.8s 0.2s cubic-bezier(.2, .7, .2, 1) both; }
  .goal-card .stamp { animation: thunk 0.5s 0.9s cubic-bezier(.3, 1.6, .5, 1) both; }
  .model .stamp-big { animation: thunk-big 0.55s cubic-bezier(.3, 1.6, .5, 1) both; }
  .model:nth-child(2) .stamp-big { animation-delay: 0.12s; }
  .model:nth-child(3) .stamp-big { animation-delay: 0.24s; }
  .model:nth-child(4) .stamp-big { animation-delay: 0.36s; }
  .soon::before { animation: pulse 1.6s ease-in-out infinite; }
  .coin { animation: float 4.5s ease-in-out infinite; }
  .coin-2 { animation-duration: 5.5s; animation-delay: -1.5s; }
  .coin-3 { animation-duration: 3.8s; animation-delay: -2.6s; }
  .coin svg { animation: spin 6s linear infinite; }
  .a-rain { animation: rain 3.2s linear infinite; }
  .a-rain.r2 { animation-delay: -0.7s; animation-duration: 2.6s; }
  .a-rain.r3 { animation-delay: -1.4s; animation-duration: 3.8s; }
  .a-rain.r4 { animation-delay: -2.1s; }
  .a-rain.r5 { animation-delay: -0.4s; animation-duration: 2.9s; }
  .a-cursor { animation: blink 1.05s steps(1) infinite; }
  .a-hist rect { animation: eq 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
  .a-hist rect:nth-child(2n) { animation-delay: -0.6s; }
  .a-hist rect:nth-child(3n) { animation-delay: -1.2s; animation-duration: 2s; }
  .a-line { stroke-dasharray: 420; animation: draw 1.6s 0.4s ease-out both; }
  .a-crash { stroke-dasharray: 200; animation: draw-crash 0.7s 2s ease-in both; }
  .a-boomg { animation: boom 0.5s 2.6s cubic-bezier(.3, 1.6, .5, 1) both; transform-box: fill-box; transform-origin: center; }
  .a-spark { animation: twinkle 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .a-spark.s2 { animation-delay: -0.6s; }
  .a-spark.s3 { animation-delay: -1.2s; }
  .odo-strip { animation: odo 2.4s 0.6s steps(4, end) both; }
  .confetti i { animation: fall 3.6s linear infinite; }
  .confetti i:nth-child(2) { animation-delay: -0.6s; animation-duration: 4.2s; }
  .confetti i:nth-child(3) { animation-delay: -1.4s; }
  .confetti i:nth-child(4) { animation-delay: -2.1s; animation-duration: 3.1s; }
  .confetti i:nth-child(5) { animation-delay: -2.8s; }
  .confetti i:nth-child(6) { animation-delay: -0.3s; animation-duration: 4.6s; }
  .confetti i:nth-child(7) { animation-delay: -1.9s; }
  .confetti i:nth-child(8) { animation-delay: -3.2s; animation-duration: 3.4s; }
  .road .here .pin { animation: bob 1.6s ease-in-out infinite; }
  .tomb:hover { transform: rotate(-3deg); transition: transform 0.2s ease; }
  .f-steam { animation: steam 2.4s ease-in-out infinite; }
  .f-steam.st2 { animation-delay: -0.8s; }
  .f-steam.st3 { animation-delay: -1.6s; }
  .fuel-art .f-rocketg { animation: hover-rocket 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  @supports (animation-timeline: view()) {
    .model .stamp-big, .model:nth-child(n) .stamp-big {
      animation: thunk-big linear both;
      animation-delay: 0s;
      animation-timeline: view();
      animation-range: entry 20% cover 40%;
    }
  }
}
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes rise-wink { from { opacity: 0; transform: translateY(14px) rotate(-1.5deg); } to { opacity: 1; transform: rotate(-1.5deg); } }
@keyframes thunk {
  0% { opacity: 0; transform: scale(2.2) rotate(-14deg); }
  70% { opacity: 1; transform: scale(0.94) rotate(-2deg); }
  100% { opacity: 1; transform: scale(1) rotate(-3deg); }
}
@keyframes thunk-big {
  0% { opacity: 0; transform: scale(2.6) rotate(-24deg); }
  70% { opacity: 1; transform: scale(0.92) rotate(-9deg); }
  100% { opacity: 1; transform: scale(1) rotate(-11deg); }
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.7); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes spin { 0%, 40% { transform: rotateY(0); } 60%, 100% { transform: rotateY(360deg); } }
@keyframes rain { 0% { transform: translateY(-14px); opacity: 0; } 30% { opacity: 0.55; } 100% { transform: translateY(18px); opacity: 0; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes eq { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.82); } }
@keyframes draw { from { stroke-dashoffset: 420; } to { stroke-dashoffset: 0; } }
@keyframes draw-crash { from { stroke-dashoffset: 200; } to { stroke-dashoffset: 0; } }
@keyframes boom { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes twinkle { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.5); opacity: 0.4; } }
@keyframes odo { from { transform: translateY(0); } to { transform: translateY(-4em); } }
@keyframes fall { 0% { transform: translateY(0) rotate(0); opacity: 0; } 10% { opacity: 1; } 100% { transform: translateY(240px) rotate(540deg); opacity: 0; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes steam { 0%, 100% { transform: translateY(0); opacity: 0.9; } 50% { transform: translateY(-8px); opacity: 0.35; } }
@keyframes hover-rocket { 0%, 100% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(0, -8px) rotate(-3deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .ticker { white-space: normal; }
  .ticker-track { flex-wrap: wrap; justify-content: center; row-gap: 0.6rem; }
  .ticker-track .dup { display: none; }
}

/* =====================================================================
   Data-nerd motifs: shell prompts, commit-log nodes, dropped tables
   ===================================================================== */
.eyebrow::before { content: "$ "; color: var(--glow-ink); font-weight: 800; }
.timeline li::before { border-radius: 4px; }
.timeline li.t-next::before { border-radius: 4px; }
.tomb::after {
  content: "-- table dropped";
  display: block; margin-top: 0.6rem;
  font: 700 0.68rem/1.3 var(--mono); letter-spacing: 0.06em; color: #3d362c;
}
.tomb-reserved::after { content: "-- table reserved"; color: var(--next); }
.cost-amount { font-family: var(--mono); font-weight: 800; letter-spacing: -0.01em; }
.model-icon { background: var(--screen); color: #3ee6c1; border-color: var(--ink); }
.ticker-track .t-next { color: #6fe0b4; }
.stamp-next { color: var(--glow-ink); }

/* =====================================================================
   The dataset + "Show me the data" (two layers: plain on top, data underneath)
   ===================================================================== */
.ds-term {
  background: var(--screen); color: #d9f7ef; border: 2px solid var(--ink);
  border-radius: var(--radius); box-shadow: 6px 6px 0 var(--ink);
  padding: clamp(1rem, 3vw, 1.6rem);
}
.ds-prompt, .ds-result, .nerd-cmd { font: 700 0.85rem/1.4 var(--mono); margin: 0 0 1rem; color: #3ee6c1; overflow-wrap: anywhere; }
.ds-prompt::after { content: ""; display: inline-block; width: 0.55em; height: 1em; margin-left: 0.2em; vertical-align: -0.15em; background: #3ee6c1; }
.ds-result { margin: 1rem 0 0; color: #ff8a63; }
.ds-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.ds-tile { border: 1px solid rgba(62, 230, 193, 0.28); border-radius: 10px; padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.ds-n {
  display: block; width: fit-content; max-width: 100%;
  font: 800 clamp(1.8rem, 4.2vw, 2.5rem)/1.05 var(--mono);
  letter-spacing: -0.03em; color: #f3efe6; font-variant-numeric: tabular-nums;
}
.ds-u { font: 700 0.75rem/1.35 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: #3ee6c1; }
.ds-x { font-size: 0.95rem; color: #c9ddd7; }
.ds-punch { font-size: clamp(1.1rem, 2vw, 1.35rem); font-weight: 750; max-width: 60ch; margin: 1.6rem 0 0; }

.nerd { margin: 0 0 1.2rem; border: 1px dashed var(--line); border-radius: 10px; }
.nerd > summary {
  cursor: pointer; list-style: none; padding: 0.6rem 0.85rem;
  font: 700 0.8rem/1.3 var(--mono); letter-spacing: 0.04em; color: var(--glow-ink);
}
.nerd > summary::-webkit-details-marker { display: none; }
.nerd > summary::before { content: "$ "; font-weight: 800; }
.nerd > summary::after { content: " [+]"; color: var(--muted); }
.nerd[open] > summary::after { content: " [\2212]"; }
.nerd > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.nerd-body {
  background: var(--screen); color: #d9f7ef; border-radius: 0 0 9px 9px;
  padding: 0.9rem 1rem 1rem; font: 0.82rem/1.5 var(--mono);
}
.nerd-dl { margin: 0.6rem 0; display: grid; gap: 0.35rem; }
.nerd-dl div { display: grid; grid-template-columns: minmax(7.5rem, 30%) 1fr; gap: 0.6rem; }
.nerd-dl dt { color: #3ee6c1; font-weight: 700; }
.nerd-dl dt::after { content: ":"; }
.nerd-dl dd { margin: 0; overflow-wrap: anywhere; }
.nerd-note { margin: 0.7rem 0 0; color: #c9ddd7; font-family: var(--font); font-size: 0.9rem; }
.nerd-note b { color: #ff8a63; }
.nerd-links { margin: 0.7rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }
.nerd-link { color: #3ee6c1; font-weight: 700; text-underline-offset: 3px; }
.nerd-link:hover { color: #f3efe6; }
.dataset .nerd { margin-top: 1.4rem; }
.dataset .nerd-body > .nerd-link { display: inline-block; margin-top: 0.7rem; }
.sg-page .nerd-table { font-size: 0.8rem; margin: 0.8rem 0 0; }
.sg-page .nerd-table th { background: rgba(62, 230, 193, 0.12); color: #3ee6c1; }
.sg-page .nerd-table td { border-bottom-color: rgba(62, 230, 193, 0.18); }
.sg-page .nerd-table td:nth-child(2) { text-align: right; white-space: nowrap; color: #f3efe6; }

.mini { display: block; width: 100%; max-width: 420px; height: auto; margin: 0.2rem 0 0.6rem; }
.mini-wide { max-width: 560px; }
.mc-lbl, .mc-val, .mc-tick { font-family: var(--mono); font-size: 9.5px; fill: #c9ddd7; }
.mc-val { font-weight: 700; fill: #f3efe6; }
.mc-tick { font-size: 8.5px; fill: #8fb3aa; }
.mc-track { fill: rgba(62, 230, 193, 0.1); }
.mc-bar { fill: #ff8a63; }
.mc-base { fill: #8fb3aa; }
.mc-hit { fill: #3ee6c1; }
.mc-ref { stroke: #f3efe6; stroke-width: 1.5; stroke-dasharray: 3 3; fill: none; }
.mc-grid { stroke: rgba(62, 230, 193, 0.18); stroke-width: 1; fill: none; }

@keyframes ds-type { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes ds-glow { 0% { color: #3ee6c1; text-shadow: 0 0 12px rgba(62, 230, 193, 0.7); } 100% { color: #f3efe6; text-shadow: none; } }
@media (prefers-reduced-motion: no-preference) {
  .ds-n { animation: ds-type 1s steps(11, end) both, ds-glow 1.6s ease-out both; }
  .ds-tile:nth-child(2) .ds-n { animation-delay: 0.15s, 0.15s; }
  .ds-tile:nth-child(3) .ds-n { animation-delay: 0.3s, 0.3s; }
  .ds-tile:nth-child(4) .ds-n { animation-delay: 0.45s, 0.45s; }
  .ds-tile:nth-child(5) .ds-n { animation-delay: 0.6s, 0.6s; }
  .ds-tile:nth-child(6) .ds-n { animation-delay: 0.75s, 0.75s; }
  .ds-prompt::after { animation: blink 1s steps(1) infinite; }
  @supports (animation-timeline: view()) {
    .ds-tile:nth-child(n) .ds-n { animation-timeline: view(), view(); animation-range: entry 0% entry 100%, entry 0% entry 100%; animation-delay: 0s, 0s; }
  }
}

/* =====================================================================
   Avatar (approved cartoon of Raivo). Images only, sized up front so nothing shifts.
   ===================================================================== */
/* Hero: Raivo stands behind the desk, in front of the monitor */
.art { isolation: isolate; }
.hero-art { position: relative; z-index: 1; width: 74%; margin-left: auto; }
.hero-avatar {
  position: absolute; z-index: 2;
  left: 0; bottom: 14.5%;
  width: 58%; height: auto; aspect-ratio: 1;
  /* keep the person, drop the pose's own dashboard wall so it doesn't fight the monitor */
  clip-path: polygon(36% 21%, 41% 13%, 50% 9.5%, 60% 10.5%, 65% 16%, 65% 34%, 69.5% 36%, 69.5% 58%, 82% 61%, 83% 100%, 17% 100%, 18% 61%, 30.5% 58%, 30.5% 36%, 35% 34%);
}
.desk {
  position: absolute; z-index: 3;
  left: -1%; right: -1%; bottom: 12.5%; height: 4.6%;
  background: #16130f;
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.16), 0 8px 0 -2px rgba(22, 19, 15, 0.18);
}
.coin { z-index: 4; }

/* Section poses: an arch-shaped portrait frame with a flat bottom, like the art itself */
.pose {
  display: block;
  width: clamp(190px, 24vw, 280px); height: auto; aspect-ratio: 1;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(180deg, #fffdf8, #efe9db);
  border: 3px solid var(--ink);
  border-radius: 999px 999px 18px 18px;
  box-shadow: 6px 6px 0 var(--ink);
  padding: 18px 12px 0;
  box-sizing: border-box;
}
.pose--float { float: right; margin: 0 0 1.5rem 2rem; }
.tombs, .lessons { clear: both; }
.pose--col { margin: 0 0 1.75rem; }
@media (max-width: 719px) {
  .pose--float { float: none; margin: 0 auto 1.5rem; width: 220px; }
  .pose--col { margin: 0 auto 1.5rem; width: 220px; }
}

/* Road: celebrating on the summit stop (no frame: he stands on the card) */
.pose--summit {
  background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0;
  width: 160px; margin: -0.4rem auto 0.4rem;
}
@media (min-width: 960px) {
  .road .summit { overflow: visible; }
  .pose--summit {
    position: absolute; z-index: 1;
    left: 50%; bottom: calc(100% - 3px);
    width: 170px; margin: 0;
    transform: translateX(-50%);
  }
}

/* Footer: round author mark */
.author-line { display: flex; gap: 0.8rem; align-items: center; }
.author-mark { width: 44px; height: 44px; flex: none; border-radius: 50%; box-shadow: 0 0 0 2px var(--bar-hot); }

/* Dark mode: light frames keep the ink outlines readable; free-standing poses get a soft rim */
@media (prefers-color-scheme: dark) {
  .pose { background: linear-gradient(rgba(22, 19, 15, 0.06) 1px, transparent 1px) 0 0 / 100% 28px, linear-gradient(180deg, #efe7d6, #d4cab6); }
  .hero-avatar, .pose--summit { filter: drop-shadow(0 0 1.2px rgba(243, 239, 230, 0.95)) drop-shadow(0 0 10px rgba(62, 230, 193, 0.18)); }
  .pose--summit { filter: none; }
}

/* Gentle idle bob, off under reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .hero-avatar { animation: avatar-bob 4.8s ease-in-out infinite; }
  .pose--summit { animation: avatar-hop 2.6s ease-in-out infinite; }
}
@keyframes avatar-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes avatar-hop { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }

/* Hero at desktop widths: one compact unit. Text top-aligned with the art; the art is
   capped by viewport height so avatar + monitor stay side by side within the first screen;
   the goal card tucks up under the desk. */
@media (min-width: 960px) {
  .hero-grid > div:first-child { padding-top: clamp(0.5rem, 2vh, 1.5rem); }
  .art { width: min(100%, 520px, calc((100vh - 170px) * 1.25)); margin-bottom: 0.5rem; }
  .goal-card { margin-top: -0.5rem; }
}

/* ---------- Print ---------- */
@media print {
  .sg-banner { position: static; }
  .ticker, .site-nav, .btns, .coin, .confetti, .fuel { display: none; }
  .ds-term, .nerd-body { box-shadow: none; }
  .goal-card, .model, .panel--accent, .sg-toc, .tomb { box-shadow: none; }
}
