/* Startseite – als Geschichte in vier Kapiteln.
   Grundfunktionen laufen ohne JavaScript: Lightbox per :target, Kapitel-Markierung,
   Fortschritt und Einblendungen per CSS-Scroll-Timeline. Browser ohne Scroll-Timeline
   (z. B. Firefox) zeigen die Seite vollständig, nur ohne Bewegung.
   home.js ergänzt Tastatur, Wischen und die Kapitel-Markierung als Ersatz. */

:root { --gutter: clamp(16px, 4vw, 48px); }

html { scroll-padding-top: 5.5rem; scrollbar-gutter: stable; }
html:has(.lightbox:target) { overflow: hidden; }

.home {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  timeline-scope: --ch1, --ch2, --ch3, --ch4, --story;
}

/* Höhenlinien hinter dem Prolog */
.contours {
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  width: 100%;
  height: 100dvh;
  opacity: .45;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent);
  mask-image: linear-gradient(to bottom, #000 40%, transparent);
}
.contours path { fill: none; stroke: var(--sand-light); stroke-width: 1; }

/* ---------- Kopfleiste ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: .7rem var(--gutter);
  border-bottom: 1px solid rgb(198 178 146 / .6);
}
/* Milchglas als eigene Ebene: backdrop-filter direkt auf .topbar würde die fixierte
   Kapitel-Leiste (Handy, unten) an der Kopfleiste statt am Bildschirm ausrichten. */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgb(244 241 234 / .86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.topbar .logo img { height: clamp(36px, 5vw, 46px); }

.status {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  padding: .45em .9em;
  border: 1px solid var(--merlot);
  border-radius: 999px;
  color: var(--merlot);
  background: var(--paper);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.status i {
  width: .55em; height: .55em;
  border-radius: 50%;
  background: var(--merlot);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .25; } }

/* Maßstabsleiste als Lese-Fortschritt */
.scalebar {
  display: none;
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 4px;
  background: repeating-linear-gradient(90deg, var(--cod) 0 48px, var(--sand) 48px 96px);
  transform-origin: left;
}

/* Kapitel-Navigation: auf dem Handy schwebende Leiste unten */
.chapters {
  --on-bg: var(--paper);
  --on-fg: var(--merlot);
  position: fixed;
  left: 50%;
  bottom: max(.9rem, env(safe-area-inset-bottom));
  translate: -50% 0;
  z-index: 50;
  display: flex;
  gap: .2rem;
  padding: .3rem;
  border-radius: 999px;
  background: rgb(46 63 70 / .94);
  box-shadow: 0 .8rem 2rem -.6rem rgb(46 63 70 / .6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.chapters a {
  padding: .6em .85em;
  border-radius: 999px;
  color: var(--paper);
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s, color .2s;
}
.chapters a span { display: none; }
.chapters a:hover { background: rgb(244 241 234 / .14); }
.chapters a[aria-current], .chapters a[aria-current]:hover { background: var(--on-bg); color: var(--on-fg); }

@media (min-width: 860px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
  }
  .topbar .status { justify-self: end; }
  .chapters {
    --on-bg: var(--merlot);
    --on-fg: var(--paper);
    position: static;
    translate: none;
    padding: 0;
    background: none;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .chapters a { color: var(--cod); font-size: .78rem; }
  /* Nummer: Terrakotta, im aktiven (Merlot-)Zustand Gold, damit sie lesbar bleibt */
  .chapters a span { display: inline; color: var(--num, var(--terra)); margin-right: .25em; }
  .chapters a[aria-current] { --num: var(--gold); }
  .chapters a:hover { background: var(--cream); color: var(--merlot); }
}

/* ---------- Grundlayout ---------- */

main {
  width: min(100% - 2 * var(--gutter), 1320px);
  margin-inline: auto;
}

.eyebrow, .waypoint, .kind {
  font-family: var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--terra);
}

.button {
  display: inline-block;
  padding: .85em 1.6em;
  border: 1.5px solid var(--merlot);
  border-radius: 999px;
  background: var(--merlot);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, translate .15s;
}
.button:hover { background: var(--terra); border-color: var(--terra); translate: 0 -2px; }
.button.ghost { background: transparent; color: var(--merlot); }
.button.ghost:hover { background: var(--cream); color: var(--merlot); border-color: var(--merlot); }

/* ---------- Prolog ---------- */

.hero {
  display: grid;
  gap: clamp(2.5rem, 6vh, 3.5rem);
  align-items: center;
  padding-block: clamp(2.5rem, 8vh, 5rem) clamp(4rem, 10vh, 6rem);
}
.hero .eyebrow { font-size: clamp(.8rem, 1.6vw, .95rem); margin-bottom: 1.2rem; }
h1 {
  font-size: clamp(2.4rem, min(7vw, 9vh), 4.6rem);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -.03em;
}
h1 em { font-style: normal; color: var(--merlot); }
.lead {
  margin-top: clamp(1rem, 3vh, 1.6rem);
  max-width: 34em;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.5;
}
.lead strong { font-weight: 700; color: var(--merlot); }
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin-top: clamp(1.4rem, 4vh, 2.2rem);
}

.hero-visual { position: relative; }

/* Browserfenster-Rahmen für Screenshots */
.frame {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--cod);
  border-radius: 10px;
  background: var(--paper);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1.5rem 3rem -1.5rem rgb(46 63 70 / .45);
  transition: translate .25s ease, box-shadow .25s ease;
  cursor: zoom-in;
}
.frame:hover {
  translate: 0 -4px;
  box-shadow: 0 2rem 3.5rem -1.5rem rgb(46 63 70 / .55);
}
.frame img { display: block; width: 100%; height: auto; }
.frame-bar {
  display: flex;
  align-items: center;
  gap: .35rem;
  height: 1.6rem;
  padding: 0 .7rem;
  background: var(--cream);
  border-bottom: 1px solid rgb(46 63 70 / .2);
}
.frame-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--sand-light); }
.frame-bar i:first-child { background: var(--terra); }
.frame-bar b {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: .66rem;
  font-weight: 400;
  color: var(--terra);
}
.zoom {
  position: absolute;
  right: .8rem;
  top: 2.4rem;
  padding: .4em .8em;
  border-radius: 999px;
  background: var(--cod);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: .72rem;
  opacity: 0;
  translate: 0 -.3rem;
  transition: opacity .2s, translate .2s;
}
.frame:hover .zoom, .frame:focus-visible .zoom { opacity: 1; translate: 0 0; }
/* Touch: kein Hinweis-Badge, er läge dauerhaft über dem Screenshot */
@media (hover: none) { .zoom { display: none; } }

/* Sprechblase mit der Beispielfrage */
.ask {
  position: relative;
  width: fit-content;
  max-width: calc(100% - 1.5rem);
  margin: -1.6rem 0 0 .75rem;
  padding: .8rem 1rem;
  border: 1px solid var(--cod);
  border-radius: 14px 14px 14px 4px;
  background: var(--paper);
  box-shadow: 0 1rem 2rem -1rem rgb(46 63 70 / .5);
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.45;
}
.ask-a { margin-top: .35rem; font-weight: 700; color: var(--moss); }

@media (min-width: 1100px) {
  .hero {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(2rem, 4vw, 4rem);
    min-height: calc(100dvh - 5rem);
    padding-block: 3rem 5rem;
  }
  .ask { position: absolute; left: -2.5rem; bottom: -2rem; margin: 0; }
}

/* ---------- Kapitel ---------- */

.story { position: relative; }
.chapter { padding-block: clamp(3.5rem, 11vh, 7rem); }
#problem { view-timeline: --ch1 block; }
#funktionen { view-timeline: --ch2 block; }
#wege { view-timeline: --ch3 block; }
#kontakt { view-timeline: --ch4 block; }

.chapter-head { margin-bottom: clamp(1.8rem, 5vh, 3rem); }
.waypoint {
  position: relative;
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: .76rem;
}
.pin {
  flex: none;
  width: 14px; height: 14px;
  --pin-on: var(--merlot);
  border: 3px solid var(--merlot);
  border-radius: 50%;
  background: var(--paper);
}
.chapter h2 {
  margin-top: .6rem;
  max-width: 18em;
  font-size: clamp(1.9rem, 4.6vw, 3.3rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -.025em;
}

/* Route am linken Rand: gestrichelt, füllt sich beim Lesen */
@media (min-width: 1100px) {
  .story {
    --route-x: 1rem;
    padding-left: 4.5rem;
    view-timeline: --story block;
  }
  .story::before, .story::after {
    content: "";
    position: absolute;
    top: clamp(3.5rem, 11vh, 7rem);
    bottom: 0;
    left: calc(var(--route-x) - 1px);
    width: 2px;
  }
  .story::before {
    background: repeating-linear-gradient(to bottom, var(--sand) 0 8px, transparent 8px 16px);
  }
  .story::after { display: none; background: var(--terra); transform-origin: top; }
  .pin {
    position: absolute;
    left: calc(var(--route-x) - 4.5rem - 7px);
    width: 16px; height: 16px;
    margin-left: -1px;
    z-index: 1;
  }
}

/* Kapitel 01: Probleme, daneben die Lösung (erscheint beim Scrollen) */
.problems { list-style: none; counter-reset: problem; }
.problems li {
  counter-increment: problem;
  display: grid;
  gap: .7rem 3rem;
  padding: clamp(1.4rem, 4vh, 2.2rem) 0;
  border-top: 1px solid var(--sand-light);
  view-timeline: --row block;
}
.problems li:last-child { border-bottom: 1px solid var(--sand-light); }
.problems li::before {
  content: counter(problem, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--terra);
  padding-top: .4em;
}
/* Sora hat keinen Kursivschnitt – aufrecht setzen, sonst schrägt der Browser künstlich an */
.problem {
  font-size: clamp(1.15rem, 2.1vw, 1.5rem);
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: -.01em;
  color: var(--moss);
}
.answer h3 {
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--merlot);
}
.answer p { margin-top: .4rem; font-size: 1rem; line-height: 1.6; max-width: 30em; }

/* Handy: Lösung als abgesetzter Block, damit Problem und Antwort nicht ineinanderlaufen */
@media (max-width: 799px) {
  .problems li { gap: .9rem; padding-block: 1.9rem; }
  .problems li::before { padding-top: 0; }
  .answer {
    margin-top: .2rem;
    padding: 1rem 1.1rem 1.1rem;
    border-left: 3px solid var(--merlot);
    border-radius: 0 10px 10px 0;
    background: rgb(234 217 192 / .5);
  }
  .answer h3 { font-size: 1.12rem; line-height: 1.3; }
  .answer p { font-size: .95rem; line-height: 1.55; }
}
@media (min-width: 800px) {
  .problems li { grid-template-columns: 5rem minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}

/* Fazit unter den Problemen: das Kostenargument */
.bottom-line {
  margin-top: clamp(1.6rem, 4vh, 2.4rem);
  max-width: 40em;
  font-size: clamp(1.1rem, 1.9vw, 1.35rem);
  line-height: 1.45;
  color: var(--cod);
}
.bottom-line strong { color: var(--merlot); }
@media (min-width: 800px) {
  .bottom-line { margin-left: 8rem; }
}

/* Kapitel 02: Was GISvox kann – Überblick als Chips, dann Scroll-Geschichte */
.chapter-lead {
  margin-top: 1rem;
  max-width: 36em;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.55;
  color: var(--moss);
}
/* Überblick als Inhaltsverzeichnis: untereinander, am Desktop zweispaltig (spaltenweise gelesen) */
.feature-index {
  list-style: none;
  display: grid;
  max-width: 54rem;
  margin-bottom: clamp(2rem, 6vh, 3.5rem);
  border-top: 1px solid var(--sand-light);
}
.feature-index li { border-bottom: 1px solid var(--sand-light); }
.feature-index a {
  display: flex;
  align-items: baseline;
  gap: .8em;
  padding: .8rem .2rem;
  color: var(--cod);
  font-size: .98rem;
  text-decoration: none;
  transition: color .2s;
}
.feature-index a::after {
  content: "↓";
  margin-left: auto;
  font-family: var(--font-mono);
  color: var(--terra);
  opacity: .45;
  transition: opacity .2s, translate .2s;
}
.feature-index a:hover { color: var(--merlot); }
.feature-index a:hover::after { opacity: 1; translate: 0 3px; }
.feature-index b { font-family: var(--font-mono); font-size: .78rem; font-weight: 400; color: var(--terra); }
@media (min-width: 760px) {
  .feature-index {
    grid-template-rows: repeat(4, auto);
    grid-auto-flow: column;
    column-gap: 2.5rem;
    border-top: 0;
  }
  .feature-index li:nth-child(4n + 1) { border-top: 1px solid var(--sand-light); }
}

/* Ein Schritt: Nummer, Titel, Text, (Extra), Screenshot */
.step {
  padding-block: clamp(1.6rem, 5vh, 2.4rem);
  border-top: 1px solid var(--sand-light);
}
.step-no { font-family: var(--font-mono); font-size: .8rem; color: var(--terra); }
.step h3 {
  margin: .35rem 0 .6rem;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--merlot);
}
.step > p:not(.step-no) { max-width: 32em; font-size: 1rem; line-height: 1.6; }
.step-ask {
  width: fit-content;
  margin-top: 1rem;
  padding: .7rem .95rem;
  border: 1px solid var(--cod);
  border-radius: 14px 14px 4px 14px;
  background: var(--cream);
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.5;
}
.formats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  max-width: 34em;
  margin-top: 1rem;
}
.formats li {
  padding: .3em .65em;
  border-radius: 6px;
  background: var(--cream);
  font-family: var(--font-mono);
  font-size: .74rem;
  color: var(--cod);
}
.formats .more { background: none; border: 1px dashed var(--sand); color: var(--terra); }
.step-shot { margin-top: 1.3rem; }
/* Schritt-Vorschau wie das App-Fenster auf 16:10 zuschneiden (Bilder mit anderem Format) */
.step-shot img { aspect-ratio: 16 / 10; object-fit: cover; object-position: left top; }
/* Sehr breite Screenshots, deren Wichtigstes rechts liegt (QGIS mit Plugin-Panel) */
.step-shot img.crop-right, .stage-shots img.crop-right { object-position: right top; }

/* Mitlaufendes App-Fenster: nur am Desktop und nur mit JS (home.js setzt .is-enhanced) */
.tour-stage { display: none; }
@media (min-width: 1000px) {
  .tour.is-enhanced {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(2rem, 4vw, 4.5rem);
  }
  .is-enhanced .tour-stage {
    display: block;
    position: sticky;
    top: max(6.5rem, calc(50vh - 16rem));
    align-self: start;
  }
  .is-enhanced .step {
    min-height: 62vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-top: 0;
    opacity: .3;
    transition: opacity .35s ease;
  }
  .is-enhanced .step.is-active { opacity: 1; }
  .is-enhanced .step-shot { display: none; }
  .is-enhanced .tour-steps { padding-bottom: 12vh; }
}
.stage-shots { display: grid; background: var(--cream); }
.stage-shots img {
  grid-area: 1 / 1;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: left top;
  opacity: 0;
  scale: 1.02;
  transition: opacity .45s ease, scale .6s ease;
}
.stage-shots img.is-on { opacity: 1; scale: 1; }
.stage-progress {
  display: flex;
  gap: 4px;
  margin-top: 1rem;
}
.stage-progress i {
  flex: 1;
  height: 4px;
  background: var(--sand-light);
  transition: background .3s;
}
.stage-progress i.is-on { background: var(--merlot); }
.stage-progress i.is-done { background: var(--cod); }

/* Kapitel 03: Produkte */
.products { list-style: none; display: grid; gap: 1.2rem; }
.products li {
  display: flex;
  flex-direction: column;
  padding: 1.6rem 1.5rem;
  border: 1px solid var(--sand-light);
  border-radius: 14px;
  background: rgb(244 241 234 / .9);
  transition: border-color .2s, translate .2s, box-shadow .2s;
}
.products li:hover {
  border-color: var(--merlot);
  translate: 0 -4px;
  box-shadow: 0 1.5rem 2.5rem -1.5rem rgb(84 20 9 / .35);
}
.icon {
  width: 48px; height: 48px;
  margin-bottom: 1.1rem;
  fill: none;
  stroke: var(--merlot);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.products .kind { font-size: .72rem; }
.products h3 { margin: .3rem 0 .5rem; font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.products p { font-size: .93rem; line-height: 1.5; }
.products .for {
  margin-top: auto;
  padding-top: 1.1rem;
  font-weight: 600;
  color: var(--merlot);
}
@media (min-width: 760px) { .products { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Kapitel 04: Finale in Dunkel, nahtlos in den Footer */
.finale {
  position: relative;
  color: var(--paper);
  padding-bottom: clamp(4rem, 12vh, 7rem);
}
/* dunkle Fläche als Pseudo-Element hinter allem, damit Route und Wegpunkt darüber liegen */
.finale::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--cod);
  box-shadow: 0 0 0 100vmax var(--cod);
  clip-path: inset(0 -100vmax);
}
.finale-contours {
  left: 50%;
  width: 100vw;
  height: 100%;
  translate: -50% 0;
  opacity: .25;
  -webkit-mask-image: none;
  mask-image: none;
}
.finale-contours path { stroke: var(--sand); }
.finale .waypoint { color: var(--gold); }
.finale .pin { --pin-on: var(--gold); background: var(--cod); border-color: var(--gold); }
.finale > p {
  max-width: 32em;
  margin-bottom: 1.8rem;
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  line-height: 1.55;
}
.finale .button { background: var(--gold); border-color: var(--gold); color: var(--cod); }
.finale .button:hover { background: var(--sand); border-color: var(--sand); }

.home .site-footer {
  padding: 1.4rem var(--gutter) 6rem;
  background: var(--cod);
  color: var(--sand-light);
}
.home .site-footer a:hover { color: var(--gold); }
@media (min-width: 860px) { .home .site-footer { padding-bottom: 1.6rem; } }

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 3.5rem clamp(.75rem, 6vw, 5.5rem);
}
.lightbox:target { display: grid; animation: lb-in .25s ease-out; }
.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(30 41 46 / .93);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
}
.lightbox figure {
  position: relative;
  display: grid;
  justify-items: center;
  gap: .9rem;
  max-width: 1500px;
}
.lightbox img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 9rem);
  border-radius: 8px;
  background: var(--cream);
  box-shadow: 0 2rem 4rem -1rem rgb(0 0 0 / .6);
}
.lightbox figcaption {
  color: var(--paper);
  font-size: .92rem;
  line-height: 1.4;
  text-align: center;
}
.lb-count {
  margin-right: .6em;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--gold);
}
.lb-nav, .lb-close {
  position: absolute;
  display: grid;
  place-items: center;
  width: 2.8rem; height: 2.8rem;
  border-radius: 50%;
  background: var(--paper);
  color: var(--merlot);
  font-size: 1.6rem;
  line-height: 1;
  text-decoration: none;
  transition: background .15s, scale .15s;
}
.lb-nav:hover, .lb-close:hover { background: var(--gold); scale: 1.08; }
.lb-nav { top: 50%; translate: 0 -50%; }
.lb-prev { left: clamp(.5rem, 1.5vw, 1.5rem); }
.lb-next { right: clamp(.5rem, 1.5vw, 1.5rem); }
.lb-close { top: .5rem; right: clamp(.5rem, 1.5vw, 1.5rem); }
@media (max-width: 700px) {
  .lb-nav { top: auto; bottom: .5rem; translate: none; }
  /* Handy: Bild randlos über die volle Breite, sonst wäre es kleiner als auf der Seite */
  .lightbox { padding-inline: 0; }
  .lightbox img { border-radius: 0; }
  .lightbox figcaption { padding-inline: 1rem; }
}
@keyframes lb-in { from { opacity: 0; } }

/* ---------- Bewegung (nur wenn erwünscht) ---------- */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* Höhenlinien zeichnen sich beim Laden */
  .home > .contours path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: draw 2.6s cubic-bezier(.3, .6, .3, 1) forwards;
  }
  .home > .contours path:nth-child(2) { animation-delay: .15s; }
  .home > .contours path:nth-child(3) { animation-delay: .3s; }
  .home > .contours path:nth-child(4) { animation-delay: .45s; }
  .home > .contours path:nth-child(5) { animation-delay: .6s; }

  /* Frage tippt sich, dann kommt die Antwort */
  @media (min-width: 600px) {
    /* --n = Zeichen pro Zeile; Zeile 2 beginnt, wenn Zeile 1 fertig ist */
    .ask-q span {
      display: block;
      width: 0;
      overflow: hidden;
      white-space: nowrap;
      border-right: 2px solid transparent;
    }
    .ask-q span:nth-child(1) {
      --n: 34;
      animation: type 1.5s steps(34, end) .9s forwards, caret .7s linear 0s 3.55;
    }
    .ask-q span:nth-child(2) {
      --n: 32;
      animation: type 1.5s steps(32, end) 2.5s forwards, caret .7s linear 2.5s 6;
    }
    .ask-a { animation: pop .45s cubic-bezier(.2, .9, .3, 1.3) 4.3s both; }
  }

  @supports (animation-timeline: view()) {
    /* Kapitel-Navigation markiert das aktuelle Kapitel */
    .chapters a { animation: chapter-on linear; animation-range: cover 50vh cover calc(100% - 50vh); }
    .chapters a:nth-child(1) { animation-timeline: --ch1; }
    .chapters a:nth-child(2) { animation-timeline: --ch2; }
    .chapters a:nth-child(3) { animation-timeline: --ch3; }
    .chapters a:nth-child(4) { animation-timeline: --ch4; }

    /* Logo wird beim Scrollen kompakter, Maßstabsleiste wächst mit */
    .topbar .logo img {
      animation: logo-shrink linear both;
      animation-timeline: scroll(root);
      animation-range: 0 180px;
    }
    .scalebar {
      display: block;
      animation: grow linear both;
      animation-timeline: scroll(root);
    }

    /* Route füllt sich, Wegpunkte färben sich beim Erreichen */
    .story::after {
      display: block;
      animation: grow-y linear both;
      animation-timeline: --story;
      animation-range: cover 50vh cover calc(100% - 50vh);
    }
    .pin {
      animation: pin-on linear both;
      animation-timeline: view();
      animation-range: cover 45% cover 50%;
    }

    /* Elemente gleiten beim Erreichen ins Bild */
    .reveal {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 5% cover 30%;
    }

    /* Lösung einblenden */
    .answer {
      animation: answer-in linear both;
      animation-timeline: --row;
      animation-range: cover 25% cover 50%;
    }
  }
}

@keyframes draw { to { stroke-dashoffset: 0; } }
/* Breite in em statt ch: Space Mono hat 0,612 em je Zeichen. ch würde (v. a. in Safari) mit der
   Ersatzschrift berechnet, solange die Webschrift noch lädt, und schnitte dann das Zeilenende ab. */
@keyframes type { to { width: calc(var(--n) * .612em + 4px); } }
@keyframes caret { 0%, 49% { border-color: var(--merlot); } 50%, 100% { border-color: transparent; } }
@keyframes pop { from { opacity: 0; translate: 0 .6rem; scale: .9; } }
@keyframes chapter-on { from, to { background: var(--on-bg); color: var(--on-fg); --num: var(--gold); } }
@keyframes logo-shrink { to { height: 32px; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes grow-y { from { transform: scaleY(0); } }
@keyframes pin-on { to { background: var(--pin-on); } }
@keyframes rise { from { opacity: 0; translate: 0 2.5rem; } }
@keyframes answer-in { from { opacity: 0; translate: 1.5rem 0; } }

@media (prefers-reduced-motion: reduce) {
  .status i { animation: none; }
  .stage-shots img, .is-enhanced .step { transition: none; }
}
