/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: #f8f9fa;
  color: #1A1A1A;
  min-height: 100vh;
}

/* ── Root wrapper ─────────────────────────────────────────── */
#hh-map-root {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

/* ── Header ───────────────────────────────────────────────── */
.map-header {
  margin-bottom: 1.75rem;
}
.map-eyebrow {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #2E7D8C;
  margin-bottom: 6px;
}
.map-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(22px, 3.5vw, 34px);
  font-weight: 700;
  color: #0D2D35;
  line-height: 1.15;
  margin-bottom: 8px;
}
.map-subtitle {
  font-size: 13px;
  color: #5A6570;
  line-height: 1.6;
  max-width: 620px;
}

/* ── Filter strip ─────────────────────────────────────────── */
.filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 1.25rem;
}
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1.5px solid #CBD5DA;
  border-radius: 99px;
  background: #fff;
  color: #4A5568;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
}
.filter-btn:hover { border-color: #2E7D8C; color: #2E7D8C; }
.filter-btn.active {
  background: #0D2D35;
  border-color: #0D2D35;
  color: #fff;
}
.filter-btn .btn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Stat bar ─────────────────────────────────────────────── */
.stat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.25rem;
}
.stat-chip {
  background: #fff;
  border: 1px solid #E2E8EE;
  border-radius: 8px;
  padding: 7px 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #5A6570;
  min-width: 90px;
}
.stat-chip .stat-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #0D2D35;
  line-height: 1;
}
.stat-chip .stat-emoji { font-size: 14px; }

/* ── Map container ────────────────────────────────────────── */
.map-container {
  position: relative;
  background: #fff;
  border: 1px solid #E2E8EE;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.map-container svg {
  display: block;
  width: 100%;
  height: auto;
}
.state-path {
  stroke: #fff;
  stroke-width: 0.8;
  cursor: pointer;
  transition: opacity .15s ease, filter .15s ease;
}
.state-path:hover {
  opacity: .82;
  filter: brightness(1.08);
}
.state-mesh {
  fill: none;
  stroke: rgba(255,255,255,.5);
  stroke-width: .4;
  pointer-events: none;
}

/* ── Tooltip ──────────────────────────────────────────────── */
.map-tooltip {
  display: none;
  position: absolute;
  background: #fff;
  border: 1px solid #E2E8EE;
  border-radius: 10px;
  padding: 11px 14px;
  pointer-events: none;
  z-index: 20;
  max-width: 210px;
  box-shadow: 0 4px 20px rgba(0,0,0,.09);
}
.map-tooltip.visible { display: block; }
.tt-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #0D2D35;
  margin-bottom: 3px;
}
.tt-primary {
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 7px;
}
.tt-pills { display: flex; flex-wrap: wrap; gap: 3px; }
.tt-pill {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 500;
}
.tt-cta {
  font-size: 10px;
  color: #2E7D8C;
  margin-top: 7px;
  font-weight: 500;
}

/* ── Legend ───────────────────────────────────────────────── */
.legend-wrap {
  background: #fff;
  border: 1px solid #E2E8EE;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.legend-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #8A9AAA;
  margin-bottom: 10px;
}
.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 6px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 500;
  color: #1A1A1A;
}
.legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
}
.legend-count {
  margin-left: auto;
  font-size: 11px;
  color: #8A9AAA;
  font-weight: 400;
  padding-right: 4px;
}

/* ── State grid ───────────────────────────────────────────── */
.state-grid-wrap {
  background: #fff;
  border: 1px solid #E2E8EE;
  border-radius: 12px;
  padding: 1rem 1.25rem;
}
.state-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.state-grid-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #8A9AAA;
}
.state-count-badge {
  font-size: 11px;
  color: #5A6570;
  background: #F3F6F8;
  padding: 3px 9px;
  border-radius: 99px;
}
.state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 6px;
}
.state-card {
  border: 1px solid #E8EDEF;
  border-radius: 8px;
  padding: 9px 11px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  background: #FAFBFC;
}
.state-card:hover {
  border-color: #2E7D8C;
  box-shadow: 0 2px 8px rgba(46,125,140,.1);
  background: #fff;
}
.sc-name {
  font-size: 12px;
  font-weight: 600;
  color: #0D2D35;
  margin-bottom: 5px;
}
.sc-pills { display: flex; flex-wrap: wrap; gap: 3px; }
.sc-pill {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 500;
}

/* ── Footer ───────────────────────────────────────────────── */
.map-footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 11px;
  color: #9AAAB4;
}
.map-footer a {
  color: #2E7D8C;
  text-decoration: none;
  font-weight: 500;
}
.map-footer a:hover { text-decoration: underline; }

/* ── Loading ──────────────────────────────────────────────── */
.map-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: #8A9AAA;
  font-size: 13px;
  gap: 8px;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #E2E8EE;
  border-top-color: #2E7D8C;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile tweaks ────────────────────────────────────────── */
@media (max-width: 520px) {
  #hh-map-root { padding: 1rem .75rem 2rem; }
  .state-grid { grid-template-columns: 1fr 1fr; }
}