/* =========================================================
   Records Matter. Verify.
   Design system for the Idaho 2026 contested-primary directory.
   Sans-serif primary; section-tinted color palette.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap');

:root {
  /* ---- Base palette ---- */
  --bg: #FAF8F4;
  --surface: #FFFFFF;
  --surface-soft: #F1ECE0;
  --border: #E5E0D2;
  --border-strong: #C9C2A8;

  --ink: #1A1F2C;
  --ink-soft: #5A5F6B;
  --ink-muted: #8B8F99;

  /* ---- Brand (navy — civic/governmental feel) ---- */
  --brand: #1E3A5F;
  --brand-hover: #122742;
  --brand-soft: #E5EBF2;
  --brand-line: #C7D3E2;

  /* ---- Accent (kept teal for links so they stand apart from nav/brand) ---- */
  --accent: #0F5E5C;
  --accent-hover: #0A4A48;

  /* ---- Voting alert (warm amber — draws the eye) ---- */
  --vote-bg: #FFF6DC;
  --vote-bg-strong: #FBEBB8;
  --vote-border: #E5C770;
  --vote-eyebrow: #8B6914;
  --vote-ink: #5C4710;

  /* ---- Section tints ---- */
  --search-bg: #F0F4F9;          /* cool blue */
  --search-eyebrow: #1E3A5F;
  --search-line: #CFDCEA;

  --races-bg: #FAF6EB;           /* warm cream */
  --races-eyebrow: #8A4A1A;
  --races-line: #E5DAB9;

  --pacs-bg: #F2EEE7;            /* neutral khaki */
  --pacs-eyebrow: #5C4A2A;
  --pacs-line: #DDD4BF;

  --explainer-bg: #EAF2EC;       /* soft sage */
  --explainer-eyebrow: #2D5C44;
  --explainer-line: #C8DDCF;

  /* ---- Tags / callouts ---- */
  --tag-bg: #EBE6D8;
  --tag-text: #5A5F6B;
  --warn-bg: #F5E9D8;
  --warn-text: #7A4A1F;
  --info-bg: #E0EBE8;
  --info-text: #0F4A48;

  /* ---- Type ---- */
  --sans: 'Public Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

  /* ---- Layout ---- */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --max-width: 760px;
  --gutter: 24px;
}

/* =========================================================
   Reset & base
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: 'kern', 'liga';
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }

img { max-width: 100%; display: block; }
input, button { font: inherit; color: inherit; }

/* =========================================================
   Page structure
   ========================================================= */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

main { padding-bottom: 3rem; }

/* ---- Top bar ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0 10px;
}

.wordmark {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--brand);
}
.wordmark a { color: inherit; }
.wordmark a:hover { text-decoration: none; color: var(--brand-hover); }
.wordmark .v { font-style: italic; font-weight: 500; color: var(--accent); }

.countdown {
  font-size: 13px;
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--brand);
  border: 1px solid var(--brand);
  white-space: nowrap;
  font-weight: 500;
}

/* ---- Top nav ---- */
.topnav {
  display: flex;
  gap: 4px;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--brand-line);
  flex-wrap: wrap;
}
.topnav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--brand);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.topnav a:hover {
  background: var(--brand-soft);
  color: var(--brand-hover);
  text-decoration: none;
}

/* ---- Back link ---- */
.backlink {
  padding: 22px 0 6px;
  font-size: 13px;
}
.backlink a { color: var(--ink-soft); }
.backlink a:hover { color: var(--accent); text-decoration: none; }

/* ---- Section ---- */
.section {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}
.section:last-of-type { border-bottom: none; }

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 0.5rem;
  font-weight: 600;
}

/* Section colored variants — light tints so the page feels structured */
.section--vote {
  background: var(--vote-bg);
  border: 1px solid var(--vote-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.5rem 1.75rem;
  margin: 1.25rem 0 0.5rem;
}
.section--vote .voterbar { margin-top: 0.5rem; }
.eyebrow--vote { color: var(--vote-eyebrow); }

.section--search { border-bottom-color: var(--search-line); }
.eyebrow--search { color: var(--search-eyebrow); }

.section--races { border-bottom-color: var(--races-line); }
.eyebrow--races { color: var(--races-eyebrow); }

.section--pacs { border-bottom-color: var(--pacs-line); }
.eyebrow--pacs { color: var(--pacs-eyebrow); }

.section--explainer { border-bottom: none; }
.eyebrow--explainer { color: var(--explainer-eyebrow); }

/* ---- Footer ---- */
.sitefoot {
  border-top: 2px solid var(--brand);
  margin-top: 1.5rem;
  padding: 1.25rem 0 2rem;
  font-size: 12px;
  color: var(--ink-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.sitefoot a { color: var(--ink-soft); margin-left: 16px; }
.sitefoot a:first-child { margin-left: 0; }
.sitefoot .footlinks a { margin-left: 16px; }

/* =========================================================
   Headings
   ========================================================= */

h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--ink); }

.hero h1, .pagehead h1 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(28px, 4.6vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  color: var(--brand);
}
.hero h1 .v { font-style: italic; color: var(--accent); }

.section h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0 0 1rem;
}

.section h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 1.25rem 0 0.4rem;
}

.lede {
  font-size: 16px;
  color: var(--ink-soft);
  max-width: 580px;
  margin: 0 0 1.25rem;
  line-height: 1.6;
}

/* =========================================================
   Hero (homepage)
   ========================================================= */

.hero {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.hero-stats {
  display: flex;
  gap: 36px;
  padding-top: 0.75rem;
}

.hero-stat-num {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--brand);
  letter-spacing: -0.02em;
}

.hero-stat-lbl {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
  font-weight: 500;
}

/* =========================================================
   Search
   ========================================================= */

.search-row {
  display: flex;
  gap: 8px;
  margin: 0.5rem 0 0.75rem;
}

.search-input {
  flex: 1;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.15);
}

.btn {
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

.btn-ghost {
  background: transparent;
  color: var(--brand);
}
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand-hover); }

.search-help {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0;
}

.search-results { margin-top: 1rem; }
.search-results:empty { display: none; }

.search-result {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  background: var(--surface);
}
.search-result-name { font-weight: 600; font-size: 14px; }
.search-result-meta { font-size: 12px; color: var(--ink-soft); }
.search-result-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border-radius: var(--radius-md);
}

/* =========================================================
   Cards
   ========================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

/* ---- District tile (homepage browse) — minimal ---- */
.race-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.dist-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: block;
  color: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.dist-card:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  text-decoration: none;
  transform: translateY(-1px);
}
.dist-card-num {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--brand);
}
.dist-card-races {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
  font-weight: 500;
}

/* ---- Race tile (legacy listing pages) ---- */
.race-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: block;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.race-tile:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  text-decoration: none;
}

.race-tile-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.race-tile-dist {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.race-tile-seat {
  font-size: 12px;
  color: var(--ink-soft);
}

.race-tile-cands {
  font-size: 13px;
  color: var(--ink);
  margin-top: 6px;
  line-height: 1.5;
}

/* =========================================================
   Race detail — candidate cards
   ========================================================= */

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

.cand-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}

.cand-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  color: var(--brand);
}

.cand-tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  margin-bottom: 16px;
  letter-spacing: 0.02em;
  font-weight: 500;
}

.cand-row {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  align-items: flex-start;
}

.cand-row-icon {
  color: var(--ink-muted);
  flex-shrink: 0;
}

.cand-row-lbl {
  color: var(--ink-soft);
  width: 100px;
  flex-shrink: 0;
  font-weight: 500;
}

.cand-row-val {
  flex: 1;
  word-break: break-word;
  color: var(--ink);
}

.cand-filing {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

/* =========================================================
   PAC detail
   ========================================================= */

.pac-aff {
  font-size: 15px;
  color: var(--ink-soft);
  max-width: 580px;
  margin: 0 0 0.75rem;
  line-height: 1.6;
}

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

.fact {
  padding: 14px 16px;
  background: var(--surface-soft);
  border-radius: var(--radius-md);
}
.fact-lbl {
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.fact-val {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
}

.treas-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}

.treas-name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  color: var(--brand);
}

.treas-role {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.treas-related {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.related-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.related-row:last-child { border-bottom: none; }

.related-name { font-weight: 500; }
.related-meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* =========================================================
   Voter info bar (now used in the homepage hero/voting block)
   ========================================================= */

.voterbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 0.75rem;
}

.voterbar-cell {
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--vote-border);
  border-radius: var(--radius-md);
}
.section--vote .voterbar-cell { background: rgba(255, 255, 255, 0.7); }
.voterbar-lbl {
  font-size: 11px;
  color: var(--vote-ink);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.voterbar-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.voterbar-cell a { color: var(--brand); }
.voterbar-cell a:hover { color: var(--brand-hover); }

/* =========================================================
   Explainer
   ========================================================= */

.step-num {
  font-style: italic;
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0 0 0.25rem;
  font-weight: 500;
}

.section h2.serif {
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 1rem;
}

.format-tile {
  padding: 13px 15px;
  background: var(--surface-soft);
  border-radius: var(--radius-md);
}
.format-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--ink);
}
.format-where {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.callout {
  background: var(--surface-soft);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin: 1.25rem 0;
  font-size: 13px;
}
.callout-lbl {
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 600;
}
.callout-line {
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 6px;
  word-break: break-word;
}

.tells { margin: 0.5rem 0; }
.tell {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.tell:last-child { border-bottom: none; }
.tell-pattern {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
}
.tell-meaning { margin-top: 4px; color: var(--ink); }

.flags {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}
.flags li {
  padding: 10px 0 10px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  position: relative;
}
.flags li:last-child { border-bottom: none; }
.flags li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18px;
  width: 8px;
  height: 8px;
  border-radius: 1px;
  background: var(--warn-text);
  opacity: 0.6;
}
.flag-label { font-weight: 600; color: var(--ink); }

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 1rem;
}

.action {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.action-num {
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
  margin-bottom: 6px;
  font-weight: 500;
}
.action-step {
  font-size: 14px;
  line-height: 1.5;
}

/* ---- Homepage explainer headline ---- */
.explainer-headline {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--explainer-eyebrow);
}

/* =========================================================
   Activity hint (sectioned panel, used in district + PAC + homepage)
   ========================================================= */

.activity-hint {
  background: var(--explainer-bg);
  border: 1px solid var(--explainer-line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  font-size: 14px;
  color: var(--ink);
}
.activity-hint p { margin: 0 0 0.75rem; }
.activity-hint p:last-child { margin-bottom: 0; }

/* =========================================================
   Listing pages (all races / all PACs)
   ========================================================= */

.listing-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.listing-row:last-child { border-bottom: none; }

.listing-name {
  font-weight: 600;
  font-size: 14px;
}
.listing-meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* =========================================================
   Utilities
   ========================================================= */

.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.no-border { border: none !important; }

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
}

.icon {
  display: inline-block;
  vertical-align: -2px;
  margin-right: 4px;
}

/* =========================================================
   Responsive tightening
   ========================================================= */

@media (max-width: 520px) {
  :root { --gutter: 18px; }
  .hero { padding: 1.5rem 0 1.25rem; }
  .hero-stats { gap: 24px; }
  .hero-stat-num { font-size: 22px; }
  .topbar { padding: 14px 0 8px; }
  .countdown { font-size: 12px; padding: 4px 11px; }
  .topnav { gap: 2px; padding: 6px 0 10px; }
  .topnav a { font-size: 12px; padding: 6px 9px; }
  .sitefoot { flex-direction: column; gap: 6px; }
  .sitefoot .footlinks a { margin-left: 0; margin-right: 14px; }
  .section--vote { padding: 1.25rem 1.25rem 1.5rem; }
  .race-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}

/* Print-friendly */
@media print {
  .topbar, .topnav, .countdown, .backlink, .sitefoot, .search-row, .search-help { display: none; }
  body { background: #fff; }
  a { color: var(--ink); }
  .section { border-bottom: 1px solid #999; }
  .section--vote { border: 1px solid #999; background: #fff; }
}
