/* ============================================================
   BAM Artworks — Startseite als Film
   Die Bühne (.buehne) bleibt stehen, die Kapitel (.kapitel)
   scrollen darüber. Jedes Kapitel trägt seinen Text in einer
   haftenden Ebene; die Bilder zeichnet assets/js/film/film.js
   als reine Funktion der Scrollposition.
   Bild im Scope-Format, Bedienung in den schwarzen Balken.
   Ohne JavaScript: normale Seite mit Schlüsselbildern.
   ============================================================ */

.filmseite { background: #000; overflow-x: clip; }
.filmseite h1, .filmseite h2 { margin: 0; }
.filmseite p { max-width: none; }

:root {
  --balken-o: max(72px, calc((100svh - 100vw / 1.78) / 2));
  --balken-u: max(76px, calc((100svh - 100vw / 1.78) / 2));
  --rand: clamp(16px, 3vw, 40px);
  --schirm: 86vh;
}
@media (min-aspect-ratio: 3/2) {
  :root {
    --balken-o: max(72px, calc((100svh - 100vw / 2.39) / 2));
    --balken-u: max(76px, calc((100svh - 100vw / 2.39) / 2));
  }
}
@media (max-aspect-ratio: 1/1) {
  :root { --balken-o: 60px; --balken-u: 84px; }
}

/* ─── Bühne ─── */
.film { position: relative; }
.buehne {
  position: sticky; top: 0; z-index: 1;
  height: 100svh;
  display: grid; grid-template-rows: var(--balken-o) minmax(0, 1fr) var(--balken-u);
  background: #000; overflow: hidden;
}
.bild { position: relative; overflow: hidden; background: #000; }
.ebene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; max-width: none; }
img.ebene { object-fit: cover; }
.standbild { opacity: 1; }
.platte, .schlussbild { opacity: 0; will-change: opacity, transform; }
#folge, #drei, #staub { pointer-events: none; }
.bild::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.86) 0%, rgba(0, 0, 0, 0.42) 26%, rgba(0, 0, 0, 0) 52%);
  opacity: var(--blende-unten, 1);
}
.korn {
  opacity: 0.07; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  inset: -40px; width: auto; height: auto;
  animation: korn 0.9s steps(6) infinite;
}
@keyframes korn { to { transform: translate3d(34px, 22px, 0); } }
.bewegung-aus .korn, .ruhig .korn { animation: none; }
@media (prefers-reduced-motion: reduce) { .korn { animation: none; } }

.abblende { background: #000; opacity: var(--abblende, 0); pointer-events: none; transition: opacity 0.18s linear; }

.wischlinie {
  position: absolute; top: 0; bottom: 0; left: 0; width: 2px; display: none;
  background: var(--bam-gold); pointer-events: none;
}
.wischlinie span {
  position: absolute; top: 14px; left: 10px; white-space: nowrap;
  font-family: var(--bam-mono); font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: #000; background: var(--bam-gold); padding: 3px 8px; border-radius: 2px;
}

.etikett {
  position: absolute; right: var(--rand); bottom: 12px; z-index: 3;
  font-family: var(--bam-mono); font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--bam-gray-light); background: rgba(0, 0, 0, 0.72);
  padding: 3px 8px; border-radius: 2px; line-height: 1.5;
  opacity: var(--etikett, 1); transition: opacity 0.2s linear;
}

/* ─── Balken oben: Marke und Wiedergabe ─── */
.leiste { position: relative; z-index: 6; color: var(--bam-white); }
.leiste--oben { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 var(--rand); }
.wortmarke {
  display: flex; align-items: center; gap: 12px; min-height: 44px;
  color: var(--bam-white); font-size: 16px; letter-spacing: 4px; font-weight: 700; white-space: nowrap;
}
.wortmarke img { width: 54px; height: auto; }
.wortmarke__zusatz { color: var(--bam-gold); font-weight: 400; }
.wortmarke:hover { opacity: 1; }
.regler { display: flex; align-items: center; gap: 8px; }
.schalter {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; min-width: 44px; padding: 0 14px; justify-content: center;
  background: transparent; color: var(--bam-gray-light);
  border: 1px solid rgba(233, 233, 233, 0.4); border-radius: var(--bam-radius-pill);
  font-family: var(--bam-font); font-size: 13.5px; line-height: 1; cursor: pointer; white-space: nowrap;
  transition: border-color var(--bam-transition), color var(--bam-transition);
}
.schalter svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.schalter:hover { border-color: var(--bam-gold); color: var(--bam-white); }
.schalter:focus-visible, .kapitelnav a:focus-visible, .seiten__liste a:focus-visible { outline: 2px solid var(--bam-gold); outline-offset: 2px; }
.schalter[aria-pressed="true"] { border-color: var(--bam-gold); color: var(--bam-gold); }
.schalter .an { display: none; }
.schalter[aria-pressed="true"] .an { display: inline; }
.schalter[aria-pressed="true"] .aus { display: none; }
#schalter-ruhig[disabled] { opacity: 0.55; cursor: default; }
.seiten { position: relative; }
.seiten > summary { list-style: none; }
.seiten > summary::-webkit-details-marker { display: none; }
.seiten[open] > summary { border-color: var(--bam-gold); color: var(--bam-gold); }
.seiten__liste {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
  display: flex; flex-direction: column; min-width: 210px; padding: 8px;
  background: #0d0d0d; border: 1px solid rgba(233, 233, 233, 0.25); border-radius: var(--bam-radius-card);
}
.seiten__liste a { color: var(--bam-white); padding: 0 14px; min-height: 44px; display: flex; align-items: center; font-size: 15px; border-radius: 8px; }
.seiten__liste a:hover { background: rgba(255, 184, 0, 0.1); color: var(--bam-gold); opacity: 1; }
@media (max-width: 1180px) {
  .schalter { padding: 0; width: 44px; }
  .schalter span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-width: 480px) {
  :root { --rand: 14px; }
  .leiste--oben { gap: 10px; }
  .wortmarke { letter-spacing: 3px; font-size: 14px; gap: 8px; min-width: 0; }
  .wortmarke img { width: 40px; }
  .wortmarke__zusatz { display: none; }
  .regler { gap: 5px; flex: none; }
}
.buehne, .leiste { min-width: 0; max-width: 100vw; }
/* Sehr schmale Fenster (unter 340 px, etwa ein schmaler Seitenbereich): nur das Zeichen, Kapitel als Ziffern. */
@media (max-width: 339px) {
  :root { --rand: 10px; }
  .wortmarke > span { display: none; }
  .regler { gap: 4px; }
  .leiste--unten .kapitelnav { gap: 0; }
  .leiste--unten .kapitelnav a { min-width: 32px; padding: 0 1px; }
  .leiste--unten .kapitelnav a[aria-current="true"] .name { display: none; }
}

/* ─── Balken unten: Spur, Zeit, Kapitel ─── */
.leiste--unten { display: flex; flex-direction: column; }
.spur { height: 3px; background: rgba(233, 233, 233, 0.16); flex: none; }
.spur__kopf { height: 100%; background: var(--bam-gold); transform: scaleX(0); transform-origin: left center; will-change: transform; }
.leiste__reihe { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 var(--rand); min-height: 0; }
.zeit { font-size: 13px; letter-spacing: 2px; color: var(--bam-gray-mid); white-space: nowrap; min-width: 128px; }
.zeit__gesamt { color: #7d7d7d; }
.ladestand { font-size: 11px; letter-spacing: 2px; color: var(--bam-gray-mid); min-width: 128px; text-align: right; white-space: nowrap; }
.kapitelnav { display: flex; gap: 2px; align-items: center; }
.kapitelnav a {
  display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 11px;
  color: var(--bam-gray-light); font-size: 14px; white-space: nowrap; border-radius: 8px;
}
.kapitelnav .nr { font-family: var(--bam-mono); font-size: 11px; color: var(--bam-gray-mid); }
.kapitelnav a:hover { color: var(--bam-gold); opacity: 1; }
.kapitelnav a[aria-current="true"], .kapitelnav a[aria-current="true"] .nr { color: var(--bam-gold); }
@media (max-width: 1080px) {
  .zeit, .ladestand { display: none; }
  .leiste__reihe { justify-content: center; }
  .kapitelnav a { padding: 0 6px; min-width: 44px; justify-content: center; }
  .kapitelnav a .name { display: none; }
  .kapitelnav a[aria-current="true"] .name { display: inline; }
  .kapitelnav .nr { font-size: 12px; }
}

/* ─── Kapitel: Text über der Bühne ─── */
.kapitelfolge { position: relative; z-index: 2; margin-top: -100svh; pointer-events: none; }
.kapitel { position: relative; height: calc(var(--dauer) * var(--schirm)); }
.kapitel:last-child { height: calc(var(--dauer) * var(--schirm) + 100vh); }
.kapitel__haft {
  position: sticky; top: 0; height: 100svh;
  display: grid; grid-template-rows: var(--balken-o) minmax(0, 1fr) var(--balken-u);
  --sicht: 0;
}
/* Mit JavaScript liegt der Text auf der Bühne (film.js hängt ihn um). */
.buehne > .kapitel__haft { position: absolute; inset: 0; height: auto; z-index: 4; pointer-events: none; }
/* Kapitelsprünge sind Schnitte: kein weiches Scrollen durch den Film. */
html.js { scroll-behavior: auto; }
.kapitel__bild { display: none; }
.titel {
  grid-row: 2; align-self: end; justify-self: start;
  max-width: min(660px, 100% - 2 * var(--rand));
  margin: 0 var(--rand) 34px;
  display: flex; flex-direction: column; gap: 12px;
  opacity: var(--sicht); transform: translate3d(0, calc((1 - var(--sicht)) * 14px), 0);
  visibility: hidden;
}
.kapitel__haft.ist-da .titel, .kapitel__haft.ist-da .platz { visibility: visible; }
.titel h1 { font-size: clamp(34px, 5.1vw, 72px); line-height: 1; letter-spacing: -0.03em; color: var(--bam-white); text-wrap: balance; }
.titel h2 { font-size: clamp(27px, 3.3vw, 46px); line-height: 1.06; letter-spacing: -0.02em; color: var(--bam-white); text-wrap: balance; }
.titel__text { font-size: clamp(16px, 1.35vw, 19px); line-height: 1.5; color: var(--bam-gray-light); max-width: 56ch; }
.marke-zeile { font-size: 12px; letter-spacing: 4px; color: var(--bam-gold); line-height: 1.4; }
.scrollhinweis { display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 15px; color: var(--bam-white); }
.scrollhinweis svg { width: 18px; height: 18px; fill: none; stroke: var(--bam-gold); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; animation: sinken 1.8s ease-in-out infinite; }
@keyframes sinken { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(4px); } }
.bewegung-aus .scrollhinweis svg, .ruhig .scrollhinweis svg { animation: none; }
@media (prefers-reduced-motion: reduce) { .scrollhinweis svg { animation: none; } }

.schritte { list-style: none; padding: 0; margin: 2px 0 0; display: flex; flex-direction: column; gap: 6px; }
.schritte li { font-size: clamp(16px, 1.35vw, 19px); line-height: 1.45; color: var(--bam-gray-light); opacity: 0.38; padding-left: 16px; border-left: 2px solid rgba(233, 233, 233, 0.3); transition: opacity 0.2s linear, border-color 0.2s linear; }
.schritte li strong { color: var(--bam-white); font-weight: 700; }
.schritte li.an { opacity: 1; border-left-color: var(--bam-gold); }

.werkzeuge { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.werkzeuge li { font-size: 12.5px; line-height: 1.3; color: var(--bam-gray-light); border: 1px solid rgba(233, 233, 233, 0.4); border-radius: var(--bam-radius-pill); padding: 5px 12px; background: rgba(0, 0, 0, 0.35); }

/* Platzhalter für Arbeiten */
.platz {
  grid-row: 2; align-self: center; justify-self: center;
  width: min(1040px, 100% - 2 * var(--rand)); max-height: 100%;
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 48px); align-items: center;
  opacity: var(--sicht); transform: translate3d(0, calc((1 - var(--sicht)) * 18px), 0);
  visibility: hidden; pointer-events: auto;
}
.platz__bild {
  aspect-ratio: 16 / 9; border: 1.5px dashed rgba(233, 233, 233, 0.55); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px;
  background: repeating-linear-gradient(135deg, rgba(233, 233, 233, 0.07) 0 14px, rgba(233, 233, 233, 0) 14px 28px), #0c0c0c;
}
/* Marke Eigenbau: die Filmwand braucht mehr Breite als ein Standbild. Das Querformat-Bild (schmal) zeigt das ganze Motiv
   (contain), ohne Zoom und ohne Bewegung, damit keine Kachel und keine Schrift am Rand abgeschnitten wird. */
.platz--me { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); width: min(1180px, 100% - 2 * var(--rand)); }
.platz__wand .me-wall { margin: 0; max-width: none; }
.me-projektbild { padding: 0; overflow: hidden; border: 1px solid rgba(255, 184, 0, 0.5); background: #101112; }
.me-projektbild > img { position: static; inset: auto; width: 100%; height: 100%; max-width: 100%; object-fit: contain; transform: none; display: block; }
/* Karte mit Standbild: führt zum Film auf der Seite Arbeiten */
.platz__bild--foto { padding: 0; overflow: hidden; border: 1px solid rgba(255, 184, 0, 0.5); background: #0c0c0c; }
.platz__bild--foto img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s ease; }
.platz__bild--foto:hover img, .platz__bild--foto:focus-visible img { transform: scale(1.03); }
.platz__bild span { font-size: 12px; letter-spacing: 3px; color: var(--bam-gray-light); background: #0c0c0c; padding: 6px 12px; border-radius: 2px; }
.platz__text { display: flex; flex-direction: column; gap: 12px; }
.platz__text h2 { font-size: clamp(30px, 3.6vw, 52px); line-height: 1.04; letter-spacing: -0.02em; }

/* Schluss */
.titel--schluss { justify-self: center; align-self: center; text-align: center; align-items: center; margin-bottom: 0; pointer-events: auto; }
.titel--schluss h2 { font-size: clamp(30px, 4.2vw, 58px); }
.titel--schluss h2, .titel--schluss .titel__text { text-shadow: 0 2px 18px rgba(0, 0, 0, 0.9); }
.titel--schluss .titel__text { color: var(--bam-white); }
.titel--schluss .btn { margin-top: 10px; }
.titel a, .platz a { pointer-events: auto; }

/* Hochformat */
@media (max-aspect-ratio: 1/1) {
  .titel { margin-bottom: 26px; gap: 10px; }
  .platz { grid-template-columns: 1fr; gap: 18px; }
  .platz__text { text-align: left; }
  .etikett { bottom: auto; top: 10px; }
}
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .titel { margin-bottom: 16px; gap: 6px; }
  .titel__text, .schritte li { font-size: 14.5px; }
  .werkzeuge { display: none; }
}

/* Ohne Kamerafahrt: Text steht, nichts gleitet */
.ruhig .titel, .ruhig .platz { transform: none; }
@media (prefers-reduced-motion: reduce) { .titel, .platz { transform: none; } }

.abspann { position: relative; z-index: 3; background: #000; }
.draft-badge { z-index: 150; left: auto; right: 14px; bottom: auto; top: 8px; font-size: 9.5px; padding: 3px 7px; opacity: 0.8; }
@media (max-width: 1180px) { .draft-badge { display: none; } }

/* ─── Ohne JavaScript: lesbare Seite mit Schlüsselbildern ─── */
.no-js .buehne { display: none; }
.no-js .kapitelfolge { margin-top: 0; pointer-events: auto; }
.no-js .kapitel, .no-js .kapitel:last-child { height: auto; padding: 40px 0; }
.no-js .kapitel__haft { position: static; height: auto; display: block; }
.no-js .kapitel__bild { display: block; width: 100%; height: auto; margin-bottom: 24px; }
.no-js .titel, .no-js .platz { opacity: 1; transform: none; visibility: visible; margin: 0 var(--rand); }
.no-js .platz { margin: 0 auto; }
.no-js .scrollhinweis { display: none; }


/* ═══ Version 3: Designsystem im Film (docs/DESIGNSYSTEM_V3.md) ═══ */
.wortmarke img { width: 40px; height: 40px; transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.1, 1); }
.wortmarke:hover img, .wortmarke:focus-visible img { transform: rotate(60deg); }
.menue > summary.schalter { cursor: pointer; }
html.menue-offen .leiste--unten, html.menue-offen .kapitel__haft { visibility: hidden; }

/* Große Zeilen: Kontur beim Fahren, Vollschrift beim Anhalten (film.js setzt .voll, --rein, --raus) */
.titel { max-width: min(1040px, 100% - 2 * var(--rand)); gap: 14px; }
.titel .titel__text, .titel .schritte { max-width: 52ch; }
.titel h1.zeilen { font-size: clamp(38px, 7.6vw, 124px); }
.titel h2.zeilen { font-size: clamp(30px, 5.2vw, 84px); }
.titel .zeilen { line-height: 0.9; letter-spacing: -0.02em; transform-origin: 0 100%; }
.titel .kv { --kv-strich: 1.4px; filter: drop-shadow(0 2px 14px rgba(0, 0, 0, 0.55)); transform: translate3d(0, calc((1 - var(--rein, 1)) * (0.5em + var(--i, 0) * 0.3em)), 0); }
.titel--schluss .zeilen { align-items: center; transform-origin: 50% 100%; }
.titel--schluss h2.zeilen { font-size: clamp(30px, 5.6vw, 88px); }
/* Am Ende eines Kapitels nimmt die Zeile die Bewegung der nächsten Einstellung auf */
.titel[data-zug="vor"] .zeilen { transform: scale(calc(1 + var(--raus, 0) * 0.55)); }
.titel[data-zug="dreh"] .zeilen { transform: perspective(900px) rotateY(calc(var(--raus, 0) * -78deg)); }
.titel[data-zug="hoch"] .zeilen { transform: translate3d(0, calc(var(--raus, 0) * -1.3em), 0); }
.titel[data-zug="wisch"] .zeilen { clip-path: inset(-0.2em 0 -0.2em calc(var(--raus, 0) * 104%)); transform: translate3d(calc(var(--raus, 0) * 5vw), 0, 0); }
.weiter-film { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }
.weiter-film .knopf { pointer-events: auto; }

/* Pixelfeld über dem Bild und Schnitt über das Feld statt über Schwarz */
#code { pointer-events: none; }
/* BÄM im Film: die Blase aus der Clip Factory springt auf, wenn das Bild fertig ist. Lage und Größe setzt film.js aus der
   Scrollposition. Pixelgrafik: nie geglättet. */
.baem-film { position: absolute; left: 0; top: 0; width: 150px; height: auto; max-width: none; opacity: 0; pointer-events: none; image-rendering: pixelated; transform-origin: 50% 50%; will-change: transform, opacity; filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.5)); }
.schnitt { background: #07090a; opacity: 0; pointer-events: none; transition: opacity 0.16s linear; }

html.ruhig .titel .kv { transform: none; }
html.ruhig .titel[data-zug] .zeilen { transform: none; clip-path: none; }
@media (max-aspect-ratio: 999/1000) {
  .titel h1.zeilen { font-size: clamp(36px, 12.4vw, 76px); }
  .titel h2.zeilen { font-size: clamp(28px, 9.2vw, 58px); }
}
.no-js .titel .zeilen { font-size: clamp(30px, 6vw, 72px); }
