/* Wetterbuch Dresden – gemeinsames Stylesheet */
:root {
  color-scheme: light;
  --bg: #f1f3f4;
  --surface: #ffffff;
  --ink: #101c26;
  --ink-2: #44515d;
  --muted: #5f6b76;
  --line: #dce1e5;
  --neutral: #e6e9ec;          /* Mittelpunkt der Abweichungsskala */
  --temp: #eb6834;
  --rain: #2a78d6;
  --third: #1baf7a;
  --dry: #eda100;
  --dull: #6250d6;
  --warm-pole: #eb6834;
  --cold-pole: #2a78d6;
  --focus: #2a78d6;
  --font-head: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #11171c; --surface: #19212a; --ink: #eef1f3; --ink-2: #bcc5cc; --muted: #929da7;
    --line: #2b353e; --neutral: #2b353e;
    --temp: #d95926; --rain: #3987e5; --third: #199e70; --dry: #c98500; --dull: #9085e9;
    --warm-pole: #d95926; --cold-pole: #3987e5; --focus: #6aa6f0;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11171c; --surface: #19212a; --ink: #eef1f3; --ink-2: #bcc5cc; --muted: #929da7;
  --line: #2b353e; --neutral: #2b353e;
  --temp: #d95926; --rain: #3987e5; --third: #199e70; --dry: #c98500; --dull: #9085e9;
  --warm-pole: #d95926; --cold-pole: #3987e5; --focus: #6aa6f0;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 var(--font-body);
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

/* ---------- Kopf / Navigation ---------- */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1120px; margin: 0 auto; padding: 14px 16px 0; }
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand b { font: 600 1.35rem/1.2 var(--font-head); letter-spacing: .005em; }
.brand span { color: var(--muted); font-size: .9rem; }
nav { display: flex; gap: 2px; margin-top: 10px; overflow-x: auto; scrollbar-width: thin; }
nav a {
  text-decoration: none; padding: 9px 14px; color: var(--ink-2); white-space: nowrap;
  border-bottom: 3px solid transparent; font-size: .95rem;
}
nav a:hover { color: var(--ink); }
nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--temp); }

main { max-width: 1120px; margin: 0 auto; padding: 28px 16px 64px; }
h1 { font: 600 clamp(1.7rem, 4vw, 2.4rem)/1.15 var(--font-head); margin: 0 0 6px; }
h2 { font: 600 1.35rem/1.25 var(--font-head); margin: 0 0 4px; }
h3 { font: 600 1rem/1.3 var(--font-body); margin: 0 0 2px; }
.lede { color: var(--ink-2); max-width: 66ch; margin: 0 0 24px; }
.note { color: var(--muted); font-size: .88rem; max-width: 80ch; }
section + section { margin-top: 40px; }

/* ---------- Bedienelemente ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; margin: 0 0 18px; }
.controls label { display: grid; gap: 4px; font-size: .85rem; color: var(--ink-2); }
select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 32px 8px 12px; min-width: 150px;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

/* ---------- Karten / Diagramme ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 18px 14px; }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid4 { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chart-box { position: relative; height: 340px; margin-top: 10px; }
.chart-box.tall { height: 380px; }
.sub { color: var(--muted); font-size: .85rem; margin: 0; }

.stats { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 0 0 18px; }
.stat { display: grid; }
.stat small { color: var(--muted); font-size: .8rem; }
.stat b { font: 600 1.25rem/1.3 var(--font-head); }
.stat em { font-style: normal; color: var(--ink-2); font-size: .85rem; }

/* ---------- Tabellen ---------- */
.tablewrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: .94rem; }
table.data th, table.data td { padding: 7px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { font-weight: 600; color: var(--ink-2); font-size: .85rem; border-bottom: 2px solid var(--line); }
table.data tbody tr:hover { background: color-mix(in srgb, var(--neutral) 55%, transparent); }
table.data tr.sum td { font-weight: 600; border-top: 2px solid var(--line); }
table.data td.bar { width: 34%; padding-left: 0; }
.mini { display: block; height: 8px; border-radius: 0 4px 4px 0; background: var(--temp); }
.mini.rain { background: var(--rain); }
.diff { border-radius: 4px; }
td.partial, th.partial { font-style: italic; color: var(--muted); }

.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* ---------- Klimastreifen ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px; align-items: start; }
.now { padding: 4px 0; }
.now .when { color: var(--ink-2); margin: 0 0 14px; }
.big { display: flex; gap: 32px; flex-wrap: wrap; }
.big div { display: grid; }
.big b { font: 600 clamp(2.6rem, 6vw, 3.8rem)/1 var(--font-head); letter-spacing: -.01em; }
.big small { color: var(--ink-2); font-size: .95rem; }
.big i { font-style: normal; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.hero .panel { padding: 14px 14px 10px; }
.heat { display: grid; grid-template-columns: 38px repeat(12, minmax(0, 1fr)); gap: 2px; font-size: .72rem; color: var(--muted); }
.heat .h { text-align: center; padding-bottom: 2px; }
.heat .y { text-align: right; padding-right: 6px; line-height: 17px; }
.heat .c { height: 17px; border-radius: 2px; }
.heat .c.none { background: transparent; border: 1px dashed var(--line); }
.legend-scale { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .78rem; color: var(--muted); }
.legend-scale .bar { flex: 0 1 220px; height: 8px; border-radius: 4px; }

.tiles { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 8px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.tile small { color: var(--muted); display: block; }
.tile b { font: 600 1.7rem/1.2 var(--font-head); }
.tile span { display: block; color: var(--ink-2); font-size: .9rem; }
.links { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 8px; }
.links a { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.links a:hover { border-color: var(--muted); }
.links b { display: block; font: 600 1.05rem var(--font-head); }
.links span { color: var(--ink-2); font-size: .9rem; }

.tip {
  position: fixed; z-index: 10; pointer-events: none; background: var(--ink); color: var(--bg);
  font-size: .8rem; line-height: 1.4; padding: 6px 9px; border-radius: 6px; display: none; max-width: 220px;
}
footer { max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; color: var(--muted); font-size: .85rem; }

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .grid2, .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .tiles, .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .links { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .chart-box, .chart-box.tall { height: 300px; }
  .panel { padding: 14px 12px 10px; }
  table.data th, table.data td { padding: 6px 8px; }
}
@media print {
  .top nav, .controls { display: none; }
  body { background: #fff; }
}

/* ---------- Pflegebereich  ---------- */
:root { --bad: #e34948; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) { --bad: #e66767; } }
:root[data-theme="dark"] { --bad: #e66767; }
.narrow { max-width: 640px; }
.form { display: grid; gap: 16px; }
.form .row { display: flex; flex-wrap: wrap; gap: 16px; }
.form label { display: grid; gap: 4px; font-size: .85rem; color: var(--ink-2); }
.form .row label { flex: 1 1 160px; }
input[type=text], input[type=password], textarea {
  font: inherit; color: var(--ink); background: var(--surface); width: 100%;
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
}
textarea { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .85rem; line-height: 1.4; min-height: 190px; white-space: pre; overflow: auto; }
input::placeholder, textarea::placeholder { color: var(--muted); }
.check { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px !important; font-size: .95rem !important; color: var(--ink) !important; }
.check input { width: 18px; height: 18px; accent-color: var(--rain); }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; color: #fff; background: var(--rain);
  border: 1px solid transparent; border-radius: 8px; padding: 9px 18px; text-decoration: none; display: inline-block;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--line); font-weight: 500; }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn.danger { background: transparent; color: var(--ink); border-color: var(--bad); font-weight: 500; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.alert { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--third); border-radius: 8px; padding: 10px 14px; margin: 0 0 18px; }
.alert.err { border-left-color: var(--bad); }
.alert ul { margin: 4px 0 0; padding-left: 20px; }
.hint { color: var(--ink-2); font-size: .9rem; margin: 0; min-height: 1.4em; }
nav .spacer { flex: 1; }
nav form { margin: 0; display: flex; }
nav button { font: inherit; font-size: .95rem; background: none; border: 0; border-bottom: 3px solid transparent; padding: 9px 14px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
nav button:hover { color: var(--ink); }
.inline { display: inline; margin: 0; }
details summary { cursor: pointer; color: var(--ink-2); }

/* ---------- Jahresstreifen (Seite „Seit 1934“) ---------- */
.grid3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stripe-label { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 4px; font-size: .9rem; }
.stripe-label span { color: var(--muted); font-size: .8rem; }
.stripes { display: flex; gap: 1px; height: 46px; }
.stripes .s { flex: 1 1 0; min-width: 0; }
.stripes .s.none { background: repeating-linear-gradient(135deg, var(--line) 0 2px, transparent 2px 5px); }
.stripe-axis { position: relative; height: 18px; margin-top: 4px; font-size: .75rem; color: var(--muted); }
.stripe-axis span { position: absolute; transform: translateX(-50%); }
details.all summary { cursor: pointer; padding: 4px 0; }
@media (max-width: 900px) { .grid3 { grid-template-columns: minmax(0, 1fr); } }

/* Export (Bild/PDF) */
.hasexp { position: relative; }
.hasexp h2 { padding-right: 150px; }
.exportbar { position: absolute; right: 14px; top: 12px; display: flex; gap: 6px; align-items: center; }
.exportmsg { font-size: .8rem; color: var(--muted); }
@media print { .exportbar { display: none; } }

.rangectl { margin: 12px 0 0; }
.rc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: .85rem; color: var(--muted); }
.rc-row label { display: inline-flex; gap: 6px; }
.rc-row label b { color: var(--ink); font-variant-numeric: tabular-nums; min-width: 2.6em; }
.rc-row input[type=range] { flex: 1 1 140px; max-width: 280px; accent-color: var(--accent, currentColor); }
.stripe-label { flex-wrap: wrap; gap: 4px 12px; }
.stripe-legend { display: inline-flex; align-items: center; gap: 8px; font-size: .75rem; }
.stripe-legend .bar { width: 120px; height: 8px; border-radius: 4px; display: inline-block; }

.footlinks { max-width: 1100px; margin: 0 auto; padding: 0 16px 28px; display: flex; gap: 16px; font-size: .85rem; }
.footlinks a { color: var(--muted); }

#stripePanel.hasexp { padding-top: 40px; }
