/* Enter and leave motion for / and /landing.
   Cross-document View Transitions cover the switch.
   A CSS fade/slide covers the first load and browsers without that API. */

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: 280ms ease-in both page-leave;
}

::view-transition-new(root) {
  animation: 380ms ease-out both page-enter;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes page-leave {
  to {
    opacity: 0;
  }
}

/* First load has no outgoing page, so fade the document itself in.
   While a view transition is running, keep the snapshot fully visible
   or the same fade is captured and plays a second time. */
@supports (view-transition-name: none) {
  @media (prefers-reduced-motion: no-preference) {
    body {
      opacity: 1;
      transform: none;
      transition: opacity 380ms ease-out, transform 380ms ease-out;
    }

    @starting-style {
      body {
        opacity: 0;
        transform: translateY(10px);
      }
    }
  }
}

html:active-view-transition body {
  transition: none;
  opacity: 1;
  transform: none;
}

@supports not (view-transition-name: none) {
  @media (prefers-reduced-motion: no-preference) {
    body {
      animation: page-enter 380ms ease-out both;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }

  body {
    transition: none;
  }
}
