/* =========================================================
   AG Mobilität Wessum · Designsystem
   Motiv: Fahrbahn, Markierung, Verkehrszeichen.
   Hell = Papier/Beton (Argumente), Dunkel = Asphalt (Physik).
   ========================================================= */

:root {
  /* Farben */
  --paper:      #EDEDE7;
  --paper-2:    #FFFFFF;
  --ink:        #1B1F22;
  --ink-2:      #5B6268;
  --asphalt:    #262B2F;
  --asphalt-2:  #31373C;
  --signal:     #F2B705;   /* Verkehrsgelb: Maßnahme, Aufmerksamkeit */
  --risk:       #BE1622;   /* Schilderrot: nur für Gefahr/Verlust */
  --calm:       #2C7A5B;   /* nur für sicher/erreicht */
  --line:       rgba(27,31,34,.16);
  --line-soft:  rgba(27,31,34,.08);

  /* Typografie */
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --ui:      'Barlow', system-ui, sans-serif;
  --prose:   'Source Serif 4', Georgia, serif;

  --wrap: 1120px;
  --col: 64ch;
  --r: 4px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--prose);
  font-size: 18px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Typo ---------- */

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0 0 .4em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.9rem, 4.4vw, 2.9rem); }
h3 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); }
h4 { font-size: 1.15rem; font-family: var(--ui); font-weight: 600; letter-spacing: 0; }

p { margin: 0 0 1.1em; max-width: var(--col); }
a { color: inherit; text-underline-offset: .18em; text-decoration-thickness: 1px; }
strong { font-weight: 600; }
small { font-family: var(--ui); font-size: .82rem; color: var(--ink-2); line-height: 1.5; }

.lead { font-size: 1.22rem; line-height: 1.55; max-width: 46ch; }

/* Kennzahl / Ziffernblock */
.num {
  font-family: var(--display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: .95;
  display: block;
}

/* Markierungsstrich als Überschriften-Auszeichnung */
.marked { position: relative; padding-top: 22px; }
.marked::before {
  content: ""; position: absolute; top: 0; left: 0;
  width: 68px; height: 7px; background: var(--signal);
}
.marked.is-risk::before { background: var(--risk); }
.marked.is-calm::before { background: var(--calm); }

/* ---------- Layout ---------- */

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }
.wrap-narrow { max-width: 780px; margin: 0 auto; padding: 0 22px; }

section { padding: 62px 0; }
section.tight { padding: 40px 0; }

.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 26px;
}
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 34px; }

.stack > * + * { margin-top: 14px; }

/* ---------- Kopfzeile ---------- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: var(--wrap); margin: 0 auto; padding: 0 22px;
  display: flex; align-items: center; gap: 24px; min-height: 60px;
}
.brand {
  font-family: var(--display); font-weight: 700; font-size: 1.32rem;
  text-decoration: none; letter-spacing: -0.01em; white-space: nowrap;
  display: flex; align-items: center; gap: 10px;
}
.brand .dash { width: 26px; height: 6px; background: var(--ink); flex: none; }
.brand:hover .dash { background: var(--signal); }

.nav {
  display: flex; gap: 4px; margin-left: auto;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  font-family: var(--ui); font-size: .95rem; font-weight: 500;
  text-decoration: none; padding: 8px 12px; white-space: nowrap;
  border-bottom: 3px solid transparent; color: var(--ink-2);
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--signal); }

/* ---------- Asphalt-Flächen ---------- */

.asphalt {
  background: var(--asphalt);
  color: #F2F3F1;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.035) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,.03) 0 1px, transparent 1px);
  background-size: 7px 7px, 11px 11px;
}
.asphalt p { color: rgba(242,243,241,.82); }
.asphalt small { color: rgba(242,243,241,.6); }
.asphalt h2, .asphalt h3 { color: #fff; }

/* ---------- Karten & Boxen ---------- */

.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 24px;
}
.card h3 { margin-bottom: .3em; }
.card p:last-child { margin-bottom: 0; }

.card-link {
  display: flex; flex-direction: column; gap: 8px;
  text-decoration: none; color: inherit;
  border-top: 6px solid var(--ink);
  background: var(--paper-2);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 22px;
  transition: border-top-color .15s ease, transform .15s ease;
}
.card-link:hover, .card-link:focus-visible { border-top-color: var(--signal); }
.card-link .go { font-family: var(--ui); font-weight: 600; font-size: .92rem; margin-top: auto; padding-top: 12px; }

.note {
  border-left: 4px solid var(--signal);
  background: rgba(242,183,5,.09);
  padding: 16px 18px;
  font-size: .96rem;
}
.note.is-risk { border-left-color: var(--risk); background: rgba(190,22,34,.06); }
.note p:last-child { margin-bottom: 0; }
.note h4 { margin-bottom: .35em; }

/* Kennzahlenzeile */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 2px; background: var(--line); border: 1px solid var(--line); }
.figures > div { background: var(--paper-2); padding: 18px; }
.asphalt .figures { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.12); }
.asphalt .figures > div { background: var(--asphalt-2); }
.figures .num { font-size: clamp(2rem, 4.4vw, 2.9rem); }
.figures span.lbl { font-family: var(--ui); font-size: .78rem; font-weight: 500; color: var(--ink-2); display: block; margin-top: 8px; }
.asphalt .figures span.lbl { color: rgba(242,243,241,.65); }

/* ---------- Bedienelemente ---------- */

.controls { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-end; }
.field { flex: 1 1 190px; min-width: 0; }
.field label,
.fieldset-label {
  display: block; font-family: var(--ui); font-size: .84rem; font-weight: 600;
  margin-bottom: 7px; color: var(--ink-2);
}
.asphalt .field label { color: rgba(242,243,241,.72); }

input[type="number"], input[type="text"], select {
  width: 100%; padding: 10px 12px; font-family: var(--ui); font-size: 1rem;
  background: var(--paper-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r);
}
.asphalt input, .asphalt select { background: var(--asphalt-2); color: #fff; border-color: rgba(255,255,255,.2); }

input[type="range"] {
  width: 100%; -webkit-appearance: none; appearance: none; background: transparent; height: 26px; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: rgba(255,255,255,.28); border-radius: 2px; }
input[type="range"]::-moz-range-track { height: 4px; background: rgba(255,255,255,.28); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; margin-top: -10px; border-radius: 50%;
  background: var(--signal); border: 3px solid var(--asphalt); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--signal); border: 3px solid var(--asphalt); cursor: pointer;
}
body:not(.on-asphalt) .light-range::-webkit-slider-runnable-track { background: var(--line); }
.light-range::-webkit-slider-thumb { border-color: var(--paper); }
.light-range::-moz-range-thumb { border-color: var(--paper); }
.light-range::-moz-range-track { background: var(--line); }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--ui); font-weight: 600; font-size: .96rem;
  padding: 12px 20px; border-radius: var(--r); border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper); cursor: pointer; text-decoration: none;
}
.btn:hover { background: #000; }
.btn-signal { background: var(--signal); border-color: var(--signal); color: #241C00; }
.btn-signal:hover { background: #ffc927; }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn-ghost:hover { background: rgba(127,127,127,.12); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.asphalt .seg { border-color: rgba(255,255,255,.22); }
.seg button {
  font-family: var(--ui); font-weight: 600; font-size: .88rem; padding: 9px 15px;
  background: transparent; border: 0; color: inherit; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--signal); color: #241C00; }

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

/* ---------- Fahrbahn-Visualisierung ---------- */

.road { margin: 26px 0 0; }
.road-row { margin-bottom: 20px; }
.road-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-family: var(--ui); font-size: .9rem; font-weight: 600; margin-bottom: 6px;
}
.road-head .val { font-variant-numeric: tabular-nums; }
.lane {
  position: relative; height: 46px; background: var(--asphalt-2);
  border-top: 1px dashed rgba(255,255,255,.22); border-bottom: 1px dashed rgba(255,255,255,.22);
  overflow: hidden;
}
.seg-react, .seg-brake {
  position: absolute; top: 0; bottom: 0; left: 0;
  transition: width .5s ease, left .5s ease;
}
.seg-react { background: repeating-linear-gradient(135deg, rgba(242,183,5,.85) 0 8px, rgba(242,183,5,.6) 8px 16px); }
.seg-brake { background: rgba(190,22,34,.85); }
.seg-brake.is-calm { background: rgba(44,122,91,.9); }
.car {
  position: absolute; top: 50%; transform: translate(-100%, -50%);
  font-family: var(--ui); font-weight: 700; font-size: .78rem; color: #fff;
  background: #11151A; padding: 4px 8px; border-radius: 3px; white-space: nowrap;
  transition: left .5s ease;
}
.marker {
  position: absolute; top: -6px; bottom: -6px; width: 3px; background: #fff;
  transition: left .5s ease;
}
.marker::after {
  content: attr(data-label); position: absolute; left: 7px; top: -2px;
  font-family: var(--ui); font-size: .74rem; font-weight: 600; color: #fff; white-space: nowrap;
}
.ruler { position: relative; height: 26px; margin-top: 4px; }
.ruler i {
  position: absolute; top: 0; width: 1px; height: 7px; background: rgba(255,255,255,.4);
  font-style: normal;
}
.ruler i::after {
  content: attr(data-m); position: absolute; left: 3px; top: 7px;
  font-family: var(--ui); font-size: .72rem; color: rgba(242,243,241,.55);
}

/* ---------- Tabellen & Listen ---------- */

table { width: 100%; border-collapse: collapse; font-family: var(--ui); font-size: .95rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; font-size: .82rem; color: var(--ink-2); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 12px 0; border-bottom: 1px solid var(--line-soft); max-width: var(--col); }
ul.plain li:last-child { border-bottom: 0; }

.src {
  font-family: var(--ui); font-size: .82rem; color: var(--ink-2);
  border-left: 2px solid var(--line); padding-left: 10px; margin-top: 10px; max-width: var(--col);
}
.asphalt .src { color: rgba(242,243,241,.6); border-left-color: rgba(255,255,255,.25); }
.src a { color: inherit; }

.tag {
  display: inline-block; font-family: var(--ui); font-size: .72rem; font-weight: 600;
  padding: 3px 8px; border: 1px solid var(--line); border-radius: 100px; color: var(--ink-2);
}
.tag.is-local { border-color: var(--signal); background: rgba(242,183,5,.16); color: #6b5200; }

details { border-top: 1px solid var(--line); padding: 12px 0; }
details summary {
  cursor: pointer; font-family: var(--ui); font-weight: 600; font-size: .95rem; list-style: none;
  display: flex; justify-content: space-between; gap: 12px;
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; font-family: var(--display); font-size: 1.3rem; line-height: 1; }
details[open] summary::after { content: "–"; }
details .body { padding-top: 10px; font-size: .96rem; }

/* ---------- Karte / Bild ---------- */

figure { margin: 0; }
figure img { width: 100%; height: auto; display: block; border: 1px solid var(--line); background: #dcdcd6; }
figcaption { font-family: var(--ui); font-size: .84rem; color: var(--ink-2); padding-top: 8px; }
.img-missing {
  padding: 40px 20px; text-align: center; font-family: var(--ui); font-size: .9rem;
  color: var(--ink-2); border: 1px dashed var(--line);
}

/* ---------- Tabs ---------- */

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button {
  font-family: var(--display); font-size: 1.5rem; font-weight: 600;
  background: none; border: 0; border-bottom: 5px solid transparent;
  padding: 8px 20px 10px 0; margin-right: 26px; cursor: pointer; color: var(--ink-2);
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--signal); }

/* ---------- Fußzeile ---------- */

footer.site {
  background: var(--asphalt); color: rgba(242,243,241,.75);
  font-family: var(--ui); font-size: .9rem; padding: 46px 0 60px;
}
footer.site a { color: #fff; }
footer.site .foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 28px; }
footer.site h4 { color: #fff; }

/* ---------- Hilfsklassen ---------- */

.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.center { text-align: center; }
.risk { color: var(--risk); } .calm { color: var(--calm); } .signal { color: var(--signal); }
.muted { color: var(--ink-2); }
.ui { font-family: var(--ui); }
.skip {
  position: absolute; left: -9999px; top: 0; background: var(--signal); color: #241C00;
  padding: 12px 18px; font-family: var(--ui); font-weight: 600; z-index: 100;
}
.skip:focus { left: 12px; top: 12px; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  section { padding: 46px 0; }
  .tabs button { font-size: 1.25rem; margin-right: 16px; }
}

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

@media print {
  .topbar, .nav, .btn { display: none; }
  body { background: #fff; font-size: 11pt; }
  .asphalt { background: #fff; color: #000; }
}
