/* ============================================================
   Illinois Senate Primary 2026 — Site Styles
   ============================================================ */

:root {
  --blue-dark:    #0d2447;
  --blue-mid:     #1a4080;
  --blue-light:   #2563a8;
  --blue-pale:    #dbeafe;
  --gold:         #c9a227;
  --gold-light:   #fef9e7;
  --green:        #166534;
  --green-light:  #dcfce7;
  --red:          #991b1b;
  --red-light:    #fee2e2;
  --gray-50:      #f9fafb;
  --gray-100:     #f3f4f6;
  --gray-200:     #e5e7eb;
  --gray-400:     #9ca3af;
  --gray-600:     #4b5563;
  --gray-800:     #1f2937;
  --white:        #ffffff;
  --text:         #1f2937;
  --text-muted:   #6b7280;

  --radius:       8px;
  --radius-lg:    16px;
  --shadow:       0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:    0 4px 12px rgba(0,0,0,.12);
  --shadow-lg:    0 10px 30px rgba(0,0,0,.12);

  --max-width:    1200px;
  --font-sans:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--gray-50);
  line-height: 1.6;
  font-size: 16px;
}

a { color: var(--blue-light); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Layout ─────────────────────────────────────────────── */

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

.section {
  padding: 56px 0;
}

.section + .section {
  border-top: 1px solid var(--gray-200);
}

/* ── Site Header ─────────────────────────────────────────── */

.site-header {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
  color: var(--white);
  padding: 0;
}

.site-header .container {
  padding-top: 48px;
  padding-bottom: 48px;
}

.header-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.65);
  margin-bottom: 10px;
}

.header-title {
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
}

.header-subtitle {
  font-size: clamp(15px, 2vw, 19px);
  color: rgba(255,255,255,.8);
  max-width: 680px;
  margin-bottom: 28px;
  line-height: 1.5;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.header-meta-item {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
}

.header-meta-item strong {
  display: block;
  font-size: 18px;
  font-weight: 800;
}

/* ── Breadcrumb nav ──────────────────────────────────────── */

.breadcrumb {
  background: var(--blue-dark);
  border-bottom: 1px solid rgba(255,255,255,.1);
  padding: 10px 0;
  font-size: 13px;
}

.breadcrumb a { color: rgba(255,255,255,.7); }
.breadcrumb a:hover { color: var(--white); text-decoration: none; }
.breadcrumb span { color: rgba(255,255,255,.45); margin: 0 8px; }
.breadcrumb .current { color: rgba(255,255,255,.9); }

/* ── Candidate Header (individual pages) ────────────────── */

.candidate-header {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
  color: var(--white);
  padding: 48px 0;
}

.candidate-header-inner {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.candidate-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: 3px solid rgba(255,255,255,.3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  overflow: hidden;
}

.candidate-header-text .eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.65);
  margin-bottom: 8px;
}

.candidate-header-text h1 {
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 10px;
}

.candidate-header-text .role {
  font-size: 17px;
  color: rgba(255,255,255,.75);
  margin-bottom: 18px;
}

.candidate-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.badge-tier1 { background: var(--gold); color: #1a1100; }
.badge-tier2 { background: rgba(255,255,255,.2); color: var(--white); border: 1px solid rgba(255,255,255,.3); }
.badge-removed { background: var(--red-light); color: var(--red); }
.badge-writein { background: var(--gray-200); color: var(--gray-600); }
.badge-endorsed { background: var(--green-light); color: var(--green); }
.badge-fundraising { background: rgba(255,255,255,.15); color: var(--white); border: 1px solid rgba(255,255,255,.25); }

/* ── Cards ───────────────────────────────────────────────── */

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-body { padding: 28px; }

/* ── Candidate Cards (index) ─────────────────────────────── */

.candidates-tier {
  margin-bottom: 48px;
}

.tier-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gray-200);
}

.tier-label .tier-name {
  color: var(--blue-mid);
}

.candidates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.candidates-grid-sm {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.candidate-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--gray-200);
}

.candidate-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}

.candidate-card.tier1 {
  border-top: 4px solid var(--gold);
}

.candidate-card.tier2 {
  border-top: 4px solid var(--blue-light);
}

.candidate-card.other {
  border-top: 4px solid var(--gray-400);
}

.card-stripe {
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--blue-dark), var(--blue-mid));
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 16px;
}

.card-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  border: 2px solid rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.card-stripe h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
}

.card-stripe .role-text {
  font-size: 13px;
  color: rgba(255,255,255,.7);
}

.card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--gray-100);
}

.card-stat {
  padding: 14px 24px;
  border-right: 1px solid var(--gray-100);
}

.card-stat:last-child { border-right: none; }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue-dark);
}

.stat-value.na { color: var(--gray-400); font-size: 14px; font-weight: 400; }
.stat-sub { font-size: 12px; color: var(--text-muted); }

.card-summary {
  padding: 18px 24px;
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.55;
  flex: 1;
}

.card-footer {
  padding: 14px 24px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.view-profile {
  color: var(--blue-light);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Section headings ────────────────────────────────────── */

.section-heading {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  color: var(--blue-dark);
  margin-bottom: 8px;
}

.section-subheading {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 32px;
  max-width: 680px;
}

/* ── Bar Charts (pure CSS) ───────────────────────────────── */

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 100px;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}

.bar-label {
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  background: var(--gray-100);
  border-radius: 4px;
  height: 28px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .6s ease;
}

.bar-fill.blue  { background: linear-gradient(90deg, var(--blue-mid), var(--blue-light)); }
.bar-fill.gold  { background: linear-gradient(90deg, #b8921e, var(--gold)); }
.bar-fill.green { background: linear-gradient(90deg, #14532d, var(--green)); }
.bar-fill.gray  { background: linear-gradient(90deg, var(--gray-400), var(--gray-600)); }

.bar-amount {
  font-weight: 700;
  color: var(--gray-800);
  text-align: right;
  font-size: 13px;
}

/* ── Poll chart ──────────────────────────────────────────── */

.poll-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.poll-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  border: 1px solid var(--gray-200);
}

.poll-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 16px;
}

.poll-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 14px;
}

.poll-row .name { flex: 1; font-weight: 500; }
.poll-row .pct { font-weight: 700; color: var(--blue-dark); min-width: 42px; text-align: right; }

.poll-bar-track {
  width: 100%;
  background: var(--gray-100);
  border-radius: 3px;
  height: 6px;
  margin-top: 2px;
}

.poll-bar-fill {
  height: 6px;
  border-radius: 3px;
  background: var(--blue-light);
}

.poll-bar-fill.undecided { background: var(--gray-400); }
.poll-bar-fill.k  { background: #2563a8; }
.poll-bar-fill.s  { background: #7c3aed; }
.poll-bar-fill.r  { background: #059669; }

.poll-source {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 14px;
  border-top: 1px solid var(--gray-100);
  padding-top: 10px;
}

/* ── Comparison Table ────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  font-size: 14px;
}

thead th {
  background: var(--blue-dark);
  color: var(--white);
  padding: 14px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

thead th:first-child { border-radius: var(--radius) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius) 0 0; }

tbody tr { border-bottom: 1px solid var(--gray-100); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--blue-pale); }

tbody td {
  padding: 13px 16px;
  vertical-align: top;
  line-height: 1.5;
}

tbody td:first-child { font-weight: 600; }

.cell-na { color: var(--gray-400); font-style: italic; }
.cell-good { color: var(--green); font-weight: 600; }
.cell-warn { color: #92400e; font-weight: 600; }

/* ── Candidate page body ─────────────────────────────────── */

.page-body {
  background: var(--white);
}

.page-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
  padding: 48px 0;
}

.page-main {}

.page-aside {}

/* ── Content blocks ──────────────────────────────────────── */

.content-block {
  margin-bottom: 40px;
}

.content-block h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--blue-pale);
}

.content-block h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 8px;
  margin-top: 18px;
}

.content-block p {
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 14px;
}

.content-block ul {
  margin: 0 0 14px 20px;
  color: var(--gray-600);
  line-height: 1.7;
}

.content-block li { margin-bottom: 5px; }

/* ── Aside widgets ───────────────────────────────────────── */

.aside-widget {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.aside-widget-header {
  background: var(--blue-dark);
  color: var(--white);
  padding: 12px 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.aside-widget-body {
  padding: 18px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
}

.stat-row:last-child { border-bottom: none; }
.stat-row .key { color: var(--text-muted); }
.stat-row .val { font-weight: 700; color: var(--blue-dark); }
.stat-row .val.negative { color: var(--red); }

/* ── SWOT ─────────────────────────────────────────────────── */

.swot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.swot-box {
  border-radius: var(--radius);
  padding: 16px 18px;
}

.swot-box h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
}

.swot-box ul {
  margin: 0 0 0 16px;
  font-size: 14px;
  line-height: 1.55;
}

.swot-box.strengths { background: var(--green-light); }
.swot-box.strengths h4 { color: var(--green); }
.swot-box.strengths ul { color: #14532d; }

.swot-box.weaknesses { background: var(--red-light); }
.swot-box.weaknesses h4 { color: var(--red); }
.swot-box.weaknesses ul { color: #7f1d1d; }

.swot-box.opportunities { background: var(--blue-pale); }
.swot-box.opportunities h4 { color: var(--blue-mid); }
.swot-box.opportunities ul { color: #1e3a5f; }

.swot-box.threats { background: var(--gold-light); }
.swot-box.threats h4 { color: #78350f; }
.swot-box.threats ul { color: #451a03; }

/* ── Source list ─────────────────────────────────────────── */

.source-list {
  list-style: none;
  font-size: 13px;
  color: var(--text-muted);
}

.source-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.source-list li:last-child { border-bottom: none; }

.source-list .num {
  font-weight: 700;
  color: var(--blue-mid);
  min-width: 22px;
}

.source-list a { color: var(--blue-light); word-break: break-all; }

/* ── Alert / callout ─────────────────────────────────────── */

.callout {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
  font-size: 14px;
  line-height: 1.55;
}

.callout.info {
  background: var(--blue-pale);
  border-left: 4px solid var(--blue-light);
  color: #1e3a5f;
}

.callout.warn {
  background: var(--gold-light);
  border-left: 4px solid var(--gold);
  color: #451a03;
}

.callout.note {
  background: var(--gray-100);
  border-left: 4px solid var(--gray-400);
  color: var(--gray-600);
}

/* ── Footer ──────────────────────────────────────────────── */

.site-footer {
  background: var(--blue-dark);
  color: rgba(255,255,255,.65);
  padding: 36px 0;
  margin-top: 80px;
  font-size: 14px;
  line-height: 1.7;
}

.site-footer a { color: rgba(255,255,255,.8); }
.footer-note { margin-top: 10px; font-size: 12px; color: rgba(255,255,255,.4); }

/* ── Endorsement tag ─────────────────────────────────────── */

.endorsement-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-light);
  color: var(--green);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  margin: 4px 4px 4px 0;
}

/* ── Nav bar (within site) ───────────────────────────────── */

.page-nav {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.page-nav .container {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding-top: 0;
  padding-bottom: 0;
}

.page-nav a {
  display: inline-block;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s;
}

.page-nav a:hover { color: var(--blue-dark); text-decoration: none; border-bottom-color: var(--blue-light); }
.page-nav a.active { color: var(--blue-dark); border-bottom-color: var(--blue-dark); }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 900px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .page-aside {
    order: -1;
  }

  .bar-row {
    grid-template-columns: 140px 1fr 80px;
  }

  .swot-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .candidate-header-inner {
    flex-direction: column;
  }

  .bar-row {
    grid-template-columns: 100px 1fr 70px;
    font-size: 13px;
  }

  .card-stats {
    grid-template-columns: 1fr;
  }

  .card-stat { border-right: none; border-bottom: 1px solid var(--gray-100); }
}
