/* ==========================================================================
   Stau auf der Schiene — Datenjournalismus One-Pager
   ========================================================================== */

:root{
  --bg:        #060606;
  --bg-raise:  #101009;
  --panel:     #121210;
  --fg:        #f4f4ef;
  --muted:     #b3b3aa;
  --faint:     #8b8b81;
  --yellow:    #fffd47;
  --alert:     #ff5a3c;
  --line:      rgba(255,255,255,.14);
  --line-soft: rgba(255,255,255,.07);

  --font-head: "Space Grotesk", "Arial Narrow", Arial, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --space-1: .5rem;
  --space-2: 1rem;
  --space-3: 1.75rem;
  --space-4: clamp(2.5rem, 5vw, 4rem);
  --space-5: clamp(4rem, 9vw, 7rem);
  --space-6: clamp(6rem, 14vw, 10rem);

  --content-w: 1180px;

  color-scheme: dark;
}

*, *::before, *::after{ box-sizing: border-box; }
figure{ margin: 0; }
html{ scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{ animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

body{
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img{ max-width: 100%; display: block; }

a{ color: var(--yellow); }

::selection{ background: var(--yellow); color: #111; }

:focus-visible{
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3{
  font-family: var(--font-head);
  color: var(--yellow);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0;
}

h2, h3{ font-size: clamp(1.75rem, 3.6vw, 2.9rem); }

p{ margin: 0 0 1em; }
p:last-child{ margin-bottom: 0; }

.wrap{
  max-width: var(--content-w);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}

.text-col{
  margin-inline: auto;
  font-size: 1.25rem;
}

.kicker{
  display: inline-flex;
  align-items: center;
  gap: .6em;
  font-family: var(--font-head);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--alert);
  margin-bottom: var(--space-2);
}
.kicker::before{
  content: "";
  width: 20px; height: 2px;
  background: var(--alert);
  display: inline-block;
}

section{ position: relative; }

/* ---------- Top bar ---------- */
.topbar{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem clamp(1.25rem, 5vw, 3rem);
  font-family: var(--font-head);
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg);
  background: linear-gradient(to bottom, rgba(0,0,0,.55), transparent);
  pointer-events: none;
}
.topbar .mark{ font-weight: 700; }
.topbar .mark span{ color: inherit; }
.topbar .meta{ color: var(--muted); pointer-events: auto; }
.progress{
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--yellow);
  z-index: 101;
  transition: width .08s linear;
}

/* ---------- Hero ---------- */
.hero{
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  background: #000;
  overflow: hidden;
}
.hero-media{
  position: absolute; inset: 0;
  overflow: hidden;
}
.hero-media img{
  width: 100%; height: 100%;
  object-fit: cover;
  filter: brightness(.72) saturate(1.05);
}
.hero-media::after{
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(to top, var(--bg) 4%, rgba(6,6,6,.6) 34%, rgba(6,6,6,.2) 58%, rgba(6,6,6,.5) 100%);
}
.hero-credit{
  position: absolute;
  z-index: 3;
  right: clamp(1.25rem, 5vw, 3rem);
  bottom: 6rem;
  color: rgba(244,244,239,.65);
  font-size: .64rem;
}
.hero-content{
  position: relative;
  z-index: 2;
  padding: var(--space-5) clamp(1.25rem, 5vw, 3rem) var(--space-5);
  width: 100%;
  text-align: center;
}
.hero h1{
  font-size: clamp(2.6rem, 8.5vw, 6.4rem);
  max-width: 16ch;
  margin-inline: auto;
}
.hero .sub{
  margin-top: var(--space-2);
  margin-inline: auto;
  max-width: 46ch;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  color: var(--fg);
}
.hero .byline{
  margin-top: var(--space-3);
  font-size: .85rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3em;
}
.scroll-cue{
  position: absolute;
  bottom: var(--space-3);
  right: clamp(1.25rem, 5vw, 3rem);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.scroll-cue .line{
  width: 1px; height: 34px;
  background: linear-gradient(var(--muted), transparent);
  animation: scrollcue 1.8s ease-in-out infinite;
}
@keyframes scrollcue{
  0%{ transform: scaleY(0); transform-origin: top; }
  50%{ transform: scaleY(1); transform-origin: top; }
  50.01%{ transform-origin: bottom; }
  100%{ transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- Generic sections ---------- */
.section{ padding-block: clamp(2.25rem, 4.5vw, 3.5rem); }
.section.tight{ padding-block: clamp(1.5rem, 3vw, 2.25rem); }

.section-head{
  max-width: 46rem;
  margin-bottom: var(--space-2);
}
.section-head p{ color: var(--muted); font-size: 1.05rem; max-width: 58ch; }
.section-head.center{ margin-inline: auto; text-align: center; }

/* ---------- Stats ---------- */
.stats-row{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
@media (max-width: 760px){
  .stats-row{ grid-template-columns: repeat(2, 1fr); }
}
.stat{
  background: var(--bg);
  padding: var(--space-4) var(--space-3);
}
.stat .num{
  font-family: var(--font-head);
  font-size: clamp(2.1rem, 4.2vw, 3.4rem);
  color: var(--yellow);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat .lbl{
  margin-top: .6rem;
  color: var(--muted);
  font-size: .92rem;
  max-width: 22ch;
}

/* ---------- Chart ---------- */
.chart-card{
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: clamp(1.25rem, 3vw, 2.25rem);
}
.chart-svg{ width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid-line{ stroke: var(--line-soft); stroke-width: 1; }
.chart-svg .axis-label{ fill: var(--faint); font-family: var(--font-body); font-size: 11px; }
.chart-svg .axis-title{ fill: var(--muted); font-family: var(--font-body); font-size: 11px; font-weight: 600; letter-spacing: .03em; }
.chart-svg .area{ fill: url(#areaGradient); }
.chart-svg .line{ fill: none; stroke: var(--yellow); stroke-width: 2.5; }
.chart-svg .dot{ fill: var(--yellow); }
.chart-svg .dot-end{ fill: var(--yellow); }
.chart-svg .bar{ fill: var(--yellow); transition: fill .12s ease; }
.chart-svg .bar.bar-hover{ fill: var(--alert); }
.chart-svg .val-label{ fill: var(--fg); font-family: var(--font-head); font-weight: 700; font-size: 13px; }
.chart-svg .guide{ stroke: var(--fg); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0; pointer-events:none; }
.chart-svg .hover-dot{ fill: var(--alert); opacity: 0; pointer-events:none; }
.chart-hit{ fill: transparent; cursor: crosshair; }
.chart-tooltip{
  position: absolute;
  background: #000;
  border: 1px solid var(--line);
  padding: .5rem .75rem;
  font-size: .8rem;
  border-radius: 4px;
  pointer-events: none;
  transform: translate(-50%, -120%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .12s ease;
  z-index: 5;
}
.chart-wrap{ position: relative; }
.source-line{
  margin-top: var(--space-2);
  color: var(--faint);
  font-size: .78rem;
}

/* ---------- Map ---------- */
.map-card{
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: clamp(1rem, 2.5vw, 1.75rem);
}
.map-hint{
  color: var(--muted);
  font-size: .9rem;
  margin-top: var(--space-2);
}
.rail-map{
  width: 100%;
  height: clamp(420px, 62vh, 640px);
  border-radius: 4px;
  background: #16160f;
}
.rail-map .leaflet-tile-pane{ display: none; }
.rail-map .leaflet-control-zoom a{
  background: var(--panel);
  color: var(--fg);
  border-color: var(--line) !important;
}
.rail-map .leaflet-control-zoom a:hover{ background: #1c1c16; }
.rail-tip.leaflet-tooltip{
  background: #000;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: .8rem;
  padding: .4rem .6rem;
  box-shadow: none;
}
.rail-tip.leaflet-tooltip::before{ display: none; }
.map-error{
  color: var(--faint);
  font-size: .9rem;
  max-width: 46ch;
  padding: var(--space-4) 0;
}

.map-info-box{
  background: #000;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-2);
  min-height: 3.2rem;
  display: flex;
  align-items: center;
}
.map-info-box .empty{ color: var(--faint); font-size: .9rem; }
.map-info-box .info-row{
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .3rem 1rem;
  width: 100%;
}
.map-info-box .info-nr{
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .06em;
  color: var(--alert);
  white-space: nowrap;
}
.map-info-box .info-name{
  color: var(--fg);
  font-weight: 600;
  flex: 1 1 auto;
}
.map-info-box .info-status{
  font-size: .82rem;
  color: var(--muted);
  white-space: nowrap;
}

.city-label{
  color: rgba(244,244,239,.85);
  font-family: var(--font-body);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 3px #000;
}
.city-label .dot{
  display: inline-block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(244,244,239,.85);
  margin-right: 4px;
  vertical-align: middle;
}

.map-filters{
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: var(--space-3);
}
.chip{
  font-family: var(--font-head);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: .45rem 1rem;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.chip:hover{ border-color: var(--muted); color: var(--fg); }
.chip.on{ border-color: var(--muted); }
.chip[data-status="rot"].on{ background: var(--alert); border-color: var(--alert); color: #1a0a05; }
.chip[data-status="gelb"].on{ background: var(--yellow); border-color: var(--yellow); color: #1a1a05; }
.chip[data-status="normal"].on{ background: var(--muted); border-color: var(--muted); color: #111; }

.map-legend-list{
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-top: var(--space-2);
}
.map-legend{
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--faint);
  font-size: .82rem;
}
.map-legend .dot{
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block;
  flex: none;
}
.map-legend .dot.rot{ background: var(--alert); }
.map-legend .dot.gelb{ background: var(--yellow); }
.map-legend .dot.normal{ background: var(--muted); }


/* ---------- Footer ---------- */
footer{
  border-top: 1px solid var(--line);
  padding-block: var(--space-4);
  color: var(--faint);
  font-size: .85rem;
  text-align: center;
}
.footer-about h4{
  font-family: var(--font-head);
  color: var(--muted);
  font-size: .74rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin: 0 0 .75rem;
}
.footer-about p{ margin: 0 0 .4rem; }
.back-top{
  display: inline-block;
  margin-top: var(--space-4);
  color: var(--yellow);
  font-family: var(--font-head);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  border-top: 1px solid var(--line);
  padding-top: var(--space-2);
}

/* ---------- Reveal on scroll ---------- */
.reveal{
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1);
}
.reveal.in{ opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce){
  .reveal{ opacity: 1; transform: none; }
}
