/* Living Life Data — site styles. Tokens first; everything reads through them. */
:root {
  color-scheme: light;
  --page: #f8f8f6;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11,11,11,0.10);
  --accent: #2a78d6;          /* series-1, validated light */
  --accent-wash: rgba(42,120,214,0.10);
  --seq-300: #6da7ec; --seq-450: #2a78d6; --seq-600: #184f95;
  --demo-bg: #fff4d6; --demo-ink: #5a3d00;
  --radius: 6px;
  --measure: 68ch;
  --wide: 960px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
    --accent: #3987e5; --accent-wash: rgba(57,135,229,0.14);
    --seq-300: #5598e7; --seq-450: #3987e5; --seq-600: #86b6ef;
    --demo-bg: #3a2c05; --demo-ink: #ffd98a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
  --accent: #3987e5; --accent-wash: rgba(57,135,229,0.14);
  --seq-300: #5598e7; --seq-450: #3987e5; --seq-600: #86b6ef;
  --demo-bg: #3a2c05; --demo-ink: #ffd98a;
}

* { box-sizing: border-box; }
html { height: auto; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px; line-height: 1.55;
  padding-inline: 16px; padding-block: 0 64px;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: "Instrument Sans", "IBM Plex Sans", system-ui, sans-serif; text-wrap: balance; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(30px, 4.6vw, 46px); font-weight: 600; letter-spacing: -0.015em; }
h2 { font-size: clamp(22px, 2.6vw, 28px); font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 18px; font-weight: 600; }
p { margin: 0; max-width: var(--measure); }
.lede { font-size: clamp(19px, 2.1vw, 22px); color: var(--ink-2); line-height: 1.45; }
.eyebrow { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; }
.wrap { max-width: var(--wide); margin-inline: auto; }
.stack { display: grid; gap: 14px; }
.stack-lg { display: grid; gap: 28px; }
section { padding-block: 44px; border-top: 1px solid var(--grid); }
section:first-of-type { border-top: 0; }
hr.rule { border: 0; border-top: 1px solid var(--grid); margin: 0; }
small, .small { font-size: 14px; color: var(--ink-2); }
ul { margin: 0; padding-left: 1.2em; max-width: var(--measure); }
li + li { margin-top: 6px; }
strong { font-weight: 600; }

/* header */
.site-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding-block: 18px 12px; }
.brand { font-family: "Instrument Sans", system-ui, sans-serif; font-weight: 600; font-size: 18px; text-decoration: none; letter-spacing: -0.01em; }
.brand:hover { color: var(--ink); }
.brand .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 1px; }
nav.primary { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 15px; }
nav.primary a { text-decoration: none; color: var(--ink-2); padding-block: 4px; border-bottom: 2px solid transparent; }
nav.primary a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.demo-bar { background: var(--demo-bg); color: var(--demo-ink); font-size: 14px; padding: 8px 12px; border-radius: var(--radius); display: flex; gap: 10px; align-items: baseline; }
.demo-bar .tag { font-family: "IBM Plex Mono", monospace; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }

/* figure / chart */
figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 14px; }
figure .fig-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
figure h3 { font-size: 17px; }
figure .fig-sub { font-size: 14px; color: var(--ink-2); }
figure .fig-note { font-size: 13px; color: var(--muted); margin-top: 8px; max-width: none; }
figure svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart { position: relative; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.legend .key { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--accent); vertical-align: middle; margin-right: 8px; }
.legend .key.sketch { border-top-style: dashed; border-top-color: var(--muted); }
.legend .key.box { width: 12px; height: 12px; border: 0; background: var(--seq-450); border-radius: 2px; }
.legend .key.wash { width: 12px; height: 12px; border: 0; background: var(--accent-wash); border-radius: 2px; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 4px; padding: 6px 9px; font-size: 13px; line-height: 1.35; box-shadow: 0 2px 8px rgba(0,0,0,0.08); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); left: 0; top: 0; opacity: 0; transition: opacity 80ms; }
.tooltip.show { opacity: 1; }
.tooltip .t-label { color: var(--ink-2); }
.tooltip .t-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.demo-chip { font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; background: var(--demo-bg); color: var(--demo-ink); padding: 2px 7px; border-radius: 3px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.tile .label { font-size: 14px; color: var(--ink-2); }
.tile .value { font-size: 30px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; }
.tile .value small { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.tile .delta { font-size: 13px; color: var(--ink-2); }
.tile svg { width: 100%; height: 34px; margin-top: 4px; }
.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 20px; }
.counters div { display: grid; gap: 2px; }
.counters .n { font-size: 26px; font-weight: 600; line-height: 1.1; }
.counters .l { font-size: 13px; color: var(--ink-2); }

/* small multiples */
.multiples { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.multiples .panel h4 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }

/* tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--grid); }
th { font-weight: 600; color: var(--ink-2); font-size: 13px; letter-spacing: 0.02em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* two-column prose */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px 40px; }
.cols > div { display: grid; gap: 8px; align-content: start; }

/* footer */
footer { border-top: 1px solid var(--grid); padding-top: 22px; margin-top: 40px; font-size: 14px; color: var(--ink-2); display: grid; gap: 8px; }
.status-line { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--ink-2); }
.status-line .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }

@media (max-width: 480px) {
  body { font-size: 16px; }
  figure { padding: 14px 12px 12px; }
  .tile .value { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { .tooltip { transition: none; } }
