:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5b6676;
  --border: #dde2e9;
  --accent: #1f6feb;
  --accent-soft: #e6effd;
  --hero-from: #0b2545;
  --hero-to: #13315c;
}

/* Dark theme: used when the viewer picks it (data-theme on <html>, see
   assets/theme.js), or when their system is dark and they haven't picked
   light. The two rules must stay identical. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141b;
  --surface: #171e27;
  --text: #e6ebf1;
  --muted: #9aa6b5;
  --border: #2a3441;
  --accent: #5aa2ff;
  --accent-soft: #1b2a3f;
  --hero-from: #08182e;
  --hero-to: #10264a;
  --skew-frame: #3a4656;
  --skew-iso: #26303c;
  --skew-zero: #53657d;
  --skew-dry: #5e4a35;
  --skew-moist: #2f5139;
  --skew-mixr: #33475f;
  --skew-temp: #ff6b6b;
  --skew-dewp: #3ddc97;
  --skew-wetb: #5cc8f0;
  --skew-parcel: #e6ebf1;
  --skew-cape: rgba(255, 107, 107, 0.2);
  --skew-cin: rgba(90, 162, 255, 0.2);
  --skew-readout: rgba(23, 30, 39, 0.92);
  --error: #ff8a80;
  --hodo-1: #ff6b6b;
  --hodo-3: #3ddc97;
  --hodo-6: #ffcf5c;
  --hodo-9: #5aa2ff;
  --hodo-12: #b49cff;
  --p-rain: #3ddc97;
  --p-snow: #5aa2ff;
  --p-fzra: #ff6b6b;
  --p-ice: #ffcf5c;
  --p-mix: #b49cff;
  --mg-cloud: #c9d6e8;
  --mg-cape: rgba(255, 107, 107, 0.35);
  --nomo-r: rgba(61, 220, 151, 0.10);
  --nomo-s: rgba(90, 162, 255, 0.12);
  --nomo-zr: rgba(255, 107, 107, 0.12);
  --nomo-ip: rgba(255, 207, 92, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f141b;
    --surface: #171e27;
    --text: #e6ebf1;
    --muted: #9aa6b5;
    --border: #2a3441;
    --accent: #5aa2ff;
    --accent-soft: #1b2a3f;
    --hero-from: #08182e;
    --hero-to: #10264a;
    --skew-frame: #3a4656;
    --skew-iso: #26303c;
    --skew-zero: #53657d;
    --skew-dry: #5e4a35;
    --skew-moist: #2f5139;
    --skew-mixr: #33475f;
    --skew-temp: #ff6b6b;
    --skew-dewp: #3ddc97;
    --skew-wetb: #5cc8f0;
    --skew-parcel: #e6ebf1;
    --skew-cape: rgba(255, 107, 107, 0.2);
    --skew-cin: rgba(90, 162, 255, 0.2);
    --skew-readout: rgba(23, 30, 39, 0.92);
    --error: #ff8a80;
    --hodo-1: #ff6b6b;
    --hodo-3: #3ddc97;
    --hodo-6: #ffcf5c;
    --hodo-9: #5aa2ff;
    --hodo-12: #b49cff;
    --p-rain: #3ddc97;
    --p-snow: #5aa2ff;
    --p-fzra: #ff6b6b;
    --p-ice: #ffcf5c;
    --p-mix: #b49cff;
    --mg-cloud: #c9d6e8;
    --mg-cape: rgba(255, 107, 107, 0.35);
    --nomo-r: rgba(61, 220, 151, 0.10);
    --nomo-s: rgba(90, 162, 255, 0.12);
    --nomo-zr: rgba(255, 107, 107, 0.12);
    --nomo-ip: rgba(255, 207, 92, 0.12);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
}

a { color: var(--accent); }

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}

nav.site a {
  margin-left: 20px;
  color: var(--muted);
  text-decoration: none;
}

nav.site a:hover,
nav.site a[aria-current="page"] { color: var(--text); }

nav.site { display: flex; flex-wrap: wrap; align-items: center; }

/* Light/dark switch: shows the theme it switches to */
.theme-toggle {
  width: 34px;
  height: 34px;
  margin-left: 16px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.theme-toggle::before { content: "\263E"; }
.theme-toggle[aria-pressed="true"]::before { content: "\2600"; }
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }

@media (max-width: 480px) {
  header.site .wrap { flex-wrap: wrap; height: auto; min-height: 56px; padding-top: 10px; padding-bottom: 10px; }
  nav.site a:first-child { margin-left: 0; }
  nav.site a { margin-left: 16px; }
}

.hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 30% 40%, #13315c 0%, var(--hero-from) 60%, #050d19 100%);
  color: #fff;
  padding: 120px 0 104px;
}

.hero canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(5, 13, 25, 0.85) 0%, rgba(5, 13, 25, 0.35) 55%, rgba(5, 13, 25, 0) 100%);
  pointer-events: none;
}

.hero .wrap {
  position: relative;
  z-index: 1;
}

.hero .eyebrow {
  display: inline-block;
  margin-bottom: 16px;
  padding: 4px 12px;
  border: 1px solid rgba(255, 207, 92, 0.5);
  border-radius: 999px;
  color: #ffcf5c;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero .caption {
  position: absolute;
  right: 16px;
  bottom: 12px;
  z-index: 1;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.75rem;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
}

.hero p {
  margin: 0;
  max-width: 620px;
  font-size: 1.1rem;
  color: #c9d6e8;
}

main.wrap { padding-top: 48px; padding-bottom: 48px; }

section + section { margin-top: 48px; }

h2 { margin: 0 0 8px; font-size: 1.4rem; }

.lede { margin: 0 0 24px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 16px;
}

.card {
  display: block;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
}

a.card:hover { border-color: var(--accent); }

.card h3 { margin: 0 0 6px; font-size: 1.05rem; }

.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.note {
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
}

footer.site {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.viz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 20px;
}

.viz {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.viz svg {
  display: block;
  width: 100%;
  height: auto;
  background: #0b1626;
}

.viz .body { padding: 16px 20px 20px; }

.viz h3 { margin: 0 0 6px; font-size: 1.05rem; }

.viz p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.radar-sweep {
  transform-origin: 160px 90px;
  animation: sweep 4s linear infinite;
}

@keyframes sweep {
  to { transform: rotate(360deg); }
}

.draw {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: draw 2.5s ease-out forwards;
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .radar-sweep, .draw { animation: none; stroke-dashoffset: 0; }
}

a.viz { display: block; color: inherit; text-decoration: none; }
a.viz:hover { border-color: var(--accent); }

/* ---------- Soundings page ---------- */

:root {
  --skew-frame: #c3cbd6;
  --skew-iso: #d3d9e1;
  --skew-zero: #8fa3bd;
  --skew-dry: #e7b98a;
  --skew-moist: #9cc9a6;
  --skew-mixr: #9bb7d9;
  --skew-temp: #d63a3f;
  --skew-dewp: #1f9d55;
  --skew-wetb: #2b8fbf;
  --skew-parcel: #3b4552;
  --skew-cape: rgba(214, 58, 63, 0.16);
  --skew-cin: rgba(31, 111, 235, 0.14);
  --skew-readout: rgba(255, 255, 255, 0.92);
  --error: #c62828;
}

.wrap.wide { max-width: 1200px; }

.page-title { margin: 0 0 8px; font-size: 1.8rem; line-height: 1.2; }

.source {
  padding: 16px 20px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.tabs button {
  margin-bottom: -1px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}

.panel[hidden] { display: none; }

.panel label:not(.drop) {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.panel input,
.panel select,
.panel textarea {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.panel input:disabled { opacity: 0.5; }

.panel textarea {
  width: 100%;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.8rem;
}

button.primary {
  padding: 8px 18px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.hint {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.drop {
  position: relative;
  display: block;
  width: 100%;
  padding: 18px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.drop.over,
.drop:focus-within { border-color: var(--accent); }

.drop input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.drop strong { color: var(--accent); }

.status {
  min-height: 1.6em;
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status.error { color: var(--error); }

.sounding { margin-top: 24px; }

.sounding[hidden] { display: none; }

.sounding-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sounding-head h2 { margin: 0; }

.sounding-head .sub { margin: 0; color: var(--muted); }

.time-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-controls[hidden] { display: none; }

.time-controls button {
  min-width: 36px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
}

.time-controls input { width: min(260px, 40vw); accent-color: var(--accent); }

.sounding-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .sounding-layout { grid-template-columns: minmax(0, 1fr); }
}

.chart {
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 4px 8px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.85rem;
}

.legend [hidden] { display: none; }

.legend .sw {
  display: inline-block;
  width: 18px;
  height: 0;
  margin-right: 6px;
  vertical-align: middle;
  border-top: 3px solid;
}

.legend .temp { border-color: var(--skew-temp); }
.legend .dewpoint { border-color: var(--skew-dewp); }
.legend .wetbulb { border-color: var(--skew-wetb); border-top-width: 2px; }
.legend .parcel { border-color: var(--skew-parcel); border-top-style: dashed; border-top-width: 2px; }
.legend .cape, .legend .cin { height: 10px; border: 0; }
.legend .cape { background: var(--skew-cape); }
.legend .cin { background: var(--skew-cin); }

.skewt {
  display: block;
  max-width: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  touch-action: pan-y;
}

.skewt .frame { fill: none; stroke: var(--skew-frame); }
.skewt .isotherm line, .skewt .isobar { stroke: var(--skew-iso); stroke-width: 1; }
.skewt .isotherm .zero { stroke: var(--skew-zero); }
.skewt .dry path { fill: none; stroke: var(--skew-dry); stroke-width: 1; }
.skewt .moist path { fill: none; stroke: var(--skew-moist); stroke-width: 1; stroke-dasharray: 6 3; }
.skewt .mixr path { fill: none; stroke: var(--skew-mixr); stroke-width: 1; stroke-dasharray: 2 3; }
.skewt .mixr text { fill: var(--skew-mixr); font-size: 9px; }
.skewt .axis text { fill: var(--muted); }
.skewt .axis .hgt { font-size: 9px; }
.skewt .temp, .skewt .dewpoint, .skewt .wetbulb { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.skewt .temp { stroke: var(--skew-temp); }
.skewt .dewpoint { stroke: var(--skew-dewp); }
.skewt .wetbulb { stroke: var(--skew-wetb); stroke-width: 1.5; }
.skewt .parcel { fill: none; stroke: var(--skew-parcel); stroke-width: 1.5; stroke-dasharray: 5 4; }
.skewt .cape { fill: var(--skew-cape); }
.skewt .cin { fill: var(--skew-cin); }
.skewt .level { stroke: var(--skew-parcel); stroke-width: 1.5; }
.skewt .level-label { fill: var(--skew-parcel); font-size: 10px; font-weight: 600; }
.skewt .barbs line, .skewt .barbs path { stroke: var(--text); stroke-width: 1.3; fill: none; stroke-linecap: round; }
.skewt .barbs .flag { fill: var(--text); }
.skewt .barbs .calm { fill: none; stroke: var(--text); }
.skewt .barb-axis { stroke: var(--skew-iso); }
.skewt .cursor line { stroke: var(--muted); stroke-dasharray: 3 3; }
.skewt .temp-dot { fill: var(--skew-temp); }
.skewt .dewpoint-dot { fill: var(--skew-dewp); }
.skewt .readout rect { fill: var(--skew-readout); stroke: var(--border); }
.skewt .readout text { fill: var(--text); font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.skewt .hit { cursor: crosshair; }

.indices,
.card {
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.indices h3, .card h3 { margin: 0 0 8px; font-size: 1rem; }

.card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.card th, .card td { padding: 5px 4px; text-align: right; }
.card thead th { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.card tbody th { text-align: left; }
#parcels tbody tr { cursor: pointer; border-top: 1px solid var(--border); }
#parcels tbody tr:hover { background: var(--bg); }
#parcels tbody tr[aria-selected="true"] { background: var(--accent-soft); }
#parcels tbody tr[aria-selected="true"] th { color: var(--accent); }

.indices dl,
.card dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  margin: 0 0 16px;
  font-size: 0.9rem;
}

.indices dt, .card dt { color: var(--muted); }
.indices dd, .card dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.note-small { margin: 6px 0 16px; color: var(--muted); font-size: 0.8rem; }

.check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.check[hidden] { display: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Hodograph */

:root {
  --hodo-1: #d63a3f;
  --hodo-3: #1f9d55;
  --hodo-6: #c98a00;
  --hodo-9: #1f6feb;
  --hodo-12: #8b5cf6;
}

.hodo-box { margin-bottom: 6px; }

.hodo {
  display: block;
  margin: 0 auto;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 10px;
}

.hodo .hodo-grid circle { fill: none; stroke: var(--skew-frame); }
.hodo .hodo-grid circle.minor { stroke: var(--skew-iso); }
.hodo .hodo-grid line { stroke: var(--skew-frame); }
.hodo .hodo-grid text { fill: var(--muted); }
.hodo .hodo-empty { fill: var(--muted); font-size: 12px; }
.hodo .hodo-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.hodo .h1 { stroke: var(--hodo-1); }
.hodo .h3 { stroke: var(--hodo-3); }
.hodo .h6 { stroke: var(--hodo-6); }
.hodo .h9 { stroke: var(--hodo-9); }
.hodo .h12 { stroke: var(--hodo-12); }
.hodo .hodo-marks circle { fill: var(--text); }
.hodo .hodo-marks text { fill: var(--text); font-weight: 600; }
.hodo .hodo-storm { fill: var(--surface); stroke: var(--text); stroke-width: 1.5; }
.hodo .hodo-storm-label { fill: var(--text); font-weight: 600; }
.hodo .hodo-mean { fill: var(--text); }

.hodo-legend { margin: 0 0 4px; font-size: 0.8rem; gap: 2px 10px; }
.legend .h1 { border-color: var(--hodo-1); }
.legend .h3 { border-color: var(--hodo-3); }
.legend .h6 { border-color: var(--hodo-6); }
.legend .h9 { border-color: var(--hodo-9); }
.legend .h12 { border-color: var(--hodo-12); }

/* Meteogram */

:root {
  --p-rain: #2fa866;
  --p-snow: #3d8bfd;
  --p-fzra: #d63a3f;
  --p-ice: #e09a12;
  --p-mix: #9b6dd6;
  --p-unknown: #8a96a6;
  --mg-cloud: #6b7a8f;
  --mg-cape: rgba(214, 58, 63, 0.35);
}

.sub-link { margin-left: 6px; font-size: 0.9rem; white-space: nowrap; }
.sub-link[hidden] { display: none; }

.units { display: flex; }

.units button {
  padding: 5px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.units button:first-child { border-radius: 6px 0 0 6px; }
.units button:last-child { border-radius: 0 6px 6px 0; border-left: 0; }

.units button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.glance {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}

.glance div {
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.glance dt { color: var(--muted); font-size: 0.8rem; }
.glance dd { margin: 2px 0 0; font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.glance dd span { display: block; color: var(--muted); font-size: 0.75rem; font-weight: 400; }

.readout-panel { position: sticky; top: 16px; }
.readout-panel h3 { margin-bottom: 0; }
.readout-panel .sub-link { display: inline-block; margin: 0 0 12px; }

.legend .box { width: 12px; height: 12px; border: 0; border-radius: 2px; }
.legend .p-rain { background: var(--p-rain); }
.legend .p-snow { background: var(--p-snow); }
.legend .p-fzra { background: var(--p-fzra); }
.legend .p-ice { background: var(--p-ice); }
.legend .p-mix { background: var(--p-mix); }

.mg {
  display: block;
  max-width: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  touch-action: pan-y;
}

.mg .mg-title { fill: var(--text); font-size: 12px; font-weight: 600; }
.mg .mg-frame { fill: none; stroke: var(--skew-frame); }
.mg .mg-grid { stroke: var(--skew-iso); }
.mg .mg-tick { fill: var(--muted); }
.mg .mg-total-tick { fill: var(--accent); }
.mg .mg-daylabel { fill: var(--text); font-weight: 600; }
.mg .mg-day { stroke: var(--skew-zero); }
.mg .mg-hour { stroke: var(--skew-iso); }
.mg .mg-now { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; }
.mg .mg-now-label { fill: var(--accent); font-size: 10px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.mg .mg-freezing { stroke: var(--p-snow); stroke-dasharray: 5 4; }
.mg .mg-temp, .mg .mg-dewpoint, .mg .mg-wind, .mg .mg-pressure, .mg .mg-total { fill: none; stroke-width: 2.25; stroke-linejoin: round; }
.mg .mg-temp { stroke: var(--skew-temp); }
.mg .mg-dewpoint { stroke: var(--skew-dewp); }
.mg .mg-wind { stroke: var(--text); stroke-width: 1.75; }
.mg .mg-pressure { stroke: var(--hodo-12); }
.mg .mg-total { stroke: var(--accent); stroke-width: 1.75; }
.mg .mg-barbs line, .mg .mg-barbs path { stroke: var(--text); stroke-width: 1.2; fill: none; stroke-linecap: round; }
.mg .mg-barbs .flag { fill: var(--text); }
.mg .mg-barbs .calm { fill: none; stroke: var(--text); }
.mg .mg-p-rain { fill: var(--p-rain); }
.mg .mg-p-snow { fill: var(--p-snow); }
.mg .mg-p-fzra { fill: var(--p-fzra); }
.mg .mg-p-ice { fill: var(--p-ice); }
.mg .mg-p-mix { fill: var(--p-mix); }
.mg .mg-p-unknown { fill: var(--p-unknown); }
.mg .mg-cloud { fill: var(--mg-cloud); }
.mg .mg-cape { fill: var(--mg-cape); stroke: var(--skew-temp); stroke-width: 1.25; }
.mg .mg-cursor line { stroke: var(--muted); stroke-dasharray: 3 3; }
.mg .mg-temp-dot { fill: var(--skew-temp); }
.mg .mg-dewpoint-dot { fill: var(--skew-dewp); }
.mg .mg-wind-dot { fill: var(--text); }
.mg .mg-hit { cursor: crosshair; }

/* Partial thickness nomogram */

:root {
  --nomo-r: rgba(31, 157, 85, 0.10);
  --nomo-s: rgba(31, 111, 235, 0.10);
  --nomo-zr: rgba(214, 58, 63, 0.10);
  --nomo-ip: rgba(201, 138, 0, 0.12);
  --nomo-active: 0.32;
}

.ptype-result { margin: 0 0 8px; font-size: 1rem; }
.ptype-result strong { margin-right: 4px; color: var(--accent); }

/* Soundings dashboard: the Skew-T on the left, the hodograph, parcels,
   precipitation type summary and indices stacked beside it. The nomogram
   and data editor are slide-out panels (.drawer). */

.wrap.dashboard { max-width: 1680px; }

.dash {
  display: grid;
  gap: 14px;
  align-items: start;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr);
}

.dash-side { display: grid; gap: 14px; min-width: 0; }

/* Narrower: Skew-T full width, the rest in two columns beneath */
@media (max-width: 1280px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .dash-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .dash-hodo { grid-row: span 3; }
}

@media (max-width: 680px) {
  .dash-side { grid-template-columns: minmax(0, 1fr); }
  .dash-hodo { grid-row: auto; }
}

.dash .card { min-width: 0; margin: 0; padding: 12px 14px; }
.dash .card h3 { font-size: 0.95rem; margin-bottom: 6px; }

/* Precipitation type summary that opens the nomogram panel */
.ptype-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  width: 100%;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ptype-chip:hover,
.ptype-chip[aria-expanded="true"] { border-color: var(--accent); }
.ptype-chip .chip-label { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.ptype-chip .ptype-result { flex: 1; margin: 0; }
.ptype-chip .chip-more { color: var(--accent); font-size: 0.85rem; white-space: nowrap; }

/* Slide-out panels from the right edge */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: min(440px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 28px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
}

.drawer.open { transform: none; visibility: visible; transition: transform 0.25s ease; }
.drawer.wide { width: min(560px, 100vw); }

@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer.open { transition: none; }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.drawer-head h3 { margin: 0; font-size: 1rem; }
.drawer-head h3:focus { outline: none; }

.drawer-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.drawer-close:hover { color: var(--text); border-color: var(--accent); }

.drawer-body { flex: 1; overflow: auto; padding: 14px 16px; }
.drawer .nomo { margin: 0 auto; }
.drawer dl.compact { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; margin: 10px 0 0; font-size: 0.85rem; }
.drawer dl.compact dt { color: var(--muted); }
.drawer dl.compact dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.drawer .table-scroll { max-height: none; }
.drawer .add-level { gap: 8px 10px; }

/* Indices flow into as many columns as fit */
.dash-indices dl {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 28px;
  margin: 0 0 8px;
}

.dash-indices dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}

/* Control panel: a sticky sidebar on the left with the data source and
   forecast-hour controls. It collapses to a thin strip, and stacks above
   the dashboard on narrow screens. The intro line goes once a sounding is
   showing. */
main.wrap.dashboard { padding-top: 16px; }
.dashboard .lede { margin: 4px 0 12px; }
.dashboard:has(#sounding:not([hidden])) .lede { display: none; }

.console {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.console-main { min-width: 0; }

.sidebar {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.sidebar .page-title { margin: 0; font-size: 1.25rem; }

.sidebar-collapse {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.sidebar-collapse::before { content: "\00AB"; }
.sidebar-collapse:hover { color: var(--text); border-color: var(--accent); }

.console.collapsed { grid-template-columns: 46px minmax(0, 1fr); }
.console.collapsed .sidebar { padding: 8px; }
.console.collapsed .sidebar-head { margin: 0; justify-content: center; }
.console.collapsed .sidebar .page-title,
.console.collapsed .sidebar-body { display: none; }
.console.collapsed .sidebar-collapse::before { content: "\00BB"; }

.sidebar .source { padding: 0; background: none; border: 0; border-radius: 0; }

.sidebar .tabs { flex-wrap: nowrap; gap: 0; margin: 0 0 12px; border: 0; }

.sidebar .tabs button {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 6px 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.85rem;
  line-height: 1.2;
}

.sidebar .tabs button small { display: block; font-size: 0.7rem; font-weight: 400; color: var(--muted); }
.sidebar .tabs button + button { border-left: 0; }
.sidebar .tabs button:first-child { border-radius: 6px 0 0 6px; }
.sidebar .tabs button:last-child { border-radius: 0 6px 6px 0; }
.sidebar .tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }

/* Form fields stack in pairs in the narrow column */
.sidebar .panel { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sidebar .panel[hidden] { display: none; }
.sidebar .panel label:not(.drop) { min-width: 0; }
.sidebar .panel input,
.sidebar .panel select { width: 100%; min-width: 0; padding: 5px 7px; }
.sidebar .panel label:has(input[type="date"]),
.sidebar .panel .primary,
.sidebar .panel .hint,
.sidebar .panel .drop,
.sidebar .panel textarea { grid-column: 1 / -1; }
.sidebar .panel .hint { font-size: 0.78rem; }
.sidebar .drop { padding: 10px; font-size: 0.85rem; }
.sidebar .status { margin: 10px 0 0; font-size: 0.85rem; }
.sidebar .status:empty { display: none; }

.side-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.side-section[hidden] { display: none; }
.side-title { margin: 0 0 2px; font-size: 0.85rem; color: var(--muted); }
.side-hour { margin: 0 0 8px; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.sidebar .time-controls { flex-wrap: wrap; }
.sidebar .time-controls input { flex: 1 1 100%; width: 100%; }

@media (max-width: 900px) {
  .console,
  .console.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; max-height: none; }
  .sidebar-collapse { display: none; }
  .console.collapsed .sidebar-body,
  .console.collapsed .sidebar .page-title { display: revert; }
}
.dash .note-small { margin-bottom: 0; }
.dash .legend { margin: 6px 0 0; }

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 8px;
}

.card-head h3 { margin: 0; }
.card-head .edit-bar { margin: 0; }
.dash-skewt .edit-note { margin: 0 0 6px; }
.dash-skewt .edit-note:empty { display: none; }

.dash .hodo-box svg { margin: 0 auto; }

.nomo {
  display: block;
  max-width: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 10px;
}

.nomo .nomo-r { fill: var(--nomo-r); }
.nomo .nomo-s { fill: var(--nomo-s); }
.nomo .nomo-zr { fill: var(--nomo-zr); }
.nomo .nomo-ip { fill: var(--nomo-ip); }
.nomo .nomo-regions .nomo-r.active { fill: rgba(31, 157, 85, var(--nomo-active)); }
.nomo .nomo-regions .nomo-s.active { fill: rgba(31, 111, 235, var(--nomo-active)); }
.nomo .nomo-regions .nomo-zr.active { fill: rgba(214, 58, 63, var(--nomo-active)); }
.nomo .nomo-regions .nomo-ip.active { fill: rgba(201, 138, 0, var(--nomo-active)); }
.nomo .nomo-grid line { stroke: var(--skew-iso); }
.nomo .nomo-grid text { fill: var(--muted); }
.nomo .nomo-axis { font-size: 10px; }
.nomo .nomo-edges path { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-linejoin: round; opacity: 0.75; }
.nomo .nomo-frame { fill: none; stroke: var(--skew-frame); }
.nomo .nomo-labels text { fill: var(--text); font-size: 10px; font-weight: 600; }
.nomo .nomo-labels .active { font-size: 11px; }
.nomo .nomo-trail { fill: none; stroke: var(--skew-temp); stroke-width: 1.5; }
.nomo .nomo-point { fill: var(--skew-temp); stroke: var(--surface); stroke-width: 1.5; }
.nomo .nomo-point.off { fill: var(--surface); stroke: var(--skew-temp); }

/* Editing */

.edit-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}

.edit-bar button,
.add-level button {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.edit-bar button[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.edit-bar [hidden] { display: none; }

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.edit-note { color: var(--muted); font-size: 0.85rem; }

.skewt .handle { stroke: var(--surface); stroke-width: 1.5; cursor: ew-resize; touch-action: none; }
.skewt .handle:hover { stroke: var(--text); }
.skewt .handle-tip { fill: var(--text); font-size: 12px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }

.table-scroll {
  max-height: 420px;
  overflow: auto;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

#levels {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

#levels th {
  position: sticky;
  top: 0;
  padding: 6px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

#levels th span { font-weight: 400; }

#levels td {
  padding: 3px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  cursor: text;
}

#levels td:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
#levels tbody tr:hover { background: var(--bg); }

#levels td input {
  width: 6em;
  padding: 2px 4px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: right;
}

#levels .del {
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

#levels .del:hover { color: var(--error); }

.add-level input { width: 5.5em; }
