/* Shared motion for every page (linked from each index.html).
   Short and quiet to match the compact dashboard style: fades with a few pixels
   of lift, nothing bouncy. Everything is off under prefers-reduced-motion. */

/* ── Page switch ───────────────────────────────────────────────────────────────
   Cross-document View Transitions: the old page fades out, the new one fades in
   with a small lift. Browsers without support just navigate normally. The topbar
   and the mobile nav (view-transition-name set in mobile-nav.js) stay in place. */
@view-transition { navigation: auto; }

::view-transition-old(root) { animation: motion-page-out 120ms ease-in both; }
::view-transition-new(root) { animation: motion-page-in 220ms cubic-bezier(0.2, 0.7, 0.3, 1) both; }

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

@keyframes motion-page-out { to   { opacity: 0; } }
@keyframes motion-page-in  { from { opacity: 0; transform: translateY(6px); } }

/* ── Content ─────────────────────────────────────────────────────────────────
   .anim-in   content replacing a skeleton, or a new tab / view / period
   .anim-fade lighter swap for lists that change in place (filters, a picked day)
   .anim-pop  popups and modal panels
   .anim-backdrop  modal backdrops
   Re-run on change by giving the element a React `key` tied to what changed.
   Fill is `backwards`, never `both`: an animation that stays in effect on
   `transform` turns the element into the containing block for every
   `position: fixed` descendant (the profile pages' floating tab pill sits inside
   `<main class="anim-in">` and would stick to the bottom of the page). */
.anim-in       { animation: motion-in 240ms cubic-bezier(0.2, 0.7, 0.3, 1) backwards; }
.anim-fade     { animation: motion-fade 180ms ease-out backwards; }
.anim-pop      { animation: motion-pop 180ms cubic-bezier(0.2, 0.7, 0.3, 1) backwards; }
.anim-backdrop { animation: motion-fade 160ms ease-out backwards; }

@keyframes motion-in   { from { opacity: 0; transform: translateY(6px); } }
@keyframes motion-fade { from { opacity: 0; } }
@keyframes motion-pop  { from { opacity: 0; transform: translateY(4px) scale(0.97); } }

@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
    .anim-in, .anim-fade, .anim-pop, .anim-backdrop { animation: none; }
}
