/* ═══════════════════════════════════════════════════════════
   RISKMAP A.I. — AWWWARDS-GRADE DESIGN SYSTEM
   Geopolitical & Disaster Intelligence Platform
   ═══════════════════════════════════════════════════════════ */

:root {
  /* ── Backgrounds ── */
  --bg-0: #030712;
  --bg-1: #0a1128;
  --bg-2: #111d3a;
  --bg-3: #182952;
  --card: rgba(8, 16, 32, .68);
  --card-hover: rgba(12, 22, 45, .82);
  --card-solid: #0c1730;
  --glass: rgba(12, 20, 42, .55);
  --glass-border: rgba(120, 160, 255, .12);

  /* ── Lines & Borders ── */
  --line: rgba(130, 165, 255, .13);
  --line-hover: rgba(130, 165, 255, .28);
  --line-strong: rgba(130, 165, 255, .4);

  /* ── Typography ── */
  --text-0: #f0f4ff;
  --text-1: #c2d4f0;
  --text-2: #7e93bd;
  --text-3: #4a5e84;

  /* ── Accents ── */
  --accent: #4ea1ff;
  --accent-glow: rgba(78, 161, 255, .35);
  --accent-2: #00d4ff;
  --accent-3: #845ef7;
  --danger: #ff5a65;
  --danger-glow: rgba(255, 90, 101, .3);
  --warning: #ffb038;
  --warning-glow: rgba(255, 176, 56, .25);
  --success: #22d68e;
  --success-glow: rgba(34, 214, 142, .25);

  /* ── Radius ── */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 32px;
  --r-full: 999px;

  /* ── Shadows ── */
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);
  --shadow-md: 0 8px 32px rgba(0,0,0,.35);
  --shadow-lg: 0 20px 60px rgba(3, 7, 18, .55);
  --shadow-glow: 0 0 40px var(--accent-glow);
  --shadow-danger: 0 0 30px var(--danger-glow);

  /* ── Layout ── */
  --nav-h: 60px;
  --container: 1320px;
  --gap: 16px;

  /* ── Easing ── */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-smooth: cubic-bezier(.4, 0, .2, 1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  font-family: "Sora", "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-0);
  background: var(--bg-0);
  padding-top: var(--nav-h);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Aurora Background ── */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -3; pointer-events: none;
  background:
    radial-gradient(ellipse 1600px 900px at 75% -5%, rgba(30, 70, 140, .45) 0%, transparent 55%),
    radial-gradient(ellipse 1200px 800px at 15% 5%, rgba(20, 50, 110, .35) 0%, transparent 50%),
    radial-gradient(ellipse 800px 600px at 50% 100%, rgba(80, 40, 160, .12) 0%, transparent 60%);
}

/* ── Dot Grid ── */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  opacity: .08;
  background-image: radial-gradient(circle at 1px 1px, rgba(200,220,255,.8) .6px, transparent 0);
  background-size: 28px 28px;
}

/* ── Grain Overlay (applied via JS to #grain) ── */
#grain {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  opacity: .035;
  mix-blend-mode: overlay;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.space-bg, .stars { display: none; }

/* ── Custom Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: rgba(78,161,255,.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(78,161,255,.45); }

/* ── Scroll Progress Bar ── */
#scrollProgress {
  position: fixed; top: 0; left: 0; height: 2px; z-index: 1002;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  width: 0; transition: none;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ═══════════════════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════════════════ */
.top-nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h); z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(14px, 3vw, 28px);
  background: rgba(3, 7, 18, .72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  transition: background .3s var(--ease-smooth), box-shadow .3s var(--ease-smooth);
}
.top-nav.scrolled {
  background: rgba(3, 7, 18, .92);
  box-shadow: 0 4px 30px rgba(0,0,0,.4);
}

.nav-brand {
  font-family: "Orbitron", "Sora", sans-serif;
  font-size: .95rem; font-weight: 700; letter-spacing: .04em;
  display: inline-flex; align-items: center; gap: 7px;
  transition: transform .25s var(--ease-spring);
}
.nav-brand:hover { transform: scale(1.03); }
.brand-accent { color: var(--accent-2); }

/* ── Language Toggle ── */
.nav-actions { display: flex; align-items: center; gap: 8px; }
.lang-toggle {
  height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: transparent; color: var(--accent);
  font-family: "Orbitron", sans-serif; font-size: .68rem; font-weight: 700;
  letter-spacing: .1em; cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
}
.lang-toggle:hover { border-color: var(--accent); background: rgba(78,161,255,.12); color: var(--text-0); }

/* ── Hamburger ── */
.hamburger {
  width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: transparent; cursor: pointer;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  transition: border-color .2s, background .2s, transform .2s;
}
.hamburger:hover { border-color: var(--accent); background: rgba(78,161,255,.08); }
.hamburger span {
  width: 18px; height: 1.5px; border-radius: 2px;
  background: var(--text-0);
  transition: transform .25s var(--ease-out), opacity .2s;
}
.hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── Nav Menu ── */
.nav-menu {
  position: fixed; top: var(--nav-h); right: 0;
  width: min(90vw, 300px);
  height: calc(100dvh - var(--nav-h));
  transform: translateX(100%);
  transition: transform .35s var(--ease-out);
  background: rgba(6, 12, 26, .96);
  border-left: 1px solid var(--line);
  padding: 10px;
  overflow-y: auto; z-index: 1001;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.nav-menu.open { transform: translateX(0); }

.nav-link {
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--r-sm); padding: 11px 12px;
  color: var(--text-2); font-size: .84rem; font-weight: 500;
  border: 1px solid transparent;
  transition: all .2s var(--ease-smooth);
}
.nav-link:hover {
  background: rgba(78,161,255,.08); border-color: var(--line);
  color: var(--text-0); transform: translateX(-3px);
}
.nav-link.active {
  background: linear-gradient(135deg, rgba(78,161,255,.14), rgba(0,212,255,.08));
  border-color: rgba(78,161,255,.3); color: #fff; font-weight: 600;
}

.nav-icon { width: 22px; text-align: center; flex-shrink: 0; font-size: .9rem; }
.nav-divider { height: 1px; margin: 8px 10px; background: linear-gradient(90deg, transparent, var(--line), transparent); }
.nav-overlay {
  position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0;
  z-index: 1000; opacity: 0; pointer-events: none;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(4px);
  transition: opacity .3s;
}
.nav-overlay.active { opacity: 1; pointer-events: auto; }

/* ── Focus ── */
.nav-link:focus-visible, .hamburger:focus-visible,
.btn:focus-visible, .chip:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-2); outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   PAGE LAYOUT
   ═══════════════════════════════════════════════════════════ */
.page-header {
  max-width: var(--container); margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) clamp(16px, 3vw, 28px) clamp(16px, 3vw, 24px);
}
.page-header .page-icon {
  display: inline-block; font-size: 2.4rem; margin-bottom: 10px;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}
.page-header h1 {
  margin: 0 0 12px;
  font-family: "Orbitron", "Sora", sans-serif;
  font-size: clamp(1.5rem, 3.8vw, 2.8rem);
  font-weight: 700; letter-spacing: -.01em; line-height: 1.15;
  background: linear-gradient(135deg, var(--text-0) 0%, var(--accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-header p {
  margin: 0; color: var(--text-2); line-height: 1.65;
  max-width: 70ch; font-size: .92rem;
}

.container {
  max-width: var(--container); margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 28px) clamp(40px, 6vw, 80px);
}

.section-title {
  margin: 0 0 14px;
  font-size: 1.05rem; font-weight: 700; letter-spacing: .01em;
  color: var(--text-0);
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: ""; width: 3px; height: 18px; border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   STATS ROW
   ═══════════════════════════════════════════════════════════ */
.stats-row {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 28px;
}

.stat-card {
  position: relative; padding: 18px 20px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  transition: border-color .25s, transform .3s var(--ease-spring), box-shadow .3s;
}
.stat-card::before {
  content: ""; position: absolute; top: -40px; right: -40px;
  width: 100px; height: 100px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  opacity: 0; transition: opacity .3s;
}
.stat-card:hover {
  border-color: var(--line-hover); transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}
.stat-card:hover::before { opacity: 1; }

.stat-icon-lg { font-size: 1.3rem; margin-bottom: 8px; }
.stat-val {
  font-family: "Orbitron", "Sora", sans-serif;
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 700; line-height: 1;
}
.stat-lbl {
  margin-top: 8px; color: var(--text-2);
  font-size: .72rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.card, .chart-card {
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 20px;
  transition: border-color .25s, box-shadow .3s;
}
.card:hover, .chart-card:hover {
  border-color: var(--line-hover);
}

.card-hover {
  transition: border-color .2s, background .2s, transform .3s var(--ease-spring), box-shadow .3s;
}
.card-hover:hover {
  transform: translateY(-4px);
  border-color: var(--line-hover);
  box-shadow: var(--shadow-md);
}

/* Glow Card Variant */
.card-glow {
  position: relative;
}
.card-glow::after {
  content: ""; position: absolute; inset: -1px;
  border-radius: inherit; z-index: -1;
  background: linear-gradient(135deg, var(--accent-glow), transparent 50%, rgba(132,94,247,.2));
  opacity: 0; transition: opacity .3s;
}
.card-glow:hover::after { opacity: 1; }

/* ═══════════════════════════════════════════════════════════
   FILTERS & BUTTONS
   ═══════════════════════════════════════════════════════════ */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }

.chip {
  border-radius: var(--r-full); cursor: pointer;
  border: 1px solid var(--line); background: rgba(255,255,255,.02);
  color: var(--text-2); padding: 7px 14px;
  font-size: .78rem; font-weight: 600; letter-spacing: .02em;
  transition: all .2s var(--ease-smooth);
}
.chip:hover { background: rgba(78,161,255,.1); border-color: var(--line-hover); color: var(--text-0); }
.chip.active {
  background: linear-gradient(135deg, rgba(78,161,255,.2), rgba(0,212,255,.1));
  border-color: var(--accent); color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: rgba(255,255,255,.03); color: var(--text-0);
  font-size: .84rem; font-weight: 600; padding: 10px 16px;
  transition: all .2s var(--ease-smooth);
}
.btn:hover { background: rgba(78,161,255,.1); border-color: var(--line-hover); transform: translateY(-1px); }

.btn-primary {
  background: linear-gradient(135deg, #2d7fff, #0099ff);
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 20px rgba(45,127,255,.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(45,127,255,.45);
}

.btn-danger { border-color: rgba(255,90,101,.4); color: var(--danger); }
.btn-danger:hover { background: rgba(255,90,101,.12); }

/* ═══════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: var(--r-full); padding: 3px 10px;
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap;
}
.badge-high, .badge-critical {
  border: 1px solid rgba(255,90,101,.45); background: rgba(255,90,101,.12); color: #ff8d95;
}
.badge-medium {
  border: 1px solid rgba(255,176,56,.45); background: rgba(255,176,56,.1); color: #ffc55c;
}
.badge-low {
  border: 1px solid rgba(34,214,142,.4); background: rgba(34,214,142,.1); color: #5ae8b1;
}
.badge-info {
  border: 1px solid rgba(78,161,255,.4); background: rgba(78,161,255,.1); color: #74b8ff;
}
.badge-unknown {
  border: 1px solid rgba(126,147,189,.3); background: rgba(126,147,189,.08); color: #9eb0dd;
}

/* Live Pulse */
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger-glow);
  animation: pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 4px var(--danger-glow); }
  50% { box-shadow: 0 0 16px var(--danger-glow), 0 0 32px var(--danger-glow); }
}

/* ═══════════════════════════════════════════════════════════
   DATA TABLE
   ═══════════════════════════════════════════════════════════ */
.data-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.data-table thead th {
  font-size: .72rem; color: var(--text-3); text-transform: uppercase;
  letter-spacing: .07em; padding: 10px 12px; border-bottom: 1px solid var(--line);
  text-align: left; font-weight: 600;
}
.data-table tbody td {
  padding: 12px; border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
}
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover td { background: rgba(78,161,255,.06); }

/* ═══════════════════════════════════════════════════════════
   MAP
   ═══════════════════════════════════════════════════════════ */
.map-wrap {
  border-radius: var(--r-lg); border: 1px solid var(--line);
  overflow: hidden; box-shadow: var(--shadow-lg);
  position: relative;
}
.map-wrap::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 60px rgba(3,7,18,.4);
  border-radius: inherit;
}
#conflict-map, .leaflet-map { width: 100%; height: 560px; background: var(--bg-0); }

.map-legend {
  background: rgba(3, 7, 18, .85); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 12px 14px;
  backdrop-filter: blur(12px);
}

/* ═══════════════════════════════════════════════════════════
   CHARTS
   ═══════════════════════════════════════════════════════════ */
.chart-wrap { position: relative; min-height: 250px; }

/* ═══════════════════════════════════════════════════════════
   LOADING & EMPTY STATES
   ═══════════════════════════════════════════════════════════ */
.loader {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--text-2); padding: 48px 0; font-size: .88rem;
}
.spin {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.1);
  border-top-color: var(--accent);
  animation: rm-spin 800ms linear infinite;
}
@keyframes rm-spin { to { transform: rotate(360deg); } }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.08) 50%, rgba(255,255,255,.04) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.empty-state {
  border: 1px dashed var(--line); border-radius: var(--r-md);
  text-align: center; color: var(--text-2);
  background: rgba(255,255,255,.01); padding: 48px 24px;
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: .6; }
.empty-state h3 { margin: 0 0 6px; color: var(--text-1); font-size: 1.05rem; }
.empty-state p { margin: 0; font-size: .88rem; }

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════ */
#toast-root {
  position: fixed; right: 16px; bottom: 16px; z-index: 3000;
  display: grid; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto;
  transform: translateX(120%); transition: transform .35s var(--ease-out);
  max-width: min(92vw, 380px);
  background: rgba(6, 12, 26, .94); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--text-0);
  padding: 12px 16px; font-size: .85rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
}
.toast.show { transform: translateX(0); }
.toast.success { border-color: rgba(34,214,142,.45); }
.toast.error { border-color: rgba(255,90,101,.45); }
.toast.warning { border-color: rgba(255,176,56,.45); }

/* ═══════════════════════════════════════════════════════════
   NEWS GRID & CARDS
   ═══════════════════════════════════════════════════════════ */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--gap);
}
.news-card {
  border-radius: var(--r-md); border: 1px solid var(--line);
  overflow: hidden; background: var(--card);
  display: flex; flex-direction: column;
  transition: all .3s var(--ease-spring);
}
.news-card:hover {
  border-color: var(--line-hover); transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.news-card-img {
  height: 170px; overflow: hidden; position: relative;
  background: linear-gradient(135deg, rgba(24,41,82,.6), rgba(8,17,40,.8));
}
.news-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease-out); }
.news-card:hover .news-card-img img { transform: scale(1.06); }
.news-card-img::after {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(transparent, rgba(3,7,18,.7));
}

.news-card-body { padding: 16px; flex: 1; }
.news-card-title { margin: 0 0 8px; font-size: .92rem; line-height: 1.4; font-weight: 600; }
.news-card-title a { transition: color .2s; }
.news-card-title a:hover { color: var(--accent); }
.news-card-excerpt { margin: 0; font-size: .82rem; color: var(--text-2); line-height: 1.55; }

.news-card-footer {
  padding: 12px 16px; border-top: 1px solid var(--line);
  color: var(--text-3); font-size: .75rem;
  display: flex; align-items: center; justify-content: space-between;
}

/* ═══════════════════════════════════════════════════════════
   ALERT CARDS
   ═══════════════════════════════════════════════════════════ */
.alert-item {
  border: 1px solid var(--line); border-left: 3px solid var(--danger);
  border-radius: var(--r-sm); padding: 14px 16px;
  background: rgba(255,255,255,.015);
  transition: all .2s var(--ease-smooth);
}
.alert-item:hover {
  border-color: var(--line-hover); border-left-color: var(--danger);
  background: rgba(255,90,101,.04);
}
.alert-item h3 { margin: 0 0 6px; font-size: .88rem; font-weight: 600; }
.alert-item p { margin: 0; color: var(--text-2); font-size: .82rem; line-height: 1.5; }
.alert-meta {
  margin-top: 8px; color: var(--text-3); font-size: .73rem;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}

/* ═══════════════════════════════════════════════════════════
   SCROLL REVEAL ANIMATIONS
   ═══════════════════════════════════════════════════════════ */
.reveal {
  opacity: 0; transform: translateY(30px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-left {
  opacity: 0; transform: translateX(-40px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
}
.reveal-left.visible { opacity: 1; transform: translateX(0); }
.reveal-right {
  opacity: 0; transform: translateX(40px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
}
.reveal-right.visible { opacity: 1; transform: translateX(0); }
.reveal-scale {
  opacity: 0; transform: scale(.92);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-spring);
}
.reveal-scale.visible { opacity: 1; transform: scale(1); }

/* Stagger children */
.stagger > * { opacity: 0; transform: translateY(20px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); }
.stagger.visible > * { opacity: 1; transform: translateY(0); }
.stagger.visible > *:nth-child(1) { transition-delay: 0s; }
.stagger.visible > *:nth-child(2) { transition-delay: .06s; }
.stagger.visible > *:nth-child(3) { transition-delay: .12s; }
.stagger.visible > *:nth-child(4) { transition-delay: .18s; }
.stagger.visible > *:nth-child(5) { transition-delay: .24s; }
.stagger.visible > *:nth-child(6) { transition-delay: .3s; }
.stagger.visible > *:nth-child(7) { transition-delay: .36s; }
.stagger.visible > *:nth-child(8) { transition-delay: .42s; }

/* ═══════════════════════════════════════════════════════════
   FORM ELEMENTS (for settings page)
   ═══════════════════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: .78rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.form-input, .form-select {
  padding: 10px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: rgba(255,255,255,.03);
  color: var(--text-0); font-size: .88rem;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}
.form-select { appearance: none; cursor: pointer; }

/* Toggle Switch */
.toggle { position: relative; width: 44px; height: 24px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0; border-radius: 12px;
  background: rgba(255,255,255,.1); border: 1px solid var(--line);
  transition: background .2s, border-color .2s;
}
.toggle-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-2); transition: transform .25s var(--ease-spring), background .2s;
}
.toggle input:checked + .toggle-track {
  background: rgba(78,161,255,.3); border-color: var(--accent);
}
.toggle input:checked + .toggle-track::after {
  transform: translateX(20px); background: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════ */
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-3); }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .72rem; }
.text-center { text-align: center; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 28px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 28px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --nav-h: 56px; }
  .page-header h1 { font-size: clamp(1.3rem, 5vw, 2rem); }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr; }
  #conflict-map, .leaflet-map { height: 400px; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; gap: 10px; }
  .filter-bar { gap: 6px; }
  .chip { padding: 6px 10px; font-size: .74rem; }
}

/* ═══════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════ */
@media print {
  body { background: #fff; color: #111; padding-top: 0; }
  body::before, body::after, #grain, #scrollProgress, .top-nav, #toast-root, .hamburger { display: none !important; }
  .card, .stat-card, .chart-card { border: 1px solid #ddd; background: #fff; box-shadow: none; backdrop-filter: none; }
  .page-header h1 { -webkit-text-fill-color: #111; background: none; }
}

/* ═══════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .reveal-left, .reveal-right, .reveal-scale,
  .stagger > * { opacity: 1; transform: none; }
}

/* --- Honesty capability labels (spec: LIVE/NEAR-REAL-TIME/EXPERIMENTAL/DEGRADED/REPLAY) --- */
.honesty {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--r-full); padding: 4px 12px;
  font-size: .66rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; white-space: nowrap;
  vertical-align: middle;
}
.honesty::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.honesty-live { border: 1px solid rgba(34,214,142,.5); background: rgba(34,214,142,.1); color: #5ae8b1; }
.honesty-nrt { border: 1px solid rgba(78,161,255,.5); background: rgba(78,161,255,.1); color: #74b8ff; }
.honesty-experimental { border: 1px solid rgba(255,176,56,.5); background: rgba(255,176,56,.1); color: #ffc55c; }
.honesty-degraded { border: 1px solid rgba(126,147,189,.4); background: rgba(126,147,189,.09); color: #9eb0dd; }
.honesty-replay { border: 1px solid rgba(183,155,255,.5); background: rgba(183,155,255,.1); color: #c6adff; }
.honesty-note { display:block; margin-top:10px; font-size:.76rem; color: var(--text-2); max-width: 70ch; }
.honesty-note b { color: var(--text-1); font-weight:600; }

/* --- Bidirectional text: feed content can arrive in RTL (Arabic/Hebrew) or
   mixed scripts. `unicode-bidi: plaintext` makes each element auto-detect its
   base direction from its first strong character (like dir="auto"), so titles
   and summaries render correctly regardless of the source language. --- */
.tile-title, .tile-src,
.alert-item h3, .alert-item p,
.country-item strong,
.zone-item h3, .zone-item p,
.quick-item h3, .quick-item p,
.hero-feature h2, .hero-feature p,
.src-item strong, .source-item strong {
  unicode-bidi: plaintext;
}
