/* ==========================================================================
   §6 Motion — CSS keyframe library.
   All animations honor prefers-reduced-motion via tokens.css clamps.
   ========================================================================== */

/* Slice googly-eye idle drift */
@keyframes eye-drift {
  0%, 100% { transform: translate(0, 0); }
  25%      { transform: translate(1px, -1px); }
  50%      { transform: translate(-1px, 1px); }
  75%      { transform: translate(1px, 2px); }
}
.slice-eye { animation: eye-drift 6s ease-in-out infinite; transform-origin: center; }
.slice-eye:nth-child(2) { animation-delay: -2.3s; }

/* Slice mouth "lipsync" — used while audio is playing */
@keyframes mouth-flap {
  0%, 100% { transform: scaleY(1); }
  50%      { transform: scaleY(0.2); }
}
.is-playing .slice-mouth { animation: mouth-flap 240ms linear infinite; transform-origin: center; }

/* Broodwich horn growth */
@keyframes horn-grow {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}

/* Ticket print-in */
@keyframes ticket-print {
  from { transform: translateY(-8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.ticket { animation: ticket-print var(--motion-slow) var(--ease-butcher) both; }
.ticket.is-torn {
  animation: ticket-tear 420ms var(--ease-snap) forwards;
}
@keyframes ticket-tear {
  50%  { transform: translateY(-2px) rotate(-1deg); }
  100% { transform: translateX(120%) rotate(-6deg); opacity: 0; }
}

/* Bloopers fly */
@keyframes fly-path {
  0%   { offset-distance: 0%; }
  100% { offset-distance: 100%; }
}
.fly {
  offset-path: path('M 0 0 C 40 -20, 80 20, 120 0 S 200 -20, 240 0 S 320 20, 360 0');
  animation: fly-path 8s linear infinite;
}

/* Hero butcher-diagram parallax driven via CSS custom property from JS */
.hero__bg { transform: translate3d(0, calc(var(--scroll-y, 0) * 0.3px), 0); }

/* Page transition cross-fade (view-transitions API fallback) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: 180ms;
}

/* Broodwich mode visual accents only.
   Token overrides live in tokens.css for accessibility consistency. */
:root[data-brood='on'] .hero__badge {
  filter: drop-shadow(0 0 6px var(--brood-accent-warm));
}

/* Reduced-motion: nuke everything non-essential */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
