/* Philosopher King — editorial, paper-toned, one accent. Light mode only for the MVP. */

:root {
  color-scheme: light;
  --paper: #f7f3ec;
  --paper-2: #efe9dd;
  --paper-3: #e6dfd1;
  --ink: #1c1b18;
  --ink-2: #4f4b43;
  --ink-3: #847e72;
  --rule: #ddd5c6;
  --rule-2: #cbc2b0;
  --accent: #1f4f7a;        /* meter fill, links, primary button */
  --accent-ink: #163a5a;
  --accent-track: #d4dde6;  /* lighter step of the same ramp */
  --good: #2e7d32;  --good-bg: #e3eee3;
  --warn: #b7791f;  --warn-bg: #f4eadb;
  --bad:  #b3261e;  --bad-bg:  #f3dedb;
  --good-ink: #1f5f24; --warn-ink: #8a5a12;  /* for words on the green wash and the tinted pills, where --good and --warn fall under 4.5:1 */
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --rail-w: 340px;
  --maxw: 1240px;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--paper-2); padding: 1px 5px; border-radius: 4px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink-3); }
[hidden] { display: none !important; }

.eyebrow {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 8px;
  font-weight: 500;
}

/* ---------- masthead ---------- */
.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); }
.masthead-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 16px 28px;
  display: flex; align-items: baseline; gap: 20px;
}
.wordmark {
  font-family: var(--serif); font-weight: 600; font-size: 26px; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none; font-variation-settings: "opsz" 36;
}
.masthead-inner .wordmark { margin-right: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: min(420px, 100%); min-width: 0;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: 999px;
  padding: 6px 12px 6px 10px; cursor: pointer; font-size: 13px; color: var(--ink-2);
}
.chip:hover { border-color: var(--rule-2); background: var(--paper-3); }
.chip-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); flex: none; }
#profile-chip-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ---------- the reading bar: how certain the profile is, and what has fed it ---------- */
.reading {
  position: sticky; top: 0; z-index: 30;
  display: block; width: 100%; border: 0; border-bottom: 1px solid var(--rule); background: var(--paper-2);
  padding: 0; cursor: pointer; text-align: left; color: var(--ink-2);
}
.reading:hover { background: var(--paper-3); }
.reading:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.reading-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 8px 28px;
  display: flex; align-items: center; gap: 14px; font-size: 12.5px; min-width: 0;
}
.reading-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; flex: none; }
.reading-track { flex: 0 1 220px; min-width: 90px; height: 6px; background: var(--paper-3); border: 1px solid var(--rule-2); border-radius: 3px; overflow: hidden; }
.reading-fill { display: block; height: 100%; background: var(--ink); width: 0; transition: width 600ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.reading-figure { flex: none; white-space: nowrap; color: var(--ink-2); }
.reading-figure strong { font-family: var(--mono); font-weight: 500; color: var(--ink); font-size: 13px; }
.reading-stage { flex: none; font-family: var(--serif); font-style: italic; font-size: 14.5px; color: var(--ink); white-space: nowrap; }
.reading-counts, .reading-today, .reading-next { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.reading-today:not(:empty)::before, .reading-next:not(:empty)::before { content: "·"; margin-right: 14px; color: var(--rule-2); }
.reading-cta { margin-left: auto; flex: none; color: var(--accent); font-weight: 500; white-space: nowrap; }
.reading.is-bumped .reading-fill { background: var(--accent); }
.reading-next { flex: none; }
/* Between tablet and wide desktop the row is tight: drop the label, then the "today" figure, before anything gets clipped. */
@media (max-width: 1240px) { .reading-track { flex-basis: 160px; } .reading-today { display: none; } }
@media (max-width: 1120px) { .reading-label { display: none; } .reading-inner { gap: 12px; } }

/* the same figure inside the profile panel */
.certainty { margin: 0 0 20px; padding: 14px 16px; background: #fff; border: 1px solid var(--rule); border-radius: 8px; }
.certainty-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.certainty-head .eyebrow { margin: 0; }
.certainty-stage { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--ink); }
.certainty-track { position: relative; height: 10px; margin: 10px 0 8px; background: var(--paper-3); border: 1px solid var(--rule-2); border-radius: 5px; overflow: hidden; }
.certainty-fill { display: block; height: 100%; background: var(--ink); width: 0; transition: width 600ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.certainty-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--paper); opacity: 0.9; }
.certainty-meta { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.certainty-meta strong { font-family: var(--mono); font-weight: 500; font-size: 14px; }
.certainty-next { color: var(--accent-ink); }

.notice {
  max-width: var(--maxw); margin: 14px auto 0; padding: 10px 14px; border-radius: var(--radius);
  background: var(--paper-2); border: 1px solid var(--rule); color: var(--ink-2); font-size: 13.5px;
}
.notice-warn { background: var(--warn-bg); border-color: #e4cfa6; }

/* ---------- layout ---------- */
.site {
  max-width: 960px; margin: 0 auto; padding: 0 28px 64px;
  display: grid; grid-template-columns: minmax(0, 1fr);
}
.rail { padding-top: 28px; border-right: 1px solid var(--rule); padding-right: 28px; }
.rail-title { font-family: var(--serif); font-weight: 600; font-size: 20px; margin: 0 0 4px; }
.rail-note { margin: 0 0 16px; color: var(--ink-3); font-size: 13px; }
.rail-foot { margin-top: 18px; }

.policy-group { margin-bottom: 18px; }
.policy-group-title {
  font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
  margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); font-weight: 500;
}
.policy-card {
  display: block; width: 100%; text-align: left; background: transparent; border: 1px solid transparent;
  border-radius: var(--radius); padding: 10px 10px; margin: 0 -10px 4px; cursor: pointer;
}
.policy-card:hover { background: var(--paper-2); }
.policy-card.is-active { background: #fff; border-color: var(--rule); box-shadow: 0 1px 0 rgba(28,27,24,0.04); }
.policy-card-title { font-family: var(--serif); font-size: 17px; font-weight: 500; line-height: 1.3; margin: 0 0 3px; letter-spacing: -0.005em; }
.policy-card-summary { margin: 0 0 6px; color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.policy-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.policy-card-meta .mono { font-size: 11.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag { border: 1px solid var(--rule); border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--ink-3); background: var(--paper); }
.tag-custom { border-style: dashed; }

/* ---------- traffic light: color + word + glyph, never color alone ---------- */
.light { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; letter-spacing: 0.06em; }
.light-glyph { width: 10px; height: 10px; display: inline-block; }
.light-green .light-glyph { background: var(--good); border-radius: 50%; }
.light-yellow .light-glyph { background: var(--warn); transform: rotate(45deg); width: 9px; height: 9px; }
.light-red .light-glyph { background: var(--bad); border-radius: 1px; }
.light-green { color: var(--good-ink); }
.light-yellow { color: var(--warn-ink); }
.light-red { color: var(--bad); }
.light-pill { padding: 2px 9px 2px 7px; border-radius: 999px; }
.light-green.light-pill { background: var(--good-bg); }
.light-yellow.light-pill { background: var(--warn-bg); }
.light-red.light-pill { background: var(--bad-bg); }

/* ---------- ballot ---------- */
.rail-ballot { display: block; text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 22px; }
.rail-ballot:hover { border-color: var(--rule-2); }
.rail-ballot.is-active { border-color: var(--ink); }
.rail-ballot-title { display: block; font-family: var(--serif); font-size: 19px; font-weight: 600; }
.rail-ballot-sub { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.ballot-title { font-family: var(--serif); font-weight: 500; font-size: 40px; line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 10px; font-variation-settings: "opsz" 72; }
.ballot-note { font-size: 13.5px; margin: 0 0 22px; max-width: 720px; }
.ballot-pending { display: flex; align-items: center; gap: 8px; max-width: 780px; margin: 0 0 18px; padding: 10px 14px; background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius); font-size: 13.5px; color: var(--ink-2); }
.race { margin: 0 0 30px; max-width: 860px; }
.race-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--rule); margin-bottom: 12px; }
.race-office { font-family: var(--serif); font-size: 22px; font-weight: 500; margin: 0; }
.race-level { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.race-note { font-size: 13px; color: var(--ink-3); margin: -4px 0 12px; }
.race-pick { margin: 2px 0 10px; color: var(--ink-2); }
.race-pick strong { color: var(--ink); }
.cand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.cand-card { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: start; text-align: left; background: #fff; border: 1px solid var(--rule); border-radius: 8px; padding: 14px; cursor: pointer; color: var(--ink); }
.cand-card:hover { border-color: var(--ink-3); }
.cand-card > span:last-child { min-width: 0; }
/* The pick in a race: a green wash and rule whose depth follows the confidence (--pick, 0 to 1). */
.cand-card.is-pick { --pick: 0.5; background: color-mix(in oklab, var(--good) calc(var(--pick) * 26%), #fff); border-color: color-mix(in oklab, var(--good) calc(30% + var(--pick) * 60%), var(--rule)); box-shadow: inset 4px 0 0 color-mix(in oklab, var(--good) calc(35% + var(--pick) * 65%), transparent); }
.cand-card.is-pick:hover { border-color: var(--good); }
.tag-pick { background: color-mix(in oklab, var(--good) 14%, #fff); color: var(--good-ink); border: 1px solid color-mix(in oklab, var(--good) 45%, transparent); font-family: var(--mono); letter-spacing: 0.04em; vertical-align: 2px; white-space: nowrap; display: inline-block; margin-top: 2px; }
.cand-pick { --pick: 0.5; margin: 22px 0 -12px; padding: 14px 16px; max-width: 780px; font-size: 14px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; border-radius: 8px; border: 1px solid var(--rule); background: #fff; }
.cand-pick.is-mine { background: color-mix(in oklab, var(--good) calc(var(--pick) * 26%), #fff); border-color: color-mix(in oklab, var(--good) calc(30% + var(--pick) * 60%), var(--rule)); box-shadow: inset 4px 0 0 color-mix(in oklab, var(--good) calc(35% + var(--pick) * 65%), transparent); }
.cand-pick strong { font-family: var(--serif); font-weight: 500; font-size: 16px; color: var(--ink); }
.cand-pick b { color: var(--good-ink); font-weight: 600; }
.cand-photo { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--paper-3); display: grid; place-items: center; font-family: var(--serif); font-size: 22px; color: var(--ink-2); flex: none; }
.cand-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cand-photo-lg { width: 112px; height: 112px; font-size: 36px; }
.cand-card-name { font-family: var(--serif); font-size: 18px; font-weight: 500; margin: 0 0 2px; line-height: 1.2; overflow-wrap: anywhere; }
.cand-card-party { font-size: 13px; color: var(--ink-2); margin: 0 0 8px; }
.tag-inc { border-color: var(--ink-3); color: var(--ink-2); }
.fit-dots { display: inline-flex; gap: 4px; align-items: center; }
.fit-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--paper-3); border: 1px solid var(--rule-2); }
.fit-dot.light-green { background: var(--good); border-color: var(--good); }
.fit-dot.light-yellow { background: var(--warn); border-color: var(--warn); }
.fit-dot.light-red { background: var(--bad); border-color: var(--bad); }
.fit-text { font-size: 12px; color: var(--ink-3); margin-left: 8px; }
.cand-card.is-pick .fit-text { color: var(--ink-2); } /* --ink-3 falls under 3:1 on the deepest wash */
.crumb { display: inline-block; font-size: 13px; color: var(--ink-3); text-decoration: none; margin-bottom: 14px; }
.crumb:hover { color: var(--ink); }
.cand-head { display: grid; grid-template-columns: 112px 1fr; gap: 22px; align-items: start; max-width: 780px; }
.cand-head h1 { font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1.1; letter-spacing: -0.015em; margin: 0 0 4px; }
.cand-party { font-size: 14px; color: var(--ink-2); margin: 0 0 10px; }
.cand-bio { font-family: var(--serif); font-size: 17px; line-height: 1.4; margin: 0 0 8px; }
.cand-links { font-size: 13.5px; margin: 0; }
.cand-links a { margin-right: 14px; }
.cand-fit { margin: 22px 0 26px; padding: 14px 16px; background: #fff; border: 1px solid var(--rule); border-radius: 8px; max-width: 780px; font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cand-fit .meter { width: 160px; }
.cand-policies { list-style: none; counter-reset: pol; padding: 0; margin: 0 0 18px; max-width: 780px; }
.cand-policy { counter-increment: pol; display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start; width: 100%; text-align: left; background: transparent; border: 0; border-top: 1px solid var(--rule); padding: 14px 4px; cursor: pointer; color: var(--ink); }
.cand-policy:last-child { border-bottom: 1px solid var(--rule); }
.cand-policy:hover { background: var(--paper-2); }
.cand-policy::before { content: counter(pol); font-family: var(--serif); font-size: 20px; color: var(--ink-3); line-height: 1.2; }
.cand-policy-title { font-family: var(--serif); font-size: 19px; font-weight: 500; margin: 0 0 3px; line-height: 1.25; }
.cand-policy-sentence { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.cand-policy-status { font-size: 12px; color: var(--ink-3); white-space: nowrap; padding-top: 4px; }
.small { font-size: 12.5px; }
.policy-note { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; }
.measure { max-width: 780px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; font-size: 14px; }
.measure strong { font-family: var(--serif); font-size: 16px; }

/* ---------- stage ---------- */
.stage { padding-top: 28px; min-width: 0; }
.empty { max-width: 640px; padding-top: 40px; }
.empty h1 { font-family: var(--serif); font-weight: 500; font-size: 44px; line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 28px; font-variation-settings: "opsz" 72; }
.steps { padding-left: 22px; margin: 0; color: var(--ink-2); font-size: 15.5px; }
.steps li { margin-bottom: 12px; }
.steps strong { color: var(--ink); }

.policy-head { max-width: 780px; }
.policy-head h1 { font-family: var(--serif); font-weight: 500; font-size: 36px; line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 10px; font-variation-settings: "opsz" 60; }
.lede { font-family: var(--serif); font-size: 19px; line-height: 1.4; color: var(--ink-2); margin: 0 0 20px; }
.facts { display: grid; grid-template-columns: 1fr; gap: 10px 0; margin: 0 0 22px; padding: 14px 0 6px; border-top: 1px solid var(--rule); }
.facts > div { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.facts dt { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; padding-top: 3px; }
.facts dd { margin: 0; font-size: 14.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.facts dd ul { margin: 0; padding-left: 16px; }
.facts dd li { margin-bottom: 2px; }
.facts dd a { word-break: break-word; }
.facts dd.is-clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.facts .more { display: inline-block; margin-top: 4px; font-size: 12.5px; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; }

.runbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.runbar-spacer { flex: 1; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 15px; height: 15px; }
.select-label { font-size: 13.5px; color: var(--ink-2); display: inline-flex; gap: 8px; align-items: center; }
select, textarea, input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input:not([type]) {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 7px 10px;
}
select { padding-right: 28px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.btn {
  border: 1px solid var(--rule-2); background: #fff; border-radius: var(--radius); padding: 8px 14px;
  cursor: pointer; font-size: 13.5px; font-weight: 500; line-height: 1.2; color: var(--ink);
}
.btn:hover { background: var(--paper-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover { background: #000; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--paper-2); }
.btn-block { width: 100%; }
.btn-small { padding: 4px 10px; font-size: 12.5px; }

/* ---------- run status ---------- */
.run-status { margin: 18px 0 8px; max-width: 780px; }
.status-line { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 0.25; transform: scale(0.8);} 50% { opacity: 1; transform: scale(1);} }
.run-status.is-done .pulse { animation: none; background: var(--good); }
.thinking { margin-top: 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); }
.thinking summary { cursor: pointer; padding: 8px 12px; font-size: 13px; color: var(--ink-2); }
.thinking pre { margin: 0; padding: 0 12px 12px; white-space: pre-wrap; font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--ink-2); max-height: 260px; overflow: auto; }

.error { margin: 16px 0; padding: 12px 14px; border: 1px solid #e0b4af; background: var(--bad-bg); border-radius: var(--radius); color: #7a1a14; font-size: 14px; max-width: 780px; }

/* ---------- verdict band ---------- */
.verdict {
  display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start;
  margin: 26px 0 10px; padding: 22px 24px; background: #fff; border: 1px solid var(--rule); border-radius: 8px; max-width: 780px;
}
.verdict-hero { border-right: 1px solid var(--rule); padding-right: 20px; }
.hero-number { font-family: var(--sans); font-weight: 600; font-size: 56px; line-height: 1; letter-spacing: -0.03em; color: var(--ink); }
.hero-unit { font-size: 18px; font-weight: 500; letter-spacing: 0; color: var(--ink-2); margin-left: 4px; }
.hero-against { margin-top: 6px; color: var(--ink-3); font-size: 14px; }
.verdict-body .light { margin-bottom: 10px; font-size: 13px; }
.verdict-summary { font-family: var(--serif); font-size: 17.5px; line-height: 1.45; color: var(--ink); }
.verdict-summary p { margin: 0 0 8px; }

/* ---------- overview rows ---------- */
.overview { margin: 18px 0 8px; max-width: 780px; padding: 18px 0 8px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.overview-rows { display: grid; gap: 7px; }
.overview-row {
  display: grid; grid-template-columns: 150px 1fr 150px 118px; align-items: center; gap: 14px;
  background: transparent; border: 0; padding: 3px 0; text-align: left; cursor: pointer; width: 100%; border-radius: 4px;
}
.overview-row:hover { background: var(--paper-2); }
.ov-name { font-family: var(--serif); font-size: 15.5px; }
.ov-weight { display: block; height: 10px; background: transparent; position: relative; }
.ov-weight-fill { display: block; height: 10px; background: var(--ink); border-radius: 0 3px 3px 0; min-width: 2px; }
.ov-numbers { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.overview-key { font-size: 12.5px; margin: 12px 0 0; }

/* meter: fill = share for, track = lighter step of same ramp */
.meter { display: inline-block; width: 100%; height: 8px; background: var(--accent-track); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.meter-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px 0 0 4px; }

/* ---------- the evaluation (prose) ---------- */
.prose { max-width: 720px; font-family: var(--serif); font-size: 18px; line-height: 1.55; color: var(--ink); margin-top: 18px; }
.prose > h2 { font-size: 30px; font-weight: 500; line-height: 1.15; letter-spacing: -0.015em; margin: 32px 0 12px; }
.prose > h3 { font-size: 22px; font-weight: 500; line-height: 1.25; margin: 40px 0 10px; padding-top: 18px; border-top: 1px solid var(--rule); }
.prose > h4 { font-family: var(--sans); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin: 22px 0 6px; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--ink-3); }
.prose strong { font-weight: 600; }
.prose a { overflow-wrap: anywhere; }
.prose blockquote { margin: 14px 0; padding: 0 0 0 16px; border-left: 2px solid var(--rule-2); color: var(--ink-2); font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 28px 0; }
.prose table { border-collapse: collapse; font-family: var(--sans); font-size: 14px; }
.prose td, .prose th { border-bottom: 1px solid var(--rule); padding: 6px 10px; text-align: left; }
/* a quote line: “…” — Thinker, Work */
.prose p.quote { font-style: italic; font-size: 19.5px; line-height: 1.45; color: var(--ink); padding-left: 16px; border-left: 2px solid var(--rule-2); }
.prose p.quote .attrib { font-style: normal; font-family: var(--sans); font-size: 13px; color: var(--ink-3); display: block; margin-top: 4px; }

/* section headings with injected meters */
.prose h3.fw-heading { display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; align-items: baseline; }
.prose h3.fw-heading .fw-name { grid-column: 1; }
.prose h3.fw-heading .fw-stats { grid-column: 2; display: inline-flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: 12.5px; color: var(--ink-3); font-weight: 500; white-space: nowrap; }
.prose h3.fw-heading .fw-stats .meter { width: 120px; }
.prose h3.fw-heading .fw-weight { color: var(--ink); background: var(--paper-2); border-radius: 999px; padding: 2px 8px; }
.prose h3.fw-lead .fw-name::after { content: "Highest weight"; font-family: var(--sans); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-left: 12px; font-weight: 600; vertical-align: middle; }

.followups { max-width: 780px; margin: 30px 0 0; padding-top: 18px; border-top: 1px solid var(--rule); }
.followup-list { display: grid; gap: 14px; margin-bottom: 14px; }
.followup { background: #fff; border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px; }
.followup-q { font-family: var(--sans); font-weight: 600; font-size: 14px; margin: 0 0 8px; color: var(--ink-2); }
.followup-a { font-family: var(--serif); font-size: 17px; line-height: 1.5; }
.followup-a p { margin: 0 0 10px; } .followup-a ul, .followup-a ol { margin: 0 0 10px; padding-left: 22px; }
.followup-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.followup-form textarea { width: 100%; font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid var(--rule-2); border-radius: var(--radius); background: #fff; resize: vertical; }
.fw-expand { font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); background: none; border: 1px solid var(--accent-track); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.fw-expand:hover { background: var(--paper-2); }
.fw-expand[disabled] { opacity: 0.6; cursor: default; }
.run-footer { margin: 36px 0 0; padding-top: 14px; border-top: 1px solid var(--rule); max-width: 780px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.run-meta { color: var(--ink-3); }
.run-actions { display: flex; gap: 8px; }

.preparing-card { text-align: center; padding: 34px 28px 30px; max-width: 440px; }
.pulse-lg { display: inline-block; width: 14px; height: 14px; margin-bottom: 14px; }
.preparing-text { font-family: var(--serif); font-size: 20px; margin: 0; color: var(--ink); }

/* ---------- political profile ---------- */
.profile-card { max-width: 720px; }
.spectra { display: grid; gap: 18px; margin: 6px 0 14px; }
.spectrum-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-family: var(--serif); font-size: 17px; }
.spectrum-head .pole { font-weight: 500; }
.spectrum-head .pole.is-near { color: var(--accent-ink); }
.spectrum-desc { font-size: 12.5px; color: var(--ink-3); margin: 2px 0 8px; }
.spectrum-track { position: relative; height: 10px; background: var(--accent-track); border-radius: 5px; }
.spectrum-band { position: absolute; top: 0; height: 100%; background: rgba(31, 79, 122, 0.18); border-radius: 5px; }
.spectrum-marker { position: absolute; top: -4px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--accent); }
.spectrum-marker.is-faint { opacity: 0.55; }
.spectrum-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.spectrum-note { font-size: 14px; color: var(--ink-2); margin: 6px 0 0; }
.profile-summary { font-family: var(--serif); font-size: 16.5px; line-height: 1.45; margin: 0; }

/* ---------- modal ---------- */
/* One cell the size of the viewport: the card can never outgrow it, and a card taller than the screen scrolls inside itself. */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 100%; place-items: center; padding: 20px; background: rgba(28,27,24,0.45); backdrop-filter: blur(2px); }
.modal-card { width: 100%; min-width: 0; max-width: 560px; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; background: var(--paper); border-radius: 10px; padding: 24px 28px 22px; box-shadow: 0 24px 60px rgba(0,0,0,0.25); border: 1px solid var(--rule); }
/* The page behind an open modal holds still (app.js already makes it inert; this keeps wheel and touch from scrolling it). */
body:has(.modal:not([hidden])) { overflow: hidden; }
.modal-wide { max-width: 680px; }
.modal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.progress { height: 3px; background: var(--paper-3); border-radius: 2px; overflow: hidden; margin-bottom: 22px; }
.progress-fill { height: 100%; background: var(--ink); width: 0; transition: width 240ms ease; }
.progress-text { color: var(--ink-3); }
.survey-q { font-family: var(--serif); font-weight: 500; font-size: 28px; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 8px; }
.survey-help { margin: 0 0 18px; color: var(--ink-3); font-size: 14px; }
.survey-body { min-height: 72px; }
.survey-body input[type=text], .survey-body input:not([type]) { width: 100%; font-size: 17px; padding: 10px 12px; }
.survey-body select { width: 100%; font-size: 16px; padding: 10px 12px; }
.chips { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 8px; }
.chips.cols-3 { --cols: 3; }
.chips.cols-6 { --cols: 6; }
.chipbtn {
  border: 1px solid var(--rule-2); background: #fff; border-radius: var(--radius); padding: 10px 12px; cursor: pointer;
  font-size: 14.5px; text-align: left; line-height: 1.25;
}
.chips.cols-6 .chipbtn { text-align: center; padding: 10px 4px; font-size: 13.5px; }
.chipbtn:hover { border-color: var(--ink-3); }
.chipbtn.is-selected { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.terms, .form .terms { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; color: var(--ink-2); line-height: 1.5; } /* the second selector outranks .form label's display: block */
.terms input[type=checkbox] { display: inline-block; margin: 4px 0 0; width: 18px; height: 18px; accent-color: var(--ink); flex: none; } /* outranks .form input, which would stretch the box to a full-width block */
.modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.modal-hint { font-size: 12.5px; }
.modal-hint:empty { display: none; }

.custom-name { width: 100%; font-size: 17px; padding: 10px 12px; }
.form label { display: block; font-size: 12.5px; color: var(--ink-3); margin-bottom: 12px; }
.form input, .form textarea, .form select { display: block; width: 100%; margin-top: 4px; font-size: 14.5px; }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.form-error { color: var(--bad); font-size: 13.5px; margin: 4px 0 0; }
#signout-btn, #save-account-btn { margin-left: 10px; }
#guest-btn, #quick-btn { margin-right: 8px; }
.quick-box { margin: 0 0 16px; padding: 12px 14px; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); }
.quick-box .eyebrow { margin-bottom: 4px; }
.quick-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 8px; }
.custom-name { width: 100%; font-size: 16px; padding: 9px 12px; }
.quick-box-ballot { max-width: 780px; margin: 0 0 22px; }
.quick-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick-item { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; text-align: left; border: 1px solid var(--rule); background: var(--paper); border-radius: 999px; padding: 4px 12px; font-size: 13.5px; cursor: pointer; color: var(--ink); }
.quick-item:hover { border-color: var(--ink-3); }

/* ---------- prompt drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 92vw); z-index: 50; background: var(--paper);
  border-left: 1px solid var(--rule); box-shadow: -20px 0 50px rgba(0,0,0,0.18); display: flex; flex-direction: column;
}
.scrim { position: fixed; inset: 0; z-index: 45; background: rgba(28,27,24,0.3); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 22px 12px; border-bottom: 1px solid var(--rule); }
.drawer-head .eyebrow { margin-bottom: 4px; }
.drawer-body { overflow: auto; padding: 8px 22px 30px; }
.drawer-body section { margin-top: 18px; }
.drawer-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.drawer-section-head h3 { margin: 0; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.prompt-pre { margin: 0; padding: 14px; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--ink-2); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .site { grid-template-columns: 1fr; gap: 20px; padding: 0 16px 48px; }
  .rail { border-right: 0; padding-right: 0; border-top: 1px solid var(--rule); padding-top: 20px; order: 2; }
  .stage { order: 1; padding-top: 20px; }
  .masthead-inner { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
  .chip { flex: 1 1 100%; max-width: 100%; }
  .reading-inner { padding: 7px 16px 8px; flex-wrap: wrap; gap: 6px 10px; }
  .reading-label, .reading-counts, .reading-today, .reading-next { display: none; }
  .reading-track { flex: 1 1 100%; order: 10; }
  .reading-stage { font-size: 13.5px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .reading-cta { margin-left: auto; font-size: 12px; }
  .verdict { grid-template-columns: 1fr; }
  .verdict-hero { border-right: 0; border-bottom: 1px solid var(--rule); padding: 0 0 14px; }
  .overview-row { grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 90px; }
  .ov-name { font-size: 14px; overflow-wrap: anywhere; }
  .overview-row .ov-numbers { display: none; }
  .prose h3.fw-heading { grid-template-columns: minmax(0, 1fr); }
  .prose h3.fw-heading .fw-stats { grid-column: 1; white-space: normal; flex-wrap: wrap; row-gap: 6px; }
  .prose h3.fw-heading .fw-stats > * { white-space: nowrap; }
  .prose h3.fw-heading .fw-stats .meter { flex: 1 1 100px; width: auto; }
  .notice { margin: 12px 16px 0; }
  .empty h1 { font-size: 34px; }
  .ballot-title { font-size: 32px; }
  .cand-head { grid-template-columns: 80px 1fr; gap: 14px; }
  .cand-photo-lg { width: 80px; height: 80px; }
  .cand-policy { grid-template-columns: 28px 1fr; }
  .cand-policy-status { grid-column: 2; }
  .policy-head h1 { font-size: 30px; }
  .facts > div { grid-template-columns: 1fr; gap: 4px; }
  .form-row { grid-template-columns: 1fr; }
  .chips.cols-6 { --cols: 3; }
}
@media (max-width: 600px) {
  .modal { padding: 12px; }
  .modal-card { padding: 20px 18px 18px; }
  .survey-q { font-size: 24px; }
  .cand-grid { grid-template-columns: minmax(0, 1fr); }
  /* the survey's action row on a phone: the buttons share the width and wrap, the hint takes its own line */
  #survey .modal-actions .btn { flex: 1 1 auto; }
  #survey .modal-hint { flex: 1 1 100%; order: 10; text-align: center; }
}
/* ---------- forced colors (Windows high contrast): author backgrounds are dropped there, so every meter, fill and the pick get system-color fills or borders ---------- */
@media (forced-colors: active) {
  .meter, .reading-track, .certainty-track, .progress, .spectrum-track { border: 1px solid CanvasText; }
  .progress { height: 6px; }
  .meter-fill, .reading-fill, .certainty-fill, .ov-weight-fill, .progress-fill { background: CanvasText; }
  .certainty-tick { background: Canvas; }
  .spectrum-band { background: Highlight; opacity: 0.4; }
  .spectrum-marker { background: Highlight; border: 2px solid CanvasText; }
  .fit-dot, .light-glyph { forced-color-adjust: none; outline: 1px solid CanvasText; }
  .cand-card.is-pick, .cand-pick.is-mine { border-left: 6px solid CanvasText; }
  .chipbtn.is-selected, .policy-card.is-active { outline: 3px solid Highlight; outline-offset: -3px; }
  .btn-primary { border: 2px solid ButtonText; }
}
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } .progress-fill { transition: none; } }
