/* ==========================================================================
   MTVCraft Online - Animations
   ========================================================================== */

/* Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@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.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

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

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

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

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

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

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

/* Animation Classes */
.animate-fadeIn {
    animation: fadeIn 0.6s ease-out forwards;
    opacity: 0;
}

.animate-fadeInUp {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

.animate-fadeInDown {
    animation: fadeInDown 0.8s ease-out forwards;
    opacity: 0;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.8s ease-out forwards;
    opacity: 0;
}

.animate-fadeInRight {
    animation: fadeInRight 0.8s ease-out forwards;
    opacity: 0;
}

.animate-scaleIn {
    animation: scaleIn 0.6s ease-out forwards;
    opacity: 0;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Typewriter effect for hero title */
.hero__title-main {
    position: relative;
    overflow: hidden;
}

.hero__title-main.typewriter {
    white-space: nowrap;
    animation: typewriter 2s steps(40, end) forwards;
}

.hero__title-main.typewriter::after {
    content: '|';
    position: absolute;
    right: 0;
    animation: blink 1s infinite;
}

/* Gradient animation for hero background */
.hero--animated {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* Loading shimmer effect */
.shimmer {
    background: linear-gradient(to right, #f0f0f0 0%, #f8f8f8 50%, #f0f0f0 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Scroll-triggered animations */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.scroll-animate.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger animation for grid items */
.stagger-animate {
    opacity: 0;
    transform: translateY(30px);
}

.stagger-animate.animate {
    animation: fadeInUp 0.6s ease-out forwards;
}

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

/* Button hover animations */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Card hover lift animation */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
}

/* Icon rotation on hover */
.icon-rotate {
    transition: transform 0.3s ease;
}

.icon-rotate:hover {
    transform: rotate(360deg);
}

/* Smooth appearance for lazy loaded images */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Navigation scroll effect */
.navbar--scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-md);
}

/* Process timeline animation */
.process__step {
    opacity: 0;
    transform: translateX(-50px);
}

.process__step:nth-child(even) {
    transform: translateX(50px);
}

.process__step.in-view {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.8s ease-out;
}

/* Feature icon animations */
.feature__icon {
    position: relative;
    overflow: hidden;
}

.feature__icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
    transform: rotate(45deg);
    transition: all 0.6s;
    opacity: 0;
}

.feature__card:hover .feature__icon::before {
    animation: shimmer 0.6s ease-out;
    opacity: 1;
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-gray-200);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

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

/* Text highlight animation */
.highlight-text {
    position: relative;
    display: inline-block;
}

.highlight-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--color-primary);
    transition: width 0.3s ease;
}

.highlight-text:hover::after {
    width: 100%;
}

/* Parallax effect */
.parallax {
    transform: translateZ(0);
    will-change: transform;
}

/* Smooth transitions for interactive elements */
a,
button,
input,
textarea,
select {
    transition: all var(--transition-fast);
}

/* Focus animations */
:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    transition: outline-offset 0.2s ease;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}