*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --link: #2563eb;
  --link-visited: #6d28d9;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --gold: #f59e0b;
  --header-bg: #0f2347;
  --header-bg2: #1e3a5f;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

/* ── Header ───────────────────────────────────────── */
header {
  background: linear-gradient(135deg, var(--header-bg) 0%, var(--header-bg2) 100%);
  border-bottom: 2px solid var(--gold);
}
header .inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
  text-decoration: none;
}
.site-tagline {
  font-size: 11px;
  color: #94afd4;
  margin-top: 2px;
  letter-spacing: 0.2px;
}
nav.top-nav {
  display: flex;
  gap: 4px;
}
nav.top-nav a {
  color: #94afd4;
  text-decoration: none;
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
nav.top-nav a:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ── Search bar ───────────────────────────────────── */
.search-bar {
  background: #152d52;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 10px 24px;
}
.search-bar .inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.search-bar input {
  flex: 0 1 480px;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search-bar input::placeholder { color: #6b80a8; }
.search-bar input:focus { border-color: #60a5fa; background: rgba(255,255,255,0.12); }
.search-bar select {
  padding: 8px 10px;
  background: rgba(255,255,255,0.08);
  color: #94afd4;
  border: 1px solid rgba(255,255,255,0.15);
  font-family: inherit;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
}
.search-bar button {
  padding: 8px 20px;
  background: var(--gold);
  color: #0f2347;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.search-bar button:hover { background: #fbbf24; }

/* ── Page wrapper ─────────────────────────────────── */
.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 24px 32px;
}

/* ── Section headers ──────────────────────────────── */
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Map section ──────────────────────────────────── */
.map-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.map-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: #fafcff;
}
.map-section-header h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
}
.map-section-header span {
  font-size: 11px;
  color: var(--muted);
}
.map-container {
  display: flex;
}
.map-wrap {
  flex: 1;
  min-height: 440px;
}
#map-d3-container {
  width: 100%;
  height: 440px;
}
.state-list-panel {
  width: 196px;
  border-left: 1px solid var(--border);
  padding: 14px 14px 14px 16px;
  background: #fafcff;
  overflow-y: auto;
  max-height: 440px;
}
.state-list-panel h3 {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}
.state-list-panel ul { list-style: none; columns: 2; column-gap: 4px; }
.state-list-panel li { margin-bottom: 3px; }
.state-list-panel a {
  font-size: 11.5px;
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s;
}
.state-list-panel a:hover { text-decoration-color: var(--link); }
.state-list-panel a:visited { color: var(--link-visited); }

/* ── Tooltip ──────────────────────────────────────── */
.state-tooltip {
  position: fixed;
  background: #0f2347;
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 5px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  pointer-events: none;
  display: none;
  z-index: 9999;
  white-space: nowrap;
}
.state-tooltip::before {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #0f2347;
  border-bottom: none;
}

/* ── Grid layouts ─────────────────────────────────── */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.columns.three { grid-template-columns: 1fr 1fr 1fr; }

/* ── Category card ────────────────────────────────── */
.cat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.cat-box:hover { box-shadow: var(--shadow-md); }
.cat-box h3 {
  background: #f8fafc;
  color: var(--text);
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}
.cat-box ul { list-style: none; padding: 6px 0; }
.cat-box li {
  border-bottom: 1px solid #f1f5f9;
  padding: 4px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cat-box li:last-child { border-bottom: none; }
.cat-box a {
  font-size: 12.5px;
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s, color 0.15s;
}
.cat-box a:hover { text-decoration-color: var(--link); }
.cat-box a:visited { color: var(--link-visited); }
.cat-box .count {
  font-size: 11px;
  color: var(--muted);
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 10px;
}

/* ── Directory table ──────────────────────────────── */
.dir-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.dir-table h2 {
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: #fafcff;
  color: var(--text);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
thead th {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 7px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
tbody tr { border-bottom: 1px solid #f1f5f9; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: 7px 14px; }
tbody td a { color: var(--link); text-decoration: underline; text-decoration-color: transparent; }
tbody td a:hover { text-decoration-color: var(--link); }
tbody td a:visited { color: var(--link-visited); }

/* ── Featured listings ────────────────────────────── */
.featured-box {
  background: var(--surface);
  border: 1px solid #fde68a;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.featured-box h2 {
  background: linear-gradient(90deg, #fffbeb, #fef3c7);
  color: #92400e;
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid #fde68a;
}
.featured-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.featured-item {
  padding: 12px 16px;
  border-right: 1px solid #fef3c7;
  border-bottom: 1px solid #fef3c7;
  transition: background 0.15s;
}
.featured-item:hover { background: #fffbeb; }
.featured-item:nth-child(4n) { border-right: none; }
.featured-item a {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s;
}
.featured-item a:hover { text-decoration-color: var(--link); }
.featured-item p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

/* ── State page ───────────────────────────────────── */
.breadcrumb {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb a { color: var(--link); text-decoration: underline; }
.breadcrumb span::before { content: '›'; margin-right: 6px; color: #cbd5e1; }
.state-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.state-header h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.state-stats { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ── Footer ───────────────────────────────────────── */
footer {
  background: var(--header-bg);
  border-top: 2px solid var(--gold);
  padding: 24px 24px;
  margin-top: 32px;
}
footer .inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
footer h4 { font-size: 11px; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
footer p, footer div > div { font-size: 12px; color: #64748b; line-height: 1.8; }
footer a { color: #94afd4; text-decoration: underline; text-decoration-color: transparent; }
footer a:hover { color: #fff; text-decoration-color: #fff; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 860px) {
  .columns, .columns.three { grid-template-columns: 1fr; }
  .map-container { flex-direction: column; }
  .state-list-panel { width: 100%; max-height: 240px; border-left: none; border-top: 1px solid var(--border); }
  .featured-grid { grid-template-columns: 1fr 1fr; }
  header .inner { flex-direction: column; align-items: flex-start; gap: 10px; }
}
