/* TornadoScanner styles, built from the designer's round-one tokens (calm slate
   surfaces, one teal brand accent, NWS hazard colours kept for danger only). */
:root {
  --surface: #f4f6f7; --raised: #ffffff; --sunken: #e8ecef; --line: #d3dae0; --line-strong: #7d8b97;
  --ink: #111b24; --muted: #4b5a67; --brand: #0a6669; --brand-ink: #ffffff; --brand-soft: #dcefee; --focus: #0a6669;
  --tw: #ff0000; --tw-strong: #b0001a; --emergency: #6e0b57; --svr: #ffa500; --twatch: #ffff00; --twatch-banner: #ffd60a;
  --svr-watch: #db7093; --on-light: #140f05; --on-dark: #ffffff; --stale: #9a4a00; --down: #b0001a;
  --ef0: #5288bf; --ef1: #3a72b0; --ef2: #2a5598; --ef3: #463690; --ef4: #331764; --ef5: #1c0540; --efu: #7d8b97;
  --shadow-float: 0 2px 8px rgba(17, 27, 36, .14); --shadow-sheet: 0 -6px 24px rgba(17, 27, 36, .16);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Map colours stay the same in dark mode, because every map uses the light Liberty style. */
  --map-ef0: #5288bf; --map-ef1: #3a72b0; --map-ef2: #2a5598; --map-ef3: #463690; --map-ef4: #331764; --map-ef5: #1c0540; --map-efu: #7d8b97; --map-track: #111b24;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #0c1217; --raised: #141c23; --sunken: #080d11; --line: #25313b; --line-strong: #6b7c8a;
    --ink: #e5ebef; --muted: #9aa9b5; --brand: #5cc0bd; --brand-ink: #05211f; --brand-soft: #123332; --focus: #7fd6d3;
    --stale: #f2a33a; --down: #ff6b6b;
    --ef0: #4f7aa3; --ef1: #6593c8; --ef2: #7fa9dc; --ef3: #b0a6f2; --ef4: #cfc3f8; --ef5: #efe8ff; --efu: #6b7c8a;
    --shadow-float: 0 2px 8px rgba(0, 0, 0, .5); --shadow-sheet: 0 -6px 24px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --surface: #0c1217; --raised: #141c23; --sunken: #080d11; --line: #25313b; --line-strong: #6b7c8a;
  --ink: #e5ebef; --muted: #9aa9b5; --brand: #5cc0bd; --brand-ink: #05211f; --brand-soft: #123332; --focus: #7fd6d3;
  --stale: #f2a33a; --down: #ff6b6b;
  --ef0: #4f7aa3; --ef1: #6593c8; --ef2: #7fa9dc; --ef3: #b0a6f2; --ef4: #cfc3f8; --ef5: #efe8ff; --efu: #6b7c8a;
  --shadow-float: 0 2px 8px rgba(0, 0, 0, .5); --shadow-sheet: 0 -6px 24px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.5; }
@media (min-width: 900px) { body { font-size: 16px; } }
a { color: var(--brand); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
img, svg { max-width: 100%; }
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-weight: 500; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 900px) { .wrap { padding: 0 32px; } }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--raised); border-bottom: 1px solid var(--line); }
.site-header .bar { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; color: var(--ink); text-decoration: none; min-height: 44px; }
.logo svg { width: 24px; height: 24px; color: var(--brand); }
.nav { display: none; gap: 4px; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: 15px; padding: 10px 12px; border-radius: 10px; }
.nav a:hover { background: var(--sunken); }
@media (min-width: 900px) { .nav { display: flex; } }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: none; color: var(--ink); cursor: pointer; }
.icon-btn:hover { background: var(--sunken); }
.menu-panel { border-top: 1px solid var(--line); padding: 8px 16px 16px; display: grid; gap: 2px; }
.menu-panel a { color: var(--ink); text-decoration: none; padding: 12px 8px; border-radius: 8px; font-weight: 500; }
.menu-panel[hidden] { display: none; }
@media (min-width: 900px) { .menu-toggle { display: none; } }

/* Type */
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 650; }
h2 { font-size: 21px; font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; }
@media (min-width: 900px) { h1 { font-size: 34px; } h2 { font-size: 24px; } }
.answer { font-size: 22px; font-weight: 700; line-height: 1.3; }
@media (min-width: 900px) { .answer { font-size: 28px; } }
.caption { font-size: 14px; color: var(--muted); }
.crumbs { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; border-radius: 10px; border: 0; background: var(--brand); color: var(--brand-ink); font: inherit; font-size: 16px; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--raised); color: var(--ink); border: 1.5px solid var(--line-strong); }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 15px; }
.btn.link { background: none; color: var(--brand); padding: 0 4px; min-height: 44px; }
.field { display: grid; gap: 6px; }
.field label, .label { font-size: 15px; font-weight: 600; }
input[type="search"], input[type="email"], input[type="text"], input[type="number"], select {
  width: 100%; min-height: 52px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--line-strong);
  background: var(--raised); color: var(--ink); font: inherit; font-size: 17px;
}
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; min-width: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--brand); flex-shrink: 0; }

/* Search suggestions */
.search-box { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--raised); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-float); list-style: none; margin: 0; padding: 6px; max-height: 320px; overflow: auto; }
.suggest[hidden] { display: none; }
.suggest li a, .suggest li button { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 12px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; min-height: 44px; }
.suggest li a:hover, .suggest li a[aria-selected="true"], .suggest li button:hover { background: var(--brand-soft); }
.suggest .kind { font-size: 13px; color: var(--muted); }

/* Status banners and chips */
.status { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line); }
.status .dot { width: 12px; height: 12px; border-radius: 99px; background: var(--brand); flex-shrink: 0; margin-top: 7px; }
.status.warning { background: var(--tw-strong); color: var(--on-dark); border-color: var(--tw-strong); }
.status.warning a { color: var(--on-dark); }
.status.warning .dot { background: var(--on-dark); }
.status.watch { background: var(--twatch-banner); color: var(--on-light); border-color: var(--twatch-banner); }
.status.watch a { color: var(--on-light); }
.status.watch .dot { background: var(--on-light); }
.status.stale { border-color: var(--stale); }
.status.stale .dot { background: var(--stale); }
.status .when { font-size: 14px; opacity: .85; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 10px; border-radius: 6px; font-size: 14px; font-weight: 600; }
.chip.tw { background: var(--tw-strong); color: var(--on-dark); }
.chip.tww { background: var(--twatch-banner); color: var(--on-light); }
.chip.svr { background: var(--svr); color: var(--on-light); }
.chip.svw { background: var(--svr-watch); color: var(--on-light); }
.chip.calm { background: var(--brand-soft); color: var(--ink); }

/* Live pill */
.live-pill { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--raised); color: var(--ink); box-shadow: var(--shadow-float); font-size: 13px; font-weight: 600; }
.live-pill .pulse { width: 8px; height: 8px; border-radius: 99px; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.live-pill.stale .pulse { background: var(--stale); box-shadow: none; }
.live-pill.down .pulse { background: var(--down); box-shadow: none; }
/* The live dot breathes twice after each update and then rests, because WCAG 2.2.2 asks that
   nothing move on its own for more than five seconds. TS.breathe() restarts it. */
@media (prefers-reduced-motion: no-preference) { .live-pill.breathe:not(.stale):not(.down) .pulse { animation: pulse 2s cubic-bezier(0.2, 0, 0, 1) 2; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }

/* Layout pieces */
.hero { padding: 14px 0 14px; display: grid; gap: 10px; }
.hero p { margin: 0; }
@media (min-width: 900px) { .hero { gap: 14px; padding: 20px 0; } }
.section { padding: 28px 0; border-top: 1px solid var(--line); display: grid; gap: 16px; }
/* Grid children shrink to the column, so a wide table scrolls inside its frame instead of widening the page. */
.section > *, .hero > * { min-width: 0; }
.card { background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; gap: 24px; } }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.tile { background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 2px; }
.tile .k { font-size: 14px; font-weight: 600; color: var(--muted); }
.tile .v { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile .n { font-size: 13px; color: var(--muted); }
.keyline { font-size: 17px; line-height: 1.45; margin: 0; }
@media (min-width: 900px) { .keyline { font-size: 18px; } }
.prelim { display: inline-block; font-size: 13px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--sunken); color: var(--muted); }

/* Maps */
.map { position: relative; height: 420px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--sunken); }
@media (min-width: 900px) { .map { height: 520px; } }
.map .live-pill { position: absolute; top: 12px; left: 12px; z-index: 5; }
.map-hint { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); z-index: 5; background: var(--ink); color: var(--surface); font-size: 13px; padding: 8px 12px; border-radius: 8px; pointer-events: none; transition: opacity .3s; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.line { height: 4px; }
.maplibregl-ctrl-group button { width: 44px !important; height: 44px !important; }
/* The map is always the light Liberty style, so its zoom buttons stay white in dark mode too. */
.maplibregl-ctrl-group { background: #ffffff !important; box-shadow: 0 2px 8px rgba(17, 27, 36, .2) !important; }
.maplibregl-popup-content { background: var(--raised) !important; color: var(--ink); border-radius: 10px !important; box-shadow: var(--shadow-float) !important; padding: 12px 14px !important; font-family: var(--font); font-size: 15px; }
.maplibregl-popup-tip { border-top-color: var(--raised) !important; border-bottom-color: var(--raised) !important; }
.maplibregl-map .maplibregl-popup-close-button { width: 32px; height: 32px; font-size: 20px; color: var(--ink); }

/* Home: on phones the order is answer and search, then the map, then the alert list;
   on desktop the search and list sit in a left panel beside a full-height map. */
.home-grid { display: grid; grid-template-areas: "panel" "map" "list"; }
.home-panel { grid-area: panel; }
.home-map-wrap { grid-area: map; position: relative; }
.home-list { grid-area: list; padding: 16px; display: grid; gap: 12px; align-content: start; }
.home-panel .inner { padding: 16px; display: grid; gap: 14px; }
.home-grid .map { height: 58vh; min-height: 360px; border-radius: 0; border-left: 0; border-right: 0; }
@media (min-width: 1000px) {
  .home-grid { grid-template-columns: 400px 1fr; grid-template-rows: auto 1fr; grid-template-areas: "panel map" "list map"; height: calc(100vh - 57px); min-height: 620px; }
  .home-panel, .home-list { background: var(--raised); border-right: 1px solid var(--line); }
  .home-panel .inner { padding: 24px 24px 8px; }
  .home-list { overflow: auto; padding: 8px 24px 24px; }
  .home-grid .map { height: 100%; border: 0; }
}
/* Alert list */
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert-item a { display: grid; grid-template-columns: 6px 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); text-decoration: none; }
.alert-item a:hover { border-color: var(--line-strong); }
.alert-item .bar { align-self: stretch; border-radius: 3px; }
.alert-item .t { font-weight: 600; }
.alert-item .s { font-size: 14px; color: var(--muted); }
.alert-item .left { font-size: 14px; font-weight: 600; white-space: nowrap; }

/* Charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-family: var(--font); font-size: 12px; }
.chart .bar { fill: var(--brand); }
.chart .avg { stroke: var(--ink); stroke-width: 2; fill: none; }
.chart .axis { stroke: var(--line); }
.rating-bars { display: grid; gap: 8px; }
.rating-bars .row { display: grid; grid-template-columns: 48px 1fr 40px; gap: 10px; align-items: center; font-size: 15px; }
.rating-bars .track { height: 14px; background: var(--sunken); border-radius: 4px; overflow: hidden; }
.rating-bars .fill { height: 100%; border-radius: 4px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 14px; color: var(--muted); font-weight: 600; background: var(--sunken); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
/* Badges use the fixed map ramp in both themes. White text passes 4.5:1 from EF1 up; EF0 and
   unrated are too light for it (3.7:1 and 3.5:1), so they take dark text (4.7:1 and 5.0:1). */
.badge { display: inline-block; min-width: 40px; text-align: center; padding: 2px 8px; border-radius: 99px; font-size: 13px; font-weight: 700; color: #fff; }
.badge.light { color: #0c1a28; }
/* Map credit links are underlined so they stand apart from the credit text by more than colour.
   Map overrides are prefixed with .maplibregl-map because MapLibre's stylesheet loads after ours. */
.maplibregl-map .maplibregl-ctrl-attrib a { text-decoration: underline; }

/* Filter chips */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fchip { min-height: 44px; padding: 0 14px; border-radius: 99px; border: 1.5px solid var(--line-strong); background: var(--raised); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.fchip[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); }
.range { display: flex; gap: 8px; align-items: center; font-size: 15px; }
.range input { width: 96px; min-height: 44px; }

/* Alert page */
.alert-banner { color: var(--on-dark); background: var(--tw-strong); }
.alert-banner.watch { background: var(--twatch-banner); color: var(--on-light); }
.alert-banner.svr { background: var(--svr); color: var(--on-light); }
.alert-banner.svw { background: var(--svr-watch); color: var(--on-light); }
.alert-banner.emergency { background: var(--emergency); color: var(--on-dark); }
/* Only top and bottom are set here, so the .wrap side margin survives on phones. */
.alert-banner .inner { padding-top: 16px; padding-bottom: 16px; display: grid; gap: 6px; }
.alert-banner .type { font-weight: 700; display: flex; align-items: center; gap: 8px; font-size: 17px; }
.countdown { font-size: 32px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (min-width: 700px) { .countdown { font-size: 40px; } }
dl.facts { margin: 0; display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 14px; }
dl.facts dt { color: var(--muted); font-size: 15px; font-weight: 600; }
dl.facts dd { margin: 0; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
details.raw summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--brand); }
details.raw pre { white-space: pre-wrap; font-family: var(--mono); font-size: 13px; background: var(--sunken); padding: 14px; border-radius: 10px; overflow-x: auto; }

/* Waitlist and modules */
.module { background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: grid; gap: 12px; }
.module .soon { font-size: 13px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.form-msg { font-size: 15px; font-weight: 600; }

/* State and county lists */
.county-list { columns: 2; column-gap: 24px; padding: 0; margin: 0; list-style: none; }
@media (min-width: 700px) { .county-list { columns: 3; } }
@media (min-width: 1000px) { .county-list { columns: 4; } }
.county-list li { break-inside: avoid; padding: 4px 0; }
.county-list a { display: inline-flex; min-height: 32px; align-items: center; }
.state-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .state-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .state-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.state-grid a { display: flex; justify-content: space-between; gap: 8px; min-height: 44px; align-items: center; padding: 8px 12px; border-radius: 8px; background: var(--raised); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 15px; }
.state-grid a span { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }

/* Footer */
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); background: var(--raised); padding: 24px 0 40px; font-size: 15px; }
.site-footer .disclaimer { font-weight: 600; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; }
.site-footer nav a { min-height: 44px; display: inline-flex; align-items: center; }
.footer-h { font-size: 16px; margin-top: 18px; }
.footer-states { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px !important; margin: 6px 0 14px; }
@media (min-width: 700px) { .footer-states { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .footer-states { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.footer-states a { min-height: 36px !important; font-size: 15px; }
.prose { max-width: 720px; display: grid; gap: 14px; }
.prose p, .prose ul { margin: 0; }

/* Link cards and round-two pieces */
a.card { color: var(--ink); text-decoration: none; display: grid; gap: 6px; }
a.card:hover { border-color: var(--line-strong); }
a.card h2, a.card h3 { color: var(--brand); }
.outlook-card { display: grid; gap: 8px; }
.today-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .today-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.month-bar .bar.now { fill: var(--ink); }
.alert-item .when { font-size: 13px; color: var(--muted); }
@media print {
  .site-header, .site-footer, .btn, .crumbs { display: none !important; }
  body { background: #fff; color: #000; }
  .section { border: 0; padding: 12px 0; }
}
/* Watches type filters sit two to a row on phones, wrapping onto two lines so every NWS name stays whole. */
@media (max-width: 599px) {
  [data-type-chips] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  [data-type-chips] .fchip { padding: 6px 10px; font-size: 14px; line-height: 1.25; text-align: left; border-radius: 12px; display: flex; align-items: center; }
}
.fchip[data-period] { text-align: left; }
