/* LA28 motion tokens. Measured frame by frame (30fps) from the six Core Graphics "Type" reference videos
   (Core_BT, Core_LR, Core_CO2, OneLines_LR, TwoLines_BT, TwoLines_LR).
   The brand move is: HOLD -> EXIT (accelerates, fades to ~50%, then hard-cuts at peak speed, no fade to 0)
   -> BLANK beat -> ENTER (starts offset + ~50% faded, decelerates hard, settles). No bounce, no overshoot. */
:root {
  /* easing: exits ease-in (slow start, cut at speed); enters ease-out (most travel in first 25% of time) */
  --la-ease-out: cubic-bezier(.16, 1, .3, 1);   /* enter: ~52% of travel done after 20% of the time */
  --la-ease-in:  cubic-bezier(.7, 0, .84, 0);   /* exit: ~35% of travel happens in the last 2 frames */

  /* durations (single-line/short text first, two-line/long second) */
  --la-dur-exit:  .3s;   /* 0.27s Core, 0.47s one-line / two-line */
  --la-dur-exit-long: .47s;
  --la-dur-enter: .5s;   /* 0.5-0.6s Core, 0.4s one/two-line */
  --la-gap:       .33s;  /* blank beat between exit and enter: 0.33s Core, 0.47-0.53s one/two-line */
  --la-gap-long:  .5s;
  --la-hold:      1.1s;  /* how long a settled line sits: 0.45s Core, 1.1-1.3s one/two-line */
  --la-stagger:   .067s; /* per line/word: 2 frames at 30fps */

  /* distances (fractions of the element's own box, so they scale with type) */
  --la-slide-exit:  5%;      /* LR: exits +5% of width, enters from -3.75% */
  --la-slide-enter: -3.75%;
  --la-rise-exit:   -5%;     /* BT: exits up 5% of height, enters from +4% below */
  --la-rise-enter:  4%;
  --la-scale-exit:  1.19;    /* CO (centre-out): grows to 1.19 on exit, enters at .85 */
  --la-scale-enter: .85;
  --la-fade-mid:    .5;      /* opacity at the moment of the cut (exit end / enter start) */
}

/* Usage: add .la-in / .la-out and one direction modifier (.la-lr | .la-bt | .la-co) to any text block.
   Sequence them from JS: out -> wait (exit + gap) -> swap text -> in. For multi-line, set --i on each line. */
.la-out, .la-in { animation-fill-mode: both; animation-delay: calc(var(--i, 0) * var(--la-stagger)); }
.la-out { animation-duration: var(--la-dur-exit); animation-timing-function: var(--la-ease-in); }
.la-in  { animation-duration: var(--la-dur-enter); animation-timing-function: var(--la-ease-out); }

.la-lr.la-out { animation-name: la-lr-out; }  .la-lr.la-in { animation-name: la-lr-in; }
.la-bt.la-out { animation-name: la-bt-out; }  .la-bt.la-in { animation-name: la-bt-in; }
.la-co.la-out { animation-name: la-co-out; }  .la-co.la-in { animation-name: la-co-in; }

@keyframes la-lr-out { to   { translate: var(--la-slide-exit) 0; opacity: var(--la-fade-mid); } }
@keyframes la-lr-in  { from { translate: var(--la-slide-enter) 0; opacity: var(--la-fade-mid); } }
@keyframes la-bt-out { to   { translate: 0 var(--la-rise-exit); opacity: var(--la-fade-mid); } }
@keyframes la-bt-in  { from { translate: 0 var(--la-rise-enter); opacity: var(--la-fade-mid); } }
@keyframes la-co-out { to   { scale: var(--la-scale-exit); } }               /* Core CO: no fade, pure scale */
@keyframes la-co-in  { from { scale: var(--la-scale-enter); } }

@media (prefers-reduced-motion: reduce) { .la-out, .la-in { animation: none; } }
