/* View transitions between pages (Includes/FrontdeskViewTransitions, docs/view-transitions.md):
   the browser blends from one page to the next. Sidebar, top bar, phone header and bar
   keep their place; only the page itself fades. Loaded only by apps that switch it on. */
@view-transition {
    navigation: auto;
}

.fdk-sidebar {
    view-transition-name: fdk-sidebar;
}

.fdk-topbar {
    view-transition-name: fdk-topbar;
}

.fdk-mobile-header {
    view-transition-name: fdk-mobile-header;
}

.fdk-mobilebar {
    view-transition-name: fdk-mobilebar;
}

.fdk-main {
    view-transition-name: fdk-main;
}

/* The frame: no cross-fade of two almost equal pictures, the new one at once. Icons on
   the new page are drawn by createIcons() on DOMContentLoaded, after the frame's "new"
   snapshot is captured for the transition; keeping the frame's group animation at the UA
   default (250ms) would hold that icon-less snapshot on screen until it times out, so the
   icons would flicker in. Zeroing it hands back to the live (by-then icon-complete) DOM
   right away. */
::view-transition-group(fdk-sidebar),
::view-transition-group(fdk-topbar),
::view-transition-group(fdk-mobile-header),
::view-transition-group(fdk-mobilebar) {
    animation-duration: 0s;
}

::view-transition-old(fdk-sidebar),
::view-transition-old(fdk-topbar),
::view-transition-old(fdk-mobile-header),
::view-transition-old(fdk-mobilebar) {
    animation: none;
    opacity: 0;
}

::view-transition-new(fdk-sidebar),
::view-transition-new(fdk-topbar),
::view-transition-new(fdk-mobile-header),
::view-transition-new(fdk-mobilebar) {
    animation: none;
}

/* The page: out quickly, in with a slight rise. */
::view-transition-group(fdk-main) {
    animation-duration: 220ms;
}

::view-transition-old(fdk-main) {
    animation: fdk-vt-out 120ms ease-in both;
}

::view-transition-new(fdk-main) {
    animation: fdk-vt-in 220ms ease-out both;
}

@keyframes fdk-vt-out {
    to { opacity: 0; }
}

@keyframes fdk-vt-in {
    from { opacity: 0; transform: translateY(6px); }
}

@media (prefers-reduced-motion: reduce) {
    @view-transition {
        navigation: none;
    }
}
