:root {
  --blue: #283593;
  --blue-mid: #3949ab;
  --blue-light: #e8eaf6;
  --teal: #00a2c6;
  --teal-light: #e0f7fa;
  --bg: #ffffff;
  --sidebar-bg: #f4f6f9;
  --text: #1a202c;
  --text-muted: #64748b;
  --link: #1565c0;
  --border: #e2e8f0;
  --header-h: 58px;
  --sidebar-w: 240px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.65;
}

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

h1 { font-size: 1.5rem; margin: 0 0 1rem; color: var(--blue); }
h2 { font-size: 1.25rem; margin: 1.5rem 0 0.75rem; color: var(--blue); }
h3 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; color: var(--blue-mid); }
h4 { font-size: 0.95rem; margin: 0.75rem 0 0.4rem; color: var(--blue-mid); }
h5 { font-size: 0.875rem; margin: 1rem 0 0.4rem; color: var(--blue-mid); }
h6 { font-size: 0.8rem; margin: 0.75rem 0 0.3rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

p { margin: 0.5rem 0 0.75rem; }
ul { padding-left: 1.25rem; margin: 0.25rem 0 0.75rem; }
li { margin: 0.25rem 0; }
blockquote { border-left: 3px solid var(--teal); padding-left: 1rem; color: var(--text-muted); margin: 0.75rem 0; font-style: italic; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ── Header ── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--blue);
  display: flex; align-items: center;
  padding: 0 1.25rem;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.site-title {
  font-size: 1.05rem; font-weight: 700;
  color: white; text-decoration: none;
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-title:hover { color: var(--teal-light); text-decoration: none; }

.header-links {
  font-size: 0.8rem;
  display: flex; gap: 0.75rem; align-items: center;
}
.header-links a { color: rgba(255,255,255,0.78); }
.header-links a:hover { color: white; text-decoration: none; }

.hamburger {
  display: none; background: none; border: none; color: white;
  cursor: pointer; font-size: 1.5rem; padding: 2px 8px;
  margin-right: 0.5rem; line-height: 1; flex-shrink: 0;
}

/* ── Layout ── */
.layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
  margin-top: var(--header-h);
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0 2rem;
  z-index: 100;
}

.nav-group { margin-bottom: 0.1rem; }

.nav-group-label {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.85rem 1rem 0.2rem;
}

.nav-link {
  display: block;
  padding: 0.32rem 1rem 0.32rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text);
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-link:hover { background: #dbeafe; color: var(--blue); text-decoration: none; }
.nav-link.active { border-left-color: var(--teal); background: var(--teal-light); color: var(--blue); font-weight: 600; }
.nav-link.active:hover { text-decoration: none; }

/* ── Main content ── */
.main-content {
  flex: 1;
  padding: 1.75rem 2rem 2.5rem;
  min-width: 0;
}

/* ── Page title ── */
.page-title {
  font-size: 1.5rem; color: var(--blue);
  border-bottom: 2px solid var(--teal);
  padding-bottom: 0.5rem; margin: 0 0 1.5rem;
}

/* ── Home page ── */
.intro-text {
  background: var(--blue-light);
  border-left: 4px solid var(--blue);
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.elections-banner {
  background: linear-gradient(135deg, var(--blue) 0%, #1976d2 55%, var(--teal) 100%);
  color: white;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
}
.elections-banner h2 { color: white; margin: 0 0 0.75rem; font-size: 1.1rem; }
.election-links { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.election-link {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  color: white; font-weight: 600; font-size: 0.875rem;
  padding: 0.35rem 0.85rem; border-radius: 4px;
}
.election-link:hover { background: rgba(255,255,255,0.28); color: white; text-decoration: none; }

.section-label {
  font-size: 0.875rem; font-weight: 700; color: var(--blue);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}
.section-label:first-of-type { margin-top: 0; }

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.resource-card {
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.875rem 1rem;
}
.resource-card h4 {
  font-size: 0.85rem; color: var(--blue);
  margin: 0 0 0.5rem; font-weight: 700;
  text-transform: none; letter-spacing: 0;
}
.resource-card ul { list-style: none; padding: 0; margin: 0; }
.resource-card li { font-size: 0.85rem; margin: 0.2rem 0; }

/* ── Resource page content ── */
.content-section h5 {
  color: var(--blue);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
  margin: 1.75rem 0 0.75rem;
}
.content-section h5:first-child { margin-top: 0; }
.content-section ul { margin: 0.25rem 0 1rem; }
.content-section li { margin: 0.3rem 0; }

/* ── Elections page ── */
.elections-content h5 {
  color: var(--blue);
  font-size: 1rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  border-bottom: 2px solid var(--teal-light);
  padding-bottom: 0.35rem;
  margin: 2rem 0 0.75rem;
}
.elections-content h5:first-child { margin-top: 0; }

.past-election-note {
  background: #fff8e1;
  border: 1px solid #ffc107;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #664d00;
  margin-bottom: 1rem;
}

/* ── Candidate tables ── */
table.no-borders,
table.no-borders th,
table.no-borders td {
  border: none !important;
  border-collapse: collapse;
  box-shadow: none !important;
  background: transparent !important;
}
table.no-borders th,
table.no-borders td {
  padding: 0.25rem 0.5rem;
}
table.no-borders thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border) !important;
  background: transparent !important;
}

.candidate-photo {
  height: 2.1em; width: 2.1em;
  object-fit: cover; border-radius: 50%;
  vertical-align: middle; margin-right: 0.45rem;
  border: 1px solid #c9d2dc;
}
.house-candidates .candidate-photo-col { width: 2.8em; white-space: nowrap; vertical-align: middle; }
.house-candidates .candidate-name-col { white-space: nowrap; vertical-align: middle; }
.house-candidates .candidate-photo-col .candidate-photo { display: block !important; margin-right: 0; }
.house-candidates .candidate-district-col { width: 3.4em; white-space: nowrap; text-align: right; vertical-align: middle; font-variant-numeric: tabular-nums; }

tr.highlight td { background-color: #e0f7fa !important; }

.map-link { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.875rem; font-weight: 600; }
.map-link img { height: 1.6em; width: auto; display: inline-block; }

/* ── About page ── */
.about-content h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; color: var(--blue-mid); }
.about-content h3 { font-size: 1rem; margin: 1.25rem 0 0.4rem; }
.about-content blockquote { background: var(--blue-light); font-style: normal; border-radius: 0 4px 4px 0; padding: 0.75rem 1rem; }
.about-content ul { margin: 0.4rem 0 0.75rem; }
.about-content li { margin: 0.25rem 0; }

/* ── Footer ── */
.site-footer {
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  font-size: 0.8rem; color: var(--text-muted);
  text-align: center;
}
.site-footer p { margin: 0.15rem 0; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--blue); text-decoration: none; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .hamburger { display: block; }
  .header-links { display: none; }

  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: calc(-1 * var(--sidebar-w) - 10px);
    height: calc(100vh - var(--header-h));
    transition: left 0.25s ease;
    box-shadow: none;
    z-index: 150;
  }
  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 16px rgba(0,0,0,0.18);
  }

  .main-content { padding: 1rem; }
  .resource-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .resource-grid { grid-template-columns: 1fr; }
  .election-links { flex-direction: column; }
  .house-candidates .candidate-name-col { white-space: normal; }
}
