/* ---- Design tokens (light default, dark via media query + data-theme) ---- */
:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;      /* series-1 blue */
  --accent-2: #1baf7a;    /* series-2 aqua */
  --good: #006300;
  --focus: #2a78d6;
  --maxw: 60rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-2: #199e70;
    --good: #0ca30c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  font-size: 1rem;
}

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

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

/* ---- Header / nav ---- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 0.75rem; padding-bottom: 0.75rem; gap: 1rem; flex-wrap: wrap;
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 1.05rem; }
.brand span { color: var(--accent); }
.site-nav a { color: var(--ink-2); text-decoration: none; margin-left: 1rem; font-size: 0.95rem; }
.site-nav a:hover { color: var(--ink); text-decoration: underline; }

/* ---- Content ---- */
main { padding: 1.5rem 0 3rem; }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 0.5rem 0 0.75rem; }
h2 { font-size: 1.25rem; margin-top: 2rem; }
h3 { font-size: 1.05rem; }
.lede { color: var(--ink-2); font-size: 1.05rem; max-width: 46rem; }
.updated { color: var(--muted); font-size: 0.85rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

/* ---- Tool cards on home ---- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.tool-card { display: block; text-decoration: none; color: var(--ink); transition: border-color 120ms; }
.tool-card:hover { border-color: var(--accent); }
.tool-card h3 { margin: 0 0 0.35rem; color: var(--accent); }
.tool-card p { margin: 0; color: var(--ink-2); font-size: 0.95rem; }
.tool-card .soon { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---- Forms ---- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.3rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.field input[type="number"], .field select {
  width: 100%; max-width: 14rem;
  padding: 0.5rem 0.65rem;
  font: inherit; color: var(--ink);
  background: var(--page);
  border: 1px solid var(--baseline);
  border-radius: 8px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.preset-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.4rem; }
.preset-row button {
  font: inherit; font-size: 0.85rem; cursor: pointer;
  padding: 0.25rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--baseline); background: transparent; color: var(--ink-2);
}
.preset-row button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.toggle-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.75rem 0; }
.toggle-row input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }

/* ---- Stat tiles ---- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.stat { padding: 1rem; }
.stat .label { color: var(--ink-2); font-size: 0.85rem; margin-bottom: 0.2rem; }
.stat .value { font-size: 1.55rem; font-weight: 700; line-height: 1.2; }
.stat .sub { color: var(--muted); font-size: 0.8rem; }
.stat.hero .value { color: var(--accent); }

/* ---- Chart ---- */
.chart-card { margin: 1.25rem 0; }
.chart-legend { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: 0.9rem; color: var(--ink-2); margin-bottom: 0.5rem; }
.chart-legend .key { display: inline-flex; align-items: center; gap: 0.4rem; }
.chart-legend .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
#chart-holder { position: relative; }
#chart-holder svg { display: block; width: 100%; height: auto; }
.chart-tip {
  position: absolute; pointer-events: none; display: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.45rem 0.6rem; font-size: 0.83rem; line-height: 1.45;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12); white-space: nowrap; z-index: 5;
}
.chart-tip .tip-age { font-weight: 700; margin-bottom: 0.1rem; }
.chart-tip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 0.35rem; }

/* ---- Table ---- */
details.data-table { margin: 1rem 0; }
details.data-table summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.table-scroll { overflow-x: auto; margin-top: 0.75rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: right; padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--baseline); }

/* ---- Verdict banner (comparison tools) ---- */
.verdict { border-left: 4px solid var(--accent); padding: 0.9rem 1.1rem; margin: 1.25rem 0; background: var(--surface); border-radius: 0 12px 12px 0; }
.verdict .headline { font-size: 1.15rem; font-weight: 700; }
.verdict .why { color: var(--ink-2); font-size: 0.95rem; margin-top: 0.15rem; }

/* ---- Prose / FAQ ---- */
.prose { max-width: 46rem; }
.prose h2 { margin-top: 2.25rem; }
.note {
  border-left: 3px solid var(--accent);
  padding: 0.6rem 1rem; margin: 1rem 0;
  background: var(--surface); border-radius: 0 8px 8px 0;
  color: var(--ink-2); font-size: 0.95rem;
}
.disclaimer { color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--grid); margin-top: 2.5rem; padding-top: 1rem; }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 1.5rem 0 2rem; color: var(--ink-2); font-size: 0.9rem; }
.site-footer nav { margin-bottom: 0.5rem; }
.site-footer a { color: var(--ink-2); margin-right: 1rem; }

@media (max-width: 40rem) {
  h1 { font-size: 1.4rem; }
  .stat .value { font-size: 1.3rem; }
}
