/* #####################################################################
   MONARCH DESIGN SYSTEM v0.8.1
   MODULE: Animations
   PURPOSE: Token-driven motion utilities with reduced-motion protection.
   DEPENDENCIES: animation-tokens.php
   ##################################################################### */

@keyframes monarch-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes monarch-fade-up {
    from { opacity: 0; transform: translateY(var(--motion-distance-md)); }
    to { opacity: 1; transform: none; }
}

@keyframes monarch-fade-down {
    from { opacity: 0; transform: translateY(calc(var(--motion-distance-md) * -1)); }
    to { opacity: 1; transform: none; }
}

@keyframes monarch-fade-left {
    from { opacity: 0; transform: translateX(var(--motion-distance-md)); }
    to { opacity: 1; transform: none; }
}

@keyframes monarch-fade-right {
    from { opacity: 0; transform: translateX(calc(var(--motion-distance-md) * -1)); }
    to { opacity: 1; transform: none; }
}

@keyframes monarch-zoom-in {
    from { opacity: 0; transform: scale(var(--motion-scale-in)); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes monarch-pop {
    0% { opacity: 0; transform: scale(var(--motion-scale-in)); }
    70% { opacity: 1; transform: scale(var(--motion-scale-overshoot)); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes monarch-slide-up {
    from { transform: translateY(var(--motion-distance-lg)); }
    to { transform: none; }
}

@keyframes monarch-slide-left {
    from { transform: translateX(var(--motion-distance-lg)); }
    to { transform: none; }
}

@keyframes monarch-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

@keyframes monarch-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(calc(var(--motion-distance-sm) * -1)); }
    75% { transform: translateX(var(--motion-distance-sm)); }
}

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

@keyframes monarch-skeleton {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.animate-fade-in { animation: monarch-fade-in var(--motion-duration-slow) var(--motion-easing-standard) both; }
.animate-fade-up { animation: monarch-fade-up var(--motion-duration-slow) var(--motion-easing-enter) both; }
.animate-fade-down { animation: monarch-fade-down var(--motion-duration-slow) var(--motion-easing-enter) both; }
.animate-fade-left { animation: monarch-fade-left var(--motion-duration-slow) var(--motion-easing-enter) both; }
.animate-fade-right { animation: monarch-fade-right var(--motion-duration-slow) var(--motion-easing-enter) both; }
.animate-zoom-in { animation: monarch-zoom-in var(--motion-duration-normal) var(--motion-easing-enter) both; }
.animate-pop { animation: monarch-pop var(--motion-duration-normal) var(--motion-easing-bounce) both; }
.animate-slide-up { animation: monarch-slide-up var(--motion-duration-normal) var(--motion-easing-enter) both; }
.animate-slide-left { animation: monarch-slide-left var(--motion-duration-normal) var(--motion-easing-enter) both; }
.animate-pulse { animation: monarch-pulse 1.5s var(--motion-easing-standard) infinite; }
.animate-shake { animation: monarch-shake var(--motion-duration-normal) var(--motion-easing-standard) both; }
.animate-spin,
.animate-spinner { animation: monarch-spin 1s linear infinite; }
.animate-skeleton {
    background-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
    background-size: 200% 100%;
    animation: monarch-skeleton 1.5s linear infinite;
}

.hover-lift,
.hover-grow,
.hover-shadow {
    transition: transform var(--motion-duration-fast) var(--motion-easing-standard),
                box-shadow var(--motion-duration-fast) var(--motion-easing-standard);
}
.hover-lift:hover { transform: translateY(calc(var(--motion-distance-sm) * -1)); }
.hover-grow:hover { transform: scale(var(--motion-scale-overshoot)); }
.hover-shadow:hover { box-shadow: var(--shadow-lg); }

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

/* Declarative viewport-triggered motion. JavaScript adds the generated
   utility class only when the element enters the viewport. */
[data-monarch-animation][data-monarch-trigger="view"]:not(.is-animation-active) {
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    [data-monarch-animation][data-monarch-trigger="view"]:not(.is-animation-active) {
        opacity: 1;
    }
}
