/* ============================================================
   Motion UI — tokens y utilidades
   ============================================================ */

:root {
    /* Duraciones */
    --motion-fast: 150ms;
    --motion-normal: 220ms;
    --motion-medium: 300ms;
    --motion-slow: 400ms;

    /* Easing */
    --ease-standard: cubic-bezier(.2, .8, .2, 1);
    --ease-emphasized: cubic-bezier(.2, 1, .2, 1);
    --ease-decelerate: cubic-bezier(0, .8, .2, 1);
    --ease-accelerate: cubic-bezier(.4, 0, 1, 1);

    /* Movimientos */
    --motion-press: scale(.97);
    --motion-card-press: scale(.985);
    --motion-hover-y: -2px;
    --motion-backdrop-opacity: .5;
}

/* ============================================================
   Utilidades reutilizables
   ============================================================ */

.motion-interactive {
    transition:
        transform var(--motion-fast) var(--ease-standard),
        opacity var(--motion-fast) ease,
        box-shadow var(--motion-fast) ease,
        background-color var(--motion-fast) ease,
        border-color var(--motion-fast) ease;
}

.motion-press:active,
.motion-press.active {
    transform: var(--motion-press);
}

.motion-lift:hover,
.motion-lift:focus-visible {
    transform: translateY(var(--motion-hover-y));
}

.motion-card {
    transition:
        transform var(--motion-fast) var(--ease-standard),
        opacity var(--motion-normal) ease,
        box-shadow var(--motion-fast) ease;
}

.motion-card:hover,
.motion-card:focus-within {
    transform: translateY(var(--motion-hover-y));
}

.motion-card:active,
.motion-card.active {
    transform: var(--motion-card-press);
}

.motion-fade {
    transition:
        opacity var(--motion-normal) var(--ease-standard),
        transform var(--motion-normal) var(--ease-standard);
}

.motion-form {
    transition:
        border-color var(--motion-fast) ease,
        box-shadow var(--motion-fast) ease,
        background-color var(--motion-fast) ease;
}

.motion-focus:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.motion-shadow-soft {
    box-shadow: 0 8px 30px rgba(0, 0, 0, .06);
}

.motion-glass {
    background: rgba(255, 255, 255, .65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, .35);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .06);
}

.dark .motion-glass {
    background: rgba(15, 23, 42, .7);
    border-color: rgba(255, 255, 255, .1);
}

/* ============================================================
   Animaciones de entrada
   ============================================================ */

@keyframes motion-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes motion-fade-in-down {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes motion-pop-in {
    from {
        opacity: 0;
        transform: scale(.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes motion-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

@keyframes motion-spin {
    to { transform: rotate(360deg); }
}

@keyframes motion-check {
    from {
        opacity: 0;
        transform: scale(.7);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.motion-fade-in {
    animation: motion-fade-in-up var(--motion-medium) var(--ease-standard) both;
}

.motion-fade-in-down {
    animation: motion-fade-in-down var(--motion-medium) var(--ease-standard) both;
}

.motion-pop-in {
    animation: motion-pop-in var(--motion-medium) var(--ease-standard) both;
}

.motion-shake {
    animation: motion-shake 250ms var(--ease-standard) both;
}

.motion-spin {
    animation: motion-spin 900ms linear infinite;
}

.motion-check {
    animation: motion-check var(--motion-fast) var(--ease-standard) both;
}

/* ============================================================
   Landing / demo specific animations
   ============================================================ */

@keyframes motion-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.motion-float {
    animation: motion-float 5s ease-in-out infinite;
}

@keyframes motion-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

.motion-bounce {
    animation: motion-bounce 1.8s ease-in-out infinite;
}

@keyframes motion-bar {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}

.motion-bar {
    transform-origin: bottom;
    animation: motion-bar 0.8s var(--ease-decelerate) both;
}

/* ============================================================
   Stagger
   ============================================================ */

.motion-stagger > *:nth-child(1)  { animation-delay: 0ms; }
.motion-stagger > *:nth-child(2)  { animation-delay: 25ms; }
.motion-stagger > *:nth-child(3)  { animation-delay: 50ms; }
.motion-stagger > *:nth-child(4)  { animation-delay: 75ms; }
.motion-stagger > *:nth-child(5)  { animation-delay: 100ms; }
.motion-stagger > *:nth-child(6)  { animation-delay: 125ms; }
.motion-stagger > *:nth-child(7)  { animation-delay: 150ms; }
.motion-stagger > *:nth-child(8)  { animation-delay: 175ms; }
.motion-stagger > *:nth-child(9)  { animation-delay: 200ms; }
.motion-stagger > *:nth-child(10) { animation-delay: 225ms; }
.motion-stagger > *:nth-child(11) { animation-delay: 250ms; }
.motion-stagger > *:nth-child(12) { animation-delay: 275ms; }

/* ============================================================
   Reduced motion
   ============================================================ */

@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;
    }
}
