/* ============================================
   METG — Design Tokens & Component Styles
   Missourians for Ethical and Transparent Government
   ============================================ */

/* --- Type Scale --- */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 5rem);

  /* --- Spacing (4px base) --- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* --- Radius --- */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* --- Transitions --- */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* --- Content widths --- */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;

  /* --- Font families --- */
  --font-display: 'Playfair Display', 'Georgia', serif;
  --font-body: 'Source Sans 3', 'Helvetica Neue', sans-serif;
}

/* --- LIGHT MODE (Default) --- */
:root,
[data-theme='light'] {
  /* Surfaces — warm ivory/parchment civic feel */
  --color-bg: #f5f4f0;
  --color-surface: #ffffff;
  --color-surface-2: #fafaf8;
  --color-surface-offset: #eceae4;
  --color-surface-offset-2: #e4e2dc;
  --color-surface-dynamic: #dddbd5;
  --color-divider: #d0cec8;
  --color-border: #c4c2bc;

  /* Text */
  --color-text: #1a1a2e;
  --color-text-muted: #5c5c6e;
  --color-text-faint: #9a9aac;
  --color-text-inverse: #f5f4f0;

  /* Primary — Deep Navy (from logo) */
  --color-primary: #1b2a4a;
  --color-primary-hover: #142140;
  --color-primary-active: #0d1830;
  --color-primary-highlight: #d8dce6;

  /* Accent — Crimson Red (from logo) */
  --color-accent: #8b1a1a;
  --color-accent-hover: #6e1414;
  --color-accent-active: #520f0f;
  --color-accent-highlight: #f0d4d4;

  /* Status Colors */
  --color-warning: #b45309;
  --color-warning-highlight: #fef3c7;
  --color-success: #15803d;
  --color-success-highlight: #dcfce7;
  --color-error: #b91c1c;
  --color-error-highlight: #fee2e2;
  --color-info: #1d4ed8;
  --color-info-highlight: #dbeafe;

  /* Investigation Status */
  --color-status-monitoring: #b45309;
  --color-status-requested: #1d4ed8;
  --color-status-review: #7c3aed;
  --color-status-published: #15803d;
  --color-status-closed: #6b7280;

  /* Shadows */
  --shadow-sm: 0 1px 2px oklch(0.2 0.01 250 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 250 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 250 / 0.12);
}

/* --- DARK MODE --- */
[data-theme='dark'] {
  --color-bg: #0f1118;
  --color-surface: #171923;
  --color-surface-2: #1c1f2e;
  --color-surface-offset: #1a1d2a;
  --color-surface-offset-2: #22253a;
  --color-surface-dynamic: #2a2d42;
  --color-divider: #2d3048;
  --color-border: #3a3d55;

  --color-text: #d4d4e0;
  --color-text-muted: #8888a0;
  --color-text-faint: #5a5a72;
  --color-text-inverse: #0f1118;

  --color-primary: #7b9fd4;
  --color-primary-hover: #5d87c4;
  --color-primary-active: #4070b0;
  --color-primary-highlight: #1e2a40;

  --color-accent: #d47b7b;
  --color-accent-hover: #c45e5e;
  --color-accent-active: #b44444;
  --color-accent-highlight: #3a1e1e;

  --color-warning: #f59e0b;
  --color-warning-highlight: #3a2a0a;
  --color-success: #22c55e;
  --color-success-highlight: #0a2a16;
  --color-error: #ef4444;
  --color-error-highlight: #3a0a0a;
  --color-info: #60a5fa;
  --color-info-highlight: #0a1a3a;

  --color-status-monitoring: #f59e0b;
  --color-status-requested: #60a5fa;
  --color-status-review: #a78bfa;
  --color-status-published: #22c55e;
  --color-status-closed: #9ca3af;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0f1118;
    --color-surface: #171923;
    --color-surface-2: #1c1f2e;
    --color-surface-offset: #1a1d2a;
    --color-surface-offset-2: #22253a;
    --color-surface-dynamic: #2a2d42;
    --color-divider: #2d3048;
    --color-border: #3a3d55;
    --color-text: #d4d4e0;
    --color-text-muted: #8888a0;
    --color-text-faint: #5a5a72;
    --color-text-inverse: #0f1118;
    --color-primary: #7b9fd4;
    --color-primary-hover: #5d87c4;
    --color-primary-active: #4070b0;
    --color-primary-highlight: #1e2a40;
    --color-accent: #d47b7b;
    --color-accent-hover: #c45e5e;
    --color-accent-active: #b44444;
    --color-accent-highlight: #3a1e1e;
    --color-warning: #f59e0b;
    --color-warning-highlight: #3a2a0a;
    --color-success: #22c55e;
    --color-success-highlight: #0a2a16;
    --color-error: #ef4444;
    --color-error-highlight: #3a0a0a;
    --color-info: #60a5fa;
    --color-info-highlight: #0a1a3a;
    --color-status-monitoring: #f59e0b;
    --color-status-requested: #60a5fa;
    --color-status-review: #a78bfa;
    --color-status-published: #22c55e;
    --color-status-closed: #9ca3af;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
    --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
  }
}

/* ============================================
   GLOBAL COMPONENTS
   ============================================ */

/* --- Skip Link --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  z-index: 100;
  font-size: var(--text-sm);
}
.skip-link:focus {
  top: var(--space-2);
}

/* --- Container --- */
.container {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
.container--narrow {
  max-width: var(--content-default);
}
.container--tight {
  max-width: var(--content-narrow);
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: oklch(from var(--color-bg) l c h / 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-divider);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.site-header--scrolled {
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-3);
  gap: var(--space-4);
}
.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text);
  flex-shrink: 0;
}
.header-logo img {
  height: 44px;
  width: auto;
}
.header-logo-text {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-primary);
}

/* --- Nav --- */
.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.main-nav a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  white-space: nowrap;
}
.main-nav a:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}
.main-nav a.active {
  color: var(--color-primary);
  background: var(--color-primary-highlight);
}
.nav-donate {
  background: var(--color-accent) !important;
  color: var(--color-text-inverse) !important;
  font-weight: 600 !important;
  padding: var(--space-2) var(--space-4) !important;
  border-radius: var(--radius-full) !important;
}
.nav-donate:hover {
  background: var(--color-accent-hover) !important;
}

/* --- Mobile Nav --- */
.mobile-menu-btn {
  display: none;
  padding: var(--space-2);
  color: var(--color-text);
}
.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  top: 0;
  background: var(--color-bg);
  z-index: 60;
  flex-direction: column;
  padding: var(--space-4);
  overflow-y: auto;
}
.mobile-nav.open {
  display: flex;
}
.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: var(--space-4);
}
.mobile-nav a {
  display: block;
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--color-divider);
}
.mobile-nav a:last-child {
  border-bottom: none;
}

@media (max-width: 1023px) {
  .main-nav {
    display: none;
  }
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .header-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }
}

/* --- Theme Toggle --- */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  color: var(--color-text-muted);
  border-radius: var(--radius-md);
}
.theme-toggle:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  min-height: 44px;
}
.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
}
.btn-accent {
  background: var(--color-accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--color-accent-hover);
}
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}
.btn-outline:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  min-height: 36px;
}
.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

/* --- Card Grid --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-6);
}
@media (max-width: 600px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}
.card:hover {
  box-shadow: var(--shadow-md);
}
a.card {
  text-decoration: none;
  color: inherit;
  display: block;
}
a.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.card-link:hover .card {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4);
  color: var(--color-accent);
}
.card h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}
.card > p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-monitoring {
  background: var(--color-warning-highlight);
  color: var(--color-status-monitoring);
}
.badge-requested {
  background: var(--color-info-highlight);
  color: var(--color-status-requested);
}
.badge-review {
  background: #f3e8ff;
  color: var(--color-status-review);
}
[data-theme='dark'] .badge-review {
  background: #2a1a3a;
}
.badge-published {
  background: var(--color-success-highlight);
  color: var(--color-status-published);
}
.badge-closed {
  background: var(--color-surface-offset);
  color: var(--color-status-closed);
}
.badge-county {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding-block: var(--space-4);
}
.breadcrumbs a {
  color: var(--color-text-muted);
  text-decoration: none;
}
.breadcrumbs a:hover {
  color: var(--color-primary);
}
.breadcrumbs span {
  color: var(--color-text-faint);
}

/* --- Section Layout --- */
.section {
  padding-block: clamp(var(--space-12), 6vw, var(--space-24));
}
.section-header {
  margin-bottom: var(--space-8);
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.section-header p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 60ch;
}
.section-header .overline {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

/* --- Grid Layouts --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr));
  gap: var(--space-6);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: var(--space-6);
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: var(--space-4);
}

/* --- Stats Row --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-4);
}
.stat-card {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
}
.stat-number {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
  margin-bottom: var(--space-1);
}
.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Hero --- */
.hero {
  position: relative;
  padding-block: clamp(var(--space-16), 10vw, var(--space-32));
  background: var(--color-primary);
  color: var(--color-text-inverse);
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--color-primary) 0%, #0d1830 100%);
  z-index: 0;
}
.hero-bg-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.12;
  mix-blend-mode: luminosity;
}
.hero .container {
  position: relative;
  z-index: 1;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-4);
  max-width: 20ch;
}
.hero p {
  font-size: var(--text-base);
  opacity: 0.85;
  max-width: 55ch;
  margin-bottom: var(--space-6);
  line-height: 1.7;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.hero .btn-accent {
  background: var(--color-accent);
}
.hero .btn-accent:hover {
  background: var(--color-accent-hover);
}
.hero .btn-outline {
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}
.hero .btn-outline:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.6);
}

/* Hero pattern overlay */
.hero-pattern {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.04;
  background-image: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 40px,
      rgba(255,255,255,0.5) 40px,
      rgba(255,255,255,0.5) 41px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 40px,
      rgba(255,255,255,0.5) 40px,
      rgba(255,255,255,0.5) 41px
    );
}

/* Faded background image utility */
.section-bg-image {
  position: relative;
}
.section-bg-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.06;
  z-index: 0;
  pointer-events: none;
}
.section-bg-image > * {
  position: relative;
  z-index: 1;
}

/* Image card with overlay */
.image-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16/9;
}
.image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-6);
  color: #fff;
}
.image-card-overlay h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin-bottom: var(--space-1);
}
.image-card-overlay p {
  font-size: var(--text-sm);
  opacity: 0.8;
}

/* Section with background photo */
.photo-section {
  position: relative;
  overflow: hidden;
}
.photo-section-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.photo-section-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.08;
}
[data-theme="dark"] .photo-section-bg img {
  opacity: 0.05;
}
.photo-section > .container {
  position: relative;
  z-index: 1;
}

/* Investigation card with thumbnail */
.investigation-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* --- Page Header (non-hero) --- */
.page-header {
  background: var(--color-surface-offset);
  padding-block: clamp(var(--space-8), 5vw, var(--space-16));
  border-bottom: 1px solid var(--color-divider);
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.page-header p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 60ch;
}

/* --- Footer --- */
.site-footer {
  background: var(--color-primary);
  color: rgba(255,255,255,0.8);
  padding-block: var(--space-16) var(--space-8);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-8);
  margin-bottom: var(--space-12);
}
@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}
.footer-brand p {
  font-size: var(--text-sm);
  max-width: 35ch;
  line-height: 1.6;
  opacity: 0.7;
  margin-top: var(--space-3);
}
.footer-col h4 {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-4);
  color: #fff;
}
.footer-col ul {
  list-style: none;
}
.footer-col li {
  margin-bottom: var(--space-2);
}
.footer-col a {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.65);
  text-decoration: none;
}
.footer-col a:hover {
  color: #fff;
}
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: var(--space-6);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.5);
}
.footer-disclaimer {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.45);
  max-width: 65ch;
  margin-top: var(--space-6);
  line-height: 1.6;
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* --- Forms --- */
.form-group {
  margin-bottom: var(--space-5);
}
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.15);
}
.form-textarea {
  resize: vertical;
  min-height: 120px;
}
.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* --- Checkbox / Radio --- */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}
.form-check label {
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
}

/* --- Tables --- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
}
.data-table {
  width: 100%;
  font-size: var(--text-sm);
}
.data-table th {
  text-align: left;
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-divider);
  white-space: nowrap;
}
.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.06);
  color: var(--color-text);
}
.data-table tbody tr:hover {
  background: var(--color-surface-offset);
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 2px solid var(--color-divider);
  margin-bottom: var(--space-6);
  overflow-x: auto;
}
.tab-btn {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
}
.tab-btn:hover {
  color: var(--color-text);
}
.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* --- Filters --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  align-items: center;
}
.filter-bar .form-select {
  width: auto;
  min-width: 160px;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}
.search-input-wrap input {
  width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-10);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}
.search-input-wrap svg {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  width: 16px;
  height: 16px;
}

/* --- Timeline --- */
.timeline {
  position: relative;
  padding-left: var(--space-8);
}
.timeline::before {
  content: '';
  position: absolute;
  left: var(--space-3);
  top: var(--space-2);
  bottom: var(--space-2);
  width: 2px;
  background: var(--color-divider);
}
.timeline-item {
  position: relative;
  margin-bottom: var(--space-6);
}
.timeline-dot {
  position: absolute;
  left: calc(-1 * var(--space-8) + var(--space-1));
  top: var(--space-1);
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  border: 2px solid var(--color-bg);
}
.timeline-date {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}
.timeline-title {
  font-weight: 600;
  margin-bottom: var(--space-1);
}
.timeline-body {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* --- Alert / Notice --- */
.notice {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
  align-items: flex-start;
}
.notice-info {
  background: var(--color-info-highlight);
  color: var(--color-info);
}
.notice-warning {
  background: var(--color-warning-highlight);
  color: var(--color-warning);
}
.notice svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* --- Tooltip --- */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: var(--color-text-inverse);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
[data-tooltip]:hover::after {
  opacity: 1;
}

/* --- County Map --- */
.county-map-container {
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
}
.county-map-container svg {
  width: 100%;
  height: auto;
}
.county-map-container path {
  fill: var(--color-surface-offset);
  stroke: var(--color-border);
  stroke-width: 0.5;
  cursor: pointer;
  transition: fill 0.2s;
}
.county-map-container path:hover {
  fill: var(--color-primary-highlight);
}
.county-map-container path.active-county {
  fill: var(--color-accent);
  fill-opacity: 0.3;
}

/* --- Entity Card --- */
.entity-card {
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}
.entity-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.entity-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-primary-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
}
.entity-info h3 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-1);
}
.entity-type {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}
.entity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.entity-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* --- Investigation Card --- */
.investigation-card {
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition-interactive);
}
.investigation-card:hover {
  box-shadow: var(--shadow-md);
}
.investigation-card-body {
  padding: var(--space-5);
}
.investigation-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.investigation-card h3 {
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.3;
}
.investigation-card h3 a {
  color: var(--color-text);
  text-decoration: none;
}
.investigation-card h3 a:hover {
  color: var(--color-primary);
}
.investigation-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.investigation-card-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.investigation-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* --- Donate Box --- */
.donate-hero {
  background: linear-gradient(135deg, var(--color-accent) 0%, #6e1414 100%);
  color: #fff;
  padding: clamp(var(--space-12), 6vw, var(--space-20));
  border-radius: var(--radius-xl);
  text-align: center;
}
.donate-hero h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
}
.donate-hero p {
  max-width: 50ch;
  margin-inline: auto;
  opacity: 0.85;
  margin-bottom: var(--space-6);
}
.donate-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: #fff;
  color: var(--color-accent);
  font-size: var(--text-base);
  font-weight: 700;
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: transform var(--transition-interactive),
    box-shadow var(--transition-interactive);
}
.donate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* --- Scroll Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none; }

/* ============================================
   LEGAL & COMPLIANCE PAGES
   ============================================ */

/* Page Hero (light variant for legal/inner pages) */
.page-hero {
  padding: clamp(var(--space-12), 8vw, var(--space-24)) var(--space-6);
  text-align: left;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
}
.page-hero-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
}
.page-hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-text);
  margin-bottom: var(--space-4);
}
.page-hero .gold-rule {
  width: 80px;
  height: 3px;
  background: var(--color-accent);
  margin-bottom: var(--space-6);
  border: none;
}
.page-hero p {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 65ch;
  line-height: 1.6;
}

/* Page Container (content wrapper for legal pages) */
.page-container {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: clamp(var(--space-8), 6vw, var(--space-16)) var(--space-6);
}
.page-container.narrow {
  max-width: var(--content-default);
}

/* Legal Page Content */
.legal-content {
  max-width: var(--content-default);
  margin: 0 auto;
  padding: clamp(var(--space-8), 6vw, var(--space-16)) var(--space-6);
}
.legal-content h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.legal-content .last-updated {
  font-size: var(--text-sm);
  color: var(--color-text-faint);
  margin-bottom: var(--space-8);
}
.legal-content h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-divider);
}
.legal-content h3 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}
.legal-content p {
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
  line-height: 1.7;
}
.legal-content ul,
.legal-content ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
}
.legal-content li {
  margin-bottom: var(--space-2);
  color: var(--color-text-muted);
  line-height: 1.6;
}
.legal-content a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-content a:hover {
  color: var(--color-accent-hover);
}

/* Highlight Box (legal emphasis) */
.highlight-box {
  background: var(--color-surface);
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin: var(--space-6) 0;
}
.highlight-box p {
  color: var(--color-text);
  font-weight: 600;
  margin-bottom: 0;
}
.highlight-box p + p {
  margin-top: var(--space-2);
  font-weight: 400;
}

/* Info Box */
.info-box {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin: var(--space-6) 0;
}

/* Placeholder Notice */
.placeholder-notice {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin: var(--space-4) 0;
  text-align: center;
}
.placeholder-notice p {
  color: var(--color-text-faint);
  font-style: italic;
  margin: 0 auto;
}

/* Source Citations */
.sources {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
}
.sources h3 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}
.sources ul {
  list-style: none;
  padding: 0;
}
.sources li {
  font-size: var(--text-xs);
  margin-bottom: var(--space-2);
}
.sources a {
  color: var(--color-text-faint);
  text-decoration: underline;
  word-break: break-all;
}

/* FEC Disclaimer Box */
.fec-disclaimer {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin: var(--space-6) 0;
  font-style: italic;
}
.fec-disclaimer p {
  color: var(--color-text);
}

/* Compliance Hub Card Grid */
.legal-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-6);
}
.legal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-decoration: none;
  color: var(--color-text);
  transition: box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}
a.legal-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.legal-card-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4);
  color: var(--color-accent);
}
.legal-card h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}
.legal-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* ============================================
   COMPLIANCE CHECKLIST
   ============================================ */

.progress-bar-container {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
  border: 1px solid var(--color-divider);
}
.progress-bar-track {
  height: 12px;
  background: var(--color-surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-3);
}
.progress-bar-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
  width: 0%;
}
.progress-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

.checklist-section {
  margin-bottom: var(--space-6);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--color-surface);
  cursor: pointer;
  user-select: none;
  width: 100%;
  text-align: left;
  border: none;
  color: inherit;
  font: inherit;
}
.checklist-header:hover {
  background: var(--color-surface-2);
}
.checklist-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
  border: none;
  padding: 0;
}
.checklist-header .chevron {
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}
.checklist-header.open .chevron {
  transform: rotate(180deg);
}
.checklist-body {
  display: none;
  padding: var(--space-4) var(--space-6);
}
.checklist-body.open {
  display: block;
}
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-divider);
}
.checklist-item:last-child {
  border-bottom: none;
}
.checklist-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--color-accent);
  cursor: pointer;
}
.checklist-item label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 1.5;
}
.checklist-item.checked label {
  text-decoration: line-through;
  color: var(--color-text-faint);
}

/* Calendar Table */
.calendar-table {
  width: 100%;
  margin: var(--space-4) 0;
  border-collapse: collapse;
}
.calendar-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface);
  border-bottom: 2px solid var(--color-divider);
}
.calendar-table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: top;
}
.calendar-table tr:last-child td {
  border-bottom: none;
}

/* ============================================
   COOKIE CONSENT BANNER
   ============================================ */

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--color-surface-2);
  border-top: 1px solid var(--color-divider);
  padding: var(--space-4) var(--space-6);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
}
.cookie-banner.hidden {
  display: none;
}
.cookie-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.cookie-inner p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex: 1;
  min-width: 200px;
  margin: 0;
}
.cookie-inner a {
  color: var(--color-accent);
}
.cookie-buttons {
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}
.cookie-buttons .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  min-height: 44px;
  white-space: nowrap;
  border: none;
  font-family: inherit;
}
.cookie-buttons .btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.cookie-buttons .btn-primary:hover {
  background: var(--color-primary-hover);
}
.cookie-buttons .btn-secondary {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.cookie-buttons .btn-secondary:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

@media (max-width: 600px) {
  .legal-card-grid {
    grid-template-columns: 1fr;
  }
}
