/*
 * population-statistics.com — a reference tool, so it should read like one:
 * quiet chrome, data in front, nothing competing with the numbers.
 * Light only. System fonts, so first paint waits on nothing.
 */
:root {
  color-scheme: light;
  --ink: #10151c;
  --ink-soft: #5b6675;
  --line: #e4e8ee;
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --accent: #0d5c63;      /* deep teal — statistical, not salesy */
  --accent-soft: #e5f0f1;
  --pos: #0a7d4d;
  --neg: #b3341f;
  --max: 1040px;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 0 0 .4rem; }
h2 { font-size: 1.4rem; margin: 2.4rem 0 .8rem; }
h3 { font-size: 1.1rem; margin: 1.6rem 0 .5rem; }
p { margin: 0 0 1rem; }

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

/* ── header / footer ─────────────────────────────────────── */
.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand svg { display: block; }
.nav a { color: var(--ink-soft); font-size: .95rem; margin-left: 22px; }
.nav a:hover { color: var(--ink); text-decoration: none; }

.site-foot {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  padding: 2rem 0;
  color: var(--ink-soft);
  font-size: .88rem;
  background: var(--bg-soft);
}
.site-foot a { color: var(--ink-soft); }
.site-foot .sources { margin-top: .6rem; }

/* ── hero / lede ─────────────────────────────────────────── */
.lede { color: var(--ink-soft); font-size: 1.12rem; max-width: 60ch; }
.crumbs { font-size: .85rem; color: var(--ink-soft); margin: 1.4rem 0 .2rem; }
.crumbs a { color: var(--ink-soft); }

/* ── the data table (the hero element) ───────────────────── */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin: 1.2rem 0; }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data thead th { background: var(--bg-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); position: sticky; top: 0; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--accent-soft); }
table.data td.num, table.data th.num { text-align: right; }
table.data td.rank { color: var(--ink-soft); width: 3rem; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* ── card grid (nations, counties) ───────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 1.2rem 0; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--bg); }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card .k { font-weight: 700; color: var(--ink); }
.card .v { color: var(--ink-soft); font-size: .9rem; margin-top: 2px; }

/* ── stat row ────────────────────────────────────────────── */
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.4rem 0; }
.stat { flex: 1 1 150px; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--bg-soft); }
.stat .n { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: .82rem; color: var(--ink-soft); margin-top: 2px; }

/* ── prose blocks ────────────────────────────────────────── */
.prose { max-width: 68ch; }
.prose h2 { border-top: 1px solid var(--line); padding-top: 1.6rem; }
.note { font-size: .85rem; color: var(--ink-soft); border-left: 3px solid var(--line); padding: .2rem 0 .2rem 14px; margin: 1.2rem 0; }

@media (max-width: 600px) {
  .nav a { margin-left: 14px; }
  .brand span { font-size: .95rem; }
}

/* ── family strip: our other sites, above the footer ─────── */
.family { border-top: 1px solid var(--line); background: #fafbfc; padding: 1.6rem 0; margin-top: 3rem; }
.family-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin-bottom: .8rem; }
.family-cards { display: flex; flex-wrap: wrap; gap: 12px; }
.family-card { display: block; border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; background: #fff; text-decoration: none; max-width: 340px; }
.family-card:hover { border-color: var(--teal, #0d5c63); }
.family-card .k { font-weight: 650; color: var(--ink); }
.family-card .v { font-size: .85rem; color: var(--ink-soft); margin-top: 2px; }
