/* Which Party quiz. Ballot paper and election ink, with each party in its own colour. Display type: Archivo (8 Oct); text: Instrument Sans.
   Self-hosted type, no external requests, mobile first, works in the WhatsApp in-app browser. */
@font-face {
  font-family: "Archivo";
  font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(fonts/archivo-latin-wght-normal.woff2) format("woff2-variations");
}
@font-face {
  font-family: "Instrument";
  font-style: normal; font-display: swap; font-weight: 400 700;
  src: url(fonts/instrument-sans-latin-wght-normal.woff2) format("woff2-variations");
}

:root {
  --paper: #ffffff;
  --page: #f4f3f9;
  --ink: #15141c;
  --ink-2: #4a4860;
  --muted: #76738c;
  --line: #e3e1ee;
  --line-strong: #cfccdf;
  --violet: #5b3fd6;
  --violet-deep: #3f2aa8;
  --violet-tint: #ece8fb;
  --violet-tint-2: #d9d2f6;
  --on-violet: #ffffff;
  --agree: #1b8a5a;  --agree-tint: #e3f5ec;
  --neutral: #b06f12; --neutral-tint: #fbefd9;
  --disagree: #c43d3d; --disagree-tint: #fbe5e5;
  --radius-s: 10px; --radius: 16px; --radius-l: 24px;
  --shadow: 0 1px 0 rgba(21,20,28,.04), 0 10px 30px -18px rgba(59,42,168,.25);
  --display: "Archivo", "Instrument", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: "Instrument", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Party colours. --p-* is the fill (bars, dots, shapes), --pt-* the same colour darkened enough to read as text on
     paper, --pl-* the light-mode fill kept constant for the share image. Sources: see methodology.html. */
  --p-anc: #f2b51d;      --pt-anc: #b8860b;      --pl-anc: #f2b51d;
  --p-da: #0277b7;       --pt-da: #0267a0;       --pl-da: #0277b7;
  --p-eff: #cf2e2e;      --pt-eff: #c02424;      --pl-eff: #cf2e2e;
  --p-mk: #14532d;       --pt-mk: #14532d;       --pl-mk: #14532d;
  --p-ifp: #b5362a;      --pt-ifp: #a32e23;      --pl-ifp: #b5362a;
  --p-pa: #008a3e;       --pt-pa: #007236;       --pl-pa: #008a3e;
  --p-ffplus: #ff6900;   --pt-ffplus: #b84a00;   --pl-ffplus: #ff6900;
  --p-actionsa: #05b615; --pt-actionsa: #097a12; --pl-actionsa: #05b615;
}
/* Dark mode follows the device unless the person has chosen a theme with the header switch. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1c1b24; --page: #121118; --ink: #f1f0f7; --ink-2: #c9c6dc; --muted: #9b98b3;
    --line: #2f2d3d; --line-strong: #46435a;
    --violet: #a594ff; --violet-deep: #c3b7ff; --violet-tint: #27224a; --violet-tint-2: #352e66; --on-violet: #15141c;
    --agree: #5ed19a; --agree-tint: #17352a; --neutral: #e6b14f; --neutral-tint: #3a2d12; --disagree: #ff8a8a; --disagree-tint: #3d1f1f;
    --shadow: none;
    --p-anc: #ffc94d; --pt-anc: #ffc94d; --p-da: #4fa8e6; --pt-da: #4fa8e6; --p-eff: #f26b67; --pt-eff: #f26b67; --p-mk: #5dba80; --pt-mk: #5dba80;
    --p-ifp: #e58a7f; --pt-ifp: #e58a7f; --p-pa: #3dc27a; --pt-pa: #3dc27a; --p-ffplus: #ff8f45; --pt-ffplus: #ff8f45; --p-actionsa: #55d463; --pt-actionsa: #55d463;
  }
}
:root[data-theme="dark"] {
  --paper: #1c1b24; --page: #121118; --ink: #f1f0f7; --ink-2: #c9c6dc; --muted: #9b98b3;
  --line: #2f2d3d; --line-strong: #46435a;
  --violet: #a594ff; --violet-deep: #c3b7ff; --violet-tint: #27224a; --violet-tint-2: #352e66; --on-violet: #15141c;
  --agree: #5ed19a; --agree-tint: #17352a; --neutral: #e6b14f; --neutral-tint: #3a2d12; --disagree: #ff8a8a; --disagree-tint: #3d1f1f;
  --shadow: none;
  --p-anc: #ffc94d; --pt-anc: #ffc94d; --p-da: #4fa8e6; --pt-da: #4fa8e6; --p-eff: #f26b67; --pt-eff: #f26b67; --p-mk: #5dba80; --pt-mk: #5dba80;
  --p-ifp: #e58a7f; --pt-ifp: #e58a7f; --p-pa: #3dc27a; --pt-pa: #3dc27a; --p-ffplus: #ff8f45; --pt-ffplus: #ff8f45; --p-actionsa: #55d463; --pt-actionsa: #55d463;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--page); }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font-family: var(--body); font-size: 17px; line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
}
a { color: var(--violet); text-underline-offset: 3px; }
h1, h2, h3, .display { font-family: var(--display); letter-spacing: -0.01em; }
h1 { font-size: 38px; line-height: 1.05; font-weight: 800; margin: 0 0 14px; letter-spacing: -0.025em; }
h2 { font-size: 24px; line-height: 1.15; font-weight: 700; margin: 0 0 10px; }
h3 { font-size: 18px; font-weight: 700; margin: 22px 0 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--paper); padding: 8px; }
.skip-link:focus { left: 8px; z-index: 10; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
/* No grey or blue flash on tap (the browser's own tap highlight); buttons show their own pressed state. */
a, button, .btn, .chip, .rankrow { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* Frame */
.site-header { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 720px; margin: 0 auto; padding: 14px 20px 6px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand .logo { height: 28px; width: auto; display: block; }
.brand .logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand .logo-light { display: none; } :root:not([data-theme="light"]) .brand .logo-dark { display: block; } }
:root[data-theme="dark"] .brand .logo-light { display: none; }
:root[data-theme="dark"] .brand .logo-dark { display: block; }
.header-right { display: flex; align-items: center; gap: 4px; }
/* The nav is a row of tabs on wide screens and a menu behind the button on phones; more tabs slot in beside these. */
.site-nav { display: none; }
.site-nav a { font-size: 16px; font-weight: 600; color: var(--ink-2); text-decoration: none; padding: 10px 12px; min-height: 44px; display: flex; align-items: center; border-radius: 8px; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--violet); }
.icon-btn { background: none; border: none; padding: 0; width: 42px; height: 42px; min-height: 0; border-radius: 10px; color: var(--ink-2); }
.icon-btn:hover { background: var(--violet-tint); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn .moon, .icon-btn.is-dark .sun { display: none; }
.icon-btn.is-dark .moon { display: block; }
.app { max-width: 720px; margin: 0 auto; padding: 6px 20px 40px; }
.site-footer { max-width: 720px; margin: 0 auto; padding: 22px 20px 48px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); text-align: center; }
.site-footer .foot-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; text-align: left; }
.site-footer .links a { margin-right: 14px; }
.loading { color: var(--muted); padding: 40px 0; }
body.wide .site-header, body.wide .site-footer { max-width: 1040px; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; margin: 14px 0; box-shadow: var(--shadow); }

/* Buttons */
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 999px; border: 1.5px solid var(--line-strong);
  background: var(--paper); color: var(--ink); padding: 12px 20px; min-height: 48px;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color .15s, border-color .15s, color .15s, transform .08s;
}
button:active, .btn:active { transform: translateY(1px); }
.btn-primary { background: var(--violet); color: var(--on-violet); border-color: var(--violet); }
.btn-primary:hover { background: var(--violet-deep); border-color: var(--violet-deep); }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 18px; padding: 14px 28px; }
.btn-link { background: none; border: none; color: var(--violet); padding: 8px 6px; min-height: 44px; font-weight: 500; border-radius: 8px; gap: 2px; }
.btn-link:hover { text-decoration: underline; }
.chev { width: 18px; height: 18px; flex: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn-row > * { flex: 1 1 auto; }
/* One pattern for a screen's main action and its quieter companion: stacked on a phone, side by side from 600px. */
.actions { display: flex; flex-direction: column-reverse; gap: 6px; margin-top: 28px; }
.actions .btn-primary { width: 100%; }
.actions .btn-link { align-self: center; color: var(--muted); }

/* Hero */
.hero { padding: 36px 24px 30px; border-radius: var(--radius-l); background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); margin: 14px 0; }
.hero h1 { max-width: 11ch; font-size: clamp(36px, 9vw, 56px); }
.hero p { max-width: 44ch; font-size: 18px; color: var(--ink-2); }
.hero .btn-row { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 480px) { .hero .btn-row { flex-direction: row; } .hero .btn-row > * { flex: 1 1 0%; min-width: 0; } }
.hero .links { margin: 12px 0 0; justify-content: center; }

/* Progress */
.topbar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 10px 0 10px; font-size: 14px; color: var(--muted); }
.topbar .sec { font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--ink); letter-spacing: -0.01em; }
.topbar .count { font-variant-numeric: tabular-nums; }
.bar { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.bar > div { height: 100%; background: var(--violet); width: 0; transition: width .25s; border-radius: 3px; }

/* Statement */
.q { padding: 26px 22px 20px; }
.statement { font-family: var(--display); font-size: clamp(24px, 6.4vw, 32px); line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 16px; text-wrap: balance; }
.explainer { font-size: 16px; color: var(--ink-2); margin: 0 0 16px; }
.means { display: grid; gap: 6px; margin: 0 0 20px; font-size: 15px; }
.means div { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; color: var(--ink-2); }
.means .ic { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; margin-top: 1px; }
.means .ic { background: var(--violet-tint); color: var(--violet-deep); }
.means b { color: var(--ink); font-weight: 600; }

/* Answer buttons: brand outline, filling with the brand colour when pressed (option B of 7 Oct; A, C and D are kept below for a swap). */
.answer-block { position: sticky; bottom: 0; background: var(--paper); margin: 0 -22px -20px; padding: 10px 22px 12px; border-radius: 0 0 var(--radius) var(--radius); }
.answers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.answers button { padding: 14px 6px; min-height: 58px; font-size: 16px; font-weight: 700; border-radius: 14px; border: 1.5px solid var(--violet); background: var(--paper); color: var(--violet); }
.answers button.sel, .answers button:active { background: var(--violet); color: var(--on-violet); border-color: var(--violet); }
/* Option A, solid traffic-light colours with white text:
   .answers .agree { background: var(--agree); color: #fff; border-color: var(--agree); } .answers .neutral { background: var(--neutral); color: #fff; border-color: var(--neutral); } .answers .disagree { background: var(--disagree); color: #fff; border-color: var(--disagree); }
   Option C, ink text with a grey border and no colour: .answers button { border-color: var(--line-strong); color: var(--ink); }
   Option D, all three solid violet: .answers button { background: var(--violet); color: var(--on-violet); } */
.under { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.under .btn-link { color: var(--muted); min-height: 40px; }
.under .btn-link:first-child { margin-left: -8px; }
.under .btn-link:last-child { margin-right: -8px; }
.under .btn-link.sel { color: var(--violet); font-weight: 600; }

/* Expectation */
.party-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 0; }
.party-grid button { min-height: 54px; border-radius: 14px; font-weight: 500; }
.party-grid button.sel { border-color: var(--violet); background: var(--violet-tint); color: var(--violet-deep); font-weight: 700; }
.hint { margin: 12px 0 0; }
.notice { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--violet-tint); color: var(--violet-deep); }

/* Results */
.top-match { padding: 26px 22px; border-radius: var(--radius-l); background: var(--paper); border: 1.5px solid var(--violet-tint-2); box-shadow: var(--shadow); margin: 14px 0; }
.top-match .lead { font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.top-match .pname { font-family: var(--display); font-size: clamp(28px, 7.5vw, 40px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.05; margin: 0 0 6px; }
.top-match .pct { font-family: var(--display); font-size: clamp(40px, 12vw, 64px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--ptc); }
.top-match .reveal { margin: 12px 0 0; color: var(--ink-2); font-size: 16px; }
.top-match .top-share { margin-top: 18px; }

.rank { list-style: none; padding: 0; margin: 4px 0 0; }
.rank li { border-top: 1px solid var(--line); }
.rank li:first-child { border-top: none; }
/* Each party is one tappable row: rank, name, match, bar in the party's colour, chevron. */
.rankrow { width: 100%; display: grid; grid-template-columns: 22px 1fr 18px; gap: 10px; align-items: center; text-align: left;
  background: none; border: none; border-radius: 10px; padding: 11px 2px 11px; min-height: 0; font-weight: inherit; }
@media (hover: hover) { .rankrow:hover { background: var(--page); } }
.rankrow .pos { font-family: var(--display); font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.rankrow .main { display: block; min-width: 0; }
.rankrow .row { display: flex; align-items: center; gap: 10px; }
.rankrow .name { flex: 1; font-weight: 600; font-size: 16px; line-height: 1.3; }
.rankrow .pct { font-family: var(--display); font-weight: 800; font-size: 18px; line-height: 1.2; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; flex: none; }
.rankrow .barwrap { display: block; height: 6px; background: var(--line); border-radius: 3px; margin-top: 7px; overflow: hidden; }
.rankrow .barwrap > span { display: block; height: 100%; background: var(--pc); border-radius: 3px; }
.rankrow .go { color: var(--muted); display: inline-flex; }
.rank li.nomatch .pct { color: var(--muted); font-size: 14px; font-weight: 500; font-family: var(--body); }

/* On a phone the four result cards run in one column in reading order; from 960px they sit in two columns. */
.results-grid { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; overflow-anchor: none; }
.results-grid .col { display: contents; }
.results-grid .card { margin: 0; }
.area-rank { order: 1; } .area-dials { order: 2; } .area-map { order: 3; } .area-share { order: 4; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.chip { font: inherit; font-size: 14px; font-weight: 500; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--paper); color: var(--ink); min-height: 40px; gap: 7px; }
.chip.sel { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.legend { display: flex; gap: 18px; font-size: 14px; color: var(--muted); margin: 4px 0 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; margin-right: 7px; }
.legend i.you { background: var(--violet); }
.legend i.party { background: var(--pc); }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.radar { margin: 6px 0 10px; }
svg text { font-family: var(--body); fill: var(--ink); }
svg text.muted { fill: var(--muted); }
svg text.maplabel { paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }
.dial { margin: 12px 0 16px; }
.dial .axis-name { font-family: var(--display); font-weight: 700; font-size: 16px; }
.dial .ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); gap: 8px; }
.dial .track { position: relative; height: 28px; }
.dial .track::before { content: ""; position: absolute; left: 0; right: 0; top: 13px; height: 4px; background: var(--line); border-radius: 2px; }
.dial .track::after { content: ""; position: absolute; left: 50%; top: 7px; width: 2px; height: 16px; background: var(--line-strong); z-index: 0; }
.dial .mark { position: absolute; top: 5px; width: 20px; height: 20px; border-radius: 50%; margin-left: -10px; z-index: 1; }
.dial .mark.you { background: var(--violet); box-shadow: 0 0 0 3px var(--paper); z-index: 2; }
.dial .mark.party { border: 3px solid var(--pc); background: var(--paper); width: 22px; height: 22px; top: 4px; margin-left: -11px; }
.dial .nodata { font-size: 13px; color: var(--muted); }
.map-controls { margin-bottom: 4px; }
.map-controls .chips { margin-top: 6px; }
.share-note { font-size: 14px; color: var(--muted); margin-top: 12px; }
.links { margin: 14px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; color: var(--muted); }
.links .btn-link { font-size: 14px; padding: 6px 2px; min-height: 36px; }
.links .dot { color: var(--line-strong); }

/* Compare */
.cmp-item { padding: 14px 0; border-top: 1px solid var(--line); }
.cmp-item:first-of-type { border-top: none; }
.cmp-item .stmt { font-family: var(--display); font-weight: 700; font-size: 18px; line-height: 1.25; margin-bottom: 8px; letter-spacing: -0.01em; }
.cmp-item .vs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.pill { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--line); color: var(--ink-2); }
.pill.agree { background: var(--agree-tint); color: var(--agree); }
.pill.neutral { background: var(--neutral-tint); color: var(--neutral); }
.pill.disagree { background: var(--disagree-tint); color: var(--disagree); }
.pill.skip, .pill.none { background: var(--line); color: var(--muted); font-weight: 500; }
.cmp-item .just { font-size: 15px; color: var(--ink-2); margin: 0 0 4px; }
.cmp-item .src { font-size: 13px; color: var(--muted); }
.sticky-top { position: sticky; top: 0; background: var(--page); padding: 6px 0; z-index: 2; }
.sticky-top .btn-link { margin-left: -8px; }
.ok { color: var(--agree); font-weight: 600; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Phones: the first two screens fill the view with their buttons at the bottom; the answer buttons stay on screen. */
@media (max-width: 599px) {
  .fill { display: flex; flex-direction: column; min-height: calc(100vh - 140px); min-height: calc(100dvh - 140px); }
  .fill .actions, .hero.fill .btn-row { margin-top: auto; padding-top: 28px; }
  .answer-block { box-shadow: 0 -10px 16px -14px rgba(21,20,28,.35); }
  .menu-btn { display: inline-flex; }
  .site-nav.open { display: flex; flex-direction: column; position: absolute; right: 16px; top: calc(100% - 2px); min-width: 200px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 12px 30px -12px rgba(21,20,28,.35); z-index: 20; }
}

/* Larger screens */
@media (min-width: 600px) {
  .site-header { padding: 22px 24px 8px; }
  .site-nav { display: flex; gap: 2px; margin-right: 6px; }
  .menu-btn { display: none; }
  .app { padding: 8px 24px 56px; }
  .card { padding: 26px 26px; }
  .q { padding: 32px 30px 26px; }
  .answer-block { position: static; margin: 0; padding: 0; }
  .hero { padding: 48px 44px 40px; }
  .party-grid { grid-template-columns: repeat(4, 1fr); }
  .answers button { min-height: 64px; font-size: 17px; }
  .actions { flex-direction: row; justify-content: flex-end; align-items: center; gap: 14px; }
  .actions .btn-primary { width: auto; min-width: 220px; }
  .actions .btn-link { align-self: auto; }
  .top-match .top-share > * { flex: 0 1 auto; min-width: 200px; }
}
@media (min-width: 960px) {
  .app.results { max-width: 1040px; }
  .results-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 6fr); gap: 0 14px; align-items: start; }
  .results-grid .col { display: block; }
  .results-grid .col > .card { margin: 0 0 14px; }
}
@media (prefers-reduced-motion: reduce) { .bar > div, button, .btn { transition: none; } }
