/* Forecast Poland — the Maps Explorer's own chrome.
 *
 * The stage is one shared coordinate space: the forecast PNG at 0,0 at its
 * natural size, an SVG overlay with the same corners in its viewBox, and a
 * single CSS transform on the pair for pan and zoom. Nothing here is a map
 * library, so nothing here needs to fight one.
 */

.exp { display: grid; grid-template-columns: 1fr; gap: .7rem; }

.bar {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: .5rem .6rem;
}
.bar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 .2rem; }

#models { display: flex; gap: .3rem; flex-wrap: wrap; }
#models button {
  font: inherit; font-size: .84rem; cursor: pointer; border-radius: 7px;
  border: 1px solid var(--line); background: var(--linen); color: var(--ink-2);
  padding: .3rem .6rem; line-height: 1.15; text-align: left;
}
#models button em { display: block; font-style: normal; font-size: .68rem; color: var(--mut); }
#models button:hover { border-color: var(--amber); }
#models button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
#models button.on em { color: var(--amber-2); }

#pills { display: flex; gap: .28rem; flex-wrap: wrap; }
#pills button {
  font: inherit; font-size: .8rem; cursor: pointer; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: .25rem .68rem;
}
#pills button:hover { border-color: var(--pine); color: var(--pine); }
#pills button.on { background: var(--crimson); border-color: var(--crimson); color: #fff; font-weight: 600; }
#pills button.uniq { border-color: var(--amber); }
#pills button.uniq::before { content: "★ "; color: var(--amber); font-size: .8em; }
#pills button.uniq.on::before { color: #fff; }

.toggles { display: flex; gap: .25rem; flex-wrap: wrap; }
.toggles button, .ctl {
  font: inherit; font-size: .78rem; cursor: pointer; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--mut);
  padding: .22rem .5rem;
}
.toggles button.on { background: var(--pine); border-color: var(--pine); color: #fff; }
select.ctl { padding: .24rem .4rem; }

/* ---- the stage --------------------------------------------------------- */

#stage {
  position: relative; overflow: hidden; background: #0d141b;
  border: 1px solid var(--line); border-radius: var(--radius);
  height: min(78vh, 900px); cursor: grab; touch-action: none;
}
#stage.grabbing { cursor: grabbing; }
#world { position: absolute; top: 0; left: 0; transform-origin: 0 0;
         will-change: transform; }

/* Every layer is laid out at the *viewBox* size, not at its own natural size.
 * That is what makes the stack one coordinate space: a COSMO frame is
 * 1160 x 1128 pixels, an IFS frame 720 x 696 and a radar frame 1160 x 1128,
 * and all three have to sit exactly on top of the same SVG. Without this the
 * layers are drawn at their own resolutions, the coastline lands on the
 * forecast for one model and a third of the way across it for another, and
 * the radar overlay is a different map from the model underneath it.
 *
 * The default is the frame's aspect; `init()` overwrites both from
 * regions.json so the two cannot drift apart. */
#raster, #radar, #wind, #vec {
  position: absolute; top: 0; left: 0;
  width: var(--vbw, 1120px); height: var(--vbh, 1089px);
}
#raster, #radar { image-rendering: auto; }
#wind { pointer-events: none; }
#vec { overflow: visible; pointer-events: none; }

#vec .ctx { fill: #ffffff10; stroke: #ffffff30; stroke-width: calc(1px / var(--kk, 1)); }
#o-coast { fill: none; stroke: #08131c; stroke-width: calc(1.4px / var(--kk, 1)); stroke-linejoin: round; }
#o-borders { fill: none; stroke: #1a2733cc; stroke-width: calc(1.1px / var(--kk, 1)); stroke-dasharray: calc(5px / var(--kk,1)) calc(3px / var(--kk,1)); }
#o-admin1 { fill: none; stroke: #33455499; stroke-width: calc(.8px / var(--kk, 1)); }
#o-rivers { fill: none; stroke: #1f4e8c99; stroke-width: calc(.9px / var(--kk, 1)); }
#o-lakes { fill: none; stroke: #1f4e8caa; stroke-width: calc(.8px / var(--kk, 1)); }
#o-iso { fill: none; stroke: #101820; stroke-width: calc(1px / var(--kk, 1)); opacity: .8; }
#iso-lab text {
  font: 600 calc(11px / var(--kk, 1)) var(--mono); fill: #101820;
  paint-order: stroke; stroke: #ffffffcc; stroke-width: calc(3px / var(--kk, 1));
  text-anchor: middle; dominant-baseline: middle;
}
#o-cities .city circle { r: calc(2.4px / var(--kk, 1)); fill: #fff; stroke: #101820; stroke-width: calc(.9px / var(--kk, 1)); }
#o-cities .city text {
  font: 600 calc(11px / var(--kk, 1)) var(--sans); fill: #0d141b;
  paint-order: stroke; stroke: #ffffffdd; stroke-width: calc(2.6px / var(--kk, 1));
}
#o-cities .city text.cval { font-weight: 700; fill: var(--crimson); }

#readout {
  position: absolute; pointer-events: none; z-index: 6;
  background: #0d141bee; color: #fff; border-radius: 7px; padding: .3rem .5rem;
  font-size: .78rem; line-height: 1.35; border: 1px solid #ffffff28;
}
#readout b { font-family: var(--mono); font-size: .95rem; }
#readout span { display: block; color: #a9bccb; font-family: var(--mono); font-size: .68rem; }

.stagefoot {
  display: flex; gap: .6rem; align-items: center; flex-wrap: wrap;
  font-size: .82rem; color: var(--mut);
}
.stagefoot .grow { flex: 1 1 auto; }
#vt b { color: var(--text); font-variant-numeric: tabular-nums; }
#vt .loc { color: var(--pine); font-variant-numeric: tabular-nums; }
#vt .lead { font-family: var(--mono); color: var(--crimson); font-weight: 700; }

.player { display: flex; gap: .4rem; align-items: center; width: 100%; }
.player button {
  font: inherit; cursor: pointer; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; padding: .2rem .55rem; color: var(--ink-2); min-width: 2.1rem;
}
.player button:hover { border-color: var(--crimson); color: var(--crimson); }
#slider { flex: 1 1 auto; accent-color: var(--crimson); }

#legend { display: flex; flex-direction: column; gap: .18rem; min-width: 210px; }
.lg-bar { height: 12px; border-radius: 3px; border: 1px solid var(--line); }
.lg-ticks { position: relative; height: 1em; font-size: .66rem; color: var(--mut); font-family: var(--mono); }
.lg-ticks span { position: absolute; top: 0; white-space: nowrap; }
.lg-name { font-size: .72rem; color: var(--ink-2); font-weight: 600; }

#status { font-size: .82rem; color: var(--mut); }
#status b { color: var(--text); }
.mono { font-family: var(--mono); }
#desc { font-size: .84rem; color: var(--mut); max-width: 78ch; }

@media (max-width: 700px) {
  #stage { height: min(62vh, 560px); }
  #legend { min-width: 150px; }
}
