/* ============================================================
 * MOTION — Easings, duracoes, springs canonicos Apple
 * Use em transitions, animations, View Transitions e Motion (JS)
 * Copyright (c) 2026 Mestre dos Cabos — chargexdev
 * ============================================================ */

:root {
  /* ---------- Easings (replicam UICubicTimingParameters da Apple) ---------- */
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);     /* entrada (decel forte) */
  --ease-in:       cubic-bezier(0.7, 0, 0.84, 0);     /* saida */
  --ease-in-out:   cubic-bezier(0.83, 0, 0.17, 1);    /* default Apple */
  --ease-smooth:   cubic-bezier(0.32, 0.72, 0, 1);    /* iOS sheets/sliders */
  --ease-snappy:   cubic-bezier(0.45, 1.45, 0.5, 1);  /* spring sutil */

  /* ---------- Duracoes ---------- */
  --dur-instant:   80ms;    /* tap feedback */
  --dur-fast:      200ms;   /* hover, toggle, color tween */
  --dur-base:      300ms;   /* sheet, popover, page transition */
  --dur-slow:      400ms;   /* hero, big transitions */
  --dur-slower:    600ms;   /* raras transicoes de pagina inteira */

  /* ---------- Springs nativos via linear() (CSS Spring Easing) ---------- */
  /* Gerador: https://www.joshwcomeau.com/animation/linear-timing-function/ */

  /* iOS Snappy — controles pequenos (toggles, segments) */
  --spring-snappy: linear(
    0, 0.029 1.5%, 0.116 3.1%, 0.471 7.7%, 0.626 10%, 0.789 13.4%, 0.957 17.5%,
    1.075 21.2%, 1.117 23.1%, 1.144 25%, 1.157 27%, 1.155 29.2%, 1.139 31.5%,
    1.115 33.8%, 1.085 36.3%, 1.013 41.6%, 0.937 47.5%, 0.892 51%, 0.866 53.8%,
    0.843 57.1%, 0.829 60.7%, 0.821 65.2%, 0.819 70.5%, 0.821 77.5%, 0.83 90%, 0.834
  );

  /* iOS Smooth — modais, paginas (sem bounce) */
  --spring-smooth: linear(
    0, 0.005, 0.02 2%, 0.084 5%, 0.187 8.5%, 0.323 12.5%, 0.482 17%, 0.652 22%,
    0.811 27.5%, 0.928 32.5%, 1, 0.97, 0.95, 0.96, 0.99 65%, 1
  );

  /* iOS Bouncy — alegre, atencao (notificacoes, toast) */
  --spring-bouncy: linear(
    0, 0.034 1.5%, 0.137 3.1%, 0.548 7.7%, 0.755 10%, 0.953 13.4%, 1.149 17.5%,
    1.286 21.2%, 1.327 23.1%, 1.346 25%, 1.336 27%, 1.302 29.2%, 1.252 31.5%,
    1.188 33.8%, 1.121 36.3%, 1.001 41.6%, 0.906 47.5%, 0.86 51%, 0.835 53.8%,
    0.825 57.1%, 0.832 60.7%, 0.855 65.2%, 0.901 70.5%, 0.989 77.5%, 1
  );
}

/* ---------- Utility classes ---------- */
.transition-base    { transition: all var(--dur-base) var(--ease-in-out); }
.transition-fast    { transition: all var(--dur-fast) var(--ease-in-out); }
.transition-instant { transition: all var(--dur-instant) var(--ease-out); }

/* PROIBIDO transition: all em producao. Use estas formas:
   transition: transform var(--dur-fast) var(--ease-out);
   transition: background-color var(--dur-fast) var(--ease-out),
               opacity var(--dur-fast) var(--ease-out);
*/

/* ---------- Tap feedback universal ---------- */
.tap-feedback {
  transition: transform 80ms ease-out;
}
.tap-feedback:active {
  transform: scale(0.97);
}

/* ---------- prefers-reduced-motion (a11y OBRIGATORIO) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Spring helpers para Motion (JS) ---------- */
/*
   import { motion } from "motion/react";

   const springs = {
     snappy: { type: "spring", stiffness: 400, damping: 32, mass: 0.8 },
     smooth: { type: "spring", duration: 0.5, bounce: 0 },
     bouncy: { type: "spring", duration: 0.35, bounce: 0.2 },
   };

   <motion.div
     layout
     transition={springs.snappy}
   >
*/
