/* =========================================================================
   Davi Code · motion.css
   Utilities de movimento/vida — consomem os tokens de tokens.css.
   Carregado via @import em tokens.css (disponível em todas as páginas).
   Tudo respeita prefers-reduced-motion no fim do arquivo.
   ========================================================================= */

/* ---- entrada: nascer subindo (cards, listas, resultados) ---- */
@keyframes dc-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes dc-pop {
  0%   { opacity: 0; transform: scale(.82); }
  60%  { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes dc-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---- feedback: press físico, shake de erro ---- */
@keyframes dc-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
  85% { transform: translateX(-2px); }
}
@keyframes dc-check {
  from { stroke-dashoffset: 32; }
  to   { stroke-dashoffset: 0; }
}

/* ---- carga: shimmer de skeleton + barra indeterminada ---- */
@keyframes dc-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
@keyframes dc-slide-x {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ---- ambient: scanline da landing (quase subliminar) ---- */
@keyframes dc-scanline {
  0%   { transform: translateY(-10vh); opacity: 0; }
  8%   { opacity: .5; }
  92%  { opacity: .5; }
  100% { transform: translateY(110vh); opacity: 0; }
}

/* ---- utilities ---- */
.u-rise   { animation: dc-rise var(--dur-3) var(--ease-out) both; }
.u-pop    { animation: dc-pop var(--dur-3) var(--ease-spring) both; }
.u-fade   { animation: dc-fade var(--dur-2) var(--ease-out) both; }
.u-shake  { animation: dc-shake 240ms var(--ease-out) 1; }

/* stagger: filhos entram em sequência (limitar com max filhos no seletor) */
.u-stagger > * { animation: dc-rise var(--dur-3) var(--ease-out) both; }
.u-stagger > *:nth-child(1) { animation-delay: 0ms; }
.u-stagger > *:nth-child(2) { animation-delay: 30ms; }
.u-stagger > *:nth-child(3) { animation-delay: 60ms; }
.u-stagger > *:nth-child(4) { animation-delay: 90ms; }
.u-stagger > *:nth-child(5) { animation-delay: 120ms; }
.u-stagger > *:nth-child(n+6) { animation-delay: 150ms; }

/* skeleton shimmer (aplicar em .sk-line) */
.sk-line {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg,
    var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: dc-shimmer 1.4s linear infinite;
}

/* barra de progresso indeterminada (topo do drawer) */
.dc-progress {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  overflow: hidden;
  border-radius: var(--radius-pill) 0 0 0;
}
.dc-progress::after {
  content: '';
  display: block;
  width: 25%;
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, transparent, hsl(var(--brand-500)), hsl(var(--accent2-500)));
  animation: dc-slide-x 1.1s var(--ease-out) infinite;
}

/* spot dos cards da landing (coordenadas via --mx/--my setadas por JS) */
.u-spotlight { position: relative; }
.u-spotlight::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%),
    hsl(var(--brand-500) / .12), transparent 65%);
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-out);
  pointer-events: none;
}
.u-spotlight:hover::before { opacity: 1; }

/* ---- reduced-motion: mata 100% do movimento novo ---- */
@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;
  }
}
