/* Probabilistic Mountain Forecast (v2). Everything is scoped to #mtnwx2 so the weather.gov template is untouched. */

#mtnwx2 {
  --bg: #ffffff;
  --surface: #f5f7fa;
  --ink: #0f1b2a;
  --muted: #566373;
  --line: #e1e6ec;
  --accent: #1a62d6;
  --band: #bfd5f5;
  --gust: #f6d0cc;
  --site: #8f5f22;
  --r0: #eef2f7;
  --r1: #bcd8fb;
  --r2: #5c9ff2;
  --r3: #1847b8;
  --hl: rgba(15, 27, 42, 0.07); /* neutral, so the blue range bands still show through the hovered hour */
  --alert-bg: #fff6dd;
  --alert-line: #ecc965;
  --alert-ink: #5f4500;
  --ok: #138a3e;
  --stale: #b25e00;
  --label-w: 112px;

  container-type: inline-size;
  box-sizing: border-box;
  max-width: 1100px;
  margin: 10px auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

/* Dark only on screen, and not while printing (.mw-print is set on beforeprint), so print always uses the light tokens. */
@media screen and (prefers-color-scheme: dark) {
  #mtnwx2:not(.mw-print) {
    --bg: #0d1520;
    --surface: #132031;
    --ink: #e7eef6;
    --muted: #9fb0c3;
    --line: #24344b;
    --accent: #66a8ff;
    --band: #26487a;
    --gust: #4f2a2a;
    --site: #e0ad66;
    --r0: #15263a;
    --r1: #1f4370;
    --r2: #2a63b5; /* keeps light text on moderate cells >= 4.5:1 */
    --r3: #9cc7ff;
    --hl: rgba(231, 238, 246, 0.10);
    --alert-bg: #2a2208;
    --alert-line: #6b5512;
    --alert-ink: #f3d27a;
    --ok: #4ade80;
    --stale: #ffb366;
  }
}

#mtnwx2 *, #mtnwx2 *::before, #mtnwx2 *::after { box-sizing: border-box; }
#mtnwx2 h2, #mtnwx2 h3, #mtnwx2 p { margin: 0; color: inherit; font-family: inherit; }
#mtnwx2 a { color: var(--accent); text-decoration: none; }
#mtnwx2 a:hover { text-decoration: underline; }
#mtnwx2 :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#mtnwx2 .mw-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
#mtnwx2 .mw-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
#mtnwx2 .mw-title { font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
#mtnwx2 .mw-elev { font-weight: 400; color: var(--muted); }
#mtnwx2 .mw-link { display: inline-flex; vertical-align: middle; color: var(--muted); }
#mtnwx2 .mw-sub { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
#mtnwx2 .mw-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 2px 9px;
  border: 1px solid var(--line); border-radius: 999px; font-size: 11.5px; color: var(--muted); vertical-align: middle;
}
#mtnwx2 .mw-beta { margin: 0 0 0 4px; padding: 1px 7px; font-size: 10.5px; font-weight: 600; color: #a3271b; background: #fdecea; border-color: #f6c9c4; }
#mtnwx2 .mw-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
#mtnwx2 .mw-fresh.is-stale { color: var(--stale); border-color: var(--stale); }
#mtnwx2 .mw-fresh.is-stale .mw-dot { background: var(--stale); }

#mtnwx2 .mw-ctrls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
#mtnwx2 select, #mtnwx2 .mw-btn, #mtnwx2 .mw-seg button {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; cursor: pointer;
}
#mtnwx2 .mw-btn { display: inline-flex; align-items: center; gap: 6px; }
#mtnwx2 .mw-seg { display: inline-flex; }
#mtnwx2 .mw-seg button { border-radius: 0; }
#mtnwx2 .mw-seg button:first-child { border-radius: 10px 0 0 10px; }
#mtnwx2 .mw-seg button:last-child { border-radius: 0 10px 10px 0; border-left: 0; }
#mtnwx2 .mw-seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- alerts, messages, footer ---------- */
#mtnwx2 .mw-alert {
  display: flex; align-items: center; gap: 8px; margin: 12px 0 0; padding: 8px 12px; font-size: 13px;
  background: var(--alert-bg); border: 1px solid var(--alert-line); color: var(--alert-ink); border-radius: 10px;
}
#mtnwx2 .mw-alert a { margin-left: auto; color: inherit; font-weight: 600; white-space: nowrap; }
#mtnwx2 .mw-message { margin: 18px 0; padding: 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); }
#mtnwx2 .mw-footer { margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ---------- storm sentence + ribbon ---------- */
#mtnwx2 .mw-story { margin: 16px 0 10px; max-width: 780px; font-size: 16.5px; line-height: 1.5; }
#mtnwx2 .mw-story strong { color: var(--accent); font-weight: 650; }
#mtnwx2 .mw-ribbon-cells { display: grid; grid-template-columns: repeat(25, 1fr); gap: 2px; height: 28px; }
#mtnwx2 .mw-cell { border-radius: 4px; background: var(--r0); }
#mtnwx2 .is-light { background: var(--r1); }
#mtnwx2 .is-moderate { background: var(--r2); }
#mtnwx2 .is-heavy { background: var(--r3); }
#mtnwx2 .mw-cell.mw-hl { outline: 2px solid var(--accent); outline-offset: 1px; }
#mtnwx2 .mw-ribbon-axis { display: grid; grid-template-columns: repeat(25, 1fr); margin-top: 3px; font-size: 10.5px; color: var(--muted); }
#mtnwx2 .mw-ribbon-axis span { text-align: center; white-space: nowrap; }

/* ---------- period cards ---------- */
#mtnwx2 .mw-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
#mtnwx2 .mw-card { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
#mtnwx2 .mw-ph { font-size: 15px; font-weight: 700; }
#mtnwx2 .mw-ph span { margin-left: 6px; font-size: 12.5px; font-weight: 400; color: var(--muted); }
#mtnwx2 .mw-wx { min-height: 1.4em; margin: 2px 0 10px; font-size: 12.5px; color: var(--muted); }
#mtnwx2 .mw-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
#mtnwx2 .mw-k { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
#mtnwx2 .mw-big { margin-top: 2px; font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
#mtnwx2 .mw-mut { font-size: 11.5px; color: var(--muted); }
#mtnwx2 .mw-rb { position: relative; height: 8px; margin: 8px 0 3px; border-radius: 4px; background: var(--r0); }
#mtnwx2 .mw-rb i, #mtnwx2 .mw-rb b { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
#mtnwx2 .mw-rb i { background: var(--band); }
#mtnwx2 .mw-rb b { background: var(--accent); min-width: 4px; }
#mtnwx2 .mw-rbl { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
#mtnwx2 .mw-odds { margin-top: 6px; font-size: 12px; color: var(--muted); }
#mtnwx2 .mw-odds strong, #mtnwx2 .mw-cardfoot strong { color: var(--ink); }
#mtnwx2 .mw-cardfoot { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

/* ---------- timeline + aligned hourly table (shared columns: label + 25 hours) ---------- */
#mtnwx2 .mw-timeline { position: relative; margin-top: 8px; }
#mtnwx2 .mw-days { display: grid; grid-template-columns: var(--label-w) 1fr 1fr; padding: 6px 0 4px; font-size: 11.5px; color: var(--muted); }
#mtnwx2 .mw-days span { text-align: center; }
#mtnwx2 .mw-row { display: grid; grid-template-columns: var(--label-w) repeat(25, minmax(0, 1fr)); align-items: center; }
#mtnwx2 .mw-chartrow { grid-template-columns: var(--label-w) minmax(0, 1fr); border-top: 1px solid var(--line); padding: 3px 0; }
#mtnwx2 .mw-lab {
  align-self: stretch; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding-right: 8px; font-size: 12px; line-height: 1.3; background: var(--bg); /* full row height so a sticky label covers what scrolls under it */
}
#mtnwx2 .mw-table .mw-lab { flex-direction: row; align-items: center; justify-content: flex-start; gap: 4px; }
#mtnwx2 .mw-lab span { color: var(--muted); }
#mtnwx2 .mw-chart { min-width: 0; }
#mtnwx2 .mw-unavail { padding: 20px 0; color: var(--muted); font-size: 12.5px; }
#mtnwx2 .mw-seg-sm { margin-top: 4px; }
#mtnwx2 .mw-seg-sm button { padding: 1px 7px; font-size: 10.5px; border-color: var(--accent); }
#mtnwx2 .mw-seg-sm button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }

#mtnwx2 .mw-table { border-top: 2px solid var(--ink); }
#mtnwx2 .mw-table .mw-row + .mw-row { border-top: 1px solid var(--line); }
#mtnwx2 .mw-td { padding: 5px 0; text-align: center; font-size: 11px; line-height: 1.25; }
#mtnwx2 .mw-th { color: var(--muted); }
#mtnwx2 .mw-m, #mtnwx2 .mw-g { color: var(--muted); }
#mtnwx2 .mw-td.is-light { background: var(--r1); }
#mtnwx2 .mw-td.is-moderate { background: var(--r2); }
#mtnwx2 .mw-td.is-heavy { background: var(--r3); color: var(--bg); }
#mtnwx2 .mw-td.is-none { background: transparent; }
#mtnwx2 .mw-td.mw-hl { box-shadow: inset 0 0 0 999px var(--hl); font-weight: 700; }

/* ---------- linked hour readout ---------- */
#mtnwx2 .mw-readout {
  position: sticky; top: 0; z-index: 2; margin: 6px 0 0; padding: 6px 10px; border-radius: 8px;
  font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line);
}
#mtnwx2 .mw-readout.is-on { color: var(--bg); background: var(--ink); border-color: var(--ink); }
#mtnwx2 .mw-td:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- More ---------- */
#mtnwx2 .mw-more { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
#mtnwx2 .mw-pill {
  font: inherit; font-size: 12.5px; color: var(--accent); background: transparent; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
}
#mtnwx2 .mw-pill[aria-expanded="true"] { border-color: var(--accent); }
#mtnwx2 .mw-morerows { margin-top: 6px; }
/* Sky cover: one slate at rising opacity darkens on light and lightens on dark, so it needs no dark-mode token */
#mtnwx2 .mw-skyrow { border-top: 1px solid var(--line); }
#mtnwx2 .mw-sky1 { background: rgba(100, 116, 139, 0.12); }
#mtnwx2 .mw-sky2 { background: rgba(100, 116, 139, 0.25); }
#mtnwx2 .mw-sky3 { background: rgba(100, 116, 139, 0.40); }
#mtnwx2 .mw-sky4 { background: rgba(100, 116, 139, 0.55); }

/* ---------- print ---------- */
@media print {
  #mtnwx2 { max-width: none; margin: 0; padding: 0; border: 0; }
  #mtnwx2 .mw-ctrls, #mtnwx2 .mw-more, #mtnwx2 .mw-map, #mtnwx2 .mw-readout, #mtnwx2 .mw-seg-sm, #mtnwx2 .mw-link { display: none !important; }
  #mtnwx2 .mw-card, #mtnwx2 .mw-timeline, #mtnwx2 .mw-table { break-inside: avoid; }
  #mtnwx2 .mw-td.is-light, #mtnwx2 .mw-td.is-moderate, #mtnwx2 .mw-td.is-heavy, #mtnwx2 .mw-cell, #mtnwx2 .mw-skyrow .mw-td { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* ---------- map picker ---------- */
#mtnwx2 .mw-map { margin-top: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
#mtnwx2 .mw-maphead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
/* Pins use fixed colors: the USGS tiles are light in both themes */
#mtnwx2 .mw-leaflet { height: 440px; border: 1px solid var(--line); border-radius: 10px; background: var(--r0); font: inherit; }
#mtnwx2 .mw-pin { box-sizing: border-box; border-radius: 50%; background: #fff; border: 3px solid #1a62d6; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45); cursor: pointer; }
#mtnwx2 .mw-pin.is-current { background: #1a62d6; border-color: #fff; }
#mtnwx2 .mw-pin:hover, #mtnwx2 .mw-pin:focus-visible { outline: 3px solid rgba(26, 98, 214, 0.45); outline-offset: 2px; }
#mtnwx2 .mw-pinlabel { font-size: 12px; font-weight: 600; color: #0f1b2a; }
@media screen and (prefers-color-scheme: dark) {
  #mtnwx2:not(.mw-print) .mw-leaflet .leaflet-tile-pane { filter: brightness(0.82) contrast(1.08); }
}

/* ---------- narrow (container-width based: the CMS page has no viewport meta) ---------- */
#mtnwx2 .mw-scroll { overflow-x: auto; }
@container (max-width: 640px) {
  #mtnwx2 .mw-cards { grid-template-columns: 1fr; }
  #mtnwx2 .mw-big { font-size: 25px; }
  #mtnwx2 .mw-story { font-size: 15px; }
  #mtnwx2 .mw-ctrls { justify-content: flex-start; }
  #mtnwx2 .mw-scroll-inner { min-width: 760px; }
  #mtnwx2 .mw-lab { position: sticky; left: 0; z-index: 1; }
  #mtnwx2 .mw-ribbon-axis { font-size: 9px; }
}
