/**
 * Shared utilities for @bytelyst/motion.
 *
 * Springs are expressed as `cubic-bezier` curves so we ship zero
 * runtime physics — primitives compose with native CSS transitions.
 */

export const SPRINGS = {
  snappy: 'cubic-bezier(0.2, 0.9, 0.1, 1)',
  bouncy: 'cubic-bezier(0.34, 1.56, 0.64, 1)',
  gentle: 'cubic-bezier(0.4, 0, 0.2, 1)',
  instant: 'cubic-bezier(0, 0, 1, 1)',
} as const;

export type Spring = keyof typeof SPRINGS;

/** Cheap server-safe check for prefers-reduced-motion. */
export function prefersReducedMotion(): boolean {
  if (typeof window === 'undefined' || !window.matchMedia) return false;
  return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
}
