@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg:           #0a0f1a;
  --bg2:          #0f1624;
  --bg3:          #151d2e;
  --surface:      #1a2438;
  --surface2:     #1f2b40;
  --border:       rgba(99, 179, 237, 0.10);
  --border2:      rgba(99, 179, 237, 0.18);

  --text:         #e8edf5;
  --text2:        #94a3b8;
  --text3:        #64748b;

  --accent:       #38bdf8;
  --accent2:      #0ea5e9;
  --accent-glow:  rgba(56, 189, 248, 0.15);

  --very-low:     #22c55e;
  --low:          #84cc16;
  --moderate:     #eab308;
  --high:         #f97316;
  --extreme:      #ef4444;

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'DM Mono', monospace;

  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    20px;

  --nav-h:        64px;
  --transition:   0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg:           #f0f4f8;
  --bg2:          #e8edf5;
  --bg3:          #dde4ee;
  --surface:      #ffffff;
  --surface2:     #f8fafc;
  --border:       rgba(14, 165, 233, 0.12);
  --border2:      rgba(14, 165, 233, 0.22);
  --text:         #0f172a;
  --text2:        #475569;
  --text3:        #94a3b8;
  --accent:       #0284c7;
  --accent2:      #0369a1;
  --accent-glow:  rgba(2, 132, 199, 0.10);
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Noise texture overlay ──────────────────────────────────────────────── */
body::before {
  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='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ── Navbar ─────────────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(10, 15, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 2rem;
  transition: background var(--transition);
}

[data-theme="light"] .nav {
  background: rgba(240, 244, 248, 0.88);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text);
  flex-shrink: 0;
}

.nav-brand-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  flex: 1;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text2);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--surface);
}

.nav-links a.active {
  color: var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.nav-live-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text3);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.nav-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--very-low);
  box-shadow: 0 0 6px var(--very-low);
  animation: pulse 1.5s ease-in-out infinite;
}

.theme-toggle {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}

/* ── Page wrapper ───────────────────────────────────────────────────────── */
.page {
  padding-top: var(--nav-h);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Container ──────────────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.container-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Section ────────────────────────────────────────────────────────────── */
.section {
  padding: 5rem 0;
}

.section-sm {
  padding: 3rem 0;
}

/* ── Typography ─────────────────────────────────────────────────────────── */
.display {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.display-xl { font-size: clamp(3rem, 7vw, 5.5rem); }
.display-lg { font-size: clamp(2rem, 4vw, 3rem); }
.display-md { font-size: clamp(1.5rem, 3vw, 2rem); }

.label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--border2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.card-glass {
  background: rgba(26, 36, 56, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

[data-theme="light"] .card-glass {
  background: rgba(255,255,255,0.7);
}

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.6;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text2);
  font-weight: 500;
}

/* ── AERSI severity colors ──────────────────────────────────────────────── */
.aersi-very-low  { color: var(--very-low); }
.aersi-low       { color: var(--low); }
.aersi-moderate  { color: var(--moderate); }
.aersi-high      { color: var(--high); }
.aersi-extreme   { color: var(--extreme); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.badge-very-low  { background: rgba(34,197,94,0.12);  color: var(--very-low); }
.badge-low       { background: rgba(132,204,22,0.12); color: var(--low); }
.badge-moderate  { background: rgba(234,179,8,0.12);  color: var(--moderate); }
.badge-high      { background: rgba(249,115,22,0.12); color: var(--high); }
.badge-extreme   { background: rgba(239,68,68,0.12);  color: var(--extreme); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0a0f1a;
}

.btn-primary:hover {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(56,189,248,0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-glow);
}

/* ── Section headers ────────────────────────────────────────────────────── */
.section-header {
  margin-bottom: 3rem;
}

.section-header .label {
  display: block;
  margin-bottom: 0.75rem;
}

/* ── Divider ────────────────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ── Formula display ────────────────────────────────────────────────────── */
.formula-block {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent);
  text-align: center;
  letter-spacing: 0.04em;
}

/* ── Table ──────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--bg2);
  color: var(--text2);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
  margin-top: 6rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.footer-desc {
  font-size: 0.875rem;
  color: var(--text2);
  line-height: 1.7;
  max-width: 320px;
}

.footer-heading {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text2);
  transition: color var(--transition);
}

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

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text3);
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.animate-fade-up {
  animation: fadeUp 0.6s cubic-bezier(0.4,0,0.2,1) both;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav { padding: 0 1rem; gap: 1rem; }
  .container, .container-wide { padding: 0 1rem; }
  .section { padding: 3rem 0; }
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .footer-bottom { flex-direction: column; gap: 0.5rem; text-align: center; }

  .nav-links { display: none; }
  .mobile-menu-btn { display: flex !important; }
}

.mobile-menu-btn {
  display: none;
  width: 36px; height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border2);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text2);
  font-size: 1.1rem;
}

/* ── Gradient text ──────────────────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Glow effects ───────────────────────────────────────────────────────── */
.glow-accent {
  box-shadow: 0 0 40px rgba(56,189,248,0.15);
}
