/* Weerstation Bemmel — v6
   Barograph paper by day, night sky after dusk, red light for the telescope.
   Colour per quantity is fixed site-wide; measured values are solid ink,
   forecasts are dashed with an uncertainty band. */

@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo.woff2') format('woff2-variations'), url('/fonts/archivo.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #eef2f5;
  --paper-2: #e4eaef;
  --paper-3: #d8e1e8;
  --card: #f6f8fa;
  --rule: #c9d5de;
  --rule-strong: #a7b8c6;
  --ink: #14213d;
  --ink-2: #414d66;
  --ink-3: #66728a;
  --ink-inverse: #f4f7fb;
  --accent: #5a3fa3;
  --focus: #5a3fa3;

  --temp: #c8352e;
  --rain: #1f66b8;
  --sun: #b7791f;
  --hum: #00897b;
  --press: #6b4bb0;
  --wind: #4f7a28;
  --cold: #2f6fb5;

  --band-temp: rgba(200, 53, 46, .14);
  --band-rain: rgba(31, 102, 184, .16);

  --warn-geel: #f2c200;
  --warn-oranje: #ec7a1c;
  --warn-rood: #cf2a2a;

  --good: #2f7d32;
  --meh: #b27500;
  --bad: #b23a2e;

  --shadow: 0 1px 0 rgba(20, 33, 61, .06), 0 8px 24px -12px rgba(20, 33, 61, .18);
  --radius-s: 6px;
  --radius-m: 10px;

  --f-13: .8125rem;
  --f-15: .9375rem;
  --f-17: 1.0625rem;
  --f-21: 1.3125rem;
  --f-26: 1.625rem;
  --f-33: 2.0625rem;
  --f-41: 2.5625rem;
  --f-52: 3.25rem;

  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
}

/* Night palette: automatic after civil dusk, or chosen. */
:root[data-theme="night"] {
  color-scheme: dark;
  --paper: #0d1526;
  --paper-2: #111b30;
  --paper-3: #18243d;
  --card: #121d33;
  --rule: #223251;
  --rule-strong: #334766;
  --ink: #e7edf6;
  --ink-2: #b3bfd2;
  --ink-3: #8593ab;
  --ink-inverse: #0d1526;
  --accent: #b3a1f5;
  --focus: #b3a1f5;

  --temp: #e8574d;
  --rain: #4f97e8;
  --sun: #bd851f;
  --hum: #16a595;
  --press: #9a80ea;
  --wind: #72a33f;
  --cold: #5b9be8;
  --band-temp: rgba(232, 87, 77, .18);
  --band-rain: rgba(79, 151, 232, .2);
  --good: #5fb562;
  --meh: #d9a441;
  --bad: #e2675c;
  --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 10px 30px -14px rgba(0, 0, 0, .6);
}

/* Red light: preserves dark adaptation at the telescope. Everything is red on black. */
:root[data-theme="red"] {
  color-scheme: dark;
  --paper: #000;
  --paper-2: #080000;
  --paper-3: #120000;
  --card: #070000;
  --rule: #3a0a06;
  --rule-strong: #5a120c;
  --ink: #c8321f;
  --ink-2: #a82a1a;
  --ink-3: #7e2014;
  --ink-inverse: #000;
  --accent: #ff4a36;
  --focus: #ff4a36;
  --temp: #ff4a36; --rain: #c8301f; --sun: #ff6a4a; --hum: #b02a1c; --press: #e03a28; --wind: #a02818; --cold: #c8301f;
  --band-temp: rgba(255, 74, 54, .18); --band-rain: rgba(200, 48, 31, .2);
  --good: #ff4a36; --meh: #c8301f; --bad: #ff6a4a;
  --shadow: none;
}
:root[data-theme="red"] img, :root[data-theme="red"] .leaflet-container { filter: grayscale(1) sepia(1) hue-rotate(-50deg) saturate(6) brightness(.55); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: var(--f-17);
  line-height: 1.55;
  font-variation-settings: 'wdth' 100;
  font-feature-settings: 'lnum';
  -webkit-font-smoothing: antialiased;
  transition: background-color .6s ease, color .6s ease;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 3px; }
button { font: inherit; color: inherit; }
.num, table, .axis { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

h1, h2, h3 { font-weight: 640; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h2 { font-size: var(--f-33); font-variation-settings: 'wdth' 112; }
h3 { font-size: var(--f-21); font-variation-settings: 'wdth' 106; }
p { margin: 0 0 1em; max-width: 68ch; }
.lede { font-size: var(--f-21); color: var(--ink-2); line-height: 1.45; max-width: 60ch; }
.muted { color: var(--ink-3); }
.small { font-size: var(--f-15); }
.tiny { font-size: var(--f-13); }

/* ---- Top bar ------------------------------------------------------------ */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar .wrap { display: flex; align-items: center; gap: 20px; min-height: 58px; }
.wordmark {
  display: flex; align-items: baseline; gap: 10px;
  color: var(--ink); text-decoration: none; font-weight: 700;
  font-variation-settings: 'wdth' 118; letter-spacing: -.01em; white-space: nowrap;
}
.wordmark .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); align-self: center; box-shadow: 0 0 0 0 currentColor; }
.wordmark .dot.stale { background: var(--meh); }
.wordmark .dot.down { background: var(--bad); }
.wordmark .live-temp { font-weight: 560; font-variation-settings: 'wdth' 80; color: var(--ink-2); display: none; }
.topbar.scrolled .live-temp { display: inline; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--ink-2); text-decoration: none; padding: 8px 12px; border-radius: 999px; white-space: nowrap;
  font-variation-settings: 'wdth' 96; font-weight: 520;
}
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--paper-3); }
.theme-btn {
  border: 1px solid var(--rule); background: transparent; border-radius: 999px; padding: 6px 12px;
  cursor: pointer; color: var(--ink-2); font-size: var(--f-15); white-space: nowrap;
}
.theme-btn:hover { border-color: var(--rule-strong); color: var(--ink); }

@media (max-width: 760px) {
  .topbar .wrap { flex-wrap: wrap; gap: 0 12px; min-height: 0; padding-top: 8px; }
  .wordmark { flex: 1; padding: 4px 0; }
  .nav { order: 3; width: 100%; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 8px; }
  .nav a { padding: 6px 10px; }
}

/* ---- Warning ribbon --------------------------------------------------- */

.warnings { display: none; }
.warnings.on { display: block; }
.warn {
  display: flex; gap: 12px; align-items: center; padding: 10px var(--gutter);
  font-weight: 560; color: #1b1300;
}
.warn[data-color="geel"] { background: var(--warn-geel); }
.warn[data-color="oranje"] { background: var(--warn-oranje); color: #fff; }
.warn[data-color="rood"] { background: var(--warn-rood); color: #fff; }
.warn .code { font-variation-settings: 'wdth' 80; font-weight: 800; text-transform: none; }
.warn a { color: inherit; }

/* ---- Hero: the live sky ------------------------------------------------- */

.hero {
  position: relative; isolation: isolate;
  min-height: clamp(560px, 86svh, 880px);
  color: #fff;
  overflow: hidden;
  background: #22407a;
}
.hero canvas.sky { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.hero svg.land { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 34%; z-index: -1; }
.hero .wrap { position: relative; height: 100%; min-height: inherit; display: grid; grid-template-rows: 1fr auto; padding-top: 28px; padding-bottom: 28px; }
.hero-now { align-self: end; padding-bottom: clamp(24px, 7vh, 72px); max-width: 980px; }
.hero-temp {
  display: flex; align-items: flex-start; line-height: .82;
  font-size: clamp(7.5rem, 26vw, 17rem);
  font-weight: 760; font-variation-settings: 'wdth' 62;
  letter-spacing: -.035em;
  text-shadow: 0 2px 30px rgba(0, 0, 0, .18);
  margin: 0;
}
.hero-temp .deg { font-size: .38em; font-weight: 420; margin-left: .04em; margin-top: .08em; opacity: .9; }
.hero-line {
  font-size: clamp(1.25rem, 2.6vw, 1.75rem); line-height: 1.3; font-weight: 520;
  font-variation-settings: 'wdth' 104; margin: 14px 0 0; max-width: 34ch; text-wrap: balance;
  text-shadow: 0 1px 16px rgba(0, 0, 0, .25);
}
.hero-meta { margin-top: 10px; font-size: var(--f-15); opacity: .88; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.hero-meta .pulse { width: 8px; height: 8px; border-radius: 50%; background: #7CF29A; box-shadow: 0 0 0 0 rgba(124, 242, 154, .6); animation: pulse 2.4s infinite; display: inline-block; margin-right: 6px; vertical-align: 1px; }
.hero-meta .pulse.stale { background: #ffcf5c; animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(124, 242, 154, .55); } 70% { box-shadow: 0 0 0 10px rgba(124, 242, 154, 0); } 100% { box-shadow: 0 0 0 0 rgba(124, 242, 154, 0); } }

.readings {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0;
  border-top: 1px solid rgba(255, 255, 255, .28);
  padding-top: 14px;
}
.reading { padding-right: 12px; min-width: 0; }
.reading .k { font-size: var(--f-13); opacity: .82; font-weight: 500; }
.reading .v { font-size: var(--f-26); font-weight: 620; font-variation-settings: 'wdth' 80; line-height: 1.1; white-space: nowrap; }
.reading .v small { font-size: .55em; font-weight: 480; opacity: .85; margin-left: 2px; }
.reading .s { font-size: var(--f-13); opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arrow { display: inline-block; transition: transform .8s cubic-bezier(.2, .8, .2, 1); }

@media (max-width: 900px) {
  .readings { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 14px; }
}
@media (max-width: 520px) {
  .hero { min-height: 640px; }
  .hero-temp { font-size: clamp(7rem, 38vw, 10rem); }
  .readings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reading .v { font-size: var(--f-21); }
}

/* Bright daytime sky needs dark type; set by sky.js from the rendered sky. */
.hero.ink-dark { color: #0f1b33; }
.hero.ink-dark .hero-temp, .hero.ink-dark .hero-line { text-shadow: 0 1px 24px rgba(255, 255, 255, .35); }
.hero.ink-dark .readings { border-top-color: rgba(15, 27, 51, .25); }
.hero.ink-dark .pulse { background: #1f8f3a; }

/* ---- Sections -------------------------------------------------------- */

.section { padding: clamp(48px, 7vw, 88px) 0; border-bottom: 1px solid var(--rule); }
.section:last-of-type { border-bottom: 0; }
.section.alt { background: var(--paper-2); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.section-head h2 { max-width: 22ch; }
.section-head .aside { color: var(--ink-3); font-size: var(--f-15); max-width: 48ch; }
.page-head { padding: clamp(40px, 6vw, 72px) 0 12px; }
.page-head h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); font-variation-settings: 'wdth' 118; font-weight: 700; letter-spacing: -.02em; }
.page-head .lede { margin-top: 14px; }

.grid { display: grid; gap: clamp(20px, 3vw, 36px); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: 1 / -1; }
@media (max-width: 960px) {
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-12 > * { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
}

/* An instrument: the one repeated panel. Plain, no card chrome by default. */
.inst { min-width: 0; }
.inst > h3 { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.inst > h3 .swatch { width: 10px; height: 10px; border-radius: 2px; align-self: center; flex: none; }
.inst .big { font-size: var(--f-52); font-weight: 680; font-variation-settings: 'wdth' 72; line-height: 1; letter-spacing: -.02em; }
.inst .big small { font-size: .4em; font-weight: 480; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.inst .sub { color: var(--ink-2); font-size: var(--f-15); margin-top: 6px; }
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: clamp(16px, 2.4vw, 24px); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 14px 0 0; font-size: var(--f-15); }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 540; }

/* ---- Charts ---------------------------------------------------------- */

.chart { position: relative; width: 100%; }
.chart .u-legend { display: none; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--f-13); color: var(--ink-2); margin: 10px 0 0; padding: 0; list-style: none; }
.chart-legend li { display: flex; align-items: center; gap: 7px; }
.chart-legend .key { width: 18px; height: 0; border-top: 2px solid currentColor; }
.chart-legend .key.dash { border-top-style: dashed; }
.chart-legend .key.band { height: 10px; border: 0; border-radius: 2px; }
.chart-legend .key.bar { width: 10px; height: 10px; border: 0; border-radius: 2px; }
.tip {
  position: absolute; pointer-events: none; z-index: 20; min-width: 150px;
  background: var(--ink); color: var(--ink-inverse); border-radius: 8px; padding: 8px 10px;
  font-size: var(--f-13); line-height: 1.4; box-shadow: var(--shadow); opacity: 0; transition: opacity .12s;
  font-variant-numeric: tabular-nums;
}
.tip.on { opacity: 1; }
.tip .t { font-weight: 640; margin-bottom: 4px; }
.tip .row { display: flex; justify-content: space-between; gap: 14px; }
.tip .row i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.chart-note { font-size: var(--f-13); color: var(--ink-3); margin-top: 8px; }
.seam-label { position: absolute; top: 0; font-size: var(--f-13); color: var(--ink-3); transform: translateX(-50%); pointer-events: none; white-space: nowrap; }

.table-toggle { margin-top: 10px; }
.table-toggle summary { cursor: pointer; color: var(--ink-3); font-size: var(--f-13); width: max-content; }
.table-wrap { overflow-x: auto; margin-top: 8px; max-height: 360px; overflow-y: auto; border: 1px solid var(--rule); border-radius: var(--radius-s); }
table.data { border-collapse: collapse; width: 100%; font-size: var(--f-13); }
table.data th, table.data td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { position: sticky; top: 0; background: var(--paper-2); color: var(--ink-2); font-weight: 600; }

/* ---- Controls --------------------------------------------------------- */

.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; padding: 3px; gap: 2px; background: var(--card); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; color: var(--ink-2); font-size: var(--f-15); font-variation-settings: 'wdth' 94; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--ink-inverse); }
.seg button:hover:not([aria-pressed="true"]) { background: var(--paper-2); }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--rule-strong); background: var(--card); padding: 8px 14px; border-radius: 999px; cursor: pointer; color: var(--ink); text-decoration: none; font-size: var(--f-15); }
.btn:hover { border-color: var(--ink-3); }
.controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
input[type="date"], select { font: inherit; font-size: var(--f-15); color: var(--ink); background: var(--card); border: 1px solid var(--rule-strong); border-radius: 8px; padding: 6px 10px; }

/* ---- Forecast day list ------------------------------------------------ */

.days { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.day {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns: 7.2rem 44px minmax(120px, 1fr) 6.2rem 5.2rem 4.4rem 1.2rem;
  padding: 10px 4px; border-bottom: 1px solid var(--rule); cursor: pointer;
}
.day:hover { background: var(--paper-2); }
.day[aria-expanded="true"] { background: var(--paper-2); }
.day .name { font-weight: 600; font-variation-settings: 'wdth' 96; line-height: 1.2; }
.day .name small { display: block; font-weight: 420; color: var(--ink-3); font-size: var(--f-13); }
.day .icon svg { width: 40px; height: 40px; }
.range { position: relative; height: 34px; }
.range .track { position: absolute; left: 0; right: 0; top: 16px; height: 2px; background: var(--rule); border-radius: 2px; }
.range .unc { position: absolute; top: 12px; height: 10px; border-radius: 5px; background: var(--band-temp); }
.range .bar { position: absolute; top: 13px; height: 8px; border-radius: 4px; }
.range .lo, .range .hi { position: absolute; top: 0; font-size: var(--f-15); font-weight: 620; font-variation-settings: 'wdth' 84; transform: translateX(-50%); line-height: 1; top: -2px; }
.range .lo { color: var(--cold); }
.range .hi { color: var(--temp); }
.range .lo, .range .hi { top: 22px; font-size: var(--f-13); }
.day .rain { color: var(--rain); font-weight: 560; font-variation-settings: 'wdth' 90; text-align: right; line-height: 1.2; }
.day .rain small { display: block; color: var(--ink-3); font-weight: 420; font-size: var(--f-13); }
.day .wind, .day .sun { text-align: right; color: var(--ink-2); font-size: var(--f-15); line-height: 1.2; }
.day .wind small, .day .sun small { display: block; color: var(--ink-3); font-size: var(--f-13); }
.day .chev { color: var(--ink-3); transition: transform .2s; }
.day[aria-expanded="true"] .chev { transform: rotate(90deg); }
.day-detail { grid-column: 1 / -1; padding: 6px 0 14px; cursor: default; }
@media (max-width: 760px) {
  .day { grid-template-columns: 4.6rem 36px minmax(90px, 1fr) 4.2rem 1rem; gap: 8px; }
  .day .wind, .day .sun { display: none; }
  .day .icon svg { width: 34px; height: 34px; }
}

.hours-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 58px; overflow-x: auto; gap: 0; padding-bottom: 6px; scrollbar-width: thin; }
.hour { text-align: center; padding: 8px 2px; border-right: 1px solid var(--rule); font-size: var(--f-13); }
.hour .h { color: var(--ink-3); }
.hour .t { font-size: var(--f-17); font-weight: 620; font-variation-settings: 'wdth' 84; }
.hour .p { color: var(--rain); min-height: 1.4em; }
.hour svg { width: 30px; height: 30px; margin: 2px auto; }

/* ---- Misc ------------------------------------------------------------- */

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: var(--f-13); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap; }
.pill.good { color: var(--good); border-color: currentColor; }
.pill.meh { color: var(--meh); border-color: currentColor; }
.pill.bad { color: var(--bad); border-color: currentColor; }
.events { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.events li { padding: 10px 14px; border-left: 3px solid var(--temp); background: var(--card); border-radius: 0 var(--radius-s) var(--radius-s) 0; font-weight: 520; }

.rain2h { display: grid; grid-template-columns: repeat(24, 1fr); align-items: end; gap: 2px; height: 120px; border-bottom: 1px solid var(--rule-strong); }
.rain2h span { background: var(--rain); border-radius: 3px 3px 0 0; min-height: 0; }
.rain2h span.zero { background: var(--rule); height: 2px !important; border-radius: 1px; }
.rain2h-axis { display: flex; justify-content: space-between; font-size: var(--f-13); color: var(--ink-3); margin-top: 6px; }

.map { height: clamp(320px, 52vw, 520px); border-radius: var(--radius-m); overflow: hidden; border: 1px solid var(--rule); background: var(--paper-3); }
.map-bar { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.map-bar input[type="range"] { flex: 1; min-width: 160px; accent-color: var(--rain); }
.map-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 5.5em; }
.leaflet-container { font: inherit; background: var(--paper-3); }
.nl-marker { font: 600 12px/1 'Archivo', sans-serif; font-variation-settings: 'wdth' 84; color: #fff; padding: 3px 5px; border-radius: 4px; white-space: nowrap; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.nl-marker.bemmel { outline: 2px solid #fff; font-size: 13px; }

.stripes { display: flex; height: 120px; border-radius: var(--radius-s); overflow: hidden; }
.stripes span { flex: 1; }
.stripes-axis { display: flex; justify-content: space-between; font-size: var(--f-13); color: var(--ink-3); margin-top: 6px; }

.cal { display: grid; grid-template-columns: 2.4rem repeat(31, minmax(0, 1fr)); gap: 2px; font-size: 11px; }
.cal .m { color: var(--ink-3); align-self: center; font-size: var(--f-13); }
.cal .c { aspect-ratio: 1; border-radius: 2px; background: var(--paper-3); position: relative; }
.cal .c.none { background: transparent; }
.cal .c:hover { outline: 2px solid var(--ink); z-index: 2; }
.scale { display: flex; align-items: center; gap: 8px; font-size: var(--f-13); color: var(--ink-3); margin-top: 10px; flex-wrap: wrap; }
.scale .ramp { display: flex; height: 10px; width: 220px; border-radius: 2px; overflow: hidden; }
.scale .ramp span { flex: 1; }

.records { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0; border-top: 1px solid var(--rule); }
.rec { padding: 16px 16px 16px 0; border-bottom: 1px solid var(--rule); }
.rec .k { color: var(--ink-3); font-size: var(--f-13); }
.rec .v { font-size: var(--f-33); font-weight: 660; font-variation-settings: 'wdth' 76; line-height: 1.1; }
.rec .v small { font-size: .45em; color: var(--ink-3); font-weight: 460; margin-left: 3px; }
.rec .d { font-size: var(--f-13); color: var(--ink-2); }

.counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 24px; margin-top: 24px; }
.count .n { font-size: var(--f-26); font-weight: 660; font-variation-settings: 'wdth' 80; }
.count .k { font-size: var(--f-13); color: var(--ink-3); line-height: 1.3; }

.skel { color: transparent !important; background: linear-gradient(90deg, var(--paper-2), var(--paper-3), var(--paper-2)); background-size: 200% 100%; animation: sh 1.4s infinite; border-radius: 4px; }
@keyframes sh { to { background-position: -200% 0; } }
.loading { opacity: .55; transition: opacity .2s; }
.error-note { color: var(--bad); font-size: var(--f-15); }

footer.site { padding: 40px 0 56px; color: var(--ink-3); font-size: var(--f-15); border-top: 1px solid var(--rule); }
footer.site .wrap { display: flex; gap: 24px 40px; flex-wrap: wrap; justify-content: space-between; }
footer.site a { color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .range .bar, .rain2h span { forced-color-adjust: none; }
}
@media print {
  .topbar, .hero canvas, .map, .theme-btn, .controls { display: none !important; }
  body { background: #fff; color: #000; }
}

.day.night-row { grid-template-columns: 9rem 7rem 1fr 7rem; cursor: default; }
@media (max-width: 640px) {
  .day.night-row { grid-template-columns: 1fr auto; row-gap: 4px; }
  .day.night-row > :nth-child(3), .day.night-row > :nth-child(4) { grid-column: 1 / -1; text-align: left !important; }
}

/* ---- Chart head and readout (doubles as legend) ---------------------- */
.ch-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.ch-title { font-weight: 620; font-size: var(--f-17); font-variation-settings: 'wdth' 100; }
.ch-title small { font-weight: 450; color: var(--ink-3); font-size: var(--f-15); margin-left: 2px; }
.ch-tbl { border: 1px solid var(--rule); background: transparent; border-radius: 999px; padding: 3px 10px; font-size: var(--f-13); color: var(--ink-3); cursor: pointer; }
.ch-tbl:hover { color: var(--ink); border-color: var(--rule-strong); }
.ch-tbl-under { margin-top: 6px; }
.ch-read { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; min-height: 2.9em; align-content: flex-start; font-size: var(--f-13); color: var(--ink-2); padding: 4px 0 6px; font-variant-numeric: tabular-nums; }
.ch-read .ch-when { font-weight: 650; color: var(--ink); min-width: 7.6em; }
.ch-read .ch-it { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ch-read b { font-weight: 650; color: var(--ink); }
.key { display: inline-block; width: 16px; height: 0; border-top: 2.5px solid currentColor; flex: none; }
.key.dash { border-top-style: dashed; }
.key.band { height: 10px; border: 0; border-radius: 2px; }
.key.bar { width: 9px; height: 9px; border: 0; border-radius: 2px; }
.ch-plot { touch-action: pan-y; }
.chart .u-over { cursor: crosshair; }
@media (max-width: 560px) {
  .ch-read { font-size: 12.5px; gap: 1px 12px; }
  .ch-read .ch-when { width: 100%; }
}

/* ---- Sky map and fullscreen viewer ------------------------------------ */
.allsky { width: 100%; max-width: 620px; aspect-ratio: 1; display: block; margin: 0 auto; touch-action: manipulation; cursor: pointer; }
.btn-big { width: 100%; justify-content: center; padding: 14px 18px; font-size: var(--f-17); font-weight: 620; background: var(--ink); color: var(--ink-inverse); border-color: var(--ink); }
.btn-big:disabled { opacity: .5; cursor: wait; }
.targets { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.target { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem 7rem auto; gap: 12px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--rule); }
.target .nm { font-weight: 620; line-height: 1.25; }
.target .nm small { display: block; font-weight: 420; color: var(--ink-3); font-size: var(--f-13); }
.target .when, .target .alt { font-size: var(--f-15); color: var(--ink-2); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .target { grid-template-columns: minmax(0, 1fr) auto; }
  .target .when, .target .alt { grid-column: 1; font-size: var(--f-13); }
  .target .btn { grid-column: 2; grid-row: 1 / span 3; }
}
html.sv-open, html.sv-open body { overflow: hidden; }
.skyview { position: fixed; inset: 0; z-index: 1000; background: #04070f; color: #e7edf6; touch-action: none; }
.skyview canvas { position: absolute; inset: 0; touch-action: none; }
.sv-top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; gap: 8px; align-items: center; }
.sv-btn { background: rgba(10,16,32,.72); color: inherit; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 8px 14px; font: 600 15px Archivo, sans-serif; cursor: pointer; min-height: 40px; min-width: 40px; }
.sv-find { flex: 1; min-width: 0; background: rgba(10,16,32,.72); color: inherit; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 8px 12px; font: 15px Archivo, sans-serif; min-height: 40px; }
.sv-zoom { display: flex; gap: 6px; }
.sv-reticle { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border: 1.5px solid rgba(255,255,255,.55); border-radius: 50%; pointer-events: none; }
.sv-label { position: absolute; left: 50%; top: calc(50% + 34px); transform: translateX(-50%); text-align: center; pointer-events: none; font: 14px/1.35 Archivo, sans-serif; max-width: 88vw; text-shadow: 0 1px 6px #000; }
.sv-label b { display: block; font-size: 17px; }
.sv-bottom { position: absolute; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); font: 13px/1.4 Archivo, sans-serif; color: rgba(231,237,246,.75); text-align: center; pointer-events: none; }
:root[data-theme="red"] .skyview { background: #000; color: #ff4a36; }
:root[data-theme="red"] .sv-btn, :root[data-theme="red"] .sv-find { background: #0a0000; border-color: #5a120c; color: #ff4a36; }
:root[data-theme="red"] .sv-reticle { border-color: #ff4a36; }
.sv-label { background: rgba(4,7,15,.72); padding: 6px 12px; border-radius: 10px; }
:root[data-theme="red"] .sv-label { background: rgba(0,0,0,.8); }
.sv-calib { pointer-events: auto; display: block; margin: 10px auto 0; }
.sv-calib[hidden] { display: none; }
.panorama { width: 100%; height: 360px; display: block; border-radius: var(--radius-m); cursor: grab; }
.panorama:active { cursor: grabbing; }
.hero-rain { margin: 10px 0 0; font-size: var(--f-17); font-weight: 560; opacity: .95; text-shadow: 0 1px 12px rgba(0,0,0,.25); }
.hero-rain:empty { display: none; }

/* Forecast list and hour strip, second pass */
.conf { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: 0; margin-left: 2px; }
.conf-hoog { background: var(--good); }
.conf-redelijk { background: var(--meh); }
.conf-laag { background: var(--bad); }
.day { scroll-margin-top: 90px; }
.hour .mm { color: var(--rain); font-size: 11px; min-height: 1.2em; }
.hours-strip { mask-image: linear-gradient(90deg, #000 88%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); padding-right: 30px; }
@media (max-width: 760px) {
  .day { grid-template-columns: 4.8rem 34px minmax(80px, 1fr) 4.1rem 3.2rem 1rem; }
  .day .wind { display: block; font-size: var(--f-13); }
  .day .sun { display: none; }
}
table.winter td, table.winter th { white-space: normal; }

/* History, second pass */
.seg button { white-space: nowrap; }
.cal .c.sel { outline: 2px solid var(--ink); z-index: 2; }
.stripes { border: 1px solid var(--rule-strong); gap: 0; }
.table-wrap table.data th:first-child, .table-wrap table.data td:first-child { position: sticky; left: 0; background: var(--card); z-index: 1; }
.table-wrap table.data thead th:first-child { z-index: 3; background: var(--paper-2); }
.table-wrap { background: var(--card); }
@media (max-width: 640px) {
  .records { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec .v { font-size: var(--f-26); }
  .scale { flex-wrap: nowrap; }
  .scale .ramp { width: 120px; }
  .scale span:first-child, .scale span:last-child { white-space: nowrap; font-size: 12px; }
}

/* Red light: keep luminance low, headings too. */
:root[data-theme="red"] .page-head h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
:root[data-theme="red"] .btn-big { background: #1a0200; color: #c8321f; border-color: #5a120c; }

/* Mobile navigation: all five items fit at 360 px. */
@media (max-width: 760px) {
  .nav { gap: 0; }
  .nav a { padding: 6px 8px; font-size: var(--f-15); }
  .theme-btn { padding: 4px 10px; font-size: var(--f-13); }
}
h1, h2 { overflow-wrap: break-word; hyphens: auto; }
@media (max-width: 760px) {
  .day { grid-template-columns: 4.3rem 32px minmax(64px, 1fr) 3.7rem 2.9rem .8rem; gap: 6px; }
  .day .rain, .day .wind { font-size: var(--f-13); }
}
/* Leaflet panes are zero-sized containers; the global max-width rule would
   squash the basemap SVG in our own pane to nothing. */
.leaflet-container svg, .leaflet-container img { max-width: none !important; max-height: none !important; }
.ext .big { margin-top: 4px; }
.ext-runs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 6px; }
.ext-runs .pill { cursor: pointer; background: transparent; font: inherit; font-size: var(--f-13); }
.ext-runs .pill[aria-pressed="true"] { background: var(--ink); color: var(--ink-inverse); border-color: var(--ink); }

/* ---- /widget: one screen, no chrome, scales from a small tile to a full page ---- */
body.bare { margin: 0; background: #22407a; overflow: hidden; }
.wg {
  position: fixed; inset: 0; isolation: isolate; color: #fff; text-decoration: none;
  display: flex; flex-direction: column; gap: 1.2vh; overflow: hidden;
  padding: max(3.5vmin, env(safe-area-inset-top)) 5vmin max(3vmin, env(safe-area-inset-bottom));
  font-size: clamp(12px, 3.6vmin, 22px);
}
.wg canvas.sky { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.wg svg.land { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 26%; z-index: -1; opacity: .9; }
.wg.ink-dark { color: #0f1b33; }
.wg-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 3vmin; }
.wg-temp { display: flex; line-height: .82; font-weight: 760; font-variation-settings: 'wdth' 62; letter-spacing: -.035em; font-size: clamp(64px, 30vmin, 260px); text-shadow: 0 2px 24px rgba(0,0,0,.18); }
.wg-temp .deg { font-size: .38em; font-weight: 420; margin-top: .08em; }
.wg-side { text-align: right; }
.wg-icon svg { width: clamp(40px, 16vmin, 120px); height: auto; margin-left: auto; filter: drop-shadow(0 1px 6px rgba(0,0,0,.2)); }
.wg-icon svg path, .wg-icon svg circle { vector-effect: non-scaling-stroke; }
.wg-range { font-weight: 620; font-variation-settings: 'wdth' 84; font-size: 1.15em; margin-top: .4em; }
.wg-line { margin: 0; font-size: 1.25em; font-weight: 560; line-height: 1.25; max-width: 30ch; text-shadow: 0 1px 12px rgba(0,0,0,.25); }
.wg-rain { margin: 0; font-weight: 540; opacity: .95; }
.wg-rain:empty { display: none; }
.wg-hours { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .4em; margin-top: auto;
  background: rgba(10, 18, 36, .28); border-radius: 14px; padding: .6em .5em; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.wg.ink-dark .wg-hours, .wg.ink-dark .wg-grid { background: rgba(255,255,255,.35); }
.wg-hours > div { text-align: center; font-variant-numeric: tabular-nums; min-width: 0; }
.wg-hours .h { font-size: .8em; opacity: .85; }
.wg-hours svg { width: 2.1em; height: 2.1em; margin: .1em auto; }
.wg-hours .t { font-weight: 650; font-variation-settings: 'wdth' 84; }
.wg-hours .p { font-size: .75em; color: #bfe0ff; min-height: 1.2em; }
.wg.ink-dark .wg-hours .p { color: #1f66b8; }
.wg-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5em .8em;
  background: rgba(10, 18, 36, .28); border-radius: 14px; padding: .7em .9em; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.wg-grid .k { font-size: .75em; opacity: .85; }
.wg-grid .v { font-weight: 640; font-variation-settings: 'wdth' 84; font-size: 1.1em; white-space: nowrap; }
.wg-foot { margin: 0; display: flex; justify-content: space-between; font-size: .75em; opacity: .8; }
/* Short or wide widgets drop the less important rows. */
@media (max-height: 520px) { .wg-grid { display: none; } }
@media (max-height: 360px) { .wg-hours, .wg-rain { display: none; } .wg-line { font-size: 1.05em; } }
@media (max-height: 220px) { .wg-line, .wg-foot { display: none; } }
@media (orientation: landscape) and (min-width: 700px) { .wg-hours { grid-template-columns: repeat(12, 1fr); } }
.steps { padding-left: 1.4em; max-width: 68ch; display: grid; gap: 10px; }
