/* wxdesk design system. Tokens first, then base, layout, components. See docs/design.md. */

@font-face {
  font-family: "Public Sans";
  src: url("/static/fonts/PublicSans-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  /* Palette (design review 2026-10-17). New names first, then the older names kept as aliases
     with the same values so existing rules and charts.js keep working. */
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #12263a;
  --muted: #53667a;
  --line: #d5dde5;
  --primary: #1f5f8b;
  --land: #e6e1d6;
  --water: #cfe2ee;
  --watch: #d98a00;
  --warning: #c62828;
  --advisory: #5b8db8;
  --caution: #b26a00;
  /* Text variants (R-175): the fills above stay as they are; use these when the colour is text. 4.5:1 or better on --surface and --bg, ratios in docs/design-tokens.md. */
  --watch-text: #8a5700;
  --amber-text: #7a5000;
  --advisory-text: #2f6690;
  --caution-text: #8f5400;
  --warning-text: #c62828;
  /* System fault (R-019): red stays for weather warnings; a data or job fault uses the caution text colour on the amber tint. */
  --fault: var(--caution-text);
  --tint-fault: var(--tint-amber);
  --on-watch: #12263a;
  --paper: #f4f6f8;
  --ink-muted: #53667a;
  --rule: #d5dde5;
  --edge: #7a8fa2;
  --link: #1f5f8b;
  --magenta: #b0177a;
  --amber: #d98e04;
  --amber-ink: #7a5000;
  --hold: #8db1cc;
  --hold-ink: #2b5a7d;
  --nws: #c62828;
  --ok: #1f6b45;
  --lv-none: #e9eef1;
  /* Map colours (D62): defined once, never in a dark block, so maps look the same in both themes. */
  --map-land: #eeede9;
  --map-water: #e1e5e9;
  --map-ink: #152233;
  --map-border: #6b7480;
  --map-inland: #4a6a88;
  --map-none: #f7f8f9;
  --map-label: #5f7c96;
  --map-hold: #8db1cc; /* alert levels: the light values, in both themes */
  --map-watch: #d98e04;
  --map-warning: #c62828;
  --tint-magenta: #f8e6f1;
  --tint-amber: #fbf0d8;
  --tint-hold: #e3eef6;
  --tint-nws: #fbe7e7;
  --tint-ok: #e3f2ea;
  --focus: #1f5f8b;

  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-1: 0.75rem;
  --fs-2: 0.875rem;
  --fs-3: 1rem;
  --fs-4: 1.25rem;
  --fs-5: 1.625rem;
  --fs-6: 2.25rem;
  --t-sm: var(--fs-2);
  --t-md: var(--fs-3);
  --t-lg: var(--fs-4);
  --t-xl: var(--fs-5);
  --t-2xl: var(--fs-6);
  --sp-1: 8px;
  --sp-2: 12px;
  --sp-3: 16px;
  --sp-4: 24px;
  --sp-5: 40px;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 40px;
  --tap: 44px;
  --nav-h: 56px;
  --radius: 6px;
  --max: 1120px;
  --sky-clear-a: #1c5ea8;
  --sky-clear-b: #2f74c4;
  --sky-over-a: #4a5868;
  --sky-over-b: #5f6d7e;
  --sky-storm-a: #262d38;
  --sky-storm-b: #46505e;
  --sky-night-a: #0f1d3a;
  --sky-night-b: #2a3b66;
  --sky-ink: #fff;
  --ic-sun: #f5b301;
  --ic-moon: #e9d98f;
  --ic-cloud: #e6ecf3;
  --ic-cloud-edge: #8a9bb0;
  --ic-storm: #b4c0ce;
  --ic-rain: #2f7fd8;
  --ic-snow: #7fb3e6;
  --ic-bolt: #f5b301;
  --ic-wind: #6b8bb0;
  --ic-fog: #9fb0c4;
}

/* Theme. The dark tokens appear twice, once for "Auto with a dark device" and once for the forced
   Dark choice (data-theme set by static/js/theme.js). Keep the two blocks identical;
   tests/test_theme_switch.py compares them. A forced Light choice skips the media block. */
:root[data-theme="light"] {
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1620;
    --surface: #15212e;
    --ink: #e8eef4;
    --muted: #9db0c2;
    --line: #263647;
    --primary: #6bb0de;
    --land: #1d2a33;
    --water: #0f2433;
    --paper: #0d1620;
    --ink-muted: #9db0c2;
    --rule: #263647;
    --edge: #5b7a92;
    --link: #6bb0de;
    --magenta: #f07ac0;
    --amber: #f2b33d;
    --amber-ink: #f2b33d;
    --watch-text: #f2b33d;
    --amber-text: #f2b33d;
    --advisory-text: #8db9d8;
    --caution-text: #e0a63a;
    --warning-text: #ff8a8a;
    --hold: #3f6a89;
    --hold-ink: #8db9d8;
    --nws: #ff8a8a;
    --ok: #6fd1a0;
    --lv-none: #22364b;
    --tint-magenta: #3a1d33;
    --tint-amber: #3a2e14;
    --tint-hold: #172f43;
    --tint-nws: #3b1e22;
    --tint-ok: #16352a;
    --focus: #6bb0de;
    --sky-clear-a: #1c5ea8;
    --sky-clear-b: #2f74c4;
    --sky-over-a: #4a5868;
    --sky-over-b: #5f6d7e;
    --sky-storm-a: #262d38;
    --sky-storm-b: #46505e;
    --sky-night-a: #0f1d3a;
    --sky-night-b: #2a3b66;
    --sky-ink: #fff;
    --ic-sun: #f5b301;
    --ic-moon: #e9d98f;
    --ic-cloud: #3d4e61;
    --ic-cloud-edge: #9db0c2;
    --ic-storm: #2c3948;
    --ic-rain: #5aa2f0;
    --ic-snow: #a9d0f5;
    --ic-bolt: #f5b301;
    --ic-wind: #9fb7d4;
    --ic-fog: #7f94a9;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1620;
  --surface: #15212e;
  --ink: #e8eef4;
  --muted: #9db0c2;
  --line: #263647;
  --primary: #6bb0de;
  --land: #1d2a33;
  --water: #0f2433;
  --paper: #0d1620;
  --ink-muted: #9db0c2;
  --rule: #263647;
  --edge: #5b7a92;
  --link: #6bb0de;
  --magenta: #f07ac0;
  --amber: #f2b33d;
  --amber-ink: #f2b33d;
  --watch-text: #f2b33d;
  --amber-text: #f2b33d;
  --advisory-text: #8db9d8;
  --caution-text: #e0a63a;
  --warning-text: #ff8a8a;
  --hold: #3f6a89;
  --hold-ink: #8db9d8;
  --nws: #ff8a8a;
  --ok: #6fd1a0;
  --lv-none: #22364b;
  --tint-magenta: #3a1d33;
  --tint-amber: #3a2e14;
  --tint-hold: #172f43;
  --tint-nws: #3b1e22;
  --tint-ok: #16352a;
  --focus: #6bb0de;
  --sky-clear-a: #1c5ea8;
  --sky-clear-b: #2f74c4;
  --sky-over-a: #4a5868;
  --sky-over-b: #5f6d7e;
  --sky-storm-a: #262d38;
  --sky-storm-b: #46505e;
  --sky-night-a: #0f1d3a;
  --sky-night-b: #2a3b66;
  --sky-ink: #fff;
  --ic-sun: #f5b301;
  --ic-moon: #e9d98f;
  --ic-cloud: #3d4e61;
  --ic-cloud-edge: #9db0c2;
  --ic-storm: #2c3948;
  --ic-rain: #5aa2f0;
  --ic-snow: #a9d0f5;
  --ic-bolt: #f5b301;
  --ic-wind: #9fb7d4;
  --ic-fog: #7f94a9;
}

/* Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-md) / 1.45 var(--font);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 var(--s-2);
  font-weight: 650;
}
h1 {
  font-size: var(--t-xl);
}
h2 {
  font-size: var(--t-lg);
}
h3 {
  font-size: var(--t-md);
}
p {
  margin: 0 0 var(--s-3);
}
a {
  color: var(--link);
  text-underline-offset: 2px;
}
a:hover {
  text-decoration-thickness: 2px;
}
small,
.muted {
  color: var(--ink-muted);
  font-size: var(--t-sm);
}
img,
svg,
canvas {
  max-width: 100%;
}
hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--s-5) 0;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: var(--s-2);
  top: -100px;
  background: var(--surface);
  padding: var(--s-2) var(--s-3);
  z-index: 50;
}
.skip:focus {
  top: var(--s-2);
}

/* Layout */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--s-4);
}
.page {
  padding-top: var(--s-4);
  padding-bottom: var(--s-5);
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-2) var(--s-4);
  margin-bottom: var(--s-4);
}
.page-head h1 {
  margin: 0;
}
.stack > * + * {
  margin-top: var(--s-4);
}
.section {
  padding-top: var(--s-4);
  border-top: 1px solid var(--rule);
  margin-top: var(--s-5);
}
.section > h2 {
  margin-bottom: var(--s-3);
}
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}
.grid-7-5 {
  display: grid;
  gap: var(--s-5);
}
@media (min-width: 960px) {
  .grid-7-5 {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: start;
  }
}
.prose {
  max-width: 68ch;
  line-height: 1.55;
}
.prose ul,
.prose ol {
  padding-left: 1.25em;
}
.prose img {
  height: auto;
}

/* Header and navigation: one sticky 56 px bar, a menu sheet of tiles, inline links from 1000 px. */
.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap {
  display: flex;
  align-items: center;
  height: 100%;
  gap: var(--sp-2);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: var(--tap);
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: auto;
  color: var(--ink);
  font-weight: 700;
  font-size: var(--fs-4);
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand span {
  color: var(--primary);
}
.brand:hover {
  text-decoration: underline;
}
.pub-live {
  flex: none;
  white-space: nowrap;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 999px;
  padding: 0 var(--sp-2);
  font-size: var(--fs-1);
  font-weight: 650;
  line-height: 1.6;
}

/* Quiet freshness chip: a dot and a word. */
.site-head .freshness.freshness--chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-1);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.site-head .freshness.freshness--chip::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}
.site-head .freshness.freshness--chip[data-state="late"]::before {
  background: var(--caution);
}
.site-head .freshness.freshness--chip[data-state="stale"]::before {
  background: var(--warning);
}
.site-head .freshness.freshness--chip[data-state="none"]::before {
  background: var(--muted);
}

/* Inline links (wide screens) */
.nav-inline {
  display: none;
}
.nav-inline ul {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-inline a {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  height: var(--nav-h);
  padding: 0 var(--sp-1);
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.nav-inline a:hover {
  color: var(--ink);
}
.nav-inline a[aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
  border-bottom-color: var(--primary);
}

/* Theme switch: one icon button (the current choice) that opens a small menu of three radios.
   The radio is visually hidden but stays focusable (arrow keys move between them); its label shows
   the focus ring and a tick for the current one. theme.js toggles the menu's hidden attribute. */
.theme-switch {
  position: relative;
  flex: none;
}
.theme-switch__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.theme-switch__btn:hover,
.theme-switch__btn[aria-expanded="true"] {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}
.theme-switch__btn:active {
  background: color-mix(in srgb, var(--ink) 14%, transparent);
}
.theme-switch__btn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}
.theme-switch__btn svg,
.theme-switch__menu svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-switch__btn svg {
  display: none;
}
.theme-switch__btn[data-choice="auto"] .ti-auto,
.theme-switch__btn[data-choice="light"] .ti-light,
.theme-switch__btn[data-choice="dark"] .ti-dark {
  display: block;
}
.theme-switch__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 9.5rem;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 24px rgb(0 0 0 / 0.14);
  animation: theme-pop 140ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.theme-switch__menu[hidden] {
  display: none;
}
@keyframes theme-pop {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .theme-switch__menu {
    animation: none;
  }
}
.theme-switch__menu label {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 36px;
  padding: 0 10px;
  border-radius: 4px;
  font-size: var(--fs-2);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.theme-switch__menu label:hover {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}
.theme-switch__menu label:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: -2px;
}
.theme-switch__menu input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.theme-switch__menu span {
  flex: 1;
}
.theme-switch__menu .tick {
  visibility: hidden;
  color: var(--primary);
}
.theme-switch__menu label:has(input:checked) .tick {
  visibility: visible;
}
@media (pointer: coarse) {
  .theme-switch__btn {
    width: 44px;
    height: 44px;
  }
  .theme-switch__menu label {
    min-height: 44px;
  }
}

/* Menu: a details element, so it opens without JavaScript. */
.menu {
  flex: none;
}
.menu > summary {
  flex: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 var(--sp-1);
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.menu > summary::-webkit-details-marker {
  display: none;
}
.menu > summary:hover,
.menu[open] > summary {
  background: var(--bg);
}
.menu-icon {
  flex: none;
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.menu-label {
  display: none;
}
.menu-sheet {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: calc(100dvh - var(--nav-h));
  overflow-y: auto;
  padding: var(--sp-3) var(--sp-3) var(--sp-4);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 24px rgb(0 0 0 / 0.14);
}
.menu[open] > .menu-sheet {
  animation: sheet-in 140ms ease-out;
}
@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}
.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-1);
  max-width: 28rem;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.menu-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--fs-2);
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
}
.menu-tile svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--primary);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.menu-tile:hover {
  border-color: var(--primary);
}
.menu-tile[aria-current="page"] {
  border-color: var(--primary);
  box-shadow: inset 0 -3px 0 var(--primary);
  font-weight: 700;
}
.menu-badge,
.pub-badge {
  min-width: 1.4em;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--warning);
  color: #fff;
  font-size: var(--fs-1);
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}
.menu-badge {
  position: absolute;
  top: 4px;
  right: 4px;
}

/* Active alerts: directly under the header, amber for a watch, red for a warning. */
.alert-bar {
  display: block;
  padding: var(--sp-1) 0;
  background: var(--watch);
  color: var(--on-watch);
  font-size: var(--fs-2);
  font-weight: 600;
  text-decoration: none;
}
.alert-bar[data-level="warning"] {
  background: var(--warning);
  color: #fff;
}
.alert-bar:hover .alert-bar__text {
  text-decoration: underline;
}
.alert-bar .wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: 32px;
}
.alert-bar strong {
  flex: none;
}
.alert-bar__text {
  min-width: 0;
}
@media (max-width: 439px) {
  .site-head .pub-live {
    display: none;
  }
}
@media (max-width: 399px) {
  .brand {
    font-size: var(--fs-3);
  }
}
.alert-bar:focus-visible {
  outline-color: var(--ink);
  outline-offset: -3px;
}

@media (min-width: 760px) {
  .menu-label {
    display: inline;
  }
  .menu {
    position: relative;
  }
  .menu-sheet {
    left: auto;
    right: 0;
    width: 26rem;
    border: 1px solid var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
  }
}

/* Header budget (checked at the HEADER_WIDTHS of tools/screenshots.py): eight inline links (P5 added
   Maps, Track A the Blog link, at 8 px padding) need about 1080 px next to the brand (public, with a two-digit alert badge), chip and menu
   button. The bar theme control needs about 1200 px, and the public header drops its menu button
   only then. Below those widths the links and the control live in the menu sheet. */
@media (min-width: 1080px) {
  .nav-inline {
    display: block;
  }
}
/* A longer chip word ("Out of date", "Not yet available") would squeeze the brand into an
   ellipsis between 1080 and 1399 px: tighten the inline links to make the room. */
@media (min-width: 1080px) and (max-width: 1399px) {
  .site-head:has(.freshness--chip[data-state="none"], .freshness--chip[data-state="stale"])
    .nav-inline
    a {
    padding: 0 4px;
  }
}
@media (min-width: 1200px) {
  .site-head--public .menu {
    display: none;
  }
}

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375em;
  min-height: 1.75rem;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--t-sm);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.chip--level-none {
  background: var(--lv-none);
  color: var(--ink-muted);
}
.chip--level-hold {
  background: var(--tint-hold);
  border-color: var(--hold-ink);
  color: var(--hold-ink);
}
.chip--level-watch {
  background: var(--tint-amber);
  border-color: var(--amber-ink);
  color: var(--amber-ink);
}
.chip--level-post_now {
  background: var(--magenta);
  border-color: var(--magenta);
  color: var(--paper);
}
.chip--nws {
  background: var(--tint-nws);
  border-color: var(--nws);
  color: var(--nws);
}
.chip--urgent {
  background: var(--nws);
  border-color: var(--nws);
  color: var(--paper);
}
/* Admin v2 r5: colour means weather, so work states are one plain chip; the word carries the
   state. Only published (Live) keeps green. */
.chip--state-idea,
.chip--state-drafting,
.chip--state-late,
.chip--state-pending,
.chip--state-ready,
.chip--state-failed {
  background: var(--surface);
  border-color: var(--edge);
  color: var(--ink);
}
.chip--state-published {
  background: var(--tint-ok);
  border-color: var(--ok);
  color: var(--ok);
}
.chip--state-skipped,
.chip--state-ended {
  background: var(--bg);
  border-color: var(--edge);
  color: var(--ink-muted);
}
.chip .dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

/* Confidence pips: n of 3 filled, with the word beside them */
.pips {
  display: inline-flex;
  align-items: center;
  gap: 0.375em;
  font-size: var(--t-sm);
  font-weight: 600;
  white-space: nowrap;
}
.pips i {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: transparent;
}
.pips[data-n="1"] i:nth-child(-n + 1),
.pips[data-n="2"] i:nth-child(-n + 2),
.pips[data-n="3"] i:nth-child(-n + 3) {
  background: var(--ink);
}

/* Desk versus official */
.badge-vs {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink);
}
.badge-vs[data-vs="higher"],
.badge-vs[data-vs="lower"],
.badge-vs[data-vs="earlier"] {
  color: var(--magenta);
}
.badge-vs[data-vs="agree"] {
  color: var(--ok);
}

/* Freshness detail on Home. The header chip is the loud-free signal; this is the quiet detail. */
.freshness {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-1) var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-left: 4px solid var(--ok);
  background: var(--surface);
  font-size: var(--fs-2);
  font-weight: 500;
}
.freshness[data-state="late"] {
  border-left-color: var(--caution);
}
.freshness[data-state="missed"] {
  border-left-color: var(--fault);
}
.freshness strong {
  white-space: nowrap;
}
.freshness small {
  color: inherit;
  font-weight: 400;
}

/* Alert strip: official NWS products, always labelled */
.alert-strip {
  border-left: 6px solid var(--nws);
  background: var(--tint-nws);
  padding: var(--s-3) var(--s-4);
}
.alert-strip a {
  color: var(--nws);
  font-weight: 600;
}

/* Cards: only for units you can open (day cards, threats) */
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: var(--s-3) var(--s-4);
  color: inherit;
  text-decoration: none;
}
a.card:hover {
  border-color: var(--ink);
}

/* Ruled rows: runs, drafts, alerts */
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-1) var(--s-3);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--rule);
  min-height: var(--tap);
}
.rows .row:first-child {
  border-top: 0;
}
.row .when {
  color: var(--ink-muted);
  font-size: var(--t-sm);
  min-width: 9.5em;
}
.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-1) var(--s-3);
  flex: 1 1 100%;
}
@media (min-width: 760px) {
  .row-meta {
    flex: 0 1 auto;
  }
}
.row .grow {
  flex: 1 1 14em;
}

/* Tables scroll inside their own container */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  max-width: 100%;
}
.table-scroll table {
  border-collapse: collapse;
  width: 100%;
  min-width: 36rem;
  font-size: var(--t-sm);
}
/* Two-column key/value tables fit a phone without scrolling. */
.table-scroll--kv table {
  min-width: 0;
}

.table-scroll th,
.table-scroll td {
  text-align: left;
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  white-space: nowrap;
}
.table-scroll th {
  font-weight: 650;
  background: var(--surface);
}
.table-scroll tbody tr:last-child td {
  border-bottom: 0;
}
.table-scroll .num {
  text-align: right;
}
.table-scroll td.wrap-cell {
  white-space: normal;
  min-width: 14em;
}
tr.unavailable td {
  color: var(--magenta);
  font-weight: 600;
}

/* Table cards. Below 760 px each row is a stacked card whose cells are labelled by data-label.
   From 760 px the first column sticks and a soft edge shows where the table keeps scrolling. */
.table-cards {
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left center / 36px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right center / 36px 100% no-repeat local,
    linear-gradient(to right, color-mix(in srgb, var(--ink) 16%, transparent), transparent) left center / 12px 100% no-repeat scroll,
    linear-gradient(to left, color-mix(in srgb, var(--ink) 16%, transparent), transparent) right center / 12px 100% no-repeat scroll;
}
.table-cards:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
@media (min-width: 760px) {
  .table-cards th:first-child,
  .table-cards td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface);
    box-shadow: 1px 0 0 var(--rule);
  }
  .table-cards td small,
  .table-cards td .compare__note {
    display: block;
  }
  .compare td {
    white-space: normal;
    min-width: 13em;
  }
}
@media (max-width: 759.98px) {
  .table-cards {
    overflow: visible;
    border: 0;
    background: none;
  }
  .table-cards table,
  .table-cards tbody {
    display: block;
    min-width: 0;
  }
  .table-cards thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .table-cards tr {
    display: block;
    margin-bottom: var(--s-3);
    background: var(--surface);
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    overflow: hidden;
  }
  .table-cards th[scope="row"] {
    display: block;
    padding: var(--s-2) var(--s-3);
    border-bottom: 1px solid var(--rule);
    background: color-mix(in srgb, var(--ink) 5%, var(--surface));
    white-space: normal;
  }
  .table-cards td {
    display: grid;
    grid-template-columns: 7.5em minmax(0, 1fr);
    gap: var(--s-2);
    align-items: baseline;
    white-space: normal;
    min-width: 0;
    padding: var(--s-2) var(--s-3);
  }
  .table-cards td::before {
    content: attr(data-label);
    color: var(--ink-muted);
    font-size: var(--t-sm);
  }
  .table-cards td[colspan]::before {
    content: attr(data-label);
  }
  .table-cards td.wrap-cell {
    min-width: 0;
  }
  .table-cards td:empty {
    display: none;
  }
  .table-cards tbody tr:last-child td {
    border-bottom: 1px solid var(--rule);
  }
  .table-cards td:last-child {
    border-bottom: 0;
  }
}
.compare th[scope="row"] {
  white-space: nowrap;
}
.compare__day {
  font-weight: 650;
}
.compare__flags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-2);
  margin-top: var(--s-1);
}
.compare__note {
  display: block;
  color: var(--ink-muted);
  margin-top: 2px;
}
@media (max-width: 759.98px) {
  .compare td > * {
    grid-column: 2;
  }
  .compare td::before {
    grid-column: 1;
    grid-row: 1 / span 4;
    align-self: start;
  }
}
tr.source-silent th,
tr.source-silent td {
  background: var(--tint-nws);
  color: var(--nws);
  font-weight: 650;
  white-space: normal;
}
tr.source-silent td {
  color: var(--ink);
  font-weight: 400;
}

/* Home and Live data heading: title with the point picker beside it. */
.point-pick {
  display: flex;
  align-items: end;
  gap: var(--s-2);
}
@media (min-width: 760px) {
  .point-pick {
    margin-left: auto;
  }
}
.section--first {
  border-top: 0;
  margin-top: var(--s-3);
  padding-top: 0;
}
.obs-line {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  margin: 0 0 var(--s-4);
}
.obs-line__temp {
  flex: none;
  font-size: var(--t-2xl);
  font-weight: 300;
  line-height: 1;
}
.chart.chart--live {
  height: auto;
  min-height: 320px;
  background: none;
  border: 0;
  padding: 0;
}
.chart--live .live-canvas {
  height: 320px;
}
/* Live chart controls (charts.js renderLive); the public site has the same rules in public.css */
.live-ctl,
.live-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.live-seg,
.live-chip {
  min-height: var(--tap);
  padding: 0 var(--s-4);
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.live-seg[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}
.live-chip {
  min-height: 36px;
  padding: 0 var(--s-3);
}
.live-chip[aria-pressed="false"] {
  opacity: 0.55;
  text-decoration: line-through;
}
.live-chip[aria-pressed="true"] {
  border-color: var(--ink);
}
.live-seg:focus-visible,
.live-chip:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.live-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  display: inline-block;
}
.live-chip--band::before {
  content: "";
  width: 1.1rem;
  height: 0.7rem;
  border-radius: 2px;
  background: var(--ink);
  opacity: 0.18;
}
.live-note {
  min-height: 1.4em;
  font-size: var(--t-sm);
  margin-top: var(--s-2);
}
.live-note--hrrr {
  min-height: 0;
  margin-top: 0;
}
pre.afd {
  white-space: pre-wrap;
  max-height: 60vh;
  max-height: 60dvh;
  overflow: auto;
}

/* Key/value lists */
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--s-1) var(--s-4);
  margin: 0;
}
.kv dt {
  color: var(--ink-muted);
}
.kv dd {
  margin: 0;
}

/* Forms and buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 var(--s-4);
  border-radius: var(--radius);
  border: 1px solid var(--edge);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover {
  border-color: var(--ink);
}
.btn--primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  font-size: var(--t-sm);
  color: var(--ink-muted);
}
.field input,
.field select,
.field textarea,
select.field-control,
input.field-control {
  min-height: var(--tap);
  padding: 0 var(--s-3);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  max-width: 100%;
}
.field textarea {
  padding: var(--s-2) var(--s-3);
  min-height: 6rem;
}
.check {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--tap);
}
.check input {
  width: 1.375rem;
  height: 1.375rem;
  accent-color: var(--ink);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: flex-end;
  margin-bottom: var(--s-4);
}
.pager {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

/* Disclosure */
details.disclosure {
  border-top: 1px solid var(--rule);
}
details.disclosure > summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
}
details.disclosure[open] > summary {
  margin-bottom: var(--s-2);
}
/* A disclosure with a turning marker and no rule, for folds that start closed (M C10: admin
   Health sections and list filters). */
details.disclosure--turn {
  border-top: 0;
}
details.disclosure--turn > summary {
  gap: var(--sp-1) var(--sp-2);
  flex-wrap: wrap;
  list-style: none;
}
details.disclosure--turn > summary::-webkit-details-marker {
  display: none;
}
details.disclosure--turn > summary::before {
  content: "▸";
  width: 1em;
  color: var(--link);
}
details.disclosure--turn[open] > summary::before {
  content: "▾";
}
pre {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s-3);
  font-size: var(--t-sm);
  margin: 0;
}

/* County map: the one bold element, framed like a chart neatline */
.countymap {
  margin: 0;
}
.map-frame {
  border: 1px solid #b8c0cc;
  background: var(--map-water);
  line-height: 0;
}
.map-frame svg {
  display: block;
  width: 100%;
  height: auto;
}
.map-frame .water {
  fill: var(--map-water);
}
.map-frame .water-cut {
  fill: var(--map-water);
  stroke: none;
  pointer-events: none;
}
.map-frame .county {
  fill: var(--map-none);
  stroke: var(--map-ink);
  stroke-opacity: 0.65;
  stroke-width: 1px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}
.map-frame .county[data-level="hold"] {
  fill: var(--map-hold);
}
.map-frame .county[data-level="watch"] {
  fill: var(--map-watch);
}
.map-frame .county[data-level="post_now"] {
  fill: url(#hatch-post);
}
.map-frame .county:hover,
.map-frame .county.is-picked {
  stroke-width: 2.5px;
  stroke-opacity: 1;
}
.map-frame .county.is-picked {
  stroke: var(--link);
}
.map-frame .land {
  fill: var(--map-land);
  stroke: var(--map-border);
  stroke-opacity: 0.6;
  stroke-width: 0.75px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.map-frame .state-line {
  fill: none;
  stroke: var(--map-ink);
  stroke-opacity: 0.88;
  stroke-width: 1.3px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.map-frame .coast {
  fill: none;
  stroke: var(--map-ink);
  stroke-opacity: 0.88;
  stroke-width: 1.5px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.map-frame .inland-shore {
  fill: none;
  stroke: var(--map-inland);
  stroke-width: 1px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.map-frame .map-label {
  font-size: 22px;
  font-weight: 600;
  fill: var(--map-ink);
  fill-opacity: 0.7;
  stroke: var(--map-land);
  stroke-width: 4px;
  paint-order: stroke;
  text-anchor: middle;
  pointer-events: none;
}
.map-frame .map-label.water-label {
  font-style: normal;
  font-weight: 500;
  fill: var(--map-label);
  fill-opacity: 1;
  stroke: var(--map-water);
}
@media (min-width:700px){.map-frame .map-label:not(.pin-label){font-size:17px;stroke-width:3.2px}}
@media (min-width:1000px){.map-frame .map-label:not(.pin-label){font-size:14px;stroke-width:2.6px}}
.map-frame .map-label.pin-label {
  text-anchor: start;
  fill: var(--map-ink);
  fill-opacity: 1;
}
.map-frame .map-pin {
  fill: var(--link);
  stroke: #fff;
  stroke-width: 3;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-4);
  margin: var(--s-3) 0;
  padding: 0;
  list-style: none;
  font-size: var(--t-sm);
}
.legend li {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.swatch {
  width: 1.25rem;
  height: 1.25rem;
  border: 1px solid var(--ink);
  background: var(--lv-none);
  flex: none;
}
.swatch[data-level="hold"] {
  background: var(--hold);
}
.swatch[data-level="watch"] {
  background: var(--amber);
}
.swatch[data-level="post_now"] {
  background: repeating-linear-gradient(45deg, var(--magenta) 0 4px, var(--paper) 4px 6px);
}
.county-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px solid var(--rule);
}
.county-chip {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
}
.county-chip[open] {
  grid-column: 1 / -1;
}
.county-chip summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  min-height: var(--tap);
  padding: 0 var(--s-3);
  cursor: pointer;
  list-style: none;
}
.county-chip summary::-webkit-details-marker {
  display: none;
}
.county-chip summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.county-chip .detail {
  padding: 0 var(--s-3) var(--s-3);
  max-width: 60ch;
}

/* Charts */
.chart {
  position: relative;
  width: 100%;
  height: 260px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s-2);
}
.chart canvas {
  width: 100% !important;
}
.chart[data-state="loading"]::after,
.chart[data-state="error"]::after {
  content: attr(data-msg);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink-muted);
}
@media (min-width: 960px) {
  .chart {
    height: 340px;
  }
}

/* Empty states */
.empty {
  padding: var(--s-5) 0;
  max-width: 48ch;
}
.empty p {
  margin-bottom: var(--s-3);
}

/* Media */
figure.post-figure {
  margin: var(--s-4) 0;
}
figure.post-figure img {
  display: block;
  width: 100%;
  height: auto;
}
figure.post-figure figcaption {
  color: var(--ink-muted);
  font-size: var(--t-sm);
  margin-top: var(--s-1);
}

/* HTMX and toast */
.htmx-request {
  opacity: 0.7;
}
.htmx-added {
  opacity: 0;
}
.htmx-settling {
  transition: opacity 120ms ease-out;
}
.htmx-error {
  position: fixed;
  left: var(--s-4);
  right: var(--s-4);
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--s-4));
  max-width: 28rem;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--tint-fault);
  color: var(--ink);
  border: 1px solid var(--fault);
  border-radius: var(--radius);
  z-index: 70;
}
.htmx-error[hidden] {
  display: none;
}
.htmx-error span {
  flex: 1;
}
.htmx-error__close {
  min-height: var(--tap);
  padding: 0 var(--s-3);
  background: transparent;
  color: var(--link);
  border: 0;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
@media (min-width: 760px) {
  .htmx-error {
    bottom: var(--s-4);
    left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
