/* Page transitions, shared by the landing, the all-cases page and every case.
   A clicked cover (catalog-covers.js gives it the name) grows into the case's first screen,
   the title comes up through it, the header stays where it is. The browser runs all of it on
   its compositor and keeps the old page on screen until the new one can paint; where it
   can't, the link is a plain link.
   The opt-in itself is a line of inline CSS in every page, allowed by its hash in the CSP: a
   style pass that runs while a stylesheet is still on its way would read as no opt-in, and the
   browser would cancel the transition and cut hard. */

.site-header { view-transition-name: site-header; }
.consent-banner { view-transition-name: consent; }
.contours[data-contours="hero"] { view-transition-name: case-cover; }
.hero-grid { view-transition-name: case-copy; }

::view-transition-group(*) { animation-duration: .64s; animation-timing-function: cubic-bezier(.45, .05, .15, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; animation-timing-function: ease; }

/* the cover stays whole on its way: a 3:2 picture and a tall phone screen differ too much to crop */
::view-transition-old(case-cover), ::view-transition-new(case-cover) { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: normal; }
/* the picture dissolves while it still travels and is nearly gone before the title comes up */
::view-transition-old(case-cover) { animation: vt-cover-out .22s .2s ease-in both; }
::view-transition-new(case-cover) { animation: vt-in .22s .2s ease both; }

::view-transition-old(case-copy) { animation: vt-out .18s ease both; }
::view-transition-new(case-copy) { animation: vt-rise .46s .44s cubic-bezier(.22, 1, .36, 1) both; }

@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-cover-out { to { opacity: 0; transform: scale(1.1); } }
@keyframes vt-in { from { opacity: 0; } }
@keyframes vt-rise { from { opacity: 0; transform: translateY(18px); } }

/* a short press that ends by itself: motion cut off by the page change would read as a stall */
@media (prefers-reduced-motion: no-preference) {
    .cover-art { transition: transform .14s ease-out; }
    .cover-art.is-opening { transform: scale(.985); }
}
