/* ==========================================================================
   Bharat Monitor — design system
   Dark "intelligence terminal" theme: near-black blue surfaces, signal-green
   accent, monospaced data details. Tokens first, components after.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #05070a;
  --panel: #0d1219;
  --panel-2: #111923;
  --panel-3: #16202c;

  /* Text */
  --text: #eef3ff;
  --text-secondary: #b7c2d6;
  --muted: #8e99aa;

  /* Brand + semantic */
  --accent: #39ff88;
  --accent-soft: rgba(57, 255, 136, 0.12);
  --accent-border: rgba(57, 255, 136, 0.4);
  --accent-2: #f59e0b;
  --info: #60a5fa;
  --danger: #ff5c6c;

  /* Borders */
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);

  /* Radius */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 24px 60px -20px rgba(0, 0, 0, 0.65);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 150ms;
  --dur: 250ms;
  --dur-slow: 450ms;

  /* Type */
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(45, 212, 191, 0.05), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(57, 255, 136, 0.03), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin-top: 0; }

::selection {
  background: rgba(57, 255, 136, 0.25);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--panel-3);
  border: 1px solid var(--accent-border);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-64px);
  opacity: 0;
  transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
  opacity: 1;
}

.noscript-notice {
  margin: 16px auto;
  width: min(720px, calc(100% - 32px));
  padding: 14px 18px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  background: var(--accent-soft);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 10px clamp(16px, 3vw, 28px);
  border-bottom: 1px solid var(--border);
  background: rgba(5, 7, 10, 0.8);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 52px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.1em;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(57, 255, 136, 0.5);
  animation: live-pulse 2.4s ease-out infinite;
}

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(57, 255, 136, 0.5); }
  60% { box-shadow: 0 0 0 6px rgba(57, 255, 136, 0); }
  100% { box-shadow: 0 0 0 0 rgba(57, 255, 136, 0); }
}

.brand-copy { display: grid; gap: 2px; }

.brand-copy strong {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1;
}

.brand-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Controls
   -------------------------------------------------------------------------- */

.ghost-btn,
.tab {
  position: relative;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.ghost-btn:hover,
.tab:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  transform: translateY(-1px);
}

.ghost-btn:active,
.tab:active {
  transform: translateY(0) scale(0.98);
}

.tab.active,
.tab[aria-selected="true"] {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-spinner {
  display: none;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(57, 255, 136, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.ghost-btn.is-loading { pointer-events: none; opacity: 0.75; }
.ghost-btn.is-loading .btn-spinner { display: inline-block; }

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

.state-picker { display: inline-flex; }

.state-picker select {
  appearance: none;
  -webkit-appearance: none;
  max-width: 210px;
  padding: 8px 32px 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238e99aa' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 12px center,
    rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition:
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.state-picker select:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.state-picker select option {
  background: var(--panel-2);
  color: var(--text);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

main {
  width: min(1380px, calc(100% - 24px));
  margin: 0 auto;
}

.dashboard-section {
  margin: 0 0 20px;
  padding: 20px;
}

.hero-panel,
.map-card,
.dashboard-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 30%), var(--panel);
  box-shadow: var(--shadow), var(--highlight);
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-header h2 {
  margin-bottom: 6px;
  font-size: clamp(20px, 2.3vw, 26px);
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.section-header p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   Ticker
   -------------------------------------------------------------------------- */

.ticker-shell { padding: 12px 0 0; }

.ticker-strip {
  display: flex;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm), var(--highlight);
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
}

.ticker-strip::-webkit-scrollbar { display: none; }

.ticker-strip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ticker-track {
  display: flex;
  min-width: max-content;
}

.ticker-strip.is-animated { overflow: hidden; }

.ticker-strip.is-animated .ticker-track {
  animation: ticker-scroll var(--marquee-duration, 40s) linear infinite;
}

.ticker-shell:hover .ticker-track,
.ticker-shell:focus-within .ticker-track {
  animation-play-state: paused;
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  padding: 10px 16px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.ticker-strip:not(.is-animated) .ticker-track > .ticker-item:last-child { border-right: 0; }

.ticker-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}

.ticker-value {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ticker-delta {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ticker-delta.up, .ticker-dot.up { color: var(--accent); }
.ticker-delta.down, .ticker-dot.down { color: var(--danger); }
.ticker-delta.flat, .ticker-dot.flat { color: var(--muted); }

.ticker-time {
  color: var(--muted);
  font-size: 12px;
}

.ticker-dot { font-size: 11px; }

/* --------------------------------------------------------------------------
   Map hero
   -------------------------------------------------------------------------- */

.map-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(360px, 0.72fr) minmax(0, 1.28fr);
  gap: 14px;
  min-height: 0;
  padding: 12px 0 20px;
  align-items: stretch;
}

.hero-panel {
  display: flex;
  flex-direction: column;
  padding: 18px;
  height: 620px;
  overflow: hidden;
}

.hero-panel h2 {
  margin-bottom: 6px;
  font-size: clamp(21px, 2.4vw, 26px);
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.18;
}

#heroDescription {
  color: var(--muted);
  line-height: 1.5;
  font-size: 13.5px;
}

.tabs { display: grid; gap: 8px; }

.horizontal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.tab {
  width: auto;
  text-align: left;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 11.5px;
  font-weight: 600;
  padding: 8px 12px;
}

.map-shell {
  position: relative;
  height: 620px;
  min-width: 0;
}

.map-card {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(45, 212, 191, 0.07), transparent 45%),
    #070b10;
}

/* Live-layer control overlay (top-left of the map) */
.map-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 4;
  width: min(230px, calc(100% - 24px));
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: rgba(9, 13, 18, 0.78);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  box-shadow: var(--shadow-lg);
  animation: rise-in var(--dur-slow) var(--ease-out) both;
}

.map-controls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.map-controls-title {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.time-range {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.time-range button {
  padding: 3px 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.time-range button:hover { color: var(--text); }

.time-range button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.layer-toggles {
  display: grid;
  gap: 6px;
}

.layer-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out);
}

.layer-toggle:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
}

.layer-toggle .layer-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot) 22%, transparent);
  background: var(--dot);
  transition: box-shadow var(--dur-fast) var(--ease-out);
}

.layer-toggle .layer-name { flex: 1; min-width: 0; }

.layer-toggle .layer-count {
  flex: 0 0 auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.layer-toggle[aria-pressed="false"] {
  opacity: 0.5;
}

.layer-toggle[aria-pressed="false"] .layer-dot {
  box-shadow: none;
  background: var(--muted);
}

.layer-toggle[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--dot) 45%, var(--border));
  color: var(--text);
}

.compact-list {
  grid-template-columns: 1fr;
  grid-auto-rows: minmax(190px, auto);
  overflow-y: auto;
  min-height: 0;
  padding-right: 8px;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.compact-list::-webkit-scrollbar { width: 8px; }
.compact-list::-webkit-scrollbar-track { background: transparent; }
.compact-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}
.compact-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

.map-notice {
  position: absolute;
  right: 24px;
  bottom: 44px;
  z-index: 5;
  width: min(420px, calc(100% - 48px));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--panel-2);
  color: var(--text-secondary);
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: rise-in var(--dur-slow) var(--ease-out) both;
}

.map-notice[hidden] { display: none; }

/* --------------------------------------------------------------------------
   News stories
   -------------------------------------------------------------------------- */

.news-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}

.story {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 190px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--panel-2);
  overflow: hidden;
  animation: rise-in var(--dur-slow) var(--ease-out) both;
  animation-delay: calc(min(var(--i, 0), 10) * 45ms);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.story:hover {
  border-color: var(--border-strong);
  background: var(--panel-3);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.story:focus-within {
  border-color: var(--accent-border);
}

.story h3 {
  margin-bottom: 8px;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.005em;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* Never let the flex column shrink the clamp box — that slices the last
     line mid-glyph instead of truncating with an ellipsis. */
  flex-shrink: 0;
}

.story p {
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-shrink: 0;
}

.story .story-link {
  margin-top: auto;
  padding-top: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.story .story-link::before {
  content: "";
  position: absolute;
  inset: 0;
}

.story .story-link::after {
  content: " →";
  display: inline-block;
  transition: transform var(--dur-fast) var(--ease-out);
}

/* Focused stretched link: ring the whole card, not just the link text. */
.story:focus-within {
  box-shadow: 0 0 0 2px var(--accent);
}

.story .story-link:focus-visible {
  outline: none;
}

.story:hover .story-link::after { transform: translateX(3px); }

.compact-list .story { min-height: 190px; }

.meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}

.meta span {
  color: var(--accent-2);
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta time {
  color: var(--muted);
  text-align: right;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Empty + error states
   -------------------------------------------------------------------------- */

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

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 24px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  animation: rise-in var(--dur-slow) var(--ease-out) both;
}

.empty-state h3 {
  margin-bottom: 2px;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
}

.empty-state p {
  margin-bottom: 0;
  font-size: 13.5px;
  line-height: 1.5;
}

.empty-state .retry-btn {
  margin-top: 12px;
  padding: 7px 14px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.empty-state .retry-btn:hover {
  background: rgba(57, 255, 136, 0.2);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   State profile
   -------------------------------------------------------------------------- */

.state-profile-section { overflow: hidden; }

.state-profile-card {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(180px, 0.65fr);
  gap: 18px;
  align-items: stretch;
  min-height: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01) 36%, rgba(57, 255, 136, 0.04) 100%),
    var(--panel-2);
}

.state-profile-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.state-profile-location {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
}

#stateProfileTitle {
  margin-bottom: 4px;
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.02;
  background: linear-gradient(180deg, var(--text) 55%, #aebadd);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.state-profile-native {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 450;
}

.state-profile-tagline {
  margin: 0 0 18px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.55;
  font-style: italic;
}

.state-profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  animation: rise-in var(--dur-slow) var(--ease-out) both;
  animation-delay: calc(min(var(--i, 0), 8) * 40ms);
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.state-badge:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.state-profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: auto;
}

.state-stat {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.state-stat:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
}

.state-stat strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.state-stat-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.state-stat small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.state-profile-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.state-profile-side {
  display: grid;
  gap: 12px;
  align-content: start;
}

.state-profile-side-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(140deg, rgba(57, 255, 136, 0.07), rgba(255, 255, 255, 0.02));
}

.state-profile-side-card-muted { background: rgba(255, 255, 255, 0.03); }

.state-profile-side-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.state-profile-side strong {
  display: block;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   Readiness score
   -------------------------------------------------------------------------- */

.score-section { padding: 0; overflow: visible; }

.score-card {
  padding: 24px;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01) 54%, rgba(57, 255, 136, 0.04));
}

.score-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.score-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

.score-grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: var(--radius);
  color: #05070a;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  transition: background-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

.score-grade.excellent, .score-code.excellent { background: var(--accent); }
.score-grade.good, .score-code.good { background: var(--info); }
.score-grade.watch, .score-code.watch { background: var(--accent-2); }
.score-grade.risk, .score-code.risk { background: var(--danger); }

.score-grade.excellent { box-shadow: 0 0 28px rgba(57, 255, 136, 0.3); }
.score-grade.good { box-shadow: 0 0 28px rgba(96, 165, 250, 0.3); }
.score-grade.watch { box-shadow: 0 0 28px rgba(245, 158, 11, 0.28); }
.score-grade.risk { box-shadow: 0 0 28px rgba(255, 92, 108, 0.3); }

.score-card h2 {
  margin: 2px 0 6px;
  font-size: clamp(21px, 2.5vw, 30px);
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.12;
}

.score-value-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.score-value-line strong {
  font-size: clamp(34px, 4vw, 46px);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-value-line span,
.score-method,
.score-note { color: var(--muted); }

.score-info {
  position: relative;
  flex: 0 0 auto;
}

.score-info-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent);
  font: inherit;
  font-family: var(--font-mono);
  font-weight: 700;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.score-info-button:hover,
.score-info-button:focus-visible,
.score-info-button[aria-expanded="true"] {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.score-method {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(440px, calc(100vw - 42px));
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
  box-shadow: var(--shadow-lg);
  text-align: left;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  pointer-events: none;
  transition:
    opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    visibility var(--dur-fast);
}

.score-info:hover .score-method,
.score-info:focus-within .score-method,
.score-method.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.score-method strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-method p { margin: 0 0 11px; }
.score-method p:last-child { margin-bottom: 0; }

.score-note {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.55;
  font-style: italic;
}

.score-subhead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 12px;
}

.score-subhead h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.score-subhead p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.score-metric {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 58px;
}

.pillar-card {
  align-items: start;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  animation: rise-in var(--dur-slow) var(--ease-out) both;
  animation-delay: calc(min(var(--i, 0), 8) * 50ms);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.pillar-card:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.035);
  transform: translateY(-2px);
}

.score-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  color: #05070a;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 750;
}

.score-metric-body { min-width: 0; }

.score-metric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.score-metric-head span {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.score-metric-head strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.score-metric-head strong.excellent { color: var(--accent); }
.score-metric-head strong.good { color: var(--info); }
.score-metric-head strong.watch { color: var(--accent-2); }
.score-metric-head strong.risk { color: var(--danger); }

.score-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.score-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 900ms var(--ease-out);
}

.score-bar span.excellent { background: linear-gradient(90deg, #1fd977, var(--accent)); }
.score-bar span.good { background: linear-gradient(90deg, #3f83e8, var(--info)); }
.score-bar span.watch { background: linear-gradient(90deg, #d9820a, var(--accent-2)); }
.score-bar span.risk { background: linear-gradient(90deg, #e33e50, var(--danger)); }

.pillar-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.pillar-details span {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   Map popups
   -------------------------------------------------------------------------- */

.mapboxgl-popup-content,
.maplibregl-popup-content {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
}

.mapboxgl-popup-tip,
.maplibregl-popup-tip { border-top-color: var(--panel-2) !important; }

.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip { border-top-color: var(--panel-2) !important; }
.mapboxgl-popup-anchor-top .mapboxgl-popup-tip { border-bottom-color: var(--panel-2) !important; }
.mapboxgl-popup-anchor-left .mapboxgl-popup-tip { border-right-color: var(--panel-2) !important; }
.mapboxgl-popup-anchor-right .mapboxgl-popup-tip { border-left-color: var(--panel-2) !important; }

.map-popup {
  display: grid;
  gap: 5px;
  min-width: 132px;
}

.map-popup strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
}

.map-popup span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  line-height: 1.3;
}

.map-popup.event-popup { min-width: 200px; max-width: 260px; gap: 7px; }

.event-popup-badge {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.event-popup-badge.high { background: rgba(255, 92, 108, 0.16); color: #ff8f9a; }
.event-popup-badge.medium { background: rgba(96, 165, 250, 0.16); color: #8fbcff; }
.event-popup-badge.low { background: rgba(142, 153, 170, 0.16); color: var(--text-secondary); }

.event-popup ul {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.event-popup li {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--text-secondary);
  padding-left: 12px;
  position: relative;
}

.event-popup li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-2);
}

.event-popup .popup-action {
  margin-top: 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.event-popup .popup-action:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Skeletons
   -------------------------------------------------------------------------- */

.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.sk {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.sk + .sk { margin-top: 10px; }
.sk-meta { width: 40%; height: 10px; }
.sk-title { width: 92%; height: 14px; margin-top: 14px; }
.sk-title.short { width: 68%; margin-top: 8px; }
.sk-text { width: 100%; height: 10px; margin-top: 12px; }
.sk-text:last-child { width: 84%; }

.skeleton-card {
  pointer-events: none;
  animation: none;
}

@keyframes shimmer { to { background-position: -200% 0; } }

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  width: min(1380px, calc(100% - 24px));
  margin: 8px auto 0;
  padding: 24px 4px 32px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
}

.footer-brand strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 650;
}

.footer-brand p {
  margin: 0;
  max-width: 46ch;
  line-height: 1.55;
}

.footer-meta {
  display: grid;
  gap: 6px;
  align-content: start;
  text-align: right;
}

.footer-meta a {
  color: var(--text-secondary);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

.footer-meta a:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 920px) {
  .map-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .map-shell { height: 540px; }

  .hero-panel { height: auto; }

  .compact-list {
    max-height: 640px;
  }

  .state-profile-card { grid-template-columns: 1fr; }

  .state-profile-stats { grid-template-columns: 1fr 1fr 1fr; }

  .score-topline { flex-direction: column; }

  .score-info { align-self: flex-end; margin-top: -44px; }

  .score-method { max-width: none; text-align: left; }

  .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .site-footer {
    flex-direction: column;
    gap: 16px;
  }

  .footer-meta { text-align: left; }
}

@media (max-width: 620px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-block { width: 100%; }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .state-picker { flex: 1 1 100%; }

  .state-picker select {
    width: 100%;
    max-width: none;
  }

  .ghost-btn { flex: 1; justify-content: center; }

  .map-shell { height: 460px; }

  .map-controls {
    width: min(200px, calc(100% - 20px));
    padding: 10px;
  }

  .layer-toggle .layer-count { display: none; }

  .dashboard-section { padding: 16px; }

  .state-profile-card { padding: 18px; }

  .score-card { padding: 18px; }

  .score-grid,
  .state-profile-stats { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .ticker-strip.is-animated { overflow-x: auto; }
  .ticker-strip.is-animated .ticker-track { animation: none !important; }

  .sk,
  .skeleton {
    animation: none !important;
    background: rgba(255, 255, 255, 0.06);
  }
}
