/* ============================================================
   POLLBOOK — design system
   Direction: 1970s U.S. Federal Graphics Standards Manual.
   Flat civic blue + signage yellow on cool paper, heavy rule
   bars, zero radius everywhere except the ballot oval — the
   fill-in bubble is the one curved object in the system.
   Type: Archivo (display) / Public Sans (body) / IBM Plex Mono (data)
   ============================================================ */

:root {
  --paper: #EFF0EB;
  --ink: #15181B;
  --blue: #2038C8;
  --blue-deep: #17289B;
  --yellow: #F2B807;
  --concrete: #C7CBC1;
  --white: #FDFDFB;

  --font-display: "Archivo", sans-serif;
  --font-body: "Public Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --rule: 3px solid var(--ink);
  --rule-thin: 1.5px solid var(--ink);
  --gutter: clamp(1rem, 4vw, 3rem);
  --maxw: 1160px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  touch-action: manipulation; /* kill double-tap-to-zoom; pinch is disabled via viewport meta */
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* Reset native button chrome — iOS/Android otherwise render an unstyled
   <button> (e.g. a submit button with no other rules) as a system-blue
   pill instead of picking up this design. Selects keep their native
   appearance for the dropdown affordance. */
button {
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
  background: none;
  border: none;
  cursor: pointer;
}

::selection { background: var(--yellow); color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* ---------- the ballot oval (signature element) ---------- */

.oval, .nav-oval, .wordmark-oval, .footer-oval, .track-oval {
  display: inline-block;
  width: 1.35em;
  height: 0.8em;
  border: 2.5px solid currentColor;
  border-radius: 50%;
  vertical-align: -0.08em;
  flex-shrink: 0;
  transition: background-color 0.18s ease;
}

.oval--filled { background: currentColor; }

/* ---------- masthead ---------- */

.masthead {
  background: var(--blue);
  color: var(--white);
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: 0.85rem var(--gutter);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 50;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 118%;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.wordmark-oval { color: var(--yellow); background: var(--yellow); border-color: var(--yellow); }

.nav {
  display: flex;
  gap: clamp(0.75rem, 2vw, 1.75rem);
  flex-wrap: wrap;
}

.nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.4rem 0;
  opacity: 0.85;
}

.nav a:hover { opacity: 1; }
.nav a:hover .nav-oval { background: rgba(255, 255, 255, 0.35); }

.nav a.active { opacity: 1; }
.nav a.active .nav-oval { background: var(--yellow); border-color: var(--yellow); }

.masthead-area {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.masthead-area-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.8;
}

#area-select {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--white);
  color: var(--ink);
  border: none;
  border-radius: 0;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}

/* tri-color rule bar under the masthead */
.rulebar { display: flex; height: 8px; }
.rulebar span:nth-child(1) { flex: 3; background: var(--blue-deep); }
.rulebar span:nth-child(2) { flex: 1; background: var(--yellow); }
.rulebar span:nth-child(3) { flex: 6; background: var(--ink); }

/* ---------- layout ---------- */

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) var(--gutter) 4rem;
  min-height: 60vh;
}

/* ---------- hero (home) ---------- */

.hero {
  border: var(--rule);
  background: var(--white);
  margin-bottom: 2.5rem;
}

.hero-strip {
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.45rem 1.25rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-body { padding: clamp(1.5rem, 4vw, 2.75rem) clamp(1.25rem, 3vw, 2.5rem); }

.hero h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 112%;
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  max-width: 18ch;
}

.hero h1 .accent { color: var(--blue); }

.hero p.lede {
  margin-top: 1.1rem;
  font-size: 1.05rem;
  max-width: 52ch;
}

.hero-count {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.4rem;
  background: var(--yellow);
  border: var(--rule);
  padding: 0.5rem 0.9rem;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ---------- section headers ---------- */

.section { margin-bottom: 2.75rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: var(--rule);
  padding-bottom: 0.5rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 110%;
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.section-head .count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

/* ---------- election ballot-line list ---------- */

.ballot-list { display: flex; flex-direction: column; }

.ballot-line {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 1.5rem);
  padding: 1rem 0.25rem;
  border-bottom: var(--rule-thin);
  text-decoration: none;
  background: transparent;
  transition: background-color 0.15s ease;
}

.ballot-line:first-child { border-top: var(--rule-thin); }
.ballot-line:hover { background: var(--white); }
.ballot-line:hover .line-oval { background: var(--blue); border-color: var(--blue); }

.line-oval {
  width: 1.6em;
  height: 0.95em;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.line-main .line-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.25;
}

.line-main .line-place {
  font-size: 0.85rem;
  color: #4A4F55;
  margin-top: 0.1rem;
}

.line-date {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  text-align: right;
}

.line-date small {
  display: block;
  font-weight: 400;
  font-size: 0.68rem;
  color: #4A4F55;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1.5px solid var(--ink);
  padding: 0.22rem 0.5rem;
  white-space: nowrap;
}

.tag--local { background: var(--yellow); }
.tag--state { background: var(--blue); color: var(--white); border-color: var(--blue); }
.tag--national { background: var(--ink); color: var(--white); }

/* ---------- browse ---------- */

.browse-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.browse-controls select,
.filter-btn {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  border: var(--rule-thin);
  border-radius: 0;
  background: var(--white);
  color: var(--ink);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

.filter-btn.active { background: var(--ink); color: var(--white); }

/* ---------- detail pages ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  margin-bottom: 1.25rem;
}

.back-link:hover { color: var(--blue); }

.detail-card {
  border: var(--rule);
  background: var(--white);
  margin-bottom: 2rem;
}

.detail-band {
  background: var(--blue);
  color: var(--white);
  padding: 1.4rem clamp(1.25rem, 3vw, 2rem);
}

.detail-band .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--yellow);
  margin-bottom: 0.4rem;
}

.detail-band h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 110%;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  line-height: 1.05;
  text-transform: uppercase;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  border-top: var(--rule);
}

.detail-meta > div {
  padding: 0.9rem clamp(1rem, 2vw, 1.5rem);
  border-right: var(--rule-thin);
}

.detail-meta > div:last-child { border-right: none; }

.detail-meta dt {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4A4F55;
}

.detail-meta dd {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

.detail-desc {
  padding: 1.25rem clamp(1.25rem, 3vw, 2rem);
  border-top: var(--rule-thin);
  max-width: 68ch;
}

/* races */

.race-block { margin-bottom: 1.75rem; }

.race-office {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: var(--ink);
  color: var(--white);
  padding: 0.5rem 0.9rem;
}

.cand-line {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0.9rem;
  border: var(--rule-thin);
  border-top: none;
  background: var(--white);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.cand-line:hover { background: var(--paper); }
.cand-line:hover .line-oval { background: var(--blue); border-color: var(--blue); }

.cand-name { font-weight: 600; }

.cand-name small {
  display: block;
  font-weight: 400;
  font-size: 0.78rem;
  color: #4A4F55;
}

.party {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  border: 1.5px solid var(--ink);
  padding: 0.2rem 0.5rem;
}

/* candidate detail */

.values-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.value-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  border: var(--rule-thin);
  background: var(--white);
  padding: 0.8rem 0.9rem;
  font-weight: 500;
  font-size: 0.92rem;
}

.value-item .oval { color: var(--blue); background: var(--blue); border-color: var(--blue); margin-top: 0.15em; }

.article-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: 0.8rem 0.25rem;
  border-bottom: var(--rule-thin);
  text-decoration: none;
}

.article-line:first-child { border-top: var(--rule-thin); }
.article-line:hover .article-title { color: var(--blue); }

.article-title { font-weight: 600; }

.article-src {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #4A4F55;
  white-space: nowrap;
}

/* ---------- data view ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  border: var(--rule);
  background: var(--white);
}

.stat-card h3 {
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 110%;
  text-transform: uppercase;
  font-size: 1.05rem;
  padding: 0.7rem 1rem;
  border-bottom: var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.stat-card h3 small {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.bar-rows { padding: 1rem; display: flex; flex-direction: column; gap: 0.7rem; }

.bar-row { font-size: 0.8rem; }

.bar-row .bar-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.bar-track {
  height: 14px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
}

.bar-fill {
  height: 100%;
  background: var(--blue);
  width: 0;
  transition: width 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.bar-row:nth-child(n+3) .bar-fill { background: var(--yellow); }

.stat-note {
  font-size: 0.82rem;
  color: #3C4046;
  padding: 0 1rem 1rem;
}

/* ---------- track toggle ---------- */

.track-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--white);
  border: var(--rule);
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.track-btn:hover { background: var(--yellow); }
.track-btn[data-tracked="true"] { background: var(--yellow); }
.track-btn[data-tracked="true"] .track-oval { background: var(--ink); }

/* ---------- empty / loading ---------- */

.empty {
  border: 2px dashed var(--concrete);
  padding: 2rem 1.5rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #4A4F55;
}

/* ---------- footer ---------- */

.footer { border-top: var(--rule); background: var(--white); }

.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 2rem;
}

.footer-mark {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.footer-oval { color: var(--blue); background: var(--blue); border-color: var(--blue); width: 1.1em; height: 0.65em; }

.footer-note { font-size: 0.78rem; color: #4A4F55; max-width: 68ch; }

/* ---------- masthead search ---------- */

.masthead-search {
  display: flex;
  margin-left: auto;
}

.masthead-search input {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  border: none;
  border-radius: 0;
  background: var(--white);
  color: var(--ink);
  padding: 0.4rem 0.6rem;
  width: clamp(120px, 18vw, 210px);
}

.masthead-search button {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  border: none;
  border-radius: 0;
  background: var(--yellow);
  color: var(--ink);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}

.masthead-search + .masthead-area { margin-left: 0; }

/* ---------- key dates (home) ---------- */

.keydates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.9rem;
}

.keydate {
  border: var(--rule);
  background: var(--white);
  padding: 0.9rem 1rem;
}

.keydate dt {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4A4F55;
}

.keydate dd {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0.25rem 0;
}

.keydate small {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #4A4F55;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.keydate--action { background: var(--yellow); border-color: var(--ink); }
.keydate--action dd a { font-size: 0.95rem; }

.keydate-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.chip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  padding: 0.18rem 0.45rem;
}

/* ---------- notices & provenance ---------- */

.notice {
  border: var(--rule-thin);
  border-left: 8px solid var(--yellow);
  background: var(--white);
  padding: 0.8rem 1rem;
  font-size: 0.88rem;
  margin: 1rem 0;
  max-width: 74ch;
}

.provenance, .attribution {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #4A4F55;
  letter-spacing: 0.03em;
  margin-top: 1rem;
  max-width: 80ch;
}

.attribution { margin: 0; padding: 0.6rem clamp(1.25rem, 3vw, 2rem) 0.9rem; }
.attribution a { color: var(--blue); }

/* ---------- state grid (browse) ---------- */

.state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 0.5rem;
}

.state-tile {
  border: var(--rule-thin);
  border-radius: 0;
  background: var(--white);
  padding: 0.55rem 0.6rem;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: background-color 0.12s ease;
}

.state-tile:hover { background: var(--yellow); }
.state-tile.active { background: var(--blue); color: var(--white); border-color: var(--blue); }

.state-code {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.state-name {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.state-marks { display: flex; gap: 0.25rem; min-height: 1em; }

.state-marks i, .legend i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  border: 1px solid currentColor;
  padding: 0 0.25rem;
}

.legend {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #4A4F55;
  margin-top: 0.8rem;
}

.browse-controls input[type="search"] {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  border: var(--rule-thin);
  border-radius: 0;
  background: var(--white);
  color: var(--ink);
  padding: 0.5rem 0.75rem;
  flex: 1;
  min-width: 160px;
}

/* ---------- probability + markets ---------- */

.prob {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  background: var(--ink);
  color: var(--yellow);
  padding: 0.2rem 0.45rem;
  white-space: nowrap;
}

.market {
  border: var(--rule-thin);
  background: var(--white);
  padding: 0.9rem 1rem;
  margin-top: 0.75rem;
}

.market-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.market-name a { text-decoration: none; color: var(--blue); }

.market-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 2fr auto;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.market-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.market-track {
  display: block;
  height: 12px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
}

.market-fill { display: block; height: 100%; background: var(--blue); }

.market-row:nth-child(odd) .market-fill { background: var(--yellow); }

.market-pct { font-weight: 600; min-width: 2.6em; text-align: right; }

.market-caption {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: #4A4F55;
  margin-top: 0.5rem;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1rem;
}

.section-sub { margin: 1.5rem 0 0.25rem; }

.section-sub h3 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.race-empty {
  border: var(--rule-thin);
  border-top: none;
  background: var(--white);
  padding: 0.85rem 0.9rem;
  font-size: 0.85rem;
  color: #4A4F55;
}

/* ---------- candidate detail extras ---------- */

.detail-band--person {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.portrait {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border: 3px solid var(--white);
  flex-shrink: 0;
}

.party--DEM { border-color: var(--blue); color: var(--blue); }
.party--REP { border-color: #B3231F; color: #B3231F; }

.finance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
}

.finance-card {
  border: var(--rule);
  background: var(--white);
  padding: 0.9rem 1rem;
}

.finance-card dt {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4A4F55;
}

.finance-card dd {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.6rem;
  margin-top: 0.2rem;
}

.position {
  border: var(--rule-thin);
  background: var(--white);
  margin-bottom: 0.5rem;
}

.position summary {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  list-style-position: inside;
}

.position summary:hover { background: var(--paper); }

.position p {
  padding: 0 0.9rem 0.9rem;
  font-size: 0.9rem;
  max-width: 74ch;
  white-space: pre-line;
}

.links-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.deep-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-decoration: none;
  border: var(--rule-thin);
  background: var(--white);
  padding: 0.5rem 0.8rem;
  transition: background-color 0.12s ease;
}

.deep-link:hover { background: var(--yellow); }

/* ---------- sample-data banner ---------- */

.mode-banner {
  background: #B3231F;
  color: var(--white);
  padding: 0.7rem var(--gutter);
  font-size: 0.85rem;
  line-height: 1.4;
  border-bottom: var(--rule);
}

.mode-banner code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.28);
  padding: 0.05rem 0.3rem;
}

/* ---------- money lines (PAC tracker + funding) ---------- */

.money-list { display: flex; flex-direction: column; }

.money-line {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 0.6rem;
  border-bottom: var(--rule-thin);
  text-decoration: none;
  background: var(--white);
  transition: background-color 0.12s ease;
}

.money-line:first-child { border-top: var(--rule-thin); }
a.money-line[href]:hover { background: var(--yellow); }

.money-name { font-weight: 600; font-size: 0.95rem; }

.money-name small {
  display: block;
  font-weight: 400;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #4A4F55;
  letter-spacing: 0.04em;
}

.money-amount {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  text-align: right;
}

.so-chip {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.22rem 0.5rem;
  border: 1.5px solid var(--ink);
  white-space: nowrap;
}

.so-chip--for { background: var(--blue); color: var(--white); border-color: var(--blue); }
.so-chip--against { background: var(--white); color: #B3231F; border-color: #B3231F; }

.finance-card small {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: #4A4F55;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

button.deep-link { cursor: pointer; font-family: var(--font-mono); }

/* ---------- data view extras ---------- */

.stats-grid--wide { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.bar-row--link { display: block; text-decoration: none; }
.bar-row--link:hover .bar-label span:first-child { color: var(--blue); }

.bar-label em {
  font-style: normal;
  color: #4A4F55;
  font-size: 0.64rem;
}

/* ---------- candidate Q&A (AI) ---------- */

.qa-callout {
  border: var(--rule);
  background: var(--white);
  margin-bottom: 2.5rem;
  box-shadow: 6px 6px 0 var(--yellow);
}

.qa-callout-head {
  background: var(--blue);
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem clamp(1.25rem, 3vw, 2rem);
  flex-wrap: wrap;
}

.qa-badge {
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  padding: 0.25rem 0.5rem;
}

.qa-callout-head h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 110%;
  font-size: clamp(1.15rem, 2.8vw, 1.55rem);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.qa-callout-tag {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.qa-callout-body { padding: clamp(1.25rem, 3vw, 1.75rem) clamp(1.25rem, 3vw, 2rem); }

.qa-note {
  font-size: 0.85rem;
  color: #4A4F55;
  max-width: 74ch;
  margin-bottom: 1rem;
}

.qa-log {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 420px;
  overflow-y: auto;
  border: var(--rule-thin);
  background: var(--white);
  padding: 1rem;
  margin-bottom: 1rem;
}

.qa-msg { max-width: 46ch; }
.qa-msg p { font-size: 0.92rem; white-space: pre-line; }

.qa-msg-role {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4A4F55;
  margin-bottom: 0.2rem;
}

.qa-msg--user { align-self: flex-end; text-align: right; }
.qa-msg--user .qa-msg-role { color: var(--blue); }
.qa-msg--user p {
  background: var(--paper);
  border: var(--rule-thin);
  padding: 0.6rem 0.8rem;
  display: inline-block;
  text-align: left;
}

.qa-msg--ai .qa-msg-role { color: var(--ink); }
.qa-msg--ai p {
  background: var(--white);
  border-left: 4px solid var(--yellow);
  padding: 0.6rem 0.8rem;
}

.qa-msg--pending p { color: #4A4F55; font-style: italic; }

.qa-empty { padding: 1.25rem; }

.qa-form { display: flex; gap: 0.6rem; }

.qa-form input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.92rem;
  border: var(--rule-thin);
  border-radius: 0;
  background: var(--white);
  color: var(--ink);
  padding: 0.6rem 0.8rem;
}

.qa-send {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.qa-send:hover { background: var(--blue-deep); border-color: var(--blue-deep); }

.qa-actions { margin-top: 0.6rem; }

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .masthead-area { margin-left: 0; width: 100%; }
  .masthead-search { margin-left: 0; width: 100%; }
  .masthead-search input { flex: 1; width: auto; }
  .ballot-line { grid-template-columns: auto 1fr; }
  .ballot-line .tag { display: none; }
  .line-date { grid-column: 2; text-align: left; }
  .cand-line { grid-template-columns: auto 1fr; }
  .cand-line .party { display: none; }
  .cand-line .prob { grid-column: 2; justify-self: start; }
  .detail-band--person { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
