/*
 * The demo episode, above the horizon: sky, stars, a shooting star now and then, the moon and
 * drifting clouds. The clouds follow the episode time (--cloud, from stage.js); the stars and
 * the shooting star keep their own clock and stop while the episode is paused (scene.css).
 */
.picture {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  container-type: inline-size;
  background: #120d2b;
}

.scene,
.scene > span {
  position: absolute;
}

.scene {
  inset: 0;
  transition: filter 0.35s ease;
}

.sky {
  inset: 0;
  background:
    radial-gradient(70% 38% at 50% 80%, rgba(255, 92, 132, 0.42), transparent 70%),
    linear-gradient(180deg, #0f0b26 0%, #251140 40%, #5c1a4b 70%, #b8365a 100%);
}

.stars {
  inset: 0 0 38% 0;
  background-image:
    radial-gradient(1.5px 1.5px at 8% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 21% 42%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 33% 12%, #ffe3ec 50%, transparent 51%),
    radial-gradient(1px 1px at 46% 30%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 8%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 64% 46%, #ffe3ec 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 22%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 94% 10%, #fff 50%, transparent 51%);
  animation: twinkle 2.6s ease-in-out infinite alternate;
}

.stars-b {
  background-image:
    radial-gradient(1px 1px at 14% 30%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 27% 6%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 52% 18%, #ffe3ec 50%, transparent 51%),
    radial-gradient(1px 1px at 86% 40%, #fff 50%, transparent 51%);
  animation-duration: 1.9s;
  animation-delay: -1s;
}

/*
 * A shooting star: a bright head and a tail that stretches along its path, then fades. The
 * element is rotated once; the keyframes slide it along its own axis.
 */
.shooting {
  top: 7%;
  left: 6%;
  width: 20cqw;
  height: 0.3cqw;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 235, 245, 0.9));
  opacity: 0;
  transform-origin: 100% 50%;
  animation: shoot 9s cubic-bezier(0.3, 0.5, 0.5, 1) 1.2s infinite;
}

.shooting::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -0.35cqw;
  width: 0.8cqw;
  height: 0.8cqw;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 1.2cqw 0.35cqw rgba(255, 220, 235, 0.9);
  transform: translateY(-50%);
}

.moon {
  top: 10%;
  right: 15%;
  width: 11cqw;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 58%, rgba(214, 150, 178, 0.35) 0 9%, transparent 10%),
    radial-gradient(circle at 62% 30%, rgba(214, 150, 178, 0.28) 0 6%, transparent 7%),
    radial-gradient(circle at 66% 66%, rgba(214, 150, 178, 0.22) 0 5%, transparent 6%),
    radial-gradient(circle at 38% 36%, #fff6f9, #ffe2ec 60%, #f4c4d6);
  box-shadow: 0 0 5cqw rgba(255, 190, 215, 0.5), 0 0 14cqw rgba(255, 120, 170, 0.22);
}

.clouds {
  top: 15%;
  left: 0;
  right: 0;
  height: 18%;
  background-repeat: repeat-x;
  background-size: 120cqw 100%;
  background-position-x: var(--cloud, 0);
  background-image:
    radial-gradient(20% 36% at 20% 55%, rgba(255, 170, 200, 0.16), transparent 70%),
    radial-gradient(15% 28% at 64% 40%, rgba(255, 170, 200, 0.12), transparent 70%);
}

@keyframes twinkle {
  from { opacity: 0.5; }
  to { opacity: 1; }
}

@keyframes shoot {
  0% { opacity: 0; transform: rotate(16deg) translateX(0) scaleX(0.1); }
  1% { opacity: 1; }
  7% { opacity: 1; transform: rotate(16deg) translateX(34cqw) scaleX(1); }
  10%, 100% { opacity: 0; transform: rotate(16deg) translateX(44cqw) scaleX(0.6); }
}

@media (prefers-reduced-motion: reduce) {
  .stars,
  .shooting {
    animation: none;
  }
}
