/* ==========================================
   SoundVault - Animations
   ========================================== */

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide Up */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide Down */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Glow Pulse */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(139, 92, 246, 0.6);
    }
}

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

/* Rotate */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Bounce */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Wave */
@keyframes wave {
    0%, 100% {
        transform: scaleY(0.5);
    }
    50% {
        transform: scaleY(1);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.6s ease forwards;
}

.animate-fade-in-delay {
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
    animation-delay: 0.3s;
}

.animate-fade-in-delay-2 {
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
    animation-delay: 0.6s;
}

.animate-slide-up {
    animation: slideUp 0.8s ease forwards;
}

.animate-slide-up-delay {
    opacity: 0;
    animation: slideUp 0.8s ease forwards;
    animation-delay: 0.2s;
}

.animate-slide-down {
    animation: slideDown 0.8s ease forwards;
}

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

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

.animate-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

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

/* Scroll Reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

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

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s ease;
}

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

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s ease;
}

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

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.8s ease;
}

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

/* Stagger Children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-children.active > *:nth-child(1) { animation: slideUp 0.6s ease forwards; animation-delay: 0.1s; }
.stagger-children.active > *:nth-child(2) { animation: slideUp 0.6s ease forwards; animation-delay: 0.2s; }
.stagger-children.active > *:nth-child(3) { animation: slideUp 0.6s ease forwards; animation-delay: 0.3s; }
.stagger-children.active > *:nth-child(4) { animation: slideUp 0.6s ease forwards; animation-delay: 0.4s; }
.stagger-children.active > *:nth-child(5) { animation: slideUp 0.6s ease forwards; animation-delay: 0.5s; }
.stagger-children.active > *:nth-child(6) { animation: slideUp 0.6s ease forwards; animation-delay: 0.6s; }

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
}

.hover-scale {
    transition: transform 0.3s ease;
}

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

/* Text Gradient Animation */
.animated-gradient-text {
    background: linear-gradient(
        90deg,
        #8b5cf6,
        #06b6d4,
        #ec4899,
        #8b5cf6
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientMove 5s linear infinite;
}

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

/* Border Glow Animation */
.border-glow {
    position: relative;
}

.border-glow::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #8b5cf6, #06b6d4, #ec4899, #8b5cf6);
    background-size: 400% 400%;
    border-radius: inherit;
    z-index: -1;
    animation: borderGlow 3s ease infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.border-glow:hover::before {
    opacity: 1;
}

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

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
    border-radius: 8px;
}

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

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--accent-primary);
    white-space: nowrap;
    animation:
        typing 3s steps(30) forwards,
        blink 0.7s step-end infinite;
}

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

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

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

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

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

/* Parallax */
.parallax-slow {
    transform: translateY(calc(var(--scroll) * 0.3));
}

.parallax-medium {
    transform: translateY(calc(var(--scroll) * 0.5));
}

.parallax-fast {
    transform: translateY(calc(var(--scroll) * 0.7));
}

/* Magnetic Hover */
.magnetic {
    transition: transform 0.3s ease;
}

/* Counter Animation */
.counter {
    display: inline-block;
}

/* Page Transition */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 9999;
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.5s ease;
}

.page-transition.active {
    transform: scaleY(1);
    transform-origin: top;
}

/* Noise Overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Custom Cursor */
.custom-cursor {
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.15s ease, opacity 0.15s ease;
    mix-blend-mode: difference;
}

.custom-cursor.hover {
    transform: scale(1.5);
}

.custom-cursor.click {
    transform: scale(0.8);
}

/* Morphing Shape */
.morph-shape {
    animation: morph 8s ease-in-out infinite;
}

@keyframes morph {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    50% {
        border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%;
    }
    75% {
        border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%;
    }
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ec4899;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-1 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #06b6d4;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-2 5s infinite linear alternate-reverse;
}

@keyframes glitch-1 {
    0% { clip: rect(31px, 9999px, 94px, 0); }
    5% { clip: rect(70px, 9999px, 71px, 0); }
    10% { clip: rect(29px, 9999px, 24px, 0); }
    15% { clip: rect(67px, 9999px, 91px, 0); }
    20% { clip: rect(14px, 9999px, 59px, 0); }
    25% { clip: rect(34px, 9999px, 28px, 0); }
    30% { clip: rect(58px, 9999px, 72px, 0); }
    35% { clip: rect(54px, 9999px, 13px, 0); }
    40% { clip: rect(12px, 9999px, 31px, 0); }
    45% { clip: rect(47px, 9999px, 95px, 0); }
    50% { clip: rect(82px, 9999px, 64px, 0); }
    55% { clip: rect(97px, 9999px, 37px, 0); }
    60% { clip: rect(33px, 9999px, 85px, 0); }
    65% { clip: rect(76px, 9999px, 46px, 0); }
    70% { clip: rect(21px, 9999px, 74px, 0); }
    75% { clip: rect(88px, 9999px, 19px, 0); }
    80% { clip: rect(43px, 9999px, 57px, 0); }
    85% { clip: rect(61px, 9999px, 83px, 0); }
    90% { clip: rect(7px, 9999px, 42px, 0); }
    95% { clip: rect(69px, 9999px, 25px, 0); }
    100% { clip: rect(38px, 9999px, 68px, 0); }
}

@keyframes glitch-2 {
    0% { clip: rect(65px, 9999px, 42px, 0); }
    5% { clip: rect(23px, 9999px, 89px, 0); }
    10% { clip: rect(78px, 9999px, 16px, 0); }
    15% { clip: rect(41px, 9999px, 73px, 0); }
    20% { clip: rect(92px, 9999px, 35px, 0); }
    25% { clip: rect(18px, 9999px, 61px, 0); }
    30% { clip: rect(56px, 9999px, 84px, 0); }
    35% { clip: rect(37px, 9999px, 49px, 0); }
    40% { clip: rect(81px, 9999px, 22px, 0); }
    45% { clip: rect(44px, 9999px, 96px, 0); }
    50% { clip: rect(11px, 9999px, 58px, 0); }
    55% { clip: rect(73px, 9999px, 31px, 0); }
    60% { clip: rect(29px, 9999px, 87px, 0); }
    65% { clip: rect(66px, 9999px, 14px, 0); }
    70% { clip: rect(52px, 9999px, 79px, 0); }
    75% { clip: rect(8px, 9999px, 45px, 0); }
    80% { clip: rect(94px, 9999px, 62px, 0); }
    85% { clip: rect(27px, 9999px, 76px, 0); }
    90% { clip: rect(59px, 9999px, 33px, 0); }
    95% { clip: rect(86px, 9999px, 51px, 0); }
    100% { clip: rect(15px, 9999px, 98px, 0); }
}
