:root {
  --bg: #000;
  --fg: #ecebe6;
  --muted: #a9a8a2;
  --accent: #c8323c;
  --box: rgba(8, 8, 8, 0.82);
  --serif: "Iowan Old Style", "Charter", "Source Serif 4", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --col: min(34rem, calc(100vw - 2.5rem));
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 18px/1.6 var(--serif); -webkit-font-smoothing: antialiased; overflow-x: hidden; }

.vh-probe { position: absolute; top: 0; left: -10px; width: 1px; height: 100vh; height: 100lvh; pointer-events: none; visibility: hidden; }

.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 50; pointer-events: none; }
.progress__bar { height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }

/* Szene = Komposition: Die Bühne bleibt stehen, solange die Szene läuft */
.scene { position: relative; }
.stage {
  position: sticky; top: 0; height: 100vh; height: 100lvh; overflow: hidden;
  background: #000; contain: strict;
}

/* Ebenen */
.lyr { position: absolute; left: 0; right: 0; top: 0; visibility: hidden; }
.lyr--full { inset: 0; overflow: hidden; }
.full__media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; will-change: transform; transform: translateZ(0); }
.full__credit {
  position: absolute; right: 0.8rem; bottom: 0.6rem; font: 11px/1.3 var(--sans);
  color: rgba(255, 255, 255, 0.6); letter-spacing: 0.02em;
}
.lyr--flow { display: flex; will-change: transform; pointer-events: none; }
.lyr--flow > * { pointer-events: auto; }
.lyr--screen { mix-blend-mode: screen; } /* Schwarz wird durchsichtig */
.step--left { justify-content: flex-start; padding-left: max(1.25rem, 7vw); }
.step--center { justify-content: center; }
.step--right { justify-content: flex-end; padding-right: max(1.25rem, 7vw); }

.textbox { width: var(--col); color: var(--tb-fg, inherit); background: var(--tb-bg, var(--box)); padding: 1.4rem 1.6rem; border-radius: 2px; font-family: var(--f-body, var(--serif)); font-weight: var(--w-body, 400); }
.textbox p { margin: 0 0 0.9em; }
.textbox p:last-child { margin-bottom: 0; }
.textbox--heading { background: none; padding: 0; text-align: center; }
.textbox--heading h2 {
  margin: 0; font: 500 1.05rem/1.3 var(--f-heading, var(--sans)); font-weight: var(--w-heading, 500); letter-spacing: 0.04em; color: var(--tb-fg, var(--fg));
  display: inline-block; background: var(--tb-bg, var(--box)); padding: 0.45rem 0.9rem;
}
.textbox--chapter { background: none; padding: 0; width: min(54rem, calc(100vw - 2.5rem)); text-align: center; }
.textbox--chapter h1 {
  margin: 0; font: 400 clamp(2.4rem, 6.5vw, 5.2rem)/1.08 var(--f-chapter, var(--serif)); font-weight: var(--w-chapter, 400);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.75);
}

.figure { margin: 0; }
.figure img, .figure video { display: block; width: 100%; height: auto; background: #111; }
.lyr--screen .figure video { background: #000; }
.figure figcaption { font: 13px/1.4 var(--f-caption, var(--sans)); font-weight: var(--w-caption, 400); color: var(--muted); margin-top: 0.5rem; }
.figure figcaption .credit { opacity: 0.75; }
.vbox { position: relative; }
.vbox__sound {
  position: absolute; left: 0.75rem; top: 0.75rem; font: 600 13px/1 var(--sans); color: #fff;
  background: rgba(0, 0, 0, 0.72); border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 999px;
  padding: 0.55rem 0.85rem; cursor: pointer;
}
.vbox__sound[hidden] { display: none; }


@media (max-width: 700px) {
  body { font-size: 17px; }
  .step--left, .step--right { justify-content: center; padding: 0; }
  .textbox { padding: 1.1rem 1.2rem; }
  .figure { width: calc(100vw - 2.5rem) !important; }
}

/* Animierte Ebenen stehen im Bild: Mitte = Position, keine Ausrichtung links/rechts */
.lyr--anim { justify-content: center; padding: 0 !important; }
.lyr--full { transform-origin: 50% 50%; }
.lyr--flow { transform-origin: 50% 50%; }
/* Studio-Vorschau: Auswahl-Werkzeug */
.is-preview .lyr--flow > * { cursor: default; }
.is-preview .lyr.is-selected, .is-preview .lyr.is-selected > * { cursor: move; }
.is-dragging, .is-dragging * { cursor: grabbing !important; user-select: none; }
.is-hand, .is-hand * { cursor: grab !important; }
.selbox { position: fixed; z-index: 10000; pointer-events: none; border: 1px solid #6aa8ff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.selbox[hidden] { display: none; }
.selbox b { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; background: #fff; border: 1px solid #3d7be0; pointer-events: auto; }
.selbox b[data-h="nw"] { left: 0; top: 0; cursor: nwse-resize; } .selbox b[data-h="n"] { left: 50%; top: 0; cursor: ns-resize; }
.selbox b[data-h="ne"] { left: 100%; top: 0; cursor: nesw-resize; } .selbox b[data-h="e"] { left: 100%; top: 50%; cursor: ew-resize; }
.selbox b[data-h="se"] { left: 100%; top: 100%; cursor: nwse-resize; } .selbox b[data-h="s"] { left: 50%; top: 100%; cursor: ns-resize; }
.selbox b[data-h="sw"] { left: 0; top: 100%; cursor: nesw-resize; } .selbox b[data-h="w"] { left: 0; top: 50%; cursor: ew-resize; }

/* Studio: Montagefläche wie in After Effects – Bühne verkleinert, Elemente ausserhalb sichtbar */
.is-pasteboard, .is-pasteboard body { background: #2b2c2f; }
.is-pasteboard .stage { contain: none; overflow: visible; transform: translate(var(--pb-x, 0px), var(--pb-y, 0px)) scale(var(--pb-scale, .6)); transform-origin: 50% 50%; background: #000; box-shadow: 0 0 0 1px rgba(255,255,255,.55), 0 0 0 9999px rgba(43,44,47,0); }
.is-pasteboard .scene { overflow: visible; }
.is-pasteboard .progress { display: none; }
/* Bewegungspfad */
.mpath { position: absolute; inset: 0; pointer-events: none; z-index: 9999; }
.mpath svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mpath polyline { fill: none; stroke: #6ad7e5; stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; }
.mpath i { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border: 1.5px solid #6ad7e5; background: #0b2a2e; transform: rotate(45deg); }

/* Zeitstrahl: rote Linie links neben der Textspalte, Zeitmarken kleben neben ihrer Textbox */
.chrono { position: fixed; inset: 0; pointer-events: none; z-index: 30; --chrono-x: max(4.5rem, calc(50vw - var(--col) / 2 - 3.5rem)); }
.chrono__line { position: absolute; top: 0; bottom: 0; left: var(--chrono-x); width: 1.5px; background: var(--chrono, var(--accent)); opacity: .9; }
.chrono__mark { position: absolute; top: 0; left: var(--chrono-x); width: 0; visibility: hidden; will-change: transform;
  font: 500 clamp(1rem, 1.6vw, 1.35rem)/1.2 var(--f-heading, var(--sans)); color: var(--chrono, var(--accent)); white-space: nowrap; }
.chrono__label { position: absolute; right: 1.1rem; top: 0; padding-top: .2rem; text-align: right; }
.mark-inline { display: none; font: 600 .8rem/1.2 var(--f-heading, var(--sans)); color: var(--chrono, var(--accent)); letter-spacing: .03em; margin-bottom: .6rem; }
/* Handy: zu wenig Platz links – dünne Linie am Rand, Marke als rote Zeile in der Box */
@media (max-width: 900px) {
  .chrono { --chrono-x: .55rem; }
  .chrono__mark { display: none; }
  .mark-inline { display: block; }
}

/* Zeitstrahl als Ebene */
.lyr--chrono { position: absolute; top: 0; bottom: 0; left: 0; right: 0; pointer-events: none; --chrono-x: max(4.5rem, calc(50vw - var(--col) / 2 - 3.5rem)); }
.chrono-l__line { position: absolute; top: 0; bottom: 0; left: var(--chrono-x); width: var(--cw, 1.5px); transform-origin: 50% 0; }
.chrono-l--solid .chrono-l__line { background: var(--cl); }
.chrono-l--dashed .chrono-l__line { background: repeating-linear-gradient(to bottom, var(--cl) 0 10px, transparent 10px 18px); }
.chrono-l--dotted .chrono-l__line { width: max(3px, var(--cw)); background: radial-gradient(circle at 50% 50%, var(--cl) 0 45%, transparent 50%) 50% 0 / 100% 9px repeat-y; }
.chrono { transition: opacity .15s linear; }
.chrono__dot { display: none; position: absolute; top: calc(.2rem + .6em - 4.5px); left: calc(var(--clw, 1.5px) / 2 - 4.5px); width: 9px; height: 9px; border-radius: 50%; background: var(--chrono, var(--accent)); box-shadow: 0 0 0 3px rgba(0,0,0,.6); }
.chrono.has-dots .chrono__dot { display: block; }
/* Linie ist noch nicht bis hierhin gewachsen: Punkt nur als Ring */
.chrono__mark.is-ahead .chrono__dot { background: #000; box-shadow: inset 0 0 0 1.5px var(--chrono, var(--accent)), 0 0 0 3px rgba(0,0,0,.6); }
@media (max-width: 900px) {
  .lyr--chrono { --chrono-x: .55rem; }
}

/* Links im Text */
.textbox a, .figure figcaption a, .title a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
.textbox a:hover, .figure figcaption a:hover { text-decoration-thickness: 2px; }

/* Easter Egg */
.egg { position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); z-index: 100000; transform: translate(-50%, 12px) scale(.96); opacity: 0;
  padding: .55rem 1.1rem; border-radius: 999px; background: rgba(12,12,14,.88); color: #fff; border: 1px solid rgba(255,255,255,.18);
  font: 600 .78rem/1 var(--f-heading, var(--sans)); letter-spacing: .14em; white-space: nowrap; pointer-events: none;
  box-shadow: 0 8px 30px rgba(0,0,0,.45); transition: opacity .5s ease, transform .5s cubic-bezier(.2,.9,.3,1.3); }
.egg.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }
