@view-transition {
  navigation: auto;
}

@property --theme-vt-wipe-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@property --theme-vt-wipe-progress {
  syntax: "<number>";
  initial-value: 0;
  inherits: false;
}

@property --theme-vt-duration {
  syntax: "<time>";
  initial-value: 1s;
  inherits: false;
}

@keyframes theme-vt-wipe-reveal {
  from {
    --theme-vt-wipe-progress: 0;
  }
  to {
    --theme-vt-wipe-progress: 1;
  }
}

@keyframes theme-vt-old-soft-out {
  from {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
  to {
    opacity: 0.5;
    transform: scale(0.992);
    filter: blur(0.8px);
  }
}

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(*) {
    --theme-vt-duration: 1.05s;
    animation-duration: var(--theme-vt-duration);
    animation-timing-function: cubic-bezier(0.45, 0, 0.35, 1);
  }

  ::view-transition-old(*),
  ::view-transition-new(*) {
    mix-blend-mode: normal;
    backface-visibility: hidden;
  }

  ::view-transition-old(root) {
    animation-name: theme-vt-old-soft-out;
    animation-fill-mode: both;
  }

  ::view-transition-new(root) {
    --theme-vt-wipe-angle: 0deg;
    animation-name: theme-vt-wipe-reveal;
    animation-fill-mode: both;
    -webkit-mask-image: linear-gradient(
      var(--theme-vt-wipe-angle),
      #000 calc(-65% + calc(165% * var(--theme-vt-wipe-progress, 0))),
      transparent calc(165% * var(--theme-vt-wipe-progress, 0))
    );
    mask-image: linear-gradient(
      var(--theme-vt-wipe-angle),
      #000 calc(-65% + calc(165% * var(--theme-vt-wipe-progress, 0))),
      transparent calc(165% * var(--theme-vt-wipe-progress, 0))
    );
  }
}
