/* Moving between pages, on every page of the site.
   Browsers with cross-document view transitions (Safari 18.2+, Chrome 126+): the page you leave fades
   back as the next one rises in, and an event card tapped on the hub grows into that event's page card.
   Older browsers: the new page simply fades in. Reduced motion: no movement at all. */
@view-transition { navigation: auto; types: page; }   /* "page": only moving between pages, not in-page changes like light/dark */

:active-view-transition-type(page)::view-transition-old(root) { animation: vt-leave 200ms cubic-bezier(.4, 0, 1, 1) both; }
:active-view-transition-type(page)::view-transition-new(root) { animation: vt-arrive 360ms cubic-bezier(.2, .8, .2, 1) both; }
@keyframes vt-leave { to { opacity: 0; transform: scale(.985); } }
@keyframes vt-arrive { from { opacity: 0; transform: translateY(16px); } }

/* the tapped event card (named on the hub just before leaving) and the event page's card */
#hero { view-transition-name: event-card; }
:active-view-transition-type(page)::view-transition-group(event-card) { animation-duration: 420ms; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(event-card), ::view-transition-new(event-card) { height: 100%; object-fit: cover; }

/* no view transitions: the page eases in (opacity only, so nothing fixed on the page moves) */
@supports not (view-transition-name: none) {
  body { animation: page-in 380ms ease-out both; }
  @keyframes page-in { from { opacity: 0; } }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  body { animation: none !important; }
}
