/* ============================================================
   Texas 2026 Candidate Resource — Stylesheet
   ============================================================ */

:root {
  --navy:       #1B3A6B;
  --navy-light: #2A5298;
  --navy-dark:  #0F2240;
  --gold:       #C9A84C;
  --white:      #FFFFFF;
  --gray-100:   #F5F6F8;
  --gray-200:   #E8EAED;
  --gray-400:   #9AA0A6;
  --gray-600:   #5F6368;
  --gray-800:   #202124;
  --red-r:      #B91C1C;
  --red-r-bg:   #FEF2F2;
  --blue-d:     #1D4ED8;
  --blue-d-bg:  #EFF6FF;
  --gold-l:     #A16207;
  --gold-l-bg:  #FEFCE8;
  --green-g:    #15803D;
  --green-g-bg: #F0FDF4;
  --status-confirmed:  #15803D;
  --status-pending:    #B45309;
  --status-partial:    #1D4ED8;
  --border: #D1D5DB;
  --shadow: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.06);
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html { scroll-behavior: smooth; }

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

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

/* ── Layout ─────────────────────────────────────────────── */
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ── Header / Nav ────────────────────────────────────────── */
#site-header {
  background: var(--navy);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  position: sticky; top: 0; z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: 1120px;
  margin: 0 auto;
  gap: 16px;
}

.site-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--white);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: -.01em;
}
.site-title span { color: var(--gold); }

.site-nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }

.nav-link {
  color: rgba(255,255,255,.85);
  font-size: .9rem;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: background .15s, color .15s;
  border: none; background: none;
}
.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,.15);
  color: var(--white);
  text-decoration: none;
}
.nav-link.cta {
  background: var(--gold);
  color: var(--navy-dark);
  font-weight: 700;
  margin-left: 6px;
}
.nav-link.cta:hover { background: #e0bb5a; }

/* ── Main content ────────────────────────────────────────── */
#main-content { min-height: calc(100vh - 130px); }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 60%, var(--navy-light) 100%);
  color: var(--white);
  padding: 56px 20px 52px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.hero h1 span { color: var(--gold); }
.hero p {
  font-size: 1.1rem;
  color: rgba(255,255,255,.85);
  max-width: 620px;
  margin: 0 auto 32px;
}

/* Ballot lookup box */
.lookup-box {
  background: var(--white);
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 560px;
  margin: 0 auto;
  text-align: left;
  box-shadow: var(--shadow-md);
}
.lookup-box h3 {
  color: var(--navy);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.lookup-input-row {
  display: flex;
  gap: 10px;
}
.lookup-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s;
}
.lookup-input:focus { border-color: var(--navy-light); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn-primary { background: var(--navy); color: var(--white); }
.btn-secondary { background: var(--gray-200); color: var(--gray-800); }
.btn-outline { background: transparent; border: 1.5px solid var(--navy); color: var(--navy); }
.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn-gold { background: var(--gold); color: var(--navy-dark); }

.lookup-note {
  margin-top: 10px;
  font-size: .82rem;
  color: var(--gray-600);
}
.lookup-note a { color: var(--navy-light); }

/* ── Stats bar ───────────────────────────────────────────── */
.stats-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
}
.stats-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}
.stat-item { text-align: center; }
.stat-num { font-size: 1.6rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--gray-600); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

/* ── Section headers ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 20px;
  background: var(--gold);
  border-radius: 2px;
}

/* ── Page section ────────────────────────────────────────── */
.page-section { padding: 36px 0; }
.page-section + .page-section { border-top: 1px solid var(--border); }

/* ── Race cards ──────────────────────────────────────────── */
.race-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.race-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s, transform .1s;
  box-shadow: var(--shadow);
}
.race-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--navy-light);
  transform: translateY(-1px);
}

.race-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 10px;
}
.race-card-title { font-size: 1rem; font-weight: 700; color: var(--navy); line-height: 1.3; flex: 1; }
.race-card-category {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  background: var(--gray-200);
  color: var(--gray-600);
}

.race-card-candidates {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.candidate-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .82rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.chip-r { background: var(--red-r-bg); color: var(--red-r); }
.chip-d { background: var(--blue-d-bg); color: var(--blue-d); }
.chip-l { background: var(--gold-l-bg); color: var(--gold-l); }
.chip-g { background: var(--green-g-bg); color: var(--green-g); }
.chip-i { background: var(--gray-200); color: var(--gray-600); }

.party-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-r { background: var(--red-r); }
.dot-d { background: var(--blue-d); }
.dot-l { background: var(--gold-l); }
.dot-g { background: var(--green-g); }
.dot-i { background: var(--gray-400); }

.race-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 600;
  margin-top: 12px;
}
.status-confirmed { color: var(--status-confirmed); }
.status-pending { color: var(--status-pending); }
.status-partial { color: var(--status-partial); }

/* ── Filters / search bar ────────────────────────────────── */
.filter-bar {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow);
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
  font-family: var(--font);
  outline: none;
}
.search-input:focus { border-color: var(--navy-light); }

.filter-select {
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .9rem;
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--white);
  cursor: pointer;
  outline: none;
}
.filter-select:focus { border-color: var(--navy-light); }

.filter-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-tag {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--white);
  color: var(--gray-600);
  transition: all .15s;
}
.filter-tag:hover, .filter-tag.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
.filter-tag.active-r { background: var(--red-r-bg); border-color: var(--red-r); color: var(--red-r); }

.results-count { font-size: .88rem; color: var(--gray-600); }

/* ── Race detail page ────────────────────────────────────── */
.page-header {
  background: var(--navy);
  color: var(--white);
  padding: 36px 20px 32px;
}
.page-header .breadcrumb {
  font-size: .85rem;
  color: rgba(255,255,255,.7);
  margin-bottom: 10px;
  cursor: pointer;
}
.page-header .breadcrumb:hover { color: var(--white); }
.page-header h1 { font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 800; margin-bottom: 8px; }
.page-header .subtitle { color: rgba(255,255,255,.85); font-size: .95rem; }

.race-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
}
.meta-item {
  background: rgba(255,255,255,.12);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: .85rem;
}
.meta-item strong { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; opacity: .8; margin-bottom: 2px; }

/* Candidate comparison */
.candidates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.candidate-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: all .15s;
  box-shadow: var(--shadow);
}
.candidate-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.candidate-card.party-r { border-top: 4px solid var(--red-r); }
.candidate-card.party-d { border-top: 4px solid var(--blue-d); }
.candidate-card.party-l { border-top: 4px solid var(--gold-l); }
.candidate-card.party-g { border-top: 4px solid var(--green-g); }
.candidate-card.party-i { border-top: 4px solid var(--gray-400); }

.candidate-card-name { font-size: 1.2rem; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.candidate-card-party {
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.candidate-card-party.r { color: var(--red-r); }
.candidate-card-party.d { color: var(--blue-d); }
.candidate-card-party.l { color: var(--gold-l); }
.candidate-card-party.g { color: var(--green-g); }

.candidate-card-bio {
  font-size: .9rem;
  color: var(--gray-600);
  line-height: 1.55;
  margin-bottom: 16px;
}

.candidate-links { display: flex; flex-wrap: wrap; gap: 8px; }
.candidate-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .8rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 4px;
  background: var(--gray-100);
  color: var(--gray-800);
  border: 1px solid var(--border);
  transition: background .15s;
}
.candidate-link:hover { background: var(--gray-200); text-decoration: none; }

/* ── Candidate profile page ──────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 768px) { .profile-grid { grid-template-columns: 1fr; } }

.profile-main {}
.profile-sidebar {}

.info-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.info-card h3 {
  font-size: .9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--gray-600);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.info-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--gray-100); align-items: baseline; }
.info-row:last-child { border-bottom: none; }
.info-label { font-size: .85rem; font-weight: 600; color: var(--gray-600); min-width: 130px; flex-shrink: 0; }
.info-value { font-size: .9rem; color: var(--gray-800); }

.party-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .9rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
}
.badge-r { background: var(--red-r-bg); color: var(--red-r); }
.badge-d { background: var(--blue-d-bg); color: var(--blue-d); }
.badge-l { background: var(--gold-l-bg); color: var(--gold-l); }
.badge-g { background: var(--green-g-bg); color: var(--green-g); }

.social-links { display: flex; flex-wrap: wrap; gap: 8px; }
.social-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--gray-800);
  transition: background .15s;
}
.social-link:hover { background: var(--gray-100); text-decoration: none; }

.finance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.finance-item { text-align: center; }
.finance-num { font-size: 1.1rem; font-weight: 800; color: var(--navy); }
.finance-lbl { font-size: .75rem; color: var(--gray-600); margin-top: 2px; }
.finance-na { color: var(--gray-400); font-style: italic; font-size: .9rem; }

/* ── About / Ballot lookup page ──────────────────────────── */
.page-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px;
}
.page-content h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 8px;
}
.page-content h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
  margin: 28px 0 10px;
}
.page-content p { color: var(--gray-800); line-height: 1.7; margin-bottom: 14px; }
.page-content ul { margin: 8px 0 14px 20px; }
.page-content ul li { margin-bottom: 6px; color: var(--gray-800); line-height: 1.6; }

/* ── Alert / notice banners ──────────────────────────────── */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: .9rem;
  margin-bottom: 16px;
}
.notice-info { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.notice-warn { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.notice-success { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }

/* ── Empty / placeholder states ──────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: .95rem; }

/* ── Footer ──────────────────────────────────────────────── */
#site-footer {
  background: var(--navy-dark);
  color: rgba(255,255,255,.7);
  padding: 28px 20px;
  font-size: .85rem;
  margin-top: 40px;
}
.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-link { color: rgba(255,255,255,.7); }
.footer-link:hover { color: var(--white); }
.footer-disclaimer { margin-top: 12px; line-height: 1.5; max-width: 1120px; margin: 12px auto 0; font-size: .8rem; border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; }

/* ── Loading ─────────────────────────────────────────────── */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--gray-400);
  font-size: .95rem;
  gap: 10px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner { padding: 12px 16px; }
  .site-title { font-size: 1rem; }
  .nav-link { padding: 6px 8px; font-size: .82rem; }
  .hero { padding: 36px 16px 32px; }
  .hero h1 { font-size: 1.6rem; }
  .lookup-box { padding: 18px 16px; }
  .lookup-input-row { flex-direction: column; }
  .race-grid { grid-template-columns: 1fr; }
  .stats-inner { gap: 20px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-input { min-width: unset; }
  .page-header { padding: 24px 16px 20px; }
  .finance-grid { grid-template-columns: repeat(3, 1fr); }
}
