/*
 * Animated gradient background.
 *
 * Two oversized fixed layers hold soft radial gradients and drift in opposite
 * directions. Only transform is animated, so the browser can run it on the
 * compositor without repainting. The layers sit behind all page content.
 */

body::before,
body::after {
  content: "";
  position: fixed;
  /* Oversized so rotating and scaling never reveals an edge. */
  inset: -25vmax;
  z-index: -1;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(
      circle at 20% 30%,
      color-mix(in srgb, var(--wp--preset--color--accent) 40%, transparent),
      transparent 45%
    ),
    radial-gradient(
      circle at 80% 25%,
      color-mix(
        in srgb,
        var(--wp--preset--color--accent-secondary) 35%,
        transparent
      ),
      transparent 40%
    );
  animation: gradient-drift-a 45s ease-in-out infinite alternate;
}

body::after {
  background:
    radial-gradient(
      circle at 70% 75%,
      color-mix(
        in srgb,
        var(--wp--preset--color--accent-tertiary) 35%,
        transparent
      ),
      transparent 45%
    ),
    radial-gradient(
      circle at 25% 80%,
      color-mix(in srgb, var(--wp--preset--color--accent) 30%, transparent),
      transparent 40%
    );
  animation: gradient-drift-b 60s ease-in-out infinite alternate;
}

@keyframes gradient-drift-a {
  from {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  to {
    transform: translate(4vmax, -3vmax) rotate(25deg) scale(1.15);
  }
}

@keyframes gradient-drift-b {
  from {
    transform: translate(0, 0) rotate(0deg) scale(1.1);
  }
  to {
    transform: translate(-5vmax, 3vmax) rotate(-30deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after {
    animation: none;
  }
}
