@font-face {
  font-family: "Merriweather";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/merriweather-400.woff2") format("woff2");
}

@font-face {
  font-family: "Merriweather";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/merriweather-700.woff2") format("woff2");
}

@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/open-sans-600.woff2") format("woff2");
}

@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/open-sans-700.woff2") format("woff2");
}

:root {
  --ink: #333;
  --muted: #666;
  --line: #d9d9d9;
  --red: #ed1c24;
  --blue: #1778b6;
  --yellow: #fff4a6;
}

* { box-sizing: border-box; }

html { background: transparent; }

body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: "Merriweather", Georgia, "Times New Roman", serif;
  line-height: 1.5;
}

button, select { font: inherit; }

.page-shell {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 0 0 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  padding: 13px 0 12px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 4px solid var(--red);
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.state-picker { display: flex; align-items: center; gap: 10px; }
.state-picker label, .priority-filters > span {
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.state-picker select {
  width: 220px;
  padding: 9px 34px 9px 11px;
  border: 1px solid #aaa;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: "Open Sans", Arial, sans-serif;
}

.state-picker select:focus-visible { border-color: var(--red); box-shadow: 0 0 0 2px rgba(237,28,36,.12); }

.priority-filters { display: flex; align-items: center; gap: 7px; }
.priority-filters > span { margin-right: 2px; color: var(--muted); }

.priority-filters button {
  display: inline-flex;
  padding: 8px 10px;
  align-items: center;
  gap: 7px;
  border: 1px solid #aaa;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 12px;
}

.priority-filters button:hover, .priority-filters button.is-active { border-color: var(--red); background: transparent; color: var(--red); }
.priority-filters i, .legend i { width: 10px; height: 10px; border: 1px solid rgba(0,0,0,.32); border-radius: 50%; }

.map-card {
  position: relative;
  padding: 22px 0 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.map-heading {
  position: relative;
  display: flex;
  margin-bottom: 14px;
  padding: 0 4px 16px;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.map-heading::after {
  position: absolute;
  bottom: -2px;
  left: 4px;
  width: 150px;
  height: 3px;
  background: var(--red);
  content: "";
}

.map-heading h2 { margin: 0; font-family: "Merriweather", Georgia, serif; font-size: 30px; line-height: 1.3; }
.map-heading > p {
  margin: 0 4px 2px 0;
  color: var(--muted);
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 12px;
}

.mouse-icon {
  display: inline-block;
  width: 11px;
  height: 15px;
  margin-right: 5px;
  vertical-align: -3px;
  border: 1.5px solid currentColor;
  border-radius: 6px;
}

.map-stage {
  position: relative;
  min-height: 720px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.map-stage svg {
  display: block;
  width: min(78%, 830px);
  height: auto;
  margin: 0 auto;
  overflow: visible;
}

.state-shape {
  fill: #d8dad5;
  stroke: #fffefa;
  stroke-width: 1.35;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill .16s ease, opacity .16s ease;
}

.state-shape.has-data { fill: #cfd2cc; }
.state-shape:hover, .state-shape:focus-visible, .state-shape.is-selected { fill: #aeb5a9; outline: none; }

.outline-layer path {
  fill: none;
  stroke: #40443f;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.district-marker { cursor: default; transition: opacity .16s ease; }
.district-marker circle { stroke: #30332f; stroke-width: 1.05; vector-effect: non-scaling-stroke; }
.district-marker text {
  fill: #111;
  font-size: 6.1px;
  font-weight: 850;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.district-marker.is-in-state circle { stroke-width: 1.5; }
.district-marker.is-in-state text { font-size: 7px; }
.district-marker.is-muted { opacity: .1; pointer-events: none; }

.district-tooltip rect { fill: #fff; stroke: #aaa; }
.district-tooltip text { fill: #555; font-family: "Open Sans", Arial, sans-serif; font-size: 10.5px; }
.district-tooltip .district-tooltip__name { fill: var(--ink); font-size: 12px; font-weight: 700; }

.state-panel {
  position: absolute;
  z-index: 20;
  top: 18px;
  right: 18px;
  display: flex;
  width: min(388px, calc(100% - 36px));
  max-height: calc(100% - 36px);
  overflow: hidden;
  flex-direction: column;
  border: 1px solid #aaa;
  border-radius: 0;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

.state-panel__header {
  display: flex;
  padding: 18px 18px 13px;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 3px solid var(--red);
}

.state-panel h2 { margin: 0; font-family: "Merriweather", Georgia, serif; font-size: 24px; line-height: 1.2; }
.state-panel__count { margin: 7px 0 0; color: var(--muted); font-family: "Open Sans", Arial, sans-serif; font-size: 12px; }

.panel-close {
  width: 31px;
  height: 31px;
  border: 1px solid #aaa;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  color: var(--ink);
  font-size: 22px;
  line-height: 26px;
}

.panel-close:hover { border-color: var(--red); background: transparent; color: var(--red); }

.district-table-wrap { overflow: auto; overscroll-behavior: contain; }
.district-table { width: 100%; border-collapse: collapse; font-family: "Open Sans", Arial, sans-serif; font-size: 12px; }
.district-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  padding: 10px 12px;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
  text-align: left;
  text-transform: uppercase;
}
.district-table th:nth-child(2), .district-table th:nth-child(3),
.district-table td:nth-child(2), .district-table td:nth-child(3) { text-align: center; }
.district-table td { padding: 9px 12px; border-top: 1px solid #e6e6e6; }
.district-table td:first-child { font-weight: 700; }

.priority-cell {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(0,0,0,.28);
  border-radius: 50%;
  color: #111;
  font-weight: 850;
}
.priority-cell--1 { background: var(--red); }
.priority-cell--2 { background: var(--blue); color: white; }
.priority-cell--3 { background: var(--yellow); }
.empty-state { margin: 0; padding: 20px; color: #676a64; font-size: 13px; line-height: 1.5; }

.legend {
  padding: 16px 6px 2px;
  color: var(--muted);
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 12px;
  line-height: 1.5;
}
.legend__title { margin-bottom: 9px; color: var(--ink); font-weight: 700; }
.legend__items { display: grid; gap: 7px; }
.legend__item { display: flex; align-items: flex-start; gap: 8px; }
.legend__item i { flex: 0 0 auto; margin-top: 4px; }
.legend__item strong { color: var(--ink); }
.legend__source {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}
.legend__forecast {
  margin: 8px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
}

.map-loading {
  display: grid;
  min-height: 720px;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 13px;
}
.map-loading span {
  width: 26px;
  height: 26px;
  border: 3px solid #d9d5cb;
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .toolbar { align-items: stretch; flex-direction: column; }
  .state-picker { justify-content: space-between; }
  .priority-filters { flex-wrap: wrap; }
  .map-stage { min-height: 620px; }
  .map-stage svg { width: 100%; }
  .state-panel { top: auto; right: 10px; bottom: 10px; width: calc(100% - 20px); max-height: 48%; }
}

@media (max-width: 560px) {
  .page-shell { width: 100%; padding-top: 0; }
  .state-picker { align-items: flex-start; flex-direction: column; }
  .state-picker select { width: 100%; }
  .priority-filters > span { width: 100%; }
  .priority-filters button { flex: 1; justify-content: center; white-space: nowrap; }
  .map-card { padding: 16px 0 10px; }
  .map-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .map-stage { min-height: 550px; }
  .map-stage svg { transform: translateY(8px); }
  .district-marker text { display: none; }
  .state-panel { max-height: 54%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
