/* ==========================================================================
   Odro motion: one-off entrance animations (first used on vantage.html,
   22 Nov 2026, as an approved exception to the no-custom-animation rule).

   How it works
   - scripts/motion.js adds .anim-ready to <html>, then adds .in to each
     element with a data-anim attribute as it scrolls into view.
   - Nothing is hidden until .anim-ready is on the page, so if the script
     fails or hasn't run, every element shows in its finished state.
   - With reduced motion set, the script does nothing and the rules at the
     bottom switch everything off, so the page shows its finished state.
   - Every animation plays once and ends within about four seconds. No loops.
   - Only transform and opacity animate, apart from .type-in (max-width)
     and .hop (left), two small decorative elements.

   Reusable classes (put inside an element with data-anim)
   .pop  .rise  .slide-in  .slide-in-left  .grow  .draw
   Stagger with an inline custom property: style="--d: .3s"

   Small effects, used on the Odro Vantage page but free to reuse
   .jiggle .wiggle .ping .hop .seat-pulse .lens .type-in .bob .typing .swap
   .fade-up-now (added by a script, not by scrolling; see below)
   ========================================================================== */

:root { --spring: cubic-bezier(.34, 1.56, .64, 1); }

/* Resting styles (always on, finished state) */
.jiggle, .wiggle { display: inline-block; transform-origin: 50% 80%; }
.draw-nodes circle { transform-box: fill-box; transform-origin: center; }
.swap { display: inline-grid; }
.swap > span { grid-area: 1 / 1; }
.swap .swap-to { visibility: hidden; }
.ping { opacity: 0; }
.lens, .typing { display: none; }
.squiggle { position: relative; white-space: nowrap; }
.squiggle svg { position: absolute; left: 0; bottom: -10px; width: 100%; height: 14px; overflow: visible; }

/* Hidden start states: only once the script has armed the page */
.anim-ready .pop,
.anim-ready .rise,
.anim-ready .slide-in,
.anim-ready .slide-in-left { opacity: 0; }
.anim-ready .grow { transform: scaleX(0); transform-origin: left center; }
.anim-ready .draw,
.anim-ready .squiggle path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.anim-ready .draw-nodes circle { transform: scale(0); }
.anim-ready .type-in { display: inline-block; max-width: 0; overflow: hidden; white-space: nowrap; vertical-align: bottom; }
.anim-ready .hop { left: var(--hop-from); }

/* Play when the element (or its section) has .in */
.anim-ready .in .pop           { animation: odro-pop .55s var(--spring) var(--d, 0s) both; }
.anim-ready .in .rise          { animation: odro-rise .6s ease-out var(--d, 0s) both; }
.anim-ready .in .slide-in      { animation: odro-slide-in .6s var(--spring) var(--d, 0s) both; }
.anim-ready .in .slide-in-left { animation: odro-slide-in-left .6s var(--spring) var(--d, 0s) both; }
.anim-ready .in .grow          { animation: odro-grow .9s ease-out var(--d, 0s) both; }
.anim-ready .in .draw          { animation: odro-draw var(--draw-time, 1.6s) ease-out var(--d, 0s) both; }
.anim-ready .in .squiggle path { animation: odro-draw .8s ease-out .6s both; }
.anim-ready .in .draw-nodes circle { animation: odro-pop .5s var(--spring) var(--d, 0s) both; }
.anim-ready .in .jiggle        { animation: odro-jiggle .5s ease-in-out .15s 2; }
.anim-ready .in .wiggle        { animation: odro-jiggle .45s ease-in-out var(--d, 0s) 2; }
.anim-ready .in .swap .swap-from { animation: odro-out .25s ease-in 2s both; }
.anim-ready .in .swap .swap-to   { visibility: visible; animation: odro-pop .5s var(--spring) 2.15s both; }
.anim-ready .in .ping          { animation: odro-ping 1s ease-out 1s 3 both; }
.anim-ready .in .hop           { animation: odro-hop 1.1s var(--spring) .6s both; }
.anim-ready .in .seat-pulse    { animation: odro-seat .7s ease-in-out 1.7s 3; }
.anim-ready .in .lens          { display: flex; animation: odro-lens 1.2s ease-in-out .3s both; }
.anim-ready .in .type-in       { animation: odro-type .9s steps(16) var(--d, 0s) both; }
.anim-ready .in .bob           { animation: odro-bob .6s ease-in-out 1.1s 3; }
.anim-ready .in .typing        { display: flex; animation: odro-flash 1.5s linear .6s both; }
.anim-ready .in .typing span   { animation: odro-dots .6s ease-in-out .6s 2; }

/* Played on demand by a script (not by scrolling into view): the script
   removes and re-adds the class to replay it. Used by scripts/scroll-tabs.js
   when a tab changes. Off with reduced motion, like everything here. */
.anim-ready .fade-up-now       { animation: odro-rise .4s ease-out both; }

@keyframes odro-pop { 0% { opacity: 0; transform: translateY(10px) scale(.9); } 70% { opacity: 1; transform: translateY(-2px) scale(1.03); } 100% { opacity: 1; transform: none; } }
@keyframes odro-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes odro-slide-in { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes odro-slide-in-left { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
@keyframes odro-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes odro-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes odro-jiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
@keyframes odro-out { to { opacity: 0; transform: scale(.85); } }
@keyframes odro-ping { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(2.8); opacity: 0; } }
@keyframes odro-hop {
  0%   { left: var(--hop-from); transform: translate(-50%, -50%) rotate(0); }
  45%  { left: 50%; transform: translate(-50%, -130%) rotate(-12deg); }
  100% { left: var(--hop-to); transform: translate(-50%, -50%) rotate(0); }
}
@keyframes odro-seat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
@keyframes odro-lens { 0% { left: -12%; opacity: 0; } 12% { opacity: 1; } 85% { opacity: 1; } 100% { left: 104%; opacity: 0; } }
@keyframes odro-type { from { max-width: 0; } to { max-width: 22ch; } }
@keyframes odro-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(7px); } }
@keyframes odro-flash { 0% { opacity: 0; } 10% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes odro-dots { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* Reduced motion and print: finished state, nothing moves */
@media (prefers-reduced-motion: reduce) {
  .anim-ready .pop, .anim-ready .rise, .anim-ready .slide-in, .anim-ready .slide-in-left { opacity: 1; }
  .anim-ready .grow, .anim-ready .draw-nodes circle { transform: none; }
  .anim-ready .draw, .anim-ready .squiggle path { stroke-dashoffset: 0; }
  .anim-ready .type-in { max-width: none; }
  .anim-ready .hop { left: var(--hop-to); }
  .anim-ready *, .anim-ready *::before, .anim-ready *::after { animation: none !important; transition: none !important; }
}
@media print {
  .anim-ready .pop, .anim-ready .rise, .anim-ready .slide-in, .anim-ready .slide-in-left { opacity: 1 !important; animation: none !important; }
}
