/* Server-rendered public pages (server/site/). One file, no JavaScript.
   Tokens are the Frost shell's (src/styles/app.css); corners stay square. */

@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/sora-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/sora-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Metric-matched fallbacks (src/index.css): the swap does not move text. */
@font-face {
  font-family: 'Sora Fallback';
  src: local('Arial');
  size-adjust: 130.95%;
  ascent-override: 74.08%;
  descent-override: 22.15%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'JetBrains Mono Fallback';
  src: local('Courier New');
  size-adjust: 99.98%;
  ascent-override: 102.02%;
  descent-override: 30.01%;
  line-gap-override: 0%;
}

:root {
  --bg-0: #0b0f14;
  --bg-1: #0f1520;
  --bg-2: #151d28;
  --border-1: #1a2430;
  --border-2: #2a3a4a;
  --text-1: #dce4ec;
  --text-2: #a8bdd0;
  --text-3: #7a95ad;
  --profit: #6ec6ff;
  --profit-dim: #6ec6ff1f;
  --loss: #ff6e8a;
  --loss-dim: #ff6e8a1f;
  --ff-display: 'Sora', 'Sora Fallback', sans-serif;
  --ff-mono: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
  --gutter: 16px;
  --measure: 68ch;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--bg-0);
  /* Ledger rules: faint columns behind the page, like ruled paper. */
  background-image:
    radial-gradient(1200px 420px at 50% -120px, #6ec6ff14, transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 119px, #1a243055 119px 120px);
  color: var(--text-1);
  font-family: var(--ff-display);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: var(--profit); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--profit); outline-offset: 2px; }

.skip {
  position: absolute;
  left: var(--gutter);
  top: -48px;
  padding: 8px 12px;
  background: var(--profit);
  color: var(--bg-0);
  font-family: var(--ff-mono);
  font-size: 13px;
  z-index: 10;
}
.skip:focus { top: 8px; }

/* ── Header / footer ───────────────────────────────────────── */

.site-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px var(--gutter);
  border-bottom: 1px solid var(--border-1);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-1);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand b { color: var(--profit); font-weight: 700; }
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-nav a { color: var(--text-2); text-decoration: none; padding: 6px 0; border-bottom: 1px solid transparent; }
.site-nav a:hover { color: var(--text-1); }
.site-nav a[aria-current="page"] { color: var(--text-1); border-bottom-color: var(--profit); }

main { display: block; max-width: 1120px; margin: 0 auto; padding: 32px var(--gutter) 64px; }

.site-foot {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px var(--gutter) 48px;
  border-top: 1px solid var(--border-1);
  color: var(--text-3);
  font-size: 13px;
}
.site-foot p { max-width: var(--measure); margin: 0 0 12px; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; font-family: var(--ff-mono); font-size: 12px; }

/* ── Page head ─────────────────────────────────────────────── */

.eyebrow {
  margin: 0 0 12px;
  color: var(--text-3);
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.eyebrow b { color: var(--profit); font-weight: 600; }

h1 {
  margin: 0 0 16px;
  font-size: clamp(28px, 6vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
  max-width: 22ch;
}
.lede { max-width: var(--measure); margin: 0 0 24px; color: var(--text-2); font-size: 17px; }

h2 {
  margin: 48px 0 8px;
  font-size: clamp(20px, 3.4vw, 26px);
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h2 .num-tag {
  display: block;
  margin-bottom: 6px;
  color: var(--text-3);
  font-family: var(--ff-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.12em;
}
h3 { margin: 28px 0 8px; font-size: 18px; }
.section-lede { max-width: var(--measure); margin: 0 0 16px; color: var(--text-2); }

/* ── Key figures (the hero tape's grammar) ─────────────────── */

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 24px 0 8px;
  padding: 0;
  border-top: 1px solid var(--border-2);
  border-left: 1px solid var(--border-2);
}
.facts > div { padding: 14px 14px 12px; border-right: 1px solid var(--border-2); border-bottom: 1px solid var(--border-2); background: #0f152099; }
.facts dt { color: var(--text-3); font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.facts dd { margin: 4px 0 0; font-family: var(--ff-mono); font-size: clamp(18px, 4.6vw, 24px); font-variant-numeric: tabular-nums; }
.facts dd small { color: var(--text-3); font-size: 12px; }

.stamp { color: var(--text-3); font-family: var(--ff-mono); font-size: 12px; }

/* ── Tables ────────────────────────────────────────────────── */

.table-wrap { margin: 16px 0 8px; overflow-x: auto; border: 1px solid var(--border-1); background: #0f1520cc; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
caption { padding: 10px 12px; color: var(--text-3); font-family: var(--ff-mono); font-size: 12px; text-align: left; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border-1); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--text-3); font-family: var(--ff-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #151d2899; }
td.num, th.num { text-align: right; font-family: var(--ff-mono); font-variant-numeric: tabular-nums; }
td.name { font-family: var(--ff-mono); color: var(--text-1); }
td.wrap { white-space: normal; min-width: 18ch; }
.muted { color: var(--text-3); }
.pos { color: var(--profit); }
.neg { color: var(--loss); }

/* Verdict tags: form carries the state, colour only for the two decided ones. */
.tag {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tag--beats { border-color: var(--profit); background: var(--profit-dim); color: var(--profit); }
.tag--fails { border-color: var(--loss); background: var(--loss-dim); color: var(--loss); }
.tag--unmeasured { border-style: dashed; color: var(--text-3); }
.tag--long { border-color: var(--profit); color: var(--profit); }
.tag--short { border-color: var(--loss); color: var(--loss); }

/* 95% interval against its benchmark: the bar is the interval, the rule the
   benchmark, the square the point estimate. Positions arrive as --lo/--hi/
   --mark/--pt percentages of the axis. */
.ci { position: relative; display: block; width: 160px; height: 14px; }
.ci::before { content: ''; position: absolute; left: 0; right: 0; top: 6px; height: 1px; background: var(--border-2); }
.ci-range { position: absolute; top: 3px; height: 7px; left: var(--lo); width: calc(var(--hi) - var(--lo)); background: var(--text-3); opacity: 0.55; }
.ci-mark { position: absolute; top: 0; bottom: 0; left: var(--mark); width: 1px; background: var(--text-1); }
.ci-pt { position: absolute; top: 4px; left: var(--pt); width: 5px; height: 5px; margin-left: -2px; background: var(--text-1); }
.ci--beats .ci-range { background: var(--profit); opacity: 0.8; }
.ci--fails .ci-range { background: var(--loss); opacity: 0.8; }

/* Long/short split, blue long, red short. */
.split { display: flex; height: 10px; margin: 8px 0 4px; border: 1px solid var(--border-2); }
.split span:first-child { background: var(--profit); }
.split span:last-child { background: var(--loss); }

/* ── Prose (Learn) ─────────────────────────────────────────── */

.prose { max-width: var(--measure); }
.prose p, .prose li { color: var(--text-1); }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose h2 { margin-top: 40px; }
.prose strong { color: #fff; }
code {
  padding: 1px 5px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  font-family: var(--ff-mono);
  font-size: 0.88em;
}
.formula {
  margin: 16px 0 20px;
  padding: 14px 16px;
  overflow-x: auto;
  border-left: 2px solid var(--profit);
  background: var(--bg-1);
  font-family: var(--ff-mono);
  font-size: 14px;
  white-space: pre;
}
.note {
  max-width: var(--measure);
  margin: 20px 0;
  padding: 12px 16px;
  border: 1px solid var(--border-2);
  border-left: 2px solid var(--text-3);
  color: var(--text-2);
  font-size: 15px;
}
.note b { color: var(--text-1); }

/* ── Card grid (Learn index, Coins) ────────────────────────── */

.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 24px 0; border-top: 1px solid var(--border-2); border-left: 1px solid var(--border-2); }
.card {
  display: block;
  padding: 18px 18px 16px;
  border-right: 1px solid var(--border-2);
  border-bottom: 1px solid var(--border-2);
  background: #0f152099;
  color: var(--text-1);
  text-decoration: none;
}
.card:hover { background: var(--bg-2); }
.card .k { display: block; margin-bottom: 6px; color: var(--text-3); font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.card .t { display: block; margin-bottom: 6px; font-weight: 600; font-size: 17px; line-height: 1.3; }
.card .d { display: block; color: var(--text-2); font-size: 14px; line-height: 1.5; }

.related { margin: 40px 0 0; padding-top: 20px; border-top: 1px solid var(--border-1); }
.related h2 { margin-top: 0; font-size: 16px; }
.related ul { margin: 0; padding-left: 20px; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 8px; }
.btn {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--profit);
  color: var(--profit);
  font-family: var(--ff-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.btn:hover { background: var(--profit-dim); }
.btn--solid { background: var(--profit); color: var(--bg-0); }
.btn--solid:hover { background: #8fd4ff; }

/* ── Entry motion: one quiet reveal, nothing on reduced motion ─ */

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
main > * { animation: rise 420ms ease-out both; }
main > *:nth-child(2) { animation-delay: 60ms; }
main > *:nth-child(3) { animation-delay: 120ms; }
main > *:nth-child(n + 4) { animation-delay: 180ms; }
@media (prefers-reduced-motion: reduce) {
  main > * { animation: none; }
}

/* ── Tablet and up ─────────────────────────────────────────── */

@media (min-width: 768px) {
  :root { --gutter: 32px; }
  main { padding-top: 48px; }
  .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ci { width: 200px; }
}
@media (min-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
