:root {
  --paper: #faf8f4;
  --cream: #f0ebe0;
  --rule: #d8d3c8;
  --ink: #1a1a1a;
  --muted: #6f6a5f;
  --accent: #f97316;
  --accent-ink: #c2410c;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --s9: 96px;

  --mono: "IBM Plex Mono", "SF Mono", ui-monospace, monospace;
  --serif: "Playfair Display", Georgia, serif;
  --radius: 3px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 var(--mono);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
p { margin: 0 0 var(--s4); max-width: 65ch; }
strong { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.wrap { width: 100%; max-width: 780px; margin: 0 auto; padding-inline: var(--s5); }

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1.5px solid var(--rule);
}
.nav-in { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.brand { display: flex; align-items: center; gap: var(--s2); font-weight: 600; text-decoration: none; }
.brand svg rect { fill: var(--accent); }
.links { display: flex; gap: var(--s4); font-size: 14px; }
.links a { color: var(--muted); text-decoration: none; }
.links a:hover { color: var(--ink); }

.hero { text-align: center; padding-block: var(--s8) var(--s6); }
.mouse { display: flex; justify-content: center; margin-bottom: var(--s5); }
.mouse svg rect { fill: var(--accent); }
h1 {
  font: 700 48px/1.1 var(--serif);
  margin: 0;
}
.lede {
  font: italic 400 20px/1.45 var(--serif);
  color: var(--muted);
  margin: var(--s3) auto 0;
  max-width: 34em;
  text-wrap: balance;
}
.status {
  margin: var(--s5) auto 0;
  font-size: 14px;
  max-width: 60ch;
  min-height: 0;
}

.stage { border-block: 1.5px solid var(--rule); }
.brain { width: 100%; height: clamp(420px, 72vh, 780px); position: relative; }
.stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding-block: var(--s3);
}
.views { display: flex; gap: var(--s1); }
.views button {
  font: 500 13px/1 var(--mono);
  padding: var(--s2) var(--s3);
  min-height: 44px;
  background: transparent;
  color: var(--muted);
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.views button:hover { color: var(--ink); }
.views button[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); }
.caption { margin: 0; font-size: 13px; color: var(--muted); max-width: 52ch; }

.sec { padding-block: var(--s8); border-bottom: 1.5px solid var(--rule); }
.sec:last-of-type { border-bottom: 0; }
h2 { font: 700 30px/1.2 var(--serif); margin: 0 0 var(--s6); text-wrap: balance; }

.book { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--s4); margin-bottom: var(--s5); }
.equity { font: 700 48px/1 var(--serif); margin: 0 0 var(--s2); font-variant-numeric: lining-nums tabular-nums; }
.book p { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin-bottom: var(--s6); }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
thead th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  padding: var(--s2) var(--s3) var(--s2) 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}
td { padding: var(--s2) var(--s3) var(--s2) 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td.sym { font-weight: 600; }
.up { color: var(--accent-ink); }
.bought { color: var(--accent-ink); font-weight: 500; }

.term { border-top: 2px solid var(--ink); }
.term-bar { font-size: 14px; color: var(--muted); padding: var(--s2) 0; border-bottom: 1px solid var(--ink); }
.term-body {
  list-style: none;
  margin: 0;
  padding: var(--s2) 0;
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink);
}
.term-body li { display: grid; grid-template-columns: 5.5ch 6ch 7ch 1fr; gap: var(--s3); border-bottom: 1px solid var(--rule); }
.term-body .t { color: var(--muted); }
.term-body .k { font-weight: 600; }
.term-body .hear { color: var(--muted); }
.term-body .buy { color: var(--accent-ink); font-weight: 600; }
.term-body .sell { font-weight: 600; }
.term-body .hold, .term-body .empty { color: var(--muted); }

.foot { padding-block: var(--s6) var(--s8); font-size: 13px; color: var(--muted); text-align: center; }
.foot p { margin-inline: auto; }

/* Motion. Whole steps everywhere; nothing eases. */
.nav { animation: drop 0.4s steps(4) both; }
@keyframes drop { from { transform: translateY(-100%); } }
.brand svg { animation: none; }
.brand:hover svg { animation: bob 0.3s steps(2) infinite alternate; }
@keyframes bob { to { transform: translateY(-2px); } }

.floor { display: flex; justify-content: center; margin-bottom: var(--s5); overflow: hidden; }
.mouse { will-change: transform; }

h1 .w, h2 .w {
  display: inline-block;
  animation: rise 0.36s steps(3) both;
  animation-delay: calc(var(--i) * 90ms);
}
h1 .w { animation-delay: calc(700ms + var(--i) * 90ms); }
@keyframes rise { from { opacity: 0; transform: translateY(0.4em); } }
.lede { animation: fade 0.5s steps(4) 1s both; }
.status { animation: fade 0.5s steps(4) 1.4s both; }
@keyframes fade { from { opacity: 0; } }

.reveal { opacity: 0; transform: translateY(16px); }
.reveal.in { animation: reveal 0.4s steps(4) both; }
@keyframes reveal { to { opacity: 1; transform: none; } }

.listen {
  position: relative;
  width: min(100%, 420px);
  height: 12px;
  margin: var(--s3) auto 0;
  border: 1.5px solid var(--ink);
  background: var(--paper);
}
.listen-fill { position: absolute; inset: 0; width: 0; background: var(--accent); transition: width 2s steps(8); }
.listen-label { position: absolute; left: 0; right: 0; top: 16px; font-size: 12px; color: var(--muted); }
.listen { margin-bottom: var(--s5); }

.raster-wrap { border-top: 1.5px solid var(--rule); padding-block: var(--s4) var(--s3); }
.raster { display: block; width: 100%; image-rendering: pixelated; }
.raster-cap { font-size: 12px; color: var(--muted); margin: var(--s2) auto 0; max-width: 780px; }

.checker, .sec::before {
  content: "";
  display: block;
  height: 12px;
  background: repeating-conic-gradient(var(--ink) 0 25%, transparent 0 50%) 0 0 / 12px 12px;
  opacity: 0.12;
  animation: crawl 1s steps(1) infinite;
}
.sec::before { margin: calc(var(--s8) * -1) calc(50% - 50vw) var(--s8); }
@keyframes crawl { 50% { background-position: 12px 0; } }

.views button { transition: none; }
.views button:hover { background: var(--ink); color: var(--paper); }

.equity.flash { animation: pop 0.5s steps(3); }
@keyframes pop { 30% { color: var(--accent-ink); transform: translateY(-4px); } }
td.flash { animation: cell 0.8s steps(4); }
@keyframes cell { 0%, 60% { background: #fed7aa; } }
tr.listening td.sym { color: var(--accent-ink); }
tr.listening td.sym::after { content: " *"; animation: blink 1s steps(1) infinite; }
tr.added { animation: reveal 0.3s steps(3) both; }

.term-bar { display: flex; justify-content: space-between; }
.term-live { color: var(--muted); }
.term-live.on { color: var(--accent-ink); }
.term-live.on::before { content: "\25A0 "; animation: blink 1.2s steps(1) infinite; }
.term-body li.added { animation: reveal 0.25s steps(2) both; }
.term-body .typing::after { content: "\2588"; color: var(--accent); }
.term-foot { padding: var(--s1) 0 var(--s2); }
.cursor { display: inline-block; width: 8px; height: 15px; background: var(--ink); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.brain { transition: none; }
.stage.busy .brain { animation: shiver 0.2s steps(2) 3; }
@keyframes shiver { 50% { transform: translateX(3px); } }

@media (prefers-reduced-motion: reduce) {
  .nav, .lede, .status, .reveal, .reveal.in, h1 .w, h2 .w, .sec::before, .checker, .equity.flash, td.flash, .brand:hover svg, .stage.busy .brain, tr.listening td.sym::after, .cursor, .term-live.on::before { animation: none; }
  .reveal { opacity: 1; transform: none; }
  .listen-fill { transition: none; }
}

@media (max-width: 560px) {
  .wrap { padding-inline: var(--s4); }
  .hero { padding-block: var(--s7) var(--s5); }
  .links { gap: var(--s3); font-size: 13px; }
  .equity { font-size: 36px; }
  .term-body li { grid-template-columns: 5.5ch 6ch 1fr; }
  .term-body li .c { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

h3 { font: 700 20px/1.2 var(--serif); margin: var(--s6) 0 var(--s4); }
.refs { padding-left: 1.4em; margin: 0; max-width: 65ch; font-size: 14px; }
.refs li { margin-bottom: var(--s3); }
.lede a { color: inherit; }

/* Inner pages */
.page { padding-block: var(--s7) var(--s8); }
.page-h { font: 700 40px/1.1 var(--serif); margin: 0 0 var(--s4); }
.lede.left { text-align: left; margin: 0 0 var(--s6); animation: none; }
.prose h2 { margin-top: var(--s7); font-size: 24px; }
.prose p { max-width: 68ch; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s4); margin: var(--s5) 0 var(--s3); font-size: 14px; }
.filters select { font: inherit; background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); border-radius: var(--radius); padding: var(--s2) var(--s3); min-height: 44px; }
table.neurons td, table.neurons th { font-size: 13px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s5); margin: var(--s5) 0 var(--s6); font-size: 14px; max-width: 68ch; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.arbor { margin: var(--s5) 0; }
.arbor svg { display: block; width: 100%; max-width: 520px; height: auto; }
.arbor .scale { margin: var(--s2) 0 0; }
.button { display: inline-block; font-weight: 600; padding: var(--s2) var(--s4); min-height: 44px; line-height: 28px; border: 1.5px solid var(--ink); border-radius: var(--radius); text-decoration: none; }
.button:hover { background: var(--ink); color: var(--paper); }
.links a[aria-current] { color: var(--ink); }
