/* ═══════════════════════════════════════════════════════════════════════
   NH Executive Council — Design System v5
   Data-first. Bloomberg Terminal meets ProPublica.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --navy: #0f172a;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-bg: #eff6ff;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --purple: #7c3aed;
  --purple-bg: #f5f3ff;

  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --bg-wash: #f8fafc;
  --bg-white: #ffffff;

  --radius: 8px;
  --radius-sm: 3px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

/* ── Reset ──────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  font-size: 15px;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; color: var(--navy); line-height: 1.3; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-hover); text-decoration: underline; }
img, svg { vertical-align: middle; max-width: 100%; }
table { border-collapse: collapse; }

/* ── Sticky Nav ─────────────────────────────────────────────────── */

.site-nav {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid #1e3a5f;
}

.site-nav .nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.site-logo {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.site-logo:hover { color: #fff; text-decoration: none; }

.nav-center {
  display: flex;
  align-items: center;
  gap: 1px;
}

.nav-link {
  padding: 6px 11px;
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  border-radius: 4px;
  text-decoration: none;
  transition: color 0.1s, background 0.1s;
  white-space: nowrap;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.08); text-decoration: none; }
.nav-link.active { color: #fff; background: rgba(255,255,255,0.12); font-weight: 600; }

/* Nav search */
.nav-search {
  position: relative;
  width: 220px;
}
.nav-search input {
  width: 100%;
  padding: 6px 12px 6px 32px;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #fff;
  outline: none;
  transition: background 0.15s, border-color 0.15s;
}
.nav-search input::placeholder { color: rgba(255,255,255,0.35); }
.nav-search input:focus {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.3);
}
.nav-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: rgba(255,255,255,0.35);
  pointer-events: none;
}

/* Mobile menu */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 4px;
}
.nav-toggle svg { width: 24px; height: 24px; }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav-center {
    display: none;
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--navy);
    flex-direction: column;
    padding: 8px 16px 16px;
    border-bottom: 2px solid #1e3a5f;
  }
  .nav-center.open { display: flex; }
  .nav-link { padding: 10px 12px; width: 100%; }
  .nav-search { width: 100%; margin-top: 8px; }
}

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

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-wrap {
  padding: 32px 0 80px;
}

/* ── Badges ─────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  text-transform: capitalize;
}

.badge-approved { background: var(--green-bg); color: var(--green); }
.badge-denied   { background: var(--red-bg); color: var(--red); }
.badge-tabled   { background: var(--amber-bg); color: var(--amber); }
.badge-withdrawn { background: var(--border-light); color: var(--text-secondary); }
.badge-confirmed { background: var(--blue-bg); color: var(--blue); }
.badge-nomination { background: var(--purple-bg); color: var(--purple); }
.badge-resignation { background: var(--amber-bg); color: var(--amber); }
.badge-r { background: var(--red-bg); color: var(--red); }
.badge-d { background: var(--blue-bg); color: var(--blue); }
.badge-type {
  background: var(--border-light);
  color: var(--text-secondary);
  font-size: 0.65rem;
  padding: 1px 6px;
}

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

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-wash);
}

.card-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
}
.card-link:hover { text-decoration: underline; }

.card-body { padding: 20px; }

/* ── Data Tables ────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table thead th {
  padding: 10px 16px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: var(--bg-wash);
}
.data-table thead th.text-right { text-align: right; }
.data-table thead th.text-center { text-align: center; }

.data-table tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.data-table tbody tr:hover { background: var(--blue-bg); }

/* Contested row */
.data-table tbody tr.row-contested { background: var(--red-bg); }
.data-table tbody tr.row-contested:hover { background: #fde8e8; }

.data-table .mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.data-table .text-right { text-align: right; }
.data-table .text-center { text-align: center; }

.data-table a { font-weight: 600; }
.data-table a:hover { text-decoration: underline; }

/* Clickable row */
.data-table tbody tr.clickable-row { cursor: pointer; }
.data-table tbody tr.clickable-row:hover { background: var(--blue-bg); }

/* ── Stat Grid ──────────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat-cell {
  background: var(--bg-white);
  padding: 16px 20px;
  text-align: center;
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  margin-top: 2px;
}

/* ── Vote Chips ─────────────────────────────────────────────────── */

.vote-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}

.vote-chip-yes { background: var(--green-bg); color: var(--green); }
.vote-chip-no { background: var(--red-bg); color: var(--red); }
.vote-chip-abstain { background: var(--border-light); color: var(--text-secondary); }

/* ── Vote Bars ──────────────────────────────────────────────────── */

.vote-bar-wrap { margin-bottom: 14px; }
.vote-bar-wrap:last-child { margin-bottom: 0; }

.vote-bar-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}
.vote-bar-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: capitalize;
}
.vote-bar-label.yes { color: var(--green); }
.vote-bar-label.no { color: var(--red); }
.vote-bar-label.abstain { color: var(--text-muted); }

.vote-bar-count {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
}

.vote-bar-track {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}
.vote-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.vote-bar-fill.yes { background: var(--green); }
.vote-bar-fill.no { background: var(--red); }
.vote-bar-fill.abstain { background: var(--text-muted); }

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

.councilor-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--bg-white);
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s;
}
.councilor-card:hover { border-color: var(--blue); color: inherit; text-decoration: none; }

.councilor-card .party-stripe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.councilor-card .party-stripe.r { background: var(--red); }
.councilor-card .party-stripe.d { background: var(--blue); }

/* ── Dissent Marker ─────────────────────────────────────────────── */

.dissent-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--red);
}

/* ── Buttons ────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); color: #fff; }

.btn-outline {
  background: var(--bg-white);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { background: var(--bg-wash); color: var(--text-primary); }

.btn-sm { padding: 4px 10px; font-size: 0.75rem; }

/* ── Inputs ─────────────────────────────────────────────────────── */

.form-input {
  padding: 8px 12px;
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-white);
  color: var(--text-primary);
  outline: none;
}
.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

.form-select {
  padding: 8px 32px 8px 12px;
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-white);
  color: var(--text-primary);
  outline: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.form-select:focus { border-color: var(--blue); }

/* ── Pagination ─────────────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}

.page-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
}
.page-btn:hover { background: var(--bg-wash); color: var(--text-primary); text-decoration: none; }

.page-info { font-size: 0.8rem; color: var(--text-muted); }

/* ── PDF Embed ──────────────────────────────────────────────────── */

.pdf-embed {
  width: 100%;
  height: 800px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-wash);
}

@media (max-width: 768px) {
  .pdf-embed { height: 500px; }
}

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

.site-footer {
  margin-top: 64px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.site-footer a { color: var(--blue); }

/* ── Empty State ────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}

/* ── Print ──────────────────────────────────────────────────────── */

@media print {
  .site-nav, .site-footer, .pagination, .btn, .nav-search { display: none !important; }
  body { background: #fff; }
  .card { border: 1px solid #ddd; }
  .pdf-embed { display: none; }
}
