/* ==========================================================================
   Design Lab stage: Tropical (Tropical Cyclone Model Tracks, /v3/tropical/, live file v3/tropical/index.php).
   Shared tokens and glass recipes are in slate.css. The live page and its assets/ are not edited.

   The page is the same shape as the Forecast Viewer (/v3/wx): one white card holding a toolbar, a layers
   column and the map. A few panels float over the map. Every tier gets the same markup (no PHP branches).
     viewer card ............. soft glass pane
     toolbar ................. quiet chips on the pane (selects, Layers, NHC Products), the storm strip is a sheet
     layers column ........... a sheet on the pane on desktop; on phones it is a bottom sheet over the page,
                               so it takes the near-solid menu colour
     over the map ............ smoked glass, no blur (legend, time bar, intensity chart, forecast weather
                               window, loading note, Show model tracks button, zoom buttons, attribution)
     plates on the map ....... storm name tags, NHC forecast callouts, arrival-time labels and popups move with
                               the map: a solid dark plate, no blur, readable over the light and the dark basemap
     NHC products drawer ..... near-solid menu colour (it slides over the page), blocks inside are sheets
     the map ................. untouched: basemap (light, or dark with the page's own Dark map switch), track
                               colours, cone, wind and watch/warning colours, track labels and their halo,
                               the D/S/H/M codes, SST imagery and every colour bar
     intensity chart ......... the drawing keeps a light (paper) ground: the model line colours (near-black
                               best track, navy consensus, purple UKMET) were picked for white and vanish on slate
   ========================================================================== */

html.stage[data-stage="tropical"]{
  --tr-chip:rgba(255,255,255,.06);          /* a control on the pane */
  --tr-chip-hover:rgba(255,255,255,.12);
  --tr-chip-line:rgba(255,255,255,.16);
  --tr-chip-line-hover:rgba(255,255,255,.3);
  --tr-on:rgba(110,231,183,.14);            /* selected tab / pressed toggle */
  --tr-on-line:rgba(110,231,183,.45);
  --tr-smoke-line:rgba(255,255,255,.2);
  --tr-smoke-shadow:0 10px 30px rgba(0,0,0,.45);
  --tr-plate:#1a2334;                       /* solid plate for things that move with the map */
  --tr-plate-line:rgba(255,255,255,.22);
}

/* Small labels on this page are written in var(--display). On the stage that is the headline serif, which
   is for headlines only; the page has no headline, so inside the viewer it points back at the sans. */
html.stage[data-stage="tropical"] .trop{--display:"Plus Jakarta Sans",system-ui,-apple-system,"Segoe UI",sans-serif}

/* ---------- size: fill the window under the new nav ----------
   Live: map and layers column are clamp(420px, 100vh - 280px, 840px); 280px = the live header (about 106px
   with its margins) plus the card chrome and some room below. The stage nav is var(--navh) tall and this
   page adds 8px under it, so the same room is 100vh - navh - 202px (100vh - 288px with the desktop nav).
   The width follows the map height exactly as live. Phones (760px and under) keep the live sizes. */
html.stage[data-stage="tropical"] .tropical-page{padding-top:8px}
@media (min-width:761px){
  html.stage[data-stage="tropical"] .tropical-page{max-width:min(1800px, calc(100% - 32px), max(1560px, calc((100vh - var(--navh) - 202px) * 1.9 + 286px)))}
  html.stage[data-stage="tropical"] .map-stage{height:clamp(420px, calc(100vh - var(--navh) - 202px), 840px)}
  html.stage[data-stage="tropical"] #sidebar{max-height:clamp(420px, calc(100vh - var(--navh) - 202px), 840px)}
}

/* ---------- the viewer card ---------- */
html.stage[data-stage="tropical"] .viewer-card{background:var(--glass-bg);border-color:var(--glass-border);box-shadow:var(--glass-shadow);color:var(--sg-ink)}

/* ---------- controls on the pane: one family of quiet chips ---------- */
html.stage[data-stage="tropical"] .trop button,
html.stage[data-stage="tropical"] .trop .pill,
html.stage[data-stage="tropical"] .trop select{background-color:var(--tr-chip);border-color:var(--tr-chip-line);color:var(--sg-ink)}
html.stage[data-stage="tropical"] .trop button:hover,
html.stage[data-stage="tropical"] .trop .pill:hover,
html.stage[data-stage="tropical"] .trop select:hover{background-color:var(--tr-chip-hover);border-color:var(--tr-chip-line-hover);color:#fff}
html.stage[data-stage="tropical"] .trop button:active{background-color:rgba(255,255,255,.16)}
html.stage[data-stage="tropical"] .trop select option{background:#131c2e;color:#f8fafc}
/* focus ring: white, the live green ring is too dark on slate */
html.stage[data-stage="tropical"] .trop button:focus-visible,
html.stage[data-stage="tropical"] .trop select:focus-visible,
html.stage[data-stage="tropical"] .trop input:focus-visible{outline-color:#fff}

/* storm facts beside the menus */
html.stage[data-stage="tropical"] #storm-meta{color:var(--sg-muted)}
html.stage[data-stage="tropical"] #storm-meta b{color:var(--sg-ink)}
html.stage[data-stage="tropical"] .tag.live{background:var(--tr-on);color:#6ee7b7}
html.stage[data-stage="tropical"] .tag.old{background:rgba(255,255,255,.1);color:var(--sg-muted)}

/* current conditions strip: a sheet on the pane; the Cat badge a neutral chip */
html.stage[data-stage="tropical"] #storm-now{background:var(--sheet-bg);border-color:var(--sheet-border);box-shadow:var(--sheet-shadow);color:var(--sg-ink)}
html.stage[data-stage="tropical"] .now-name .cat{background:rgba(255,255,255,.1);border-color:var(--sg-line2);color:var(--sg-ink)}
html.stage[data-stage="tropical"] .now-facts i,
html.stage[data-stage="tropical"] .now-facts u{color:var(--sg-muted)}

/* ---------- layers column: a sheet on the pane ---------- */
html.stage[data-stage="tropical"] #sidebar{background:var(--sheet-bg);border-color:var(--sheet-border);box-shadow:var(--sheet-shadow);color:var(--sg-ink)}
html.stage[data-stage="tropical"] .panel-head h2,
html.stage[data-stage="tropical"] .fam-group h3{color:var(--sg-muted)}
html.stage[data-stage="tropical"] .trop .mini button{background:transparent;border-color:transparent;color:var(--sg-muted)}
html.stage[data-stage="tropical"] .trop .mini button:hover{background:rgba(255,255,255,.09);border-color:transparent;color:#fff}
html.stage[data-stage="tropical"] .fam:hover,
html.stage[data-stage="tropical"] .opt:hover{background:rgba(255,255,255,.08)}
html.stage[data-stage="tropical"] .fam.empty:hover{background:none}
/* live .55 left the "no data this run" note near 3:1 on the sheet; .7 keeps the dimmed look at 4.5:1 */
html.stage[data-stage="tropical"] .fam.empty{opacity:.7}
html.stage[data-stage="tropical"] .fam input,
html.stage[data-stage="tropical"] .opt input{accent-color:#10b981}
html.stage[data-stage="tropical"] .fam-n,
html.stage[data-stage="tropical"] .fam-why,
html.stage[data-stage="tropical"] .opt-sub,
html.stage[data-stage="tropical"] .hint{color:var(--sg-muted)}
/* The family swatches are data colours chosen for white (best track is near black). A faint light ring
   keeps the dark ones findable without changing the colour. Same for the legend and chart readout swatches. */
html.stage[data-stage="tropical"] .swatch,
html.stage[data-stage="tropical"] .leg-sw,
html.stage[data-stage="tropical"] .leg-box,
html.stage[data-stage="tropical"] #int-read i{box-shadow:0 0 0 1px rgba(255,255,255,.22)}
/* rust text on dark (the "stale" date note) */
html.stage[data-stage="tropical"] .stale{color:#f0a58c}

/* wind probability Off | 34 | 50 | 64: a well with the raised pill */
html.stage[data-stage="tropical"] .wsp-seg{background:var(--well-bg);border-color:transparent;box-shadow:var(--well-shadow)}
html.stage[data-stage="tropical"] .wsp-seg span{color:var(--sg-soft)}
html.stage[data-stage="tropical"] .wsp-seg label:hover span{color:#fff}
html.stage[data-stage="tropical"] .wsp-seg label + label span{border-left-color:rgba(255,255,255,.1)}
html.stage[data-stage="tropical"] .wsp-seg input:checked + span{background:var(--pill-bg);box-shadow:var(--pill-shadow);color:#fff}
html.stage[data-stage="tropical"] .wsp-seg input:focus-visible + span{outline-color:#fff}

/* phones: the column becomes a bottom sheet over the page and the map, so it is near solid */
@media (max-width:760px){
  html.stage[data-stage="tropical"] #sidebar{background:var(--menu-bg);border-color:var(--menu-border);box-shadow:var(--menu-shadow)}
  html.stage[data-stage="tropical"] .trop .sheet-grip{background:rgba(255,255,255,.3)}
  html.stage[data-stage="tropical"] .trop .sheet-close{background:transparent;border-color:transparent;color:var(--sg-muted)}
  html.stage[data-stage="tropical"] .trop .sheet-close:hover{background:rgba(255,255,255,.09);color:#fff}
}
html.stage[data-stage="tropical"] #scrim{background:rgba(2,6,23,.6)}

/* ---------- map frame ---------- */
html.stage[data-stage="tropical"] .map-stage{border-color:var(--sg-line);background:var(--night2)}

/* ---------- over the map: smoked glass, no blur ----------
   body + id: the live light-glass rule is body:not(.dark) #legend (and the time bar, loading note). */
html.stage[data-stage="tropical"] body #legend,
html.stage[data-stage="tropical"] body #timebar,
html.stage[data-stage="tropical"] body #loading,
html.stage[data-stage="tropical"] body #intensity,
html.stage[data-stage="tropical"] body #wx{background:var(--smoke-bg);-webkit-backdrop-filter:none;backdrop-filter:none;border-color:var(--tr-smoke-line);box-shadow:inset 0 1px 0 rgba(255,255,255,.14),var(--tr-smoke-shadow);color:var(--sg-ink)}
/* body + id like the rule above, or the ink colour there would win */
html.stage[data-stage="tropical"] body #loading{color:var(--sg-soft)}

/* legend: only the box and the words; swatches, dots, ramps and the SST bar are data */
html.stage[data-stage="tropical"] #legend h3,
html.stage[data-stage="tropical"] .ocean-ticks,
html.stage[data-stage="tropical"] .leg-ramp-ends{color:var(--sg-muted)}
html.stage[data-stage="tropical"] .ocean-bar{border-color:rgba(255,255,255,.2)}

/* time bar */
html.stage[data-stage="tropical"] .lbl,
html.stage[data-stage="tropical"] #lead-label{color:var(--sg-muted)}
html.stage[data-stage="tropical"] #lead-label{font-variant-numeric:tabular-nums}
html.stage[data-stage="tropical"] #lead-label b{color:var(--sg-ink)}
html.stage[data-stage="tropical"] #lead{accent-color:#34d399}
html.stage[data-stage="tropical"] #play{color:#6ee7b7}
html.stage[data-stage="tropical"] #play.on,
html.stage[data-stage="tropical"] #play.on:hover{background:#047857;border-color:#047857;color:#fff}   /* playing: the live solid green, as on /v3/wx */
html.stage[data-stage="tropical"] #loopbtn.on,
html.stage[data-stage="tropical"] #loopbtn.on:hover{background:var(--tr-on);border-color:var(--tr-on-line);color:#6ee7b7}

/* Show model tracks: floats over the map where the time bar will appear */
html.stage[data-stage="tropical"] .trop #btn-tracks{background:var(--smoke-bg);border-color:var(--tr-smoke-line);box-shadow:inset 0 1px 0 rgba(255,255,255,.14),var(--tr-smoke-shadow);color:#fff}
html.stage[data-stage="tropical"] .trop #btn-tracks:hover{background:linear-gradient(180deg,rgba(255,255,255,.1),rgba(255,255,255,.1)),var(--smoke-bg);border-color:rgba(255,255,255,.34)}

/* intensity chart window */
html.stage[data-stage="tropical"] .int-head h2{color:var(--sg-muted)}
html.stage[data-stage="tropical"] .trop .int-tabs button,
html.stage[data-stage="tropical"] .trop .int-x{background:transparent;border-color:transparent;color:var(--sg-muted)}
html.stage[data-stage="tropical"] .trop .int-tabs button:hover,
html.stage[data-stage="tropical"] .trop .int-x:hover{background:rgba(255,255,255,.09);color:#fff}
html.stage[data-stage="tropical"] .trop .int-tabs button.on,
html.stage[data-stage="tropical"] .trop .int-tabs button.on:hover{background:var(--tr-on);border-color:var(--tr-on-line);color:#6ee7b7}
/* The drawing itself keeps a light ground (see the header). Paper, not white; the grid and axis inks go back
   to the live light-page values so they read on it. No padding: app.js sizes the drawing from this box. */
html.stage[data-stage="tropical"] #int-plot{background:var(--paper);border-radius:8px;overflow:hidden}
html.stage[data-stage="tropical"] #int-plot .int-grid{stroke:#d5d9df}
html.stage[data-stage="tropical"] #int-plot .int-ax{fill:#475569}
html.stage[data-stage="tropical"] #int-plot .int-band{fill:#475569}
html.stage[data-stage="tropical"] #int-plot .int-cursor{stroke:#047857}
html.stage[data-stage="tropical"] #int-plot .int-empty{color:#475569}
html.stage[data-stage="tropical"] #int-read{color:var(--sg-muted)}
html.stage[data-stage="tropical"] #int-read b,
html.stage[data-stage="tropical"] .int-at{color:var(--sg-ink)}

/* forecast weather window (its little map and colour bar are data) */
html.stage[data-stage="tropical"] .wx-head h2,
html.stage[data-stage="tropical"] .wx-leg-label,
html.stage[data-stage="tropical"] .wx-leg-ticks{color:var(--sg-muted)}
html.stage[data-stage="tropical"] .wx-run{color:var(--sg-ink)}
html.stage[data-stage="tropical"] .trop .wx-models button,
html.stage[data-stage="tropical"] .trop .wx-x,
html.stage[data-stage="tropical"] .trop .wx-globe{background:transparent;border-color:transparent;color:var(--sg-muted)}
html.stage[data-stage="tropical"] .trop .wx-models button:hover,
html.stage[data-stage="tropical"] .trop .wx-x:hover,
html.stage[data-stage="tropical"] .trop .wx-globe:hover{background:rgba(255,255,255,.09);color:#fff}
html.stage[data-stage="tropical"] .trop .wx-models button.on,
html.stage[data-stage="tropical"] .trop .wx-models button.on:hover,
html.stage[data-stage="tropical"] .trop .wx-globe.on{background:var(--tr-on);border-color:var(--tr-on-line);color:#6ee7b7}
html.stage[data-stage="tropical"] .trop #wx-var{background-color:var(--well-bg);border-color:var(--sg-line2);color:var(--sg-ink)}
html.stage[data-stage="tropical"] .wx-map{background:var(--night2)}
html.stage[data-stage="tropical"] .wx-note{background:var(--tr-plate);border-color:var(--tr-plate-line);box-shadow:var(--tr-smoke-shadow);color:var(--sg-soft)}
html.stage[data-stage="tropical"] .wx-leg-bar{border-color:rgba(255,255,255,.2)}

/* ---------- map buttons (zoom, recenter) and the "i" attribution pill ----------
   Same smoke as /v3/wx, in light and dark map alike. MapLibre's glyphs are dark images: inverted, then
   hue-rotated so the compass's red north stays red. Covers the forecast weather window's small map too
   (live, the page's own button rule gave those buttons a white chip; here they are clear on the smoke). */
html.stage[data-stage="tropical"] .trop #map .maplibregl-ctrl-group,
html.stage[data-stage="tropical"] .trop #wx .maplibregl-ctrl-group{background:var(--smoke-bg);-webkit-backdrop-filter:none;backdrop-filter:none;border-color:var(--tr-smoke-line);box-shadow:0 6px 18px rgba(0,0,0,.4)}
html.stage[data-stage="tropical"] .trop #map .maplibregl-ctrl-group button,
html.stage[data-stage="tropical"] .trop #wx .maplibregl-ctrl-group button{background:transparent;border-color:transparent}
html.stage[data-stage="tropical"] .trop #map .maplibregl-ctrl-group button + button,
html.stage[data-stage="tropical"] .trop #wx .maplibregl-ctrl-group button + button{border-top-color:rgba(255,255,255,.1)}
html.stage[data-stage="tropical"] .trop #map .maplibregl-ctrl-group button:hover,
html.stage[data-stage="tropical"] .trop #wx .maplibregl-ctrl-group button:hover{background:rgba(255,255,255,.12)}
html.stage[data-stage="tropical"] .trop #map .maplibregl-ctrl-group button .maplibregl-ctrl-icon,
html.stage[data-stage="tropical"] .trop #wx .maplibregl-ctrl-group button .maplibregl-ctrl-icon,
html.stage[data-stage="tropical"] .trop #map .maplibregl-ctrl-attrib-button,
html.stage[data-stage="tropical"] .trop #wx .maplibregl-ctrl-attrib-button{filter:invert(.92) hue-rotate(180deg)}
html.stage[data-stage="tropical"] .trop #map .trop-recenter-btn i{color:var(--sg-soft)}
html.stage[data-stage="tropical"] .trop #map .trop-recenter-btn:hover i{color:#fff}
/* !important: the live rules set this background with !important */
html.stage[data-stage="tropical"] .trop #map .maplibregl-ctrl-attrib,
html.stage[data-stage="tropical"] .trop #wx .maplibregl-ctrl-attrib{background:var(--smoke-bg) !important;-webkit-backdrop-filter:none;backdrop-filter:none;border-color:var(--tr-smoke-line);color:var(--sg-soft)}
html.stage[data-stage="tropical"] .trop #map .maplibregl-ctrl-attrib a,
html.stage[data-stage="tropical"] .trop #wx .maplibregl-ctrl-attrib a{color:var(--sg-ink)}

/* ---------- plates that move with the map: solid dark, no blur ----------
   Live they are white cards built on var(--card), which the stage turns into a faint see-through white;
   light text on that over the light basemap would vanish. */
html.stage[data-stage="tropical"] .storm-tag,
html.stage[data-stage="tropical"] .nhc-callout,
html.stage[data-stage="tropical"] .toa-label{background:var(--tr-plate);border-color:var(--tr-plate-line);box-shadow:0 4px 12px rgba(0,0,0,.35);color:var(--sg-muted)}
html.stage[data-stage="tropical"] .nhc-callout::before{background:var(--tr-plate);border-color:var(--tr-plate-line)}
html.stage[data-stage="tropical"] .nhc-callout.right::before{border-top-color:transparent;border-right-color:transparent}
html.stage[data-stage="tropical"] .nhc-callout.left::before{border-left-color:transparent;border-bottom-color:transparent}
html.stage[data-stage="tropical"] .nhc-callout b,
html.stage[data-stage="tropical"] .storm-tag b{color:var(--sg-ink)}
html.stage[data-stage="tropical"] .storm-tag i{color:var(--sg-muted)}
html.stage[data-stage="tropical"] .toa-label{color:var(--sg-ink)}
html.stage[data-stage="tropical"] .toa-label.earliest{color:var(--sg-muted)}
html.stage[data-stage="tropical"] .storm-tag.hover{border-color:rgba(255,255,255,.5);box-shadow:0 8px 20px rgba(0,0,0,.45)}
html.stage[data-stage="tropical"] .storm-tag.sel{border-color:#6ee7b7}
html.stage[data-stage="tropical"] .storm-tag.sel b{color:#6ee7b7}

/* popups (track point, outlook area, NHC layer readouts). The tip colour is set with !important live. */
html.stage[data-stage="tropical"] .maplibregl-popup-content{background:var(--tr-plate);border-color:var(--tr-plate-line);box-shadow:0 8px 22px rgba(0,0,0,.45);color:var(--sg-soft)}
html.stage[data-stage="tropical"] .maplibregl-popup-content b{color:var(--sg-ink)}
html.stage[data-stage="tropical"] .maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
html.stage[data-stage="tropical"] .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
html.stage[data-stage="tropical"] .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{border-top-color:var(--tr-plate) !important}
html.stage[data-stage="tropical"] .maplibregl-popup-anchor-top .maplibregl-popup-tip,
html.stage[data-stage="tropical"] .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
html.stage[data-stage="tropical"] .maplibregl-popup-anchor-top-right .maplibregl-popup-tip{border-bottom-color:var(--tr-plate)}
html.stage[data-stage="tropical"] .maplibregl-popup-anchor-left .maplibregl-popup-tip{border-right-color:var(--tr-plate)}
html.stage[data-stage="tropical"] .maplibregl-popup-anchor-right .maplibregl-popup-tip{border-left-color:var(--tr-plate)}
/* the anchors that are not "bottom" also inherit the live top-colour rule, which would draw a second
   (wrong-side) wedge in the translucent card colour; clear it */
html.stage[data-stage="tropical"] .maplibregl-popup-anchor-top .maplibregl-popup-tip,
html.stage[data-stage="tropical"] .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
html.stage[data-stage="tropical"] .maplibregl-popup-anchor-top-right .maplibregl-popup-tip,
html.stage[data-stage="tropical"] .maplibregl-popup-anchor-left .maplibregl-popup-tip,
html.stage[data-stage="tropical"] .maplibregl-popup-anchor-right .maplibregl-popup-tip{border-top-color:transparent !important}

/* ---------- NHC products drawer: slides over the page, near solid ---------- */
html.stage[data-stage="tropical"] .drawer{background:var(--menu-bg);border-left-color:var(--menu-border);box-shadow:var(--menu-shadow);color:var(--sg-ink)}
/* sticky head: a solid colour equal to the top of the drawer, so content scrolling under it does not show */
html.stage[data-stage="tropical"] .drawer-head{background:rgb(38,47,62);border-bottom-color:var(--sg-line)}
html.stage[data-stage="tropical"] .drawer-head h2{color:var(--sg-ink)}
html.stage[data-stage="tropical"] #products-close{background:transparent;border-color:transparent;color:var(--sg-muted)}
html.stage[data-stage="tropical"] #products-close:hover{background:rgba(255,255,255,.09);color:#fff}
html.stage[data-stage="tropical"] #products-body h3,
html.stage[data-stage="tropical"] .stat .k,
html.stage[data-stage="tropical"] .plink .sub,
html.stage[data-stage="tropical"] .empty-note{color:var(--sg-muted)}
html.stage[data-stage="tropical"] .stat,
html.stage[data-stage="tropical"] .plink{background:var(--sheet-bg);border-color:var(--sheet-border);color:var(--sg-ink)}
html.stage[data-stage="tropical"] a.plink:hover{background:rgba(255,255,255,.12);border-color:rgba(255,255,255,.3);color:#fff}
html.stage[data-stage="tropical"] div.plink:hover{background:var(--sheet-bg);border-color:var(--sheet-border)}
html.stage[data-stage="tropical"] .gis-links a{background:var(--tr-chip);border-color:var(--tr-chip-line);color:#6ee7b7;transition:background-color .2s ease}
html.stage[data-stage="tropical"] .gis-links a:hover{background:var(--tr-chip-hover);border-color:var(--tr-chip-line-hover);color:#fff}
/* "Show on map" on: the live solid green with white text (5.5:1) */
html.stage[data-stage="tropical"] .trop button.onmap.on{background:#047857;border-color:#047857;color:#fff}
