body { isolation: isolate; }

.space-background {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: #02040a;
}

#star-parallax {
  position: absolute;
  inset: -26px;
  transform: translate3d(var(--star-x, 0px), var(--star-y, 0px), 0);
  transition: transform 235ms ease-out;
}

.space-drift {
  position: absolute;
  inset: -2.5%;
  background: url("../assets/starfield.webp") center 44% / cover no-repeat;
  animation: space-drift 46s ease-in-out infinite alternate;
}

@keyframes space-drift {
  from { transform: translate3d(-9px, 6px, 0) scale(1.012); }
  to { transform: translate3d(10px, -9px, 0) scale(1.034); }
}

.space-background::after {
  position: absolute;
  inset: 0;
  content: "";
  background: radial-gradient(ellipse at 55% 48%, transparent 45%, #02040a55 100%);
}

.meteor {
  position: absolute;
  top: 21%;
  left: 77%;
  width: 76px;
  height: 1px;
  border-radius: 50%;
  background: linear-gradient(90deg, #cde8ff, #6ab4ff9c 25%, transparent);
  box-shadow: -10px 0 12px #668eff80;
  opacity: 0;
  animation: shooting-star 32s linear -4s infinite;
}

.meteor-late {
  top: 42%;
  left: 94%;
  width: 51px;
  animation-duration: 43s;
  animation-delay: -29s;
}

@keyframes shooting-star {
  0%, 90% { opacity: 0; transform: translate(70px, -46px) rotate(-33deg); }
  91% { opacity: .8; }
  94%, 100% { opacity: 0; transform: translate(-222px, 144px) rotate(-33deg); }
}

.star-aura {
  position: absolute;
  inset: -13%;
  border-radius: 50%;
  pointer-events: none;
}

.star-aura::before {
  position: absolute;
  inset: 8%;
  content: "";
  border: 1px solid #3d9fff60;
  border-radius: inherit;
  box-shadow: 0 0 24px #3e87f66b;
  animation: aura-pulse 13s ease-in-out infinite alternate;
}

@keyframes aura-pulse {
  from { opacity: .34; transform: scale(.97); }
  to { opacity: .8; transform: scale(1.04); }
}

.star-aura i {
  position: absolute;
  inset: 0;
  transform: rotate(var(--angle));
}

.star-aura i::after {
  position: absolute;
  top: var(--edge, 4%);
  left: 50%;
  width: var(--size, 2px);
  height: var(--size, 2px);
  content: "";
  border-radius: 50%;
  background: #83ccff;
  box-shadow: 0 0 6px 1px #3180ff9c;
  opacity: 0;
  animation: aura-particle var(--period, 8s) ease-out var(--delay, 0s) infinite;
}
.star-aura i:nth-child(1) { --angle: 4deg; --delay: -3s; }
.star-aura i:nth-child(2) { --angle: 36deg; --delay: -9s; --edge: 7%; }
.star-aura i:nth-child(3) { --angle: 71deg; --delay: -2s; --period: 10s; }
.star-aura i:nth-child(4) { --angle: 109deg; --delay: -8s; --edge: 9%; }
.star-aura i:nth-child(5) { --angle: 144deg; --delay: -4s; --size: 3px; }
.star-aura i:nth-child(6) { --angle: 177deg; --delay: -1s; }
.star-aura i:nth-child(7) { --angle: 209deg; --delay: -6s; --edge: 8%; }
.star-aura i:nth-child(8) { --angle: 249deg; --delay: -4s; --period: 11s; }
.star-aura i:nth-child(9) { --angle: 282deg; --delay: -7s; --size: 3px; }
.star-aura i:nth-child(10) { --angle: 319deg; --delay: -2s; --edge: 9%; }

@keyframes aura-particle {
  0% { opacity: 0; transform: translateY(5px); }
  24% { opacity: .68; }
  80%, 100% { opacity: 0; transform: translateY(-10px); }
}

@media (prefers-reduced-motion: reduce) {
  #star-parallax { transform: none; transition: none; }
  .space-drift, .meteor, .star-aura::before, .star-aura i::after { animation: none; }
  .star-aura::before { opacity: .32; }
}
