/* ==========================================================================
   Catch Signal: "Conditions now" (#/now, docs/DESIGN.md §6.0)
   Loaded by index.html after base.css and app.css. Every rule is scoped to
   the .now view or a .now-* class. Mobile first: one column at 375 px, two
   columns of detail cards from 48rem. Colours come from the base.css tokens,
   so light and dark themes both work; the few extra tokens are defined here
   for both themes (system dark and data-theme="dark").
   ========================================================================== */

.now {
  --now-green: #1d6b3c;          /* green-zone banner fill */
  --now-green-ink: #ffffff;
  --now-band: rgb(14 114 126 / .16);
  --now-gust: #6b7f88;
  --now-zone-cpz: #f3d65a; --now-zone-cpz-ink: #3d3100;
  --now-zone-hpz: #1f4f8a; --now-zone-hpz-ink: #ffffff;
  --now-zone-guz: #cfe3f3; --now-zone-guz-ink: #0f2a3a;
  --now-zone-mnp: #1d6b3c; --now-zone-mnp-ink: #ffffff;
  display: grid;
  gap: var(--space-4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .now {
    --now-green: #287a48; --now-green-ink: #ffffff;
    --now-band: rgb(72 184 192 / .2);
    --now-gust: #93a9b2;
    --now-zone-cpz: #e2c548; --now-zone-cpz-ink: #2a2100;
    --now-zone-hpz: #3d6fb0; --now-zone-hpz-ink: #ffffff;
    --now-zone-guz: #24445c; --now-zone-guz-ink: #e1ecee;
    --now-zone-mnp: #287a48; --now-zone-mnp-ink: #ffffff;
  }
}
:root[data-theme="dark"] .now {
  --now-green: #287a48; --now-green-ink: #ffffff;
  --now-band: rgb(72 184 192 / .2);
  --now-gust: #93a9b2;
  --now-zone-cpz: #e2c548; --now-zone-cpz-ink: #2a2100;
  --now-zone-hpz: #3d6fb0; --now-zone-hpz-ink: #ffffff;
  --now-zone-guz: #24445c; --now-zone-guz-ink: #e1ecee;
  --now-zone-mnp: #287a48; --now-zone-mnp-ink: #ffffff;
}

.now > *, .now-result > *, .now-grid > * { min-width: 0; }
.now .ic { flex: none; vertical-align: -3px; }

/* ---- header: title, mode switch, location */
.now-head { display: grid; gap: var(--space-3); }
.now-title { display: grid; gap: var(--space-1); }
.now-title h1 { font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem); }

.now-mode { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; width: 100%; max-width: 34rem; margin: 0; padding: 3px; border: 1px solid var(--field-line); border-radius: 10px; background: var(--surface); }
.now-mode-opt { position: relative; display: block; cursor: pointer; }
.now-mode-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.now-mode-opt span {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 6px 8px; border-radius: 7px;
  color: var(--muted); font-weight: 600; font-size: var(--fs-sm); line-height: 1.1; text-align: center;
}
.now-mode-opt input:checked + span { background: var(--accent); color: var(--accent-ink); }
.now-mode-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.now-mode-opt:hover input:not(:checked) + span { color: var(--ink); background: var(--sunken); }

.now-locbox { display: grid; gap: var(--space-2); }
.now-loc { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); }
.now-loc .btn { flex: 0 0 auto; }
/* The shell's "Fishing at" picker (components/location.js) goes on its own line under the location button (it has a
   label above and a save line below, so side by side the button would sit against neither), as wide as the mode switch */
.now-spot { width: 100%; min-width: 0; max-width: 34rem; }
/* A boat-only spot picked while in shore mode: say which shore spot the verdict is for */
.now-spot-note { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-sm); color: var(--warn); }
.now-spot-note .ic { margin-top: 2px; }
.now-loc-status { font-size: var(--fs-sm); color: var(--muted); min-height: 1.3em; }
.now-loc-status:empty { display: none; }
.now-loc-status.is-problem { color: var(--warn); font-weight: 500; }
.now-privacy { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-xs); color: var(--muted); }
.now-privacy .ic { margin-top: 1px; }

/* "Looks like you're moving — on the boat?" */
.now-hint {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--surface);
}
.now-hint p { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.now-hint:empty, [data-now="hint"]:empty { display: none; }

/* ---- loading */
.now-result { display: grid; gap: var(--space-4); }
.now-loading { display: grid; justify-items: center; gap: var(--space-3); padding: var(--space-6) var(--space-4); border: 1px dashed var(--line); border-radius: var(--radius-lg); color: var(--muted); text-align: center; }
/* The shell's .boot blocks are page-sized (180 + 88 + 88 px) and collapse to zero width here, leaving a tall blank
   box that pushes the safety strip off a phone screen: show them as three short pulsing bars instead */
.now-loading .boot { grid-template-columns: repeat(3, 2.5rem); gap: 6px; }
.now-loading .boot i, .now-loading .boot i:first-child { height: 8px; border-radius: 999px; }
@media (prefers-reduced-motion: reduce) { .now-loading .boot i { animation: none; } }

/* ---- green-zone banner (top of the result, whatever the verdict) */
.now-green {
  display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--now-green); color: var(--now-green-ink); box-shadow: var(--shadow);
}
.now-green p { display: grid; gap: 4px; min-width: 0; }
.now-green b { font: 700 1.25rem/1.15 var(--font-display); text-transform: uppercase; letter-spacing: .02em; overflow-wrap: anywhere; }
.now-green p > span { font-size: var(--fs-sm); opacity: .92; }
.now-green a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.now-green a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* ---- the verdict */
.now-verdict {
  --lvl: var(--good); --lvl-bg: var(--good-bg);
  display: grid; gap: var(--space-3); padding: var(--space-4) var(--space-4) var(--space-4) calc(var(--space-4) + 2px);
  border: 1px solid var(--line); border-left: 6px solid var(--lvl); border-radius: var(--radius-lg);
  background: var(--lvl-bg); box-shadow: var(--shadow);
}
@supports (color: color-mix(in srgb, red 50%, red)) { .now-verdict { border-color: color-mix(in srgb, var(--lvl) 35%, var(--line)); border-left-color: var(--lvl); } }
.now-verdict.lvl-caution { --lvl: var(--caution); --lvl-bg: var(--caution-bg); }
.now-verdict.lvl-leave { --lvl: var(--warn); --lvl-bg: var(--warn-bg); }
.now-verdict-top { display: flex; align-items: center; gap: var(--space-3); }
.now-verdict-icon {
  display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 50%;
  background: var(--lvl); color: var(--lvl-bg);
}
.now-verdict-words { display: grid; gap: 2px; min-width: 0; }
.now-level { font: 700 clamp(2.25rem, 1.8rem + 2.4vw, 3.25rem)/.95 var(--font-display); text-transform: uppercase; letter-spacing: .02em; color: var(--lvl); }
.now-headline { font: 600 var(--fs-md)/1.25 var(--font-body); text-transform: none; letter-spacing: 0; color: var(--ink); }
.now-by {
  justify-self: start; display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: var(--lvl); color: var(--lvl-bg); font-weight: 600;
}
.now-by b { font: 700 1.5rem/1 var(--font-display); letter-spacing: .02em; }
.now-reasons { margin: 0; padding-left: 1.15em; display: grid; gap: 4px; }
.now-reasons li::marker { color: var(--lvl); }
.now-for { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }

/* ---- always-visible safety strip */
.now-safety {
  display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4); border: 1px solid var(--line);
  border-left: 4px solid var(--warn); border-radius: var(--radius); background: var(--surface); font-size: var(--fs-sm);
}
.now-safety-list { display: flex; flex-wrap: wrap; gap: 4px var(--space-4); margin: 0; padding: 0; list-style: none; }
.now-safety-list li { white-space: nowrap; }
.now-safety-list b { color: var(--warn); }
.now-safety-list span { color: var(--muted); }
.now-guide { color: var(--ink); }
.now-safety-more { margin: 0; padding-left: 1.1em; color: var(--muted); display: grid; gap: 2px; }

/* ---- detail cards */
.now-grid { display: grid; gap: var(--space-4); }
@media (min-width: 48rem) {
  .now-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
.now-card {
  display: grid; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow);
}
.now-card h3 { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); letter-spacing: .06em; color: var(--muted); }
.now-big-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.now-big { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px; }
.now-big b { font: 700 2.75rem/1 var(--font-display); letter-spacing: .01em; }
.now-unit { font: 600 1.25rem/1 var(--font-display); color: var(--muted); }
.now-from { font-weight: 600; color: var(--muted); }
.now-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: 6px var(--space-4); margin: 0; flex: 1 1 14rem; font-size: var(--fs-sm); }
.now-mini div { display: grid; gap: 0; }
.now-mini dt { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; }
.now-mini dd { margin: 0; font-weight: 600; }
.now-nw { white-space: nowrap; } /* a figure and its unit ("1.94 m") never split across lines */
.trend-rising { color: var(--warn); }
.trend-easing { color: var(--good); }
.now-note { font-size: var(--fs-sm); }
.now-card .attr, .now .attr { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
.now .attr a { color: inherit; }
.now-storm { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: var(--fs-sm); }
.now-storm.storm-possible { color: var(--caution); }
.now-storm.storm-likely { color: var(--warn); }
.now-near-green { display: flex; align-items: flex-start; gap: 6px; color: var(--warn); font-weight: 600; }
.now-near-green .ic { margin-top: 2px; }
/* the spot name, then the distance on its own line (no ragged wrap with a leading gap on phones) */
.now-where-block { display: grid; gap: 2px; }
.now-where { font-size: var(--fs-md); overflow-wrap: anywhere; }
.now-where-dist { font-size: var(--fs-sm); line-height: 1.3; color: var(--muted); }
.now-zone-front { font-size: var(--fs-sm); font-weight: 600; margin-bottom: calc(-1 * var(--space-2)); }
.now-zone-row { display: flex; flex-wrap: wrap; gap: 6px; }
.now-zone-guide { color: var(--muted); }

/* wind direction arrow */
.now-arrow { flex: none; }
.now-arrow-ring { fill: var(--sunken); stroke: var(--line); stroke-width: 1.5; }
.now-arrow-head { fill: var(--accent); }
.now-arrow-n { fill: var(--muted); font: 600 7px/1 var(--font-body); }

/* charts (SVG; colours through classes so both themes work and no inline styles are needed) */
.now-chart { display: block; width: 100%; height: auto; overflow: visible; }
.now-chart-empty { font-size: var(--fs-sm); color: var(--muted); }
.now-chart text { font-family: var(--font-data); font-size: 10px; }
.now-gridline { stroke: var(--line); stroke-width: 1; }
.now-tick, .now-ytick { fill: var(--muted); }
.now-zone-caution { fill: var(--caution); fill-opacity: .13; }
.now-zone-leave { fill: var(--warn); fill-opacity: .12; }
.now-thr { stroke-width: 1; stroke-dasharray: 3 3; }
.now-thr-caution { stroke: var(--caution); }
.now-thr-leave { stroke: var(--warn); }
.now-wind-band { fill: var(--now-band); }
.now-wind-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.now-gust-line { fill: none; stroke: var(--now-gust); stroke-width: 1.5; stroke-dasharray: 2 3; stroke-linecap: round; }
.now-nowline { stroke: var(--marker); stroke-width: 1.5; }
.now-nowdot { fill: var(--marker); stroke: var(--surface); stroke-width: 1.5; }
.now-nowtxt { fill: var(--marker-text); font-weight: 500; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.now-tide-fill { fill: var(--tide); fill-opacity: .12; }
.now-tide-line { fill: none; stroke: var(--tide); stroke-width: 2; }
.now-turn { fill: var(--tide); }
.now-turn-txt { fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.now-tide-pred { fill: var(--surface); stroke: var(--tide); stroke-width: 2; }
.now-tide-obs { fill: var(--marker); stroke: var(--surface); stroke-width: 1.5; }
.now-key-obs { display: inline-block; width: 9px; height: 9px; margin-left: 4px; border-radius: 50%; background: var(--marker); vertical-align: 0; }

.now-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: var(--fs-xs); color: var(--muted); }
.now-legend > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.now-legend .key { display: inline-block; width: 16px; height: 0; border-top: 2.5px solid var(--accent); }
.now-legend .key-band { height: 9px; border: 0; background: var(--now-band); }
.now-legend .key-gust { border-top: 2px dotted var(--now-gust); }
.now-legend .key-thr { border-top: 1.5px dashed var(--warn); }

/* zone badges */
.now-zone {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em; background: var(--sunken); color: var(--ink);
}
.now-zone-mnp { background: var(--now-zone-mnp); color: var(--now-zone-mnp-ink); }
.now-zone-cpz { background: var(--now-zone-cpz); color: var(--now-zone-cpz-ink); }
.now-zone-hpz { background: var(--now-zone-hpz); color: var(--now-zone-hpz-ink); }
.now-zone-guz { background: var(--now-zone-guz); color: var(--now-zone-guz-ink); }
.now-zone-none { background: var(--sunken); color: var(--muted); }

/* ---- advice */
.now-advice { display: grid; gap: var(--space-3); }
.now-advice > h2 { margin-top: var(--space-2); }
.now-sub { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); margin-top: var(--space-2); }
.now-targets, .now-moves { display: grid; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
@media (min-width: 48rem) {
  .now-targets { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
  .now-moves { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
}
.now-target, .now-move {
  display: grid; gap: var(--space-2); align-content: start; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.now-target h4, .now-move h4 { font: 700 1.25rem/1.1 var(--font-display); text-transform: uppercase; letter-spacing: .03em; }
.now-target-why { font-size: var(--fs-sm); color: var(--muted); }
.now-gear { display: grid; gap: 6px; margin: 0; font-size: var(--fs-sm); }
.now-gear div { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: 8px; }
.now-gear dt { color: var(--muted); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; padding-top: 2px; }
.now-gear dd { margin: 0; }
.now-move-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px var(--space-3); }
.now-dist { font: 500 var(--fs-sm)/1.2 var(--font-data); color: var(--marker-text); white-space: nowrap; }
.now-move p { font-size: var(--fs-sm); }
.now-move-links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.now-window {
  display: flex; align-items: flex-start; gap: 8px; padding: var(--space-3) var(--space-4); border-radius: var(--radius);
  border: 1px solid var(--marker); background: var(--surface);
}
@supports (color: color-mix(in srgb, red 50%, red)) { .now-window { border-color: color-mix(in srgb, var(--marker) 45%, var(--line)); } }
.now-window .ic { color: var(--marker); margin-top: 2px; }
.now-ramp { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-sm); }
.now-ramp .ic { margin-top: 1px; color: var(--accent); }
.now-ramp-why { display: block; margin-top: 2px; color: var(--muted); }
.now-tips { margin: 0; padding-left: 1.15em; display: grid; gap: 4px; font-size: var(--fs-sm); }

/* ---- data freshness */
.now-data { display: grid; gap: var(--space-2); font-size: var(--fs-xs); color: var(--muted); }
.now-data p { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.now-problems { margin: 0; padding-left: 1.1em; color: var(--caution); }
.now-stale { color: var(--caution); font-weight: 700; }

/* Windows high contrast */
@media (forced-colors: active) {
  .now-verdict, .now-card, .now-safety, .now-green, .now-zone, .now-by, .now-mode { border: 1px solid CanvasText; }
  .now-mode-opt input:checked + span { outline: 2px solid Highlight; }
}

@media print {
  .now-head, .now-data, [data-now="hint"] { display: none; }
}
