/* Keep the ambient gradient anchored; slowly blend its colors in place. */
@property --ambient-glow-one {
  syntax: "<color>";
  inherits: false;
  initial-value: #7449918c;
}
@property --ambient-glow-two {
  syntax: "<color>";
  inherits: false;
  initial-value: #8c3ea15c;
}
@property --ambient-glow-three {
  syntax: "<color>";
  inherits: false;
  initial-value: #23766b55;
}

body:not(.light) > .ambient {
  --ambient-glow-one: #7449918c;
  --ambient-glow-two: #8c3ea15c;
  --ambient-glow-three: #23766b55;
  background:
    radial-gradient(ellipse at 12% 4%, var(--ambient-glow-one), transparent 55%),
    radial-gradient(ellipse at 88% 30%, var(--ambient-glow-two), transparent 55%),
    radial-gradient(ellipse at 65% 98%, var(--ambient-glow-three), transparent 55%),
    linear-gradient(125deg, #27123e, #38234f 60%, #241a42) !important;
  background-size: 100% 100% !important;
  background-position: center !important;
  animation: player-ambient-color-blend 44s ease-in-out infinite alternate;
}

body.light > .ambient {
  --ambient-glow-one: #dcc5eb80;
  --ambient-glow-two: #cee8dd80;
  --ambient-glow-three: #e8d9f050;
  background:
    radial-gradient(ellipse at 8% 2%, var(--ambient-glow-one), transparent 55%),
    radial-gradient(ellipse at 90% 65%, var(--ambient-glow-two), transparent 55%),
    radial-gradient(ellipse at 52% 100%, var(--ambient-glow-three), transparent 60%),
    linear-gradient(135deg, #f3edf8, #f7f3f8) !important;
  background-size: 100% 100% !important;
  background-position: center !important;
  animation: player-ambient-light-blend 48s ease-in-out infinite alternate;
}

@keyframes player-ambient-color-blend {
  0% { --ambient-glow-one: #7449918c; --ambient-glow-two: #8c3ea15c; --ambient-glow-three: #23766b55; }
  50% { --ambient-glow-one: #89549b78; --ambient-glow-two: #a74f8d69; --ambient-glow-three: #397d7564; }
  100% { --ambient-glow-one: #65478a82; --ambient-glow-two: #765c9c68; --ambient-glow-three: #4a817568; }
}

@keyframes player-ambient-light-blend {
  0% { --ambient-glow-one: #dcc5eb80; --ambient-glow-two: #cee8dd80; --ambient-glow-three: #e8d9f050; }
  50% { --ambient-glow-one: #e7d4ef80; --ambient-glow-two: #d1eadd80; --ambient-glow-three: #f0dce970; }
  100% { --ambient-glow-one: #d7c8ed80; --ambient-glow-two: #d9eee480; --ambient-glow-three: #e5d8f080; }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.light) > .ambient,
  body.light > .ambient { animation: none; }
}
