/* ===== Animation Keyframes ===== */

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

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

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

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

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

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

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

/* Glow Animations */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 212, 255, 0.5);
    }
}

@keyframes borderGlow {
    0%, 100% {
        border-color: rgba(0, 212, 255, 0.2);
    }
    50% {
        border-color: rgba(0, 212, 255, 0.5);
    }
}

/* Music Wave Animation */
@keyframes waveAnimation {
    0% {
        transform: scaleY(0.5);
    }
    50% {
        transform: scaleY(1);
    }
    100% {
        transform: scaleY(0.5);
    }
}

/* Floating Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(2deg);
    }
    75% {
        transform: translateY(10px) rotate(-2deg);
    }
}

/* Rotating Gradient */
@keyframes rotateGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

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

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

/* Base animation states */
/* 默认可见，JS 加载后才添加动画初始状态 */
[data-aos] {
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* JS 加载后添加 .aos-init 类，才隐藏元素等待触发 */
.aos-init [data-aos] {
    opacity: 0;
}

[data-aos].aos-animate {
    opacity: 1;
}

/* Fade animations - 只在 JS 初始化后才应用变换 */
.aos-init [data-aos="fade-up"] {
    transform: translateY(50px);
}

[data-aos="fade-up"].aos-animate {
    transform: translateY(0);
    opacity: 1;
}

.aos-init [data-aos="fade-down"] {
    transform: translateY(-30px);
}

[data-aos="fade-down"].aos-animate {
    transform: translateY(0);
}

.aos-init [data-aos="fade-left"] {
    transform: translateX(30px);
}

[data-aos="fade-left"].aos-animate {
    transform: translateX(0);
}

.aos-init [data-aos="fade-right"] {
    transform: translateX(-30px);
}

[data-aos="fade-right"].aos-animate {
    transform: translateX(0);
}

/* Scale animations */
.aos-init [data-aos="zoom-in"] {
    transform: scale(0.9);
}

[data-aos="zoom-in"].aos-animate {
    transform: scale(1);
}

/* Animation delays */
[data-aos-delay="100"] {
    transition-delay: 0.1s;
}

[data-aos-delay="200"] {
    transition-delay: 0.2s;
}

[data-aos-delay="300"] {
    transition-delay: 0.3s;
}

[data-aos-delay="400"] {
    transition-delay: 0.4s;
}

[data-aos-delay="500"] {
    transition-delay: 0.5s;
}

/* ===== Interactive Animations ===== */

/* Button hover effects */
.btn-animated {
    position: relative;
    overflow: hidden;
}

.btn-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s ease;
}

.btn-animated:hover::before {
    left: 100%;
}

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

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

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

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

/* Image zoom on hover */
.img-zoom-hover {
    overflow: hidden;
}

.img-zoom-hover img {
    transition: transform 0.5s ease;
}

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

/* ===== Music-specific Animations ===== */

/* Audio wave bars */
.audio-wave {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 40px;
}

.audio-wave-bar {
    width: 4px;
    background: linear-gradient(to top, var(--color-accent-cyan), var(--color-accent-purple));
    border-radius: 2px;
    animation: waveAnimation 0.8s ease-in-out infinite;
}

.audio-wave-bar:nth-child(1) { animation-delay: 0s; height: 60%; }
.audio-wave-bar:nth-child(2) { animation-delay: 0.1s; height: 80%; }
.audio-wave-bar:nth-child(3) { animation-delay: 0.2s; height: 100%; }
.audio-wave-bar:nth-child(4) { animation-delay: 0.3s; height: 70%; }
.audio-wave-bar:nth-child(5) { animation-delay: 0.4s; height: 90%; }

/* Vinyl spin effect */
.vinyl-spin {
    animation: spin 4s linear infinite;
}

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

/* Note float effect */
.note-float {
    animation: noteFloat 3s ease-in-out infinite;
}

@keyframes noteFloat {
    0%, 100% {
        transform: translateY(0) rotate(-5deg);
        opacity: 0.7;
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
        opacity: 1;
    }
}

/* ===== Loading Animations ===== */

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Dots loading */
.dots-loading {
    display: flex;
    gap: 6px;
}

.dots-loading span {
    width: 8px;
    height: 8px;
    background: var(--color-accent-cyan);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.dots-loading span:nth-child(1) { animation-delay: 0s; }
.dots-loading span:nth-child(2) { animation-delay: 0.2s; }
.dots-loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== Page Transition Effects ===== */

/* Page load animation */
.page-loaded .hero-title {
    animation: fadeInUp 0.8s ease forwards;
}

.page-loaded .hero-subtitle {
    animation: fadeInUp 0.8s ease 0.2s forwards;
    opacity: 0;
}

.page-loaded .hero-downloads {
    animation: fadeInUp 0.8s ease 0.4s forwards;
    opacity: 0;
}

.page-loaded .hero-image {
    animation: fadeIn 1s ease 0.3s forwards, floatImage 6s ease-in-out 1s infinite;
    opacity: 0;
}

/* ===== Scroll-triggered Animations ===== */

/* Reveal on scroll */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Stagger children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.stagger-children.active > *:nth-child(1) { transition-delay: 0s; }
.stagger-children.active > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-children.active > *:nth-child(3) { transition-delay: 0.2s; }
.stagger-children.active > *:nth-child(4) { transition-delay: 0.3s; }
.stagger-children.active > *:nth-child(5) { transition-delay: 0.4s; }

.stagger-children.active > * {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
    }
}
