/* Forecast chart styles, reused from the snow forecast site. Copyright (c) 2026 Greg Hilton. */
/* ---------- 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; }
  background: var(--plane); border: 1px solid var(--hairline); border-radius: 999px; }
  padding: .25rem .8rem; border-radius: 999px; }
  text-decoration: none; color: var(--ink-2); padding: .25rem .8rem; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--plane); }
.bar-range { opacity: .92; }
.barval.dim { fill: var(--ink-muted); }
.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; }
/* The 1991-2020 average: present, but never competing with the forecast. */
.series-normal { stroke: var(--ink-muted); stroke-width: 1.6; stroke-dasharray: 1 4; fill: none;
  stroke-linecap: round; opacity: .85; }
.swatch.sw-normal { background: none; border-top: 2px dotted var(--ink-muted); height: 0; }
.swatch.sw-ref { background: none; border-top: 2px dashed var(--ink-muted); height: 0; }
.swatch.sw-ref-soft { border-top-style: dotted; opacity: .8; }
.normal-mark { stroke: var(--ink-2); stroke-width: 1.6; stroke-linecap: round; opacity: .75; }
/* The snow-to-the-village line: same idea, quieter, so 0 °C stays the anchor. */
.refline-soft { stroke-dasharray: 2 5; opacity: .8; }
.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; }

/* 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); }

/* ---------- 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; }
/* Several tabs: on a phone they become "GFS · ECMWF · AIFS · 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          */
.m8 { --model: #cc3d3d; }   /* AIFS         */
@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; }
  :root:not([data-theme="light"]) .m8 { --model: #e05a5a; }
}

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; }
