/*
 * CM Election Predictions — modern editorial foundation.
 * This intentionally sits after legacy page styles so the site can migrate
 * toward a smaller component system without disrupting its live-data logic.
 */
:root {
  --cmep-ink: #071528;
  --cmep-ink-soft: #16263a;
  --cmep-paper: #f5f7fb;
  --cmep-surface: rgba(255, 255, 255, 0.96);
  --cmep-line: rgba(15, 35, 60, 0.12);
  --cmep-muted: #607089;
  --cmep-gold: #e5b83f;
  --cmep-blue: #1976d2;
  --cmep-red: #d94a45;
  --cmep-radius-sm: 12px;
  --cmep-radius: 18px;
  --cmep-radius-lg: 26px;
  --cmep-shadow-sm: 0 1px 2px rgba(7, 21, 40, 0.04), 0 8px 24px rgba(7, 21, 40, 0.06);
  --cmep-shadow: 0 2px 4px rgba(7, 21, 40, 0.05), 0 18px 50px rgba(7, 21, 40, 0.09);
  --cmep-content: 1240px;
  --cmep-font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html {
  color-scheme: light;
  scroll-padding-top: 6rem;
  background: var(--cmep-paper);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(25, 118, 210, 0.07), transparent 28rem),
    radial-gradient(circle at 90% 14%, rgba(229, 184, 63, 0.06), transparent 24rem),
    var(--cmep-paper);
  color: var(--cmep-ink);
  font-family: var(--cmep-font);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

main {
  isolation: isolate;
}

:where(.container, .shell, .page-shell, .about-shell, .wrap, .wrapper) {
  width: min(calc(100% - 2rem), var(--cmep-content));
  margin-inline: auto;
}

:where(h1, h2, h3) {
  color: var(--cmep-ink);
  letter-spacing: -0.025em;
  text-wrap: balance;
}

:where(p, li) {
  text-wrap: pretty;
}

:where(.cm-card, .card, .about-card, .about-faq-card, .forecast-card, .race-card, .state-card, .district-card) {
  border-color: var(--cmep-line) !important;
  border-radius: var(--cmep-radius) !important;
  background: var(--cmep-surface);
  box-shadow: var(--cmep-shadow-sm);
}

:where(button, .btn, .button, .cm-btn, [role="button"]) {
  border-radius: 999px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

@media (prefers-reduced-motion: no-preference) {
  :where(a, button, .btn, .button, .cm-btn, .card, .cm-card) {
    transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease,
      box-shadow 160ms ease, transform 160ms ease;
  }

  :where(button, .btn, .button, .cm-btn):hover {
    transform: translateY(-1px);
  }
}

body.cmep-home-page .forecast-grid {
  align-items: start;
  gap: clamp(1rem, 2vw, 1.5rem);
}

body.cmep-home-page .forecast-grid > .cm-card {
  overflow: clip;
  box-shadow: var(--cmep-shadow);
}

body.cmep-home-page #changelog-section {
  content-visibility: auto;
  contain-intrinsic-size: 720px;
}

:where(.cm-card, .card, .race-card, .state-card, .district-card):not(:first-child) {
  content-visibility: auto;
  contain-intrinsic-size: 420px;
}

.cmep-data-note {
  color: var(--cmep-muted);
  font-size: 0.82rem;
}

@media (max-width: 760px) {
  :where(.container, .shell, .page-shell, .about-shell, .wrap, .wrapper) {
    width: min(calc(100% - 1rem), var(--cmep-content));
  }

}

@media (forced-colors: active) {
  :where(.cm-card, .card, button, .btn, .button, .cm-btn) {
    border: 1px solid CanvasText !important;
  }
}
