:root {
  --space-cyan: rgba(84, 214, 255, 0.16);
  --space-violet: rgba(126, 110, 255, 0.15);
  --space-blue: rgba(45, 92, 180, 0.12);
}

.space-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 22%, var(--space-cyan), transparent 30rem),
    radial-gradient(circle at 82% 28%, var(--space-violet), transparent 34rem),
    radial-gradient(circle at 54% 78%, var(--space-blue), transparent 38rem),
    linear-gradient(180deg, rgba(2, 6, 14, 0.20), rgba(2, 5, 12, 0.04));
}

.shell {
  position: relative;
  z-index: 3;
}

.ambient {
  z-index: 2;
}

.space-bg::before,
.space-bg::after,
.space-stars {
  position: absolute;
  inset: -15%;
  content: "";
  background-repeat: repeat;
  will-change: transform;
}

.space-bg::before {
  opacity: 0.62;
  background-image:
    radial-gradient(circle at 30px 40px, rgba(255, 255, 255, 0.78) 0 1px, transparent 1.4px),
    radial-gradient(circle at 160px 95px, rgba(176, 224, 255, 0.62) 0 1px, transparent 1.4px),
    radial-gradient(circle at 285px 24px, rgba(255, 255, 255, 0.52) 0 1px, transparent 1.4px),
    radial-gradient(circle at 410px 145px, rgba(203, 210, 255, 0.58) 0 1px, transparent 1.4px);
  background-size: 460px 220px;
  animation: noesis-stars-far 92s linear infinite;
}

.space-bg::after {
  opacity: 0.42;
  background-image:
    radial-gradient(circle at 76px 54px, rgba(255, 255, 255, 0.94) 0 1.2px, transparent 1.7px),
    radial-gradient(circle at 225px 132px, rgba(152, 221, 255, 0.82) 0 1.2px, transparent 1.7px),
    radial-gradient(circle at 382px 72px, rgba(229, 224, 255, 0.84) 0 1.2px, transparent 1.7px);
  background-size: 520px 260px;
  animation: noesis-stars-mid 64s linear infinite reverse;
}

.space-stars {
  opacity: 0.28;
  background-image:
    radial-gradient(circle at 92px 70px, rgba(255, 255, 255, 0.98) 0 1.8px, transparent 2.2px),
    radial-gradient(circle at 310px 186px, rgba(122, 225, 255, 0.94) 0 1.6px, transparent 2px),
    radial-gradient(circle at 510px 92px, rgba(194, 184, 255, 0.94) 0 1.7px, transparent 2.1px);
  background-size: 620px 300px;
  animation: noesis-stars-near 40s linear infinite;
}

.space-nebula {
  position: absolute;
  width: 44rem;
  height: 44rem;
  border-radius: 50%;
  filter: blur(95px);
  opacity: 0.30;
  will-change: transform, opacity;
}

.space-nebula-a {
  top: -20rem;
  right: -12rem;
  background: rgba(98, 104, 255, 0.42);
  animation: noesis-nebula-a 28s ease-in-out infinite alternate;
}

.space-nebula-b {
  left: -18rem;
  bottom: -22rem;
  background: rgba(50, 194, 232, 0.36);
  animation: noesis-nebula-b 34s ease-in-out infinite alternate;
}

@keyframes noesis-stars-far {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-130px, 70px, 0); }
}

@keyframes noesis-stars-mid {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-190px, 100px, 0); }
}

@keyframes noesis-stars-near {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-240px, 125px, 0) scale(1.025); }
}

@keyframes noesis-nebula-a {
  from { transform: translate3d(0, 0, 0) scale(1); opacity: 0.22; }
  to { transform: translate3d(-36px, 24px, 0) scale(1.08); opacity: 0.38; }
}

@keyframes noesis-nebula-b {
  from { transform: translate3d(0, 0, 0) scale(1.02); opacity: 0.20; }
  to { transform: translate3d(44px, -26px, 0) scale(1.1); opacity: 0.34; }
}

@media (prefers-reduced-motion: reduce) {
  .space-bg::before,
  .space-bg::after,
  .space-stars,
  .space-nebula {
    animation: none !important;
  }
}
