/* Compile Academy Cinema – Film-Intro, Lichtlinse, 3D-Glas, Filmstreifen-Story.
   Alles ist Verzierung: Ohne JavaScript oder mit reduzierter Bewegung bleibt die Seite vollständig. */

@view-transition {
  navigation: auto;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.45s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}
.nav {
  view-transition-name: byteling-nav;
}

/* ---------- Film-Intro ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: #03030c;
  overflow: hidden;
  clip-path: circle(150% at 50% 50%);
  transition: clip-path 1.1s cubic-bezier(0.7, 0, 0.2, 1);
}
.intro.out {
  clip-path: circle(0% at 50% 46%);
}
.intro canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.intro-leak {
  position: absolute;
  left: -40%;
  top: 46%;
  width: 180%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #9d86ff 30%, #fff 50%, #6fe7f7 70%, transparent);
  box-shadow:
    0 0 30px 6px rgba(157, 134, 255, 0.8),
    0 0 120px 30px rgba(111, 231, 247, 0.35);
  transform: translateX(-60%) scaleY(0.6);
  opacity: 0;
  animation: leak 1.6s cubic-bezier(0.6, 0, 0.2, 1) 0.15s forwards;
}
@keyframes leak {
  0% {
    opacity: 0;
    transform: translateX(-60%) scaleY(0.4);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(40%) scaleY(1.4);
  }
}
.intro-flare {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.55), rgba(34, 211, 238, 0.15) 40%, transparent 65%);
  opacity: 0;
  animation: flare 2.4s ease-out 0.5s forwards;
}
@keyframes flare {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0.7;
    transform: scale(1.15);
  }
}
.intro-stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 18px;
}
.intro-stage img {
  width: clamp(110px, 18vw, 170px);
  opacity: 0;
  filter: blur(14px) drop-shadow(0 0 40px rgba(124, 92, 255, 0.9));
  transform: scale(0.6) translateY(20px);
  animation: kodaIn 1.2s cubic-bezier(0.2, 1.2, 0.3, 1) 0.55s forwards;
}
@keyframes kodaIn {
  to {
    opacity: 1;
    filter: blur(0) drop-shadow(0 0 30px rgba(124, 92, 255, 0.7));
    transform: none;
  }
}
.intro-word {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.12em 0.32em;
  max-width: 92vw;
  font: 700 clamp(34px, 7vw, 76px) / 1 var(--display);
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: #fff;
}
.intro-word .intro-w {
  display: inline-flex;
  opacity: 1;
  filter: none;
  transform: none;
  animation: none;
}
.intro-word span {
  display: inline-block;
  opacity: 0;
  filter: blur(10px);
  transform: translateY(0.4em) rotateX(70deg);
  animation: letterIn 0.7s cubic-bezier(0.2, 1, 0.3, 1) forwards;
  animation-delay: calc(1s + var(--i) * 0.06s);
}
@keyframes letterIn {
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}
.intro-tag {
  font: 600 13px/1 var(--body);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: #b8b4e6;
  opacity: 0;
  animation: fadeUp 0.8s ease 1.65s forwards;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.intro-skip {
  position: absolute;
  right: 18px;
  bottom: 18px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  color: #d8d6ff;
  font: 600 13px var(--body);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  cursor: pointer;
}
.intro .bars::before,
.intro .bars::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 11vh;
  background: #000;
  z-index: 2;
}
.intro .bars::before {
  top: 0;
}
.intro .bars::after {
  bottom: 0;
}

/* ---------- Lichtpartikel hinter dem Hero ---------- */
.bokeh {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  width: 100%;
  height: 100%;
  mask-image: linear-gradient(180deg, #000 60%, transparent);
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent);
}
.hero {
  position: relative;
}

/* ---------- Liquid-Glass-Linse ---------- */
.lens {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 60;
  width: 150px;
  height: 150px;
  margin: -75px 0 0 -75px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-200px, -200px, 0) scale(0.6);
  transition: opacity 0.35s ease;
  -webkit-backdrop-filter: blur(1px) saturate(170%) brightness(1.08);
  backdrop-filter: blur(1px) saturate(170%) brightness(1.08);
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.75),
    inset 0 -3px 6px rgba(0, 0, 0, 0.25),
    inset 0 0 22px rgba(255, 255, 255, 0.18),
    0 20px 40px -12px rgba(0, 0, 0, 0.5);
}
.lens::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(60% 40% at 32% 22%, rgba(255, 255, 255, 0.55), transparent 70%),
    radial-gradient(50% 30% at 70% 85%, rgba(255, 255, 255, 0.12), transparent 70%);
}
.lens::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 1.5px;
  background: conic-gradient(from var(--angle), #fff, rgba(255, 255, 255, 0.1) 25%, rgba(255, 255, 255, 0.55) 50%, rgba(255, 255, 255, 0.05) 75%, #fff);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box exclude,
    linear-gradient(#000 0 0);
}
.lens.on {
  opacity: 1;
}
.lens-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--haze);
}
.lens-hint i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow:
    inset 0 1px 1px #fff,
    0 0 0 1px rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
}
@media (hover: none), (pointer: coarse) {
  .lens,
  .lens-hint {
    display: none;
  }
}

/* ---------- 3D-Glas: Kippen und Lichtpunkt ---------- */
.tilt {
  transform-style: preserve-3d;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(0);
  transition:
    transform 0.5s cubic-bezier(0.2, 0.9, 0.25, 1),
    box-shadow 0.4s ease;
  will-change: transform;
}
.tilt.active {
  transition: transform 0.08s linear;
}
.tilt > * {
  transform: translateZ(18px);
}
.tilt::before {
  background:
    radial-gradient(220px circle at var(--mx, 30%) var(--my, 0%), rgba(255, 255, 255, 0.24), transparent 65%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 40%) !important;
}

/* Glanz, der über Hauptbuttons streicht */
.btn:not(.ghost)::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-150%) skewX(-20deg);
  animation: sweep 5.5s ease-in-out infinite;
  pointer-events: none;
  will-change: transform;
}
/* Nur transform: läuft auf der Grafikkarte statt das Layout jedes Bild neu zu berechnen. */
@keyframes sweep {
  0%,
  70% {
    transform: translateX(-150%) skewX(-20deg);
  }
  100% {
    transform: translateX(330%) skewX(-20deg);
  }
}
.magnetic {
  transition: transform 0.5s var(--nx-spring, cubic-bezier(0.22, 1, 0.36, 1));
}

/* Lebendiger Farbverlauf im Text */
.grad {
  background-size: 220% auto !important;
  animation: gradShift 8s ease-in-out infinite alternate;
}
@keyframes gradShift {
  from {
    background-position: 0% 50%;
  }
  to {
    background-position: 100% 50%;
  }
}

/* Wörter fliegen einzeln herein */
[data-split] .w {
  display: inline-block;
  opacity: 0;
  filter: blur(8px);
  transform: translateY(0.55em);
  transition:
    opacity 0.7s ease,
    filter 0.7s ease,
    transform 0.8s cubic-bezier(0.2, 1, 0.3, 1);
  transition-delay: calc(var(--i) * 55ms);
}
.in[data-split] .w,
.in [data-split] .w {
  opacity: 1;
  filter: none;
  transform: none;
}

/* ---------- Der Film: Ein Lerntag in vier Szenen ---------- */
.film {
  position: relative;
  height: 420vh;
  padding: 0;
}
.film-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  gap: 22px;
}
.film-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  width: min(1160px, 100% - 32px);
  margin-inline: auto;
}
.film-head h2 {
  max-width: 760px;
}
.timecode {
  font: 600 15px/1 var(--mono);
  letter-spacing: 0.08em;
  padding: 10px 14px;
  border-radius: 999px;
  color: #ff6b6b;
  white-space: nowrap;
}
.timecode::before {
  content: '●';
  margin-right: 8px;
  animation: rec 1.2s steps(2) infinite;
}
@keyframes rec {
  50% {
    opacity: 0.2;
  }
}
.letterbox::before,
.letterbox::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: var(--bar, 0px);
  background: #000;
  z-index: 5;
  transition: height 0.4s ease;
}
.letterbox::before {
  top: 0;
}
.letterbox::after {
  bottom: 0;
}
.strip {
  position: relative;
  overflow: hidden;
  padding: 34px 0;
  background: rgba(0, 0, 0, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}
.strip::before,
.strip::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 16px;
  background: radial-gradient(circle at 12px 8px, rgba(255, 255, 255, 0.85) 0 4px, transparent 4.5px) 0 0 / 34px 16px repeat-x;
  opacity: 0.35;
  transform: translateX(var(--sprocket, 0px));
}
.strip::before {
  top: 9px;
}
.strip::after {
  bottom: 9px;
}
.track {
  display: flex;
  gap: 28px;
  padding-inline: max(16px, calc((100vw - 1160px) / 2));
  will-change: transform;
}
.scene {
  position: relative;
  flex: none;
  width: min(760px, 86vw);
  min-height: 420px;
  padding: 34px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  align-items: center;
  border-radius: 36px;
}
.scene .no {
  font: 700 13px/1 var(--display);
  letter-spacing: 0.24em;
  color: var(--violet-ink);
}
.scene h3 {
  font: 700 clamp(24px, 3vw, 34px) / 1.1 var(--display);
  margin: 12px 0;
  letter-spacing: -0.02em;
}
.scene p {
  margin: 0;
  color: var(--mist);
}
.scene-art {
  position: relative;
  height: 300px;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(80% 60% at 20% 10%, rgba(124, 92, 255, 0.5), transparent 60%),
    radial-gradient(70% 60% at 90% 90%, rgba(34, 211, 238, 0.35), transparent 60%), #0b0d24;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
/* Szene 1: Erklärseiten blättern */
.pages-art .pg {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 70%;
  height: 62%;
  padding: 16px;
  border-radius: 20px;
  color: #eef;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.5),
    0 20px 30px -14px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%) rotate(var(--r)) translateY(var(--y));
}
.pages-art .pg b {
  display: block;
  font-family: var(--display);
  margin-bottom: 8px;
}
.pages-art .pg code {
  display: block;
  margin-top: 10px;
  padding: 8px;
  border-radius: 10px;
  font: 12px var(--mono);
  color: #a8f05a;
  background: rgba(0, 0, 0, 0.4);
}
.scene.active .pages-art .pg:last-child {
  animation: flip 3s ease-in-out infinite;
}
@keyframes flip {
  0%,
  35% {
    transform: translate(-50%, -50%) rotate(-2deg);
  }
  55%,
  100% {
    transform: translate(-150%, -60%) rotate(-24deg);
    opacity: 0;
  }
}
/* Szene 2: Code tippt sich selbst */
.type-art pre {
  margin: 0;
  padding: 22px;
  font: 14px/1.7 var(--mono);
  color: #e3e7ff;
  white-space: pre-wrap;
}
.type-art .caret {
  display: inline-block;
  width: 9px;
  height: 1.1em;
  vertical-align: -2px;
  background: #22d3ee;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
.k {
  color: #c4b5ff;
}
.s {
  color: #a8f05a;
}
.n {
  color: #ffc857;
}
/* Szene 3: Richtig! */
.check-art {
  display: grid;
  place-items: center;
}
.check-art .ring {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #c6ff8f, #6fb82a);
  box-shadow:
    inset 0 3px 2px rgba(255, 255, 255, 0.6),
    0 0 0 0 rgba(168, 240, 90, 0.6),
    0 24px 40px -12px rgba(111, 184, 42, 0.8);
  transform: scale(0.4);
  opacity: 0;
}
.scene.active .check-art .ring {
  animation:
    popIn 0.9s cubic-bezier(0.2, 1.6, 0.3, 1) 0.2s forwards,
    pulseRing 2.2s ease-out 1.1s infinite;
}
@keyframes popIn {
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes pulseRing {
  0% {
    box-shadow:
      inset 0 3px 2px rgba(255, 255, 255, 0.6),
      0 0 0 0 rgba(168, 240, 90, 0.55),
      0 24px 40px -12px rgba(111, 184, 42, 0.8);
  }
  100% {
    box-shadow:
      inset 0 3px 2px rgba(255, 255, 255, 0.6),
      0 0 0 46px rgba(168, 240, 90, 0),
      0 24px 40px -12px rgba(111, 184, 42, 0.8);
  }
}
.check-art .xp {
  position: absolute;
  top: 18%;
  right: 16%;
  font: 700 22px var(--display);
  color: #ffc857;
  opacity: 0;
}
.scene.active .check-art .xp {
  animation: xpFloat 2.2s ease-out 0.8s infinite;
}
@keyframes xpFloat {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.8);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-40px) scale(1.1);
  }
}
/* Szene 4: Streak-Flamme */
.flame-art {
  display: grid;
  place-items: center;
}
.flame {
  width: 110px;
  height: 140px;
  border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%;
  background: radial-gradient(ellipse at 50% 72%, #fff3c4 0 18%, #ffc857 32%, #ff7a3d 58%, #ff4d6d 80%);
  box-shadow: 0 0 60px 10px rgba(255, 122, 61, 0.55);
  transform-origin: 50% 100%;
}
.scene.active .flame {
  animation: flick 0.9s ease-in-out infinite alternate;
}
@keyframes flick {
  0% {
    transform: scale(0.96, 1) rotate(-2deg);
  }
  100% {
    transform: scale(1.04, 1.08) rotate(2deg);
  }
}
.streak-no {
  position: absolute;
  bottom: 14%;
  font: 700 40px var(--display);
  color: #fff;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}
@media (max-width: 820px) {
  .film {
    height: auto;
  }
  .film-pin {
    position: relative;
    height: auto;
    padding: 70px 0;
  }
  .track {
    flex-direction: column;
    transform: none !important;
  }
  .scene {
    width: auto;
    grid-template-columns: 1fr;
  }
  .scene-art {
    height: 240px;
  }
  .film-head {
    flex-direction: column;
    align-items: start;
  }
  .strip::before,
  .strip::after {
    display: none;
  }
}

/* ---------- Flüssige Glasblasen (Gooey) ---------- */
.goo {
  position: absolute;
  inset: 0;
  z-index: -1;
  filter: url(#goo);
  opacity: 0.55;
  pointer-events: none;
}
.goo i {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(140deg, rgba(124, 92, 255, 0.9), rgba(34, 211, 238, 0.8));
  animation: gooMove 9s ease-in-out infinite alternate;
}
.goo i:nth-child(1) {
  width: 160px;
  height: 160px;
  left: 18%;
  top: 30%;
}
.goo i:nth-child(2) {
  width: 120px;
  height: 120px;
  left: 30%;
  top: 40%;
  animation-delay: -3s;
  background: linear-gradient(140deg, rgba(255, 95, 162, 0.9), rgba(124, 92, 255, 0.8));
}
.goo i:nth-child(3) {
  width: 140px;
  height: 140px;
  right: 18%;
  top: 25%;
  animation-delay: -6s;
}
.goo i:nth-child(4) {
  width: 100px;
  height: 100px;
  right: 30%;
  top: 45%;
  animation-delay: -1.5s;
  background: linear-gradient(140deg, rgba(255, 181, 71, 0.9), rgba(255, 95, 162, 0.8));
}
@keyframes gooMove {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(60px, -30px) scale(1.15);
  }
  100% {
    transform: translate(-40px, 40px) scale(0.9);
  }
}
.final {
  position: relative;
  isolation: isolate;
}

/* ---------- Zahlen zählen hoch ---------- */
[data-count] {
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .intro,
  .lens,
  .bokeh,
  .goo {
    display: none !important;
  }
  [data-split] .w {
    opacity: 1;
    filter: none;
    transform: none;
  }
  .tilt {
    transform: none !important;
  }
}

/* ---------- Compile Academy Studio: Kreativ-Apps ---------- */
.apps-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.app-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  min-height: 300px;
  text-decoration: none;
}
.app-card h3 {
  font: 700 22px/1.2 var(--display);
  letter-spacing: -0.02em;
}
.app-card p {
  margin: 0;
  color: var(--mist);
}
.app-no {
  font: 700 13px/1 var(--display);
  letter-spacing: 0.24em;
  color: var(--haze);
}
.app-go {
  margin-top: auto;
  font-weight: 600;
  color: var(--violet-ink);
}
.app-icon {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 38px 38px;
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.55),
    inset 0 -3px 8px rgba(0, 0, 0, 0.2),
    0 18px 30px -14px rgba(0, 0, 0, 0.6);
}
.app-icon.foto {
  background-color: #ff7a59;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='3'/%3E%3Ccircle cx='12' cy='12' r='3.5'/%3E%3Cpath d='M8 5l1.5-2h5L16 5'/%3E%3C/svg%3E"),
    linear-gradient(140deg, #ffb347, #ff5f6d);
  background-size:
    38px 38px,
    100% 100%;
}
.app-icon.film {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='8' width='18' height='12' rx='2'/%3E%3Cpath d='M3 8l2.5-4 4 2.5L13 4l4 2.5L20 4l1 4'/%3E%3Cpath d='M10 12l4 2-4 2z' fill='white'/%3E%3C/svg%3E"),
    linear-gradient(140deg, #7c5cff, #ff5fa2);
  background-size:
    38px 38px,
    100% 100%;
}
.app-icon.pdf {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3Cpath d='M8.5 14h7M8.5 17h5'/%3E%3C/svg%3E"),
    linear-gradient(140deg, #22d3ee, #3b82f6);
  background-size:
    38px 38px,
    100% 100%;
}
@media (max-width: 900px) {
  .apps-row {
    grid-template-columns: 1fr;
  }
  .app-card {
    min-height: 0;
  }
}
