:root {
  --page-veil: #eeeaf3;
  --page-cover: 230ms;
  --page-reveal: 340ms;
  --page-wave: site-page-sweep;
}

:root[data-theme="dark"] { --page-veil: #24202c; }

@supports (clip-path: shape(from 0 0, line to 100% 100%, close)) {
  :root { --page-wave: site-page-wave; }
}

@media (prefers-reduced-motion: no-preference) {
  :root[data-page-transition]::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--page-veil);
  }

  :root[data-page-transition="cover"]::after {
    animation: var(--page-wave) var(--page-cover) cubic-bezier(.4,0,.32,1) both;
  }

  :root[data-page-transition="reveal"]::after {
    scale: -1 1;
    animation: var(--page-wave) var(--page-reveal) cubic-bezier(.46,0,.2,1) reverse both;
  }
}

@keyframes site-page-sweep {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0); }
}

@keyframes site-page-wave {
  from {
    clip-path: shape(from -20% -5%, line to -9% -5%,
      curve to -1% 48% with -9% 17% / -1% 29%,
      curve to -10% 105% with -1% 70% / -10% 82%,
      line to -20% 105%, close);
  }
  55% {
    clip-path: shape(from -20% -5%, line to 62% -5%,
      curve to 81% 48% with 65% 16% / 81% 31%,
      curve to 71% 105% with 81% 67% / 71% 87%,
      line to -20% 105%, close);
  }
  to {
    clip-path: shape(from -20% -5%, line to 112% -5%,
      curve to 117% 48% with 113% 17% / 117% 30%,
      curve to 111% 105% with 117% 70% / 112% 83%,
      line to -20% 105%, close);
  }
}
