:root {
  --navy: #0b0f19;
  --navy-2: #181f2e;
  --bg: #f6f5f3;
  --surface: #ffffff;
  --border: #e5e2dc;
  --text: #111827;
  --muted: #52525b;
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --low: #059669;
  --moderate: #d97706;
  --elevated: #ea580c;
  --high: #dc2626;
  --severe: #991b1b;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(17, 24, 39, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden { display: none !important; }

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.muted { color: var(--muted); }

/* Topbar */
.topbar {
  background: #0b0f19;
  color: #fff;
  border-top: 2px solid #ea580c;
  border-bottom: 1px solid rgba(251, 146, 60, 0.16);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand small {
  font-weight: 500;
  color: #fdba74;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-links a:hover { color: #fff; }

.pill-badge {
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(234, 88, 12, 0.18);
  border: 1px solid rgba(251, 146, 60, 0.3);
  color: #fed7aa;
  font-weight: 600;
}

/* Hero */
.hero {
  /* To add a hero background image later, layer it at the end of background and set background-size: cover */
  background:
    radial-gradient(ellipse 65% 80% at 88% 8%, rgba(220, 38, 38, 0.24) 0%, rgba(234, 88, 12, 0.1) 42%, transparent 72%),
    radial-gradient(ellipse 50% 60% at 12% 100%, rgba(245, 158, 11, 0.1) 0%, transparent 65%),
    linear-gradient(180deg, #0b0f19 0%, #111827 100%);
  color: #fff;
  padding: 52px 0 88px;
  position: relative;
  -webkit-clip-path: url(#hero-wave-clip);
  clip-path: url(#hero-wave-clip);
}

.hero-copy { max-width: 780px; }

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(234, 88, 12, 0.14);
  border: 1px solid rgba(251, 146, 60, 0.34);
  color: #fed7aa;
  margin-bottom: 16px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f97316;
  box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.65);
  animation: radar-pulse 2.2s ease-out infinite;
}

@keyframes radar-pulse {
  0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.65); }
  70% { box-shadow: 0 0 0 7px rgba(249, 115, 22, 0); }
  100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.hero h1 .accent {
  background: linear-gradient(90deg, #fbbf24 0%, #f97316 55%, #f87171 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin: 0 0 28px;
  color: #cbd5e1;
  font-size: 1.05rem;
  line-height: 1.6;
}

.search-bar {
  display: flex;
  gap: 10px;
  background: #fff;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(251, 146, 60, 0.35);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(234, 88, 12, 0.14);
  max-width: 860px;
  transition: box-shadow 0.2s ease;
}

.search-bar:focus-within {
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42), 0 0 0 3px rgba(249, 115, 22, 0.35);
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  min-width: 0;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.65; cursor: wait; }

.search-bar .btn-primary {
  background: linear-gradient(135deg, #ea580c, #dc2626);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

.search-bar .btn-primary:hover {
  background: linear-gradient(135deg, #c2410c, #b91c1c);
}

.hero-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: #94a3b8;
  max-width: 860px;
}

.hero-signals span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sig-warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text);
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-chip {
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-chip:hover { background: #e2e8f0; }

.samples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.samples-label {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-right: 4px;
}

.sample-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sample-chip:hover { background: rgba(255, 255, 255, 0.18); }

.error-banner {
  margin-top: 16px;
  max-width: 860px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
}

/* Cards & Layout */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.loading-card {
  display: flex;
  align-items: center;
  gap: 18px;
}

.spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid #fed7aa;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

#dossierSection { padding: 32px 20px 56px; }

.dossier-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.dossier-title {
  margin: 4px 0 6px;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.geo-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

.source-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.src-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
}

.src-badge.ok { color: #065f46; background: #ecfdf5; border-color: #a7f3d0; }
.src-badge.warn { color: #92400e; background: #fffbeb; border-color: #fde68a; }

.grid-hero-dossier {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Gauge & Risk Card */
.tier-badge {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.tier-low { background: #ecfdf5; color: var(--low); }
.tier-moderate { background: #fffbeb; color: var(--moderate); }
.tier-elevated { background: #fff7ed; color: var(--elevated); }
.tier-high { background: #fef2f2; color: var(--high); }
.tier-severe { background: #fef2f2; color: var(--severe); border: 1px solid #fca5a5; }

.gauge-row {
  display: grid;
  grid-template-columns: 185px 1fr;
  gap: 20px;
  align-items: center;
  margin: 18px 0;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.gauge-wrap {
  position: relative;
  width: 180px;
  height: 112px;
}

.gauge-svg { width: 100%; height: 100%; }

#gaugeArc { transition: stroke-dashoffset 0.8s cubic-bezier(0.22, 1, 0.36, 1), stroke 0.3s ease; }

.gauge-value {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
}

.gauge-value span {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.gauge-value small {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.carrier-signal {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
}

.carrier-headline {
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.breakdown-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}

.b-item { font-size: 0.76rem; }
.b-top { display: flex; justify-content: space-between; margin-bottom: 3px; font-weight: 600; }
.b-track { height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.b-fill { height: 100%; background: var(--accent); border-radius: 999px; }

.insights-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.insight-item {
  padding: 11px 13px;
  border-radius: 10px;
  background: #f8fafc;
  border-left: 4px solid var(--accent);
}

.insight-item.sev-severe, .insight-item.sev-high { border-left-color: var(--high); background: #fef2f2; }
.insight-item.sev-moderate { border-left-color: var(--moderate); background: #fffbeb; }
.insight-item.sev-low { border-left-color: var(--low); background: #f0fdf4; }

.insight-title { font-weight: 700; font-size: 0.88rem; margin-bottom: 3px; }
.insight-body { font-size: 0.83rem; color: var(--muted); line-height: 1.45; }

/* Interactive Map */
.map-card { display: flex; flex-direction: column; }

.map-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.hazard-map {
  width: 100%;
  height: 360px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 14px 0 12px;
  z-index: 1;
}

.map-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted);
}

.legend-items { display: flex; gap: 14px; flex-wrap: wrap; }
.swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 4px;
}
.swatch-sfha { background: #38bdf8; border: 1px solid #0284c7; }
.swatch-mod { background: #fbbf24; border: 1px solid #d97706; }

.opacity-control { display: flex; align-items: center; gap: 6px; }
.opacity-control input { width: 80px; }

/* KPI Strip */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 6px 0 4px;
  letter-spacing: -0.02em;
}

.kpi-sub { font-size: 0.8rem; color: var(--muted); line-height: 1.35; }

/* CTA Banner */
.cta-banner {
  background:
    radial-gradient(ellipse 55% 110% at 92% 10%, rgba(234, 88, 12, 0.26) 0%, transparent 68%),
    linear-gradient(135deg, #0b0f19 0%, #1c1917 100%);
  border: 1px solid rgba(251, 146, 60, 0.22);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.cta-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fdba74;
}

.cta-banner h3 { margin: 6px 0 4px; font-size: 1.25rem; }
.cta-banner p { margin: 0; color: #d6d3d1; font-size: 0.9rem; }

.cta-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn-cta-primary {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  font-weight: 800;
  padding: 12px 20px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.92rem;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.3);
}

.btn-cta-primary:hover { background: linear-gradient(135deg, #d97706, #c2410c); }

.btn-cta-secondary {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.9rem;
}

/* Two-Column Sections */
.grid-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Perils */
.perils-list { display: flex; flex-direction: column; gap: 12px; }

.peril-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
}

.peril-name { font-weight: 600; font-size: 0.9rem; }
.peril-meta { font-size: 0.78rem; color: var(--muted); font-family: 'JetBrains Mono', monospace; }
.peril-track {
  grid-column: 1 / -1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.peril-fill { height: 100%; border-radius: 999px; }

/* Checklist */
.mitigation-pill {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  display: flex;
  gap: 6px;
  align-items: center;
}

.savings-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 12px 0 16px;
  font-size: 0.88rem;
}

.savings-highlight { color: var(--low); font-size: 1rem; margin-left: 4px; }

.checklist-list { display: flex; flex-direction: column; gap: 12px; }

.check-item {
  display: flex;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.check-item:hover { border-color: #fdba74; }
.check-item.checked { background: #f0fdf4; border-color: #86efac; }

.check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--low);
  flex-shrink: 0;
}

.check-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.check-title { font-weight: 700; font-size: 0.92rem; }
.check-discount {
  font-size: 0.74rem;
  font-weight: 700;
  color: #065f46;
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 999px;
}

.check-why { font-size: 0.82rem; color: var(--muted); margin: 5px 0 7px; line-height: 1.45; }
.check-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--muted);
}

.affiliate-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* History Lists */
.history-list { display: flex; flex-direction: column; gap: 10px; }

.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #f8fafc;
  border: 1px solid var(--border);
  font-size: 0.86rem;
}

.history-title { font-weight: 600; }
.history-sub { font-size: 0.76rem; color: var(--muted); }
.history-val { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 0.82rem; white-space: nowrap; }

/* Info Band & Footer */
.info-band {
  background: #fff;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 48px 0;
  margin-top: 24px;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.three-col h4 { margin: 0 0 8px; }
.three-col p { margin: 0; font-size: 0.9rem; line-height: 1.55; }

.zip-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.zip-links a {
  padding: 8px 14px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
}

.zip-links a:hover { border-color: var(--accent); color: var(--accent); }

.footer {
  background: var(--navy);
  border-top: 1px solid rgba(251, 146, 60, 0.16);
  color: #a8a29e;
  padding: 28px 0;
  font-size: 0.82rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 25, 0.7);
}

.modal-box {
  position: relative;
  max-width: 480px;
  width: 100%;
  z-index: 1;
}

@media (max-width: 960px) {
  .grid-hero-dossier, .grid-two-col, .three-col { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .search-bar { flex-direction: column; }
  .gauge-row { grid-template-columns: 1fr; text-align: center; }
  .gauge-wrap { margin: 0 auto; }
  .kpi-grid { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .hero, .cta-banner, .info-band, #zip-seo, .footer { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
