/* Über Yousil – gemalte Bühne mit echtem Licht */

:root {
  --papier: #ece2d4;
  --tinte: #1d1915;
  --tinte-leise: #6b6158;
  --bordeaux: #6e1f2b;
  --schrift: "Jost", "Futura", "Avenir Next", system-ui, sans-serif;
  --rand: clamp(20px, 5vw, 72px);
}

* { box-sizing: border-box; }

html { background: var(--papier); }

body {
  margin: 0;
  color: var(--tinte);
  background: var(--papier);
  font-family: var(--schrift);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

#buehne {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  display: block;
  z-index: 0;
}

/* Ein Hauch Papier über der ganzen Bühne, damit Bild und Schrift aus einem Guss wirken. */
.vorhang {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 30% 45%, rgba(236, 226, 212, 0) 55%, rgba(60, 44, 30, 0.10) 100%);
}

/* ─── Kopf ─────────────────────────────────────────────────────────────── */

.kopf {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: 26px var(--rand) 0;
  pointer-events: none;
}
.kopf a { pointer-events: auto; text-decoration: none; }

/* Inhalt des Kopfs (Menü, Wortmarke, Warenkorb): design/shared/kopf.css */

.marke,
.hinweis,
.kapitelzeiger a,
.weiter {
  font-family: var(--schrift);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}


/* ─── Geschichte ───────────────────────────────────────────────────────── */

.geschichte {
  position: relative;
  z-index: 2;
  /* Die Länge des Scrollwegs bestimmt das Tempo der Kamerafahrt. */
  height: 1350vh;
  pointer-events: none;
}

/* Der Text steht links, wo die Bühne ihm Platz lässt. Die Bühne ist ein gemaltes Bild und wird für
   Sprachen von rechts nach links nicht gespiegelt; der Text bleibt deshalb auch dort links (in sich
   rechtsbündig). Ebenso bleibt der Kapitelzeiger rechts unten neben David. */
.kapitel .inhalt {
  position: fixed;
  left: var(--rand);
  top: 50%;
  width: min(30rem, 34vw);
  transform: translateY(calc(-50% + var(--dy, 0px)));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  will-change: opacity, transform;
}
.kapitel.aktiv .inhalt { visibility: visible; pointer-events: auto; }

.marke {
  margin: 0 0 22px;
  color: var(--tinte-leise);
  display: flex;
  align-items: center;
  gap: 14px;
}
.ziffer {
  font-family: var(--schrift);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--bordeaux);
  padding-inline-end: 14px;
  border-inline-end: 1px solid rgba(29, 25, 21, 0.25);
  line-height: 1;
}

h1, h2 {
  font-weight: 300;
  margin: 0;
}

.auftakt h1 {
  font-size: clamp(40px, 4.6vw, 72px);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.finale h2 {
  font-size: clamp(36px, 4vw, 60px);
  line-height: 1.05;
  margin-bottom: 18px;
}

.kapitel p { margin: 0 0 1em; text-wrap: pretty; }
.kapitel .leise { color: var(--tinte-leise); }

blockquote { margin: 1.6em 0 0; padding: 0; }
blockquote p {
  font-size: 1.32em;
  line-height: 1.35;
  font-weight: 300;
  margin-bottom: 0.6em;
}
blockquote.gross p { font-size: clamp(25px, 2.15vw, 34px); line-height: 1.3; }
blockquote footer {
  font-family: var(--schrift);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--tinte-leise);
}
blockquote footer::before { content: "— "; letter-spacing: 0; }

.sr {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hinweis {
  margin-top: 46px;
  color: var(--tinte-leise);
  display: flex;
  align-items: center;
  gap: 14px;
}
.hinweis span {
  display: block;
  width: 48px;
  height: 1px;
  background: currentColor;
  transform-origin: left;
  animation: hinweis 2.6s ease-in-out infinite;
}
@keyframes hinweis {
  0% { transform: scaleX(0); }
  50% { transform: scaleX(1); }
  100% { transform: scaleX(0); transform-origin: right; }
}

.weiter {
  display: inline-block;
  margin-top: 14px;
  padding: 16px 0 6px;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
.weiter:hover, .weiter:focus-visible { color: var(--bordeaux); }

/* ─── Kapitelzeiger ────────────────────────────────────────────────────── */

.kapitelzeiger {
  position: fixed;
  /* Rechts unten sitzt Davids Raute (Abstand wie in david.css, Raute 28 px breit): daneben bleiben. */
  right: max(var(--rand), calc(clamp(16px, 3vw, 32px) + 56px));
  bottom: 30px;
  z-index: 5;
  display: flex;
  gap: 22px;
}
.kapitelzeiger a {
  font-family: var(--schrift);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-decoration: none;
  color: var(--tinte-leise);
  opacity: 0.55;
  padding: 6px 2px;
  border-bottom: 1px solid transparent;
  transition: opacity 0.5s, border-color 0.5s, color 0.5s;
}
.kapitelzeiger a.an { opacity: 1; color: var(--bordeaux); border-bottom-color: currentColor; }
.kapitelzeiger a:focus-visible { opacity: 1; outline: 1px solid currentColor; outline-offset: 4px; }

a:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

/* ─── Fußzeile (auch auf Kontakt) ──────────────────────────────────────── */

.fuss {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  padding: 0 var(--rand) 34px;
}
.fuss a {
  font-family: var(--schrift);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--tinte-leise);
}
.fuss a:hover, .fuss a:focus-visible { color: var(--tinte); }
/* Nur in übersetzten Seiten: Die Rechtstexte gibt es auf Deutsch. */
.fuss .fuss-hinweis {
  font-family: var(--schrift);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--tinte-leise);
  opacity: 0.75;
}
.fuss .sprachwahl { margin-inline-start: auto; color: var(--tinte-leise); }
/* Über Yousil: Die Fußzeile folgt auf das Ende der Geschichte. Sie liegt über der Bühne, und buehne.js schiebt
   Bühne, Text und Kapitelzeiger um das Stück nach oben, um das sie hereingescrollt ist (--fuss-ueber). */
.geschichte ~ .fuss {
  position: relative;
  z-index: 4;
  align-items: center;
  padding-top: 30px;
  /* Unten rechts steht am Seitenende Davids Knopf „Beraten lassen“ (david.css: Abstand clamp(16px, 3vw, 32px),
     50 px hoch): Die Zeile bleibt darüber, damit kein Link verdeckt wird. */
  padding-bottom: calc(clamp(16px, 3vw, 32px) + 64px);
  background: var(--papier);
  border-top: 1px solid rgba(29, 25, 21, 0.14);
}
#buehne, .vorhang, .kapitel .inhalt, .kapitelzeiger { translate: 0 calc(-1 * var(--fuss-ueber, 0px)); }

/* ─── Laden ────────────────────────────────────────────────────────────── */

.laden {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: var(--papier);
  transition: opacity 1.2s ease, visibility 1.2s;
}
.laden span {
  width: 14px;
  height: 26px;
  background: var(--tinte);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  animation: atmen 1.6s ease-in-out infinite;
}
@keyframes atmen { 50% { opacity: 0.25; } }
.bereit .laden { opacity: 0; visibility: hidden; }

/* ─── Handy ────────────────────────────────────────────────────────────── */

@media (max-width: 760px), (max-aspect-ratio: 9/10) {
  body { font-size: 15px; line-height: 1.55; }
  .kapitel p { margin-bottom: 0.75em; }
  .marke { margin-bottom: 14px; }
  .kapitel .inhalt {
    top: auto;
    bottom: calc(70px + env(safe-area-inset-bottom));
    left: var(--rand);
    right: var(--rand);
    width: auto;
    transform: translateY(var(--dy, 0px));
  }
  .vorhang {
    background:
      linear-gradient(to top, rgba(240, 232, 222, 0.97) 0%, rgba(240, 232, 222, 0.93) 38%, rgba(240, 232, 222, 0) 60%);
  }
  .auftakt h1 { font-size: 38px; }
  blockquote p { font-size: 1.18em; }
  blockquote.gross p { font-size: 22px; }
  .kapitelzeiger { left: var(--rand); right: auto; bottom: calc(22px + env(safe-area-inset-bottom)); }
  .kopf { padding-top: 18px; }
}

/* ─── Ohne WebGL: ruhige Fassung mit denselben Bildern ─────────────────── */

.ohne-3d #buehne, .ohne-3d .kapitelzeiger { display: none; }
.ohne-3d .geschichte { height: auto; pointer-events: auto; }
.ohne-3d .kapitel { min-height: 90vh; display: grid; align-items: center; padding: 120px var(--rand); }
.ohne-3d .kapitel .inhalt { position: static; opacity: 1; visibility: visible; transform: none; width: min(34rem, 100%); }

@media (prefers-reduced-motion: reduce) {
  .hinweis span, .laden span { animation: none; }
}
