/* ===== 滚动显示 ===== */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.active { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ===== 科技网格背景 ===== */
.tech-grid {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
.tech-grid-lines {
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(rgba(79,70,229,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79,70,229,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    transform: perspective(500px) rotateX(60deg);
    animation: grid-move 20s linear infinite;
}
@keyframes grid-move {
    0% { transform: perspective(500px) rotateX(60deg) translateY(0); }
    100% { transform: perspective(500px) rotateX(60deg) translateY(60px); }
}

/* 扫描线 */
.scan-line {
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(6,182,212,0.3), transparent);
    animation: scan 4s ease-in-out infinite;
    z-index: 1;
}
@keyframes scan {
    0%, 100% { top: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    50% { top: 100%; }
}

/* 数据流粒子 */
.data-particle {
    position: absolute;
    width: 2px; height: 2px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--accent);
    animation: data-flow 3s linear infinite;
    opacity: 0;
}
@keyframes data-flow {
    0% { transform: translateY(-100vh) scale(0); opacity: 0; }
    10% { opacity: 1; transform: translateY(-80vh) scale(1); }
    90% { opacity: 1; }
    100% { transform: translateY(100vh) scale(0.5); opacity: 0; }
}

/* 脉冲光环 */
.pulse-ring {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(79,70,229,0.15);
    border-radius: 50%;
    animation: pulse-ring-anim 4s ease-out infinite;
}
.pulse-ring:nth-child(2) { animation-delay: 1.3s; }
.pulse-ring:nth-child(3) { animation-delay: 2.6s; }
@keyframes pulse-ring-anim {
    0% { width: 100px; height: 100px; opacity: 1; }
    100% { width: 500px; height: 500px; opacity: 0; }
}

/* 连接线 */
.connect-line {
    position: absolute;
    background: linear-gradient(90deg, transparent, rgba(79,70,229,0.2), transparent);
    height: 1px;
    animation: connect-pulse 3s ease-in-out infinite;
}
@keyframes connect-pulse {
    0%, 100% { opacity: 0.2; transform: scaleX(0.8); }
    50% { opacity: 0.6; transform: scaleX(1); }
}

/* 浮动节点 */
.float-node {
    position: absolute;
    width: 8px; height: 8px;
    background: var(--primary-light);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(79,70,229,0.5);
    animation: node-float 6s ease-in-out infinite;
}
@keyframes node-float {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(10px, -15px); }
    50% { transform: translate(-5px, -25px); }
    75% { transform: translate(-15px, -10px); }
}

/* ===== 基础动画 ===== */
@keyframes float-y {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-16px); }
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes orbit-rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ===== 可访问性增强 ===== */
/* 1. 跳到主要内容（键盘用户） */
.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 9999;
    padding: 0.75rem 1.25rem;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: top 0.2s ease;
}
.skip-link:focus { top: 1rem; outline: 3px solid var(--accent); outline-offset: 2px; }

/* 2. 键盘焦点环 */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}
a:focus-visible, button:focus-visible { outline-offset: 4px; }

/* 3. 尊重用户减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .reveal { opacity: 1 !important; transform: none !important; }
    .float-node, .data-particle, .pulse-ring, .connect-line, .scan-line { display: none !important; }
    #particles-canvas { display: none !important; }
}