/* Monday — smooth page-to-page navigation.
 *
 * Every page is still a normal server-rendered page (all scripts and forms keep working), but moving between pages no
 * longer looks like a reload:
 *  - browsers with cross-document View Transitions (Chrome/Edge 126+, Safari 18.2+) keep the old page on screen, then
 *    cross-fade to the new one; the side menu and the dotted sky are "pinned" so they stay put instead of blinking;
 *  - other browsers get a short fade-in of the page content only (the side menu and top bar never animate).
 * Switched off for people who ask for reduced motion (OS setting or Settings → motion).
 */

@view-transition { navigation: auto; }

/* pinned parts: their own layer, so only their state (active item, badges) cross-fades */
.rail { view-transition-name: app-rail; }
.page-sky { view-transition-name: app-sky; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .18s;
  animation-timing-function: cubic-bezier(.2, .0, .0, 1);
}
::view-transition-group(app-rail),
::view-transition-group(app-sky) { animation-duration: 0s; }
::view-transition-old(app-rail),
::view-transition-new(app-rail),
::view-transition-old(app-sky),
::view-transition-new(app-sky) { animation-duration: .12s; }

/* fallback (set by the tiny script in <head>): fade the content in, never the chrome around it */
@keyframes nav-fade-in { from { opacity: 0; } to { opacity: 1; } }
html.nav-fallback body > .app .page,
html.nav-fallback .pub-shell > main { animation: nav-fade-in .18s ease-out; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  html.nav-fallback body > .app .page,
  html.nav-fallback .pub-shell > main { animation: none; }
}
html[data-motion="reduce"]::view-transition-group(*),
html[data-motion="reduce"]::view-transition-old(*),
html[data-motion="reduce"]::view-transition-new(*) { animation: none !important; }
html[data-motion="reduce"].nav-fallback body > .app .page,
html[data-motion="reduce"].nav-fallback .pub-shell > main { animation: none; }
