/*
  Sign-in -> organization step hand-over (View Transitions API): the
  illustration panel travels from the right half to the left while the
  sign-in side fades out and the organization picker fades in.

  This file is deliberately outside the Sass/PostCSS build. postcss-rtl
  (craco.config.js) prefixes these rules with [dir], and a
  "[dir] ::view-transition-*" selector can never match: the transition
  pseudo-elements hang off the root element itself.

  The two elements are named in src/views/AuthScreens/auth.scss
  (view-transition-name: nmr-auth-form / nmr-auth-panel), and the transition
  is started in src/views/AuthScreens/Login.js.
*/

::view-transition-group(nmr-auth-panel),
::view-transition-group(nmr-auth-form) {
  animation-duration: 0.8s;
  animation-timing-function: cubic-bezier(0.65, 0, 0.25, 1);
}

/* The panel looks the same at both ends, so it simply travels. */
::view-transition-old(nmr-auth-panel) {
  animation: none;
  opacity: 0;
}

::view-transition-new(nmr-auth-panel) {
  animation: none;
}

::view-transition-old(nmr-auth-form) {
  animation: nmr-vt-step-out 0.3s ease both;
}

::view-transition-new(nmr-auth-form) {
  animation: nmr-vt-step-in 0.45s 0.4s ease both;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

@keyframes nmr-vt-step-out {
  to {
    opacity: 0;
    transform: translateX(-24px);
  }
}

@keyframes nmr-vt-step-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
