/* Bestphonedealz Reparatur – Kino-Ebene für den Kopfbereich (Licht, Dunst, Staub, Korn, Auftakt).
   Liegt über main.css und ändert weder Texte noch Ablauf. Ohne JavaScript bleibt alles sichtbar:
   der Auftakt läuft rein über CSS und endet immer im offenen Zustand. Erzeugt/eingebunden über gen/make_cine.py. */

@property --key { syntax: '<color>'; inherits: true; initial-value: #ff4257; }

/* ---------- Farbstimmung je Kapitel: ein Scheinwerfer, fünf Lichtfarben ---------- */
.story { --key: #ff4257; --cool: #1c8fd6; --c-ease: cubic-bezier(.16, 1, .3, 1);
  background:
    radial-gradient(120% 92% at 56% 46%, transparent 52%, rgba(3, 1, 8, .5) 84%, rgba(3, 1, 8, .86) 100%),
    radial-gradient(60% 34% at 46% 66%, color-mix(in srgb, var(--key) 10%, transparent) 0%, transparent 72%),
    radial-gradient(56% 30% at 60% 88%, color-mix(in srgb, var(--cool) 9%, transparent) 0%, transparent 70%),
    radial-gradient(44% 56% at 71% 46%, color-mix(in srgb, var(--key) 15%, transparent) 0%, transparent 72%),
    radial-gradient(46% 56% at 0% 104%, color-mix(in srgb, var(--cool) 26%, transparent) 0%, transparent 72%),
    radial-gradient(40% 46% at 100% 0%, rgba(120, 70, 255, .16) 0%, transparent 70%),
    linear-gradient(180deg, #06030d 0%, #0a0616 52%, #040209 100%); }
html[data-ch="1"] .story { --key: #8f62ff; }
html[data-ch="2"] .story { --key: #ff9d3c; }
html[data-ch="3"] .story { --key: #2fe0a8; }
html[data-ch="4"] .story { --key: #ffc45e; }

/* die bunten Nebel und Sterne treten zurück – das Licht übernimmt */
.story .neb { opacity: .2; }
.story .stars { opacity: .3; }
.story .stars2 { opacity: .22; }
.story .shoot { display: none; }
.story .gword { -webkit-text-stroke: 0; color: color-mix(in srgb, var(--key) 4%, rgba(255, 255, 255, .018)); }

/* ---------- die Ebene selbst ---------- */
.cine { position: absolute; inset: 0; pointer-events: none; }
.cine > * { position: absolute; pointer-events: none; }

/* Scheinwerfer: Lichtkegel von oben rechts auf das Handy (Ursprung, Winkel und Länge setzt cine.js passend zur Bühne) */
.c-beamwrap { left: var(--ox, 88%); top: var(--oy, -150px); width: 0; height: 0; transform: rotate(var(--ang, 22deg)); z-index: 3; animation: c-lights 1.15s .42s both; }
.c-beam { position: absolute; left: -560px; top: 0; width: 1120px; height: var(--len, 1180px); opacity: .5;
  background:
    repeating-conic-gradient(from 165deg at 50% 0, rgba(255, 255, 255, 0) 0deg, rgba(255, 255, 255, .2) .5deg, rgba(255, 255, 255, 0) 1.5deg, rgba(255, 255, 255, 0) 3.3deg),
    conic-gradient(from 165deg at 50% 0, transparent 0deg, color-mix(in srgb, var(--key) 56%, transparent) 8deg, rgba(255, 250, 240, .58) 15deg, color-mix(in srgb, var(--key) 56%, transparent) 22deg, transparent 30deg, transparent 360deg);
  -webkit-mask-image: conic-gradient(from 165deg at 50% 0, transparent 1deg, #000 9deg, #000 21deg, transparent 29deg, transparent 360deg), linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .78) 42%, rgba(0, 0, 0, .3) 74%, transparent 98%);
  mask-image: conic-gradient(from 165deg at 50% 0, transparent 1deg, #000 9deg, #000 21deg, transparent 29deg, transparent 360deg), linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .78) 42%, rgba(0, 0, 0, .3) 74%, transparent 98%);
  -webkit-mask-composite: source-in; mask-composite: intersect; }

/* Staub im Licht (Canvas, von cine.js gezeichnet) */
.c-dust { left: 0; top: 0; }

/* Linsenreflex: blauer Lichtstreifen über dem Glas plus kleine Geisterbilder */
.c-flare { left: 0; top: 0; width: 0; height: 0; z-index: 3; transform: translate(var(--fx, 71vw), var(--fy, 300px)); }
.c-flare i { position: absolute; display: block; border-radius: 50%; }
.c-flare .c-streak { left: -230px; top: -.5px; width: 460px; height: 1px; border-radius: 3px; background: linear-gradient(90deg, transparent 0%, rgba(110, 160, 255, .0) 8%, rgba(150, 195, 255, .9) 50%, rgba(110, 160, 255, .0) 92%, transparent 100%); box-shadow: 0 0 26px 7px rgba(80, 140, 255, .32), 0 0 90px 22px rgba(80, 140, 255, .12); opacity: .42; animation: c-breathe 6s ease-in-out infinite, c-streak-in 1.1s .5s var(--c-ease) both; }
.c-flare .c-core { left: -70px; top: -70px; width: 140px; height: 140px; background: radial-gradient(closest-side, rgba(255, 255, 255, .5), color-mix(in srgb, var(--key) 30%, transparent) 40%, transparent 72%); opacity: .55; animation: c-breathe 6s ease-in-out infinite; }

/* Belichtungsblitz beim Kapitelwechsel */
.c-flare .c-flash { left: -330px; top: -330px; width: 660px; height: 660px; background: radial-gradient(closest-side, rgba(255, 255, 255, .5), transparent 100%); opacity: 0; }
.cine.cut .c-flash { animation: c-flash .7s ease-out; }
.cine.cut .c-streak { animation: c-breathe 6s ease-in-out infinite, c-streak-in 1.1s .5s var(--c-ease) both, c-streak-cut .85s var(--c-ease); }

/* Filmkorn (nur auf großen Bildschirmen mit Maus) */
.c-grain { display: none; inset: -40px; z-index: 8; opacity: .05; 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='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); background-size: 240px 240px; }
@media (hover: hover) and (pointer: fine) and (min-width: 1101px) { .c-grain { display: block; } }

/* Auftakt: das Bild öffnet sich wie eine Blende */
/* Grundzustand = offen und unsichtbar; nur die Animation liefert den geschlossenen Anfang (fällt sie weg, bleibt die Bühne frei) */
.c-bar { left: 0; right: 0; height: 50.5%; z-index: 10; background: #030108; transform: scaleY(0); visibility: hidden; animation: c-open .95s .12s cubic-bezier(.76, 0, .24, 1) both; }
.c-top { top: 0; transform-origin: 50% 0; box-shadow: 0 1px 0 rgba(255, 255, 255, .14); }
.c-bot { bottom: 0; transform-origin: 50% 100%; box-shadow: 0 -1px 0 rgba(255, 255, 255, .14); }

/* ---------- Bühne: Handy, Boden, Text ---------- */
.story .scene { animation: c-reveal .7s .45s ease-out both; }
.story .floor { width: 620px; height: 130px; margin-left: -310px; bottom: -22px; background: radial-gradient(closest-side, rgba(3, 1, 8, .9) 0%, rgba(3, 1, 8, .55) 38%, transparent 70%), radial-gradient(closest-side, color-mix(in srgb, var(--key) 46%, transparent) 0%, transparent 100%); }

.story .stext > p:first-of-type { animation: c-up .7s .3s var(--c-ease) both; }
.story .h1x { animation: c-rack .8s .3s var(--c-ease) both; }
.story .stext > p:nth-of-type(2) { animation: c-up .7s .5s var(--c-ease) both; }
.story .stext > ul { animation: c-up .7s .58s var(--c-ease) both; }
.story .stext > div { animation: c-up .7s .66s var(--c-ease) both; }
@media (hover: hover) and (pointer: fine) and (min-width: 1101px) { .story .stext { animation: c-focus .8s .3s var(--c-ease) both; } }
html.cine-cut .story .h1x { animation: c-rack .8s .3s var(--c-ease) both, c-rack2 .6s var(--c-ease) both; }
html.cine-cut .story .stext > p:nth-of-type(2) { animation: c-up .7s .5s var(--c-ease) both, c-up2 .55s .06s var(--c-ease) both; }
html.cine-cut .story .stext > ul { animation: c-up .7s .58s var(--c-ease) both, c-up2 .55s .1s var(--c-ease) both; }

/* Handy: gefüllte Metallkante (dünne Scheiben zwischen Rückseite und Glas), Glasreflex, Randlicht in der Lichtfarbe */
.story .rig > .ph:nth-child(2), .story .rig > .ph:nth-child(3), .story .rig > .ph:nth-child(6) { transform-style: preserve-3d; }
.story .rig::before, .story .rig > .ph:nth-child(2)::before, .story .rig > .ph:nth-child(2)::after, .story .rig > .ph:nth-child(3)::before, .story .rig > .ph:nth-child(3)::after, .story .rig > .ph:nth-child(6)::before, .story .rig > .ph:nth-child(6)::after {
  content: ""; position: absolute; inset: -2px; box-sizing: border-box; border-radius: 46px; border: 3px solid; border-color: #f1ecff #b9aaf0 #5b48ab #8d79da; pointer-events: none; }
.story .rig::before { inset: 0; transform: translateZ(5.25px); }
.story .rig > .ph:nth-child(2)::before { transform: translateZ(1.5px); border-color: #cfc4f6 #9d8be2 #4a399a #7663c6; }
.story .rig > .ph:nth-child(2)::after { transform: translateZ(4.5px); border-color: #d8cef8 #a595e6 #5140a2 #7d6acd; }
.story .rig > .ph:nth-child(3)::before { transform: translateZ(3px); }
.story .rig > .ph:nth-child(3)::after { transform: translateZ(4.5px); }
.story .rig > .ph:nth-child(6)::before { inset: -11px; transform: translateZ(1.75px); }
.story .rig > .ph:nth-child(6)::after { inset: -11px; transform: translateZ(3.5px); }
.story .rig > .ui { box-shadow: 0 0 0 2px #9483e6, 0 44px 90px rgba(3, 1, 8, .78), 0 0 80px color-mix(in srgb, var(--key) 34%, transparent); }
.story .rig > .ui::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; background: linear-gradient(118deg, transparent 22%, rgba(255, 255, 255, .13) 36%, rgba(255, 255, 255, .03) 46%, transparent 56%); background-size: 260% 100%; background-position: 40% 0; animation: c-glass 1.5s .7s var(--c-ease) both; }

/* Lesbarkeit: Hauptknopf endet in einem dunkleren Orange, Kapitelnamen in der Leiste sind heller (beides vorher unter 4,5:1) */
.story .stext a.press { background: linear-gradient(100deg, #7B2CFF 0%, #D0246E 58%, #C2410C 100%) !important; }
.story .rail button[aria-pressed="false"] { color: #DCD3F3 !important; }

/* Schalter „Animationen pausieren“ (erscheint nur, wenn cine.js läuft) */
.c-pause { display: none; position: absolute; z-index: 6; left: 14px; bottom: 16px; width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .28); background: rgba(10, 6, 22, .6); color: #FFFFFF; cursor: pointer; align-items: center; justify-content: center; transition: background-color .15s ease, border-color .15s ease; }
html.cine-on .c-pause { display: inline-flex; }
.c-pause:hover { background: rgba(40, 24, 80, .85); border-color: rgba(255, 255, 255, .5); }
.c-pause .c-ic-play, .c-pause[aria-pressed="true"] .c-ic-pause { display: none; }
.c-pause[aria-pressed="true"] .c-ic-play { display: block; }

/* ---------- Bewegungen ---------- */
@keyframes c-open { from { transform: scaleY(1); visibility: visible; } to { transform: scaleY(0); visibility: hidden; } }
@keyframes c-lights { 0% { opacity: 0; } 30% { opacity: .85; } 38% { opacity: .15; } 52% { opacity: .95; } 60% { opacity: .5; } 100% { opacity: 1; } }
@keyframes c-reveal { from { opacity: 0; } to { opacity: 1; } }
@keyframes c-rack { from { transform: translateY(14px) scale(1.03); } to { transform: none; } }
@keyframes c-focus { from { filter: blur(12px); } to { filter: blur(0); } }
@keyframes c-rack2 { from { opacity: .2; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes c-up { from { transform: translateY(18px); } to { transform: none; } }
@keyframes c-up2 { from { opacity: .2; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes c-breathe { 0%, 100% { opacity: .14; } 50% { opacity: .3; } }
@keyframes c-streak-in { 0% { transform: scaleX(.02); } 40% { transform: scaleX(1.3); } 100% { transform: scaleX(1); } }
@keyframes c-streak-cut { 0% { transform: scaleX(.3); opacity: .3; } 25% { transform: scaleX(1.5); opacity: 1; } 100% { transform: scaleX(1); opacity: .45; } }
@keyframes c-flash { 0% { opacity: 0; } 14% { opacity: .22; } 100% { opacity: 0; } }
@keyframes c-glass { from { background-position: 120% 0; } to { background-position: 40% 0; } }

/* ---------- schmale Bildschirme: gleiche Stimmung, weniger Last ---------- */
@media (max-width: 1100px) {
  .c-bar { display: none; }
  .c-beam { background: conic-gradient(from 165deg at 50% 0, transparent 0deg, color-mix(in srgb, var(--key) 50%, transparent) 8deg, rgba(255, 250, 240, .34) 15deg, color-mix(in srgb, var(--key) 50%, transparent) 22deg, transparent 30deg, transparent 360deg); -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .25) 30%, #000 60%, transparent 98%); mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .25) 30%, #000 60%, transparent 98%); -webkit-mask-composite: source-over; mask-composite: add; }
  .story .floor { width: 420px; height: 96px; margin-left: -210px; }
}

/* ---------- wer weniger Bewegung möchte, bekommt ein ruhiges Standbild ---------- */
@media (prefers-reduced-motion: reduce) {
  .c-bar, .c-flash { display: none; }
  .cine *, .story .scene, .story .stext, .story .stext > *, .story .h1x, .story .rig > .ui::after { animation: none !important; }
  .story { transition: none; }
}

/* ---------- vom Besucher pausiert: alles in der Bühne steht still, der Inhalt bleibt ---------- */
html.calm .c-bar, html.calm .c-flash { display: none; }
html.calm .story *, html.calm .story *::before, html.calm .story *::after { animation: none !important; }

/* ---------- schwaches Gerät (von cine.js gemessen): Licht bleibt, Dauerbewegung der Kino-Ebene endet ---------- */
html.cine-lite .c-dust { display: none; }
html.cine-lite .cine * { animation: none !important; }
