body {
  font-family: system-ui, sans-serif;
  margin: 2rem;
}

body > p:first-of-type {
  position: fixed;
  top: 0.5rem;
  background: #fff;
}

.label {
  margin: 2rem 0 0;
}

.box {
  margin: 90vh 0;
  height: 20vh;
  display: grid;
  place-items: center;
  background: #eee;
  border-radius: 0.5rem;
  font-size: 1.5rem;
}

/* Ohne Support bleibt die Box einfach normal sichtbar — kein Fallback nötig,
   weil das @keyframes fade-in-up kein explizites "to" hat und damit auf
   den normalen (sichtbaren) Wert der .box zurückfällt. */
@media (prefers-reduced-motion: no-preference) {
  .box {
    animation: fade-in-up linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 40%;
  }
}

/* .box--fade-out ist ANDERS: ihr @keyframes endet explizit bei opacity:0.05
   (nicht beim normalen sichtbaren Wert). Ohne animation-timeline-Support
   fällt die Dauer auf 0s zurück (nie explizit gesetzt, die "Dauer" kommt ja
   sonst von der Scroll-Position) — mit fill-mode "both" landet die Box dann
   SOFORT und DAUERHAFT bei opacity:0.05, quasi unsichtbar. Deshalb hier kein
   bloßes prefers-reduced-motion, sondern ein echter Support-Gate: ohne
   @supports bekäme ein Browser ohne animation-timeline eine permanent fast
   unsichtbare Box statt einer normal sichtbaren. Gefunden beim Nachbauen von
   Kevin Powells "Incredible scroll-based animations with CSS-only". */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .box--fade-out {
      animation-name: fade-in-out;
      animation-range: entry 0% exit 120%;
    }
  }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(3rem);
  }
}

@keyframes fade-in-out {
  0%, 100% {
    opacity: 0.05;
  }
  50% {
    opacity: 1;
  }
}
