/* ---------------------------------------------------------------------------
 * panels.css — THE ONE DRAWER (SPEC §16).
 *
 * There is exactly ONE panel element: #drawer. Storms, storm detail, layers,
 * home, and settings are VIEWS INSIDE IT. It is glass, translucent, globe
 * visible behind, never full-screen. Docking adapts to WIDTH, not device —
 * the same DOM element becomes a bottom sheet when narrow and a left rail
 * when wide. No isMobile, no second markup tree.
 *
 * The drawer slides ONCE. Moving between views does not re-animate it; only
 * the view body crossfades. Four sibling panels alternating open/closed read
 * as a stack of drawers fighting each other, which is what this replaced.
 *
 * All values are custom properties written from tokens.js at boot; the
 * literals in :root of index.html are first-paint fallbacks only.
 *
 * Motion: transform and opacity ONLY (SPEC §9). The sheet slides with
 * translateY, the rail with translateX. Nothing here animates height.
 * ------------------------------------------------------------------------- */

#drawer {
  position: fixed;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 40px var(--glass-shadow);
  color: var(--text-primary);
  /* transition lives with the visibility rules below — see the note there. */
}

/* A CLOSED PANEL IS OFF-SCREEN, NOT GONE.
 *
 * The open/close animation is transform + opacity only (the §9 rule), so a
 * closed panel is still laid out, still in the DOM, and — the bug — still
 * FOCUSABLE. Tab walked through invisible storm rows.
 *
 * `display: none` would fix focus but kills the slide. `visibility: hidden` is
 * the right tool: it removes the element from the tab order AND from the
 * accessibility tree, but unlike display it is animatable, so the slide-out
 * still plays. The delayed transition is what makes that work — visibility
 * flips to hidden only AFTER the transform finishes, so the panel is still
 * visible while it slides away, then goes untabbable on arrival. Opening is
 * instant (0s delay) so it's focusable the moment it starts moving.
 *
 * `inert` would also work but is not animatable and would need JS to toggle;
 * this keeps the whole open/closed contract in CSS where the animation lives. */
#drawer {
  visibility: hidden;
  transition: transform var(--duration-base) var(--ease-settle),
              opacity var(--duration-base) var(--ease-settle),
              visibility 0s linear var(--duration-base);
}

#drawer[data-open="true"] {
  visibility: visible;
  transition: transform var(--duration-base) var(--ease-settle),
              opacity var(--duration-base) var(--ease-settle),
              visibility 0s linear 0s;
}

/* Narrow: bottom sheet, ~60% height max, sliding up from the thumb zone. */
@media (max-width: 719.9px) {
  #drawer {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 60vh;
    border-radius: var(--radius-large) var(--radius-large) 0 0;
    padding-bottom: var(--safe-bottom);
    transform: translateY(105%);
  }
  #drawer[data-open="true"] { transform: translateY(0); }

  /* The control cluster floats over the sheet's right edge and buries row
   * text, so while the drawer is open the cluster steps aside. This is safe
   * precisely BECAUSE the drawer carries its own back and close chrome: the
   * only navigation anyone wants mid-view is Back, and Back is in the header.
   * (It is also why there is no tab row inside the drawer — a persistent nav
   * would cost ~44px of a 60vh sheet forever to duplicate these buttons.)
   * Transform and opacity only. (#controls is a later sibling, hence ~.) */
  #drawer[data-open="true"] ~ #controls {
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
  }
  #controls {
    transition: opacity var(--duration-base) var(--ease-swap),
                transform var(--duration-base) var(--ease-swap);
  }
}

/* Wide: left rail, fixed width, full height. A touchscreen laptop gets the
 * rail because it is WIDE, and that is correct (capability, not device). */
@media (min-width: 720px) {
  #drawer {
    top: 0;
    left: 0;
    bottom: 0;
    width: 340px;
    border-radius: 0 var(--radius-large) var(--radius-large) 0;
    padding-top: var(--safe-top);
    transform: translateX(-105%);
  }
  #drawer[data-open="true"] { transform: translateX(0); }
}

/* --- drawer chrome --------------------------------------------------------
 * PERSISTENT ACROSS VIEWS. The header does not rebuild when the body swaps —
 * only its title and the back button's presence change. That steadiness is
 * what makes the drawer read as one surface being navigated rather than a
 * stack of panels replacing each other.
 * ------------------------------------------------------------------------ */

.drawer-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-tight);
  padding: var(--space-base) var(--space-snug);
  flex: 0 0 auto;
}

/* The title slot holds either a plain <h1> or a view-supplied node (the storm
 * detail's swatch + name + nature). min-width:0 lets a long storm name
 * ellipsis instead of shoving the close button off the edge. */
.drawer-title-slot { min-width: 0; }

.drawer-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-back,
.drawer-close {
  width: var(--touch-target);
  height: var(--touch-target);
  display: grid;
  place-items: center;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}
.drawer-back svg,
.drawer-close svg { width: 18px; height: 18px; }
@media (hover: hover) {
  .drawer-back:hover,
  .drawer-close:hover { color: var(--text-primary); }
}
.drawer-back:focus-visible,
.drawer-close:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
/* [hidden] must beat the grid display above, or a hidden back button still
 * occupies its column and the title never reclaims the space. */
.drawer-back[hidden] { display: none; }

/* --- views ----------------------------------------------------------------
 * One host per view, all stacked in the same box. Only the active one is
 * rendered; the rest carry the `hidden` attribute, which takes them out of
 * BOTH the tab order and the accessibility tree. Opacity alone would leave
 * an invisible view's controls focusable — the same trap the closed panel
 * hit (§13).
 * ------------------------------------------------------------------------ */

.drawer-views {
  flex: 1 1 auto;
  min-height: 0;   /* lets the scrolling body shrink inside a flex column */
  display: flex;
  flex-direction: column;
}

.drawer-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.drawer-view[hidden] { display: none; }

/* The body scrolls; view chrome above it (the detail stamp, the scope filter)
 * stays pinned. */
.drawer-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--space-snug) var(--space-comfy);
  flex: 1 1 auto;
  min-height: 0;
}

/* Entering a view fades its body in. Transform and opacity only (§9), and
 * short — this is a swap inside an already-open surface, not an arrival. */
.drawer-view[data-active="true"] {
  animation: drawer-view-in var(--duration-instant) var(--ease-settle) both;
}
@keyframes drawer-view-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  /* Per §15: a transition of 0 makes state changes hard to follow, so this
   * keeps the fade and drops the travel rather than removing both. */
  .drawer-view[data-active="true"] { animation: none; }
}

/* --- basin groups ---------------------------------------------------------
 * Real <h2>s so screen-reader users jump by heading. Headers are NOT
 * focusable; Tab hits rows only (SPEC §16). */
.basin-head {
  margin: var(--space-comfy) var(--space-snug) var(--space-tight);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* --- storm rows -----------------------------------------------------------
 * The WHOLE ROW is the hit target, 44px minimum. Category color is the
 * swatch, never the text (SPEC §6). */
.storm-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-base);
  width: 100%;
  min-height: var(--touch-target);
  padding: var(--space-snug) var(--space-snug);
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: opacity var(--duration-instant) var(--ease-swap);
}
@media (hover: hover) { .storm-row:hover { background: var(--glass-raised); } }
.storm-row:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

.row-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 8px var(--swatch);
}

.row-name {
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-meta {
  font-family: var(--font-numeric);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.row-stale {
  color: var(--stale);
  margin-left: var(--space-snug);
  font-size: 0.75rem;
}

/* --- list notes & failure states ----------------------------------------- */
.list-note {
  margin: var(--space-comfy) var(--space-snug);
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
}
.list-error { color: var(--error); }

.retry {
  display: block;
  min-height: var(--touch-target);
  margin: 0 var(--space-snug);
  padding: 0 var(--space-comfy);
  background: var(--glass-raised);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.retry:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* --- the collapsed pill (narrow first-launch, SPEC §16) ------------------- */
#storm-pill {
  position: fixed;
  left: 50%;
  bottom: var(--safe-bottom);
  z-index: 30;
  transform: translateX(-50%);
  min-height: var(--touch-target);
  padding: 0 var(--space-comfy);
  display: flex;
  align-items: center;
  background: var(--glass-raised);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--glass-shadow);
  -webkit-appearance: none;
  appearance: none;
  transition: transform var(--duration-base) var(--ease-settle),
              opacity var(--duration-base) var(--ease-settle);
}
#storm-pill[data-tone="error"] { color: var(--error); }
#storm-pill[data-hidden="true"] {
  opacity: 0;
  transform: translateX(-50%) translateY(12px);
  pointer-events: none;
}
#storm-pill:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Wide: the pill never shows — the rail is open by default and the Storms
 * control reopens it. */
@media (min-width: 720px) {
  #storm-pill { display: none; }
}

/* --- storm detail view (SPEC §16) ------------------------------------------
 * IDENTITY LIVES IN THE DRAWER HEADER, supplied by the view as its title, so
 * there is one header rather than a view header stacked under the drawer's.
 * The timestamp pins directly below it; the body scrolls under both. Category
 * color is the SWATCH, never text color (§6) — a yellow Cat 1 as text on
 * glass fails contrast outright. */

.detail-identity { min-width: 0; }
.detail-name {
  display: flex;
  align-items: center;
  gap: var(--space-snug);
}
.detail-name .drawer-title {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.detail-nature {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 2px;
}

/* The load-bearing element. Pinned with the header; three bands. */
.detail-stamp {
  flex: 0 0 auto;
  padding: var(--space-tight) var(--space-base);
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--glass-border);
}
.detail-stamp[data-band="aging"] { color: var(--stale); }
.detail-stamp[data-band="stale"] { color: var(--error); }
.detail-stamp-geo {
  margin-top: 2px;
  color: var(--stale);
}

.detail-body { padding: 0 0 var(--space-comfy); }

.detail-section { border-bottom: 1px solid var(--glass-border); }
.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: var(--touch-target);
  padding: 0 var(--space-base);
  background: none;
  border: 0;
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}
.detail-section-head h2 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0;
}
.detail-section-head:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
.detail-chevron {
  width: 8px; height: 8px;
  border-right: 1.6px solid var(--text-muted);
  border-bottom: 1.6px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform var(--duration-base) var(--ease-settle);
}
.detail-section[data-collapsed="true"] .detail-chevron { transform: rotate(-45deg); }
.detail-section-body { padding: 0 var(--space-base) var(--space-base); }
.detail-section[data-collapsed="true"] .detail-section-body { display: none; }

.detail-vitals {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-tight) var(--space-base);
  margin: 0;
  font-size: 0.9rem;
}
.detail-vitals dt { color: var(--text-muted); }
.detail-vitals dd {
  margin: 0;
  font-family: var(--font-numeric);
  color: var(--text-primary);
}

.detail-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: var(--space-snug);
}
.detail-kicker:first-child { margin-top: 0; }
.detail-figure {
  font-family: var(--font-numeric);
  font-size: 0.95rem;
  margin-top: 2px;
}
.detail-soft { color: var(--text-muted); font-size: 0.85rem; }
.detail-empty { color: var(--text-muted); font-size: 0.85rem; }

.detail-ww {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-tight);
  font-size: 0.9rem;
}
.detail-ww li { display: flex; align-items: center; gap: var(--space-snug); }

.detail-ghost-note {
  margin: var(--space-base);
  padding: var(--space-snug) var(--space-base);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--stale);
  font-size: 0.85rem;
}

/* Toggle rows: the whole 44px row is the hit target, not just the switch. */
/* --- the switch row (SHARED) ----------------------------------------------
 * Was .detail-toggle / .detail-switch, used once by the storm detail panel.
 * Extracted on its second use (the Layers view) per §12 — any pattern used
 * twice gets extracted BEFORE the second use, rather than copied and left to
 * drift. The whole row is the hit target, not just the switch (§7).
 * ------------------------------------------------------------------------ */

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-snug);
  width: 100%;
  min-height: var(--touch-target);
  padding: 0;
  background: none;
  border: 0;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}
.switch-row:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
.switch-row:disabled { cursor: default; }

.switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 34px; height: 20px;
  border-radius: 999px;
  background: var(--glass-raised);
  border: 1px solid var(--glass-border);
  transition: background var(--duration-base) var(--ease-settle);
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform var(--duration-base) var(--ease-settle);
}
.switch-row[aria-checked="true"] .switch-track { background: var(--focus-ring); }
.switch-row[aria-checked="true"] .switch-track::after {
  transform: translateX(14px);
  background: var(--text-primary);
}

.detail-geo-error {
  margin-top: var(--space-snug);
  color: var(--error);
  font-size: 0.85rem;
}
.detail-retry {
  display: block;
  min-height: var(--touch-target);
  margin-top: var(--space-tight);
  padding: 0 var(--space-base);
  background: var(--glass-raised);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}
.detail-retry:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Short human-written failure detail (never a stack trace) — on a phone this
 * panel is the console. */
.detail-geo-detail {
  margin-top: var(--space-tight);
  font-family: var(--font-numeric);
  font-size: 0.75rem;
  color: var(--text-muted);
  word-break: break-word;
}

/* ---------------------------------------------------------------------------
 * LAYERS VIEW (SPEC §7)
 *
 * Three groups, headers are real <h2>s so screen-reader users jump by
 * heading. Rows are 44px and the WHOLE ROW is the hit target.
 *
 * ROWS DIM, THEY NEVER DISAPPEAR. A layer whose data source has not shipped
 * renders at reduced opacity with its reason as a subtitle — a missing toggle
 * looks like a bug, a dimmed one with a reason is information.
 * ------------------------------------------------------------------------- */

.layer-group { margin-top: var(--space-base); }
.layer-group:first-child { margin-top: var(--space-tight); }

.layer-group-head {
  margin: 0 var(--space-snug) var(--space-tight);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.layer-row {
  padding: 0 var(--space-snug);
}
.layer-row-pair { padding-bottom: var(--space-tight); }

.layer-row-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.layer-row-label {
  font-size: 0.9rem;
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
}
.layer-row-text .layer-row-label { min-height: 0; display: block; }

.layer-row-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}
/* An error outranks a note — a layer that exists and broke is more urgent
 * than one that has not shipped (§5: errors surface near their source). */
.layer-row-toggle[data-tone="error"] .layer-row-sub { color: var(--error); }
.layer-row-toggle[data-tone="loading"] .layer-row-sub { color: var(--text-secondary); }

/* Dimmed, not gone. */
.layer-row-toggle:disabled,
.layer-row-pair[data-usable="false"] { opacity: 0.45; }

.layer-note {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- segmented control ----------------------------------------------------
 * EXCLUSIVE PAIRS ARE SEGMENTED, NEVER TWO SWITCHES (§7). Two switches imply
 * both-on is possible; a segment shows that one is chosen.
 * ------------------------------------------------------------------------ */

.seg-group {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--glass-raised);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}

.seg {
  flex: 1 1 0;
  min-width: 0;
  min-height: 36px;          /* the GROUP clears 44px including its padding */
  padding: 0 var(--space-tight);
  background: none;
  border: 0;
  border-radius: calc(var(--radius) - 3px);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background var(--duration-base) var(--ease-settle),
              color var(--duration-base) var(--ease-settle);
}
.seg[aria-checked="true"] {
  background: var(--glass);
  color: var(--text-primary);
  font-weight: 600;
}
.seg:disabled { opacity: 0.5; cursor: default; }
.seg:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
@media (hover: hover) {
  .seg:not(:disabled):not([aria-checked="true"]):hover { color: var(--text-primary); }
}

.layer-reset-wrap {
  margin-top: var(--space-comfy);
  padding: 0 var(--space-snug);
}
.layer-reset {
  min-height: var(--touch-target);
  width: 100%;
  padding: 0 var(--space-base);
  background: var(--glass-raised);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
/* Disabled rather than hidden when already at defaults — the affordance stays
 * discoverable instead of appearing only once you have changed something. */
.layer-reset:disabled { opacity: 0.4; cursor: default; }
.layer-reset:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* --- the detail view's Layers shortcut ------------------------------------
 * A LINK, NOT A CONTROL SURFACE. It names what is drawn and pushes into the
 * Layers view; no switches live in the detail view (see view-storm-detail.js).
 * ------------------------------------------------------------------------ */

.detail-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-snug);
  width: 100%;
  min-height: var(--touch-target);
  padding: 0;
  background: none;
  border: 0;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.detail-link:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
.detail-link-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.detail-link-label { font-size: 0.9rem; }
.detail-link-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-link-chevron {
  flex: 0 0 auto;
  width: 16px; height: 16px;
  color: var(--text-muted);
}
@media (hover: hover) {
  .detail-link:hover .detail-link-chevron { color: var(--text-primary); }
}

/* --- settings view -------------------------------------------------------- */

.settings-note {
  margin: var(--space-base) var(--space-snug) 0;
  font-size: 0.875rem;
  color: var(--text-primary);
}
.settings-soft { color: var(--text-muted); font-size: 0.82rem; }

/* One setting: its name, its control, and the sentence explaining what the
 * chosen value actually does. The horizontal inset matches .settings-note so
 * the control lines up with the prose beneath it. */
.settings-block {
  margin: var(--space-base) var(--space-snug) 0;
}
.settings-label {
  margin: 0 0 var(--space-tight);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}
/* The block already carries the inset; the note inside it must not add a
 * second one or it would step in from the control above it. */
.settings-block .settings-note {
  margin-left: 0;
  margin-right: 0;
}

/* --- per-model selector (§7 — model tracks expands IN PLACE) --------------
 * Never a second panel: §16 allows one view at a time, so there is no stack
 * to push onto. The rows appear under their parent toggle and disappear with
 * it.
 *
 * THE SWATCH IS THE LEGEND. A separate map key would be a second surface
 * listing the same five models, free to drift from what is actually drawn;
 * here the control and the key are one object and cannot disagree.
 * ------------------------------------------------------------------------ */

.layer-row-wrap { display: block; }

.model-selector {
  /* Indented under its parent and hung off a hairline, so the relationship
   * reads structurally rather than relying on proximity alone. */
  margin: 0 var(--space-snug) var(--space-tight) calc(var(--space-snug) + 10px);
  padding-left: var(--space-snug);
  border-left: 1px solid var(--glass-border);
}

.model-group { margin-top: var(--space-tight); }
.model-group:first-child { margin-top: 0; }

.model-group-head {
  margin: 0;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.model-row {
  display: flex;
  align-items: center;
  gap: var(--space-snug);
  width: 100%;
  /* 44px FLOOR, and it grows with the second line — the WHOLE row is the hit
   * target, not the swatch and not the tick (§7, §10). */
  min-height: var(--touch-target);
  padding: var(--space-tight) var(--space-tight) var(--space-tight) 0;
  background: none;
  border: 0;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.model-row[aria-checked="true"] { color: var(--text-primary); }

/* Never `outline: none` without a replacement (§10). */
.model-row:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
  border-radius: var(--radius);
}

/* Hover is an AFFORDANCE, not a requirement — gated on capability, never on
 * device class, so a touchscreen laptop still gets it and a finger is never
 * asked to hover to discover anything (§10). */
@media (hover: hover) {
  .model-row:hover:not(:disabled) { color: var(--text-primary); }
}

.model-swatch {
  flex: 0 0 auto;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--swatch);
  /* Matches the dashed line on the map: guidance is dashed everywhere, so
   * the key looks like the thing it is keying. */
  opacity: 0.9;
  /* Two-line rows now, so the swatch pins to the NAME's line rather than
   * floating to the vertical centre of a block it does not belong to. */
  margin-top: 7px;
  align-self: flex-start;
}

.model-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.model-label { min-width: 0; }

/* The second line: what sets this model apart. Quieter than the name — it is
 * read once and then ignored, while the name is scanned every time. */
.model-sub {
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-muted);
}

/* The tick. Drawn, not a glyph — a checkmark character renders differently on
 * every platform and at 10px the differences are the whole shape. */
.model-check {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 1px solid var(--glass-border);
  border-radius: 3px;
}
.model-check { align-self: center; }

.model-row[aria-checked="true"] .model-check {
  border-color: var(--focus-ring);
  background: var(--focus-ring);
  /* A tick cut out of the filled box: two borders on a rotated square. */
  clip-path: polygon(14% 44%, 0 58%, 36% 100%, 100% 22%, 86% 8%, 36% 72%);
}

/* The last remaining model cannot be switched off — a layer switched on with
 * nothing selected draws silence (§5). Dimmed, not gone. */
.model-row:disabled { opacity: 0.55; cursor: default; }

/* --- advisory text (§16 item 7) --------------------------------------------
 *
 * The raw teletype product, whole. Fixed at 69 columns upstream, which does
 * not fit a phone — so it SOFT-WRAPS rather than scrolling sideways. A
 * horizontal scroll region inside a vertically scrolling drawer is a gesture
 * fight on a touchscreen and a trap for a keyboard user, and `pre-wrap` keeps
 * every newline and every space the forecaster wrote either way.
 * ------------------------------------------------------------------------ */

.detail-advisory-from {
  margin-bottom: var(--space-tight);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.detail-advisory {
  margin: 0;
  padding: var(--space-snug);
  background: var(--glass-raised);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-numeric);
  /* Small, because a teletype line is long. Not smaller than this: the whole
   * point of the section is that it can be read. */
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* KEYBOARD-REACHABLE ON PURPOSE. The block is `tabindex="0"` so arrow keys
 * can scroll it once focused, which is the only way in without a pointer —
 * and a focusable element with no visible ring is the accessibility bug this
 * project's input rules exist to prevent. */
.detail-advisory:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
