/* ============================================================
   Design-Tokens
   ============================================================ */
:root {
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-raised: #212120;
  --ink: #ffffff;
  --ink-secondary: #c3c2b7;
  --ink-muted: #898781;
  --gridline: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --shadow: rgba(0, 0, 0, 0.45);

  --hitze: #ec5f12;
  --hitze-trend: #ffab7a;
  --sauhitze: #ee4143;
  --sauhitze-trend: #ff9e9e;
  --tropen: #2f8dec;
  --tropen-trend: #8ec1ff;
  --mittel: #ec5f12;
  --mittel-trend: #ffab7a;
  --max: #ee4143;
  --max-trend: #ff9e9e;
  --min: #2f8dec;
  --min-trend: #8ec1ff;
  --niederschlag: #2f8dec;
  --sonne: #f5a623;

  --success: #0ca30c;

  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --content-width: 920px;
}

@media (prefers-color-scheme: light) {
  :root {
    --page: #f9f9f7;
    --surface: #fcfcfb;
    --surface-raised: #ffffff;
    --ink: #0b0b0b;
    --ink-secondary: #52514e;
    --ink-muted: #6d6b66;
    --gridline: #e1e0d9;
    --baseline: #c3c2b7;
    --border: rgba(11, 11, 11, 0.10);
    --shadow: rgba(11, 11, 11, 0.12);

    --hitze: #f04a00;
    --hitze-trend: #8f2b00;
    --sauhitze: #d90429;
    --sauhitze-trend: #820019;
    --tropen: #0d6fe8;
    --tropen-trend: #0a4494;
    --mittel: #f04a00;
    --mittel-trend: #8f2b00;
    --max: #d90429;
    --max-trend: #820019;
    --min: #0d6fe8;
    --min-trend: #0a4494;
    --niederschlag: #0d6fe8;
    --sonne: #ee8b00;

    --success: #006300;
  }
}

/* ============================================================
   Basis
   ============================================================ */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a { color: inherit; }

.content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

h1, h2, h3 { font-weight: 650; letter-spacing: -0.01em; }

/* ============================================================
   Kopfnavigation
   ============================================================ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  background: color-mix(in srgb, var(--page) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.topnav__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 650;
  text-decoration: none;
}

.topnav__logo {
  width: 26px;
  height: 26px;
  display: block;
}

.topnav__links { display: flex; gap: 1.25rem; }

.topnav__links a {
  text-decoration: none;
  color: var(--ink-secondary);
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.topnav__links a:hover,
.topnav__links a[aria-current="page"] {
  color: var(--ink);
  border-color: var(--hitze);
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  min-height: 78svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1.5rem;
  overflow: hidden;
  isolation: isolate;
}

.hero__kicker {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hitze);
  margin: 0 0 0.75rem;
}

.hero h1 {
  font-size: clamp(2.4rem, 6.5vw, 4.4rem);
  font-weight: 800;
  line-height: 1.08;
  margin: 0 0 1.1rem;
  max-width: 18ch;
  color: var(--ink);
}

.hero h1 .akzent { color: var(--hitze); }

/* Klimastreifen: ein Streifen je Jahr, Farbe = echte Sommermitteltemperatur */
.hero__stripes {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: clamp(72px, 12svh, 120px);
  display: flex;
}

.hero__stripes .stripe {
  flex: 1 1 0;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero__stripes.is-visible .stripe { transform: scaleY(1); }

.hero__stripes .stripe:hover,
.hero__stripes .stripe:focus-visible {
  filter: brightness(1.18);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .hero__stripes .stripe { transform: none; transition: none; }
}

.hero p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--ink-secondary);
  max-width: 46ch;
  margin: 0 auto;
}

.hero__scroll-hint {
  position: absolute;
  bottom: calc(clamp(72px, 12svh, 120px) + 1.25rem);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  animation: bob 2.2s ease-in-out infinite;
}

.hero__scroll-hint svg { width: 16px; height: 16px; }

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 6px); }
}

/* ============================================================
   Besonderheiten
   ============================================================ */
.highlights {
  padding: 3rem 0 1rem;
}

.highlights__title {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 1rem;
}

.highlights__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.highlight-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 4px solid var(--hitze);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 10px 28px -14px var(--shadow);
}

.highlight-card__label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin: 0 0 0.35rem;
}

.highlight-card__value {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--hitze);
  font-variant-numeric: proportional-nums;
}

.highlight-card__unit {
  font-size: 0.95rem;
  color: var(--ink-secondary);
  font-weight: 500;
  margin-left: 0.35rem;
}

.highlight-card__text {
  margin: 0.6rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-secondary);
}

/* ============================================================
   Kennzahlen-Leiste (Stat-Tiles)
   ============================================================ */
.stats {
  padding: 2rem 0 4rem;
}

.stats__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  text-align: center;
}

.stat-tile__value {
  font-size: clamp(2.3rem, 5vw, 3.4rem);
  font-weight: 800;
  color: var(--stat-color, var(--ink));
}

.stat-tile__label {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  color: var(--ink-secondary);
}

/* ============================================================
   Chart-Sektionen
   ============================================================ */
.chart-section {
  padding: 5rem 0;
  border-top: 1px solid var(--border);
}

.chart-section__eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--chart-accent, var(--ink-muted));
  background: color-mix(in srgb, var(--chart-accent, var(--ink-muted)) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--chart-accent, var(--ink-muted)) 30%, transparent);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  margin: 0 0 0.8rem;
}

.chart-section h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  font-weight: 800;
  margin: 0 0 0.75rem;
}

.chart-section__desc {
  color: var(--ink-secondary);
  max-width: 65ch;
  margin: 0 0 2rem;
}

.chart-figure {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--chart-accent, var(--border));
  border-radius: 14px;
  padding: 1.5rem 1.5rem 1rem;
}

.chart-svg-wrap { position: relative; }

.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }

.chart-bar {
  transition: opacity 0.15s;
  cursor: pointer;
}
.chart-bar:hover, .chart-bar:focus-visible { opacity: 0.75; outline: none; }

.chart-bar--partial { }

.chart-trend-line {
  fill: none;
  stroke-width: 3px;
  stroke-linecap: round;
}

.chart-series-line {
  fill: none;
  stroke-width: 2.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-band { opacity: 0.14; }

.chart-axis text {
  fill: var(--ink-muted);
  font-size: 10px;
  font-family: var(--font);
}

.chart-axis line,
.chart-gridline {
  stroke: var(--gridline);
  stroke-width: 1;
}

.chart-baseline { stroke: var(--baseline); stroke-width: 1; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 1rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-secondary);
}

.chart-legend__item { display: flex; align-items: center; gap: 0.45rem; }

.chart-legend__swatch {
  width: 14px; height: 3px; border-radius: 2px;
  background: var(--swatch-color, currentColor);
}
.chart-legend__swatch--dashed {
  background: none;
  border-top: 2px dashed var(--swatch-color, currentColor);
  height: 0;
}

.chart-footnote {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin: 0.75rem 0 0;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
  box-shadow: 0 10px 30px -10px var(--shadow);
  transform: translate(-50%, -100%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 5;
}
.chart-tooltip--visible { opacity: 1; }
.chart-tooltip__value { font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-tooltip__label { color: var(--ink-muted); margin-left: 0.35rem; }

.chart-table-toggle {
  margin-top: 0.75rem;
}
.chart-table-toggle summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--ink-secondary);
}
.chart-table-toggle table {
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  width: 100%;
}
.chart-table-toggle caption { text-align: left; color: var(--ink-muted); margin-bottom: 0.4rem; }
.chart-table-toggle th, .chart-table-toggle td {
  text-align: right;
  padding: 0.3rem 0.6rem;
  border-bottom: 1px solid var(--gridline);
  font-variant-numeric: tabular-nums;
}
.chart-table-toggle th:first-child, .chart-table-toggle td:first-child { text-align: left; }
.chart-table-toggle .chart-table-scroll { max-height: 260px; overflow-y: auto; }

/* ============================================================
   Rekord-Kacheln (Stationsübersicht)
   ============================================================ */
.records__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.record-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 8px 24px -14px var(--shadow);
}

.record-card__label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin: 0 0 0.4rem;
}

.record-card__value {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--record-color, var(--ink));
}

.record-card__date {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-secondary);
}

/* ============================================================
   Kalender-Heatmap
   ============================================================ */
.heatmap-wrap { overflow-x: auto; }
.heatmap-cell { cursor: pointer; }
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 0.75rem;
}
.heatmap-legend__swatch { width: 12px; height: 12px; border-radius: 2px; }

/* ============================================================
   Methodik / Footer
   ============================================================ */
.methodik {
  padding: 4rem 0;
  border-top: 1px solid var(--border);
  color: var(--ink-secondary);
  font-size: 0.92rem;
}

.methodik dt { font-weight: 650; color: var(--ink); margin-top: 1rem; }
.methodik dd { margin: 0.25rem 0 0; }

.site-footer {
  padding: 2.5rem 1.5rem 4rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.82rem;
}
.site-footer a { color: var(--ink-secondary); }

/* ============================================================
   Scroll-Reveal
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  .chart-figure { padding: 1rem 1rem 0.75rem; }
  .chart-section { padding: 3.5rem 0; }
  .topnav { font-size: 0.8rem; padding: 0.7rem 1rem; }
  .topnav__links { gap: 0.6rem; }
}
