/* =========================================================================
   Der goldene Schnitt (Lab, Experiment 03) — bunter Erklaerfilm zum Scrollen.
   Eine angepinnte Buehne, darin ein quadratisches Bild (SVG), links der Text.
   Ablauf und Zeichnungen: assets/js/goldener-schnitt.js
   ========================================================================= */

@font-face { font-family: 'Fredoka'; src: url('../fonts/fredoka-latin-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url('../fonts/fredoka-latin-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --nacht: #1C1E45;
  --creme: #FFF4DC;
  --sonne: #FFC93C;
  --koralle: #F06B54;
  --tuerkis: #2EC4B6;
  --rosa: #FF9BC2;
  --blatt: #3BB273;
  --eis: #34A7B9;
  --text: var(--creme);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rund: 'Fredoka', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  --s: min(84svh, 54vw, 1000px);
  --gutter: clamp(20px, 4vw, 64px);
  --breite: 1640px;
  --rand: max(var(--gutter), calc((100vw - var(--breite)) / 2 + var(--gutter)));
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--nacht); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--rund); color: var(--text); background: var(--nacht); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
img, svg { display: block; }
button { font: inherit; color: inherit; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--sonne); color: var(--nacht); border-radius: 30px; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--sonne); outline-offset: 3px; border-radius: 8px; }

/* ---------- Leiste --------------------------------------------------------- */
.leiste {
  position: fixed; left: 0; right: 0; top: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center;
  padding: 16px var(--rand); color: var(--creme); transition: color .6s var(--ease); pointer-events: none;
}
.leiste > * { pointer-events: auto; }
.leiste__links { display: flex; align-items: center; gap: 14px; }
.leiste__marke img { width: 34px; height: 34px; transition: filter .6s var(--ease); }
.leiste__weg {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 18px; border-radius: 999px; text-decoration: none;
  font-weight: 600; font-size: 15px; border: 2px solid color-mix(in srgb, currentColor 30%, transparent); transition: border-color .3s, background .3s;
}
.leiste__weg:hover { border-color: currentColor; }
.leiste__kapitel { list-style: none; display: flex; gap: 9px; margin: 0; padding: 0; }
.leiste__kapitel button {
  width: 12px; height: 12px; border-radius: 50%; padding: 0; border: 2px solid currentColor; background: transparent; cursor: pointer; opacity: .55;
  transition: background .4s var(--ease), transform .4s var(--ease), opacity .4s;
}
.leiste__kapitel button:hover { opacity: 1; }
.leiste__kapitel button.ist-an { background: currentColor; opacity: 1; transform: scale(1.25); }
body[data-k='8'] .leiste, body[data-k='11'] .leiste { color: var(--nacht); }
body[data-k='8'] .leiste__marke img, body[data-k='11'] .leiste__marke img { filter: invert(1); }

/* ---------- Buehne --------------------------------------------------------- */
.film { position: relative; }
.buehne { position: relative; height: 100svh; overflow: hidden; }
.grund i { position: absolute; inset: 0; background: var(--c); clip-path: circle(var(--r, 0%) at var(--wx, 70%) var(--wy, 50%)); }
.grund i:first-child { --r: 150%; }
.kulisse { position: absolute; inset: 0; width: 100%; height: 100%; }
.buehne__innen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: clamp(20px, 2.6vw, 56px); padding: 70px var(--rand) 30px;
}
.bild {
  position: relative; flex: none; width: var(--s); height: var(--s); margin-top: 2svh;
  overflow: visible; touch-action: pan-y; -webkit-user-select: none; user-select: none;
}
.bild [data-tipp] { cursor: pointer; }
.bild .ziehbar { cursor: ew-resize; touch-action: none; }

/* ---------- Texte ----------------------------------------------------------- */
.texte {
  position: relative; flex: 0 1 clamp(320px, 31vw, 560px); display: grid; z-index: 5;
}
.text { grid-area: 1 / 1; align-self: center; opacity: 0; visibility: hidden; }
.text h1, .text h2 {
  margin: 0 0 18px; font-weight: 600; font-size: clamp(42px, 4.3vw, 92px); line-height: 1.02; letter-spacing: -.01em; text-wrap: balance;
}
.text h1 { font-size: clamp(48px, 5vw, 104px); }
.text p { margin: 0 0 16px; font-size: clamp(20px, 1.65vw, 32px); line-height: 1.32; max-width: 22ch; }
.zeilen { display: grid; }
.zeilen p { grid-area: 1 / 1; opacity: 0; visibility: hidden; }
.text .marke {
  display: inline-block; font-weight: 600; font-size: 14px; letter-spacing: .12em; text-transform: uppercase; opacity: 1;
  background: var(--sonne); color: var(--nacht); padding: 6px 14px; border-radius: 999px; margin-bottom: 22px; white-space: nowrap; max-width: none;
}
.text .treffer {
  font-weight: 600; color: var(--sonne); opacity: 0; transform: translateY(10px) scale(.96); transform-origin: left;
  transition: opacity .5s var(--ease), transform .6s cubic-bezier(.34,1.56,.64,1);
}
body.ist-golden .text .treffer { opacity: 1; transform: none; }
body[data-k='8'] .text, body[data-k='11'] .text { color: var(--nacht); }

.knopf {
  display: inline-flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 24px; border-radius: 999px; cursor: pointer;
  font-family: var(--rund); font-weight: 600; font-size: 17px; text-decoration: none; background: transparent; color: inherit;
  border: 2.5px solid currentColor; transition: transform .35s cubic-bezier(.34,1.56,.64,1), background .3s, color .3s;
}
.knopf:hover { transform: translateY(-2px) scale(1.03); }
.knopf:active { transform: scale(.96); }
.knopf--voll { background: var(--nacht); color: var(--creme); border-color: var(--nacht); }
.text[data-k='6'] .knopf { background: var(--sonne); color: var(--nacht); border-color: var(--sonne); margin-top: 6px; }
.text[data-k='6'] .knopf.ist-an { background: transparent; color: var(--sonne); }

.sticker { list-style: none; margin: 4px 0 26px; padding: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.sticker li {
  display: inline-flex; align-items: baseline; gap: 10px; padding: 12px 20px; border-radius: 18px; font-size: clamp(17px, 1.4vw, 21px);
  box-shadow: 0 6px 0 rgba(28,30,69,.18);
}
.sticker b { font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: .78em; }
.sticker--echt { background: var(--blatt); color: #fff; transform: rotate(-3deg); }
.sticker--gewollt { background: var(--sonne); color: var(--nacht); transform: rotate(2deg); margin-left: 18px; }
.sticker--erfunden { background: var(--koralle); color: #fff; transform: rotate(-1.5deg); margin-left: 6px; }
.ende__knoepfe { display: flex; flex-wrap: wrap; gap: 10px; }

/* Scroll-Hinweis */
.hinweis {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); margin: 0; z-index: 6;
  display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 600; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; opacity: .7;
}
.hinweis i { width: 26px; height: 40px; border: 2.5px solid currentColor; border-radius: 14px; position: relative; }
.hinweis i::after { content: ''; position: absolute; left: 50%; top: 7px; width: 5px; height: 9px; margin-left: -2.5px; border-radius: 3px; background: currentColor; animation: rad 1.8s ease-in-out infinite; }
@keyframes rad { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }

/* Fuss */
.fuss { position: relative; z-index: 3; display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px 28px; padding: 30px var(--gutter); background: var(--nacht); color: rgba(255,244,220,.7); font-size: 15px; }
.fuss nav { display: flex; gap: 22px; }
.fuss a { text-decoration: none; } .fuss a:hover { color: var(--creme); }
.quellen summary { cursor: pointer; font-weight: 600; color: var(--creme); }
.quellen ul { margin: 12px 0 0; padding-left: 18px; max-width: 70ch; }
.quellen li { margin-bottom: 6px; }
.quellen a { text-decoration: underline; text-underline-offset: 3px; }

/* Ohne JS: alle Texte untereinander */
html:not(.js) .text { opacity: 1; visibility: visible; position: relative; margin-bottom: 40px; }
html:not(.js) .texte { position: relative; transform: none; top: auto; padding: 120px var(--gutter); display: block; width: auto; }
html:not(.js) .buehne { height: auto; }

/* ---------- Hochformat / Telefon: Bild oben, Text unten ---------------------- */
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  :root { --s: min(calc(100vw - 12px), 56svh); }
  .leiste { padding: 12px 16px; }
  .leiste__kapitel { gap: 7px; }
  .leiste__kapitel button { width: 10px; height: 10px; }
  .buehne__innen { flex-direction: column; justify-content: space-between; padding: 58px 18px max(22px, env(safe-area-inset-bottom)); gap: 10px; }
  .bild { order: -1; margin-top: 0; }
  .texte { flex: none; width: 100%; }
  .text { align-self: start; }
  .text h1, .text h2 { font-size: clamp(30px, 8.4vw, 44px); margin-bottom: 10px; }
  .text p { font-size: 18px; max-width: none; margin-bottom: 10px; }
  .text .marke { margin-bottom: 12px; font-size: 11px; }
  .sticker { margin-bottom: 16px; gap: 8px; }
  .sticker li { padding: 9px 16px; font-size: 16px; }
  .knopf { min-height: 46px; font-size: 16px; padding: 0 20px; }
  .hinweis { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .15s !important; }
}

/* Kurze Telefone: Fazit-Sticker enger, sie sind hier der eigentliche Schlusstext */
@media (max-aspect-ratio: 1/1) and (max-height: 760px), (max-width: 760px) and (max-height: 760px) {
  .sticker { gap: 5px; margin-bottom: 8px; }
  .sticker li { padding: 6px 13px; font-size: 15px; }
}

/* ---------- Pfeile, kleine Telefone, ohne JS (Bestandspflege) ---------------- */
.pfeil { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.leiste__weg { gap: 6px; padding-left: 13px; }
.leiste__weg .pfeil { width: 17px; height: 17px; }
.knopf .pfeil { width: 20px; height: 20px; margin-right: -4px; }
/* Unter 420 px passt der Text nicht neben zwoelf Kapitelpunkte: nur der Pfeil bleibt */
@media (max-width: 420px) {
  .leiste__links { gap: 10px; }
  .leiste__marke img { width: 30px; height: 30px; }
  .leiste__weg { width: 40px; padding: 0; justify-content: center; }
  .leiste__weg .wort { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .leiste__kapitel { gap: 6px; }
  .leiste__kapitel button { width: 9px; height: 9px; border-width: 1.5px; }
}
/* Telefon: Schlussknoepfe kompakter, damit das Schlusskapitel neben das Bild passt */
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  .ende__knoepfe { gap: 8px; }
  .ende__knoepfe .knopf { min-height: 42px; padding: 0 16px; font-size: 15px; }
}
/* Sehr kurze Telefone (um 640 px Hoehe): Bild etwas kleiner, damit lange Kapitel ganz zu sehen sind */
@media (max-aspect-ratio: 1/1) and (max-height: 700px), (max-width: 760px) and (max-height: 700px) {
  :root { --s: min(calc(100vw - 12px), 46svh); }
}
/* Ohne JS: kein Film, sondern alle Kapitel als Lesetext untereinander */
html:not(.js) .buehne { height: auto; overflow: visible; }
html:not(.js) .buehne__innen { position: relative; inset: auto; display: block; padding: 0; }
html:not(.js) .texte { display: block; padding: 110px var(--gutter) 40px; max-width: 760px; }
html:not(.js) .text { opacity: 1; visibility: visible; margin-bottom: 56px; }
html:not(.js) .text h1, html:not(.js) .text h2 { font-size: clamp(30px, 5vw, 56px); }
html:not(.js) .text p { max-width: 60ch; }
html:not(.js) .zeilen { display: block; }
html:not(.js) .zeilen p, html:not(.js) .text .treffer { opacity: 1; visibility: visible; transform: none; }
html:not(.js) .bild, html:not(.js) .kulisse, html:not(.js) .hinweis, html:not(.js) .leiste__kapitel,
html:not(.js) .text button { display: none; }
