/* Wetterstation Pablo — Chrome nach dataviz-Referenzpalette */
:root {
  --page:        #f9f9f7;
  --surface:     #fcfcfb;
  --ink:         #0b0b0b;
  --ink-2:       #52514e;
  --muted:       #898781;
  --grid:        #e1e0d9;
  --baseline:    #c3c2b7;
  --ring:        rgba(11,11,11,0.10);

  --c-temp:      #e34948;
  --c-dew:       #2a78d6;
  --c-rain:      #2a78d6;
  --c-wind:      #4a3aa7;
  --c-gust:      #e87ba4;
  --c-press:     #008300;
  --c-hum:       #1baf7a;
  --c-solar:     #eb6834;

  --c-icon:      #2a78d6;   /* Modellvergleich, 6er-Set validiert light+dark */
  --c-iconeu:    #1baf7a;
  --c-gfs:       #eb6834;
  --c-ecmwf:     #4a3aa7;
  --c-aifs:      #eda100;
  --c-harmonie:  #e87ba4;
  --c-ukmo:      #008300;
  --c-uol:       #898781;   /* Kontextlinie Uni Oldenburg (Emphasis-Grau) */

  --accent:      #1c5cab;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page:      #0d0d0d;
    --surface:   #1a1a19;
    --ink:       #ffffff;
    --ink-2:     #c3c2b7;
    --muted:     #898781;
    --grid:      #2c2c2a;
    --baseline:  #383835;
    --ring:      rgba(255,255,255,0.10);

    --c-temp:    #e66767;
    --c-dew:     #3987e5;
    --c-rain:    #3987e5;
    --c-wind:    #9085e9;
    --c-gust:    #d55181;
    --c-press:   #2ea52e;
    --c-hum:     #199e70;
    --c-solar:   #d95926;

    --c-icon:    #3987e5;
    --c-iconeu:  #199e70;
    --c-gfs:     #d95926;
    --c-ecmwf:   #9085e9;
    --c-aifs:    #c98500;
    --c-harmonie:#d55181;
    --c-ukmo:    #2ea52e;
    --c-uol:     #898781;

    --accent:    #86b6ef;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.45;
}

main {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 16px calc(32px + env(safe-area-inset-bottom));
}

/* ---- Kopf ---- */
.site-head { padding: calc(14px + env(safe-area-inset-top)) 16px 0; }
.head-inner {
  max-width: 1060px; margin: 0 auto;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.eyebrow {
  margin: 0; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
}
h1 { margin: 2px 0 0; font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.updated { margin: 0 0 3px; font-size: 13px; color: var(--ink-2); text-align: right; }
.updated .dot { color: #0ca30c; }
.updated .dot.stale { color: #d03b3b; }

/* ---- Jetztwetter ---- */
.now {
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: 16px;
  padding: 18px 18px 14px;
  margin-top: 16px;
}
.now-hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.hero-value { font-size: 64px; font-weight: 650; letter-spacing: -0.03em; line-height: 1; }
.hero-unit  { font-size: 26px; font-weight: 500; color: var(--ink-2); vertical-align: 28px; }
.hero-sub   { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }
.hero-range { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.compass-wrap { text-align: center; }
#compass { width: 108px; height: 108px; display: block; margin: 0 auto; }
.compass-label { margin: 4px 0 0; font-size: 14px; font-weight: 600; }
.compass-sub   { margin: 0; font-size: 12px; color: var(--muted); }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.tile {
  background: var(--page);
  border: 1px solid var(--ring);
  border-radius: 12px;
  padding: 10px 12px;
}
.tile .t-label { font-size: 11.5px; color: var(--muted); margin: 0; }
.tile .t-value { font-size: 19px; font-weight: 620; margin: 2px 0 0; }
.tile .t-value small { font-size: 12px; font-weight: 400; color: var(--ink-2); }
.tile .t-extra { font-size: 11.5px; color: var(--ink-2); margin: 1px 0 0; }

/* ---- Abschnitte ---- */
section { margin-top: 30px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
h2 { margin: 0; font-size: 17px; font-weight: 650; }
.muted-note { font-size: 12.5px; font-weight: 400; color: var(--muted); }

/* Zeitraum-Filter: eine Reihe über allen Charts */
.range-row { display: flex; gap: 4px; flex-wrap: wrap; }
.range-btn {
  appearance: none; border: 1px solid var(--ring); background: var(--surface);
  color: var(--ink-2); border-radius: 999px; padding: 5px 12px;
  font: inherit; font-size: 13px; cursor: pointer;
}
.range-btn:hover { color: var(--ink); }
.range-btn[aria-selected="true"] {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .range-btn[aria-selected="true"] { color: #0d0d0d; }
}

/* ---- Tab-Navigation ---- */
.tabbar {
  display: flex; gap: 4px;
  max-width: 1060px; margin: 14px auto 0; padding: 4px;
  background: var(--surface); border: 1px solid var(--ring); border-radius: 999px;
  width: fit-content;
}
.tab-btn {
  appearance: none; border: none; background: none; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--ink-2);
  display: flex; align-items: center; gap: 7px;
  padding: 7px 18px; border-radius: 999px;
}
.tab-btn svg { width: 17px; height: 17px; }
.tab-btn[aria-selected="true"] {
  background: var(--accent); color: #fff; font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .tab-btn[aria-selected="true"] { color: #0d0d0d; }
}

/* Mobil: feste Leiste unten (daumenfreundlich) */
@media (max-width: 759px) {
  .tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    width: auto; max-width: none; margin: 0; border-radius: 0;
    border: none; border-top: 1px solid var(--ring);
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface);
  }
  .tab-btn { flex: 1; flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; }
  .tab-btn svg { width: 21px; height: 21px; }
  .tab-btn[aria-selected="true"] { background: none; color: var(--accent); }
  main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .site-foot { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}

.tab-panel > section:first-child { margin-top: 16px; }

/* ---- Warnbanner (DWD-Stufen über Status-Palette) ---- */
.warn {
  border-radius: 14px; border: 1px solid var(--ring);
  padding: 12px 16px; margin-top: 16px;
  background: var(--surface);
  border-left: 6px solid var(--warn-color, #fab219);
}
.warn summary { cursor: pointer; font-weight: 650; font-size: 14.5px; list-style: none; }
.warn summary::-webkit-details-marker { display: none; }
.warn .warn-icon { margin-right: 8px; }
.warn .warn-meta { font-size: 12.5px; color: var(--ink-2); margin: 3px 0 0 26px; }
.warn .warn-body { font-size: 13.5px; margin: 8px 0 0 26px; color: var(--ink-2); }

/* ---- Vorhersage: 7-Tage-Karten ---- */
.day-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(122px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.day-card {
  background: var(--surface); border: 1px solid var(--ring); border-radius: 14px;
  padding: 12px 12px 10px; text-align: center;
}
.day-card .d-name { margin: 0; font-size: 12.5px; font-weight: 650; }
.day-card .d-icon { font-size: 30px; line-height: 1.4; }
.day-card .d-desc { margin: 0; font-size: 11px; color: var(--muted); min-height: 2.6em; }
.day-card .d-temp { margin: 4px 0 0; font-size: 14.5px; font-weight: 620; }
.day-card .d-temp .lo { color: var(--ink-2); font-weight: 400; }
.day-card .d-extra { margin: 3px 0 0; font-size: 11.5px; color: var(--ink-2); }
.day-card .d-sun { margin: 3px 0 0; font-size: 10.5px; color: var(--muted); }

.modell-head { margin-top: 20px; }
h3 { margin: 0; font-size: 14.5px; font-weight: 650; }

/* Modell-Chips: Legende und Auswahl in einem */
.model-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.model-chip {
  appearance: none; border: 1px solid var(--ring); background: var(--surface);
  color: var(--ink-2); border-radius: 999px; padding: 5px 12px;
  font: inherit; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.model-chip .key {
  width: 14px; height: 3px; border-radius: 2px;
  background: var(--chip-color); opacity: 0.35;
}
.model-chip[aria-pressed="true"] { color: var(--ink); border-color: var(--chip-color); }
.model-chip[aria-pressed="true"] .key { opacity: 1; }
.model-chip:hover { color: var(--ink); }

.runs-line { margin: 0 2px 10px; font-size: 11.5px; color: var(--muted); }

/* ---- Regenradar ---- */
#radar-map {
  height: 380px; border-radius: 16px; border: 1px solid var(--ring);
  z-index: 0; background: var(--surface);
}
.radar-ctl { display: flex; align-items: center; gap: 10px; }
.attrib { font-size: 11px; color: var(--muted); margin: 6px 2px 0; }
.attrib a { color: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  #radar-map .leaflet-tile { filter: brightness(0.7) contrast(1.1); }
  .leaflet-container { background: #0d0d0d; }
}

/* ---- Charts ---- */
.chart-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 760px) { .chart-grid { grid-template-columns: 1fr 1fr; } }

.chart-card {
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: 16px;
  padding: 14px 14px 8px;
  transition: opacity 0.2s;
}
.chart-card.loading { opacity: 0.45; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.chart-title { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--ink-2); }
.legend .key {
  display: inline-block; width: 14px; height: 2px; border-radius: 1px;
  vertical-align: 3px; margin-right: 5px;
}
.chart-card svg.chart { display: block; width: 100%; height: auto; touch-action: pan-y; }

/* Tooltip */
.tooltip {
  position: fixed; z-index: 10; pointer-events: none;
  background: var(--surface); border: 1px solid var(--ring); border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.14);
  padding: 8px 11px; font-size: 12.5px; min-width: 130px;
}
.tooltip .tt-time { color: var(--muted); margin: 0 0 4px; font-size: 11.5px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 7px; margin: 2px 0; }
.tooltip .tt-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tooltip .tt-val { font-weight: 650; margin-left: auto; font-variant-numeric: tabular-nums; }
.tooltip .tt-name { color: var(--ink-2); }

/* ---- Tabelle ---- */
.table-scroll {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--ring); border-radius: 16px;
  max-height: 430px; overflow-y: auto;
}
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 8px 14px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th {
  position: sticky; top: 0; background: var(--surface);
  color: var(--muted); font-weight: 550; font-size: 12px;
  border-bottom: 1px solid var(--grid);
}
tbody td { border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }

/* ---- Rekorde ---- */
.records .t-extra { font-variant-numeric: tabular-nums; }

/* ---- Fuß ---- */
.site-foot {
  max-width: 1060px; margin: 0 auto;
  padding: 8px 16px calc(28px + env(safe-area-inset-bottom));
  color: var(--muted); font-size: 12.5px;
}
.site-foot p { margin: 3px 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
