/* ---------- design tokens: every color and the type live here ---------- */
/* "Canopy with sea colors": salt-white page, deep-water ink, and one status panel per spot
   (seafoam = on, wax = wind fits but wrong time, sea-teal outline = off). */
:root {
  color-scheme: light dark;
  --font: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --bg: #f4f6f3;          /* salt white */
  --surface: #ffffff;
  --track: #e5ebe8;       /* segmented-control track */
  --text: #17313b;        /* deep-water ink, 12.6:1 on bg */
  --muted: #56707a;       /* secondary text, 4.8:1 */
  --border: #dde5e3;      /* hairlines */
  --focus: #3e8594;       /* focus ring */

  --on: #93d3c8;          /* seafoam: rideable now */
  --on-text: #17313b;
  --near: #f0d88e;        /* wax: wind fits, but outside your days or hours */
  --near-text: #17313b;
  --off-line: #3e8594;    /* sea teal: outline of a spot that's off */
  --swell-on: #93d3c8;    /* wind-plot area above your minimum */
  --swell-off: #dce4e2;   /* … and below it */
  --arrow-out: #a9bcc1;   /* direction outside your sector */

  /* used by screens not restyled yet */
  --accent: #17313b;
  --accent-text: #f4f6f3;
  --good: #1d6b60;
  --good-bg: #ddf0ec;
  --warn: #7a5b12;
  --warn-bg: #f7edc9;
  --danger: #b3261e;
  --observed: #b3261e;    /* measured wind: the nearest station */
  --observed-2: #6a4fb3;  /* … and the second nearest */
  --second: #b5651d;      /* the second weather model (DMI) */
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1e24;        /* night sea */
    --surface: #172a31;
    --track: #1a2b31;
    --text: #e2eeee;
    --muted: #8fa9b0;
    --border: #1f333a;
    --focus: #7cc4b8;

    --on: #7cc4b8;
    --on-text: #0f1e24;
    --near: #e3c878;
    --near-text: #0f1e24;
    --off-line: #5e7880;
    --swell-on: #7cc4b8;
    --swell-off: #1f3239;
    --arrow-out: #4e6870;

    --accent: #e2eeee;
    --accent-text: #0f1e24;
    --good: #7cc4b8;
    --good-bg: #173a36;
    --warn: #e3c878;
    --warn-bg: #3a3420;
    --danger: #ff8a80;
    --observed: #ff8a80;
    --observed-2: #b9a3ff;
    --second: #e8a25c;
  }
}

@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/instrument-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/instrument-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
}
a { color: var(--text); text-underline-offset: 3px; }
h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.015em; margin: 0.4rem 0; }
h2 { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; margin: 0.6rem 0 0.3rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- header: wordmark and unit switch, tabs below (one row on wide screens) ---------- */
.topbar {
  display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 1rem;
  padding: 0.4rem 1rem 0; background: var(--bg); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1000;
}
.navwrap { display: contents; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; min-height: 44px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 1.2rem; letter-spacing: -0.01em; }
/* The logo (logo.svg): the seafoam canopy with a clock-and-gust line carved out of it. */
.brand-mark { display: block; width: 28px; height: 21px; }
.units { grid-column: 2; grid-row: 1; display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--track); }
.units button { font: 500 15px var(--font); min-width: 48px; min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.units button[aria-pressed='true'] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(10 40 50 / 0.15); }
.tabs { grid-column: 1 / -1; display: flex; gap: 0.15rem; margin-left: -0.6rem; }
.tabs a { display: flex; align-items: center; min-height: 44px; padding: 0 0.6rem; text-decoration: none; color: var(--muted); font-weight: 500; }
.tabs a.active { color: var(--text); font-weight: 600; box-shadow: inset 0 -3px 0 var(--text); }
@media (min-width: 640px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .units { grid-column: 3; }
  .tabs { grid-column: 2; grid-row: 1; margin-left: 1rem; }
}

main { max-width: 760px; margin: 0 auto; padding: 0.75rem 1rem 3rem; }
.sitefoot { max-width: 480px; margin: 0 auto; padding: 0 1rem 1.5rem; font-size: 0.8rem; color: var(--muted); }
.sitefoot a { color: inherit; display: inline-block; padding: 0.5rem 0; }
/* Privacy and terms pages. */
.prose { padding-bottom: 1rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: 0.35rem 0; }
.prose h2 { margin-top: 1.4rem; }
.prose a { color: var(--text); }

.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--danger); min-height: 1em; margin: 0; }
.empty { color: var(--muted); padding: 2rem 0; text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 1.1rem;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 600 1rem var(--font); text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.danger { color: var(--danger); }
.confirm-delete { margin-top: 0.75rem; padding: 0.75rem; border: 1px solid var(--danger); border-radius: var(--radius); }
.confirm-delete p { margin: 0 0 0.6rem; }
.btn.small { padding: 0 0.85rem; font-size: 0.9rem; }
.btn:disabled { opacity: 0.5; }
/* Quiet text actions (Forecast, Map, Edit) that still have a 44 px tap target. */
.link-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.6rem; color: var(--text); font-weight: 600; }

.hint { color: var(--muted); font-size: 0.875rem; margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.page-actions { display: flex; gap: 0.25rem; margin: -0.2rem 0 0.4rem -0.6rem; }

/* Small sentence-case tags (alerts: new / updated). */
.tag { font-size: 0.8rem; font-weight: 600; padding: 0.1rem 0.55rem; border-radius: 999px; white-space: nowrap; }
.tag.new { background: var(--on); color: var(--on-text); }
.tag.updated { background: var(--near); color: var(--near-text); }

/* Login page */
.landing { padding: 2.5rem 0 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.landing h1 { font-size: 2rem; line-height: 1.15; }
.landing .lead { font-size: 1.05rem; }
.landing-sample { width: 168px; margin-bottom: 0.6rem; }
.login { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.4rem; }
.login .btn, .landing > .btn { align-self: flex-start; }
.bot-check:empty { display: none; }

/* ---------- pages: one phone-width column, even on desktop (except .page.wide, below) ---------- */
.page { max-width: 480px; margin: 0 auto; }
.section-title { font-size: 1.1rem; margin: 1.6rem 0 0.4rem; }
.lead { color: var(--muted); margin: 0.2rem 0 0.8rem; }

/* ---------- spot list: one spot per row, split by hairlines ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 0.6rem 0 0.2rem; }
.page-head h1 { margin: 0; }
.spots { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.spot { padding: 0.9rem 0 0.1rem; border-top: 1px solid var(--border); min-width: 0; }
.spot-top { display: grid; grid-template-columns: 168px minmax(0, 1fr); column-gap: 0.75rem; }
.spot-info h2 { margin: 0.2rem 0 0; font-size: 1.2rem; line-height: 1.25; overflow-wrap: anywhere; }
.spot-info p { margin: 0.25rem 0 0; }
.spot-info .gust { color: var(--muted); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.now-weather { white-space: nowrap; margin-left: 0.6rem; padding-left: 0.6rem; border-left: 1px solid var(--border); }
.now-weather .wx { vertical-align: -5px; margin-right: 0.2rem; }
.spot-info .status { margin-top: 0.5rem; font-weight: 600; font-size: 0.95rem; }
.spot-info .next { color: var(--muted); font-size: 0.875rem; }
.paused { display: inline-block; margin-left: 0.4rem; padding: 0 0.45rem; border: 1px solid var(--border); border-radius: 999px; font-size: 0.75rem; font-weight: 600; color: var(--muted); vertical-align: middle; }
.spot-actions { display: flex; gap: 0.25rem; margin-left: -0.6rem; }

/* The status panel: a kite-canopy cut. Filled when something's happening, only outlined when off. */
.panel { position: relative; padding: 0.6rem 1.9rem 0.75rem 0.85rem; color: var(--on-text); }
.panel-shape { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.panel-shape path { fill: var(--on); stroke: none; }
.panel[data-state='near'] .panel-shape path { fill: var(--near); }
.panel[data-state='near'] { color: var(--near-text); }
.panel[data-state='off'] .panel-shape path,
.panel[data-state='unknown'] .panel-shape path { fill: none; stroke: var(--off-line); stroke-width: 1.75; }
.panel[data-state='off'], .panel[data-state='unknown'] { color: var(--text); }
.panel[data-state='unknown'] .panel-shape path { stroke-dasharray: 4 4; }
.panel > :not(.panel-shape) { position: relative; }
.panel-word { display: flex; align-items: center; gap: 0.4rem; font-weight: 600; }
.panel-speed { display: flex; align-items: baseline; gap: 0.25rem; margin-top: 0.1rem; font-variant-numeric: tabular-nums; }
.panel-speed .value { font-size: 3.4rem; font-weight: 600; line-height: 1; letter-spacing: -0.02em; }
.panel-speed .unit { font-size: 1.05rem; font-weight: 600; }
.panel-dir { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.35rem; font-weight: 600; }
.panel-dir svg { flex: none; }

/* Wind plot: speed over the next 24 h against your minimum, with direction arrows every 3 h. */
.plot-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.9rem; font-size: 0.8rem; color: var(--muted); flex-wrap: wrap; }
.plot-head span { display: inline-flex; align-items: center; gap: 0.35rem; font-variant-numeric: tabular-nums; }
.plot { display: block; width: 100%; height: auto; margin-top: 0.25rem; font-family: var(--font); font-variant-numeric: tabular-nums; touch-action: pan-y; cursor: crosshair; }
/* The hover readout (components/windPlot.js withReadout): a line at the hour, dots on the lines, a small box. */
.plot-wrap { position: relative; }
.plot .hover-line { stroke: var(--text); stroke-width: 1; stroke-dasharray: 2 2; }
.plot .hover-dot { fill: var(--text); stroke: var(--bg); stroke-width: 1.5; }
.plot .hover-dot.second { fill: var(--second); }
.plot-tip { position: absolute; top: 0; z-index: 2; pointer-events: none; padding: 0.35rem 0.55rem; border-radius: 8px; background: var(--surface); box-shadow: 0 2px 8px rgb(10 40 50 / 0.2); font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plot-tip strong { display: block; margin-bottom: 0.1rem; }
.plot-tip span { color: var(--muted); }
.plot-tip .second { color: var(--second); }
.plot .grid { stroke: var(--border); stroke-width: 1; }
.plot .axis { stroke: var(--muted); stroke-width: 1; }
.plot .midnight { stroke: var(--muted); stroke-width: 1; stroke-opacity: 0.45; }
.plot text { font-size: 11px; fill: var(--muted); }
.plot .day { font-weight: 600; }
.plot .below { fill: var(--swell-off); }
.plot .gust-band { fill: var(--off-line); opacity: 0.18; }
@media (prefers-color-scheme: dark) { .plot .gust-band { opacity: 0.35; } }
.plot .gust-line { fill: none; stroke: var(--off-line); stroke-width: 1; stroke-dasharray: 2 2; opacity: 0.8; }
.gust-key { width: 16px; height: 9px; border-top: 1px dashed var(--off-line); background: color-mix(in srgb, var(--off-line) 18%, transparent); }
/* The second model (DMI): a thin, faint dashed line, so the forecast itself stays the line you read. */
.plot .second-line { fill: none; stroke: var(--second); stroke-width: 1.25; stroke-dasharray: 4 3; stroke-linecap: round; opacity: 0.75; }
.second-key { width: 18px; height: 0; border-top: 2px dashed var(--second); }
.plot .above { fill: var(--swell-on); }
.plot .min-line { stroke: var(--text); stroke-width: 1.25; stroke-dasharray: 2 4; stroke-linecap: round; }
.plot .wind-line { fill: none; stroke: var(--text); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.plot .arrow-in { stroke: var(--text); fill: var(--text); }
.plot .arrow-out { stroke: var(--arrow-out); fill: var(--arrow-out); }
.min-key { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 2 3; stroke-linecap: round; }
.dir-key { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); margin: 0.2rem 0 0.4rem; }
.dir-key span { display: inline-flex; align-items: center; gap: 0.35rem; }
.dir-key .arrow-in { color: var(--text); }
.dir-key .arrow-out { color: var(--arrow-out); }

/* Shared legend style (wind map). */
.legend { display: flex; gap: 0.9rem; flex-wrap: wrap; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 0.3rem; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }

/* ---------- forms: sections split by hairlines instead of boxes ---------- */
fieldset { border: 0; border-top: 1px solid var(--border); padding: 1rem 0 0.4rem; margin: 0; display: flex; flex-direction: column; gap: 0.8rem; min-width: 0; }
legend { float: left; width: 100%; padding: 0; margin-bottom: 0.2rem; font-weight: 600; font-size: 1.1rem; letter-spacing: -0.01em; }
legend + * { clear: both; }
.field { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 600; }
input[type='text'], input[type='email'] {
  font: 400 1rem var(--font); min-height: 48px; padding: 0 0.85rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
input[type='text']:focus-visible, input[type='email']:focus-visible { outline-offset: 0; border-color: var(--focus); }
input[type='checkbox'], input[type='radio'] { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--text); }
.check { display: inline-flex; gap: 0.6rem; align-items: center; min-height: 44px; }
.options { display: flex; flex-direction: column; gap: 0.6rem; }
.option-title { color: var(--muted); font-size: 0.875rem; }
.option { display: flex; gap: 0.6rem; align-items: flex-start; min-height: 44px; }
.option input { margin-top: 0.15rem; }
.option > span { display: flex; flex-direction: column; }
.option .hint { margin-top: 0.1rem; }
.account { margin: 0; }
.account + .btn { align-self: flex-start; }
.saved { color: var(--good); font-weight: 600; }
/* The one confirming motion: "Saved" fades in (off with reduced motion, see the base rules). */
.saved.flash { animation: saved-in 0.35s ease-out; }
@keyframes saved-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.slider { display: flex; flex-direction: column; gap: 0.1rem; }
.slider-head { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.95rem; }
.slider output { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
input[type='range'] { width: 100%; accent-color: var(--text); height: 44px; margin: 0; }
.chips { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.chip {
  font: 500 0.95rem var(--font); min-width: 48px; min-height: 44px; padding: 0 0.7rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer;
}
.chip[aria-pressed='true'] { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }

.map { height: 280px; border-radius: var(--radius); overflow: hidden; }
@media (prefers-color-scheme: dark) {
  .map { background: #1d2329; }
}

/* wind map. Arrows are a shade deeper than the panels so they stand out on the map; the white outline does the rest.
   "On" is a brighter seafoam than the panels, and its arrows are drawn larger with a glow (see windMap.js), so it can't be
   mistaken for the grey "off". */
.windmap { height: min(60vh, 520px); margin-top: 0.5rem; border-radius: var(--radius); }
:root { --wm-on: #14b89f; --wm-near: #c99a2e; --wm-off: #6a838b; --wm-unknown: #a9b3bd; }
@media (prefers-color-scheme: dark) { :root { --wm-on: #5ee6c8; --wm-near: #e3c878; --wm-off: #6f8a92; --wm-unknown: #4e6870; } }
.key.wm-on { background: var(--wm-on); }
.key.wm-near { background: var(--wm-near); }
.key.wm-off { background: var(--wm-off); }
.windmap.compact { height: min(45vh, 320px); }
/* Wind arrow markers: the icon box is large so the arrow can turn freely; only the drawing itself takes clicks. */
.wa { --wm: var(--wm-unknown); width: 96px; height: 96px; }
.wa[data-state='on'] { --wm: var(--wm-on); }
.wa[data-state='near'] { --wm: var(--wm-near); }
.wa[data-state='off'] { --wm: var(--wm-off); }
.wa, .wa svg { pointer-events: none; }
.wa-arrow, .wa-label { pointer-events: auto; cursor: pointer; }
.wa svg { overflow: visible; filter: drop-shadow(0 1.5px 2px rgb(0 0 0 / 0.45)); }
.wa[data-state='on'] { z-index: 1; }
.wa[data-state='on'] svg { filter: drop-shadow(0 0 5px var(--wm-on)) drop-shadow(0 1.5px 2px rgb(0 0 0 / 0.45)); }
.wa-arrow { fill: var(--wm); stroke: #fff; stroke-width: 2.5; stroke-linejoin: round; paint-order: stroke; }
/* With the wind overlay the spot is a pin (components/windMap.js); its arrows show the wind instead. */
.wa-pin { stroke-width: 2; }
.wa-pin-dot { fill: #fff; pointer-events: none; }
.wa-label {
  position: absolute; transform: translate(-50%, -50%);
  font: 600 12px/1 var(--font); font-variant-numeric: tabular-nums; padding: 2px 5px; border-radius: 6px; white-space: nowrap;
  background: #fff; color: #17202a; box-shadow: 0 1px 2px rgb(0 0 0 / 0.35);
}
.wm-popup { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; }
.windmap .maplibregl-popup-content { background: var(--surface); color: var(--text); border-radius: var(--radius); padding: 0.6rem 1.6rem 0.6rem 0.8rem; }
.windmap .maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--surface); }
.windmap .maplibregl-popup-close-button { color: var(--muted); font-size: 1.1rem; padding: 0 0.4rem; }
.wm-popup a { color: var(--accent); }
/* On the map, top right (the zoom buttons are top left): the overlay is loading, or how old its wind is. */
.wm-note {
  position: absolute; top: 10px; right: 10px; z-index: 3; margin: 0; max-width: calc(100% - 70px);
  padding: 0.3rem 0.6rem; border-radius: 8px; background: var(--surface); color: var(--text);
  font: 0.85rem/1.35 var(--font); box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
}
.map-error { padding: 2rem 1rem; text-align: center; }

/* Spot editor map (components/editorMap.js): the pin, and an arrow for each ticked direction. */
.ed-map { height: 320px; }
.ed-pin { --wm: var(--accent); cursor: grab; }
.ed-pin .wa-arrow { cursor: grab; }
.ed-dirs, .ed-dirs svg { pointer-events: none; }
.ed-dirs svg { overflow: visible; }
.ed-arrow { fill: var(--on); stroke: var(--on-text); stroke-width: 1.5; stroke-linejoin: round; filter: drop-shadow(0 1px 1.5px rgb(0 0 0 / 0.35)); }
.timebar { display: flex; flex-direction: column; gap: 0.2rem; margin-top: 0.6rem; }
.timebar .when { font-weight: 600; font-variant-numeric: tabular-nums; }
.strip-axis { position: relative; height: 1.1em; font-size: 0.72rem; }
.strip-axis span { position: absolute; top: 0; }
.timebar .strip-axis { overflow: hidden; }
/* ‹ slider › : the hour buttons level with the slider; the day names under the slider only (inset by a button and gap). */
.tb-scrub { display: flex; align-items: center; gap: 0.5rem; }
.tb-scrub input { flex: 1; min-width: 0; }
.btn.tb-step { min-width: 2.75rem; min-height: 2.75rem; padding: 0 0 0.15rem; font-size: 1.6rem; line-height: 1; }
.tb-scrub + .strip-axis { margin-inline: 3.25rem; }
/* The wind overlay's color steps (components/windField.js). */
.wf-legend { margin-top: 0.9rem; }
.wf-legend .wf-caption { margin: 0 0 0.25rem; }
.wf-bar { height: 10px; border-radius: 5px; }
.wf-ticks { position: relative; height: 1.2em; font-variant-numeric: tabular-nums; }
.wf-ticks span { position: absolute; top: 0.1em; transform: translateX(-50%); }
.wf-ticks span:first-child { transform: none; }
.wf-ticks .wf-end { right: 0; transform: none; }
/* Every other number on phones, where they'd run together; the last one would crowd "22+". */
@media (max-width: 599px) { .wf-ticks .odd, .wf-ticks .last { display: none; } }

/* Direction picker: chosen directions in seafoam, like an "on" spot. */
.compass { width: min(300px, 100%); align-self: center; touch-action: manipulation; user-select: none; }
.compass .wedge { fill: var(--surface); stroke: var(--border); stroke-width: 1; cursor: pointer; }
.compass .wedge:hover { fill: color-mix(in srgb, var(--on) 35%, var(--surface)); }
.compass .wedge.on { fill: var(--on); stroke: var(--off-line); }
.compass .wedge:focus-visible { outline: none; stroke: var(--focus); stroke-width: 3; }
.compass .label { font-size: 9px; fill: var(--muted); text-anchor: middle; dominant-baseline: central; pointer-events: none; font-family: var(--font); }
.compass .label.cardinal { font-size: 13px; font-weight: 700; fill: var(--text); }
/* Each label directly follows its wedge in the SVG. */
.compass .wedge.on + .label { fill: var(--on-text); font-weight: 600; }
.compass .label.centre { font-size: 10px; }

/* ---------- Forecast page ---------- */
.rules { color: var(--muted); font-size: 0.875rem; margin: 0.8rem 0 0; }
.windows { list-style: none; padding: 0; margin: 0; }
.windows li { display: flex; flex-direction: column; padding: 0.55rem 0 0.55rem 0.8rem; border-left: 3px solid var(--on); margin-bottom: 0.4rem; }
.windows li span { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.filters { display: flex; gap: 0.2rem 1.2rem; flex-wrap: wrap; }
.days { display: flex; flex-direction: column; gap: 1.2rem; margin-top: 0.4rem; }
.day h3 { font-size: 1rem; margin: 0 0 0.3rem; }
.day h3 span { color: var(--muted); font-weight: 400; }
table.hours { width: 100%; border-collapse: collapse; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.hours th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.8rem; padding: 0.25rem 0.4rem; }
.hours td { padding: 0.45rem 0.4rem; border-top: 1px solid var(--border); vertical-align: middle; }
.hours tr.ok td { background: color-mix(in srgb, var(--on) 30%, transparent); }
.hours tr.ok td:first-child { box-shadow: inset 3px 0 var(--off-line); }
.hours tr.ok .verdict { font-weight: 600; white-space: nowrap; }
.hours tr.fail .verdict { color: var(--muted); font-size: 0.85rem; }
.hours tr.past { opacity: 0.5; }
.hours .time { white-space: nowrap; }
.hours .wind { font-weight: 600; }
.hours .dir { white-space: nowrap; }
.hours .dir svg { vertical-align: -3px; }
.hours .weather { white-space: nowrap; color: var(--muted); }
.hours .weather .wx { vertical-align: -6px; margin-right: 0.15rem; }
.hours .weather .rain { display: block; font-size: 0.75rem; color: var(--off-line); padding-left: 1.6rem; }

/* Weather symbols (components/weather.js): wax sun, outlined cloud, sea-teal rain. */
.wx { overflow: visible; }
.wx-sun { fill: var(--near); stroke: var(--near); stroke-width: 1.6; stroke-linecap: round; }
.wx-moon { fill: var(--muted); }
.wx-cloud { fill: var(--surface); stroke: var(--muted); stroke-width: 1.6; stroke-linejoin: round; }
.wx-rain line { stroke: var(--off-line); stroke-width: 1.6; stroke-linecap: round; }
.wx-snow circle { fill: var(--muted); }
.wx-fog line { stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }
.wx-bolt { fill: var(--near); stroke: var(--warn); stroke-width: 0.6; stroke-linejoin: round; }
/* A window in two compact lines: when | weather, and wind | labels (the labels wrap under on a phone). */
.windows li .w-line { display: flex; align-items: center; justify-content: space-between; gap: 0.2rem 0.75rem; flex-wrap: wrap; }
.windows li .w-line + .w-line { margin-top: 0.15rem; }
.windows li .w-weather { color: var(--text); display: inline-flex; align-items: center; gap: 0.3rem; }
.windows li .w-wind { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--text); }
.windows li .w-wind svg { flex: none; }
.w-tags { display: inline-flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
/* Steadiness labels on windows (.tag pills): steady in the app's green, some gusts in wax, gusty filled. */
.windows li span.tag { font-size: 0.75rem; }
.tag.steady { background: var(--good-bg); color: var(--good); }
.tag.some { background: var(--warn-bg); color: var(--warn); }
.tag.gusty { background: var(--warn); color: var(--bg); }
.tag.agree { background: var(--good-bg); color: var(--good); }
.tag.differ { background: var(--warn-bg); color: var(--warn); }
/* The second model's wind in brackets in the hour table, in its plot color. */
.hours .second { color: var(--second); font-weight: 400; font-size: 0.85em; white-space: nowrap; }
/* On a phone it goes under our number instead of beside it, so the table still fits without scrolling sideways. */
@media (max-width: 600px) { .hours .second { display: block; font-size: 0.75rem; line-height: 1.1; } }

/* ---------- Measured nearby (SMHI stations) on the Forecast page: Live dials or the last hours' plot ---------- */
/* Each station has a color, shared by its dial and its line. */
.st-0 { --station: var(--observed); }
.st-1 { --station: var(--observed-2); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin: 1.6rem 0 0.4rem; }
.section-head .section-title { margin: 0; }
/* A small segmented toggle, like the kn / m/s one. */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--track); }
.seg button { font: 500 0.9rem var(--font); min-height: 40px; padding: 0 0.9rem; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(10 40 50 / 0.15); }

.dials { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem; margin: 0.2rem 0 0.6rem; }
.station { margin: 0; display: flex; flex-direction: column; align-items: center; text-align: center; }
.station figcaption { display: flex; flex-direction: column; gap: 0.05rem; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.station figcaption strong { color: var(--text); font-size: 0.95rem; }
.station figcaption strong i { display: inline-block; width: 10px; height: 10px; margin-right: 0.35rem; border-radius: 50%; background: var(--station); }
.station .stale { color: var(--warn); }
.dial { width: 100%; max-width: 170px; height: auto; font-family: var(--font); font-variant-numeric: tabular-nums; }
.dial-ring { fill: var(--surface); stroke: var(--station); stroke-width: 2.5; }
.dial-tick { stroke: var(--muted); stroke-width: 1; }
.dial-tick.major { stroke: var(--text); stroke-width: 1.5; }
.dial-compass { font-size: 10px; font-weight: 600; fill: var(--muted); }
.dial-arrow { fill: var(--station); stroke: var(--surface); stroke-width: 1.5; stroke-linejoin: round; }
.dial-speed { font-size: 30px; font-weight: 700; fill: var(--text); }
.dial-unit { font-size: 11px; fill: var(--muted); }
.dial-gust { font-size: 11px; font-weight: 600; fill: var(--text); }
.forecast-said { margin: 0 0 0.3rem; font-weight: 600; font-size: 0.95rem; }

.measured-plot { display: block; width: 100%; height: auto; margin-top: 0.2rem; font-family: var(--font); font-variant-numeric: tabular-nums; }
.measured-plot text { font-size: 11px; fill: var(--muted); }
.measured-plot .grid { stroke: var(--border); }
.measured-plot .axis { stroke: var(--muted); }
.measured-plot .mp-line { fill: none; stroke: var(--station); stroke-width: 2; stroke-linejoin: round; }
.measured-plot .mp-dot { fill: var(--station); stroke: var(--bg); stroke-width: 1; }
.measured-plot .mp-forecast { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 3; }
.measured-key { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; margin: 0.2rem 0 0.4rem; font-size: 0.8rem; color: var(--muted); }
.measured-key span { display: inline-flex; align-items: center; gap: 0.35rem; }
.measured-key i { width: 18px; height: 0; border-top: 2.5px solid var(--station); }
.measured-key i.mp-forecast { border-top: 2px dashed var(--muted); }
.about { margin-top: 1.6rem; color: var(--muted); font-size: 0.875rem; }
.about summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--text); }
.about p { margin: 0 0 0.5rem; }

/* ---------- Alerts page ---------- */
.alert-list { list-style: none; padding: 0; margin: 0; }
.alert { padding: 0.8rem 0; border-top: 1px solid var(--border); }
.alert-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.alert-head h2 { margin: 0; font-size: 1.05rem; }
.alert-head h2 span { color: var(--muted); font-weight: 400; }
.alert-windows { margin: 0.35rem 0 0; padding-left: 1.1rem; font-variant-numeric: tabular-nums; }
.alert-meta { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.85rem; }
.devout { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 380px) {
  .hours td, .hours th { padding-left: 0.25rem; padding-right: 0.25rem; }
  .hours .verdict { font-size: 0.8rem; }
}

/* Forecast page: phones show one view at a time, picked in the bar under the title; wide screens show them all. */
.view-tabs { margin: 0.9rem 0 0.2rem; scroll-margin-top: 7.5rem; } /* clear of the sticky header */
.view-tabs .seg, .day-pick .seg { display: flex; }
.view-tabs .seg button, .day-pick .seg button { flex: 1; padding: 0 0.4rem; }
.day-pick { margin: 0.5rem 0 0.2rem; }
/* Keeps "Hour by hour" on one line on 320 px phones. */
@media (max-width: 380px) {
  .view-tabs .seg button { font-size: 0.82rem; padding: 0 0.15rem; white-space: nowrap; }
}
@media (max-width: 899px) {
  .view-off, .view-title { display: none; }
}
@media (min-width: 900px) {
  .view-tabs { display: none; }
}

/* ---------- wide screens: the Forecast page uses the room (phones keep the single column above) ---------- */
@media (min-width: 900px) {
  main:has(.page.wide) { max-width: 1080px; }
  .page.wide { max-width: none; }
  /* Spot list: each spot one row, the panel, status and links on the left and its plot on the right. */
  .page.wide .spot {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); column-gap: 2.5rem;
    grid-template-areas: 'top plot' 'actions plot'; align-items: start; padding-bottom: 0.9rem;
  }
  .page.wide .spot-top { grid-area: top; }
  .page.wide .spot-plot { grid-area: plot; }
  .page.wide .spot-plot .plot-head { margin-top: 0; }
  .page.wide .spot-actions { grid-area: actions; margin-top: 0.4rem; }
  /*
   * Summary, plot and windows on the left; the map on the right, at least 400 px tall and stretched to end where
   * the left column ends.
   */
  .forecast-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 2.5rem; align-items: stretch; }
  .ft-map { display: flex; flex-direction: column; }
  .ft-map > section { flex: 1; display: flex; flex-direction: column; }
  .ft-map > .section-title:first-child { margin-top: 0.2rem; }
  .forecast-top .windmap.compact { flex: 1; height: auto; min-height: 400px; }
  /* Fixed columns, so every day's table lines up with the next. */
  .page.wide .hours { font-size: 1.05rem; table-layout: fixed; }
  .page.wide .hours th:nth-child(1) { width: 11%; }
  .page.wide .hours th:nth-child(2) { width: 13%; }
  .page.wide .hours th:nth-child(3) { width: 11%; }
  .page.wide .hours th:nth-child(4) { width: 15%; }
  .page.wide .hours th:nth-child(5) { width: 22%; }
  .page.wide .hours .wind { font-size: 1.2rem; }
  .page.wide .hours th { font-size: 0.85rem; padding: 0.4rem 0.75rem; }
  .page.wide .hours td { padding: 0.7rem 0.75rem; }
  .page.wide .hours .weather .wx { width: 28px; height: 28px; vertical-align: -8px; }
  .page.wide .hours .weather .rain { display: inline; padding-left: 0.5rem; font-size: 0.85rem; }
  .page.wide .hours .dir svg { width: 20px; height: 20px; vertical-align: -4px; }
  .page.wide .day h3 { font-size: 1.2rem; }
  /* Spot editor: the form on the left, the map on the right, staying in view while the form scrolls. */
  /* Margins instead of row gaps: the map spans more rows than the form has, and the spare ones stay 0 high. */
  .ed { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 0 2.5rem; align-items: start; }
  .ed > * { grid-column: 1; margin-bottom: 0.9rem; }
  .ed > .page-head { grid-column: 1 / -1; }
  .ed > .ed-where { grid-column: 2; grid-row: 2 / span 20; position: sticky; top: 5rem; }
  .ed .ed-map { height: max(420px, calc(100vh - 14rem)); }
}
