/* Capexwave - one stylesheet, mobile first.
   Design (docs/DECISIONS.md, 15 November 2026): "research note" paper, ink and serif headlines,
   plus "data desk" monospace figures and an automatic dark mode. System fonts only (no downloads). */
:root {
  --paper: #fbfaf6;
  --surface: #ffffff;
  --ink: #1b2433;
  --muted: #5f5e5a;
  --line: #e4e1d8;
  --accent: #0f6e56;
  --accent-soft: #e1f5ee;
  --up: #0f6e56;
  --down: #a32d2d;
  --note-bg: #faeeda;
  --note-line: #ba7517;
  --chart-1: #0f6e56;
  --chart-2: #185fa5;
  --chart-3: #ba7517;
  --chart-4: #7f77dd;
  --radius: 8px;
  --measure: 40rem;
  --serif: "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1115;
    --surface: #171a20;
    --ink: #e6e8ec;
    --muted: #a2a7b4;
    --line: #2a2e36;
    --accent: #5dcaa5;
    --accent-soft: #10302a;
    --up: #5dcaa5;
    --down: #f09595;
    --note-bg: #2a2416;
    --note-line: #8a6d27;
    --chart-1: #5dcaa5;
    --chart-2: #85b7eb;
    --chart-3: #ef9f27;
    --chart-4: #afa9ec;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.65 var(--sans);
  font-variant-numeric: lining-nums; /* Georgia-style serifs default to old-style figures; numbers must sit level */
}
a { color: var(--accent); text-underline-offset: 2px; }
main, .site-header, .site-footer { max-width: 62rem; margin: 0 auto; padding: 0 16px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; }

/* Data desk: figures line up, dates and numbers read as data */
.num, time, .meta, .figure table td { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }

/* Header with the wave mark */
.site-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 24px; padding-top: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none;
  font-family: var(--serif); font-weight: 600; font-size: 1.3rem; letter-spacing: -0.01em; }
.brand svg { width: 34px; height: 14px; color: var(--accent); flex: none; }
.site-header ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; padding: 0;
  font-size: 0.95rem; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; }

/* Intro blocks on home and section pages */
.intro { padding: 36px 0 8px; max-width: var(--measure); }
.intro h1 { margin: 0 0 6px; font-size: 2.1rem; line-height: 1.15; }
.intro p { margin: 0; color: var(--muted); font-size: 1.1rem; }

/* Article cards */
.cards { list-style: none; padding: 0; margin: 28px 0; display: grid; gap: 16px; }
@media (min-width: 720px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 6px; }
.card h2 { font-size: 1.3rem; line-height: 1.25; margin: 0; }
.card h2 a { color: var(--ink); text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
.card p { margin: 0; }
.card .sources-line { margin-top: auto; padding-top: 6px; }
.meta { color: var(--muted); font-size: 0.8rem; margin: 0; letter-spacing: 0.01em; }
.meta a { color: var(--muted); }
.sources-line { color: var(--accent); }
.empty { color: var(--muted); padding: 24px 0; }

/* Article page */
article { max-width: var(--measure); padding: 36px 0; }
article h1 { font-size: 2.3rem; line-height: 1.15; margin: 10px 0 12px; }
.lede { font-family: var(--serif); font-size: 1.25rem; line-height: 1.5; color: var(--muted); margin-top: 0; }
.prose h2 { margin-top: 2em; font-size: 1.5rem; line-height: 1.25; }
.prose h3 { margin-top: 1.6em; font-size: 1.2rem; }
.prose pre { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; font-family: var(--mono); font-size: 0.85rem; }
.prose code { font-family: var(--mono); font-size: 0.88em; }
.prose blockquote { margin: 1.2em 0; padding-left: 16px; border-left: 3px solid var(--accent); color: var(--muted);
  font-family: var(--serif); font-size: 1.1rem; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

/* Charts and data tables (data desk) - <figure class="figure"> with an <img>/<svg> or <table> and a caption */
.figure { margin: 2em 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.figure img, .figure svg { display: block; width: 100%; height: auto; }
.figure table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.figure th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.8rem; border-bottom: 1px solid var(--line); padding: 6px 8px; }
.figure td { border-bottom: 1px solid var(--line); padding: 6px 8px; }
.figure td.num, .figure th.num { text-align: right; }
.figure figcaption { color: var(--muted); font-size: 0.8rem; margin-top: 8px; }

/* Charts drawn by scripts/charts.py - colours by class so they follow dark mode */
.chart-title { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; margin: 0 0 8px; color: var(--ink); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .grid.zero { stroke: var(--muted); }
.chart .axis { fill: var(--muted); font: 12px var(--mono); }
/* The SVG is 640 units wide and shrinks on phones, so its text is set larger there to stay about 10px on screen */
@media (max-width: 560px) { .chart .axis { font-size: 19px; } }
.chart .bar.s1, .chart .dot.s1, .legend .s1 { fill: var(--chart-1); background: var(--chart-1); }
.chart .bar.s2, .chart .dot.s2, .legend .s2 { fill: var(--chart-2); background: var(--chart-2); }
.chart .bar.s3, .chart .dot.s3, .legend .s3 { fill: var(--chart-3); background: var(--chart-3); }
.chart .bar.s4, .chart .dot.s4, .legend .s4 { fill: var(--chart-4); background: var(--chart-4); }
.chart .line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1 { stroke: var(--chart-1); }
.chart .line.s2 { stroke: var(--chart-2); }
.chart .line.s3 { stroke: var(--chart-3); }
.chart .line.s4 { stroke: var(--chart-4); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 6px; padding: 0;
  font-size: 0.8rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend .key { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.chart-data { margin-top: 8px; font-size: 0.85rem; }
.chart-data summary { cursor: pointer; color: var(--accent); }
.chart-data table { margin-top: 8px; }
.example { color: var(--down); font-weight: 600; }

/* Notes: not-advice, AI help, draft */
.not-advice, .ai-line, .draft {
  background: var(--note-bg); border-left: 4px solid var(--note-line);
  border-radius: 0; padding: 10px 14px; font-size: 0.9rem;
}
.ai-line { background: var(--accent-soft); border-left-color: var(--accent); margin-top: 32px; }
.draft { font-weight: 700; }
.sources { border-top: 1px solid var(--line); margin-top: 36px; font-size: 0.9rem; }
.sources h2 { font-size: 1.05rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 56px; padding-top: 18px; padding-bottom: 36px;
  color: var(--muted); font-size: 0.85rem; }
.site-footer .not-advice { color: var(--ink); }
