/* A quiet atmospheric layer behind the editorial content. */
body.ambient-enabled {
  isolation: isolate;
}

.ambientScene {
  contain: strict;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}

.ambientCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ambientHalo {
  position: absolute;
  width: max(650px, 75vw);
  height: max(650px, 90vh);
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
}

body.ambient-enabled .ambientHaloA {
  top: -40vh;
  left: -35vw;
  background: radial-gradient(ellipse, rgb(79 124 255 / 0.11), rgb(52 118 178 / 0.045) 30%, transparent 67%);
  animation: ambient-drift-a 39s ease-in-out infinite alternate !important;
}

body.ambient-enabled .ambientHaloB {
  right: -40vw;
  bottom: -48vh;
  background: radial-gradient(ellipse, rgb(69 200 245 / 0.075), rgb(91 157 255 / 0.025) 35%, transparent 66%);
  animation: ambient-drift-b 47s ease-in-out infinite alternate !important;
}

body.ambient-enabled .ambientBrandGlow {
  position: absolute;
  inset: -4px;
  border: 1px solid rgb(69 200 245 / 0.34);
  border-radius: inherit;
  pointer-events: none;
  animation: ambient-brand-breathe 5.5s ease-in-out infinite !important;
}

body.ambient-enabled .ambientAsterisk {
  transform-origin: 50% 47%;
  animation: ambient-asterisk-turn 60s linear infinite !important;
}

body.ambient-enabled .ambientStripSpark {
  display: inline-block;
  animation: ambient-asterisk-turn 30s linear infinite !important;
  animation-delay: var(--ambient-spark-delay, 0s) !important;
}

/* Explicit play-state keeps the current phase when the shared motion control
   applies its general animation:none rule to the rest of the document. */
body.ambient-enabled :is(.ambientHalo, .ambientBrandGlow, .ambientAsterisk, .ambientStripSpark) {
  animation-play-state: running !important;
}

body.ambient-enabled:is(.ambient-still, .ambient-suspended, .motion-paused) :is(.ambientHalo, .ambientBrandGlow, .ambientAsterisk, .ambientStripSpark) {
  animation-play-state: paused !important;
}

@keyframes ambient-drift-a {
  from { transform: translate3d(0, 0, 0) scale(0.94); }
  to { transform: translate3d(16vw, 24vh, 0) scale(1.12); }
}

@keyframes ambient-drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.04); }
  to { transform: translate3d(-17vw, -21vh, 0) scale(0.9); }
}

@keyframes ambient-brand-breathe {
  0%, 100% { opacity: 0.18; transform: scale(0.93); }
  50% { opacity: 0.75; transform: scale(1.04); }
}

/* The individual rotate property does not replace existing transforms. */
@keyframes ambient-asterisk-turn {
  to { rotate: 360deg; }
}

@media (max-width: 650px) {
  .ambientHalo { width: 110vw; height: 75vh; }
  body.ambient-enabled .ambientHaloA { left: -55vw; top: -25vh; }
  body.ambient-enabled .ambientHaloB { right: -60vw; bottom: -35vh; }
}

@media (prefers-reduced-motion: reduce) {
  body.ambient-enabled.motion-paused :is(.ambientHalo, .ambientBrandGlow, .ambientAsterisk, .ambientStripSpark) {
    animation-play-state: paused !important;
  }
}

@media print {
  .ambientScene, .ambientBrandGlow { display: none !important; }
  body.ambient-enabled :is(.ambientAsterisk, .ambientStripSpark) {
    animation-play-state: paused !important;
  }
}
