/* ===================================================================
   StormTracking — stormtracking.com
   Single-page live storm & winter-weather tracker
   =================================================================== */

:root {
  /* base surfaces */
  --bg:        #0a1120;
  --bg-2:      #0e1830;
  --panel:     #111d38;
  --panel-2:   #16233f;
  --line:      #22314f;
  --line-2:    #2c3f63;

  /* text */
  --ink:       #eaf1ff;
  --ink-soft:  #b7c4de;
  --ink-mute:  #7d8bab;

  /* brand + accents */
  --brand:     #38bdf8;   /* sky */
  --brand-2:   #22d3ee;

  /* severity / category palette */
  --cat5:      #f043a6;   /* magenta - major hurricane */
  --cat3:      #ff5a5f;   /* red */
  --cat1:      #ff8c42;   /* orange */
  --ts:        #ffd23f;   /* yellow - tropical storm */
  --td:        #7dd3fc;   /* light blue - depression */
  --tropwarn:  #ff6b6b;
  --winter:    #8b9dff;   /* icy indigo */
  --winter-2:  #67e8f9;
  --ok:        #34d399;

  --radius:    14px;
  --radius-sm: 10px;
  --shadow:    0 18px 50px -20px rgba(0,0,0,.7);
  --maxw:      1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 620px at 80% -8%, rgba(56,189,248,.14), transparent 60%),
    radial-gradient(900px 560px at -5% 10%, rgba(139,157,255,.12), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------------- Top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(10,17,32,.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand__mark { color: var(--brand); display: inline-flex; }
.brand__text { font-weight: 600; font-size: 1.15rem; letter-spacing: -.01em; }
.brand__text strong { font-weight: 800; color: var(--brand); }
.topnav { margin-left: auto; display: flex; gap: 6px; }
.topnav a {
  text-decoration: none; color: var(--ink-soft); font-weight: 500; font-size: .92rem;
  padding: 8px 12px; border-radius: 9px; transition: .15s;
}
.topnav a:hover { color: var(--ink); background: var(--panel); }

.livebox {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  padding: 6px 8px 6px 12px; border-radius: 999px;
}
.livedot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--ink-mute); flex: none;
  box-shadow: 0 0 0 0 rgba(52,211,153,.6);
}
.livedot.is-live { background: var(--ok); animation: pulse 2s infinite; }
.livedot.is-err  { background: var(--cat3); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,.55); }
  70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
.livebox__txt { display: flex; flex-direction: column; line-height: 1.15; }
#liveLabel { font-size: .78rem; font-weight: 600; }
.livebox__sub { font-size: .68rem; color: var(--ink-mute); font-family: "JetBrains Mono", monospace; }
.refreshbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-soft);
  cursor: pointer; transition: .15s;
}
.refreshbtn:hover { color: var(--ink); border-color: var(--line-2); transform: rotate(-40deg); }
.refreshbtn.is-spin svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Hero ---------------- */
.hero { padding: 52px 0 30px; }
.hero__grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .16em; font-size: .72rem;
  color: var(--brand-2); font-weight: 600; margin: 0 0 12px;
}
.hero__title { font-size: clamp(1.9rem, 4vw, 2.9rem); font-weight: 800; }
.hero__sub { color: var(--ink-soft); font-size: 1.05rem; margin: 16px 0 0; max-width: 46ch; }

.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; position: relative; overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand);
}
.stat--tropical::before { background: linear-gradient(var(--cat3), var(--cat1)); }
.stat--warn::before { background: var(--tropwarn); }
.stat--winter::before { background: var(--winter); }
.stat--sev::before { background: var(--ts); }
.stat__num { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; }
.stat__num.is-sev { font-size: 1.35rem; line-height: 2.6rem; }
.stat__label { color: var(--ink-mute); font-size: .82rem; margin-top: 2px; }

/* ---------------- Sections ---------------- */
.section { padding: 34px 0; }
.section__head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.section__head h2 { font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.h2icon { font-size: 1.2rem; }
.section__meta { color: var(--ink-mute); font-size: .85rem; font-family: "JetBrains Mono", monospace; }

/* ---------------- Map ---------------- */
.map {
  height: 500px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--bg-2);
}
.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend__item { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; color: var(--ink-soft); }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot--td { background: #ffd43b; }
.dot--ts { background: #ff922b; }
.dot--tropwarn { background: #ff6b6b; }
.dot--winter { background: var(--winter); }
.swatch--hur { width: 30px; height: 11px; display: inline-block; border-radius: 3px;
  background: linear-gradient(90deg, #ff6b4a, #fa5252, #e64980, #be4bdb, #9c36b5); }
.cone { width: 13px; height: 11px; display: inline-block; border: 1px dashed rgba(255,255,255,.55); background: rgba(255,255,255,.06); border-radius: 2px; }
.leaflet-popup-content-wrapper { background: var(--panel); color: var(--ink); border-radius: 10px; }
.leaflet-popup-tip { background: var(--panel); }
.leaflet-popup-content { margin: 12px 14px; font-family: "Inter", sans-serif; }
.leaflet-container { font-family: "Inter", sans-serif; }
.popup h4 { margin: 0 0 6px; font-size: 1rem; }
.popup p { margin: 2px 0; font-size: .82rem; color: var(--ink-soft); }
.popup a { color: var(--brand-2); }

/* ---------------- Cards ---------------- */
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; position: relative; overflow: hidden; transition: .18s;
}
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card__name { font-size: 1.2rem; font-weight: 700; }
.card__sub { color: var(--ink-mute); font-size: .8rem; margin-top: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent;
}
.badge--td   { background: rgba(255,212,59,.16); color: #ffe071; border-color: rgba(255,212,59,.45); }
.badge--ts   { background: rgba(255,146,43,.16); color: #ffc599; border-color: rgba(255,146,43,.45); }
.badge--cat1 { background: rgba(255,107,74,.16); color: #ffb4a2; border-color: rgba(255,107,74,.45); }
.badge--cat2 { background: rgba(250,82,82,.16);  color: #ffa8a8; border-color: rgba(250,82,82,.45); }
.badge--cat3 { background: rgba(230,73,128,.18); color: #ff9ac1; border-color: rgba(230,73,128,.45); }
.badge--cat4 { background: rgba(190,75,219,.18); color: #e6a8f5; border-color: rgba(190,75,219,.45); }
.badge--cat5 { background: rgba(156,54,181,.20); color: #dca8e8; border-color: rgba(156,54,181,.50); }
.badge--extreme { background: rgba(240,67,166,.16); color: #ffa8dc; border-color: rgba(240,67,166,.45); }
.badge--severe  { background: rgba(255,90,95,.16); color: #ff9a9d; border-color: rgba(255,90,95,.4); }
.badge--moderate{ background: rgba(255,140,66,.15); color: #ffc199; border-color: rgba(255,140,66,.4); }
.badge--minor   { background: rgba(125,211,252,.14); color: #bde8ff; border-color: rgba(125,211,252,.4); }
.badge--winter  { background: rgba(139,157,255,.15); color: #c3ccff; border-color: rgba(139,157,255,.4); }

.metrics { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 4px 0 14px; }
.metric { background: rgba(0,0,0,.18); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; }
.metric__v { font-size: 1.05rem; font-weight: 700; font-family: "JetBrains Mono", monospace; }
.metric__k { font-size: .68rem; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.card__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; border-top: 1px solid var(--line); padding-top: 12px; }
.card__foot a { color: var(--brand-2); text-decoration: none; font-size: .82rem; font-weight: 600; }
.card__foot a:hover { text-decoration: underline; }
.move { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: .82rem; }
.move__arrow { display: inline-block; transition: transform .3s; }

.card--winter .card__name { font-size: 1.02rem; }
.card--winter .card__top { margin-bottom: 10px; }
.card__desc { color: var(--ink-soft); font-size: .85rem; margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* empty / info states */
.empty {
  grid-column: 1 / -1; text-align: center; padding: 44px 20px;
  border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--ink-mute);
  background: rgba(255,255,255,.015);
}
.empty h3 { color: var(--ink-soft); font-weight: 600; margin-bottom: 6px; font-size: 1.05rem; }
.empty code { background: var(--panel); padding: 2px 7px; border-radius: 6px; font-size: .82rem; color: var(--brand-2); }
.empty .ok { color: var(--ok); font-size: 2rem; display: block; margin-bottom: 8px; }

/* skeletons */
.skeleton {
  height: 170px; border-radius: var(--radius);
  background: linear-gradient(100deg, var(--panel) 30%, var(--panel-2) 50%, var(--panel) 70%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------- Alerts table ---------------- */
.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#alertSearch {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  padding: 9px 14px; border-radius: 10px; font-size: .88rem; width: 240px; font-family: inherit;
}
#alertSearch:focus { outline: none; border-color: var(--brand); }
.chips { display: flex; gap: 6px; }
.chip {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-soft);
  padding: 8px 14px; border-radius: 999px; font-size: .82rem; font-weight: 600; cursor: pointer; transition: .15s;
}
.chip:hover { color: var(--ink); }
.chip.is-active { background: var(--brand); color: #05213a; border-color: var(--brand); }

.alerttable { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.arow {
  display: grid; grid-template-columns: 210px 1fr 120px; gap: 14px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); align-items: center; transition: background .12s;
}
.arow:last-child { border-bottom: none; }
.arow:hover { background: var(--panel); }
.arow__event { font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: 9px; }
.arow__area { color: var(--ink-soft); font-size: .85rem; }
.arow__sev { justify-self: end; }
.evbar { width: 4px; height: 26px; border-radius: 3px; flex: none; }
.arow__empty { padding: 40px; text-align: center; color: var(--ink-mute); }

/* ---------------- Footer ---------------- */
.foot { border-top: 1px solid var(--line); margin-top: 30px; padding: 36px 0; background: rgba(0,0,0,.22); }
.foot__inner { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.brand--foot { margin-bottom: 10px; }
.foot__disclaimer { color: var(--ink-mute); font-size: .82rem; max-width: 54ch; margin: 0; }
.foot__disclaimer a { color: var(--brand-2); }
.foot__meta { color: var(--ink-mute); font-size: .8rem; text-align: right; }
.foot__meta p { margin: 3px 0; }
#footUpdated { font-family: "JetBrains Mono", monospace; }

/* ---------------- Advisory page ---------------- */
.hero--adv { padding: 34px 0 6px; }
.backlink { color: var(--brand-2); text-decoration: none; font-size: .9rem; font-weight: 600; display: inline-block; margin-bottom: 18px; }
.backlink:hover { text-decoration: underline; }
.adv-title-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.adv-title-row .hero__title { font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
.adv-updated { color: var(--ink-mute); font-size: .82rem; font-family: "JetBrains Mono", monospace; margin: 8px 0 0; }
.adv-metrics { grid-template-columns: repeat(6, 1fr); margin-top: 20px; max-width: 760px; }
.adv-metrics .metric__v { font-size: .95rem; }
.adv-section-title { font-size: 1.15rem; font-weight: 700; margin: 30px 0 12px; }
.adv-section-title:first-child { margin-top: 0; }
.advtext {
  white-space: pre-wrap; word-break: break-word;
  font-family: "JetBrains Mono", monospace; font-size: .82rem; line-height: 1.6;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; color: var(--ink-soft); overflow-x: auto;
}
@media (max-width: 720px) { .adv-metrics { grid-template-columns: repeat(3, 1fr); } }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; gap: 26px; }
  .topnav { display: none; }
  .arow { grid-template-columns: 1fr auto; }
  .arow__area { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .statgrid { grid-template-columns: 1fr; }
  .map { height: 380px; }
  .livebox__txt { display: none; }
}
