@keyframes aa-page-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes aa-page-out { from { opacity: 1; } to { opacity: 0; } }

@media (prefers-reduced-motion: no-preference) and (forced-colors: none) {
  @view-transition { navigation: auto; }

  body.aa-sea-live canvas.aa-sea { view-transition-name: aa-sky; }
  ::view-transition { background: white; isolation: isolate; }
  ::view-transition-group(aa-sky) { z-index: 0; animation-duration: 240ms; }
  /* The isolated sky snapshot no longer has the hero's white overlay above it. */
  :root:has(body.agent-home-active)::view-transition-group(aa-sky) { opacity: .5; }
  /* Ink stays in front. The light page backdrop lets the separate sky show through. */
  ::view-transition-group(root) { z-index: 1; mix-blend-mode: darken; animation-duration: 240ms; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 240ms; }
  /* Hold the previous sky if the new WebGL surface hasn't drawn its first frame. */
  ::view-transition-old(aa-sky) { animation: none; }
  ::view-transition-new(aa-sky) { animation: aa-page-in 240ms ease both; }
  ::view-transition-new(aa-sky):only-child { animation: none; }

  body.aa-page-enter { animation: aa-page-in 240ms ease; }
  body.aa-page-leave { animation: aa-page-out 240ms ease both; }
  #app.aa-route-enter { animation: aa-page-in 180ms ease; }
}

/* The isolated white body paints behind its negative-z sky, even on long documents. */
@media screen {
  body:is(.agent-public, .agent-legal, .agent-downloads) {
    isolation: isolate;
    background: white;
  }
  body > canvas.aa-sea {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    user-select: none;
    opacity: 0;
    mask-image: linear-gradient(to bottom, rgb(0 0 0 / 32%), rgb(0 0 0 / 28%) 25%, rgb(0 0 0 / 26%) 48%, transparent 86%);
  }
  body.aa-sea-live > canvas.aa-sea { opacity: 1; }
  /* The 80%-opacity step number sits on an opaque blue-tinted selection.
     Wash just its background with white while preserving the original ink. */
  body.agent-public .pp-step-nav a[aria-current="step"] {
    background-image: linear-gradient(#fffe, #fffe);
  }
  /* Keep the original stage and its mist in place until the first successful draw. */
  body.aa-sea-live .public-page .pp-hero { background: transparent; }
  body.aa-sea-live .public-page .pp-hero::before { content: none; }
  /* The full-viewport white fade continues through the former hero boundary. */
  body.aa-sea-live .public-page .pp-hero::after { background: none; }
}
@media print, (forced-colors: active), (prefers-reduced-motion: reduce) {
  body > canvas.aa-sea { display: none; }
}
