/* Matrioskale explorer: one design system.
   Type: Source Serif 4 (headings) + Inter (UI), self-hosted (fonts/, OFL).
   Scale: 1.25 ratio from 16px. Spacing: 4px grid (--s1..--s8).
   Colour: one signature accent (graphite-navy, brass for the mark only; D001) + domain hues (theme.js). */
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(fonts/inter-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(fonts/inter-latin-ext-wght-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-display: swap; font-weight: 200 900; src: url(fonts/source-serif-4-latin-wght-normal.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-display: swap; font-weight: 200 900; src: url(fonts/source-serif-4-latin-wght-italic.woff2) format("woff2"); }

:root {
  color-scheme: light;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --t-xs: .75rem; --t-sm: .875rem; --t-md: 1rem; --t-lg: 1.25rem; --t-xl: 1.5625rem; --t-2xl: 1.953rem; --t-3xl: 2.441rem;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --radius: 12px; --radius-sm: 8px;
  --maxw: 1240px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --bg: #F9F9F7;
  --surface: #FFFFFF;
  --surface-2: #EFEFEC;
  --fg: #15171A;
  --fg-2: #444950;
  --fg-3: #5F646B; /* 5.7:1 on --bg, 5.2:1 on --surface-2 (WCAG AA, F9) */
  --line: #E2E2DE;
  --accent: #23395B;
  --accent-2: #172840;
  --on-accent: #FFFFFF;
  --brass: #B7791F; /* logo graphics only, never text (D001) */
  --focus: #2563EB;
  --warn: #B45309;
  --nodata: #ECEAE4;
  --hatch: #C9C5BC;
  --land: #DCD8CF;
  --sphere: #F4F2EE;
  --graticule: #E6E3DC;
  --unit-line: #FFFFFF;
  --cov-obs: #2F6F8F; --cov-flag: #E3A008; --cov-gap: #C2410C; --cov-none: #EFEDE8;
  --cat-0: #A8B4C0; --cat-1: #2F6F8F;
  --shadow: 0 1px 2px rgba(20, 20, 20, .05), 0 4px 16px rgba(20, 20, 20, .05);
  --shadow-hover: 0 2px 4px rgba(20, 20, 20, .06), 0 12px 28px rgba(20, 20, 20, .09);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101214; --surface: #181A1D; --surface-2: #212428; --fg: #EDEEEF; --fg-2: #B5BAC0; --fg-3: #8C9299; --line: #2C3035; /* 6.0:1 on --bg (F9) */
  --accent: #9DB4D8; --accent-2: #C2D3EC; --on-accent: #0E1420; --brass: #D9A441; --focus: #7AA7FF; --warn: #F5B544;
  --nodata: #262A2F; --hatch: #3A4047; --land: #2E3338; --sphere: #15181B; --graticule: #22262A; --unit-line: #111315;
  --cov-obs: #5FA8C8; --cov-flag: #F5B544; --cov-gap: #F2763A; --cov-none: #1E2226;
  --cat-0: #4A5560; --cat-1: #5FA8C8;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, .5), 0 12px 28px rgba(0, 0, 0, .35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101214; --surface: #181A1D; --surface-2: #212428; --fg: #EDEEEF; --fg-2: #B5BAC0; --fg-3: #8C9299; --line: #2C3035; /* 6.0:1 on --bg (F9) */
    --accent: #9DB4D8; --accent-2: #C2D3EC; --on-accent: #0E1420; --brass: #D9A441; --focus: #7AA7FF; --warn: #F5B544;
    --nodata: #262A2F; --hatch: #3A4047; --land: #2E3338; --sphere: #15181B; --graticule: #22262A; --unit-line: #111315;
    --cov-obs: #5FA8C8; --cov-flag: #F5B544; --cov-gap: #F2763A; --cov-none: #1E2226;
    --cat-0: #4A5560; --cat-1: #5FA8C8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-hover: 0 2px 6px rgba(0, 0, 0, .5), 0 12px 28px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 120px; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 var(--t-md)/1.55 var(--font-sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-2); }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
code { font-family: var(--font-mono); font-size: .85em; color: var(--fg-2); overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 6px 10px; z-index: 50; }
.small { font-size: var(--t-sm); color: var(--fg-2); }
.method { font-size: var(--t-xs); color: var(--fg-3); max-width: 80ch; margin: var(--s2) 0 0; }
.warn { color: var(--warn); }
.empty { color: var(--fg-3); padding: var(--s6) 0; text-align: center; }

/* buttons */
button, select, input { font: inherit; color: inherit; }
.btn, .btn-primary, .btn-ghost, .btn-round, .btn-icon, select {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease), transform .15s var(--ease);
}
.btn:hover, .btn-ghost:hover, .btn-round:hover, .btn-icon:hover, select:hover { border-color: var(--fg-3); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; font-size: var(--t-sm); padding: 3px 12px; margin-left: var(--s2); }
.btn-round { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; font-size: 14px; flex: none; }
.btn-icon { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; flex: none; }
select { border-radius: var(--radius-sm); padding: 6px 10px; max-width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* header */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-inner { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: var(--s4); padding: 10px var(--s4); }
.brand { display: inline-flex; align-items: center; gap: var(--s2); text-decoration: none; color: var(--fg); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { color: var(--fg); }
.brand-sub { font-weight: 400; color: var(--fg-3); }
.brand-wm { font: 600 1.15rem/1 var(--font-serif); letter-spacing: -.005em; }
.brand-wm svg { width: .62em; height: .62em; vertical-align: -.02em; }
.search { position: relative; flex: 1 1 auto; max-width: 560px; margin-left: auto; min-width: 0; }
.search input { width: 100%; padding: 8px 14px 8px 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; }
body[data-page="home"] .top .search { visibility: hidden; }
.status { margin: 0 auto; max-width: var(--maxw); padding: 0 var(--s4); color: var(--fg-3); font-size: var(--t-xs); min-height: 1.2em; }
main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s4) var(--s8); outline: none; }
.foot { border-top: 1px solid var(--line); color: var(--fg-3); font-size: var(--t-sm); }
.foot-inner { max-width: var(--maxw); margin: 0 auto; padding: var(--s5) var(--s4); }
.foot p { margin: 0 0 var(--s2); }

/* skeletons */
.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 40%, var(--surface-2) 80%); background-size: 300% 100%; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
a.card { color: inherit; text-decoration: none; transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s var(--ease); }
a.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: color-mix(in srgb, var(--dc, var(--accent)) 45%, var(--line)); color: inherit; }

/* home: hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--s6); align-items: center; padding: var(--s6) 0 var(--s7); }
.hero-map { aspect-ratio: 2.05 / 1; }
.hero-map .skeleton { height: 100% !important; }
.hero-copy h1 { font-size: var(--t-3xl); margin: var(--s2) 0 var(--s4); font-weight: 600; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: var(--t-xs); font-weight: 700; color: var(--accent); margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.lede { font-size: var(--t-lg); color: var(--fg-2); line-height: 1.5; margin: 0 0 var(--s5); max-width: 62ch; font-family: var(--font-serif); }
.hero-search { display: flex; gap: var(--s2); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px; box-shadow: var(--shadow); }
.hero-search:focus-within { border-color: var(--accent); }
.hero-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 14px; font-size: var(--t-lg); outline: none; }
.hero-actions { margin: var(--s3) 0 0; }
.search-note { color: var(--fg-3); margin: var(--s2) 0 0; }
.examples { font-size: var(--t-sm); color: var(--fg-3); margin: var(--s3) 0 var(--s5); }
.hero-caption { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); font-size: var(--t-sm); color: var(--fg-2); }
.hero-var { font-weight: 600; }
.hero-year { font: 600 var(--t-xl)/1 var(--font-serif); color: var(--fg); font-variant-numeric: tabular-nums; }
.section-title { font-size: var(--t-xl); margin: var(--s7) 0 var(--s4); }

/* home: stories */
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s4); }
.story { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4) var(--s4) var(--s3); min-height: 260px; border-top: 3px solid var(--dc, var(--accent)); }
.story h3 { font-size: var(--t-lg); margin: 0; }
.story-domain { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--dc); display: inline-flex; align-items: center; gap: 6px; }
.story-finding { margin: 0; color: var(--fg-2); font-size: var(--t-sm); line-height: 1.5; }
.story-chart { margin-top: auto; }
.story-cta { font-size: var(--t-sm); font-weight: 600; color: var(--accent); }

/* home: domains */
.domain-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s3); }
.domain-tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: var(--s3); align-items: center; padding: var(--s3) var(--s4);
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--fg); transition: border-color .2s var(--ease), transform .2s var(--ease); }
.domain-tile:hover { border-color: var(--dc); transform: translateY(-1px); color: var(--fg); }
.dt-icon { grid-row: span 2; width: 40px; height: 40px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--dc); background: color-mix(in srgb, var(--dc) 13%, transparent); }
.prof-sec .dt-icon, .sec-title .dt-icon { width: 30px; height: 30px; border-radius: 8px; vertical-align: middle; }
.dt-name { font-weight: 600; font-size: var(--t-sm); line-height: 1.3; }
.dt-count { font-size: var(--t-xs); color: var(--fg-3); }

/* search + lists */
.page-narrow { max-width: 860px; margin: 0 auto; padding-top: var(--s5); }
.page-title { font-size: var(--t-2xl); margin: var(--s2) 0 var(--s2); }
.results { list-style: none; padding: 0; margin: var(--s4) 0 0; }
.results li + li { border-top: 1px solid var(--line); }
.results a { display: flex; gap: var(--s3); padding: var(--s3) var(--s2); text-decoration: none; color: var(--fg); border-radius: var(--radius-sm); transition: background .15s; }
.results a:hover, .results a:focus-visible { background: var(--surface); }
.r-icon { flex: none; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--dc); background: color-mix(in srgb, var(--dc) 12%, transparent); margin-top: 2px; }
.r-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.results .name { font-weight: 600; color: var(--fg); }
.results a:hover .name { color: var(--accent); }
.results .meta, .reasons { color: var(--fg-3); font-size: var(--t-sm); }
.results.compact a { padding: var(--s2); }
.results .more-row { padding: var(--s2); }
.fam-title { font-size: var(--t-lg); margin: var(--s6) 0 0; }
.unit-hits { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0; }
.chip-link { padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--fg); font-weight: 600; font-size: var(--t-sm); }
.chip-link span { font-weight: 400; color: var(--fg-3); }
.dom-eyebrow { color: var(--dc); }

/* variable page */
.page-var { padding-top: var(--s4); }
.crumbs { font-size: var(--t-sm); color: var(--fg-3); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--fg-2); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.crumbs a:hover { color: var(--accent); }
.var-head h1, .unit-head h1 { font-size: var(--t-3xl); margin: var(--s3) 0 var(--s3); max-width: 28ch; }
.var-head .lede { font-size: var(--t-md); }
.facts-row { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s6); margin: var(--s4) 0; }
.facts-row div { min-width: 0; }
.facts-row dt { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--fg-3); font-weight: 700; }
.facts-row dd { margin: 2px 0 0; font-size: var(--t-sm); }
.lic { white-space: nowrap; font-size: var(--t-xs); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; color: var(--fg-2); }
.static-badge { font-size: var(--t-xs); font-family: var(--font-sans); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; border: 1px solid var(--dc, var(--line)); border-radius: 4px; padding: 0 5px; color: var(--fg-2); vertical-align: middle; }
.flag-chip { display: inline-block; font-size: var(--t-xs); background: var(--surface-2); border-radius: 4px; padding: 1px 6px; margin: 1px 2px 1px 0; color: var(--fg-2); }
.flag-word { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }
.tier-badge { display: inline-block; font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; border-radius: 4px; padding: 1px 6px; color: var(--fg-2); border: 1px solid var(--line); vertical-align: middle; }
.tier-badge.tier-core { color: var(--on-accent, #fff); background: var(--accent); border-color: var(--accent); }
.tier-wrap { display: inline-flex; align-items: center; min-height: 2rem; }
.cite { margin-top: var(--s3); font-size: var(--t-sm); color: var(--fg-2); } .cite strong { margin-right: var(--s2); } .cite span { font-family: var(--font-mono); font-size: .9em; overflow-wrap: anywhere; }
.id-line { font-size: var(--t-sm); color: var(--fg-3); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.section-nav { position: sticky; top: 59px; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); margin: var(--s4) calc(-1 * var(--s4)) 0; padding: 0 var(--s4); }
.section-nav ul { list-style: none; display: flex; gap: var(--s1); margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.section-nav a { display: block; padding: 10px 12px; font-size: var(--t-sm); white-space: nowrap; color: var(--fg-2); text-decoration: none; border-bottom: 2px solid transparent; }
.section-nav a:hover { color: var(--fg); }
.section-nav a[aria-current] { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }
.view-bar { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s3) var(--s4); margin: var(--s4) 0 0; }
.view-bar label, .field { display: flex; flex-direction: column; gap: 4px; font-size: var(--t-xs); color: var(--fg-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.view-bar select, .field select { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--fg); font-size: var(--t-sm); max-width: min(30rem, 88vw); }
.view-bar p { flex-basis: 100%; margin: 0; }
.sec { padding: var(--s6) 0 var(--s4); border-bottom: 1px solid var(--line); }
.sec[hidden] { display: none; }
.sec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); }
.sec-title { font-size: var(--t-xl); margin: 0 0 var(--s4); }
.sec-head .sec-title { margin: 0; }
.sec h3 { font-size: var(--t-md); margin: var(--s4) 0 var(--s2); font-family: var(--font-sans); font-weight: 700; }

.findings { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s3); max-width: 78ch; }
.findings li { font: 400 var(--t-lg)/1.5 var(--font-serif); padding-left: var(--s5); position: relative; }
.findings li::before { content: ""; position: absolute; left: 0; top: .62em; width: 10px; height: 10px; border-radius: 50%; background: var(--dc, var(--accent)); }
.headline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s3); margin-top: var(--s5); }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3) var(--s4); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sc-label { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--fg-3); font-weight: 700; }
.sc-value { font: 600 var(--t-xl)/1.2 var(--font-serif); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sc-sub { font-size: var(--t-sm); color: var(--fg-2); }
.sc-value .u.alt, .pc-value .u.alt { color: var(--fg-3); font-size: .6em; font-weight: 400; }

/* header actions (builder-34): Download · Cite · Share, one panel at a time */
.var-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0 0; }
.var-actions button[aria-expanded="true"] { border-color: var(--fg-3); box-shadow: inset 0 -2px 0 var(--accent); }
.action-panel { margin: var(--s3) 0 0; padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); max-width: 78ch; }
.action-panel[hidden] { display: none; }
.action-panel > p:first-child { margin-top: 0; }
.action-panel .dl-row { margin: var(--s3) 0 var(--s2); }
.action-panel pre, .how pre { font: .85em/1.45 var(--font-mono); background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--s2) var(--s3); overflow-x: auto; white-space: pre; margin: var(--s2) 0; }
.snippets summary { cursor: pointer; font-size: var(--t-sm); font-weight: 600; }
.how { margin-top: var(--s5); max-width: 78ch; }
.how-kv dd { overflow-wrap: anywhere; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 4px 12px; font-size: var(--t-sm); cursor: pointer; color: var(--fg-2); }
.seg button[aria-checked="true"] { background: var(--fg); color: var(--bg); }
.map-wrap { margin-top: var(--s3); }
.map-box { position: relative; min-height: 120px; }
.eqmap { position: relative; width: 100%; }
.eqmap svg { display: block; width: 100%; height: auto; }
.eqmap .sphere { fill: var(--sphere); stroke: var(--line); stroke-width: 1; }
.eqmap .graticule { fill: none; stroke: var(--graticule); stroke-width: .6; }
.eqmap .units path { stroke: var(--ln, var(--unit-line)); stroke-width: .5; stroke-linejoin: round; transition: fill .35s var(--ease); cursor: pointer; }
.eqmap .units path:hover { stroke: var(--fg); stroke-width: 1.2; }
.eqmap .units path.sel { stroke: var(--fg); stroke-width: 1.6; }
.eqmap .base path { fill: var(--land); stroke: var(--unit-line); stroke-width: .5; pointer-events: none; }
.eqmap.l2 .units path { stroke-width: .3; }
.eqmap.l2 .units path.sel { stroke-width: 1.6; }
.map-attrib { margin-top: 4px; }
.zoom-field select { max-width: 14rem; }
.regions-tbl td.num { white-space: nowrap; }
.bnd-tbl td { vertical-align: top; }
.callout.notice { margin: 0 0 var(--s5); padding: var(--s3) var(--s4); border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; max-width: 80ch; }
.callout.notice p { margin: 0 0 var(--s2); }
.callout.notice p:last-child { margin-bottom: 0; }
.maptip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface); color: var(--fg); border: 1px solid var(--line); box-shadow: var(--shadow-hover);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: var(--t-sm); max-width: 260px; line-height: 1.4; }
.maptip strong { display: block; font-weight: 700; }
.slider { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s3); }
.slider input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.slider output { font: 600 var(--t-xl)/1 var(--font-serif); min-width: 3.4ch; font-variant-numeric: tabular-nums; }
.legend-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); margin-top: var(--s2); color: var(--fg-2); min-height: 50px; }
.legend-plot { max-width: 100%; }
.nodata-key { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); }
.nodata-key i { width: 16px; height: 12px; border: 1px solid var(--line); background: repeating-linear-gradient(45deg, var(--nodata) 0 2px, var(--hatch) 2px 3.5px); }
.movers { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s5); }
#trend-map { max-width: 980px; margin: 0 auto; }
.sc-value .u, .pc-value .u { font: 500 var(--t-sm)/1.3 var(--font-sans); color: var(--fg-2); }
.toggles { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); font-size: var(--t-sm); color: var(--fg-2); }
.toggles label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.toggles input { accent-color: var(--accent); width: 16px; height: 16px; }
.unit-pick { display: flex; gap: var(--s2); margin: var(--s3) 0 var(--s2); max-width: 520px; }
.unit-pick input { flex: 1; min-width: 0; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s3); }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 3px 10px; font-size: var(--t-sm); cursor: pointer; }
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.chip:hover { border-color: var(--c); }
.chart { min-height: 260px; }
.chart svg, #distribution svg, #cmp-chart svg, .story-chart svg { max-width: 100%; height: auto; overflow: visible; }
[aria-label][role="img"] text { font-family: var(--font-sans); }

.tbl { width: 100%; border-collapse: collapse; font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); font-weight: 700; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.tbl th button { all: unset; cursor: pointer; }
.tbl th button:focus-visible { outline: 2px solid var(--focus); }
.tbl th[aria-sort="ascending"] button::after { content: " ↑"; }
.tbl th[aria-sort="descending"] button::after { content: " ↓"; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl a { color: var(--fg); text-decoration: none; font-weight: 500; }
.tbl a:hover { color: var(--accent); text-decoration: underline; }
.scroll-tbl { max-height: 520px; overflow: auto; border-radius: var(--radius-sm); }
.spark { display: block; color: var(--dc, var(--accent)); }

.cov-legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-bottom: var(--s2); }
.cov-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cov-legend i { width: 12px; height: 12px; border-radius: 2px; border: 1px solid var(--line); }
.cov-wrap { position: relative; overflow-x: auto; }
.cov-wrap canvas { display: block; }

.cmp-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--s5); margin: var(--s4) 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s4); font-size: var(--t-sm); margin: 0; }
.kv dt { color: var(--fg-3); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

.rel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s5); }
.rel-grid h3 { margin-top: 0; }
.rel-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s2); }
.rel-list a { display: flex; flex-direction: column; padding: var(--s2) var(--s3); border-left: 3px solid var(--dc); background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; text-decoration: none; color: var(--fg); }
.rel-list a:hover .name { color: var(--accent); }
.rel-list .name { font-weight: 600; font-size: var(--t-sm); }
.rel-list .meta { font-size: var(--t-xs); color: var(--fg-3); }

.sources dt { font-weight: 600; margin-top: var(--s3); }
.sources dd { margin: 2px 0; }
.sources .attr { font-family: var(--font-serif); font-size: var(--t-md); }
.dl-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: var(--s4) 0 var(--s2); }

/* unit profile */
.page-unit { padding-top: var(--s4); }
.unit-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: var(--s5); align-items: center; padding-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.unit-locator .units path { cursor: default; }
.prof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s3); }
.prof-card { display: flex; flex-direction: column; gap: 4px; padding: var(--s3) var(--s4); }
.pc-name { font-size: var(--t-sm); font-weight: 600; line-height: 1.3; min-height: 2.6em; }
.pc-value { font: 600 var(--t-xl)/1.2 var(--font-serif); font-variant-numeric: tabular-nums; }
.pc-sub { font-size: var(--t-xs); color: var(--fg-3); }
.prof-card .spark { width: 100%; height: auto; margin: 4px 0; }

/* responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: var(--s4); padding-top: var(--s4); }
  .hero-copy { order: -1; }
  .hero-copy h1 { font-size: var(--t-2xl); }
  .cmp-grid, .unit-head { grid-template-columns: 1fr; }
  .var-head h1, .unit-head h1 { font-size: var(--t-2xl); }
}
@media (max-width: 560px) {
  /* Two rows (F11): logo, nav and theme button; the search on its own line. */
  .top-inner { gap: var(--s2) var(--s3); padding: 8px var(--s3); flex-wrap: wrap; }
  .top-nav { gap: var(--s2); font-size: var(--t-xs); flex: 1 1 auto; justify-content: space-evenly; min-width: 0; }
  .search { flex: 1 1 100%; order: 3; margin-left: 0; max-width: none; }
  body[data-page="home"] .top .search { display: none; }
  .brand-sub { display: none; }
  .brand span:not(.brand-sub) { display: none; }
  main { padding: 0 var(--s3) var(--s7); }
  .lede { font-size: var(--t-md); }
  .hero-search input { font-size: var(--t-md); }
  .findings li { font-size: var(--t-md); }
  .section-nav { top: 104px; margin: var(--s3) calc(-1 * var(--s3)) 0; padding: 0 var(--s3); } /* under the two-row header */
  .story-grid { grid-template-columns: 1fr; }
  .facts-row { gap: var(--s3) var(--s4); }
  .sc-value { font-size: var(--t-lg); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Faceted search and browse (builder-03a, D007 #2) */
.page-wide { max-width: 1180px; margin: 0 auto; padding-top: var(--s5); }
.facet-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--s5); align-items: start; margin-top: var(--s4); }
.facet-box { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm, 8px); padding: var(--s3); }
.facet-box > summary { font-weight: 600; cursor: pointer; list-style: none; }
.facet-box > summary::-webkit-details-marker { display: none; }
.facet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin: var(--s2) 0; font-size: var(--t-sm); color: var(--fg-2); }
.facet { border: 0; padding: 0; margin: 0 0 var(--s3); }
.facet legend { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); font-weight: 600; margin-bottom: 4px; }
.facet ul { list-style: none; margin: 0; padding: 0; }
.facet li label { display: flex; align-items: baseline; gap: 6px; font-size: var(--t-sm); padding: 2px 0; cursor: pointer; }
.facet li .fv { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.facet li .fc { color: var(--fg-3); font-variant-numeric: tabular-nums; font-size: var(--t-xs); }
.facet li input:disabled + .fv { color: var(--fg-3); }
.facet details summary { font-size: var(--t-xs); color: var(--accent); cursor: pointer; margin: 2px 0; }
.facet .field { margin-top: 6px; }
.facet .field input { width: 100%; font: inherit; font-size: var(--t-sm); text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
@media (max-width: 800px) {
  .facet-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
  .facet-box { position: static; max-height: none; }
}

/* ---------- families (builder-04, D008) ---------- */
.top-nav { display: flex; gap: var(--s3); font-size: var(--t-sm); font-weight: 600; }
.top-nav a { color: var(--fg-2); text-decoration: none; }
.top-nav a:hover { color: var(--accent); }
body[data-page="families"] .top-nav a[href="#/families"], body[data-page="f"] .top-nav a[href="#/families"], body[data-page="browse"] .top-nav a[href="#/browse"] { color: var(--accent); }
.sec-head > .section-title { margin-bottom: var(--s4); }
a.btn, a.btn-primary { display: inline-block; text-decoration: none; }
a.btn { color: var(--fg); }
.domain-grid > li { display: flex; flex-direction: column; gap: 6px; }
.dt-fams { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--t-xs); padding: 0 var(--s2); }
.dt-fams a { color: var(--fg-2); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--dc) 55%, transparent); }
.dt-fams a:hover { color: var(--dc); }
.dt-fams a.more { color: var(--fg-3); border: 0; }
.fam-chip { text-decoration: none; font-weight: 600; color: var(--dc); }
.fam-title a { color: inherit; text-decoration: none; }
.fam-title a:hover { color: var(--accent); }
.inv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin: var(--s2) 0; }
.lens-seg { flex-wrap: wrap; border-radius: 18px; }
.inv-layout { display: grid; grid-template-columns: minmax(0, 640px) minmax(260px, 1fr); gap: var(--s6); align-items: start; margin-top: var(--s4); }
.inv-chart svg { display: block; max-width: 100%; height: auto; font: 500 10.5px var(--font-sans); }
.inv-chart path, .inv-chart g[role="button"], .sb-centre { cursor: pointer; }
.inv-chart path:hover, .inv-chart g[role="button"]:hover rect { fill-opacity: 1; stroke: var(--fg); stroke-width: 1; }
.inv-chart .labels text { fill: var(--fg); pointer-events: none; paint-order: stroke; stroke: color-mix(in srgb, var(--bg) 70%, transparent); stroke-width: 2.5px; }
.inv-chart g[role="button"] text { fill: var(--fg); pointer-events: none; paint-order: stroke; stroke: color-mix(in srgb, var(--bg) 75%, transparent); stroke-width: 3px; }
.sb-centre { fill: var(--surface); stroke: var(--line); }
.sb-centre:focus-visible { outline: none; stroke: var(--focus); stroke-width: 2.5; }
.sb-centre-t { fill: var(--fg-2); font-size: 12px; pointer-events: none; }
.sb-centre-n { fill: var(--fg); font: 600 15px var(--font-serif); pointer-events: none; }
.inv-side { position: sticky; top: 80px; }
.inv-title { font-size: var(--t-xl); margin: var(--s2) 0 var(--s1); }
.inv-links { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--fg-2); cursor: pointer; font: inherit; }
.linkish:hover { color: var(--accent); }
.bars { list-style: none; padding: 0; margin: var(--s3) 0 0; display: grid; gap: 4px; }
.bars button { width: 100%; display: grid; grid-template-columns: minmax(0, 1.3fr) 1fr 3.2em; gap: var(--s2); align-items: center; background: none; border: 0; padding: 3px 4px; border-radius: 6px; cursor: pointer; text-align: left; color: var(--fg); font-size: var(--t-sm); }
.bars button:hover { background: var(--surface-2); }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--dc); border-radius: 5px; }
.bar-n { text-align: right; font-variant-numeric: tabular-nums; color: var(--fg-2); }
.fam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s3); }
.fam-card { display: flex; flex-direction: column; gap: 4px; padding: var(--s3) var(--s4); border-top: 3px solid var(--dc); }
.fc-name { font: 600 var(--t-md) var(--font-serif); }
.fc-sub { font-size: var(--t-xs); color: var(--fg-3); }
.con-tbl tr.cross td { background: color-mix(in srgb, var(--dc) 9%, transparent); }
.con-tbl td { vertical-align: top; }
.con-tbl details summary { cursor: pointer; margin-top: 2px; }
.plain { list-style: none; padding: 0; margin: 4px 0; }
.badge { display: inline-block; font-size: var(--t-xs); font-weight: 700; color: var(--dc); border: 1px solid var(--dc); border-radius: 999px; padding: 0 8px; margin-left: 4px; }
.src-chip { display: inline-block; font: var(--t-xs) var(--font-mono); background: var(--surface-2); border-radius: 6px; padding: 1px 6px; margin: 1px 0; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s3); }
.gal { margin: 0; padding: var(--s3); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gal-name { font-weight: 600; font-size: var(--t-sm); color: var(--fg); text-decoration: none; min-height: 2.6em; }
.gal-name:hover { color: var(--accent); }
.gal-map { min-height: 120px; position: relative; }
.corr-grid, .pca-grid { display: grid; grid-template-columns: minmax(0, auto) minmax(240px, 1fr); gap: var(--s5); align-items: start; }
.corr-keys { margin: 0; padding-left: 2.2em; columns: 1; }
.corr-keys li { margin: 2px 0; }
.corr-keys a { color: var(--fg-2); text-decoration: none; }
.corr-keys a:hover { color: var(--accent); }
td.agree { font-weight: 700; }
@media (max-width: 900px) {
  .inv-layout, .corr-grid, .pca-grid { grid-template-columns: minmax(0, 1fr); }
  .inv-side { position: static; }
}
@media (max-width: 560px) {
  .top-nav { gap: var(--s2); font-size: var(--t-xs); }
}

/* Boundary explorer "#/geo" (D025). */
.geo-search { position: relative; max-width: 560px; margin: 0 0 var(--s3); }
.geo-search input { width: 100%; font-size: var(--t-md); padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--fg); }
.geo-hits { position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: var(--s1); list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-hover); max-height: 360px; overflow: auto; }
.geo-hits[hidden] { display: none; }
.geo-hits li > a { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; padding: 6px 10px; border-radius: 6px; color: var(--fg); text-decoration: none; }
.geo-hits li > a:hover, .geo-hits li > a:focus-visible { background: var(--surface-2); }
.geo-hits li.small { padding: 6px 10px; }
.geo-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--s5); align-items: start; }
.geo-side { border-left: 1px solid var(--line); padding-left: var(--s4); max-height: 640px; overflow: auto; margin-top: var(--s3); }
.geo-side-title { font-size: var(--t-lg); margin: 0 0 var(--s2); }
.geo-side-sub { font: 700 var(--t-xs)/1.4 var(--font-sans); text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); margin: var(--s4) 0 var(--s2); }
.geo-list { list-style: none; margin: 0; padding: 0; font-size: var(--t-sm); }
.geo-list li { padding: 3px 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.geo-list a, .geo-panel a, .geo-cols a { color: var(--fg); }
.geo-list a:hover, .geo-panel a:hover { color: var(--accent); }
.geo-sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.geo-key { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); }
.geo-key i { width: 16px; height: 12px; border-radius: 2px; border: 1px solid var(--line); }
/* CShapes polygon with no unit of ours that year (D036): the map's hatch. */
.geo-key i.hatch { background: repeating-linear-gradient(45deg, var(--nodata) 0 2px, var(--hatch) 2px 3.5px); }
/* Present-day outline standing in for a missing CShapes border (D037): hatched, dashed edge. */
.eqmap .units path.pd { stroke: var(--fg-3); stroke-dasharray: 2 1.5; }
.geo-key i.hatch.pd { border: 1px dashed var(--fg-3); }
/* Ring around a highlighted unit drawn under 4 px (D037.2). */
.eqmap .rings circle { fill: none; stroke: var(--accent); stroke-width: 2; pointer-events: none; filter: drop-shadow(0 0 1px var(--bg)); }
.geo-panel { border-bottom: 0; }
.geo-panel h3 { margin-top: var(--s5); }
.geo-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: var(--s5); align-items: start; }
.geo-title { font-size: var(--t-xl); margin: var(--s1) 0 var(--s2); }
.geo-title code { font-size: var(--t-sm); color: var(--fg-3); font-weight: 400; }
.geo-kv { margin-top: var(--s3); }
.geo-shape .callout.notice { margin: 0; }
.geo-notes { margin: 0; padding-left: 1.2em; font-size: var(--t-sm); max-width: 90ch; }
.geo-notes li { margin-bottom: var(--s2); }
.tbl tr.geo-cur td { background: var(--surface-2); }
.geo-details { margin-top: var(--s4); }
.geo-details summary { cursor: pointer; font-weight: 600; font-size: var(--t-sm); }
.geo-cols { columns: 4 200px; margin: var(--s2) 0 0; padding: 0; list-style: none; font-size: var(--t-sm); }
.geo-cols li { padding: 2px 0; break-inside: avoid; }
.geo-scroll { max-height: 360px; overflow: auto; }
/* Country groups (D030): legend entries highlight their group; names on the map. */
button.geo-key { background: none; border: 1px solid transparent; border-radius: 999px; padding: 2px 8px 2px 4px; color: inherit; font: inherit; font-size: var(--t-xs); cursor: pointer; }
button.geo-key:hover, button.geo-key[aria-pressed="true"] { border-color: var(--line); background: var(--surface-2); color: var(--fg); }
.geo-list li.geo-hl:hover { background: var(--surface-2); border-radius: 4px; }
.geo-labels text { font: 600 11px/1 var(--font-sans); fill: var(--fg); stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; paint-order: stroke; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
/* Country history railway (figures-1112 builder-52): family colours on tracks and
   ribbons (from the spec), white inner line = link convention, grey only for text and axis. */
.rail-controls { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; font-size: var(--t-xs); color: var(--fg-3); margin-bottom: var(--s2); }
.rail-controls label { display: flex; gap: 6px; align-items: center; }
.rail-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; margin: 0 0 0 auto; padding: 0; }
.rail-legend li { display: flex; align-items: center; gap: 4px; }
.rail-wrap { position: relative; }
.rail-svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.rail-fam { font: 700 12px/1 var(--font-sans); }
.rail-code { font: 11px/1 var(--font-sans); fill: var(--fg-2); text-anchor: end; }
.rail-track, .rail-rib { stroke-width: 7; stroke-linecap: round; fill: none; }
.rail-inner { stroke: #fff; stroke-width: 1.5; fill: none; pointer-events: none; }
.rail-gap { stroke-width: 1; stroke-dasharray: 2 3; }
.rail-year { font: 10px/1 var(--font-sans); fill: var(--fg-3); }
.rail-brk { stroke: #fff; stroke-width: 2; fill: none; }
.rail-axis, .rail-tick line { stroke: var(--fg-3); stroke-width: 1; }
.rail-tick text { font: 10px/1 var(--font-sans); fill: var(--fg-3); text-anchor: middle; }
.rail-hit { fill: transparent; }
.rail-lane { cursor: pointer; outline: none; }
.rail-lane:hover .rail-hit, .rail-lane:focus-visible .rail-hit { fill: var(--surface-2); }
.rail-lane:hover .rail-code, .rail-lane:focus-visible .rail-code { fill: var(--fg); font-weight: 700; }
.rail-link { cursor: pointer; outline: none; }
.rail-link:hover .rail-rib, .rail-link:focus-visible .rail-rib { stroke-width: 10; }
.rail-station { cursor: pointer; outline: none; }
.rail-station circle { fill: #fff; stroke-width: 2.4; }
.rail-station:hover circle, .rail-station:focus-visible circle, .rail-station.cur circle { r: 7; stroke-width: 3; }
.rail-tip { position: absolute; z-index: 5; max-width: 300px; padding: 6px 10px; font-size: var(--t-xs); white-space: pre-line; background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-hover); pointer-events: none; }
.rail-tip[hidden] { display: none; }
.rail-more { margin-top: var(--s2); }
.rail-hint { margin-top: 0; }
.rail-event { margin: var(--s3) 0; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.rail-event[hidden] { display: none; }
.rail-ev-head { display: flex; justify-content: space-between; align-items: center; }
.rail-ev-head h4 { margin: 0; font-size: var(--t-md); }
.rail-ev-maps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s3); margin: var(--s2) 0; }
.rail-ev-maps figure { margin: 0; }
.rail-ev-maps figcaption { font-size: var(--t-sm); color: var(--fg-3); text-align: center; }
.rail-map { min-height: 140px; }
.rail-ev-vars { display: flex; gap: 6px; margin-bottom: var(--s1); }
.rail-ev-vars button[aria-pressed="true"] { border-color: var(--fg-3); background: var(--surface-2); }
.rail-more summary { cursor: pointer; font-size: var(--t-sm); color: var(--fg-2); }
.rail-more li.rail-cur { background: var(--surface-2); border-radius: 4px; }
/* Hierarchy strip (D030): selection alone, within its parent, parent within its parent. */
.geo-head.solo { grid-template-columns: minmax(0, 1fr); }
.geo-head.solo .geo-shape:empty { display: none; }
.geo-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s3); align-items: start; }
.geo-strip-cell { margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s2); background: var(--surface); }
.geo-strip-cell figcaption { font-size: var(--t-sm); margin-top: var(--s1); }
.geo-strip-cell figcaption .small { color: var(--fg-3); }
.geo-strip-cell figcaption .geo-notshown { display: block; margin-top: 2px; }
@media (max-width: 900px) {
  .geo-layout, .geo-head { grid-template-columns: minmax(0, 1fr); }
  .geo-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: var(--s3); max-height: 360px; }
}

/* Coverage page (explorer-coverage D001) */
.cs-body { margin-top: var(--s4); }
.cs-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); margin-bottom: var(--s2); }
.cs-head p { margin: 0; }
.cs-legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cs-sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; border: 1px solid var(--line); vertical-align: middle; }
.cs-ramp { display: inline-block; width: 120px; height: 10px; border-radius: 2px; }
.cs-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--dc); font-weight: 600; }
.cs-wrap { overflow: visible; }
.cs-wrap canvas:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cs-focus { position: absolute; pointer-events: none; border: 2px solid var(--focus); border-radius: 2px; }
.cs-domains { list-style: none; padding: 0; margin: var(--s3) 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cs-dom { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--fg); font: inherit; font-size: var(--t-sm); cursor: pointer; }
.cs-dom:hover { border-color: var(--dc); }
.cs-dom i { width: 10px; height: 10px; border-radius: 2px; background: var(--dc); }
.cs-dom span { color: var(--fg-3); }
.cs-sum svg path[aria-label], .cs-sum g[aria-label="area"] path { cursor: pointer; }
.cs-static { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s2) var(--s4); }
.cs-static summary { cursor: pointer; color: var(--dc); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.cs-static summary .small { color: var(--fg-3); font-weight: 400; }
.cs-static ul { margin: var(--s1) 0 var(--s2); padding-left: var(--s5); font-size: var(--t-sm); }

/* Navigation, search, browse and about (website-hosting builder-37). */
@media (max-width: 560px) { .top-nav { flex-wrap: wrap; row-gap: 2px; } }
body[data-page="countries"] .top-nav a[href="#/countries"], body[data-page="u"] .top-nav a[href="#/countries"], body[data-page="about"] .top-nav a[href="#/about"] { color: var(--accent); }
.ta-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; list-style: none; margin: 0; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-hover); max-height: 60vh; overflow-y: auto; text-align: left; }
.ta-list li { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; border-radius: 4px; cursor: pointer; }
.ta-list li[aria-selected="true"], .ta-list li:hover { background: var(--surface-2); }
.ta-label { font-weight: 600; color: var(--fg); font-size: var(--t-sm); }
.ta-kind { color: var(--fg-3); font-size: var(--t-xs); }
.results li > .grp-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 var(--s2) var(--s2) calc(18px + var(--s3) + var(--s2)); }
.stat-chip { font-size: var(--t-xs); font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg-2); text-decoration: none; }
.stat-chip:hover { border-color: var(--accent); color: var(--accent); }
.name-filter { display: flex; flex-direction: column; gap: 4px; max-width: 420px; margin: 0 0 var(--s3); font-size: var(--t-sm); color: var(--fg-2); }
.name-filter input { padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--fg); }
a.flag-chip, a.tier-badge { text-decoration: none; }
a.flag-chip:hover, a.tier-badge:hover { outline: 1px solid var(--accent); }
.unit-links { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0 0; }
.cty-grid { list-style: none; padding: 0; margin: 0 0 var(--s4); display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s2) var(--s4); }
.cty-grid li { display: flex; flex-direction: column; }
.cty-name { font-weight: 600; text-decoration: none; }
.about-kv { margin: var(--s3) 0; }
.about-kv code { color: var(--fg-3); }
.about-toc ul { display: flex; flex-wrap: wrap; gap: 4px var(--s4); }
.about .sec:focus { outline: none; }

/* Nested-dolls view "#/nest" */
.nest { padding-top: var(--s4); }
.nest-head h1 { margin: var(--s2) 0 var(--s2); max-width: 30ch; }
.nest-head .lede { font-size: var(--t-md); margin-bottom: var(--s3); }
.nest-header-links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-bottom: var(--s4); }
.nest-preset { font-size: var(--t-xs); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg-2); text-decoration: none; }
.nest-preset:hover, .nest-preset.is-current { border-color: var(--dc, var(--accent)); color: var(--fg); background: var(--surface-2); }
.nest-controls { display: grid; grid-template-columns: minmax(230px, 1.35fr) repeat(3, minmax(150px, 1fr)); gap: var(--s3); padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: var(--s2); }
.nest-controls .field { min-width: 0; }
.nest-controls select, .nest-controls input { min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--fg); padding: 6px 10px; font-size: var(--t-sm); text-transform: none; letter-spacing: 0; font-weight: 400; }
.nest-var-row { display: flex; gap: var(--s1); align-items: center; }
.nest-var-row input { flex: 1 1 auto; }
.nest-var-row .btn { padding: 5px 12px; border-radius: var(--radius-sm); font-size: var(--t-sm); flex: none; }
.nest-year-field { grid-column: 1 / -1; }
.nest-year-row { display: flex; align-items: center; gap: var(--s2); }
.nest-year-row input[type="range"] { flex: 1 1 auto; accent-color: var(--accent); padding: 0; border: 0; background: transparent; }
.nest-year-row output { font: 600 var(--t-lg)/1 var(--font-serif); font-variant-numeric: tabular-nums; min-width: 4ch; text-align: right; color: var(--fg); }
.nest-meta-note { margin: 0 0 var(--s3); min-height: 1.2em; }
.nest-stack { display: flex; flex-direction: column; gap: var(--s3); }
.nest-doll { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--dc, var(--accent)); border-radius: var(--radius); padding: var(--s4); box-shadow: var(--shadow); transition: border-color .2s var(--ease), box-shadow .2s var(--ease); min-width: 0; }
.nest-doll[data-depth="0"] { margin-left: 0; }
.nest-doll[data-depth="1"] { margin-left: 16px; border-left-color: color-mix(in srgb, var(--dc, var(--accent)) 80%, var(--cov-obs)); }
.nest-doll[data-depth="2"] { margin-left: 32px; border-left-color: var(--cov-obs); }
.nest-doll[data-depth="3"] { margin-left: 48px; border-left-color: var(--accent); }
.nest-doll-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--s2) var(--s4); padding-bottom: var(--s2); border-bottom: 1px solid var(--line); }
.nest-lvl { display: block; font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--fg-3); }
.nest-doll-head h2 { margin: 2px 0 0; font-size: var(--t-lg); }
.nest-doll-val { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); justify-content: flex-end; }
.nest-val { font: 600 var(--t-xl)/1.2 var(--font-serif); font-variant-numeric: tabular-nums; }
.nest-val .u { font: 500 var(--t-sm)/1.3 var(--font-sans); color: var(--fg-2); }
.nest-val .u.alt { color: var(--fg-3); font-size: var(--t-xs); }
.nest-noval { font-size: var(--t-sm); color: var(--fg-3); font-style: italic; }
.nest-flags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.nest-rel { margin-top: var(--s3); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); padding: var(--s2) var(--s3); background: var(--surface-2); border-radius: var(--radius-sm); }
.nest-rel-none, .nest-rel-note { margin: var(--s2) 0 0; font-size: var(--t-sm); color: var(--fg-2); }
.nest-rel-grid { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin: 0; font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.nest-rel-grid dt { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); font-weight: 700; }
.nest-rel-grid dd { margin: 0; font-weight: 600; color: var(--fg); }
.nest-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: var(--t-xs); font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
.nest-badge.is-pass { border-color: var(--cov-obs); background: color-mix(in srgb, var(--cov-obs) 14%, var(--surface)); }
.nest-badge.is-partial, .nest-badge.is-info { border-color: var(--cov-flag); background: color-mix(in srgb, var(--cov-flag) 14%, var(--surface)); }
.nest-badge.is-warn, .nest-badge.is-fail { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.nest-flag-shared { color: var(--fg-3); font-size: var(--t-xs); }
.nest-uncovered-note { margin: var(--s2) 0 0; font-size: var(--t-xs); color: var(--fg-2); }
.nest-source-note, .nest-pseudo-note { flex-basis: 100%; margin: 2px 0 0; font-size: var(--t-xs); color: var(--fg-2); }
.nest-children-wrap { margin-top: var(--s3); }
.nest-children-head { font-size: var(--t-xs); color: var(--fg-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--s2); }
.nest-chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 6px; max-height: 290px; overflow: auto; padding: 2px; }
.nest-child-item { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); padding: 4px 6px; transition: border-color .15s var(--ease), background .15s var(--ease); min-width: 0; }
.nest-child-item .flag-chip, .nest-l2-row .flag-chip { font-size: 11px; padding: 0 5px; margin: 0; line-height: 1.45; }
.nest-child-item.is-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.nest-child-btn { all: unset; cursor: pointer; display: flex; flex-direction: column; flex: 1 1 100%; min-width: 0; border-radius: 4px; padding: 2px 4px; }
.nest-child-btn:hover .nest-child-name { color: var(--accent); }
.nest-child-btn:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.nest-child-name { font-size: var(--t-xs); font-weight: 600; color: var(--fg); overflow-wrap: anywhere; }
.nest-child-val { font-size: var(--t-xs); color: var(--fg-2); font-variant-numeric: tabular-nums; }
.nest-l2-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--s4); margin-top: var(--s3); align-items: start; }
.nest-l2-scroll { max-height: 360px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.nest-l2-list { list-style: none; margin: 0; padding: 0; }
.nest-l2-row { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.nest-l2-row:last-child { border-bottom: 0; }
.nest-l2-row.is-active { background: color-mix(in srgb, var(--accent) 11%, var(--surface)); }
.nest-l2-btn { all: unset; cursor: pointer; display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); flex: 1 1 100%; min-width: 0; font-size: var(--t-sm); }
.nest-l2-btn:hover .nest-l2-name { color: var(--accent); }
.nest-l2-btn:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.nest-l2-name { font-weight: 500; color: var(--fg); overflow-wrap: anywhere; }
.nest-l2-val { font-variant-numeric: tabular-nums; color: var(--fg-2); white-space: nowrap; }
.nest-tag { display: inline-block; margin-left: 6px; font-size: var(--t-xs); color: var(--fg-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.nest-focus-box { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2); padding: var(--s2) var(--s3); margin-bottom: var(--s2); border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface-2); font-size: var(--t-sm); }
.nest-nogeo { margin-top: var(--s2); }
.nest-map-col { min-width: 0; }
.nest-strip { margin-top: var(--s3); padding-top: var(--s2); border-top: 1px solid var(--line); }
.nest-strip svg { max-width: 100%; height: auto; overflow: visible; }
.nest-strip-title { margin: 0 0 4px; }
@media (max-width: 820px) {
  .nest-controls { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .nest-l2-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .nest-controls { padding: var(--s3); grid-template-columns: 1fr; }
  .nest-doll { padding: var(--s3); }
  .nest-doll[data-depth="1"] { margin-left: 6px; }
  .nest-doll[data-depth="2"] { margin-left: 12px; }
  .nest-doll[data-depth="3"] { margin-left: 18px; }
  .nest-doll-val { justify-content: flex-start; }
  .nest-chip-grid { grid-template-columns: 1fr; }
}
