/* ============================================================
   voting.wiki — Stylesheet
   Palette: #1e3a5f #f5f7fa #1a1a2e #dc2626 #16a34a #ffffff #d1d5db
   Fonts: Source Serif 4, Source Sans 3, Source Code Pro
   ============================================================ */

/* ── Reset / Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: #1a1a2e;
  background: #ffffff;
}

a {
  color: #1e3a5f;
  text-decoration: none;
}
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

ul, ol { list-style: none; }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Source Serif 4', Georgia, serif;
  color: #1e3a5f;
  line-height: 1.25;
}

h1 { font-size: clamp(1.5rem, 2.5vw, 2rem); font-weight: 700; }
h2 { font-size: clamp(1.2rem, 2vw, 1.5rem); font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

p { margin-bottom: 0.9rem; }
p:last-child { margin-bottom: 0; }

code, pre, .codeblock {
  font-family: 'Source Code Pro', 'Courier New', monospace;
  font-size: 0.85rem;
}

code {
  background: #f5f7fa;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  color: #1a1a2e;
}

strong { font-weight: 600; }
em { font-style: italic; }

/* ── Site Header ─────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid #d1d5db;
  padding: 0 1.5rem;
}

.site-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 52px;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e3a5f;
  white-space: nowrap;
  flex-shrink: 0;
}
.site-header__brand:hover { text-decoration: none; }

.site-header__mark {
  color: #1e3a5f;
  display: flex;
  align-items: center;
}

.site-header__dot { color: #dc2626; }

.site-header__nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  flex: 1;
}

.site-header__nav a {
  color: #1a1a2e;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.site-header__nav a:hover {
  color: #1e3a5f;
  border-bottom-color: #1e3a5f;
  text-decoration: none;
}

.site-header__search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.site-header__search input[type="search"] {
  width: 200px;
  padding: 0.35rem 0.65rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  color: #1a1a2e;
  background: #f5f7fa;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.site-header__search input[type="search"]:focus {
  border-color: #1e3a5f;
  background: #ffffff;
}
.site-header__search input[type="search"]::placeholder { color: #6b7280; }

.site-header__search kbd {
  font-family: 'Source Code Pro', monospace;
  font-size: 0.7rem;
  background: #f5f7fa;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  padding: 0.1em 0.4em;
  color: #6b7280;
}

/* ── Wiki Layout ─────────────────────────────────────────────── */
.wiki {
  display: grid;
  grid-template-columns: 200px minmax(0, 720px) 280px;
  gap: 0;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  align-items: start;
}

/* ── TOC Sidebar ─────────────────────────────────────────────── */
.wiki__toc {
  position: sticky;
  top: 70px;
  padding-right: 1.5rem;
  padding-top: 0.25rem;
  border-right: 1px solid #d1d5db;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.toc__title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 0.75rem;
}

.toc__list,
.toc__sublist {
  list-style: none;
  padding: 0;
}

.toc__sublist { padding-left: 0.75rem; margin-top: 0.15rem; }

.toc__list li { margin-bottom: 0.1rem; }
.toc__sublist li { margin-bottom: 0.05rem; }

.toc__link {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #1a1a2e;
  padding: 0.15rem 0.4rem 0.15rem 0;
  border-right: 3px solid transparent;
  transition: color 0.15s;
}

.toc__link:hover { color: #1e3a5f; text-decoration: none; }

.toc__link.is-active {
  font-weight: 600;
  color: #1e3a5f;
  border-right-color: #1e3a5f;
}

.toc__link--sub { font-size: 0.78rem; color: #4b5563; }
.toc__link--sub.is-active { color: #1e3a5f; }

.toc__num {
  font-family: 'Source Code Pro', monospace;
  font-size: 0.72rem;
  color: #9ca3af;
  flex-shrink: 0;
}

/* Reading progress bar */
.toc__progress {
  margin-top: 1.5rem;
  height: 3px;
  background: #f5f7fa;
  border-radius: 2px;
  overflow: hidden;
}
.toc__progress-bar {
  height: 100%;
  width: 0%;
  background: #1e3a5f;
  transition: width 0.1s linear;
}

/* ── Article Main ─────────────────────────────────────────────── */
.wiki__article {
  padding: 0 2rem;
  min-width: 0;
}

/* Article Header */
.article-header { margin-bottom: 1.5rem; }

.article-header__kicker {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #1e3a5f;
  margin-bottom: 0.4rem;
}

.article-header__title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: 0.6rem;
}

.article-header__lede {
  font-size: 1.05rem;
  color: #374151;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.article-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: 0.8rem;
  color: #6b7280;
  border-top: 1px solid #d1d5db;
  padding-top: 0.6rem;
}
.article-header__meta span { white-space: nowrap; }
.article-header__meta strong { color: #1a1a2e; }

/* ── Infobox (right-floated within article) ─────────────────── */
.infobox {
  float: right;
  width: 280px;
  margin: 0 0 1.5rem 1.5rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.85rem;
  background: #f5f7fa;
  clear: right;
}

.infobox__header {
  background: #1e3a5f;
  color: #ffffff;
  padding: 0.5rem 0.75rem;
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  border-radius: 3px 3px 0 0;
}

.infobox__figure { padding: 0.75rem; border-bottom: 1px solid #d1d5db; }

.infobox__diagram {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  height: 70px;
  padding: 0.25rem 0;
}

.infobox__diagram-bar {
  flex: 1;
  height: var(--h, 50%);
  background: var(--c, #1e3a5f);
  border-radius: 2px 2px 0 0;
  opacity: 0.85;
}

.infobox__figure figcaption {
  font-size: 0.72rem;
  color: #6b7280;
  text-align: center;
  margin-top: 0.4rem;
}

.infobox__list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
  padding: 0.5rem 0.75rem;
}

.infobox__list dt {
  font-weight: 600;
  color: #1a1a2e;
  padding: 0.25rem 0.5rem 0.25rem 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.8rem;
}

.infobox__list dd {
  color: #374151;
  padding: 0.25rem 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.8rem;
}

.infobox__list dt:last-of-type,
.infobox__list dd:last-of-type { border-bottom: none; }

.infobox__footer {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid #d1d5db;
}

.infobox__chip {
  font-size: 0.7rem;
  padding: 0.15em 0.5em;
  border-radius: 20px;
  background: #e5e7eb;
  color: #374151;
  font-weight: 500;
}

.infobox__chip--good {
  background: #dcfce7;
  color: #15803d;
}

/* ── Article Sections ─────────────────────────────────────────── */
.article-section {
  margin-bottom: 2.5rem;
  padding-top: 1rem;
}

.article-section__heading {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-weight: 600;
  color: #1e3a5f;
  border-bottom: 2px solid #d1d5db;
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}

.article-section__num {
  font-family: 'Source Code Pro', monospace;
  font-size: 0.85rem;
  color: #9ca3af;
}

.article-section__anchor {
  margin-left: auto;
  font-size: 0.85rem;
  color: #9ca3af;
  opacity: 0;
  transition: opacity 0.15s;
}
.article-section__heading:hover .article-section__anchor { opacity: 1; }

/* ── Pullquote ─────────────────────────────────────────────────── */
.pullquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid #1e3a5f;
  background: #f5f7fa;
  border-radius: 0 4px 4px 0;
}

.pullquote p {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.05rem;
  font-style: italic;
  color: #1a1a2e;
  margin-bottom: 0.5rem;
}

.pullquote cite {
  font-size: 0.82rem;
  color: #6b7280;
  font-style: normal;
}

.pullquote cite span { font-style: italic; }

/* ── Wiki links ─────────────────────────────────────────────────── */
.wiki-link {
  color: #1e3a5f;
  text-decoration: underline;
  text-decoration-color: #9ca3af;
  text-underline-offset: 2px;
}
.wiki-link:hover { text-decoration-color: #1e3a5f; }

/* ── System Tabs ─────────────────────────────────────────────────── */
.system-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #d1d5db;
  margin-bottom: 0;
}

.system-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.6rem 1.1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: 'Source Sans 3', sans-serif;
}

.system-tab:hover { background: #f5f7fa; }

.system-tab.is-active {
  border-bottom-color: #1e3a5f;
  background: #ffffff;
}

.system-tab__abbr {
  font-family: 'Source Code Pro', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: #1e3a5f;
  letter-spacing: 0.04em;
}

.system-tab__name {
  font-size: 0.82rem;
  color: #374151;
}

.system-tab.is-active .system-tab__name { color: #1a1a2e; font-weight: 600; }

/* ── System Panels ─────────────────────────────────────────────── */
.system-panels {
  border: 1px solid #d1d5db;
  border-top: none;
  border-radius: 0 0 4px 4px;
  background: #ffffff;
}

.system-panel {
  display: none;
  padding: 1.25rem 1.5rem;
}

.system-panel.is-active { display: block; }

.system-panel__title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e3a5f;
  margin-bottom: 0.75rem;
}

/* Data row */
.data-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 0.75rem;
  background: #f5f7fa;
  border-radius: 4px;
  border: 1px solid #d1d5db;
}

.data-row > div { display: contents; }

.data-row dt {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 0.1rem;
  grid-column: span 1;
}

.data-row dd {
  font-size: 0.9rem;
  color: #1a1a2e;
  font-weight: 500;
}

.data-row > div {
  display: flex;
  flex-direction: column;
}

/* ── Comparison Table ─────────────────────────────────────────── */
.comparison-wrap {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: 4px;
  border: 1px solid #d1d5db;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.comparison-table thead th {
  background: #1e3a5f;
  color: #ffffff;
  padding: 0.6rem 1rem;
  text-align: left;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
}

.comparison-table thead th:first-child { width: 200px; }

.comparison-table tbody tr:nth-child(even) td,
.comparison-table tbody tr:nth-child(even) th {
  background: #f9fafb;
}

.comparison-table tbody th {
  padding: 0.6rem 1rem;
  font-weight: 500;
  font-size: 0.85rem;
  color: #1a1a2e;
  text-align: left;
  cursor: help;
  border-right: 1px solid #d1d5db;
}

.comparison-table tbody td {
  padding: 0.6rem 1rem;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  border-right: 1px solid #e5e7eb;
  position: relative;
}

.comparison-table tbody td:last-child { border-right: none; }

.cell--yes {
  color: #15803d;
  background: #f0fdf4 !important;
}

.cell--no {
  color: #b91c1c;
  background: #fef2f2 !important;
}

.cell--mixed {
  color: #b45309;
  background: #fffbeb !important;
}

.cell--na {
  color: #9ca3af;
  background: #f9fafb !important;
  font-weight: 400;
}

/* Tooltip on hover */
.comparison-table tbody th[data-tip] {
  position: relative;
}

.comparison-table tbody th[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: #1a1a2e;
  color: #ffffff;
  font-size: 0.72rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.15s;
  max-width: 200px;
  white-space: normal;
}

.comparison-table tbody th[data-tip]:hover::after { opacity: 1; }

/* ── Pros / Cons ─────────────────────────────────────────────────── */
.proscons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.25rem 0;
}

.proscons__card {
  border-radius: 4px;
  border: 1px solid #d1d5db;
  padding: 1rem 1.25rem;
}

.proscons__card--pro {
  border-left: 4px solid #16a34a;
  background: #f0fdf4;
}

.proscons__card--con {
  border-left: 4px solid #dc2626;
  background: #fef2f2;
}

.proscons__title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.proscons__card--pro .proscons__title { color: #15803d; }
.proscons__card--con .proscons__title { color: #b91c1c; }

.proscons__list { padding: 0; }

.proscons__list li {
  font-size: 0.85rem;
  color: #374151;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding-left: 1.1rem;
  position: relative;
}
.proscons__list li:last-child { border-bottom: none; }

.proscons__card--pro .proscons__list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #16a34a;
  font-weight: 700;
}

.proscons__card--con .proscons__list li::before {
  content: '✗';
  position: absolute;
  left: 0;
  color: #dc2626;
  font-weight: 700;
}

/* ── Ballot Diagrams ─────────────────────────────────────────────── */
.ballot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.ballot {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.ballot__caption {
  background: #1e3a5f;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  text-align: center;
}

.ballot__list { padding: 0.25rem; }

.ballot__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.12s;
  user-select: none;
}

.ballot__row:last-child { border-bottom: none; }
.ballot__row:hover { background: #f5f7fa; }
.ballot__row.is-marked { background: #eff6ff; }

.ballot__check {
  width: 20px;
  height: 20px;
  border: 2px solid #9ca3af;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: #ffffff;
  transition: background 0.15s, border-color 0.15s;
}

.ballot__check--multi {
  border-radius: 3px;
}

.ballot__row.is-marked .ballot__check {
  background: #1e3a5f;
  border-color: #1e3a5f;
}
.ballot__row.is-marked .ballot__check::after { content: '✓'; }

.ballot__rank {
  width: 20px;
  height: 20px;
  border: 2px solid #9ca3af;
  border-radius: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Source Code Pro', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffffff;
  transition: background 0.15s, border-color 0.15s;
}

.ballot__row.is-ranked .ballot__rank {
  background: #1e3a5f;
  border-color: #1e3a5f;
}

.ballot__name {
  font-size: 0.82rem;
  color: #1a1a2e;
  flex: 1;
}

.ballot__party {
  font-family: 'Source Code Pro', monospace;
  font-size: 0.68rem;
  color: #9ca3af;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.ballot__hint {
  font-size: 0.7rem;
  color: #9ca3af;
  text-align: center;
  padding: 0.35rem;
  background: #fafafa;
  border-top: 1px solid #f0f0f0;
  margin: 0;
}

/* ── Code Block ─────────────────────────────────────────────────── */
.codeblock {
  background: #1a1a2e;
  color: #d1d5db;
  padding: 1.25rem 1.5rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.65;
  margin: 1rem 0;
}

.codeblock code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.code-comment { color: #6b7280; font-style: italic; }
.code-keyword { color: #93c5fd; font-weight: 500; }
.code-fn { color: #86efac; }

/* ── Round Counter (IRV simulation) ─────────────────────────────── */
.round-counter {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 1.25rem;
}

.round-counter__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: #f5f7fa;
  border-bottom: 1px solid #d1d5db;
}

.round-counter__head h4 {
  font-size: 0.875rem;
  color: #1e3a5f;
  font-family: 'Source Serif 4', Georgia, serif;
}

.round-counter__btn {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  background: #1e3a5f;
  border: none;
  border-radius: 4px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}
.round-counter__btn:hover { background: #1a3352; }
.round-counter__btn:disabled { background: #9ca3af; cursor: default; }

.round-counter__rounds {
  padding: 0.75rem 1rem;
  min-height: 80px;
  list-style: decimal;
  list-style-position: inside;
}

.round-counter__rounds li {
  font-size: 0.85rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid #f0f0f0;
  color: #374151;
}
.round-counter__rounds li:last-child { border-bottom: none; }

/* ── Glossary ─────────────────────────────────────────────────── */
.glossary {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  overflow: hidden;
}

.glossary dt {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e3a5f;
  background: #f5f7fa;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #d1d5db;
}

.glossary dd {
  font-size: 0.875rem;
  color: #374151;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  line-height: 1.5;
}

.glossary dd:last-child { border-bottom: none; }

/* ── References ─────────────────────────────────────────────────── */
.references {
  list-style: decimal;
  list-style-position: outside;
  padding-left: 1.5rem;
}

.references li {
  font-size: 0.875rem;
  color: #374151;
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.see-also {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #6b7280;
  border-top: 1px solid #d1d5db;
  padding-top: 0.75rem;
}

/* ── Right Rail ─────────────────────────────────────────────────── */
.wiki__rail {
  position: sticky;
  top: 70px;
  padding-left: 1.5rem;
  padding-top: 0.25rem;
  border-left: 1px solid #d1d5db;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rail-card {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  overflow: hidden;
  background: #ffffff;
}

.rail-card__title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  background: #1e3a5f;
  padding: 0.45rem 0.75rem;
}

/* Stats */
.rail-card__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.rail-card__stats li {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 0.5rem;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  text-align: center;
}

.rail-card__stats li:nth-child(even) { border-right: none; }
.rail-card__stats li:nth-last-child(-n+2) { border-bottom: none; }

.rail-card__num {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e3a5f;
  line-height: 1;
}

.rail-card__lbl {
  font-size: 0.68rem;
  color: #6b7280;
  margin-top: 0.2rem;
  text-align: center;
}

/* Related links */
.rail-card__links { padding: 0.25rem 0; }

.rail-card__links li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.82rem;
}

.rail-card__links li:last-child { border-bottom: none; }
.rail-card__links a { color: #1e3a5f; }
.rail-card__links span {
  font-size: 0.68rem;
  color: #9ca3af;
  text-transform: capitalize;
}

/* Cite card */
.rail-card__cite-line {
  font-size: 0.78rem;
  color: #374151;
  padding: 0.6rem 0.75rem;
  line-height: 1.5;
  border-bottom: 1px solid #e5e7eb;
}

.rail-card__copy {
  display: block;
  width: 100%;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e3a5f;
  background: #f5f7fa;
  border: none;
  border-top: 1px solid #e5e7eb;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.rail-card__copy:hover { background: #eff6ff; }
.rail-card__copy.is-copied { color: #16a34a; }

/* Edit history */
.rail-card__history {
  list-style: none;
  padding: 0.25rem 0;
}

.rail-card__history li {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  color: #374151;
  border-bottom: 1px solid #f0f0f0;
  line-height: 1.4;
}
.rail-card__history li:last-child { border-bottom: none; }

.rail-card__time {
  font-family: 'Source Code Pro', monospace;
  font-size: 0.72rem;
  color: #9ca3af;
  flex-shrink: 0;
}

.rail-card__history em { font-style: italic; color: #1e3a5f; }

/* ── Footer ─────────────────────────────────────────────────────── */
.site-footer {
  background: #1a1a2e;
  color: #d1d5db;
  padding: 2.5rem 1.5rem;
  margin-top: 3rem;
  border-top: 3px solid #1e3a5f;
}

.site-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 2fr;
  gap: 2rem;
}

.site-footer__brand {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.35rem;
}

.site-footer__brand span { color: #dc2626; }

.site-footer__tag {
  font-size: 0.82rem;
  color: #9ca3af;
}

.site-footer__heading {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #9ca3af;
  margin-bottom: 0.6rem;
}

.site-footer__col ul { list-style: none; padding: 0; }

.site-footer__col li { margin-bottom: 0.3rem; }

.site-footer__col a {
  font-size: 0.85rem;
  color: #d1d5db;
  transition: color 0.15s;
}
.site-footer__col a:hover { color: #ffffff; text-decoration: none; }

.site-footer__col p:not(.site-footer__brand):not(.site-footer__tag):not(.site-footer__heading) {
  font-size: 0.82rem;
  color: #9ca3af;
  line-height: 1.6;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .wiki {
    grid-template-columns: 180px 1fr;
    grid-template-rows: auto auto;
  }

  .wiki__rail {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
    border-left: none;
    border-top: 1px solid #d1d5db;
    padding-left: 0;
    padding-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .site-footer__inner {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .wiki {
    grid-template-columns: 1fr;
  }

  .wiki__toc {
    position: static;
    border-right: none;
    border-bottom: 1px solid #d1d5db;
    padding-right: 0;
    padding-bottom: 1rem;
    max-height: none;
    margin-bottom: 1.5rem;
  }

  .wiki__article { padding: 0; }

  .infobox {
    float: none;
    width: 100%;
    margin: 0 0 1.5rem 0;
  }

  .proscons { grid-template-columns: 1fr; }

  .site-header__nav { display: none; }

  .site-footer__inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .ballot-grid { grid-template-columns: 1fr; }

  .system-tabs {
    overflow-x: auto;
  }
}
