:root {
  --bg: #f7f8f6;
  --bg-alt: #eef1ee;
  --surface: #ffffff;
  --text: #16201d;
  --muted: #5b6662;
  --line: #d9dfdb;
  --accent: #0f766e;
  --accent-soft: #d6efec;
  --llm: #6d4bd1;
  --llm-soft: #ebe5fb;
  --up: #15803d;
  --press: #b45309;
  --early: #2563eb;
  --corr: #b91c1c;
  /* Chart series, a validated categorical order: book, twin, S&P 500, paper account. */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --sunk: #eef1ee;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1211;
    --bg-alt: #121917;
    --surface: #171f1d;
    --text: #e6ece9;
    --muted: #97a39f;
    --line: #26312e;
    --accent: #2dd4bf;
    --accent-soft: #123430;
    --llm: #a78bfa;
    --llm-soft: #251d3d;
    --up: #4ade80;
    --press: #fbbf24;
    --early: #60a5fa;
    --corr: #f87171;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --sunk: #121917;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.top nav { display: flex; gap: 20px; }
.top nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.top nav a:hover { color: var(--text); }
.gh {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; font-size: 14px;
  color: var(--text); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.gh:hover { border-color: var(--muted); }

/* Hero */
.hero { padding: 88px 0 72px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 24px;
  padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; color: var(--muted); background: var(--surface);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--press); }
h1 {
  margin: 0 0 20px; font-size: clamp(36px, 6vw, 60px); line-height: 1.05;
  letter-spacing: -0.03em; font-weight: 750;
}
.lede { max-width: 680px; margin: 0 0 16px; font-size: 21px; line-height: 1.5; color: var(--text); }
.lede-more { max-width: 680px; margin: 0 0 32px; font-size: 17px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.button {
  display: inline-flex; align-items: center; padding: 10px 20px; border-radius: 999px; font-size: 15px; font-weight: 600;
  text-decoration: none; color: var(--text); border: 1px solid var(--line); background: var(--surface);
}
.button:hover { border-color: var(--muted); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.button.primary:hover { filter: brightness(1.08); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Sections */
.band { padding: 72px 0; border-top: 1px solid var(--line); }
.band.alt { background: var(--bg-alt); }
h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -0.02em; }
h2.sub { margin-top: 56px; }
.section-lede { margin: 0 0 32px; max-width: 640px; color: var(--muted); }
.note { margin: 20px 0 0; font-size: 14px; color: var(--muted); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.split.three { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.card h3 { margin: 0 0 12px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 15px; }
.card li + li { margin-top: 6px; }

.tag { font-size: 13px; padding: 2px 10px; border-radius: 999px; font-weight: 600; }
.tag-llm { background: var(--llm-soft); color: var(--llm); }
.tag-code { background: var(--accent-soft); color: var(--accent); }

/* Timeline */
.timeline { list-style: none; margin: 24px 0 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 0 0 20px 24px; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.timeline time { font-family: var(--mono); font-size: 14px; color: var(--accent); padding-top: 2px; }
.timeline div { color: var(--muted); font-size: 15px; }
.timeline strong { color: var(--text); }

/* Regime table */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.regimes { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 620px; }
.regimes th, .regimes td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.regimes tbody tr:last-child > * { border-bottom: 0; }
.regimes thead th { font-size: 13px; font-weight: 600; color: var(--muted); }
.regimes td { color: var(--muted); }
.regimes .num { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.pill { display: inline-block; white-space: nowrap; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid currentcolor; }
.pill-up { color: var(--up); }
.pill-press { color: var(--press); }
.pill-early { color: var(--early); }
.pill-corr { color: var(--corr); }

/* Limits */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.limit { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.limit strong { font-size: 26px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--accent); }
.limit span { font-size: 14px; color: var(--muted); }
.principles { margin: 32px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.principles li { padding-left: 16px; border-left: 3px solid var(--accent); color: var(--muted); }
.principles strong { color: var(--text); }

/* The dashboard (web/dashboard.js): the MCP dashboard's layout, scoped to .dash */
.dash-empty {
  margin: 0; padding: 24px; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
}
.dash { display: grid; gap: 16px; }
.dash p { margin: 0; }
.dash .stack { display: grid; gap: 16px; min-width: 0; }
.dash .card { padding: 18px 20px; min-width: 0; }
.dash .card > h3 { display: block; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; text-transform: uppercase; margin: 0 0 10px; }
.dash .pos { color: var(--up); }
.dash .neg { color: var(--corr); }
.dash-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.dash-meta p { font-size: 14px; color: var(--muted); }
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.toggle button { font: inherit; font-size: 13px; border: 0; border-radius: 999px; padding: 4px 14px; background: transparent; color: var(--muted); cursor: pointer; }
.toggle button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The balance */
.dash .balance-card { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: center; }
.dash .label { font-size: 14px; color: var(--muted); }
.dash .balance { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.dash .deltas { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--muted); }
.dash .deltas strong { font-variant-numeric: tabular-nums; }
.dash .taxes { margin: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.dash .taxes div { background: var(--sunk); padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dash .taxes dt { font-size: 14px; }
.dash .taxes dt span { display: block; font-size: 12px; color: var(--muted); }
.dash .taxes dd { margin: 0; font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* The returns */
.dash .tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.dash .tiles li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash .tiles .name { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.dash .tiles strong { font-size: 24px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dash .tiles .sub { font-size: 13px; color: var(--muted); line-height: 1.4; }
.dash .tiles .edge { background: var(--llm-soft); border-color: transparent; }
.dash .tiles .edge strong { color: var(--llm); }
.dash .chart-card .chart { border: 0; border-radius: 0; padding: 4px 0 0; }

/* The exposure and the satellite */
.dash .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash .level { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dash .level strong { font-size: 32px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dash .level span { font-size: 14px; color: var(--muted); }
.dash .pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.dash .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dash .chip { font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--sunk); color: var(--muted); white-space: nowrap; }
.dash .gauge { position: relative; padding-bottom: 20px; }
.dash .gauge .track { position: relative; height: 10px; border-radius: 999px; background: var(--sunk); border: 1px solid var(--line); }
.dash .gauge .fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--s1); }
.dash .gauge .mark { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 2px dashed var(--s2); }
.dash .gauge .scale span { position: absolute; top: 16px; transform: translateX(-50%); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dash .gauge .scale span:first-child { transform: none; }
.dash .gauge .scale span:last-child { transform: translateX(-100%); }
.dash .gauge-key { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); margin-top: 4px; }
.dash .gauge-key span { display: inline-flex; align-items: center; gap: 6px; }
.dash .gauge-key .key.s1 { border-top-width: 6px; border-radius: 2px; width: 12px; }
.dash .satellite .note { margin-top: 12px; font-size: 13px; }
.dash .bars { max-width: none; }

/* The latest decision and the journal */
.dash .decision header, .dash .entry header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 10px; }
.dash .decision header h4, .dash .entry header h4 { margin: 0; font-size: 16px; }
.dash .summary { font-size: 15px; }
.dash .expect { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.dash .expect li { display: grid; grid-template-columns: 56px 52px 1fr; gap: 10px; font-size: 14px; align-items: baseline; }
.dash .expect .sym { font-family: var(--mono); font-size: 13px; }
.dash .expect .w { text-align: right; font-variant-numeric: tabular-nums; }
.dash .expect .why { color: var(--muted); }
.dash details { font-size: 14px; }
.dash summary { cursor: pointer; color: var(--accent); }
.dash .card details { margin-top: 12px; }
.dash details p { margin-top: 8px; color: var(--muted); }
.dash .limits { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.dash .limits li { padding-left: 10px; border-left: 3px solid var(--press); font-size: 14px; color: var(--muted); }
.dash .result { margin-top: 12px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dash .entry { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }

/* The folded detail: the scorecard, the exposure over time, the earlier months, the numbers */
.dash .more { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px; }
.dash .more > summary { font-weight: 600; font-size: 15px; }
.dash .more[open] > summary { margin-bottom: 14px; }
.dash .score { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.dash .score div { background: var(--sunk); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.dash .score dt { font-size: 13px; color: var(--muted); }
.dash .score dd { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.dash .score span { font-size: 13px; color: var(--muted); }
.dash .data { width: 100%; border-collapse: collapse; font-size: 14px; }
.dash .data th, .dash .data td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dash .data thead th { font-size: 12px; font-weight: 600; color: var(--muted); position: sticky; top: 0; background: var(--surface); }
.dash .data td { color: var(--muted); font-variant-numeric: tabular-nums; }
.dash .data tbody tr:last-child > * { border-bottom: 0; }
.dash .more .table-scroll { max-height: 320px; overflow-y: auto; }

/* How it works: the pipeline */
.flow { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 20px; align-items: start; }
.lane-title { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.step {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 4px;
}
.step.llm { border-left-color: var(--llm); }
.step + .step::before { content: ""; position: absolute; left: 28px; top: -23px; height: 22px; border-left: 2px solid var(--line); }
.step + .step::after { content: ""; position: absolute; left: 24px; top: -7px; border: 5px solid transparent; border-top-color: var(--muted); }
.step time { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.step.llm time { color: var(--llm); }
.step strong { font-size: 16px; }
.step p { margin: 0; font-size: 14px; color: var(--muted); }
.step .tg { margin-top: 4px; font-size: 13px; }
.step .tg span {
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}
.steps.apart { gap: 16px; }
.steps.apart .step::before, .steps.apart .step::after { content: none; }

/* How it works: the MCP server */
.mcp { display: grid; grid-template-columns: 1fr auto 1.2fr auto 1fr; align-items: center; gap: 12px; }
.mcp-node { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 4px; }
.mcp-node.main { border-color: var(--llm); box-shadow: 0 0 0 3px var(--llm-soft); }
.mcp-node strong { font-size: 15px; }
.mcp-node p { margin: 0; font-size: 14px; color: var(--muted); }
.mcp-link { display: grid; justify-items: center; gap: 4px; font-size: 12px; color: var(--muted); text-align: center; max-width: 120px; }
.mcp-link::after { content: "\2192"; font-size: 22px; line-height: 1; color: var(--muted); }

.ui-card { margin-top: 24px; border-color: var(--llm); }
.ui-card code, .step code { font-family: var(--mono); font-size: 0.88em; padding: 0 3px; border-radius: 4px; background: var(--bg-alt); color: var(--text); }

/* Tech stack */
.stack-grid .card { padding: 20px; }
.stack-grid .card h3 { font-size: 16px; margin-bottom: 8px; }
.stack-grid .card p { font-size: 14px; }

.foot { border-top: 1px solid var(--line); padding: 40px 0 56px; font-size: 14px; }
.foot p { margin: 0 0 8px; max-width: 760px; }
.muted { color: var(--muted); }

@media (max-width: 820px) {
  .split, .split.three, .grid { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr; gap: 28px; }
  .mcp { grid-template-columns: 1fr; }
  .mcp-link { max-width: none; }
  .mcp-link::after { content: "\2193"; }
  .dash .balance-card, .dash .pair { grid-template-columns: 1fr; }
  .dash .tiles { grid-template-columns: repeat(2, 1fr); }
  .dash .balance { font-size: 36px; }
  /* Links move to a second header row (CSS only, no menu script). */
  html { scroll-padding-top: 104px; }
  .top-inner { height: auto; flex-wrap: wrap; row-gap: 6px; padding-top: 12px; padding-bottom: 10px; }
  .top nav { order: 3; width: 100%; gap: 18px; overflow-x: auto; scrollbar-width: none; }
  .top nav a { white-space: nowrap; padding: 4px 0; }
  .hero { padding: 56px 0 48px; }
  .band { padding: 56px 0; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}

@media (max-width: 360px) {
  .top nav { gap: 12px; }
  .top nav a { font-size: 13px; }
}
