/* ============================================
   高级动画效果样式表
   类似苹果官网的滚动视差和动画效果
   ============================================ */

/* === 页面加载动画 === */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* 快速加载模式 - 缩短动画时间 */
.page-loader.fast-load {
    transition: opacity 0.1s ease, visibility 0.1s ease;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 如果没有page-loader类则不显示 */
body:not(.show-loader) .page-loader {
    display: none;
}

/* === 粒子背景容器 === */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.particles-container canvas {
    width: 100%;
    height: 100%;
}

.hero {
    position: relative;
    overflow: hidden;
}

/* === 滚动动画类 === */
.animate-on-scroll {
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.animate-fade-up {
    transform: translateY(60px);
}

.animate-on-scroll.animate-fade-down {
    transform: translateY(-60px);
}

.animate-on-scroll.animate-fade-left {
    transform: translateX(-60px);
}

.animate-on-scroll.animate-fade-right {
    transform: translateX(60px);
}

.animate-on-scroll.animate-scale {
    transform: scale(0.9);
}

.animate-on-scroll.animate-zoom-in {
    transform: scale(0.8);
}

.animate-on-scroll.animate-rotate {
    transform: rotate(-5deg) scale(0.95);
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translate(0) scale(1) rotate(0);
}

.animate-on-scroll.animate-reset {
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 延迟类 */
.delay-100 { transition-delay: 0.1s; }
.delay-200 { transition-delay: 0.2s; }
.delay-300 { transition-delay: 0.3s; }
.delay-400 { transition-delay: 0.4s; }
.delay-500 { transition-delay: 0.5s; }
.delay-600 { transition-delay: 0.6s; }

/* === 视差效果 === */
.parallax-element {
    transition: transform 0.1s ease-out;
    will-change: transform;
}

.parallax-slow {
    --parallax-speed: 0.3;
}

.parallax-medium {
    --parallax-speed: 0.5;
}

.parallax-fast {
    --parallax-speed: 0.8;
}

/* === Hero文字动画 === */
.hero-title {
    overflow: hidden;
}

.hero-title .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%);
    animation: wordReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-title .word:nth-child(1) { animation-delay: 0.2s; }
.hero-title .word:nth-child(2) { animation-delay: 0.4s; }
.hero-title .word:nth-child(3) { animation-delay: 0.6s; }

@keyframes wordReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-subtitle {
    opacity: 0;
    animation: fadeUp 0.8s ease 0.8s forwards;
}

.hero-buttons {
    opacity: 0;
    animation: fadeUp 0.8s ease 1s forwards;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === 磁性按钮效果 === */
.magnetic-btn {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.magnetic-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.magnetic-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* === 卡片悬停效果 === */
.feature-card,
.product-card,
.news-card,
.solution-card {
    position: relative;
    overflow: hidden;
}

.feature-card::before,
.product-card::before,
.news-card::before,
.solution-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 0.7s ease;
}

.feature-card:hover::before,
.product-card:hover::before,
.news-card:hover::before,
.solution-card:hover::before {
    left: 100%;
}

/* 卡片3D倾斜效果 */
.tilt-card {
    transform-style: preserve-3d;
    transform: perspective(1000px);
}

.tilt-card .tilt-inner {
    transform: translateZ(20px);
}

/* === 数字滚动动画 === */
.stat-item h3 {
    opacity: 0;
    transform: translateY(20px);
}

.stat-item.is-visible h3 {
    animation: countUp 0.6s ease forwards;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === 图片揭示动画 === */
.reveal-image {
    position: relative;
    overflow: hidden;
}

.reveal-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    transform: scaleX(1);
    transform-origin: right;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-image.is-visible::after {
    transform: scaleX(0);
}

/* === 文字逐字动画 === */
.char-animate {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%);
}

.char-animate.is-visible {
    animation: charReveal 0.5s ease forwards;
}

@keyframes charReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === 分割线动画 === */
.animated-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    transform: scaleX(0);
    transition: transform 1s ease;
}

.animated-divider.is-visible {
    transform: scaleX(1);
}

/* === 渐变背景动画 === */
.gradient-animate {
    background: linear-gradient(-45deg, #2563eb, #1e40af, #3b82f6, #60a5fa);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* === 脉冲动画 === */
.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* === 浮动动画 === */
.float-animation {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* === 滚动进度条 === */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    z-index: 1001;
    transition: width 0.1s ease;
}

/* === 平滑锚点滚动 === */
html {
    scroll-behavior: smooth;
}

/* === 滚动捕捉效果（可选） === */
.snap-section {
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

/* === 鼠标跟随光效 === */
.cursor-glow {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
}

/* === 页面过渡 === */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    z-index: 9999;
    transform: scaleY(0);
    transform-origin: bottom;
}

.page-transition.active {
    animation: pageTransition 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pageTransition {
    0% { transform: scaleY(0); transform-origin: bottom; }
    50% { transform: scaleY(1); transform-origin: bottom; }
    50.1% { transform-origin: top; }
    100% { transform: scaleY(0); transform-origin: top; }
}

/* === 响应式调整 === */
@media (max-width: 768px) {
    .cursor-glow {
        display: none;
    }
    
    .hero-title .word {
        animation-delay: 0.1s !important;
    }
    
    .animate-on-scroll {
        transition-duration: 0.6s;
    }

    .animate-on-scroll.animate-fade-left,
    .animate-on-scroll.animate-fade-right {
        transform: translateY(40px);
    }
}

/* === 性能优化 === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .particles-container {
        display: none;
    }
}

/* === 滚动触发动画速度控制 === */
.animate-slow {
    transition-duration: 1.2s !important;
}

.animate-medium {
    transition-duration: 0.8s !important;
}

.animate-fast {
    transition-duration: 0.5s !important;
}
