/* Motion, loaded by the hub and every plate. The colophon's metric lines draw in once (hub only: the
   spans exist only there); filtering re-files project entries through a view transition (htmx 4
   transition:true + innerMorph keeps each entry's node, so view-transition-name: match-element follows it). */
@layer motion {
  @media (prefers-reduced-motion: no-preference) {
    .metrics i {
      animation: metric-draw 1.4s var(--ease-out) both;
      &:nth-child(2) { animation-delay: 0.12s; }
      &:nth-child(3) { animation-delay: 0.24s; }
      &:nth-child(4) { animation-delay: 0.36s; }
    }

    ::view-transition-group(*.specimen) {
      animation-duration: 0.55s;
      animation-timing-function: var(--ease-out);
    }
    ::view-transition-old(*.specimen):only-child { animation: specimen-out 0.22s ease-in both; }
    ::view-transition-new(*.specimen):only-child { animation: specimen-in 0.45s var(--ease-out) 0.12s both; }
    ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.2s; }

    .vh-status__v--building::before { animation: blink 0.8s steps(2, jump-none) infinite; }
  }

  @keyframes metric-draw { from { scale: 0 1; } }
  @keyframes specimen-out { to { opacity: 0; translate: 0 -0.75rem; } }
  @keyframes specimen-in { from { opacity: 0; translate: 0 1.25rem; } }
  @keyframes blink { 50% { opacity: 0; } }

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