/* Smooth open and close for the viewer. view-transition.js decides which navigations actually use this. */
@view-transition { navigation: auto; }

/* The two pages cross-fade. */
::view-transition-old(root), ::view-transition-new(root) {
    animation-duration: 260ms;
    animation-timing-function: cubic-bezier(.22, 1, .36, 1);
}

/* A tapped photo or video grows into the viewer's picture. */
html.vt-hero #stageCard { view-transition-name: viewer-hero; }
::view-transition-group(viewer-hero) {
    animation-duration: 420ms;
    animation-timing-function: cubic-bezier(.22, 1, .36, 1);
    border-radius: 14px;
    overflow: clip;
}
::view-transition-old(viewer-hero), ::view-transition-new(viewer-hero) {
    height: 100%;
    object-fit: cover;          /* the thumbnail is cropped square: crop it the same way while it grows instead of stretching it */
}

/* While the browser animates the arrival, the viewer's own entrance would fight it. */
html.vt-active body.viewer-entering main,
html.vt-active body.viewer-entering header,
html.vt-active body.viewer-entering .viewer-nav { animation: none; }

/* Arriving from a swipe: no fade, no scale, no sliding bars. The picture is already where it should be. */
html.vt-swipe body.viewer-entering main,
html.vt-swipe body.viewer-entering header,
html.vt-swipe body.viewer-entering .viewer-nav { animation: none; }
