/**
 * Rainbow AIoT Theme - Animations
 * 动画样式
 *
 * @package Rainbow_AIoT
 */

/* ===== 滚动渐入动画 ===== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ===== 脉冲动画 ===== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ===== 浮动动画 ===== */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

.hero-float-1 {
    animation-delay: 0s;
}

.hero-float-2 {
    animation-delay: 1s;
}

.hero-float-3 {
    animation-delay: 2s;
}

/* ===== 场景滚动动画 ===== */
@keyframes sceneScroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.scroll-track {
    animation: sceneScroll 36s linear infinite;
}

.scene-scroll:hover .scroll-track {
    animation-play-state: paused;
}

/* ===== 滚动线条动画 ===== */
@keyframes scroll-line {
    0% {
        transform: scaleY(0);
        transform-origin: top;
    }
    50% {
        transform: scaleY(1);
    }
    100% {
        transform: scaleY(0);
        transform-origin: bottom;
    }
}

.hero-scroll::after {
    content: '';
    width: 1px;
    height: 60px;
    background: linear-gradient(180deg, var(--primary), transparent);
    animation: scroll-line 2s infinite;
}

/* ===== 数字计数动画 ===== */
.counter-number {
    display: inline-block;
    transition: all 0.1s;
}

/* ===== 悬停效果 ===== */
.scene-card,
.product-card,
.case-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.scene-card:hover,
.product-card:hover,
.case-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px rgba(79, 70, 229, 0.12);
}

/* ===== 按钮悬停 ===== */
.btn-cta-primary,
.hero-cta-primary {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-cta-primary:hover,
.hero-cta-primary:hover {
    transform: translateY(-2px);
}

/* ===== 导航下划线动画 ===== */
.nav-links a::after {
    transition: width 0.2s ease;
}

/* ===== 背景渐变动画 ===== */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-animate {
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

/* ===== 加载动画 ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

/* ===== 旋转动画 ===== */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

/* ===== 减少动画偏好 ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .scroll-track {
        animation: none;
    }

    .hero-float-card {
        animation: none;
    }
}
