/* ===================================
   ANIMATIONS & MICRO-INTERACTIONS
   =================================== */

/* Smooth Reveal Animations */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--ease-in-out),
                transform 0.8s var(--ease-in-out);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s var(--ease-in-out),
                transform 0.8s var(--ease-in-out);
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.8s var(--ease-in-out),
                transform 0.8s var(--ease-in-out);
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s var(--ease-in-out),
                transform 0.8s var(--ease-in-out);
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Stagger Animation for Lists */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    animation: staggerFadeIn 0.6s var(--ease-in-out) forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }

@keyframes staggerFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Floating Animation */
.float {
    animation: floating 3s ease-in-out infinite;
}

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

/* Pulse Animation */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Shimmer Effect */
.shimmer {
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

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

/* Glow Effect */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 10px rgba(255, 107, 53, 0.3),
                    0 0 20px rgba(255, 107, 53, 0.2);
    }
    to {
        box-shadow: 0 0 20px rgba(255, 107, 53, 0.5),
                    0 0 30px rgba(255, 107, 53, 0.3),
                    0 0 40px rgba(255, 107, 53, 0.2);
    }
}

/* Bounce In Animation */
.bounce-in {
    animation: bounceIn 0.8s var(--ease-bounce);
}

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

/* Slide In From Bottom */
.slide-up {
    animation: slideUp 0.6s var(--ease-in-out) forwards;
}

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

/* Fade In */
.fade-in {
    animation: fadeIn 0.8s var(--ease-in-out) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Rotate In */
.rotate-in {
    animation: rotateIn 0.6s var(--ease-in-out) forwards;
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-10deg) scale(0.9);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* Card Tilt Effect (3D) */
.card-tilt {
    transform-style: preserve-3d;
    transition: transform var(--transition-base);
}

.card-tilt:hover {
    transform: perspective(1000px) rotateX(2deg) rotateY(5deg);
}

/* Magnetic Hover Effect */
.magnetic {
    transition: transform var(--transition-fast);
}

.magnetic:hover {
    transform: scale(1.05);
}

/* Underline Animation */
.underline-animate {
    position: relative;
    text-decoration: none;
}

.underline-animate::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width var(--transition-base);
}

.underline-animate:hover::after {
    width: 100%;
}

/* Gradient Text Animation */
.gradient-text {
    background: linear-gradient(
        90deg,
        var(--color-aurora),
        var(--color-sunset),
        var(--color-aurora)
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 3s linear infinite;
}

@keyframes gradientFlow {
    to {
        background-position: 200% center;
    }
}

/* Button Press Effect */
.btn-press:active {
    transform: scale(0.95);
    transition: transform 0.1s;
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-ice) 25%,
        var(--color-snow) 50%,
        var(--color-ice) 75%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: var(--radius-md);
}

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

/* Number Counter Animation */
.counter {
    font-variant-numeric: tabular-nums;
}

/* Elastic Bounce */
.elastic {
    animation: elastic 1s ease-out;
}

@keyframes elastic {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* Swing Animation */
.swing {
    transform-origin: top;
    animation: swing 1s ease-in-out;
}

@keyframes swing {
    20% {
        transform: rotate(15deg);
    }
    40% {
        transform: rotate(-10deg);
    }
    60% {
        transform: rotate(5deg);
    }
    80% {
        transform: rotate(-5deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

/* Zoom In/Out */
.zoom-in {
    animation: zoomIn 0.5s var(--ease-in-out);
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Flip Animation */
.flip {
    animation: flip 0.6s ease-in-out;
}

@keyframes flip {
    0% {
        transform: perspective(400px) rotateY(0);
    }
    100% {
        transform: perspective(400px) rotateY(360deg);
    }
}

/* Shake Animation */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-aurora), var(--color-sunset));
    z-index: 9999;
    transition: width 0.1s linear;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--color-aurora);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.back-to-top:active {
    transform: translateY(-2px);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-ice);
    border-top-color: var(--color-aurora);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Hover Lift Effect */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* Ken Burns Effect (for images) */
.ken-burns {
    overflow: hidden;
}

.ken-burns img {
    transition: transform 20s ease-in-out;
}

.ken-burns:hover img {
    transform: scale(1.1);
}

/* Accessibility - 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;
    }

    .float,
    .pulse,
    .shimmer,
    .glow,
    .gradient-text {
        animation: none !important;
    }
}

/* Page Transition */
.page-transition {
    animation: pageTransition 0.5s var(--ease-in-out);
}

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