:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --ink: #1f1d1a;
  --muted: #5f5a52;
  --line: #e4ded3;
  --accent: #2f5d50;
  --accent-soft: #e6efe9;
  --note-bg: #f4efe4;
  --note-line: #c9b48a;
  --max: 46rem;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --surface: #1e1c19;
    --ink: #ece7de;
    --muted: #a8a196;
    --line: #34312c;
    --accent: #8cc2ae;
    --accent-soft: #22302b;
    --note-bg: #26221b;
    --note-line: #7a6a48;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: 0.5rem 1.5rem; padding-top: 1rem; padding-bottom: 1rem;
}
.brand {
  font-family: var(--sans); font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; font-size: 0.9rem; color: var(--ink); text-decoration: none;
}
.brand span { color: var(--muted); font-weight: 500; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-family: var(--sans); font-size: 0.9rem; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 0.25rem 0; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); border-bottom: 2px solid var(--accent); }

/* Main */
main { padding: 2.5rem 0 3rem; }
.eyebrow {
  font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 0.5rem;
}
h1 { font-size: clamp(2rem, 6vw, 2.75rem); line-height: 1.15; margin: 0 0 1rem; font-weight: 600; }
h2 { font-size: 1.45rem; line-height: 1.3; margin: 2.5rem 0 0.75rem; font-weight: 600; }
h3 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; font-weight: 600; }
.lede { font-size: 1.2rem; color: var(--muted); margin-top: 0; }
p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: 0.35rem; }

/* Disclaimer / notes */
.notice {
  font-family: var(--sans); font-size: 0.9rem; line-height: 1.55;
  background: var(--note-bg); border-left: 4px solid var(--note-line);
  padding: 0.85rem 1rem; margin: 1.5rem 0; border-radius: 0 4px 4px 0;
}
.notice strong { display: block; margin-bottom: 0.2rem; }

/* Key facts */
.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 6px;
  overflow: hidden; margin: 2rem 0;
}
.fact { background: var(--surface); padding: 1rem; }
.fact .value { font-family: var(--sans); font-size: 1.6rem; font-weight: 700; display: block; line-height: 1.2; }
.fact .label { font-family: var(--sans); font-size: 0.82rem; line-height: 1.4; color: var(--muted); display: block; margin-top: 0.25rem; }

/* Section cards on home */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 1rem 1.1rem; color: var(--ink); text-decoration: none;
}
.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 0.35rem; font-size: 1.05rem; color: var(--accent); }
.card p { margin: 0; font-size: 0.95rem; color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; }
table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 600; border-bottom: none; }

/* People */
.person { border-top: 1px solid var(--line); padding: 1.1rem 0; }
.person h3 { margin: 0 0 0.15rem; }
.person .meta { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); margin: 0 0 0.5rem; }
.person p { margin-bottom: 0.4rem; }

/* Changelog */
.log { list-style: none; padding: 0; }
.log li { border-left: 2px solid var(--line); padding: 0 0 1rem 1rem; }
.log time { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); display: block; }

/* Footnotes */
.sources { font-family: var(--sans); font-size: 0.88rem; color: var(--muted); }
.sources li { word-break: break-word; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
.site-footer .wrap { padding-top: 1.5rem; padding-bottom: 2rem; }
.site-footer p { margin-bottom: 0.6rem; }
.site-footer a { color: var(--muted); }

@media (max-width: 30rem) {
  body { font-size: 1rem; }
  main { padding-top: 1.75rem; }
}

/* Bar chart (distribution) */
.chart { margin: 1.75rem 0 2rem; padding: 1rem 1.1rem 0.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-family: var(--sans); }
.chart figcaption { margin-bottom: 0.9rem; }
.chart-title { display: block; font-weight: 600; font-size: 0.95rem; }
.chart-sub { display: block; font-size: 0.8rem; color: var(--muted); }
.bars { list-style: none; margin: 0; padding: 0; }
.bar-row { display: grid; grid-template-columns: 8.5rem 1fr; align-items: center; gap: 0.75rem; padding: 2px 0; margin: 0; border-radius: 3px; outline-offset: 2px; }
.bar-row:hover, .bar-row:focus-visible { background: var(--accent-soft); }
.bar-label { font-size: 0.85rem; color: var(--ink); text-align: right; line-height: 1.2; }
.bar-track { display: flex; align-items: center; gap: 0.4rem; min-width: 0; border-left: 1px solid var(--line); height: 1.5rem; }
.bar { display: block; height: 14px; width: max(calc((100% - 2.5rem) * var(--f)), 2px); background: var(--accent); border-radius: 0 4px 4px 0; }
.bar-value { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-note { font-size: 0.82rem; color: var(--muted); margin: 0.75rem 0 0; }
@media (max-width: 30rem) {
  .bar-row { grid-template-columns: 6.5rem 1fr; gap: 0.5rem; }
}

/* Advertising and affiliate disclosure */
.ad { margin: 2rem 0; padding: 0.5rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 6rem; }
.ad-label { display: block; font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.35rem; }
.aff-mark { font-family: var(--sans); font-size: 0.78rem; color: var(--muted); }
.disclosure { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }

/* Short answers at the top of a page */
.brief { margin: 1.5rem 0 2rem; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.brief > div { padding: 0.85rem 1rem; border-top: 1px solid var(--line); }
.brief > div:first-child { border-top: none; }
.brief dt { font-family: var(--sans); font-weight: 600; font-size: 0.92rem; margin-bottom: 0.2rem; }
.brief dd { margin: 0; }
