/* One warm dark palette for every visitor, whatever their system setting (owner's choice, 8.10.2026). The page,
   boxes, lines, text and links match the owner's preferred dark rendering; the agree/disagree and notice colours
   are the earlier dark theme's. Printing switches to black on white below. */
:root {
  color-scheme: dark;
  --bg: #24211a;
  --surface: #201d14;   /* header, boxes and cards sit a shade darker than the page */
  --text: #cfcbc4;
  --muted: #ada69c;
  --line: #3e4346;
  --accent: #7fb4e3;
  --notice-bg: #3a3218;
  --notice-text: #f3e2b0;
  --agree: #8fd19e;
  --disagree: #f0a3a3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

.site-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.site-name {
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 16px;
}

h1 { font-size: 1.9rem; margin: 0.6em 0 0.3em; }
h2 { font-size: 1.35rem; margin-top: 2.2em; padding-top: 0.6em; border-top: 1px solid var(--line); }

details.section { margin: 2.2em 0 0; border-top: 1px solid var(--line); }
details.section > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 0.6em 0 0.2em; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::before { content: "▸"; color: var(--muted); font-size: 1rem; transition: transform 0.15s; }
details.section[open] > summary::before { transform: rotate(90deg); }
details.section > summary h2 { margin: 0; padding: 0; border: 0; display: inline; }
h3 { font-size: 1.05rem; margin-top: 1.6em; }

.lead { color: var(--muted); font-size: 1.05rem; }
.section-intro { color: var(--muted); }

.mp-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 8px;
}
.mp-group > h3 { font-size: 1.2rem; margin: 1.8em 0 0; padding-top: 0.5em; border-top: 1px solid var(--line); }
.mp-group-link { margin: 2px 0 0; font-size: 0.92rem; }
.mp-district { margin: 1.1em 0 0; font-size: 0.98rem; }
.mp-count { color: var(--muted); font-weight: 400; }

/* Party summary pages and their links on the front page */
.party-nav ul { padding-left: 1.2rem; }
.party-nav li { margin: 4px 0; }
.party-tally { font-weight: 600; }
.party-district h2 { border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.party-mp { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin: 10px 0; }
.party-mp h3 { margin: 0 0 6px; font-size: 1.05rem; display: flex; justify-content: space-between; gap: 12px; }
.party-mp p { margin: 0 0 6px; }
.party-mp p:last-child { margin-bottom: 0; }
.party-mp ul { margin: 0 0 8px; padding-left: 1.3rem; }
.party-mp-list-heading { font-weight: 600; margin-bottom: 2px; }
.party-mp-rating { color: var(--accent); white-space: nowrap; }

.mp-card {
  display: grid;
  height: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}
.mp-card:hover { border-color: var(--accent); }
.mp-card-name { font-weight: 650; }
.mp-card-meta { color: var(--muted); font-size: 0.92rem; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
@media (max-width: 520px) {
  .facts { grid-template-columns: 1fr; }
  .facts dd { margin-bottom: 6px; }
}

.missing-notice {
  border-left: 3px solid var(--line);
  padding-left: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.source { font-size: 0.85rem; color: var(--muted); margin: 6px 0 0; }
.source-compact { margin-top: 2px; }
.source-meta { white-space: nowrap; margin-left: 6px; }

.promises li, .answers li { margin-bottom: 1.4em; }
.promise-text { margin: 0; white-space: pre-line; }
.reasoning { white-space: pre-line; }

.question { font-weight: 600; margin: 0; }
.answer { margin: 4px 0; }
.answer-label {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.88rem;
}

.reasoning {
  margin: 6px 0 0;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--accent);
}
.reasoning-missing { color: var(--muted); font-style: italic; margin: 4px 0 0; }

.rule { color: var(--muted); font-size: 0.9rem; margin: 0 0 8px; }
.unchecked { font-style: italic; }

details { margin: 12px 0; }
summary { cursor: pointer; font-weight: 600; padding: 4px 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0; }
.stats > div { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--surface); }
.stats dt { color: var(--muted); font-size: 0.9rem; }
.stats dd { margin: 0; }
.stat-value { font-size: 1.6rem; font-weight: 700; }

.table-wrap { overflow-x: auto; }
table.votes { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
table.votes th, table.votes td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.votes th { color: var(--muted); font-weight: 600; }
.nowrap { white-space: nowrap; }
.vote-item { display: block; font-weight: 600; }
.vote-title, .vote-stage { display: block; color: var(--muted); }
.status-jaa { color: var(--agree); font-weight: 600; }
.status-ei { color: var(--disagree); font-weight: 600; }
.status-poissa, .status-presiding { color: var(--muted); }

.documents { padding-left: 1.2em; }
.documents li { margin-bottom: 8px; }
.doc-kind { display: block; color: var(--muted); font-size: 0.85rem; }

.speeches li { margin-bottom: 1em; }
.speech-meta { margin: 0; color: var(--muted); font-size: 0.88rem; }
.speech-excerpt { margin: 2px 0 0; }

.promise-kind { margin: 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.promise-links { margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.promise-links-heading { margin: 0 0 6px; font-weight: 600; font-size: 0.9rem; }
.promise-links ul { list-style: none; padding: 0; margin: 0; }
.promise-links li + li { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.link-label { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; border: 1px solid var(--line); }
.link-ai_varma .link-label, .link-ai_heikko .link-label { border-style: dashed; }
.link-target-kind { color: var(--muted); font-size: 0.85rem; margin-left: 6px; }
.link-target { margin: 6px 0 0; padding-left: 12px; border-left: 3px solid var(--line); }
.link-reasoning { margin: 6px 0 0; font-size: 0.88rem; color: var(--muted); }
.link-vote { margin: 6px 0 0; font-size: 0.9rem; }

/* Table of contents: a box under the MP's facts, or on wide screens a list that stays beside the page. */
main { position: relative; }
.toc {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 14px;
  font-size: 0.88rem;
  line-height: 1.45;
}
.toc-title { margin: 0; font-weight: 700; }
details.toc > summary.toc-title { cursor: pointer; }
.toc ol { counter-reset: toc; list-style: none; margin: 4px 0 0; padding: 0; }
.toc ol ol { margin: 2px 0 4px 1.6em; }
.toc li { counter-increment: toc; margin: 2px 0; }
.toc li > a::before { content: counters(toc, ".") " "; color: var(--muted); }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.toc-inline { margin: 1.4em 0 0; }
.toc-side { display: none; }
@media (min-width: 1260px) {
  .toc-side { display: block; position: absolute; top: 16px; bottom: 16px; right: calc(100% + 8px); width: 15rem; }
  .toc-side .toc { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
  .toc-inline { display: none; }
}

/* The statistics at the top of an MP page: always open, values first, how they are counted behind a toggle. */
.section-static { margin: 2.2em 0 0; }
.section-static > h2 { margin-top: 0; }
.section-static h3 { margin: 1.2em 0 0.5em; }
.stats-lead { font-weight: 600; }
.stats-note { margin: 8px 0 0; color: var(--muted); font-size: 0.92rem; }
.stats dt a { text-decoration: none; }
.stats dt a:hover { text-decoration: underline; }
.stat-base { font-size: 0.82rem; color: var(--muted); }
.stats-how { margin: 1.2em 0 0; font-size: 0.9rem; }
.stats-how > summary { cursor: pointer; color: var(--accent); }
.stats-how dt { font-weight: 600; margin-top: 8px; }
.stats-how dd { margin: 0; color: var(--muted); }

.compare-list { list-style: none; padding: 0; }
.compare-list > li {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.compare-list > li.compare-miss { border-left-color: var(--disagree); }
.compare-list > li.compare-hit { border-left-color: var(--agree); }
.compare-outcome { margin: 0; font-weight: 600; }
.compare-miss .compare-outcome { color: var(--disagree); }
.compare-hit .compare-outcome { color: var(--agree); }
.compare-vote { margin: 2px 0 0; }
.compare-said { margin: 10px 0 0; font-size: 0.85rem; color: var(--muted); }
.compare-statement + .compare-statement { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.compare-facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 12px 0 0; }
.compare-facts dt { color: var(--muted); }
.compare-facts dd { margin: 0; }
@media (max-width: 520px) {
  .compare-facts { grid-template-columns: 1fr; }
  .compare-facts dd { margin-bottom: 6px; }
}

.media { list-style: none; padding: 0; }
.media li { margin-bottom: 1.2em; }
.media-meta { margin: 0; color: var(--muted); font-size: 0.85rem; }
.media-quote { margin: 4px 0 0; padding-left: 12px; border-left: 3px solid var(--accent); }

.cv { padding-left: 1.2em; }
.cv li { margin-bottom: 4px; }
.period { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 4px; }

.export-tools {
  max-width: 46rem;
  margin: 12px auto 0;
  padding: 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.export-button {
  font: inherit;
  font-size: 0.88rem;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.export-button:hover { border-color: var(--accent); }
.export-note {
  max-width: 46rem;
  margin: 12px auto 0;
  padding: 0 16px;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer {
  max-width: 46rem;
  margin: 2em auto 0;
  padding: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

/* Printing and "save as PDF": the whole page, light colours, sources written out. */
@media print {
  :root {
    color-scheme: light;
    --bg: #ffffff; --surface: #ffffff; --text: #000000; --muted: #444444;
    --line: #bbbbbb; --accent: #000000; --notice-bg: #ffffff; --notice-text: #000000;
    --agree: #000000; --disagree: #000000;
  }
  body { font-size: 10.5pt; background: #ffffff; }
  main, .site-footer { max-width: none; padding: 0; }
  .export-tools, .back-link, .toc-side { display: none; }
  details.section > summary::before { display: none; }
  summary { list-style: none; }
  summary::-webkit-details-marker { display: none; }
  a { color: #000000; }
  /* A printed page cannot be clicked, so source links show their address. */
  .source a[href^="http"]::after,
  .documents a[href^="http"]::after,
  .rule a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    word-break: break-all;
  }
  table.votes { font-size: 7.5pt; }
  table.votes a[href^="http"]::after { content: none; }
  h2, h3, summary { break-after: avoid; }
  li, tr, .stats > div, .promise-links { break-inside: avoid; }
}
