/* Tokens. Dark mode is selected deliberately, not an automatic inversion:
   each value is chosen against its own surface. Chart colours are validated
   for >=3:1 non-text contrast (WCAG 1.4.11) against both surfaces:
   light  line 4.30:1, rain 5.26:1 on #fcfcfb
   dark   line 4.79:1, rain 5.83:1 on #1a1a19 */
:root {
  --surface: #fcfcfb;
  --plane: #f4f4f1;
  --ink: #0b0b0b;
  --ink-2: #47463f;
  --rule: #d7d7d0;
  --accent: #1c5cab;
  --warn-bg: #fdf0ea;
  --warn-ink: #8a2f10;
  --chart-line: #2a78d6;
  --chart-rain: #256abf;
  --chart-grid: #d7d7d0;
  /* Icon colours, each validated >=3:1 against --surface (#fcfcfb).
     The sun is warm gold rather than yellow because no recognisably yellow
     hue reaches 3:1 on a near-white surface (#eda100 is 2.11, #c98500 2.99). */
  --icon-sun: #b87700;    /* 3.60:1 */
  --icon-moon: #6f6f66;   /* 4.94:1 */
  --icon-cloud: #6f6f66;  /* 4.94:1 */
  --icon-rain: #256abf;   /* 5.26:1 */
  --icon-snow: #2a78d6;   /* 4.30:1 */
  --icon-bolt: #b87700;   /* 3.60:1 */
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #1a1a19;
    --plane: #0d0d0d;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --rule: #3a3a37;
    --accent: #86b6ef;
    --warn-bg: #3a1f14;
    --warn-ink: #f4b79b;
    --chart-line: #3987e5;
    --chart-rain: #5598e7;
    --chart-grid: #3a3a37;
    /* Each validated >=3:1 against the dark --surface (#1a1a19). Dark is
       chosen, not an inversion: the sun can be bright here. */
    --icon-sun: #f5c542;    /* 10.74:1 */
    --icon-moon: #e8e7dc;   /* 14.01:1 */
    --icon-cloud: #c3c2b7;  /*  9.72:1 */
    --icon-rain: #5598e7;   /*  5.83:1 */
    --icon-snow: #9ec5f4;   /*  9.74:1 */
    --icon-bolt: #f5c542;   /* 10.74:1 */
  }
}

/* 20px base; everything in rem so browser zoom reflows instead of clipping. */
html { font-size: 20px; }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  /* A 600-character ?ort= is one unbreakable "word"; without this it forces
     horizontal page scrolling, which spec 8 forbids. */
  overflow-wrap: anywhere;
}
main {
  max-width: 44rem;      /* ~60ch of prose */
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}
section {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin: 2.5rem 0;      /* generous vertical rhythm — the "calm" part */
}
h1 { font-size: 2.25rem; line-height: 1.2; margin: 1rem 0 0.25rem; }
h2 { font-size: 1.75rem; margin: 0 0 1rem; }
h3 { font-size: 1.25rem; margin: 0 0 0.25rem; }
p { margin: 0 0 0.75rem; }

.skip {
  position: absolute; left: -9999px;
  background: var(--accent); color: var(--surface);
  padding: 0.75rem 1rem;
}
.skip:focus { left: 1rem; top: 1rem; z-index: 10; }

.suche label { display: block; font-weight: 600; margin-bottom: 0.5rem; }
.suche-zeile { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.suche input {
  flex: 1 1 14rem; font: inherit; padding: 0.75rem;
  border: 2px solid var(--rule); border-radius: 0.375rem;
  background: var(--surface); color: var(--ink);
}
.suche button {
  font: inherit; font-weight: 600; padding: 0.75rem 1.25rem;
  border: 2px solid var(--accent); border-radius: 0.375rem;
  background: var(--accent); color: var(--surface); cursor: pointer;
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.stand { color: var(--ink-2); margin-bottom: 0; }
.jetzt-temp { font-size: 4rem; line-height: 1; font-weight: 700; margin: 0; }
.jetzt-lage { font-size: 1.5rem; margin: 0.25rem 0 1rem; }
.jetzt-satz { font-size: 1.125rem; }

.fakten { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.5rem; margin: 0; }
.fakten dt { color: var(--ink-2); }
.fakten dd { margin: 0; font-weight: 600; }

.teile, .tage { list-style: none; padding: 0; margin: 0; }
.teile li, .tage li {
  padding: 1rem 0; border-top: 1px solid var(--rule);
}
.teile li:first-child, .tage li:first-child { border-top: 0; }
.teil-temp, .spanne { font-size: 1.5rem; font-weight: 700; margin: 0 0 0.25rem; }
.teil-regen { color: var(--ink-2); }
.tage .heute { border-left: 6px solid var(--accent); padding-left: 1rem; }
.bericht { color: var(--ink-2); }

.warnung { background: var(--warn-bg); border-color: var(--warn-ink); }
.warnung h2, .warnung h3, .warnung p { color: var(--warn-ink); }
.stufe { font-weight: 700; }

/* The chart's own scroll container. SVG text scales with the rendered width,
   so an unbounded 100% chart drops its 26-unit labels to 7.4px at 375px and
   5.9px at 320px — and 320px is what a 1280px screen becomes at the 400% zoom
   this page targets. min-width floors the rendered width at 800px instead,
   holding the scale factor at 0.8: 20.8px of label text at every viewport,
   measured. The floor is px, not rem, on purpose — the SVG's own units are
   absolute, so a rem floor would move with the root size the breakpoint
   below changes (50rem = 1000px at the 20px base; 40rem = 720px at the 18px
   narrow base, which is 18.7px of label text, under the floor).
   The chart's container is 778px at a 1280px viewport, so the region scrolls
   by ~22px there — the overflow stays inside this labelled, keyboard-focusable
   region, and the PAGE itself never scrolls horizontally at any width. */
.chart-scroll { overflow-x: auto; }
.chart-scroll:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chart {
  width: 100%; min-width: 800px; height: auto; display: block;
  margin-bottom: 1rem;
}
/* These are SVG user units, not CSS pixels: text inside a viewBox'd SVG scales
   with the SVG's rendered width. The chart renders ~780-840px against a
   1000-unit viewBox (~0.8x), so these are sized up to clear the 20px floor
   in effect rather than only on paper. */
.chart-label { fill: var(--ink-2); font-size: 26px; }
.chart-value { fill: var(--ink); font-size: 30px; font-weight: 700; }

.tabelle summary { cursor: pointer; font-weight: 600; padding: 0.5rem 0; }
table { border-collapse: collapse; width: 100%; }
caption { text-align: left; color: var(--ink-2); padding-bottom: 0.5rem; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--rule); }

footer { max-width: 44rem; margin: 0 auto; padding: 0 1rem 3rem; color: var(--ink-2); }
footer a { color: var(--accent); }
.hinweis { color: var(--ink-2); }
.fehler { font-size: 1.25rem; overflow-wrap: anywhere; }

@media (max-width: 30rem) { html { font-size: 18px; } }

/* Condition icons. Decorative reinforcement beside the German word, which
   always carries the meaning — see webapp/icons.py. Sized in rem so browser
   zoom grows them with the text. */
.icon { display: inline-block; vertical-align: middle; flex: none; }
.jetzt-lage .icon { width: 3rem; height: 3rem; margin-right: 0.5rem; }
.lage .icon { width: 2rem; height: 2rem; margin-right: 0.4rem; }
.lage { display: flex; align-items: center; gap: 0; }
.jetzt-lage { display: flex; align-items: center; }

/* Section tabs. Real links first, upgraded to a tablist by tabs.js. Targets
   are deliberately large — this audience should not have to aim. */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0 0;
}
.tabs a {
  flex: 1 1 auto;
  text-align: center;
  padding: 0.85rem 1rem;
  min-height: 3rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--rule);
  border-radius: 0.5rem;
  white-space: nowrap;
}
.tabs a:hover { border-color: var(--accent); }
.tabs a.aktiv {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}
/* The active tab is never signalled by colour alone. */
.tabs a.aktiv::before { content: "\2713\00a0"; }
.panel[hidden] { display: none; }

/* Chart tooltip. The hit strips carry an SVG <title> so a tooltip exists with
   scripting off; chart-tooltip.js swaps that for this, which is large enough
   to actually read. */
.chart-hit { cursor: crosshair; }
.chart-hit.aktiv { fill: var(--rule); fill-opacity: 0.35; }
.chart-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 0.5rem 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--ink-2);
  border-radius: 0.375rem;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.25);
}

/* Regenradar. The page's one piece of third-party content, and the only
   place an external request is made — see the note rendered beside it. */
.radar-rahmen {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 24rem;
  border: 2px solid var(--rule);
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--plane);
}
.radar-rahmen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* The Heute table: hours across the top, measures down the side. Nine columns
   at this type size will not fit a narrow window, so it scrolls inside its own
   labelled, keyboard-reachable box rather than widening the page. */
.stunden-tabelle { overflow-x: auto; margin-bottom: 1rem; }
.stunden-tabelle:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.stunden-tabelle table { border-collapse: collapse; width: auto; min-width: 100%; }
.stunden-tabelle th,
.stunden-tabelle td {
  padding: 0.6rem 0.75rem;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--rule);
}
.stunden-tabelle th[scope="row"] {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--surface);
  border-right: 2px solid var(--rule);
  color: var(--ink-2);
  font-weight: 600;
}
/* The hours are a scale, not data: normal weight, so the temperatures
   below them carry the emphasis. */
.stunden-tabelle th[scope="col"] { font-size: 1.1rem; font-weight: 400; }
.stunden-tabelle tr:nth-child(2) td { font-size: 1.35rem; font-weight: 700; }
.stunden-tabelle .icon { width: 2.25rem; height: 2.25rem; }

/* Read by a screen reader, not shown. The icon row would otherwise be an
   empty cell for anyone not looking at it. */
.nur-vorlesen {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
