/* Snow forecast — one stylesheet, no framework, light + dark.
   Chart colours live here as custom properties so the server-rendered SVG
   themes without being re-rendered. */

:root {
  color-scheme: light;

  --surface:        #fcfcfb;
  --plane:          #f9f9f7;
  --ink:            #0b0b0b;
  --ink-2:          #52514e;
  --ink-muted:      #898781;
  --grid:           #e1e0d9;
  --axis:           #c3c2b7;
  --hairline:       rgba(11, 11, 11, .10);

  --series-median:  #2a78d6;
  --series-control: #eb6834;
  --band-outer:     #cde2fb;
  --band-inner:     #9ec5f4;
  --outlook:        #f0efea;   /* week-2 shading: one step off the surface */

  --warn-bg:        #fff6e0;
  --warn-ink:       #6b4c00;

  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface:        #1a1a19;
    --plane:          #0d0d0d;
    --ink:            #ffffff;
    --ink-2:          #c3c2b7;
    --ink-muted:      #898781;
    --grid:           #2c2c2a;
    --axis:           #383835;
    --hairline:       rgba(255, 255, 255, .10);

    --series-median:  #3987e5;
    --series-control: #d95926;
    --band-outer:     #16324f;
    --band-inner:     #1c4b7a;
    --outlook:        #222221;

    --warn-bg:        #3a2f10;
    --warn-ink:       #f6d68a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1rem 4rem;
  background: var(--plane);
  color: var(--ink);
  font: 16px/1.6 var(--font);
  max-width: 1000px;
  margin-inline: auto;
}

a { color: var(--series-median); }
a:hover { text-decoration: none; }

/* ---------- header / picker ---------- */
.site { padding: 1.5rem 0 .5rem; }
.site .home { font-size: .85rem; color: var(--ink-muted); text-decoration: none; }
.site .home:hover { color: var(--ink-2); }
.site h1 { margin: .25rem 0 0; font-size: 1.5rem; letter-spacing: -.01em; }

.picker {
  display: flex; gap: .75rem; align-items: center;
  margin: 1.25rem 0 2rem; padding: .85rem 1rem;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius);
}
.picker label { font-weight: 600; font-size: .9rem; }
.picker select {
  flex: 1; padding: .5rem .6rem; font: inherit; font-size: .95rem;
  color: var(--ink); background: var(--plane);
  border: 1px solid var(--axis); border-radius: 6px;
}

.banner { padding: .8rem 1rem; border-radius: var(--radius); margin: 1rem 0; font-size: .95rem; }
.banner-warn { background: var(--warn-bg); color: var(--warn-ink); }

/* ---------- content ---------- */
.intro, .resort { background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 1.25rem 1.5rem 1.75rem; }
.intro h2, .resort h2 { margin-top: 0; }
.resort h2 .alt { font-size: .8rem; font-weight: 400; color: var(--ink-muted); margin-left: .5rem; }
.resort h3 { margin: 2rem 0 .75rem; font-size: 1.05rem; }
.desc { color: var(--ink-2); }
.runs { font-size: .9rem; color: var(--ink-2); }

.links { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.links a {
  font-size: .85rem; padding: .35rem .7rem; text-decoration: none;
  border: 1px solid var(--hairline); border-radius: 999px; color: var(--ink-2);
  background: var(--plane);
}
.links a:hover { color: var(--series-median); border-color: var(--series-median); }

.empty, .chart-empty { color: var(--ink-muted); font-size: .95rem; font-style: italic; }

/* ---------- charts ---------- */
.chart-figure { margin: 0 0 2rem; }
.chart-title { font-weight: 600; font-size: .95rem; margin-bottom: .15rem; }
.chart-title .chart-unit { color: var(--ink-muted); font-weight: 400; }
.chart-note { font-size: .82rem; color: var(--ink-2); margin: .4rem 0 0; }
.runline { font-size: .82rem; color: var(--ink-2); margin: -.6rem 0 1rem;
  padding: .45rem .6rem; background: var(--plane); border: 1px solid var(--hairline);
  border-radius: 6px; }
.runline strong { color: var(--ink); }
.run-badge { display: inline-block; white-space: nowrap; margin: 0 .5rem .15rem 0; }
.run-badge:last-of-type { margin-right: 0; }
.run-badge b { color: var(--ink); }


.chart-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin: .35rem 0 .5rem;
  font-size: .8rem; color: var(--ink-2); }
.chart-legend .key { display: inline-flex; align-items: center; gap: .4rem; }
.swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.sw-median  { background: var(--series-median); }
.sw-control { background: var(--series-control); }
.sw-band    { background: var(--band-inner); height: 10px; border-radius: 3px; }

.chart-wrap { position: relative; overflow-x: auto; }
/* 14 days of data: below ~760px the day labels get squeezed, so narrower
   screens scroll the chart sideways rather than squash it. */
svg.chart { display: block; width: 100%; height: 300px; min-width: 760px; }

.grid   { stroke: var(--grid); stroke-width: 1; }
.axis   { stroke: var(--axis); stroke-width: 1; }
.daysep { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 2 4; }
.refline{ stroke: var(--ink-muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.reflabel { fill: var(--ink-muted); font-size: 11px; text-anchor: end; font-family: var(--font); }

.tick { fill: var(--ink-muted); font-size: 11px; font-family: var(--font);
  font-variant-numeric: tabular-nums; }
.tick-y { text-anchor: end; }
.tick-x { text-anchor: start; }
.tick-x.mid { text-anchor: middle; }
.tick-x.dim { fill: var(--ink-muted); opacity: .75; }
.agree { fill: var(--ink-muted); font-size: 10px; text-anchor: middle; font-family: var(--font); }
.barval { fill: var(--ink-2); font-size: 11px; text-anchor: middle; font-family: var(--font);
  font-variant-numeric: tabular-nums; }

.band { stroke: none; }
.band-outer { fill: var(--band-outer); }
.band-inner { fill: var(--band-inner); }
.series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round;
  vector-effect: non-scaling-stroke; }
.series-median  { stroke: var(--series-median); }
.series-control { stroke: var(--series-control); stroke-dasharray: 6 4; }
.bar { fill: var(--series-median); }

/* Week 2 — see OUTLOOK_FROM_DAY in app/lib/chart.php. A tinted band behind the
   data with a plain-text label, so the change of status isn't carried by colour
   alone; bars there are drawn lighter and lose their printed value. */
.outlook       { fill: var(--outlook); }
.outlook-label { fill: var(--ink-muted); font-size: 10.5px; font-family: var(--font);
  letter-spacing: .02em; }
.bar-outlook   { opacity: .45; }

.crosshair { position: absolute; top: 0; width: 1px; background: var(--ink-muted);
  pointer-events: none; }
.tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: 8px;
  padding: .45rem .6rem; font-size: .78rem; line-height: 1.45;
  box-shadow: 0 4px 14px rgba(0,0,0,.14); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tip b { font-weight: 600; }
.tip .k { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: .35rem; }

/* ---------- webcams ----------
   Two across on a normal screen, one on a phone. The 420px floor is what
   forces two rather than three: three would need ~1290px of row, and the
   panel gives about 920px.

   Windy's free tier serves stills at 400x224 (`preview`) — its `full` and
   `original` sizes are 1920x1080 but belong to the paid tier, so they are not
   used here. At two across each card is ~450px, so a Windy still is scaled up
   about 1.2x and looks slightly soft. Everything else has pixels to spare:
   page cams ~800px, YouTube posters 1280px, Foto-Webcam 1200px and Feratel
   1920px (4K on its newer cams). Clicking any Windy cam opens it full size on
   windy.com; Timelapse and Live play at whatever size the window allows. */
.cams { display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.cam { margin: 0; background: var(--plane); border: 1px solid var(--hairline);
  border-radius: var(--radius); overflow: hidden; }
.cam img { display: block; width: 100%; height: auto; aspect-ratio: 400 / 224;
  object-fit: cover; background: var(--grid); }
.cam-still { position: relative; display: block; }
.cam-badge {
  position: absolute; left: .6rem; bottom: .6rem;
  background: rgba(0,0,0,.72); color: #fff; font-size: .72rem;
  padding: .18rem .55rem; border-radius: 999px; letter-spacing: .01em;
}
.cam figcaption { padding: .6rem .8rem .7rem; font-size: .85rem; color: var(--ink-2);
  display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: center; }
.cam-name { flex: 1 1 100%; color: var(--ink); font-weight: 500; font-size: .92rem; }
/* A Windy card's caption carries three things (name, age, Timelapse) and reads
   best with the name on its own line. A provider card carries two, so the name
   and its Live button share a line and wrap only when the name is long. */
.cam-direct .cam-name, .cam-page .cam-name { flex: 1 1 auto; min-width: 9rem; }
.cam-age, .cam-src { color: var(--ink-muted); font-size: .75rem; }
.cam-play {
  margin-left: auto; font: inherit; font-size: .78rem; cursor: pointer;
  padding: .25rem .7rem; border-radius: 999px;
  border: 1px solid var(--series-median); background: transparent; color: var(--series-median);
}
.cam-play:hover { background: var(--series-median); color: #fff; }
.cam-note { font-size: .85rem; color: var(--ink-2); margin-top: .9rem; }

.windy-courtesy { margin-top: .9rem; font-size: .78rem; color: var(--ink-muted); }
.windy-courtesy a { color: var(--ink-muted); }

/* ---------- player modal ---------- */
#player-modal { border: none; border-radius: var(--radius); padding: 0; width: min(92vw, 900px);
  background: var(--surface); color: var(--ink); }
#player-modal::backdrop { background: rgba(0,0,0,.6); }
#player-modal .close { position: absolute; top: .35rem; right: .55rem; z-index: 2;
  background: none; border: none; font-size: 1.6rem; line-height: 1; cursor: pointer;
  color: var(--ink-2); }
.player-frame { aspect-ratio: 16 / 9; }
.player-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

.site-footer { margin-top: 2.5rem; font-size: .82rem; color: var(--ink-muted); }
.site-footer a { color: var(--ink-muted); }
.site-footer .version { margin: .3rem 0 0; font-size: .74rem; opacity: .75; }

/* Said when a snowfall chart has nothing to draw, so a flat line reads as
   "no snow" rather than "no data". */
.chart-trace { font-weight: 500; color: var(--ink-2); }

@media (max-width: 600px) {
  .picker { flex-wrap: wrap; }
  .intro, .resort { padding: 1rem 1rem 1.5rem; }
}

/* ---------- YouTube live cams ---------- */
.cam-play-tile {
  display: block; position: relative; width: 100%; padding: 0;
  border: 0; background: none; cursor: pointer; font: inherit;
}
.cam-play-tile img { display: block; width: 100%; height: auto;
  aspect-ratio: 400 / 224; object-fit: cover; background: var(--grid); }
.cam-playmark {
  position: absolute; inset: 0; margin: auto; width: 58px; height: 58px;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; font-size: 21px; padding-left: 4px;
  transition: background .15s, transform .15s;
}
.cam-play-tile:hover .cam-playmark,
.cam-play-tile:focus-visible .cam-playmark { background: var(--series-median); transform: scale(1.08); }
.cam-play-tile:focus-visible { outline: 2px solid var(--series-median); outline-offset: 2px; }
.cam-badge.cam-live { background: #c4302b; }
.cam-yt { margin-left: auto; font-size: .72rem; color: var(--ink-muted); }
.cam-yt:hover { color: var(--series-median); }

/* Roundshot 360° panoramas — see render_roundshot(). The strip keeps its own
   proportions at card height and the box scrolls sideways; chart.js adds
   click-and-drag and starts it centred. */
.pano-wrap { position: relative; }
.pano { aspect-ratio: 400 / 224; overflow-x: auto; overflow-y: hidden;
  cursor: grab; overscroll-behavior-x: contain; scrollbar-width: thin;
  background: var(--grid); }
.pano.dragging { cursor: grabbing; }
.pano:focus-visible { outline: 2px solid var(--series-median); outline-offset: -2px; }
.cam .pano img { width: auto; height: 100%; max-width: none; aspect-ratio: auto;
  object-fit: fill; user-select: none; -webkit-user-drag: none; }
/* Top-left, so it never sits on the "last daylight" badge at the bottom. */
.pano-badge { top: .6rem; bottom: auto; pointer-events: none; }

/* A provider that streams video but publishes no still (live-panorama keys its
   stream by an id and has no picture under it). There is nothing honest to put
   in the grid, so the tile says so rather than showing a stale poster. */
.cam-noposter { aspect-ratio: 400 / 224; background:
  linear-gradient(160deg, var(--grid), var(--plane)); position: relative; }

details.panel > summary { cursor: pointer; font-size: .95rem; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: '▸ '; color: var(--ink-muted); }
details.panel[open] > summary::before { content: '▾ '; }

/* ---------- geocoding lookup ---------- */
.geo { margin-top: .8rem; }
.geo-msg { display: block; font-size: .84rem; color: var(--ink-2); }
.geo-msg.geo-ok { color: #14521a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .geo-msg.geo-ok { color: #9fdcaa; }
}
.geo-list { list-style: none; margin: .5rem 0 0; padding: 0;
  display: grid; gap: .35rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.geo-list button {
  width: 100%; text-align: left; font: inherit; cursor: pointer;
  background: var(--plane); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: 8px; padding: .5rem .65rem;
  display: flex; flex-direction: column; gap: .1rem;
}
.geo-list button:hover { border-color: var(--series-median); }
.geo-list strong { font-size: .88rem; font-weight: 600; }
.geo-where { font-size: .78rem; color: var(--ink-2); }
.geo-facts { font-size: .72rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* ---------- forecast view switch ---------- */
.forecast-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  margin: 2rem 0 .4rem; }
.forecast-head h3 { margin: 0; }
.viewswitch { display: inline-flex; border: 1px solid var(--hairline);
  border-radius: 999px; overflow: hidden; background: var(--plane); }
.viewswitch button { font: inherit; font-size: .8rem; padding: .3rem .85rem;
  border: 0; background: none; color: var(--ink-2); cursor: pointer; }
.viewswitch button.on { background: var(--series-median); color: #fff; }
.viewswitch button:not(.on):hover { color: var(--ink); }
.view-intro { font-size: .87rem; color: var(--ink-2); margin: .1rem 0 1.1rem; }
/* Three tabs: on a phone they become "GFS · ECMWF · Compare", full width. */
@media (max-width: 520px) {
  .viewswitch { display: flex; width: 100%; }
  .viewswitch button { flex: 1; padding: .35rem .5rem; }
  .vs-long { display: none; }
}

/* ---------- model comparison ---------- */
/* Colour is bound to the model, not its position, so hiding one never
   repaints the others. Slots follow the validated categorical order. */
.m1 { --model: #2a78d6; }   /* ECMWF        */
.m2 { --model: #eb6834; }   /* GFS          */
.m3 { --model: #1baf7a; }   /* ICON         */
.m4 { --model: #eda100; }   /* UK Met Office*/
.m5 { --model: #e87ba4; }   /* Météo-France */
.m6 { --model: #008300; }   /* JMA          */
.m7 { --model: #4a3aa7; }   /* GEM          */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .m1 { --model: #3987e5; }
  :root:not([data-theme="light"]) .m2 { --model: #d95926; }
  :root:not([data-theme="light"]) .m3 { --model: #199e70; }
  :root:not([data-theme="light"]) .m4 { --model: #c98500; }
  :root:not([data-theme="light"]) .m5 { --model: #d55181; }
  :root:not([data-theme="light"]) .m6 { --model: #008300; }
  :root:not([data-theme="light"]) .m7 { --model: #9085e9; }
}

polyline.model { stroke: var(--model); fill: none; stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
text.endlabel { fill: var(--model); font-size: 10.5px; font-family: var(--font);
  font-variant-numeric: tabular-nums; }
polyline.model[hidden], text.endlabel[hidden] { display: none; }

.model-legend { gap: .5rem .9rem; }
.model-key { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer;
  font-size: .8rem; color: var(--ink-2); }
.model-key input { margin: 0; }
.model-key .swatch { background: var(--model); width: 15px; height: 3px; border-radius: 2px; }
.model-key.off { opacity: .45; }
.model-key.off .swatch { background: var(--ink-muted); }

/* End labels sit on top of the lines, so give them a halo in the surface
   colour — three of the seven model colours are below 3:1 contrast on light,
   and these labels are what makes the lines identifiable without relying on
   colour alone. */
text.endlabel {
  paint-order: stroke fill;
  stroke: var(--surface); stroke-width: 3.5px; stroke-linejoin: round;
}
circle.modeldot { fill: var(--model); stroke: var(--surface); stroke-width: 1.5; }
circle.modeldot[hidden] { display: none; }
