/* ===========================================================================
   Slide decks (`lib/registries/decks.ts`) — the stylesheet every deck shares.

   Ported from ligangyan.com's deck.css, with the class names kept so a deck
   written for either site drops into the other. What changed is the palette and
   the faces: this site is light-only ("Terminal", see src/globals.css), so the
   deck tokens below are the site's own values under the names the fragments
   use (--surface, --ink, --line …), and the fonts are the three self-hosted
   ones. A deck may still override any token in its own <style>.

   Layout: a numbered rail on the left (sticky), one full-screen
   <section class="panel"> per slide on the right; on a phone the rail becomes
   a row of numbers above the first slide. deck.js highlights the rail and
   pages with the keyboard.
   =========================================================================== */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/BricolageGrotesque-Variable.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Variable.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --font-display: "Bricolage Grotesque", "Geist", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-sans: "Geist", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface2: #eef2f8;
  --line: #dde2ea;
  --ink: #101828;
  --ink2: #475467;
  --muted: #5b6472;
  --accent: #1f5eff;
  --accent-soft: #eaf0ff;
  --steel: #98a2b3;
  --pos: #0f7b4f;
  --pos-soft: #e6f4ec;
  --neg: #c2410c;
  --neg-soft: #fdede6;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --grid: #eef2f8;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
a { color: var(--accent); }

/* The way back to the blog, and the other edition. */
.deck-bar { position: fixed; top: 12px; right: 16px; z-index: 50; display: flex; gap: 8px; font: 500 12px/1 var(--font-mono); }
.deck-bar a { color: var(--ink2); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; }
.deck-bar a:hover { color: var(--accent); border-color: var(--accent); }

/* ---- rail + panels -------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
nav.rail {
  position: sticky; top: 0; height: 100vh; overflow: auto;
  display: flex; flex-direction: column; gap: 2px;
  padding: 28px 16px; border-right: 1px solid var(--line); background: var(--surface);
}
nav.rail .brand { font: 600 12px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 8px 14px; }
nav.rail a {
  display: grid; grid-template-columns: 26px 1fr; gap: 6px; align-items: baseline;
  color: var(--ink2); text-decoration: none; font-size: 13px; line-height: 1.35; padding: 6px 8px; border-radius: 6px;
}
nav.rail a .n { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
nav.rail a:hover { background: var(--bg); }
nav.rail a.on { background: var(--accent-soft); color: var(--ink); }
nav.rail a.on .n { color: var(--accent); }
nav.rail a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
nav.rail .hint { margin: auto 8px 0; padding-top: 16px; font-size: 11px; color: var(--muted); line-height: 1.5; }

main { min-width: 0; }
section.panel {
  min-height: 100vh; padding: 64px 72px 56px;
  display: flex; flex-direction: column; justify-content: center; gap: 24px;
  border-bottom: 1px solid var(--line);
}
section.panel.cover { background: var(--surface); }

.eyebrow { display: flex; gap: 12px; align-items: baseline; color: var(--muted); font: 500 13px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.eyebrow .n { color: var(--accent); }
h1, h2, h3 { margin: 0; text-wrap: balance; font-family: var(--font-display); color: var(--ink); }
.panel h1 { font-size: 60px; line-height: 1.05; font-weight: 700; letter-spacing: -.02em; }
.panel h2 { font-size: 38px; line-height: 1.12; font-weight: 700; letter-spacing: -.01em; }
.panel h3 { font-size: 20px; line-height: 1.3; font-weight: 650; }
.thesis { font-size: 19px; color: var(--ink2); max-width: 62ch; margin: 0; }
.foot { font-size: 13px; color: var(--muted); line-height: 1.6; max-width: 90ch; margin: 0; }

/* ---- blocks ---------------------------------------------------------------- */
.grid2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 36px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; }
.card h3 { margin-bottom: 6px; }
.card p { margin: 0; color: var(--ink2); font-size: 15px; line-height: 1.55; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .l { font: 500 12px/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi .v { font: 600 36px/1.05 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi .s { font-size: 13px; color: var(--ink2); }
.kpi .v.neg { color: var(--neg); } .kpi .v.pos { color: var(--pos); }
.big { font: 700 64px/1 var(--font-mono); color: var(--ink); }
.big.neg { color: var(--neg); } .big.pos { color: var(--pos); }
.neg { color: var(--neg); } .pos { color: var(--pos); }
ul.pts, .pts { margin: 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 8px; color: var(--ink2); max-width: 64ch; }
.pts strong { color: var(--ink); }
.quote { font: 600 26px/1.3 var(--font-display); color: var(--ink); max-width: 30ch; border-left: 3px solid var(--accent); padding-left: 18px; margin: 0; }
.callout { background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; color: var(--ink2); font-size: 15px; line-height: 1.6; }
.callout b { color: var(--ink); }
.callout.warn { background: var(--neg-soft); border-color: var(--neg); }
.formula { font-family: var(--font-mono); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; font-size: 15px; color: var(--ink); overflow-x: auto; }
.tag { display: inline-block; font: 600 11px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; border: 1px solid var(--line); color: var(--ink2); background: var(--surface); }
.tag.pos { color: var(--pos); border-color: var(--pos); background: var(--pos-soft); }
.tag.neg { color: var(--neg); border-color: var(--neg); background: var(--neg-soft); }
.tag.accent { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.chain { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.chain .step { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.chain .step.key { border-color: var(--accent); }
.chain .step .n { font-family: var(--font-mono); color: var(--accent); font-size: 12px; }
.chain .step b { display: block; font: 650 20px/1.25 var(--font-display); margin: 4px 0 6px; color: var(--ink); }
.chain .step span { display: block; font-size: 14px; color: var(--ink2); line-height: 1.45; }
.belief { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.belief h3 { margin: 0 0 8px; }
.belief p { margin: 0 0 8px; font-size: 15px; color: var(--ink2); line-height: 1.55; }
.belief .w { font-size: 13px; color: var(--neg); border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ---- charts and tables ------------------------------------------------------ */
figure { margin: 0; }
figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }
svg { max-width: 100%; height: auto; }
svg text { font-family: var(--font-sans); fill: var(--ink2); font-size: 12px; }
svg text.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
svg .grid { stroke: var(--grid); stroke-width: 1; }
svg .axis { stroke: var(--line); stroke-width: 1; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.tw { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; background: var(--surface); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { color: var(--muted); font: 500 11px/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; background: var(--surface2); }
th:first-child, td:first-child { text-align: left; }
td.mono, th.mono, td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
tr.hl td { background: var(--accent-soft); font-weight: 600; }
td.left { text-align: left; color: var(--muted); }

/* ---- narrow screens ----------------------------------------------------------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  nav.rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 56px 16px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  nav.rail .brand, nav.rail .hint { display: none; }
  nav.rail a { grid-template-columns: auto; padding: 4px 8px; }
  nav.rail a span:last-child { display: none; }
  section.panel { min-height: auto; padding: 44px 16px; }
  .panel h1 { font-size: 36px; }
  .panel h2 { font-size: 26px; }
  .big { font-size: 44px; }
  .kpi .v { font-size: 28px; }
  .grid2, .grid3, .cols, .belief { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .chain { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .chain { grid-template-columns: 1fr; }
  .deck-bar { top: 10px; right: 12px; }
}
