/* Hallmark · check · built: the project · redesign: polish · genre: editorial · motion: cross-document view transition, script fallback moves without hiding */
/* Hallmark · pre-emit critique: P4 H5 E4 S4 R5 V4 · weakest: E, the fallback entrance started the body at opacity 0; it now only settles 8px */

:root {
  /* motion tokens — deliberate duplicate of the audit-styles.css :root
     block; this is a standalone stylesheet with no cross-file dependency. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

/* Native cross-document transitions carry the selected folder artwork into
   the matching case-study hero. The JS fade below remains the fallback for
   browsers that do not support view-transition-name. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

::view-transition-group(*) {
  animation-duration: 440ms;
  animation-timing-function: var(--ease-in-out);
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 220ms;
  animation-timing-function: var(--ease-out);
}

/* The landing already suspends this blur; do the same on the receiving
   page so the wide frosted header doesn't rerasterize during the flight. */
html:active-view-transition .case-header::before {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html:active-view-transition .intro-media img[data-project-transition] {
  filter: none;
}

/* Both ends use the same PNG. Composite one traveling image instead of
   crossfading two full-resolution phone surfaces on every frame. */
::view-transition-old(vt-hero-weather),
::view-transition-old(vt-hero-wallet),
::view-transition-old(vt-hero-gate),
::view-transition-old(vt-hero-onboard),
::view-transition-old(vt-hero-foreign) {
  display: none;
}
::view-transition-new(vt-hero-weather),
::view-transition-new(vt-hero-wallet),
::view-transition-new(vt-hero-gate),
::view-transition-new(vt-hero-onboard),
::view-transition-new(vt-hero-foreign) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-group(vt-hero-weather),
::view-transition-group(vt-hero-wallet),
::view-transition-group(vt-hero-gate),
::view-transition-group(vt-hero-onboard),
::view-transition-group(vt-hero-foreign),
::view-transition-group(vt-title-weather),
::view-transition-group(vt-title-wallet),
::view-transition-group(vt-title-gate),
::view-transition-group(vt-title-onboard),
::view-transition-group(vt-title-foreign),
::view-transition-group(vt-sub-weather),
::view-transition-group(vt-sub-wallet),
::view-transition-group(vt-sub-gate),
::view-transition-group(vt-sub-onboard),
::view-transition-group(vt-sub-foreign) {
  animation-duration: 440ms;
  animation-timing-function: var(--ease-drawer);
  z-index: 1;
}

/* The fallback arrival moves the page, it never hides it. This class is
   set by a script and cleared two animation frames later; a background
   tab can hold those frames back indefinitely, so an opacity: 0 start
   here was a whole case study rendered blank. */
html.page-transition body {
  transform: translateY(8px);
  transition: transform 280ms var(--ease-out);
}

html.page-transition.page-ready body {
  transform: none;
}

/* Exit mirrors the entrance path exactly (same translateY/blur amounts)
   instead of a different distance — spatial consistency: it should look
   like the reverse of how the page arrived, not a different motion. The
   easing is the time-reversed curve of the entrance's, so the outbound
   path visually matches the inbound one played backwards. */
html.page-transition.page-exit body {
  opacity: 0;
  transform: translateY(8px);
  filter: blur(0.5px);
  transition:
    opacity 170ms cubic-bezier(0.64, 0, 0.78, 0.39),
    transform 170ms cubic-bezier(0.64, 0, 0.78, 0.39),
    filter 170ms cubic-bezier(0.64, 0, 0.78, 0.39);
}

@media (prefers-reduced-motion: reduce) {
  html.page-transition body,
  html.page-transition.page-ready body,
  html.page-transition.page-exit body {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
}
