:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1f24;
  --muted: #5d6470;
  --line: #e4e1d9;
  --accent: #1f5fa8;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fa;
  --maj: #b4532a;
  --pro: #2d7a4f;
  --mix: #7a4fa8;
  --map-sea: #eef3f8;
  --map-empty: #d9dde3;
  --map-border: #ffffff;
  --map-other: #c9a227;
  --map-noparl: #8b8f97;
  --radius: 10px;
  --wrap: 1120px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1b1f26;
    --text: #e7e9ee;
    --muted: #a0a7b4;
    --line: #2c323c;
    --accent: #7fb0ec;
    --accent-ink: #0d1520;
    --accent-soft: #1d2a3b;
    --maj: #e39470;
    --pro: #74c79a;
    --mix: #b996e3;
    --map-sea: #17202b;
    --map-empty: #3a414d;
    --map-border: #1b1f26;
    --map-other: #d8b84a;
    --map-noparl: #6b717c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 var(--font); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-family: var(--serif); font-size: clamp(1.9rem, 4vw, 2.6rem); margin: .2em 0 .4em; }
h2 { font-size: 1.4rem; margin: 1.8em 0 .5em; }
h3 { font-size: 1.1rem; margin: 1.4em 0 .4em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 46em; }
.section { padding: 24px 16px 48px; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.2rem; }
.brand-mark { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .95rem; }
.site-nav a:hover, .site-nav a[aria-current] { background: var(--accent-soft); color: var(--accent); }

/* hero */
.hero { padding: 48px 0 24px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }
.hero-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.button { display: inline-block; background: var(--accent); color: var(--accent-ink); padding: 10px 18px; border-radius: 8px; text-decoration: none; font-weight: 600; border: 1px solid var(--accent); }
.button.ghost { background: transparent; color: var(--accent); }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 12px; }
.card { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--text); text-decoration: none; }
.card:hover { border-color: var(--accent); }
.card strong { font-size: 1.05rem; }
.card .muted { font-size: .92rem; }
.tag { align-self: flex-start; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.tag-majoritarian { color: var(--maj); }
.tag-proportional { color: var(--pro); }
.tag-mixed { color: var(--mix); }

.country-list { list-style: none; padding: 0; margin: 0; columns: 3 220px; column-gap: 24px; }
.country-list li { padding: 3px 0; break-inside: avoid; }

/* article */
.article { padding-top: 20px; padding-bottom: 56px; }
.crumbs { font-size: .88rem; color: var(--muted); margin-top: 8px; }
.crumbs a { color: var(--muted); }
.meta { margin-top: -4px; }
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; margin-top: 20px; align-items: start; }
.article-grid > .facts { order: 2; position: sticky; top: 16px; }
.article-grid > .prose { order: 1; }
.prose { max-width: 720px; }
.prose p, .prose li { overflow-wrap: break-word; }
.prose h2 { font-family: var(--serif); font-size: 1.55rem; border-top: 1px solid var(--line); padding-top: 1em; }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--accent-soft); }
.prose blockquote { margin: 1em 0; padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.prose blockquote p { margin: 0; }

.facts { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; font-size: .92rem; }
.facts-title { font-family: var(--font); font-size: 1rem; margin: 0 0 10px; border: 0; padding: 0; }
.facts dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.facts .star { text-decoration: none; margin-left: 1px; }
.facts-note { margin: 8px 0 0; line-height: 1.4; }
.office { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; }
.office h3 { font-size: .98rem; margin: 0 0 8px; }
/* world map */
.map-wrap { margin: 16px 0 8px; }
.map { position: relative; background: var(--map-sea); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; touch-action: none; }
.world-map { display: block; width: 100%; height: auto; cursor: grab; user-select: none; }
.world-map.dragging { cursor: grabbing; }
.world-map .sea { fill: var(--map-sea); }
.world-map .land path { fill: var(--map-empty); stroke: var(--map-border); stroke-width: calc(0.5px / var(--k, 1)); vector-effect: non-scaling-stroke; }
.world-map .land path.has-page { cursor: pointer; }
.world-map .f-majoritarian { fill: var(--maj) !important; }
.world-map .f-proportional { fill: var(--pro) !important; }
.world-map .f-mixed { fill: var(--mix) !important; }
.world-map .f-other { fill: var(--map-other) !important; }
.world-map .f-none { fill: var(--map-noparl) !important; }
.world-map .land path.has-page { stroke: var(--text); stroke-width: 0.9px; }
.world-map .land path.no-page:not([class*="f-"]) { fill: var(--map-empty); }
.world-map .land path.has-page:hover, .world-map .land path.has-page:focus { filter: brightness(1.15); outline: none; }
.world-map .dots circle { fill: var(--map-empty); stroke: var(--map-border); stroke-width: 0.5px; vector-effect: non-scaling-stroke; r: calc(2.2px / sqrt(var(--k, 1))); }
.world-map .dots circle.has-page { cursor: pointer; }
.map-controls { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; }
.map-controls button { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 18px; line-height: 1; cursor: pointer; }
.map-controls button:hover { border-color: var(--accent); color: var(--accent); }
.map-tip { position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: .85rem; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.map-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.65); color: #fff; padding: 8px 14px; border-radius: 8px; font-size: .9rem; pointer-events: none; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 8px; font-size: .88rem; }
.map-legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw-majoritarian { background: var(--maj); }
.sw-proportional { background: var(--pro); }
.sw-mixed { background: var(--mix); }
.sw-other { background: var(--map-other); }
.sw-noparl { background: var(--map-noparl); }
.sw-none { background: var(--map-empty); border: 1px solid var(--map-border); }

.tier { margin-top: 10px; }
.tier-name { margin: 0 0 4px; }
.tier p.small { margin: 4px 0 0; }
.plain { list-style: none; padding: 0; margin: 0 0 16px; }
.plain li { padding: 3px 0; }

.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px; margin-bottom: 8px; font-size: .95rem; }
.toc-title { font-weight: 700; margin: 0 0 4px; }
.toc ol { margin: 0; padding-left: 20px; }

.sources { margin-top: 32px; font-size: .92rem; }
.sources h2 { font-size: 1.15rem; }
.related { margin-top: 48px; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 28px 0 24px; margin-top: 24px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; margin-bottom: 16px; }
.footer-grid nav { display: flex; flex-direction: column; gap: 4px; }
.footer-grid nav a { color: var(--text); text-decoration: none; font-size: .95rem; }
.footer-grid nav a:hover { color: var(--accent); }
.footer-brand { font-weight: 700; margin: 0 0 4px; }

@media (max-width: 860px) {
  .article-grid { grid-template-columns: 1fr; gap: 24px; }
  .article-grid > .facts { order: 0; position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
}
