/* The original nebula remains the source texture on every plane. Masks reveal
   different cloud fragments; the fixed shade keeps the opening statement calm. */
.nebula-depth {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  isolation: isolate;
  pointer-events: none;
  user-select: none;
  background: #0c1028;
}

.nebula-depth .nebula-plane {
  position: absolute;
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  transform-origin: 50% 50%;
  pointer-events: none;
  backface-visibility: hidden;
}

.nebula-depth .nebula-cloud img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center 54%;
  transform: none;
  pointer-events: none;
}

.nebula-depth .nebula-cloud--far {
  inset: -14%;
  z-index: 0;
  overflow: visible;
}
.nebula-depth .spellweave-background::after { display: none; }

.nebula-depth .nebula-cloud--middle {
  inset: -24%;
  z-index: 2;
  opacity: .49;
  mix-blend-mode: screen;
  -webkit-mask-image:
    radial-gradient(ellipse 41% 35% at 73% 42%, #000 12%, #000b 38%, transparent 76%),
    radial-gradient(ellipse 37% 25% at 47% 73%, #000a 4%, transparent 72%);
  mask-image:
    radial-gradient(ellipse 41% 35% at 73% 42%, #000 12%, #000b 38%, transparent 76%),
    radial-gradient(ellipse 37% 25% at 47% 73%, #000a 4%, transparent 72%);
}
.nebula-depth .nebula-cloud--middle img {
  object-position: 76% 62%;
  filter: saturate(1.14);
}

.nebula-depth .nebula-cloud--near {
  inset: -34%;
  z-index: 4;
  opacity: .35;
  mix-blend-mode: screen;
  -webkit-mask-image:
    radial-gradient(ellipse 30% 21% at 76% 42%, #000 10%, #000a 35%, transparent 72%),
    radial-gradient(ellipse 38% 23% at 47% 69%, #000d 7%, transparent 74%);
  mask-image:
    radial-gradient(ellipse 30% 21% at 76% 42%, #000 10%, #000a 35%, transparent 72%),
    radial-gradient(ellipse 38% 23% at 47% 69%, #000d 7%, transparent 74%);
}
.nebula-depth .nebula-cloud--near img {
  object-position: 91% 72%;
  filter: saturate(1.08) contrast(1.06);
}

.nebula-depth .nebula-stars--far { inset: -16%; z-index: 1; opacity: .57; }
.nebula-depth .nebula-stars--near { inset: -27%; z-index: 3; opacity: .81; }
.nebula-stars svg { display: block; width: 100%; height: 100%; overflow: visible; }
.nebula-star { fill: var(--orbit-b, #a9def3); }
.nebula-star--warm { fill: var(--orbit-c, #f7c98c); }
.nebula-star-cross { stroke: var(--orbit-white, #fff4dd); }

/* This shade stays fixed as the clouds pass behind it. It also hides all layer
   boundaries, leaving only diffuse texture and tiny points of light. */
.nebula-depth::after {
  position: absolute;
  inset: 0;
  z-index: 5;
  background:
    linear-gradient(90deg, #101126ef, #101126a8 30%, #1011263d 54%, #10112608 75%),
    linear-gradient(0deg, #101126df, transparent 25%, transparent 80%, #10112650);
  content: "";
  pointer-events: none;
}

.nebula-depth[data-reduced="true"] .nebula-plane,
.nebula-depth[data-reduced="true"] .nebula-cloud img { transform: none !important; }
.nebula-depth[data-reduced="true"] .nebula-cloud--far { inset: 0; }
.nebula-depth[data-reduced="true"] .nebula-cloud--middle { opacity: .24; }
.nebula-depth[data-reduced="true"] .nebula-cloud--near { opacity: .16; }

@media (max-width: 900px) {
  .nebula-depth .nebula-cloud--far img { object-position: 71% 70%; }
  .nebula-depth .nebula-cloud--middle img { object-position: 78% 57%; }
  .nebula-depth .nebula-cloud--near img { object-position: 65% 76%; }
  .nebula-depth::after {
    background:
      linear-gradient(180deg, #101126e3, #101126b8 25%, #10112620 53%, transparent 72%, #101126cf),
      linear-gradient(90deg, #10112638, transparent 24%, transparent 78%, #10112620);
  }
}

@media (prefers-reduced-motion: reduce) {
  .nebula-depth .nebula-plane,
  .nebula-depth .nebula-cloud img { transform: none !important; }
}
