/* ==========================================================================
   TT Rail Tech – Die Sperrpause (Erlebnisebene)
   Baut auf style.css auf. Eine feste Bühne (WebGL) bleibt stehen, während
   der Besucher durch die Nacht scrollt; Kapitelkarten, Uhr und Zeitleiste
   liegen als HUD darüber.
   ========================================================================== */

/* Scrollweg der Bühne: 2,5-fach gegenüber Fassung 8 (Hakan: deutlich mehr scrollen, mehr Details sehen) */
.experience { position: relative; height: 2750vh; }
.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--night);
  color: var(--night-ink);
}
.stage.no-webgl::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 10, 12, 0.3), rgba(7, 10, 12, 0.85)),
    url("img/szenen/k0-m.jpg") center / cover no-repeat #0b1217;
}
.stage.no-webgl .plankopf, .stage.no-webgl .wahl-strip, .stage.no-webgl .holo-labels { display: none; }
.clips { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.clips video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; opacity: 0; transition: opacity 0.7s ease; will-change: transform, opacity; }
.clips video.is-playing { opacity: 1; }
.stage.no-webgl .clips { display: none; }
.stage-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.5) 100%);
}
.stage-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* HUD */
.hud {
  position: absolute;
  left: 0; right: 0; top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) var(--gutter) 14px;
}
.hud .brand { color: var(--night-ink); }
.uhr-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.hud-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--night-ink-3); }
.uhr {
  padding: 2px 12px;
  font-family: var(--font-mono);
  font-size: clamp(1.3rem, 2.4vw, 2rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--night-ink);
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--night-line);
  border-radius: 3px;
}
.hud-actions { display: flex; gap: 8px; }
.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid var(--night-line);
  border-radius: 3px;
  background: rgba(12, 17, 21, 0.78);
  color: var(--night-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.hud-btn:hover { border-color: var(--accent); }
.hud-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.hud-btn--accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.hud-btn--accent:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
@media (max-width: 760px) {
  .hud .brand span { display: none; }
  .hud-btn .lang { display: none; }
  .hud-btn { padding: 9px 10px; }
}

/* Zeitleiste rechts: Kapitel als Stationen der Nacht */
.zeitleiste {
  position: absolute;
  right: 22px;
  top: 50%;
  z-index: 6;
  display: none;
  flex-direction: column;
  gap: 18px;
  transform: translateY(-50%);
}
@media (min-width: 960px) { .zeitleiste { display: flex; } }
.zeitleiste::before { content: ""; position: absolute; right: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--night-line); }
.zeitleiste button {
  position: relative;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 12px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--night-ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: right;
  cursor: pointer;
}
.zeitleiste button::before {
  content: "";
  flex: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 3px solid var(--night-line);
  background: var(--night);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.zeitleiste button span { opacity: 0; transition: opacity 0.2s ease; white-space: nowrap; }
.zeitleiste button:hover span, .zeitleiste button:focus-visible span, .zeitleiste button.is-active span { opacity: 1; }
.zeitleiste button.is-active { color: var(--accent); }
.zeitleiste button.is-active::before { border-color: var(--accent); background: var(--accent); }

/* Kapitelkarten */
.kapitel {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(9vh + env(safe-area-inset-bottom, 0px));
  z-index: 5;
  max-width: 560px;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  pointer-events: none;
}
.kapitel.is-active { opacity: 1; transform: none; pointer-events: auto; }
.karte {
  display: grid;
  gap: 14px;
  padding: clamp(18px, 2.4vw, 28px);
  background: rgba(12, 17, 21, 0.84);
  border: 1px solid var(--night-line);
  border-radius: var(--radius);
}
.kapitel .eyebrow { color: var(--night-ink-2); }
.kapitel h2 { font-size: clamp(1.9rem, 4vw, 3.3rem); font-weight: 700; text-transform: uppercase; line-height: 0.96; }
.kapitel p { color: var(--night-ink-2); font-size: clamp(0.98rem, 1.15vw, 1.08rem); max-width: 54ch; }
.fakten { display: flex; flex-wrap: wrap; gap: 6px; }
.fakten li {
  padding: 5px 8px;
  border: 1px solid var(--night-line);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--night-ink-2);
}
.fakten li.is-accent { border-color: var(--accent); color: var(--accent); }
.kapitel .cta { display: flex; flex-wrap: wrap; gap: 10px; }

/* Prolog: Titeltafel in der Mitte */
.kapitel--prolog {
  left: 0; right: 0; top: 50%; bottom: auto;
  max-width: none;
  display: grid;
  place-items: center;
  gap: 18px;
  padding-inline: var(--gutter);
  text-align: center;
  transform: translateY(calc(-50% + 20px));
}
.kapitel--prolog.is-active { transform: translateY(-50%); }
.kapitel--prolog .titel { font-family: var(--font-display); font-size: clamp(3.2rem, 11vw, 9.5rem); font-weight: 700; line-height: 0.9; text-transform: uppercase; }
.titel--sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.titel-svg { display: block; width: min(92vw, 1080px); height: auto; overflow: visible; }
.titel-svg text { font-family: var(--font-display); font-weight: 700; font-size: 128px; letter-spacing: 0.01em; fill: var(--night-ink); fill-opacity: 0; stroke: var(--night-ink); stroke-width: 1.4; stroke-linejoin: round; stroke-dasharray: 900; stroke-dashoffset: 900; paint-order: stroke; }
.titel-svg .tl--accent { fill: var(--accent); stroke: var(--accent); }
.stage.is-ready .titel-svg .tl { animation: titelzug 1.6s cubic-bezier(0.3, 0, 0.2, 1) forwards, titelfuell 0.9s ease forwards; animation-delay: calc(0.35s + var(--i) * 0.11s), calc(1.5s + var(--i) * 0.11s); }
@keyframes titelzug { to { stroke-dashoffset: 0; } }
@keyframes titelfuell { to { fill-opacity: 1; stroke-opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .titel-svg text { fill-opacity: 1; stroke-dashoffset: 0; } .stage.is-ready .titel-svg .tl { animation: none; } }
@media (max-width: 760px) { .titel-svg text { font-size: 150px; } .titel-svg { width: 94vw; } }
.kapitel--prolog .titel .accent { color: var(--accent); }
.kapitel--prolog .sub { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--night-ink-2); max-width: none; }
.kapitel--prolog .board { display: inline-block; font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.kapitel--prolog .tile { background: var(--night); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); color: var(--accent); min-width: 0.9em; padding: 0.22em 0.1em; }

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--night-ink-3);
  white-space: nowrap;
  transition: opacity 0.5s ease;
}
.scroll-hint::after { content: ""; width: 2px; height: 34px; background: linear-gradient(180deg, var(--accent), transparent); animation: hint 1.6s ease-in-out infinite; }
@keyframes hint { 0%, 100% { transform: translateY(0); opacity: 0.4; } 50% { transform: translateY(8px); opacity: 1; } }
.stage:not([data-kapitel="prolog"]) .scroll-hint, .stage:not(.is-film) .scroll-hint { opacity: 0; pointer-events: none; }

/* Weiche stellen */
.wahl { display: flex; flex-wrap: wrap; gap: 8px; }
.wahl button {
  padding: 10px 14px;
  border: 1px solid var(--night-line);
  border-radius: 3px;
  background: transparent;
  color: var(--night-ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}
.wahl button:hover, .wahl button.is-on { border-color: var(--accent); color: var(--accent); }
.wahl button.is-on { background: var(--accent-soft); }
.antwort { display: none; }
.antwort.is-on { display: block; }
.weiche-hinweis { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--night-ink-3); }

/* Messwerte */
.messwerte { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 0; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.messwerte dt, .messwerte dd { margin: 0; }
.messwerte .k { display: block; color: var(--night-ink-3); }
.messwerte .v { display: block; margin-top: 2px; font-size: 16px; color: var(--night-ink); font-variant-numeric: tabular-nums; transition: color 0.3s ease; }
.messwerte .v.ok { color: #2fbf71; }
.stempel {
  display: inline-block;
  justify-self: start;
  padding: 6px 10px;
  border: 2px solid #2fbf71;
  border-radius: 2px;
  color: #2fbf71;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0;
  transform: rotate(-6deg) scale(1.15);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.stempel.is-on { opacity: 1; transform: rotate(-3deg) scale(1); }

/* Finale */
.kapitel--fahrtfrei .karte { border-color: color-mix(in srgb, var(--accent) 40%, var(--night-line)); }

/* Abspann */
.abspann { text-align: center; }
.abspann .rolle { margin-top: 30px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--night-ink-3); }
.abspann .name { margin-top: 6px; font-family: var(--font-display); font-size: clamp(1.4rem, 2.6vw, 2.2rem); font-weight: 700; line-height: 1.05; text-transform: uppercase; }
.abspann .name small { display: block; margin-top: 4px; font-family: var(--font-body); font-size: 14px; font-weight: 400; color: var(--night-ink-2); text-transform: none; }
.abspann .portrait { max-width: 380px; margin: 44px auto 0; text-align: left; }
.abspann .kurz { margin-top: 36px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* Drehbuch (Volltext ohne Bühne, für Screenreader und reduzierte Bewegung) */
.drehbuch { max-width: 760px; margin-inline: auto; }
.drehbuch h3 { margin-top: 28px; font-size: 1.4rem; text-transform: uppercase; }
.drehbuch p { margin-top: 8px; color: var(--night-ink-2); }

/* --------------------------------------------------------------------------
   Film plus Hologramm: Kulissen, Schnitt, Kinobalken, Lichtleck, Vorhang
   -------------------------------------------------------------------------- */


.holo { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; display: block; }

/* Beschriftungen, Führungslinien, Tracking-Ecken */
.holo-labels { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.hlabel {
  position: absolute;
  left: 0; top: 0;
  padding: 5px 8px;
  background: rgba(7, 10, 12, 0.8);
  border-left: 2px solid var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffd9bf;
  white-space: nowrap;
  opacity: 0;
  will-change: transform, opacity;
}
.fps {
  position: absolute;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  transform: translateX(-50%);
  padding: 4px 9px;
  background: rgba(0, 0, 0, 0.72);
  color: #2fbf71;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
@media (max-width: 760px) {
  .hlabel { font-size: 10px; padding: 4px 6px; }
}

/* Plan-Beschriftungen: Bildtitel unter den Fotos, Detailtitel unter den Zeichnungen */
.pcap, .dcap {
  position: absolute;
  left: 0; top: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9fb3c4;
  white-space: nowrap;
  opacity: 0;
  will-change: transform, opacity;
}
.dcap { color: #ffd9bf; padding-left: 10px; border-left: 2px solid var(--accent); }
@media (max-width: 760px) {
  .pcap { white-space: normal; max-width: 160px; font-size: 10px; line-height: 1.5; }
  .dcap { font-size: 10px; }
}

/* Plankopf wie auf einem Bauplan, unten rechts */
.plankopf {
  position: absolute;
  right: var(--gutter);
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  z-index: 5;
  width: min(360px, calc(100% - 2 * var(--gutter)));
  border: 1px solid rgba(159, 179, 196, 0.45);
  background: rgba(11, 18, 23, 0.82);
  color: var(--night-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  transition: opacity 0.6s ease, transform 0.6s var(--ease);
}
.stage.is-film .plankopf { opacity: 0; transform: translateY(12px); pointer-events: none; }
.pk-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 10px; border-bottom: 1px solid rgba(159, 179, 196, 0.45); }
.pk-brand { font-family: var(--font-display); font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase; }
.pk-sub { font-size: 10px; color: var(--night-ink-3); text-transform: uppercase; white-space: nowrap; }
.pk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.pk-grid > div { padding: 6px 10px; border-right: 1px solid rgba(159, 179, 196, 0.3); border-bottom: 1px solid rgba(159, 179, 196, 0.3); min-width: 0; }
.pk-grid > div:nth-child(2n), .pk-grid > .pk-wide { border-right: 0; }
.pk-grid > .pk-wide { grid-column: 1 / -1; }
.pk-grid dt { font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--night-ink-3); }
.pk-grid dd { margin: 2px 0 0; font-size: 12px; color: var(--night-ink); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-grid dd#pk-leistung { white-space: normal; line-height: 1.45; }
@media (max-width: 760px) {
  .plankopf { width: calc(100% - 2 * var(--gutter)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); font-size: 10px; }
  .pk-head { padding: 6px 8px; }
  .pk-grid > div { padding: 4px 8px; }
  .pk-grid dd { font-size: 11px; }
  .pk-grid > div:nth-child(1), .pk-grid > div:nth-child(5), .pk-grid > div:nth-child(7), .pk-grid > div:nth-child(8), .pk-sub { display: none; }
  .stage.is-finale .plankopf { opacity: 0; }
}

/* Weiche stellen: auf dem Plan, bevor der Kran sie absenkt */
.wahl-strip {
  position: absolute;
  left: var(--gutter);
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  z-index: 6;
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(11, 18, 23, 0.82);
  border: 1px solid rgba(159, 179, 196, 0.45);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.6s ease, transform 0.6s var(--ease);
}
.stage[data-phase="plan"][data-kapitel="weiche"] .wahl-strip { opacity: 1; transform: none; pointer-events: auto; }
@media (max-width: 760px) {
  .wahl-strip { right: var(--gutter); bottom: auto; top: calc(44% + 0px); padding: 10px 12px; }
  .wahl-strip .wahl button { padding: 8px 10px; font-size: 13px; }
  .stage[data-phase="plan"][data-kapitel="weiche"] .plankopf { opacity: 0; }
}
.antwort-leer { display: block; }
.stage[data-wahl] .antwort-leer { display: none; }

/* Phasen: Karten gehören zum Film, Plankopf und Zeichnung zum Plan */
.stage:not(.is-film):not(.is-finale) .kapitel.is-active { opacity: 0; transform: translateY(28px); pointer-events: none; }
.stage:not(.is-film):not(.is-finale) .kapitel--prolog.is-active { transform: translateY(calc(-50% + 20px)); }

/* Standbild-Modus zum Rendern der Einzelbilder: nur Bühne, Fotos, Zeichnungen, Beschriftungen */
.stage.is-still .hud, .stage.is-still .zeitleiste, .stage.is-still .kapitel, .stage.is-still .plankopf, .stage.is-still .wahl-strip,
.stage.is-still .scroll-hint, .stage.is-still .vorhang, .stage.is-still .fps, .stage.is-still .cinebars, .stage.is-still .stage-grain, .stage.is-still .stage-vignette { display: none !important; }
.stage.is-still .clips video { transition: none; }
.stage.is-still .kapitel, .stage.is-still .plankopf { transition: none; }

/* Der lange Seitenteil unterhalb wird erst gerendert, wenn er gebraucht wird */
main > section { content-visibility: auto; contain-intrinsic-size: auto 900px; }


.stage-vignette { z-index: 4; }
.stage-grain { z-index: 4; }

.cinebars span { position: absolute; left: 0; right: 0; height: 6vh; background: #000; z-index: 8; pointer-events: none; transition: transform 0.7s var(--ease); }
.cinebars span:first-child { top: 0; transform: translateY(-100%); }
.cinebars span:last-child { bottom: 0; transform: translateY(100%); }
.stage.is-film .cinebars span { transform: none; }

@media (orientation: portrait), (max-width: 760px) { .cinebars { display: none; } }
.hud, .zeitleiste { z-index: 9; }
.kapitel { z-index: 6; }
.scroll-hint { z-index: 9; }

.vorhang {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--night);
  transition: opacity 0.9s ease;
}
.vorhang.is-off { opacity: 0; pointer-events: none; }
.vorhang .logo { width: 132px; height: 132px; }
.vorhang .lade { position: relative; width: 120px; height: 2px; background: var(--night-line); overflow: hidden; }
.vorhang .lade::after { content: ""; position: absolute; left: -40%; top: 0; width: 40%; height: 100%; background: var(--accent); animation: lade 1.1s linear infinite; }
@keyframes lade { to { left: 100%; } }

@media (prefers-reduced-motion: reduce) {
  .vorhang .lade::after { animation: none; }
}

@media (max-width: 760px) {
  .kapitel { bottom: calc(6vh + env(safe-area-inset-bottom, 0px)); }
  .kapitel h2 { font-size: 1.8rem; }
  .kapitel p { font-size: 0.95rem; }
  .karte { gap: 10px; }
  .fakten li { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .kapitel { transition: none; }
  .scroll-hint::after { animation: none; }
  .stempel { transition: none; }
}

@media print {
  .experience { height: auto; }
  .stage { position: static; height: auto; overflow: visible; }
  .welt, .stage-vignette, .stage-grain, .hud, .zeitleiste, .scroll-hint { display: none !important; }
  .kapitel { position: static; opacity: 1 !important; transform: none !important; max-width: none; margin-top: 16pt; }
  .karte { background: #fff; border-color: #bbb; color: #000; }
}
