/* ═══════════════════════════════════════════════════════════════════
   INDEX.CSS — All styling for the main dashboard
   Fonts: Syne (headings/body) · DM Mono (data/labels)
   ═══════════════════════════════════════════════════════════════════ */

/* ── CSS VARIABLES ─────────────────────────────────────────────── */
:root {
  --bg:       #060810;
  --surface:  #0d0f1a;
  --surface2: #13162a;
  --border:   rgba(255, 255, 255, 0.07);
  --border2:  rgba(255, 255, 255, 0.12);
  --text:     #e2e4f0;
  --muted:    #5a5e80;
  --accent1:  #ff4d6d;
  --accent2:  #ff9a3c;
  --accent3:  #4dffc3;
  --accent4:  #5b8fff;
  --accent5:  #c77dff;
  --glow1:    rgba(255, 77, 109, 0.15);
  --glow3:    rgba(77, 255, 195, 0.12);
  --glow4:    rgba(91, 143, 255, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Syne", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 15px;
  line-height: 1.6;
}

/* ── WALLPAPER ──────────────────────────────────────────────────── */
/* Live video wallpaper loaded from utils/wallpaper.mp4 */
#bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  opacity: 0.18;
}

/* Fallback: NASA India night-lights gradient shown if video fails */
.bg-fallback {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(ellipse 70% 50% at 30% 60%, rgba(255,154,60,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 70% 30%, rgba(255,77,109,0.06) 0%, transparent 55%),
    radial-gradient(ellipse 40% 30% at 20% 20%, rgba(91,143,255,0.07) 0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at 55% 75%, rgba(199,125,255,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 80% 80% at 50% 50%, rgba(255,154,60,0.04) 0%, transparent 70%),
    #060810;
}

/* Stars/dots effect simulating city lights */
.bg-fallback::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 15% 25%, rgba(255,220,150,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 45% 15%, rgba(255,200,100,0.5) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 72% 35%, rgba(255,180,80,0.7) 0%, transparent 100%),
    radial-gradient(1px 1px at 28% 55%, rgba(255,220,150,0.4) 0%, transparent 100%),
    radial-gradient(2px 2px at 60% 60%, rgba(255,200,120,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 82% 70%, rgba(255,220,150,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 35% 75%, rgba(255,180,80,0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 88% 20%, rgba(255,210,130,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 52% 85%, rgba(255,190,90,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 12% 80%, rgba(255,220,140,0.3) 0%, transparent 100%),
    radial-gradient(2px 2px at 40% 40%, rgba(255,200,100,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 67% 15%, rgba(255,210,140,0.4) 0%, transparent 100%);
}

/* Grid overlay on top of wallpaper */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* Noise texture overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ── LAYOUT ─────────────────────────────────────────────────────── */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ── NAV ─────────────────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(24px);
  background: rgba(6, 8, 16, 0.80);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-shrink: 0;
}

.logo-mark {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-text {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.nav-pills {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.nav-pill {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.03em;
}

.nav-pill:hover {
  border-color: var(--border2);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-live {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "DM Mono", monospace;
  font-size: 12px;
  color: var(--accent3);
  text-decoration: none;
  border: 1px solid rgba(77, 255, 195, 0.2);
  padding: 6px 14px;
  border-radius: 100px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.nav-live:hover {
  background: rgba(77, 255, 195, 0.06);
  border-color: rgba(77, 255, 195, 0.4);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent3);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

/* ── HERO ─────────────────────────────────────────────────────────── */
.hero {
  padding: 100px 0 80px;
}

.hero-eyebrow {
  font-family: "DM Mono", monospace;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero-title {
  font-size: 72px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.hero-title em {
  font-style: normal;
  color: var(--accent1);
}

.hero-title .line2 {
  color: var(--muted);
}

.hero-sub {
  font-size: 17px;
  color: #8b8fad;
  max-width: 680px;
  line-height: 1.7;
  margin-bottom: 48px;
}

.hero-stats {
  display: flex;
  gap: 48px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}

.hstat-val {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--text), var(--muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hstat-lbl {
  font-family: "DM Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

.hero-chain {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chain-step {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: "DM Mono", monospace;
  font-size: 13px;
  color: var(--muted);
}

.chain-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chain-arrow {
  color: var(--border2);
  font-size: 16px;
}

/* ── SECTION LAYOUT ──────────────────────────────────────────────── */
section {
  padding: 80px 0;
  border-top: 1px solid var(--border);
}

.sec-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
}

.sec-label {
  font-family: "DM Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.sec-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.sec-sub {
  font-size: 15px;
  color: #8b8fad;
  margin-top: 10px;
  max-width: 600px;
  line-height: 1.65;
}

/* ── CARDS ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.04), transparent 70%);
  left: calc(var(--mx, 50%) - 140px);
  top: calc(var(--my, 50%) - 140px);
  pointer-events: none;
  transition: opacity 0.2s;
}

.card-label {
  font-family: "DM Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.card-val {
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.card-delta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-family: "DM Mono", monospace;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 100px;
}

.delta-up {
  background: rgba(255, 77, 109, 0.1);
  color: var(--accent1);
  border: 1px solid rgba(255, 77, 109, 0.2);
}

.delta-dn {
  background: rgba(77, 255, 195, 0.1);
  color: var(--accent3);
  border: 1px solid rgba(77, 255, 195, 0.2);
}

/* ── GRIDS ──────────────────────────────────────────────────────── */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

/* ── CHART WRAPPERS ─────────────────────────────────────────────── */
.chart-wrap {
  position: relative;
  height: 240px;
  margin-top: 16px;
}

.chart-wrap-tall {
  position: relative;
  height: 320px;
  margin-top: 16px;
}

/* ── INSIGHT BOX ────────────────────────────────────────────────── */
.insight-box {
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent4);
  border-radius: 8px;
  font-size: 13px;
  color: #8b8fad;
  line-height: 1.65;
}

.insight-box strong {
  color: var(--text);
  font-weight: 600;
}

/* ── UNIT LABEL ─────────────────────────────────────────────────── */
.unit-label {
  font-family: "DM Mono", monospace;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 1px dashed var(--muted);
  cursor: help;
}

/* ── UNIT TOOLTIP ───────────────────────────────────────────────── */
.unit-tip {
  display: none;
  position: fixed;
  z-index: 9999;
  background: rgba(13,15,26,0.97);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: "DM Mono", monospace;
  font-size: 12px;
  color: var(--text);
  max-width: 280px;
  line-height: 1.55;
  pointer-events: none;
}

/* ── CLICK HINT ─────────────────────────────────────────────────── */
.click-hint {
  display: block;
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: var(--accent5);
  margin-top: 8px;
  letter-spacing: 0.04em;
  opacity: 0.8;
}

/* ── DEATHS CARD HOVER ──────────────────────────────────────────── */
#deathsCardTrigger {
  transition: transform 0.2s, border-color 0.2s;
}
#deathsCardTrigger:hover {
  transform: translateY(-2px);
  border-color: rgba(199,125,255,0.3);
}

/* ── STATE TABLE ─────────────────────────────────────────────────── */
.state-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.state-table th {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.state-table td {
  padding: 12px 14px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.state-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.pm-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pm-mini {
  height: 7px;
  border-radius: 4px;
}

.rank-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: "DM Mono", monospace;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.rank-badge.top {
  background: rgba(255, 77, 109, 0.1);
  border-color: rgba(255, 77, 109, 0.3);
  color: var(--accent1);
}

/* ── CORRELATION BARS ───────────────────────────────────────────── */
.corr-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}

.corr-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.corr-name {
  font-size: 13px;
  font-family: "DM Mono", monospace;
  color: #9a9ec4;
  flex: 0 0 210px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.corr-bar-wrap {
  flex: 1;
  height: 9px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
  overflow: hidden;
}

.corr-bar {
  height: 100%;
  border-radius: 5px;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.corr-val {
  font-size: 13px;
  font-family: "DM Mono", monospace;
  font-weight: 600;
  flex: 0 0 52px;
  text-align: right;
}

.corr-sig {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 7px;
}

/* ── ML CARDS ────────────────────────────────────────────────────── */
.ml-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 0;
}

.ml-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  position: relative;
  overflow: hidden;
}

.ml-card::before {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.03), transparent 70%);
  left: calc(var(--mx, 50%) - 140px);
  top: calc(var(--my, 50%) - 140px);
  pointer-events: none;
}

.ml-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-family: "DM Mono", monospace;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.ml-badge.a {
  background: rgba(91,143,255,0.15);
  color: var(--accent4);
  border: 1px solid rgba(91,143,255,0.3);
}

.ml-badge.b {
  background: rgba(199,125,255,0.15);
  color: var(--accent5);
  border: 1px solid rgba(199,125,255,0.3);
}

.ml-card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.2;
}

.ml-card-desc {
  font-size: 14px;
  color: #8b8fad;
  line-height: 1.65;
}

.ml-metric-row {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.ml-metric { text-align: center; }

.ml-metric-val {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
}

.ml-metric-lbl {
  font-size: 11px;
  font-family: "DM Mono", monospace;
  color: var(--muted);
  margin-top: 5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── FOOTER ──────────────────────────────────────────────────────── */
footer {
  padding: 48px 0;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-family: "DM Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover { color: var(--text); }

/* ── DEATHS MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(6, 8, 16, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px;
  position: relative;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.modal-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.modal-sub {
  font-size: 13px;
  font-family: "DM Mono", monospace;
  color: var(--muted);
  margin-top: 6px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text);
}

.modal-chart-container {
  position: relative;
  height: 480px;
  margin-bottom: 20px;
}

.modal-back-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.modal-back-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.modal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-source-note {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  padding-top: 16px;
  border-top: 1px solid var(--border);
  line-height: 1.6;
}

/* ── ANIMATE IN ──────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0);    }
}

.fade-up {
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
  animation-play-state: paused;
}

.fade-up:nth-child(1) { animation-delay: 0.05s; }
.fade-up:nth-child(2) { animation-delay: 0.12s; }
.fade-up:nth-child(3) { animation-delay: 0.19s; }
.fade-up:nth-child(4) { animation-delay: 0.26s; }

/* ── SCROLLBAR ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero-title { font-size: 54px; }
}

@media (max-width: 900px) {
  .grid2, .grid3, .ml-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 42px; }
  .sec-title  { font-size: 28px; }
  .corr-name  { flex: 0 0 140px; }
  .wrap       { padding: 0 20px; }
}

@media (max-width: 600px) {
  .hero-title      { font-size: 34px; }
  .card-val        { font-size: 40px; }
  .hero-stats      { gap: 28px; }
  .hstat-val       { font-size: 28px; }
  .nav-pills       { display: none; }
  .modal-box       { padding: 24px 18px; }
}