/* ==========================================================================
   Animations - McMillan Woods Theme
   ========================================================================== */

/* ==========================================================================
   Keyframes
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

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

/* ==========================================================================
   Animation Classes
   ========================================================================== */

/* Base animation state - elements start invisible */
.animate {
    opacity: 0;
    will-change: opacity, transform;
}

/* Animated state - elements become visible */
.animate.is-visible {
    opacity: 1;
}

/* Animation Types */
.animate--fade.is-visible {
    animation: fadeIn 0.6s ease forwards;
}

.animate--fade-up.is-visible {
    animation: fadeInUp 0.6s ease forwards;
}

.animate--fade-down.is-visible {
    animation: fadeInDown 0.6s ease forwards;
}

.animate--fade-left.is-visible {
    animation: fadeInLeft 0.6s ease forwards;
}

.animate--fade-right.is-visible {
    animation: fadeInRight 0.6s ease forwards;
}

.animate--scale.is-visible {
    animation: scaleIn 0.6s ease forwards;
}

.animate--bounce.is-visible {
    animation: bounceIn 0.8s ease forwards;
}

/* Animation Delays */
.animate--delay-1 {
    animation-delay: 0.1s !important;
}

.animate--delay-2 {
    animation-delay: 0.2s !important;
}

.animate--delay-3 {
    animation-delay: 0.3s !important;
}

.animate--delay-4 {
    animation-delay: 0.4s !important;
}

.animate--delay-5 {
    animation-delay: 0.5s !important;
}

.animate--delay-6 {
    animation-delay: 0.6s !important;
}

/* Animation Durations */
.animate--slow {
    animation-duration: 0.8s !important;
}

.animate--fast {
    animation-duration: 0.4s !important;
}

/* ==========================================================================
   Staggered Animations for Lists/Grids
   ========================================================================== */
.stagger-children > * {
    opacity: 0;
    will-change: opacity, transform;
}

.stagger-children.is-visible > *:nth-child(1) {
    animation: fadeInUp 0.6s ease 0.1s forwards;
}

.stagger-children.is-visible > *:nth-child(2) {
    animation: fadeInUp 0.6s ease 0.2s forwards;
}

.stagger-children.is-visible > *:nth-child(3) {
    animation: fadeInUp 0.6s ease 0.3s forwards;
}

.stagger-children.is-visible > *:nth-child(4) {
    animation: fadeInUp 0.6s ease 0.4s forwards;
}

.stagger-children.is-visible > *:nth-child(5) {
    animation: fadeInUp 0.6s ease 0.5s forwards;
}

.stagger-children.is-visible > *:nth-child(6) {
    animation: fadeInUp 0.6s ease 0.6s forwards;
}

.stagger-children.is-visible > *:nth-child(7) {
    animation: fadeInUp 0.6s ease 0.7s forwards;
}

.stagger-children.is-visible > *:nth-child(8) {
    animation: fadeInUp 0.6s ease 0.8s forwards;
}

.stagger-children.is-visible > *:nth-child(9) {
    animation: fadeInUp 0.6s ease 0.9s forwards;
}

.stagger-children.is-visible > *:nth-child(10) {
    animation: fadeInUp 0.6s ease 1.0s forwards;
}

.stagger-children.is-visible > *:nth-child(11) {
    animation: fadeInUp 0.6s ease 1.1s forwards;
}

.stagger-children.is-visible > *:nth-child(12) {
    animation: fadeInUp 0.6s ease 1.2s forwards;
}

/* Catch-all for items beyond 12 */
.stagger-children.is-visible > *:nth-child(n+13) {
    animation: fadeInUp 0.6s ease 1.3s forwards;
}

/* ==========================================================================
   Hover Animations
   ========================================================================== */
.hover--lift {
    transition: transform var(--transition-normal);
}

.hover--lift:hover {
    transform: translateY(-5px);
}

.hover--scale {
    transition: transform var(--transition-normal);
}

.hover--scale:hover {
    transform: scale(1.02);
}

.hover--glow {
    transition: box-shadow var(--transition-normal);
}

.hover--glow:hover {
    box-shadow: 0 0 30px rgba(230, 57, 70, 0.3);
}

/* ==========================================================================
   Loading Animations
   ========================================================================== */
.loading-shimmer {
    background: linear-gradient(
        90deg,
        var(--color-gray-lighter) 25%,
        var(--bg-secondary) 50%,
        var(--color-gray-lighter) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ==========================================================================
   Page Transitions
   ========================================================================== */
.page-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.page-exit {
    opacity: 1;
}

.page-exit-active {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .animate,
    .stagger-children > *,
    .hover--lift,
    .hover--scale,
    .hover--glow {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    html {
        scroll-behavior: auto;
    }
}
