:root {
  --bg: #f7f8f6;
  --card: #ffffff;
  --fg: #17262b;
  --muted: #4f6168;
  --line: #dde3e1;
  --accent: #0b6b88;
  --bad: #c0392b;
  --bad-soft: #f6dcd8;
  --good: #1e8449;
  --good-soft: #d6efdf;
  --neutral: #8a9aa0;
  --note: #fff6d6;
  --note-line: #e8c95a;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
abbr[title] { text-decoration: underline dotted; cursor: help; }
img { max-width: 100%; height: auto; display: block; }

header.hero {
  background: linear-gradient(180deg, #0f3d4c 0%, #0b6b88 100%); color: #fff;
  padding: 3rem 16px 2.5rem;
}
.wrap { max-width: 46rem; margin: 0 auto; padding: 0 16px; }
header.hero .wrap { padding: 0; }
header.hero h1 { font-size: clamp(1.8rem, 5vw, 2.7rem); line-height: 1.15; margin: 0 0 .75rem; letter-spacing: -.01em; }
header.hero p { margin: .5rem 0; color: #d9edf3; max-width: 40rem; }
header.hero .byline { font-size: .92rem; color: #b9dbe5; }
header.hero a { color: #fff; }

nav.toc { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
nav.toc ol { list-style: none; margin: 0 auto; padding: .5rem 16px; max-width: 46rem; display: flex; gap: .35rem 1rem;
  overflow-x: auto; white-space: nowrap; font-size: .88rem; scrollbar-width: none; }
nav.toc ol::-webkit-scrollbar { display: none; }
nav.toc a { text-decoration: none; color: var(--muted); }
nav.toc a:hover { color: var(--accent); }

main section { padding: 2.25rem 0 1rem; border-bottom: 1px solid var(--line); scroll-margin-top: 3rem; }
main section:last-of-type { border-bottom: 0; }
h2 { font-size: 1.55rem; line-height: 1.25; margin: 0 0 .25rem; }
h2 .n { color: var(--accent); font-variant-numeric: tabular-nums; margin-right: .35rem; }
h3 { font-size: 1.1rem; margin: 1.6rem 0 .3rem; }
.lede { font-size: 1.1rem; color: var(--muted); margin-top: .25rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .75rem; margin: 1.25rem 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; }
.stat b { display: block; font-size: 2rem; line-height: 1.1; color: var(--bad); font-variant-numeric: tabular-nums; }
.stat.good b { color: var(--good); }
.stat span { font-size: .9rem; color: var(--muted); display: block; margin-top: .2rem; }

figure { margin: 1.25rem 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .75rem; }
figure img { border-radius: 6px; }
figcaption { font-size: .9rem; color: var(--muted); margin-top: .5rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.pair .lbl { font-size: .82rem; font-weight: 600; margin: 0 0 .25rem; color: var(--muted); }
@media (max-width: 520px) { .pair { grid-template-columns: 1fr; } }

/* bar charts */
.chart { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin: 1.25rem 0; }
.chart h4 { margin: 0 0 .75rem; font-size: .98rem; }
.row { display: grid; grid-template-columns: 9.5rem 1fr; gap: .5rem; align-items: center; margin: .45rem 0; font-size: .9rem; }
.row .k { color: var(--fg); line-height: 1.25; }
.track { position: relative; height: 1.5rem; background: #eef1f0; border-radius: 4px; }
.bar { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 4px; background: var(--neutral);
  display: flex; align-items: center; justify-content: flex-end; padding: 0 .4rem; color: #fff; font-weight: 600;
  font-size: .82rem; white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 2.6rem; }
.bar.bad { background: var(--bad); }
.bar.good { background: var(--good); }
.bar.today { background: var(--neutral); }
.row.two .track { height: auto; background: none; display: grid; gap: 3px; }
.row.two .bar { position: relative; height: 1.25rem; }
.chart .legend { font-size: .82rem; color: var(--muted); margin-top: .6rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.chart .legend i { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; vertical-align: -1px; margin-right: .3rem; }
/* diverging chart: centre line at 50% */
.div .track { background: linear-gradient(90deg, #eef1f0 0 calc(50% - 1px), #9aa7ab calc(50% - 1px) calc(50% + 1px), #eef1f0 calc(50% + 1px)); }
.div .bar { left: 50%; }
.div .bar.good { left: auto; right: 50%; justify-content: flex-start; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; gap: .15rem; } }

.note { background: var(--note); border-left: 4px solid var(--note-line); padding: .75rem 1rem; border-radius: 0 8px 8px 0; margin: 1.25rem 0; font-size: .95rem; }
.slot { border: 2px dashed var(--accent); background: #eef7fa; padding: 1rem; border-radius: 10px; margin: 1.25rem 0; }
.slot strong { color: var(--accent); }
blockquote { margin: 1rem 0; padding: .25rem 1rem; border-left: 4px solid var(--accent); color: var(--muted); }
ul, ol { padding-left: 1.3rem; }
li { margin: .3rem 0; }
.asks li { margin: .55rem 0; }

.cta { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .75rem; margin: 1.25rem 0; }
.cta a { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem;
  text-decoration: none; color: var(--fg); }
.cta a:hover { border-color: var(--accent); }
.cta a strong { color: var(--accent); display: block; }
.cta a span { font-size: .88rem; color: var(--muted); }
.cta a.primary { background: var(--accent); border-color: var(--accent); }
.cta a.primary strong, .cta a.primary span { color: #fff; }

footer { padding: 2rem 0 3rem; font-size: .88rem; color: var(--muted); }
