/* Both ends of a same-origin navigation opt in, including the marketplace. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  :root {
    --ll-page-duration: 740ms;
    --ll-page-easing: cubic-bezier(.39, 0, .31, 1);
  }

  :root::view-transition { pointer-events: none; }
  :root::view-transition-group(root) {
    animation-duration: var(--ll-page-duration);
    animation-timing-function: var(--ll-page-easing);
  }
  :root::view-transition-old(root) {
    animation: none;
    mix-blend-mode: normal;
    opacity: 1;
  }
  :root::view-transition-new(root) {
    animation: ll-page-dissolve var(--ll-page-duration) var(--ll-page-easing) both;
    mix-blend-mode: normal;
  }
  @keyframes ll-page-dissolve {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  /* Keep the logo on the page snapshot when it moves between header and sidebar. */
  :root body > header :is(.brand, a:first-child) > img[src*="brand-logo"] {
    view-transition-name: none;
  }
  :root[data-ll-leaving]::before { animation: none; opacity: 0; }

  /* Some browsers cannot blend two documents. Keep the arriving one legible. */
  :root[data-ll-page-arrival] main {
    animation: ll-content-arrival 540ms var(--ll-page-easing);
  }
  body .portal-shell [data-panel]:not([hidden]) {
    animation: ll-content-arrival 360ms var(--ll-page-easing);
  }
  @keyframes ll-content-arrival {
    from { opacity: .90; }
    to { opacity: 1; }
  }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  :root::view-transition-group(*), :root::view-transition-old(*), :root::view-transition-new(*) {
    animation: none !important;
  }
  :root[data-ll-page-arrival] main, body .portal-shell [data-panel]:not([hidden]) {
    animation: none;
  }
}
