:root,
[data-theme="dark"] {
  --bg: #05070c;
  --bg-elevated: rgba(5, 8, 15, 0.84);
  --bg-card: rgba(15, 23, 42, 0.82);
  --bg-card-hover: rgba(30, 41, 59, 0.98);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #cbd5e1;
  --border: rgba(148, 163, 184, 0.25);
  --border-subtle: rgba(148, 163, 184, 0.18);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  --map-bg: #08111f;
  --popup-bg: #020617;
  --ticker-bg: rgba(2, 6, 23, 0.92);
  --nav-bg: rgba(5, 8, 15, 0.92);
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.16);
  --live-bg: rgba(239, 68, 68, 0.16);
  --live-text: #fecaca;
  --live-border: rgba(248, 113, 113, 0.35);
  --tile-url: "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png";
  --zoom-bg: rgba(15, 23, 42, 0.94);
  --zoom-text: #fff;
  --zoom-border: rgba(148, 163, 184, 0.24);
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --bg-elevated: rgba(255, 255, 255, 0.92);
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #475569;
  --border: rgba(100, 116, 139, 0.28);
  --border-subtle: rgba(100, 116, 139, 0.16);
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
  --map-bg: #e2e8f0;
  --popup-bg: #ffffff;
  --ticker-bg: rgba(255, 255, 255, 0.96);
  --nav-bg: rgba(255, 255, 255, 0.94);
  --accent: #0284c7;
  --accent-soft: rgba(2, 132, 199, 0.12);
  --live-bg: rgba(239, 68, 68, 0.12);
  --live-text: #b91c1c;
  --live-border: rgba(239, 68, 68, 0.35);
  --tile-url: "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png";
  --zoom-bg: rgba(255, 255, 255, 0.96);
  --zoom-text: #0f172a;
  --zoom-border: rgba(100, 116, 139, 0.28);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background 0.2s ease, color 0.2s ease;
}

/* Site nav */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.site-nav .brand {
  font-weight: 900;
  font-size: 15px;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
}

.site-nav .brand span {
  color: var(--accent);
}

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

.nav-links a {
  color: var(--text-subtle);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}

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

.theme-toggle {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text);
  padding: 8px 12px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  min-width: 42px;
  min-height: 38px;
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
}

/* Blog layout */
.blog-page {
  padding: 72px 18px 48px;
  max-width: 920px;
  margin: 0 auto;
}

.blog-hero {
  margin-bottom: 36px;
}

.blog-hero h1 {
  font-size: clamp(28px, 5vw, 40px);
  margin: 0 0 10px;
  letter-spacing: -0.04em;
}

.blog-hero .author-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.author-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 22px;
  color: white;
  flex-shrink: 0;
}

.author-card h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.author-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.blog-intro {
  color: var(--text-subtle);
  font-size: 16px;
  line-height: 1.6;
  max-width: 640px;
}

.article-grid {
  display: grid;
  gap: 16px;
}

.article-card {
  display: block;
  padding: 20px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.article-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.article-card .category {
  display: inline-block;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 10px;
}

.article-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.article-card .excerpt {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
}

.article-card .meta {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Article detail */
.article-detail {
  padding: 72px 18px 60px;
  max-width: 720px;
  margin: 0 auto;
}

.article-detail .back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.article-detail .back-link:hover {
  text-decoration: underline;
}

.article-detail header {
  margin-bottom: 32px;
}

.article-detail .category {
  display: inline-block;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 12px;
}

.article-detail h1 {
  font-size: clamp(26px, 5vw, 36px);
  margin: 0 0 12px;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.article-detail .subtitle {
  color: var(--text-subtle);
  font-size: 17px;
  line-height: 1.5;
  margin: 0 0 16px;
}

.article-detail .byline {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.article-body {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-subtle);
}

.article-body p {
  margin: 0 0 1.25em;
}

.article-body h2 {
  color: var(--text);
  font-size: 20px;
  margin: 2em 0 0.75em;
  letter-spacing: -0.02em;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.25em;
  padding-left: 1.4em;
}

.article-body li {
  margin-bottom: 0.5em;
}

.article-body strong {
  color: var(--text);
}

.coming-soon-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

/* Storm catalog */
.catalog-page {
  max-width: 960px;
}

.catalog-section {
  margin-bottom: 48px;
}

.catalog-section-header {
  margin-bottom: 20px;
}

.catalog-section-header h2 {
  font-size: clamp(20px, 4vw, 26px);
  margin: 0 0 8px;
  letter-spacing: -0.03em;
}

.catalog-section-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.catalog-grid {
  display: grid;
  gap: 14px;
}

.catalog-card {
  display: block;
  position: relative;
  padding: 20px 22px 20px 58px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.catalog-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.rank-badge {
  position: absolute;
  left: 18px;
  top: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
  color: white;
}

.tornado-card .rank-badge {
  background: linear-gradient(135deg, #ef4444, #f97316);
}

.hurricane-card .rank-badge {
  background: linear-gradient(135deg, #0284c7, #6366f1);
}

.catalog-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.catalog-card .excerpt {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.catalog-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.catalog-detail {
  max-width: 760px;
}

.category-tornado {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
}

.category-hurricane {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
}

[data-theme="light"] .category-tornado {
  color: #b91c1c;
}

[data-theme="light"] .category-hurricane {
  color: #0369a1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.stats-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
}

.stats-item strong {
  display: block;
  font-size: 15px;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 4px;
}

.stats-item span {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.fun-facts {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 22px;
  margin-bottom: 32px;
}

.fun-facts h2 {
  margin: 0 0 14px;
  font-size: 16px;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.fun-facts ul {
  margin: 0;
  padding-left: 1.2em;
}

.fun-facts li {
  margin-bottom: 0.65em;
  color: var(--text-subtle);
  font-size: 15px;
  line-height: 1.55;
}

.fun-facts li:last-child {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .site-nav {
    padding: 8px 12px;
  }

  .nav-links a {
    font-size: 12px;
    padding: 7px 10px;
  }

  .blog-page,
  .article-detail {
    padding-top: 64px;
  }

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

  .catalog-card {
    padding-left: 22px;
    padding-top: 52px;
  }

  .rank-badge {
    left: 18px;
    top: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-card:hover {
    transform: none;
  }
}
