/* ==========================================================================
   animations.css — 动画效果：粒子、光晕、渐变、淡入
   ========================================================================== */

/* --- 视频背景 --- */
#bg-video {
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: 0;
    transform: translate(-50%, -50%);
    opacity: 0.12;
    pointer-events: none;
}

/* 移动端降级：隐藏视频，用渐变替代 */
@media (max-width: 768px) {
    #bg-video { display: none; }
    body::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: 0;
        background:
            radial-gradient(ellipse at 20% 50%, rgba(34, 211, 238, 0.08) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 20%, rgba(100, 255, 218, 0.05) 0%, transparent 50%),
            var(--color-bg-deep);
        pointer-events: none;
    }
}

.content-wrapper {
    position: relative;
    z-index: 1;
}

/* --- 粒子背景 (CSS-only) --- */
.particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.particles::before,
.particles::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: 0.3;
    animation: particle-float 35s ease-in-out infinite;
}

.particles::before {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.12) 0%, transparent 70%);
    top: 10%;
    left: 15%;
    animation-delay: 0s;
}

.particles::after {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(100, 255, 218, 0.08) 0%, transparent 70%);
    bottom: 10%;
    right: 10%;
    animation-delay: -10s;
}

@keyframes particle-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(12px, -12px) scale(1.02); }
    50% { transform: translate(-8px, 8px) scale(0.98); }
    75% { transform: translate(6px, 4px) scale(1.01); }
}

/* 额外粒子点 */
.particle-dots {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.particle-dot {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--color-cyan);
    border-radius: 50%;
    opacity: 0;
    animation: dot-twinkle 6s ease-in-out infinite;
}

.particle-dot:nth-child(1) { top: 20%; left: 10%; animation-delay: 0s; }
.particle-dot:nth-child(2) { top: 60%; left: 85%; animation-delay: 1s; }
.particle-dot:nth-child(3) { top: 30%; left: 70%; animation-delay: 2s; }
.particle-dot:nth-child(4) { top: 80%; left: 25%; animation-delay: 0.5s; }
.particle-dot:nth-child(5) { top: 15%; left: 55%; animation-delay: 3s; }
.particle-dot:nth-child(6) { top: 45%; left: 40%; animation-delay: 1.5s; }
.particle-dot:nth-child(7) { top: 70%; left: 60%; animation-delay: 2.5s; }
.particle-dot:nth-child(8) { top: 50%; left: 15%; animation-delay: 3.5s; }

@keyframes dot-twinkle {
    0%, 100% { opacity: 0; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(1.3); }
}

/* --- Hero 渐变动画 --- */
.hero-gradient {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(34, 211, 238, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(100, 255, 218, 0.04) 0%, transparent 50%);
    animation: gradient-shift 15s ease-in-out infinite;
}

@keyframes gradient-shift {
    0%, 100% { opacity: 0.8; transform: translate(0, 0); }
    50% { opacity: 0.5; transform: translate(4px, -4px); }
}

/* --- Section 分割渐变线 --- */
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-cyan-border), transparent);
    border: none;
    margin: 0;
}

/* --- 淡入动画 --- */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- 按钮光晕 --- */
.btn-primary {
    position: relative;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: var(--color-cyan);
    opacity: 0;
    filter: blur(12px);
    z-index: -1;
    transition: opacity var(--transition-fast);
}

.btn-primary:hover::after {
    opacity: 0.3;
}

/* --- 计数动画 (JS 驱动的类) --- */
.count-up {
    display: inline-block;
}

/* --- 平滑滚动到锚点时的偏移 --- */
:target {
    scroll-margin-top: calc(var(--nav-height) + 1rem);
}
