:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --ink: #1d2330;
  --muted: #595f6b;
  --accent: #b8252b;
  --accent-soft: #f6e3e3;
  --line: #e4e0d8;
  --maxw: 920px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

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

/* Header */
.site-header {
  background: linear-gradient(135deg, #7a1418, var(--accent));
  color: #fff;
  padding: 3rem 0 2.25rem;
}
.site-header h1 { margin: 0 0 .25rem; font-size: 2.1rem; letter-spacing: -.5px; }
.site-header .subtitle { margin: 0 0 1rem; font-size: 1.1rem; opacity: .92; }
.site-header .lead { margin: 0 0 1rem; max-width: 64ch; opacity: .95; }
.site-header .updated { margin: 0; font-size: .85rem; opacity: .8; }
.viz-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .9rem 0 0; }
.viz-chips a { display: inline-block; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35); color: #fff; text-decoration: none; font-size: .82rem; font-weight: 600; padding: .3rem .75rem; border-radius: 999px; white-space: nowrap; }
.viz-chips a:hover { background: rgba(255,255,255,.28); }

/* Nav */
.site-nav { position: sticky; top: 0; z-index: 10; background: #2a2f3a; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.site-nav .wrap { display: flex; flex-wrap: wrap; gap: .25rem 1rem; padding: .5rem 1.25rem; }
.site-nav .wrap::-webkit-scrollbar { display: none; }
.site-nav a { color: #e8e6e1; text-decoration: none; font-size: .85rem; font-weight: 600; padding: .15rem 0; white-space: nowrap; }
.site-nav a:hover { color: #fff; border-bottom: 2px solid var(--accent); }

/* Country index */
.country-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.country-card { display: flex; flex-direction: column; gap: .15rem; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 6px; padding: .7rem .85rem; text-decoration: none; color: var(--ink); }
.country-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.cc-name { font-weight: 700; }
.cc-party { font-size: .82rem; color: var(--muted); }
.cc-count { font-size: .72rem; color: var(--accent); font-weight: 600; }

/* Sections */
main { padding: 2rem 1.25rem 3rem; }
section { margin: 2.5rem 0; }
h2 {
  font-size: 1.5rem;
  border-bottom: 2px solid var(--accent-soft);
  padding-bottom: .4rem;
  margin-bottom: 1rem;
}
h3 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
.section-intro { color: var(--muted); max-width: 70ch; }

/* Notice */
.notice {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: .85rem 1rem;
  border-radius: 4px;
  font-size: .92rem;
}

/* Facts list */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0; }
.facts dt { font-weight: 600; color: var(--accent); }
.facts dd { margin: 0; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.tl-item {
  display: grid;
  grid-template-columns: 4rem 3rem 1fr;
  align-items: baseline;
  gap: .75rem;
  padding: .35rem .6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.tl-year { font-weight: 700; }
.tl-edition { color: var(--muted); font-variant: small-caps; }
.tl-place { color: var(--ink); }

/* Meetings controls */
.m-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 .75rem; }
.m-controls input, .m-controls select { font: inherit; font-size: .9rem; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.m-controls #m-search { flex: 1 1 240px; min-width: 180px; }
.m-count { color: var(--muted); font-size: .82rem; margin-left: auto; }

/* Meetings table */
.table-scroll { overflow-x: auto; }
table.meetings { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); }
table.meetings th, table.meetings td { text-align: left; padding: .55rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.meetings thead th { background: #2a2f3a; color: #fff; position: sticky; top: 0; }
table.meetings tbody tr:nth-child(even) { background: #fbfaf8; }
td.edition { font-variant: small-caps; color: var(--muted); white-space: nowrap; }
td.year { font-weight: 700; }
td.notes { color: var(--muted); font-size: .85rem; max-width: 24ch; }
.muted { color: var(--muted); }
.flag { color: var(--accent); font-weight: 700; cursor: help; }
.decl-link { color: var(--accent); text-decoration: none; font-size: .82rem; white-space: nowrap; }
.decl-link:hover { text-decoration: underline; }
td.heads { color: var(--muted); font-size: .85rem; }
tr.fsp-row { background: #eaf4ec !important; }
tr.fsp-row td { font-weight: 500; }
.fsp-badge { display: inline-block; background: #1b7a3d; color: #fff; font-size: .65rem; font-weight: 700; padding: .1rem .4rem; border-radius: 999px; vertical-align: middle; letter-spacing: .03em; }
.ch-type { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: .08rem .4rem; border-radius: 4px; background: #e4e0d8; color: #444; white-space: nowrap; }
.ch-packing { background: #b8252b; color: #fff; }
.ch-purge { background: #7a1418; color: #fff; }
.ch-reform { background: #2f5fb0; color: #fff; }
.ch-founding { background: #1b7a3d; color: #fff; }

/* Parties */
.party-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.party-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1rem; }
.party-card h3 { margin: 0 0 .35rem; font-size: 1.02rem; }
.party-card .abbr { color: var(--muted); font-weight: 400; }
.party-card .country { margin: 0 0 .5rem; font-size: .9rem; }
.party-card .figures, .party-card .party-notes { margin: .35rem 0 0; font-size: .85rem; color: var(--muted); }
.badge { display: inline-block; font-size: .7rem; padding: .12rem .5rem; border-radius: 999px; margin-left: .3rem; vertical-align: middle; }
.badge-founding { background: #1b7a3d; color: #fff; }
.badge-later { background: #2f5fb0; color: #fff; }
.badge-unknown { background: #e4e0d8; color: #555; }
.countries { line-height: 2; }

/* Related organizations */
.related-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid #2f5fb0; border-radius: 6px; padding: 1rem; }
.related-card h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.related-card p { margin: .4rem 0; font-size: .9rem; }
.related-meta { color: var(--muted); font-size: .82rem !important; }
.related-link a { color: var(--accent); font-size: .82rem; word-break: break-all; }

/* Founding organizations (1990 roster) */
.founding-orgs dt { white-space: nowrap; }
.founding-orgs dd { margin-bottom: .35rem; }
.fo-n { display: inline-block; background: #e4e0d8; color: #555; font-size: .7rem; font-weight: 700; padding: .02rem .35rem; border-radius: 999px; vertical-align: middle; }
.roster-h { margin: 1rem 0 .3rem; font-size: 1rem; }
details.roster { margin: .5rem 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: .4rem .75rem; }
details.roster > summary { cursor: pointer; font-size: .95rem; }
details.roster[open] > summary { margin-bottom: .5rem; }
details.wg-composition { margin-top: .75rem; background: #fbfaf8; }
details.wg-composition > summary { font-size: .85rem; }
details.wg-composition .founding-orgs dt { white-space: normal; }

/* Presidential timeline map — "pink tide" (issue #104) */
.ptl {
  --ptl-cell: 15px;
  --ptl-lbl: 8.5rem;
  display: grid;
  gap: 2px;
  align-items: stretch;
  width: max-content;
  min-width: 100%;
  margin: .25rem 0 .75rem;
}
.ptl-corner { font-size: .72rem; color: var(--muted); align-self: end; padding-bottom: .2rem; white-space: nowrap; }
.ptl-yr { font-size: .62rem; color: var(--muted); writing-mode: vertical-rl; transform: rotate(180deg); justify-self: center; align-self: end; height: 2.4rem; line-height: var(--ptl-cell); }
.ptl-lbl { font-size: .74rem; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: .4rem; align-self: center; }
a.ptl-row:hover { color: var(--accent); text-decoration: underline; }
.ptl-tally-lbl { color: var(--muted); font-weight: 600; }
.ptl-c { width: var(--ptl-cell); height: var(--ptl-cell); border-radius: 2px; background: var(--line); display: block; }
/* State = colour AND fill, so the four states read without colour (WCAG 1.4.1):
   solid dark = FSP · diagonal hatch = to-verify · solid light = non-FSP · outline = no data. */
.ptl-fsp { background: #b8252b; }
.ptl-fsp-unv { background: #e79aa0; background-image: repeating-linear-gradient(45deg, rgba(122,20,24,.75) 0 1.5px, transparent 1.5px 4px); }
.ptl-non { background: #dfe3ea; }
.ptl-nodata { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
/* One-party socialist state (Cuba): FSP-governed but not electoral — a cross-hatch
   distinct from the single-direction "to-verify" hatch and from solid FSP. */
.ptl-fsp-op { background: #b8252b; background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.42) 0 1.5px, transparent 1.5px 4px), repeating-linear-gradient(-45deg, rgba(0,0,0,.42) 0 1.5px, transparent 1.5px 4px); }
/* Separate the one-party row(s) from the electoral wave above. */
.ptl-op { box-shadow: inset 0 2px 0 rgba(29,35,48,.35); }
.ptl-op.ptl-tick { box-shadow: inset 0 2px 0 rgba(29,35,48,.35), inset 1.5px 0 0 rgba(29,35,48,.22); }
a.ptl-lbl.ptl-op { margin-top: 2px; }
/* Lustrum gridline every 5 years (no layout shift). */
.ptl-tick { box-shadow: inset 1.5px 0 0 rgba(29,35,48,.22); }
.ptl-nodata.ptl-tick { box-shadow: inset 0 0 0 1px var(--line), inset 1.5px 0 0 rgba(29,35,48,.28); }
.ptl-bar { height: 2.2rem; display: flex; align-items: flex-end; justify-content: center; }
.ptl-bar > span { display: block; width: 9px; background: #7a1418; border-radius: 2px 2px 0 0; min-height: 1px; }
a.ptl-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 2px; }
.ptl-c:hover, .ptl-bar:hover { outline: 1.5px solid var(--ink); outline-offset: -1px; }
.ptl-caption { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: .35rem .6rem; font-size: .82rem; margin: .5rem 0; min-height: 1.5em; }
.ptl-note { color: var(--muted); font-size: .85rem; max-width: 70ch; }
.ptl-legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin-top: .5rem; font-size: .8rem; color: var(--muted); }
.ptl-key { display: inline-flex; align-items: center; gap: .35rem; }
@media print {
  .ptl { width: auto; }
  #presidents-map .table-scroll { overflow: visible; }
  .ptl-caption { display: none; }
}

/* Year-by-year grids, in tabs (Presidential / Court interventions) */
.viz { margin: 2rem 0; }
.viz-h { margin-bottom: .6rem; }
.viz-tabs { display: flex; flex-wrap: wrap; gap: .3rem; border-bottom: 2px solid var(--accent-soft); margin-bottom: .25rem; }
.viz-tab { font: inherit; font-size: .9rem; font-weight: 600; padding: .45rem .9rem; border: 1px solid var(--line); border-bottom: none; border-radius: 7px 7px 0 0; background: #f1eee8; color: var(--muted); cursor: pointer; margin-bottom: -2px; }
.viz-tab:hover { color: var(--accent); }
.viz-tab[aria-selected="true"] { background: var(--surface); color: var(--accent); border-color: var(--accent-soft); box-shadow: inset 0 -3px 0 var(--accent); }
.viz-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.viz .tab-panel { margin: .75rem 0 0; }
.tab-panel[hidden] { display: none; }

/* Interactive Latin America map (the "map, year by year"). */
.atlas-controls { display: flex; align-items: center; gap: .6rem; margin: .25rem 0 .5rem; max-width: 460px; }
.atlas-btn { font: inherit; font-size: .85rem; font-weight: 600; padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.atlas-btn:hover { border-color: var(--accent); color: var(--accent); }
.atlas-controls input[type=range] { flex: 1 1 auto; min-width: 120px; accent-color: var(--accent); }
.atlas-year { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3ch; color: var(--accent); }
.atlas-map { max-width: 440px; }
.latam-svg { width: 100%; height: auto; display: block; }
.latam-bg { fill: #e6eaef; stroke: #fff; stroke-width: .5; }
.latam-c { fill: #cbd2db; stroke: #fff; stroke-width: .6; transition: fill .12s ease; cursor: pointer; }
.latam-c:hover, .latam-c:focus-visible { outline: none; stroke: var(--ink); stroke-width: 1.2; }
.latam-c.atlas-f { fill: #b8252b; }
.latam-c.atlas-u { fill: url(#p-u); }
.latam-c.atlas-o { fill: url(#p-o); }
.latam-c.atlas-n { fill: #dfe3ea; }
.latam-c.atlas-nodata { fill: #eef0f3; }
.latam-c.atlas-leg { fill: url(#p-leg); }
.latam-c.atlas-court { fill: url(#p-court); }
.latam-c.atlas-both { fill: url(#p-both); }
.atlas-credit { color: var(--muted); font-size: .72rem; margin: .3rem 0 0; }
.atlas-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; }
.atlas-swatch.atlas-f { background: #b8252b; }
.atlas-swatch.atlas-u { background: #e79aa0; background-image: repeating-linear-gradient(45deg, rgba(122,20,24,.75) 0 2px, transparent 2px 5px); }
.atlas-swatch.atlas-o { background: #b8252b; background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.42) 0 2px, transparent 2px 5px), repeating-linear-gradient(-45deg, rgba(0,0,0,.42) 0 2px, transparent 2px 5px); }
.atlas-swatch.atlas-n { background: #dfe3ea; }
.atlas-swatch.atlas-nodata { background: #eef0f3; box-shadow: inset 0 0 0 1px var(--line); }
.atlas-swatch.atlas-leg { background: #dfe3ea; background-image: repeating-linear-gradient(0deg, #b8252b 0 2px, transparent 2px 6px); }
.atlas-swatch.atlas-court { background: #dfe3ea; background-image: repeating-linear-gradient(90deg, #b8252b 0 2px, transparent 2px 6px); }
.atlas-swatch.atlas-both { background: #dfe3ea; background-image: repeating-linear-gradient(0deg, #b8252b 0 1.5px, transparent 1.5px 6px), repeating-linear-gradient(90deg, #b8252b 0 1.5px, transparent 1.5px 6px); }

/* High-court interventions grid — reuses the .ptl grid layout. Cells carry a
   glyph as well as colour (P = packing, × = purge, R = reform) for a11y. */
.cm-c {
  width: var(--ptl-cell); height: var(--ptl-cell);
  display: flex; align-items: center; justify-content: center;
  font-size: .6rem; font-weight: 700; line-height: 1; color: #fff;
  border-radius: 2px; background: #eef0f3;
}
.cm-packing { background: #b8252b; }
.cm-purge { background: #7a1418; }
.cm-reform { background: #2f5fb0; }
.cm-c:hover { outline: 1.5px solid var(--ink); outline-offset: -1px; }

/* Legislative-control grid — reuses the .ptl grid layout. Cells carry a glyph as
   well as colour (M/P/m majority/plurality/minority, blank opposition, 1 one-party). */
.lg-c {
  width: var(--ptl-cell); height: var(--ptl-cell);
  display: flex; align-items: center; justify-content: center;
  font-size: .6rem; font-weight: 700; line-height: 1; color: #fff;
  border-radius: 2px; background: #eef0f3;
}
.lg-majority { background: #b8252b; }
.lg-plurality { background: #cf6a6e; }
.lg-minority { background: #e79aa0; color: #7a1418; }
.lg-opposition { background: #dfe3ea; }
.lg-single-party { background: #b8252b; background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.42) 0 1.5px, transparent 1.5px 4px), repeating-linear-gradient(-45deg, rgba(0,0,0,.42) 0 1.5px, transparent 1.5px 4px); }
.lg-c:hover { outline: 1.5px solid var(--ink); outline-offset: -1px; }

/* Court bench-control grid (appointment provenance, issue #129) — reuses the .ptl
   layout. States read without colour (WCAG 1.4.1): solid + glyph M = FSP-era
   majority · diagonal hatch + p = partial · solid light = independent ·
   outline = no sourced data (the base cell). */
.cs-c {
  width: var(--ptl-cell); height: var(--ptl-cell);
  display: flex; align-items: center; justify-content: center;
  font-size: .6rem; font-weight: 700; line-height: 1; color: #fff;
  border-radius: 2px; background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
}
.cs-c.ptl-tick { box-shadow: inset 0 0 0 1px var(--line), inset 1.5px 0 0 rgba(29,35,48,.28); }
.cs-aligned { background: #b8252b; box-shadow: none; }
.cs-partial { background: #e79aa0; background-image: repeating-linear-gradient(45deg, rgba(122,20,24,.55) 0 1.5px, transparent 1.5px 4px); color: #7a1418; box-shadow: none; }
.cs-independent { background: #dfe3ea; box-shadow: none; }
.cs-aligned.ptl-tick, .cs-partial.ptl-tick, .cs-independent.ptl-tick { box-shadow: inset 1.5px 0 0 rgba(29,35,48,.22); }
.cs-c:hover { outline: 1.5px solid var(--ink); outline-offset: -1px; }
/* Country-page bench-control tags (reuse the .ch-type pill). */
.cs-t-aligned { background: #b8252b; color: #fff; }
.cs-t-partial { background: #e79aa0; color: #7a1418; }
.cs-t-independent { background: #dfe3ea; color: #444; }

/* Armed & guerrilla movements */
.am-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid #7a1418; border-radius: 6px; padding: 1rem; }
.am-card h3 { margin: 0 0 .25rem; font-size: 1.02rem; }
.am-card .abbr { color: var(--muted); font-weight: 400; }
.am-meta { color: var(--muted); font-size: .82rem; margin: 0 0 .5rem; }
.am-row { margin: .35rem 0; font-size: .88rem; }
.am-row strong { color: var(--accent); }

/* Critical perspectives */
.notice-attribution { background: #fff7e6; border-left-color: #c47f17; margin-bottom: 1rem; }
.cp-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid #c47f17; border-radius: 6px; padding: 1rem; }
.cp-card h3 { margin: 0 0 .25rem; font-size: 1.02rem; }
.cp-card p { margin: .4rem 0; font-size: .9rem; }
.cp-meta { color: var(--muted); font-size: .82rem !important; }
.cp-link a { color: var(--accent); font-size: .82rem; word-break: break-all; }

/* Citations */
sup.cite { font-size: .68rem; line-height: 0; margin-left: .12rem; }
sup.cite a { color: var(--accent); text-decoration: none; font-weight: 700; }
sup.cite a:hover { text-decoration: underline; }
ol.references li:target { background: var(--accent-soft); border-radius: 4px; padding: .2rem .35rem; }

/* References */
ol.references { padding-left: 1.25rem; }
ol.references li { margin-bottom: .6rem; }
ol.references a { color: var(--accent); text-decoration: none; font-weight: 600; }
ol.references a:hover { text-decoration: underline; }
.ref-meta { display: block; color: var(--muted); font-size: .8rem; }
.archive-link { color: var(--muted); font-weight: 600; text-decoration: none; }
.archive-link:hover { color: var(--accent); text-decoration: underline; }

/* Legislative seat-share bar */
.seatbar { position: relative; display: flex; height: 20px; border-radius: 4px; overflow: hidden; background: #eef0f3; max-width: 640px; margin: .1rem 0 .4rem; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.seatseg { height: 100%; }
.seatseg-fsp { background: #b8252b; }
.seatseg-government { background: #d98a3d; }
.seatseg-mixed { background: #e8c9a0; }
.seatseg-independent { background: #cbd2db; }
.seatseg-opposition { background: #9aa3b0; }
.seatbar-maj { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); box-shadow: 0 0 0 1px #fff; }
.seatbar-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .25rem 0 .6rem; font-size: .78rem; color: var(--muted); }
.seatseg-key { display: inline-block; width: 14px; height: 12px; border-radius: 2px; vertical-align: middle; }
.seatbar-maj-key { display: inline-block; width: 2px; height: 13px; background: var(--ink); vertical-align: middle; }

/* Country-page inline source links */
.src-links { font-size: .8rem; color: var(--muted); }
.src-links a { color: var(--accent); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0; color: var(--muted); font-size: .85rem; }
.site-footer code { background: #efece6; padding: .1rem .35rem; border-radius: 3px; }

@media (max-width: 560px) {
  .facts { grid-template-columns: 1fr; gap: .1rem; }
  .facts dt { margin-top: .5rem; }
  .tl-item { grid-template-columns: 3.2rem 2.5rem 1fr; }
  .site-header { padding: 1.4rem 0 1.1rem; }
  .site-header h1 { font-size: 1.5rem; }
  .site-header .subtitle { font-size: .95rem; margin-bottom: .5rem; }
  .site-header .lead { display: none; }
  .site-header .updated { font-size: .78rem; }
  .site-nav .wrap { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 1rem; padding: .55rem 1rem; }
  .site-nav a { font-size: .82rem; }
}

/* i18n: language switcher (header, top-right) + machine-translation disclaimer */
.site-header { position: relative; }
.lang-switch { position: absolute; top: 1rem; right: 1.25rem; font-size: .8rem; }
.lang-switch a, .lang-switch .lang-current { color: #cfd6e4; text-decoration: none; padding: .15rem .4rem; border-radius: 4px; }
.lang-switch .lang-current { background: rgba(255,255,255,.18); color: #fff; font-weight: 700; }
.lang-switch a:hover { background: rgba(255,255,255,.1); }
.i18n-disclaimer { background: #fdf3e3; border-bottom: 1px solid #ecd9b0; color: #6b5518; font-size: .82rem; padding: .45rem 1.25rem; text-align: center; }
@media (max-width: 640px) {
  /* The compact header leaves no safe corner — let the switcher flow above the title. */
  .lang-switch { position: static; display: inline-block; margin: 0 0 .3rem -.4rem; }
}

/* ---------------------------------------------------------------------------
   fsp rules for core#122: what the shared dark block cannot know. fsp colours
   many text rules with its accent and paints several light backgrounds of its
   own; in the dark scheme those take the lightened accent and dark surfaces.
   Also, bare URLs used as link text (country pages) may break anywhere rather
   than push the page wider than a phone.
   --------------------------------------------------------------------------- */
main a[href^="http"] { overflow-wrap: anywhere; }
@media screen and (prefers-color-scheme: dark) {
  main a, .cc-count, .am-row strong, .decl-link, .viz-tab:hover, .viz-tab[aria-selected="true"],
  .atlas-year, .cp-link a, .src-links a, .facts dt { color: var(--accent-hi); }
  table.meetings tbody tr:nth-child(even), details.wg-composition { background: #1d2026; }
  tr.fsp-row { background: #1c2a20 !important; }
  .viz-tab { background: #23262d; }
  .viz-tab[aria-selected="true"] { background: var(--surface); }
  .atlas-btn, .m-controls input, .m-controls select { background: var(--surface); color: var(--ink); }
  .m-controls select option { background: var(--surface); color: var(--ink); }
}

/* ---------------------------------------------------------------------------
   Dark mode (core#113): follows the reader's system setting; the light page
   is untouched. A self-contained block, appended last, so it layers over any
   site's copy of the stylesheet: it redefines the base tokens and restates
   only the rules that hard-code a light colour. The site accent is a dark
   hue, so wherever it is TEXT it is lifted to --accent-hi; where it is a fill
   it stays the accent. Screen only: print keeps the light page.
   --------------------------------------------------------------------------- */
@media screen and (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121418; --surface: #1a1d23; --ink: #e4e6ea; --muted: #9ba2ae; --line: #2d313a;
    --accent-hi: color-mix(in srgb, var(--accent) 45%, #ffffff);
    --accent-soft: color-mix(in srgb, var(--accent) 26%, #1a1d23);
    --accent-dark: var(--accent-hi);
    --card: var(--surface);
  }
  .site-header { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 45%, #000000), var(--accent)); }
  .site-nav { background: #0d0f13; box-shadow: 0 1px 0 var(--line); }
  a { color: var(--accent-hi); }
  .site-nav a { color: #e8e6e1; }
  .facts dt, .flag, .related-link a, sup.cite a, ol.references a, .archive-link:hover,
  .lang-switch a:hover, .lang-switch .lang-current, .party-link a { color: var(--accent-hi); }
  .glossary-link { color: var(--accent-hi); border-bottom-color: var(--accent-hi); }
  .notice-attribution { background: #2a2416; }
  .i18n-disclaimer { background: #2a2416; border-bottom-color: #4a3d1f; color: #e3cf8f; }
  table.meetings thead th { background: #0d0f13; }
  table.meetings tbody tr:nth-child(even) { background: #16191e; }
  .site-footer code { background: #262a31; }
  .lineage-branch.lineage-separate { background: #211d14; }
  .lineage-separate .tree-status { color: #e7c58a; background: #3a2f18; }
  .tree-edge-label { background: #23262d; }
  .nc-track { background: #262a31; }
  .latam-bg { fill: #2a2e36; stroke: #121418; }
  .latam-c { fill: #353a44; stroke: #121418; }
  .latam-c.map-t1, .atlas-swatch.map-t1 { fill: color-mix(in srgb, var(--accent) 70%, #2a2e36); background: color-mix(in srgb, var(--accent) 70%, #2a2e36); }
  .latam-c.map-t2, .atlas-swatch.map-t2 { fill: color-mix(in srgb, var(--accent) 45%, #2a2e36); background: color-mix(in srgb, var(--accent) 45%, #2a2e36); }
  .latam-c.map-t3, .atlas-swatch.map-t3 { fill: color-mix(in srgb, var(--accent) 25%, #2a2e36); background: color-mix(in srgb, var(--accent) 25%, #2a2e36); }
  .atlas-swatch { background: #353a44; }
  .sw-has-unverified { background-image: repeating-linear-gradient(45deg, rgba(18,20,24,.55) 0 3px, transparent 3px 6px); }
  .al-tab[aria-selected="true"] { color: #121418; }
  .al-favourable .al-node-status, .al-favourable .al-status { color: #7fd1a0; }
  .al-negative .al-node-status, .al-negative .al-status { color: #f0a0ab; }
  .al-inconclusive .al-node-status, .al-inconclusive .al-status,
  .al-reported-undocumented .al-node-status, .al-reported-undocumented .al-status { color: #e3c77a; }
  .al-pending .al-node-status, .al-pending .al-status { color: #8cc8e6; }
  .al-adjacent .al-node-status, .al-adjacent .al-status { color: #c3a9e8; }
  .rv-l0 { --c: var(--accent-hi); }
  .rv-lanes .rv-l0 { --c: #9d93ff; }
  /* The light scheme's solid heat steps would sink into the dark page; the
     translucent steps keep the scale reading dark-to-bright. */
  .sw-i3 { background: color-mix(in srgb, var(--accent) 46%, transparent); }
  .sw-i4 { background: color-mix(in srgb, var(--accent) 64%, transparent); }
  .rv-span .rv-ct { background: var(--accent-hi); }
  .rv-span .rv-cr { border-color: var(--accent-hi); background: color-mix(in srgb, var(--accent-hi) 35%, transparent); }
  .rv-span b { border-color: var(--accent-hi); }
  .rv-l1 { --c: #4fc4b5; } .rv-l2 { --c: #e3a24f; } .rv-l3 { --c: #f07aa8; }
  .rv-l4 { --c: #6fb4e8; } .rv-l5 { --c: #a8c25a; } .rv-l6 { --c: #d49a7e; } .rv-l7 { --c: #a3adbb; }
  .rv-win { fill: var(--accent-hi); stroke: var(--accent-hi); }
}
