/* ============================================================
   Motion — Material 3 Expressive
   ------------------------------------------------------------
   M3E defaults to the *Expressive* motion scheme: spring physics
   with lower damping so transitions visibly overshoot and settle.
   These tokens are authored from the M3E motion spec (springs are
   not stored as Figma Variables). Springs are approximated as CSS
   linear() easing curves so they run on plain transitions.
   ============================================================ */

:root {
  /* ---- Easing (md.sys.motion.easing) ---- */
  --md-sys-motion-easing-linear: cubic-bezier(0, 0, 1, 1); /* @kind other */
  --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1); /* @kind other */
  --md-sys-motion-easing-standard-accelerate: cubic-bezier(0.3, 0, 1, 1); /* @kind other */
  --md-sys-motion-easing-standard-decelerate: cubic-bezier(0, 0, 0, 1); /* @kind other */
  --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1); /* @kind other */
  --md-sys-motion-easing-emphasized-accelerate: cubic-bezier(0.3, 0, 0.8, 0.15); /* @kind other */
  --md-sys-motion-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1); /* @kind other */
  --md-sys-motion-easing-legacy: cubic-bezier(0.4, 0, 0.2, 1); /* @kind other */

  /* ---- Duration (md.sys.motion.duration) ---- */
  --md-sys-motion-duration-short1: 50ms; /* @kind other */
  --md-sys-motion-duration-short2: 100ms; /* @kind other */
  --md-sys-motion-duration-short3: 150ms; /* @kind other */
  --md-sys-motion-duration-short4: 200ms; /* @kind other */
  --md-sys-motion-duration-medium1: 250ms; /* @kind other */
  --md-sys-motion-duration-medium2: 300ms; /* @kind other */
  --md-sys-motion-duration-medium3: 350ms; /* @kind other */
  --md-sys-motion-duration-medium4: 400ms; /* @kind other */
  --md-sys-motion-duration-long1: 450ms; /* @kind other */
  --md-sys-motion-duration-long2: 500ms; /* @kind other */
  --md-sys-motion-duration-long3: 550ms; /* @kind other */
  --md-sys-motion-duration-long4: 600ms; /* @kind other */
  --md-sys-motion-duration-extra-long1: 700ms; /* @kind other */
  --md-sys-motion-duration-extra-long2: 800ms; /* @kind other */
  --md-sys-motion-duration-extra-long3: 900ms; /* @kind other */
  --md-sys-motion-duration-extra-long4: 1000ms; /* @kind other */

  /* ---- Expressive spring easings (linear() approximations) ----
     Named by category (spatial = position/size, effect = color/opacity)
     and speed. Spatial springs carry overshoot; effect springs settle
     without overshoot. Pair each with its --*-duration below. */

  /* Spatial — visible overshoot / bounce (lower damping) */
  --md-sys-motion-spring-spatial-fast: linear(0,0.16 3.3%,0.55 7.8%,0.9 12.4%,1.13 16.9%,1.22 21.7%,1.22 26.9%,1.15 32.4%,1.06 38.9%,0.998 47%,0.99 54%,1.003 68%,1); /* @kind other */
  --md-sys-motion-spring-spatial-fast-duration: 350ms; /* @kind other */
  --md-sys-motion-spring-spatial-default: linear(0,0.09 2.7%,0.35 6.9%,0.79 12.1%,1.09 16.9%,1.23 21.3%,1.27 25.9%,1.24 31.1%,1.13 38.4%,1.02 47.9%,0.986 55%,0.996 70%,1); /* @kind other */
  --md-sys-motion-spring-spatial-default-duration: 500ms; /* @kind other */
  --md-sys-motion-spring-spatial-slow: linear(0,0.05 3.1%,0.2 7.2%,0.63 13.4%,0.98 18.9%,1.2 24.1%,1.28 29.6%,1.25 35.4%,1.13 43.9%,1.01 54%,0.982 62%,1.001 82%,1); /* @kind other */
  --md-sys-motion-spring-spatial-slow-duration: 650ms; /* @kind other */

  /* Effect — smooth, no overshoot (higher damping) */
  --md-sys-motion-spring-effect-fast: linear(0,0.24 5.2%,0.66 12.9%,0.87 18.9%,0.96 25%,0.995 34%,1); /* @kind other */
  --md-sys-motion-spring-effect-fast-duration: 200ms; /* @kind other */
  --md-sys-motion-spring-effect-default: linear(0,0.16 5.2%,0.53 12.9%,0.79 20.1%,0.92 27.4%,0.98 36%,1); /* @kind other */
  --md-sys-motion-spring-effect-default-duration: 300ms; /* @kind other */
  --md-sys-motion-spring-effect-slow: linear(0,0.11 5.2%,0.39 13.4%,0.67 21.8%,0.85 30%,0.95 40%,1); /* @kind other */
  --md-sys-motion-spring-effect-slow-duration: 450ms; /* @kind other */

  /* Convenience default transitions */
  --md-transition-standard: var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard); /* @kind other */
  --md-transition-emphasized: var(--md-sys-motion-duration-medium4) var(--md-sys-motion-easing-emphasized); /* @kind other */
  --md-transition-spring: var(--md-sys-motion-spring-spatial-default-duration) var(--md-sys-motion-spring-spatial-default); /* @kind other */
}

/* Reusable expressive keyframes ------------------------------------ */

/* Springy pop-in for entering surfaces (dialogs, menus, FABs). */
@keyframes md-spring-in {
  0%   { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* Wavy / meandering rotation used by the M3E progress indicator. */
@keyframes md-wavy-rotate {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Shape-morph pulse (rounded <-> squircle-ish) for expressive press. */
@keyframes md-shape-morph {
  0%, 100% { border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%; }
  50%      { border-radius: 42% 58% 46% 54% / 55% 44% 56% 45%; }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --md-transition-standard: 0.001ms linear; /* @kind other */
    --md-transition-emphasized: 0.001ms linear; /* @kind other */
    --md-transition-spring: 0.001ms linear; /* @kind other */
  }
}
