/* A quiet moving colour field. Load after the page's theme stylesheet.
   Only the paper canvas opens onto it; media and intentional dark chapters
   keep their existing surfaces. No filters, canvas or per-frame JS. */
:root {
  --wave-cool: rgb(74 102 191 / .065);
  --wave-sage: rgb(126 163 134 / .08);
  --wave-warm: rgb(202 170 133 / .055);
  --wave-violet: rgb(144 123 177 / .045);
}

:root[data-theme="dark"] {
  --wave-cool: rgb(121 143 200 / .075);
  --wave-sage: rgb(125 154 119 / .065);
  --wave-warm: rgb(183 151 112 / .045);
  --wave-violet: rgb(143 125 183 / .045);
}

body[data-wave-background="true"] { isolation: isolate; }

.v2-wave-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  contain: strict;
}

.v2-wave-layer {
  position: absolute;
  inset: -12%;
  pointer-events: none;
  transform-origin: 50% 50%;
  animation: v2-wave-flow 58s ease-in-out infinite alternate;
  animation-play-state: paused;
}

/* Off-canvas elliptical bands make broad arcs, rather than visible blobs. */
.v2-wave-layer:first-child {
  background:
    radial-gradient(ellipse 130% 76% at 2% 119%,
      transparent 37%, var(--wave-cool) 49%, var(--wave-cool) 54%, transparent 70%),
    radial-gradient(ellipse 118% 92% at 104% -12%,
      transparent 35%, var(--wave-sage) 49%, transparent 68%);
}

.v2-wave-layer:last-child {
  background:
    radial-gradient(ellipse 150% 80% at 105% 125%,
      transparent 38%, var(--wave-warm) 52%, transparent 71%),
    linear-gradient(118deg, transparent 19%, var(--wave-violet) 47%, transparent 78%);
  animation-name: v2-wave-return;
  animation-duration: 79s;
  animation-direction: alternate-reverse;
}

.v2-wave-field[data-running="true"] > .v2-wave-layer {
  animation-play-state: running;
  will-change: transform;
}

/* These three selectors were opaque paper only in the existing dark theme.
   Do not open the service chapter, players, cards, dialogs or comparison. */
body[data-view="home"][data-wave-background="true"]
  :is(.work-section, .about-section, .site-footer) {
  background-color: transparent;
}

@keyframes v2-wave-flow {
  0% { transform: translate3d(-3%, 1%, 0) rotate(-2deg) scale(1.015); }
  50% { transform: translate3d(1%, -2.5%, 0) rotate(.5deg) scale(1.035); }
  100% { transform: translate3d(4%, 2%, 0) rotate(2deg) scale(1.015); }
}

@keyframes v2-wave-return {
  0% { transform: translate3d(3%, -2%, 0) rotate(1.5deg) scale(1.025); }
  50% { transform: translate3d(-1%, 2.5%, 0) rotate(-1deg) scale(1.04); }
  100% { transform: translate3d(-4%, -1%, 0) rotate(-2deg) scale(1.025); }
}

:is(html, body).motion-paused .v2-wave-layer,
:is(html, body)[data-role-paused="true"] .v2-wave-layer,
:is(html, body):is([data-motion="paused"], [data-motion="off"],
  [data-motion="false"], [data-motion="reduced"]) .v2-wave-layer {
  animation-play-state: paused !important;
  will-change: auto;
}

@media (max-width: 700px) {
  .v2-wave-layer { inset: -9%; animation-duration: 69s; }
  .v2-wave-layer:last-child { animation-duration: 89s; }
}

@media (prefers-reduced-motion: reduce) {
  .v2-wave-layer {
    animation: none !important;
    transform: none;
    will-change: auto !important;
  }
}

@media (forced-colors: active), print {
  .v2-wave-field { display: none; }
}
