:root {
  --paper: #f5f3ee;
  --panel: #ffffff;
  --tint: #eeebe3;
  --deep: #1b1b3a;
  --deep-2: #2b2b56;
  --deep-line: #3c3c72;
  --ink: #1d1d2b;
  --ink-soft: #4c4c60;
  --ink-faint: #83839a;
  --rule: #dcd9d0;
  --rule-strong: #b8b4a8;
  --value: #d8472f;
  --value-wash: #fbe8e3;
  --fair: #3d3dc4;
  --fair-wash: #e8e8fa;
  --clv: #9c7108;
  --clv-wash: #f8efd7;
  --sans: 'Inter var', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', 'Cascadia Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --step: 8px;
  --radius: 10px;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17.5px;
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; }
svg { display: block; }

a { color: var(--ink); text-decoration-color: var(--value); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--value); }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--deep); color: var(--paper); padding: 10px 14px; z-index: 30;
  border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; top: 0; }

/* ---------- masthead ---------- */

.top { background: var(--deep); }
.bar {
  max-width: 1140px; margin: 0 auto; padding: 14px 22px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 680; font-size: 16.5px; letter-spacing: -0.01em;
  color: var(--panel); text-decoration: none;
}
.brand:hover { color: var(--panel); }
.brand .mark {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(140deg, var(--value) 0 55%, var(--clv) 55% 78%, var(--fair) 78% 100%);
  color: var(--deep); font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
}
.menu { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.menu a {
  font-size: 14px; color: #bcbcd8; text-decoration: none;
  padding: 6px 10px; border-radius: 999px;
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}
.menu a:hover { color: var(--panel); background: var(--deep-2); }
.menu a[aria-current="page"] { color: var(--deep); background: var(--clv); font-weight: 600; }

.btn {
  display: inline-block; font-weight: 620; font-size: 14.5px;
  text-decoration: none; background: var(--value); color: #fff;
  padding: 11px 17px; border-radius: 999px; border: 2px solid var(--value);
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease), transform 180ms var(--ease), color 180ms var(--ease);
}
.btn:hover { background: var(--deep); border-color: var(--deep); color: #fff; transform: translateY(-1px); }
.ghost {
  display: inline-block; font-weight: 600; font-size: 14.5px; text-decoration: none;
  padding: 11px 17px; border-radius: 999px; border: 2px solid var(--rule-strong); color: var(--ink);
  transition: background-color 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
}
.ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- shell ---------- */

.shell { max-width: 1140px; margin: 0 auto; padding: 0 22px; }
main { display: block; padding: 30px 0 60px; }

/* ---------- hero: the indigo instrument panel ---------- */

.page-hero {
  position: relative; overflow: hidden;
  background:
    linear-gradient(150deg, var(--deep) 0%, var(--deep-2) 62%, #34346a 100%);
  border-radius: var(--radius);
  padding: 30px 28px 28px;
  color: var(--paper);
}
.page-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    repeating-linear-gradient(to right, rgba(255,255,255,0.055) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.055) 0 1px, transparent 1px 44px);
}
.page-hero > * { position: relative; z-index: 1; }
.crumb-line {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: #9d9dc4; margin-bottom: 14px;
}
.hero-grid { display: grid; gap: 26px; grid-template-columns: 1fr; align-items: start; }
.page-hero .eyebrow {
  font-size: 12px; font-weight: 680; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--clv); margin-bottom: 10px;
}
.page-hero h1 {
  font-size: clamp(30px, 5vw, 49px); font-weight: 760; line-height: 1.05;
  letter-spacing: -0.028em; margin: 0 0 14px; max-width: 24ch; color: var(--paper);
}
.page-hero .lede { font-size: 19px; line-height: 1.6; color: #cfcfe4; max-width: 60ch; margin: 0 0 18px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.page-hero .ghost { border-color: var(--deep-line); color: var(--paper); }
.page-hero .ghost:hover { background: var(--paper); border-color: var(--paper); color: var(--deep); }

/* ---------- the probability axis ---------- */

.axiscard {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--deep-line);
  border-radius: var(--radius);
  padding: 16px 16px 12px;
}
.fig-cap {
  display: block; font-size: 11px; font-weight: 680; letter-spacing: 0.16em;
  text-transform: uppercase; color: #9d9dc4; margin-bottom: 18px;
}
.axis {
  position: relative; height: 88px; margin: 0 4px;
  border-left: 1px solid var(--deep-line);
}
.axis .tick { position: absolute; top: 46px; width: 1px; height: 12px; background: var(--deep-line); }
.axis .tick::after {
  content: ""; position: absolute; left: -2px; top: 52px; width: 5px; height: 1px;
}
.axis .fill {
  position: absolute; left: 0; top: 40px; height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(216,71,47,0.25), var(--value));
}
.axis .marker { position: absolute; top: 0; width: 2px; height: 40px; }
.axis .marker b {
  position: absolute; top: 0; transform: translateX(-42%);
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  padding: 1px 5px; border-radius: 5px;
}
.axis .marker.value { background: var(--value); }
.axis .marker.value b { background: var(--value); color: #fff; }
.axis .marker.fair { background: var(--fair); }
.axis .marker.fair b { background: var(--fair); color: #fff; }
.axis-legend { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 7px; }
.axis-legend li { display: flex; align-items: baseline; gap: 9px; font-size: 13.5px; color: #cfcfe4; }
.axis-legend .sw { flex: none; width: 22px; height: 5px; border-radius: 999px; margin-top: 8px; }
.axis-legend .sw.value { background: var(--value); }
.axis-legend .sw.fair { background: var(--fair); }
.axis-legend .sw.clv { background: var(--clv); }
.axis-legend b { color: var(--paper); font-weight: 620; }
.axis-rule {
  height: 10px; margin: 14px 4px 6px;
  background-image: repeating-linear-gradient(to right, var(--deep-line) 0 1px, transparent 1px 11px);
}
.book-foot, .card-foot {
  font-size: 12.5px; line-height: 1.55; color: #9d9dc4; margin: 10px 0 0;
}

/* ---------- on-page jump list ---------- */

.jumplist {
  display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 30px; padding: 11px 16px;
  background: var(--tint); border-radius: 999px;
}
.jumplist a { color: var(--ink-soft); text-decoration: none; }
.jumplist a:hover { color: var(--value); text-decoration: underline; }

/* ---------- figures ---------- */

.figure { margin: 22px 0 18px; }
.figure figcaption {
  font-size: 12.5px; line-height: 1.55; color: var(--ink-faint); margin-top: 10px; max-width: 68ch;
}
svg.trace {
  width: 100%; height: auto; display: block;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius);
}

/* ---------- sections ---------- */

section { margin: 44px 0; }
h2 {
  display: flex; align-items: baseline; gap: 12px;
  font-size: clamp(21px, 2.7vw, 28px); font-weight: 720; letter-spacing: -0.02em;
  line-height: 1.15; margin: 0 0 14px; padding-bottom: 10px;
  border-bottom: 1px dashed var(--rule-strong);
}
h2 .n {
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  color: var(--value); letter-spacing: 0.04em; white-space: nowrap;
}
h3 { font-size: 17px; font-weight: 680; letter-spacing: -0.008em; margin: 26px 0 6px; }
h3 + p { margin-top: 0; }
p { margin: 0 0 14px; }
ul.plain, ol.plain { padding-left: 22px; margin: 0 0 16px; }
ul.plain li, ol.plain li { margin-bottom: 8px; }
strong { font-weight: 660; }
em { font-style: italic; }
code {
  font-family: var(--mono); font-size: 0.9em; background: var(--tint);
  padding: 1px 5px; border-radius: 4px;
}

.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
.card {
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 18px; border-left: 4px solid var(--rule-strong);
}
.card.value { border-left-color: var(--value); }
.card.fair { border-left-color: var(--fair); }
.card.clv { border-left-color: var(--clv); }
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.chips li {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.03em;
  border: 1px solid var(--rule-strong); border-radius: 999px;
  padding: 5px 11px; background: var(--panel); color: var(--ink-soft);
}
.chips li.value { background: var(--value-wash); border-color: var(--value); color: var(--value); font-weight: 600; }
.chips li.fair { background: var(--fair-wash); border-color: var(--fair); color: var(--fair); font-weight: 600; }
.chips li.clv { background: var(--clv-wash); border-color: var(--clv); color: var(--clv); font-weight: 600; }

/* ---------- tables ---------- */

.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
caption {
  caption-side: top; text-align: left; padding: 13px 15px 9px;
  font-size: 11px; font-weight: 680; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint);
}
th, td { text-align: left; padding: 10px 15px; border-top: 1px solid var(--rule); }
thead th { background: var(--deep); color: var(--paper); border-top: 0; font-size: 12px; font-weight: 620; letter-spacing: 0.04em; }
tbody tr:hover td { background: var(--tint); }
td.num, th.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.value { color: var(--value); font-weight: 620; }
td.fair { color: var(--fair); font-weight: 620; }
td.clv { color: var(--clv); font-weight: 620; }

/* ---------- rail of steps ---------- */

.rail { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.rail li { position: relative; padding: 14px 0 16px 52px; border-bottom: 1px solid var(--rule); }
.rail li:last-child { border-bottom: 0; }
.rail li::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 15px;
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%;
  background: var(--value-wash); color: var(--value);
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
}
.rail li strong { display: block; font-size: 16px; font-weight: 660; margin-bottom: 2px; }
.rail li span { color: var(--ink-soft); }

/* ---------- worked ledger ---------- */

.ledger {
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius);
  overflow: hidden; font-family: var(--mono); font-size: 13.5px;
}
.ledger dl { margin: 0; display: grid; grid-template-columns: 1fr auto; }
.ledger dt, .ledger dd { margin: 0; padding: 9px 15px; border-top: 1px solid var(--rule); }
.ledger dt { font-family: var(--sans); font-size: 13.5px; color: var(--ink-soft); }
.ledger dd { text-align: right; font-variant-numeric: tabular-nums; }
.ledger .total dt, .ledger .total dd {
  background: var(--fair-wash); border-top: 2px solid var(--fair); color: var(--fair); font-weight: 700;
}
.ledger .pos dd { color: var(--value); font-weight: 620; }
.ledger .neg dd { color: var(--fair); }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { padding: 11px 0 11px 30px; border-bottom: 1px solid var(--rule); position: relative; }
.checklist li:last-child { border-bottom: 0; }
.checklist li::before {
  content: ""; position: absolute; left: 4px; top: 18px;
  width: 12px; height: 12px; border-radius: 3px; border: 2px solid var(--value);
  transition: background-color 160ms var(--ease);
}
.checklist li:hover::before { background: var(--value); }
.checklist li strong { font-weight: 660; }

/* ---------- callout and band ---------- */

.callout {
  border: 1px solid var(--clv); border-radius: var(--radius);
  background: var(--clv-wash); padding: 16px 18px; margin: 24px 0;
}
.callout strong { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--clv); }
.callout p:last-child { margin-bottom: 0; }

.band {
  border: 1px solid var(--deep-line); border-radius: var(--radius);
  background: linear-gradient(140deg, var(--deep) 0%, var(--deep-2) 100%);
  color: var(--paper); padding: 20px; display: grid; gap: 16px; margin: 36px 0;
}
.band h3 { margin: 0 0 4px; color: var(--paper); font-size: 18px; }
.band p { margin: 0; color: #cfcfe4; font-size: 15px; }
.band .eyebrow { font-size: 11.5px; font-weight: 680; letter-spacing: 0.16em; text-transform: uppercase; color: var(--clv); margin-bottom: 6px; }
.band .btn { justify-self: start; }
.band .ghost { border-color: var(--deep-line); color: var(--paper); }
.band .ghost:hover { background: var(--paper); border-color: var(--paper); color: var(--deep); }

/* ---------- faq ---------- */

.faq { border-top: 2px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--rule); padding: 2px 0; }
.faq summary {
  cursor: pointer; font-weight: 660; font-size: 16.5px; letter-spacing: -0.008em;
  padding: 15px 30px 15px 0; position: relative; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 2px; top: 12px;
  font-family: var(--mono); font-size: 20px; color: var(--value);
}
.faq details[open] summary::after { content: "\2212"; color: var(--fair); }
.faq details[open] summary { color: var(--fair); }
.faq details p { margin: 0 0 16px; color: var(--ink-soft); }

/* ---------- footer ---------- */

.footer { background: var(--deep); color: #bcbcd8; margin-top: 44px; padding: 36px 22px 42px; }
.foot-grid { max-width: 1140px; margin: 0 auto 22px; display: grid; gap: 26px; grid-template-columns: 1fr; }
.footer .brand { margin-bottom: 10px; }
.footer strong {
  display: block; font-size: 11.5px; font-weight: 680; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--clv); margin-bottom: 10px;
}
.footer a { display: block; color: #bcbcd8; text-decoration: none; font-size: 15px; padding: 3px 0; }
.footer a:hover { color: var(--panel); text-decoration: underline; text-decoration-color: var(--value); }
.footer p { font-size: 14.5px; line-height: 1.62; color: #a9a9c8; max-width: 74ch; }
.fine {
  max-width: 1140px; margin: 0 auto; font-size: 12.5px; line-height: 1.68; color: #8d8db1;
  border-top: 1px solid var(--deep-line); padding-top: 18px;
}

/* ---------- wide screens ---------- */

@media (min-width: 720px) {
  .grid2 { grid-template-columns: 1fr 1fr; }
  .grid2.wide-first { grid-template-columns: 1.35fr 1fr; }
  .band { grid-template-columns: 1fr auto; align-items: center; }
  .foot-grid { grid-template-columns: 1.5fr 1fr 1fr; }
}
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.5fr 1fr; gap: 34px; }
  .page-hero { padding: 38px 36px 34px; }
  .grid2.thirds { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

@media print {
  .top, .band, .footer, .hero-cta { display: none; }
  .page-hero { background: #fff; color: #000; border: 1px solid #000; }
  body { background: #fff; }
}
