/* Motion: travel between places, and the small lives of stars.
   Rule: 350–600ms, ease-out, never blocks input. Reduced motion → crossfade only. */

@keyframes you-glow { 0%, 100% { filter: drop-shadow(0 0 0 transparent); transform: scale(1); }
                      50% { filter: drop-shadow(0 0 4px var(--you)); transform: scale(1.18); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes sweep { 0% { transform: scaleX(0); opacity: 1; } 70% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
@keyframes draw-line { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes draw-line-v { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { transform: scale(1) translate(0, 0); opacity: .85; }
                     50% { transform: scale(1.08) translate(1.5%, -1%); opacity: 1; } }
@keyframes shoot {
  0%   { transform: translate(-20vw, -6vh) rotate(18deg) scaleX(.2); opacity: 0; }
  12%  { opacity: 1; }
  70%  { transform: translate(52vw, 16vh) rotate(18deg) scaleX(1); opacity: 1; }
  100% { transform: translate(64vw, 20vh) rotate(18deg) scaleX(.05); opacity: 0; }
}
@keyframes settle { 0% { transform: scale(0) rotate(-90deg); opacity: 0; } 60% { transform: scale(1.3) rotate(10deg); opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }

/* Things arriving in a view rise into place, staggered by --i. */
.arrive { animation: rise var(--t-travel) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 45ms); }

/* ── Travel: View Transitions. Direction set on <html data-travel="in|out|across">. ── */
::view-transition-group(*) { animation-duration: var(--t-travel); animation-timing-function: var(--ease-out); }
::view-transition-old(view), ::view-transition-new(view) { animation-duration: var(--t-travel); animation-timing-function: var(--ease-out); }

@keyframes zoom-in-old  { to   { opacity: 0; transform: scale(1.1);  filter: blur(6px); } }
@keyframes zoom-in-new  { from { opacity: 0; transform: scale(.9);   filter: blur(6px); } }
@keyframes zoom-out-old { to   { opacity: 0; transform: scale(.9);   filter: blur(6px); } }
@keyframes zoom-out-new { from { opacity: 0; transform: scale(1.1);  filter: blur(6px); } }
@keyframes across-old   { to   { opacity: 0; transform: translateX(-4%); } }
@keyframes across-new   { from { opacity: 0; transform: translateX(4%); } }
@keyframes fade-out     { to   { opacity: 0; } }
@keyframes fade-in      { from { opacity: 0; } }

html[data-travel="in"]::view-transition-old(view)     { animation-name: zoom-in-old; }
html[data-travel="in"]::view-transition-new(view)     { animation-name: zoom-in-new; }
html[data-travel="out"]::view-transition-old(view)    { animation-name: zoom-out-old; }
html[data-travel="out"]::view-transition-new(view)    { animation-name: zoom-out-new; }
html[data-travel="across"]::view-transition-old(view) { animation-name: across-old; }
html[data-travel="across"]::view-transition-new(view) { animation-name: across-new; }
/* Moving fast (a hop within 2s of the last): the travel shortens to 0.2s. The ceremony that
   delights on day one shouldn't tax the hundredth visit (journey analysis, finding 7). */
html[data-pace="quick"]::view-transition-old(view), html[data-pace="quick"]::view-transition-new(view),
html[data-pace="quick"]::view-transition-group(role-star) { animation-duration: 200ms; }
/* The header and sky never travel — they are the window you look through. */
::view-transition-old(header), ::view-transition-new(header),
::view-transition-old(starfield), ::view-transition-new(starfield) { animation: none; }
/* The star you clicked flies to become the role's hero star. */
::view-transition-group(role-star) { animation-duration: 600ms; animation-timing-function: var(--ease-out); z-index: 50; }

/* Fallback where View Transitions are unsupported. */
.no-vt main#view.is-entering { animation: rise var(--t-travel) var(--ease-out) both; }

/* The star you keep flies to your pill in the header. */
.flyer {
  position: fixed; z-index: 60; width: 26px; height: 26px; color: var(--you);
  pointer-events: none; filter: drop-shadow(0 0 6px var(--you-tint));
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  html[data-travel]::view-transition-old(view) { animation: fade-out 200ms linear both !important; }
  html[data-travel]::view-transition-new(view) { animation: fade-in 200ms linear both !important; }
  ::view-transition-group(role-star) { animation-duration: 1ms !important; }
  .is-travelling .sweep { animation: none; }
  .shooting-star { display: none; }
}
