/* ==========================================================================
   Design Lab stage: Models (the Forecast Viewer, /v3/wx/).
   Shared tokens and glass recipes are in slate.css. The live page is not edited.

   On the live page the bar and the variable list sit in a white card above and beside the map;
   only a few things actually float over the map. So:
     viewer card ............. soft glass pane (like every card on the stage)
     bar controls ............ quiet chips on the pane, light text; mint for "go" (play, progress)
     variable sidebar ........ a sheet on the pane
     colour bar strip ........ a sheet; the colour bar canvas itself keeps its live off-white ground
     things over the map ..... smoked glass, mostly opaque, no blur (settings, notes, overlay legend,
                               map buttons, menus, the help card, the Pro box)
     the map ................. untouched: weather layers, globe space and glow, town value labels,
                               the hover readout (already dark on the live page)
   Nothing here gets backdrop-filter. The live map buttons had a blur; it is removed, the smoke is
   opaque enough without it and the map animates underneath.
   ========================================================================== */

html.stage{
  --wx-chip:rgba(255,255,255,.06);          /* a control on the pane */
  --wx-chip-hover:rgba(255,255,255,.12);
  --wx-chip-line:rgba(255,255,255,.16);
  --wx-chip-line-hover:rgba(255,255,255,.3);
  --wx-go:#34d399;                          /* slider progress and thumb */
  --wx-on:rgba(110,231,183,.14);            /* selected row / pressed toggle */
  --wx-smoke-line:rgba(255,255,255,.2);
  --wx-smoke-shadow:0 18px 40px rgba(0,0,0,.5);
}

/* ---------- size: fill the window under the new nav ----------
   Live: the map is clamp(400px, 100vh - 256px, 840px), where 256px is the live header (16 + 74 + 16)
   plus the card padding, the bar row and the colour bar strip. The stage nav is var(--navh) tall and
   the gap under its pill is 8px of its own height + 8px here, so the chrome around the map is
   var(--navh) + 8 + 1 + 16 + 56 (bar row) + 48 (colour bar strip) + 18 + 1 = navh + 148.
   The extra 48px keeps the bottom of the card clear of the preview strip (bottom left, 14px up).
   The page width follows the map height exactly as on the live page (1.9:1 map + 308px of chrome).
   Phones and tablets (820px and under) keep the live sizes, which do not depend on the header. */
@media (min-width:821px){
  html.stage .viewer-page{
    padding-top:8px;
    max-width:min(1800px, calc(100% - 32px), max(1560px, calc((100vh - var(--navh) - 196px) * 1.9 + 308px)));
  }
  html.stage .map-pane{height:clamp(400px, calc(100vh - var(--navh) - 196px), 840px)}
}
@media (max-width:820px){
  html.stage .viewer-page{padding-top:4px}
}

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

/* ---------- bar: one family of quiet chips ---------- */
html.stage .pill,
html.stage .viewer-pillbar .model-dropdown__toggle,
html.stage .viewer-pillbar .frame-viewer-playback,
html.stage .viewer-pillbar .fw-meta,
html.stage .run-dropdown .model-dropdown__toggle{
  background:var(--wx-chip);border-color:var(--wx-chip-line);box-shadow:none;color:var(--sg-ink)}
html.stage .pill:hover,
html.stage .viewer-pillbar .model-dropdown__toggle:hover,
html.stage .viewer-pillbar .model-dropdown__toggle[aria-expanded="true"],
html.stage .run-dropdown .model-dropdown__toggle:hover,
html.stage .run-dropdown .model-dropdown__toggle[aria-expanded="true"]{
  background:var(--wx-chip-hover);border-color:var(--wx-chip-line-hover);box-shadow:none;color:#fff}
html.stage .viewer-pillbar .model-dropdown__label{color:var(--sg-ink)}
html.stage .model-dropdown__icon,
html.stage .region-btn__chev,
html.stage .run-dropdown .model-dropdown__icon{color:var(--sg-muted)}
html.stage .model-dropdown__toggle:hover .model-dropdown__icon,
html.stage .run-dropdown .model-dropdown__toggle:hover .model-dropdown__icon{color:#fff}
html.stage .pill-icon,html.stage .viewer-pillbar .pill-icon{color:var(--sg-soft)}
html.stage .pill-icon:hover{color:#fff}

/* Flat map pressed: the quiet mint version of the live green tint. The strike's halo is the pill's
   own colour over the pane, worked out as a solid (mint 14% over about rgb(41,50,65)). */
html.stage #globe-pill[aria-pressed="true"],
html.stage #globe-pill[aria-pressed="true"]:hover{background:var(--wx-on);border-color:rgba(110,231,183,.6);color:#6ee7b7;box-shadow:inset 0 0 0 1px rgba(110,231,183,.6)}
html.stage #globe-pill[aria-pressed="true"]::after,
html.stage #globe-pill[aria-pressed="true"]:hover::after{box-shadow:0 0 0 1.5px rgb(51,75,81)}

/* transport: mint icons; playing = the live solid green with white */
html.stage .frame-viewer-btn{color:#6ee7b7}
html.stage .frame-viewer-btn:hover{background:rgba(255,255,255,.1);color:#fff}
html.stage .frame-viewer-btn:active{background:rgba(255,255,255,.16)}
html.stage .frame-viewer-btn--play,
html.stage .frame-viewer-btn--play:hover{background:var(--wx-on);color:#6ee7b7}
html.stage .frame-viewer-btn--play.playing,
html.stage .frame-viewer-btn--play.playing:hover{background:#047857;color:#fff}

/* forecast hour chip (F+000 keeps its live min-width and tabular figures, so it never jumps) */
html.stage .tb-fh{color:var(--sg-ink)}
html.stage .viewer-card .tb-time,
html.stage .viewer-card.sidebar-collapsed .tb-time{color:var(--sg-muted)}

/* slider: white-alpha track, mint progress, mint thumb with a light ring (the live shape) */
html.stage #time-slider::-webkit-slider-runnable-track{background:linear-gradient(to right, var(--wx-go) var(--fill, 0%), rgba(255,255,255,.16) var(--fill, 0%))}
html.stage #time-slider::-moz-range-track{background:rgba(255,255,255,.16)}
html.stage #time-slider::-moz-range-progress{background:var(--wx-go)}
html.stage #time-slider::-webkit-slider-thumb{background:var(--wx-go);border-color:#f8fafc;box-shadow:0 1px 4px rgba(0,0,0,.5)}
html.stage #time-slider::-moz-range-thumb{background:var(--wx-go);border-color:#f8fafc;box-shadow:0 1px 4px rgba(0,0,0,.5)}
html.stage .tb-now{border-left-color:#6ee7b7}

/* day guides under the slider */
html.stage .tb-days .tb-day-tick{border-left-color:rgba(255,255,255,.3)}
html.stage .tb-days .tb-day-label{color:var(--sg-muted)}
html.stage .tb-days .tb-day-tick.is-minor{border-left-color:rgba(255,255,255,.16)}
html.stage .tb-days .tb-day-label.is-minor{color:#a9b6c8}
/* valid-time bubble above the thumb */
html.stage .tb-float{background:var(--smoke-bg);border-color:var(--wx-smoke-line);box-shadow:0 6px 16px rgba(0,0,0,.45);color:var(--sg-ink)}
/* drawn slider (.tb-rail, see "Slider rail" in wx/style.css): same colours as the native one above.
   Hover brightens the bar inside its own shape; held, the core and the fill go one mint lighter. No rings, no glow. */
html.stage .tb-rail__track{background:rgba(255,255,255,.16)}
html.stage .has-rail.is-hot .tb-rail__track{background:rgba(255,255,255,.23)}
html.stage .tb-rail__fill{background:var(--wx-go)}
html.stage .tb-rail__thumb{--tb-ring:#f8fafc;--tb-core-c:var(--wx-go);box-shadow:0 1px 4px rgba(0,0,0,.5)}
html.stage .has-rail.is-thumb-hot .tb-rail__thumb{box-shadow:0 2px 8px rgba(0,0,0,.55)}
html.stage .has-rail.is-held .tb-rail__thumb{--tb-core-c:#6ee7b7;box-shadow:0 1px 3px rgba(0,0,0,.6)}
html.stage .has-rail.is-held .tb-rail__fill{background:#6ee7b7}
html.stage .tb-rail__ghost{background:#f8fafc;box-shadow:0 0 0 1px rgba(11,18,32,.3)}
html.stage .has-rail #time-slider:focus-visible ~ .tb-rail .tb-rail__thumb{outline-color:#6ee7b7}

/* ---------- menus: smoked (they pass over the map) ---------- */
html.stage .model-dropdown__menu{background:var(--smoke-bg);border-color:var(--wx-smoke-line);box-shadow:var(--wx-smoke-shadow);color:var(--sg-ink)}
html.stage .model-dropdown__item{color:var(--sg-ink);border-bottom-color:rgba(255,255,255,.07)}
html.stage .model-dropdown__item:hover{background:rgba(255,255,255,.09);color:#fff}
html.stage .model-dropdown__item--active,
html.stage .model-dropdown__item--active:hover{background:var(--wx-on);color:#6ee7b7;font-weight:600}
html.stage .model-dropdown__group-header,
html.stage .model-dropdown__menu--columns .model-dropdown__group-header{background:none;color:var(--sg-muted);border-color:var(--sg-line)}
html.stage .model-dropdown__group:not(:first-child) .model-dropdown__group-header,
html.stage .model-dropdown__group-header:not(:first-child){border-top-color:var(--sg-line)}
html.stage .model-dropdown__col + .model-dropdown__col{border-color:var(--sg-line)}
/* Pro-locked rows (signed-out and free visitors): dimmed name, rust badge as live */
html.stage .model-dropdown__item--pro{color:var(--sg-muted)}
html.stage .model-dropdown__item--pro:hover{background:rgba(185,79,53,.18);color:#f0a58c}
html.stage .bar-more__item > .fas:first-child{color:#6ee7b7}

/* ---------- variable sidebar: a sheet on the pane ---------- */
html.stage .wx-sidebar{background:var(--sheet-bg);border-color:var(--sheet-border);box-shadow:var(--sheet-shadow)}
html.stage .wx-sidebar__head{border-bottom-color:var(--sg-line)}
html.stage .vt-title,html.stage .vt-valid{color:var(--sg-ink)}
html.stage .vt-run,html.stage .wx-sidebar__run-age{color:var(--sg-muted)}
html.stage .wx-sidebar__collapse{background:transparent;border-color:var(--wx-chip-line);color:var(--sg-muted)}
html.stage .wx-sidebar__collapse:hover{background:var(--wx-on);border-color:rgba(110,231,183,.5);color:#6ee7b7}
html.stage .wx-sidebar__group-toggle{background:rgba(255,255,255,.035);color:var(--sg-muted);border-bottom-color:rgba(255,255,255,.07)}
html.stage .wx-sidebar__group-toggle:hover{background:rgba(255,255,255,.08);color:#fff}
html.stage .wx-sidebar__group.is-open .wx-sidebar__group-toggle{color:#6ee7b7}
html.stage .wx-sidebar__chevron{color:#6ee7b7}
html.stage .wx-sidebar__item{color:var(--sg-soft);border-bottom-color:rgba(255,255,255,.05)}
html.stage .wx-sidebar__item:hover{background:rgba(255,255,255,.08);color:#fff}
html.stage .wx-sidebar__item--active,
html.stage .wx-sidebar__item--active:hover{background:var(--wx-on);color:#6ee7b7;border-left-color:#6ee7b7}
html.stage .wx-sidebar__item--pro{color:var(--sg-muted)}
html.stage .wx-sidebar__item--pro:hover{background:rgba(185,79,53,.18);color:#f0a58c}
/* collapsed rail */
html.stage .wx-sidebar__expand{background:transparent;color:#6ee7b7}
html.stage .wx-sidebar__expand:hover{background:rgba(255,255,255,.07)}
html.stage .wx-sidebar__expand-label{color:var(--sg-muted)}

/* ---------- map pane frame ----------
   Only the frame and the empty ground before tiles arrive. In globe mode the live space colour
   (.map-pane.globe-mode) is part of the map and is left alone. */
html.stage .map-pane{border-color:var(--sg-line)}
html.stage .map-pane:not(.globe-mode){background-color:var(--night2)}

/* first-paint splash: solid, as live (translucency let tile fade-in show through), on the dark ground */
html.stage #splash{background:var(--night)}
html.stage .splash-card,html.stage .splash-title{color:var(--sg-ink)}
html.stage .splash-sub{color:var(--sg-muted)}
html.stage .splash-logo{border-color:rgba(255,255,255,.16);border-top-color:#6ee7b7}

/* thin loading bar along the top of the map */
html.stage .loader .bar{background:var(--wx-go)}

/* ---------- over the map: smoked glass, no blur ---------- */
/* map buttons (zoom, compass, CONUS, my location) and the "i" attribution pill.
   MapLibre's glyphs are dark images: inverted, then hue-rotated so the compass's red north stays red. */
html.stage .map-pane .maplibregl-ctrl-group{background:var(--smoke-bg);-webkit-backdrop-filter:none;backdrop-filter:none;border-color:var(--wx-smoke-line);box-shadow:0 6px 18px rgba(0,0,0,.4)}
html.stage .map-pane .maplibregl-ctrl-group button + button{border-top-color:rgba(255,255,255,.1)}
html.stage .map-pane .maplibregl-ctrl-group button:hover{background:rgba(255,255,255,.12)}
html.stage .map-pane .maplibregl-ctrl-group button .maplibregl-ctrl-icon,
html.stage .map-pane .maplibregl-ctrl-attrib-button{filter:invert(.92) hue-rotate(180deg)}
html.stage .map-pane .conus-ctrl-btn i{color:var(--sg-soft)}
html.stage .map-pane .conus-ctrl-btn:hover i{color:#fff}
/* !important: the live rule sets this background with !important */
html.stage .map-pane .maplibregl-ctrl-attrib{background:var(--smoke-bg) !important;-webkit-backdrop-filter:none;backdrop-filter:none;border-color:var(--wx-smoke-line);color:var(--sg-soft)}
html.stage .map-pane .maplibregl-ctrl-attrib a{color:var(--sg-ink)}

/* settings popover */
html.stage .ctl-popover{background:var(--smoke-bg);border-color:var(--wx-smoke-line);box-shadow:var(--wx-smoke-shadow);color:var(--sg-ink)}
html.stage .ctl-row > span:first-child{color:var(--sg-muted)}
html.stage .ctl-row .ctl-val{color:var(--sg-ink)}
html.stage .ctl-row input[type="range"],html.stage .ctl-row input[type="checkbox"]{accent-color:#10b981}
html.stage .ctl-section-label{border-top-color:var(--sg-line);color:var(--sg-muted)}
html.stage .ctl-row select{background-color:var(--well-bg);border-color:var(--sg-line2);color:var(--sg-ink);
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path fill='%23b9c5d6' d='M2 4l4 4 4-4z'/></svg>")}
html.stage .ctl-row-actions button{background:var(--wx-chip);border-color:var(--wx-chip-line);color:var(--sg-ink)}
html.stage .ctl-row-actions button:hover{background:var(--wx-chip-hover);border-color:var(--wx-chip-line-hover);color:#fff}

/* lower-left note: SPC / NWS overlay legend */
html.stage .overlay-legend{background:var(--smoke-bg);border-color:var(--wx-smoke-line);box-shadow:0 6px 18px rgba(0,0,0,.4);color:var(--sg-ink)}
html.stage .overlay-legend-row{color:var(--sg-soft)}
html.stage .overlay-legend-note{color:var(--sg-soft)}
html.stage .overlay-legend-link{color:var(--sg-ink)}
html.stage .overlay-legend-link:hover{color:#fff}

/* forecaster discussion under the map (WPC excessive rainfall) */
html.stage .wx-discussion{background:var(--sheet-bg);border-color:var(--sheet-border);box-shadow:var(--sheet-shadow);color:var(--sg-ink)}
html.stage .wx-discussion__meta,html.stage .wx-discussion__subhead{color:var(--sg-muted)}
html.stage .wx-discussion__body{color:var(--sg-soft)}
html.stage .wx-discussion__headline{color:var(--sg-ink)}
html.stage .wx-discussion__source{color:#6ee7b7}
html.stage .overlay-legend-swatch{border-color:rgba(255,255,255,.35)}   /* the frame only; the swatch colours are data */

/* ---------- colour bar strip under the map ---------- */
html.stage .legend-horizontal{background:var(--sheet-bg);border-color:var(--sheet-border);box-shadow:var(--sheet-shadow);color:var(--sg-ink)}
html.stage .legend-horizontal .legend-label{color:var(--sg-ink)}
html.stage .legend-horizontal .legend-ticks{color:var(--sg-soft)}
html.stage .legend-types{color:var(--sg-muted)}
html.stage .legend-desc{border-top-color:var(--sg-line);color:var(--sg-muted)}
/* The colour bar is data. Its "below the first step" cells are drawn half-transparent white and the
   live strip behind them is #f8fafc, so the canvas keeps that ground and reads exactly as live. */
html.stage #legend-canvas{background:#f8fafc;border-color:rgba(255,255,255,.18)}
/* in | cm switch on snow variables */
html.stage .legend-units{background:var(--well-bg);border-color:var(--sg-line2)}
html.stage .legend-units button{color:var(--sg-soft)}
html.stage .legend-units button:hover{background:rgba(255,255,255,.1);color:#fff}
html.stage .legend-units button[aria-pressed="true"]{background:#047857;color:#fff}
html.stage .legend-units button:focus-visible{outline-color:#6ee7b7}

/* ---------- keyboard help (press ?) ---------- */
html.stage .help-card{background:var(--smoke-bg);border-color:var(--wx-smoke-line);box-shadow:0 18px 50px rgba(0,0,0,.6);color:var(--sg-ink)}
html.stage .help-title{color:#6ee7b7}
html.stage .help td:first-child{color:var(--sg-muted)}
html.stage .help kbd{background:rgba(255,255,255,.1);border-color:var(--sg-line2);color:var(--sg-ink)}
html.stage .help-hint{color:var(--sg-muted)}

/* ---------- Pro box (signed-out and free visitors: Compare, locked models and variables) ---------- */
html.stage .pro-modal__backdrop{background:rgba(2,6,23,.6)}
html.stage .pro-modal__dialog{background:var(--smoke-bg);-webkit-backdrop-filter:none;backdrop-filter:none;border-color:var(--wx-smoke-line);box-shadow:0 30px 70px rgba(0,0,0,.6),inset 0 1px 0 rgba(255,255,255,.12);color:var(--sg-ink)}
html.stage .pro-modal__close{color:var(--sg-muted)}
html.stage .pro-modal__close:hover{background:rgba(255,255,255,.1);color:#fff}
html.stage .pro-modal__eyebrow{color:#f0a58c;background:rgba(185,79,53,.18);border-color:rgba(240,165,140,.35)}
html.stage .pro-modal__title{color:var(--sg-ink)}
html.stage .pro-modal__text{color:var(--sg-soft)}
html.stage .pro-modal__text strong{color:#f0a58c}           /* live rust is under 3:1 on dark; the light rust keeps the meaning */
html.stage .pro-modal__btn--primary{background:var(--pro);color:#fff}
html.stage .pro-modal__btn--primary{transition:var(--pro-ease)}   /* shared rust hover, see slate.css (orchestrator) */
html.stage .pro-modal__btn--primary:hover{background:var(--pro-h);box-shadow:var(--pro-glow)}
html.stage .pro-modal__btn--primary:active{background:var(--pro-d);box-shadow:none;transition-duration:.08s}
html.stage .pro-modal__btn--ghost{background:rgba(255,255,255,.08);border-color:var(--sg-line2);color:var(--sg-ink)}
html.stage .pro-modal__btn--ghost:hover{background:rgba(255,255,255,.14);border-color:rgba(255,255,255,.42);color:#fff}
html.stage .pro-modal__sample{border-color:var(--sg-line);box-shadow:0 14px 30px -18px rgba(0,0,0,.7)}   /* the sample picture stays as published */
