/* ===================================
   animations.css - 动画样式
   描述：YiCore 企业网站动画效果
   =================================== */

/* -----------------------------------
   1. 关键帧动画定义
   ----------------------------------- */

/* 淡入动画 */
@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);
    }
}

/* 缩放动画 */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 弹跳动画 */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
        transform: translateY(0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translateY(-30px);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translateY(-15px);
    }
    90% {
        transform: translateY(-4px);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

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

@keyframes pulseShadow {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 102, 255, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 20px rgba(0, 102, 255, 0);
    }
}

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

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

/* 摇晃动画 */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

@keyframes swing {
    20% {
        transform: rotate(15deg);
    }
    40% {
        transform: rotate(-10deg);
    }
    60% {
        transform: rotate(5deg);
    }
    80% {
        transform: rotate(-5deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

/* 闪烁动画 */
@keyframes flash {
    0%, 50%, 100% {
        opacity: 1;
    }
    25%, 75% {
        opacity: 0;
    }
}

@keyframes tada {
    0% {
        transform: scale(1);
    }
    10%, 20% {
        transform: scale(0.9) rotate(-3deg);
    }
    30%, 50%, 70%, 90% {
        transform: scale(1.1) rotate(3deg);
    }
    40%, 60%, 80% {
        transform: scale(1.1) rotate(-3deg);
    }
    100% {
        transform: scale(1) rotate(0);
    }
}

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

@keyframes floatHorizontal {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(20px);
    }
}

/* 波浪动画 */
@keyframes wave {
    0% {
        transform: rotate(0deg);
    }
    10% {
        transform: rotate(14deg);
    }
    20% {
        transform: rotate(-8deg);
    }
    30% {
        transform: rotate(14deg);
    }
    40% {
        transform: rotate(-4deg);
    }
    50% {
        transform: rotate(10deg);
    }
    60% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

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

/* 打字机动画 */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* 扫光动画 */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* 粒子动画基础 */
@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(20px);
        opacity: 0;
    }
}

/* -----------------------------------
   2. 动画应用类
   ----------------------------------- */

/* 基础动画类 */
.animate-fadeIn {
    animation: fadeIn 0.5s ease forwards;
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.6s ease forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.6s ease forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.6s ease forwards;
}

.animate-scaleIn {
    animation: scaleIn 0.5s ease forwards;
}

.animate-zoomIn {
    animation: zoomIn 0.5s ease forwards;
}

.animate-bounce {
    animation: bounce 1s ease infinite;
}

.animate-bounceIn {
    animation: bounceIn 0.75s ease forwards;
}

.animate-pulse {
    animation: pulse 2s ease infinite;
}

.animate-pulseShadow {
    animation: pulseShadow 2s ease infinite;
}

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

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

.animate-wave {
    animation: wave 2.5s ease-in-out infinite;
}

/* -----------------------------------
   3. 动画延迟类
   ----------------------------------- */
.delay-0 { animation-delay: 0ms; }
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }
.delay-900 { animation-delay: 900ms; }
.delay-1000 { animation-delay: 1000ms; }

/* -----------------------------------
   4. 动画持续时间类
   ----------------------------------- */
.duration-fast { animation-duration: 300ms; }
.duration-normal { animation-duration: 500ms; }
.duration-slow { animation-duration: 800ms; }
.duration-slower { animation-duration: 1200ms; }
.duration-slowest { animation-duration: 2000ms; }

/* -----------------------------------
   5. 交互动画效果
   ----------------------------------- */

/* 悬停效果 */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.hover-grow {
    transition: transform var(--transition-fast);
}

.hover-grow:hover {
    transform: scale(1.05);
}

.hover-shrink {
    transition: transform var(--transition-fast);
}

.hover-shrink:hover {
    transform: scale(0.95);
}

.hover-rotate {
    transition: transform var(--transition-fast);
}

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

.hover-brightness {
    transition: filter var(--transition-fast);
}

.hover-brightness:hover {
    filter: brightness(1.1);
}

/* 链接下划线动画 */
.link-underline {
    position: relative;
    text-decoration: none;
}

.link-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width var(--transition-base);
}

.link-underline:hover::after {
    width: 100%;
}

/* 按钮悬停光效 */
.btn-shine {
    position: relative;
    overflow: hidden;
}

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

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

/* 卡片悬停光效 */
.card-shine {
    position: relative;
    overflow: hidden;
}

.card-shine::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 60%
    );
    transform: rotate(45deg);
    transition: all 0.5s ease;
    opacity: 0;
}

.card-shine:hover::before {
    animation: shine 0.75s ease;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) rotate(45deg);
        opacity: 1;
    }
    100% {
        transform: translateX(100%) rotate(45deg);
        opacity: 1;
    }
}

/* -----------------------------------
   6. 页面过渡动画
   ----------------------------------- */

/* 页面淡入 */
.page-enter {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

/* 元素滚动进入 */
.scroll-enter {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-enter.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* 数字计数动画占位 */
.counter-up {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* -----------------------------------
   7. 加载动画
   ----------------------------------- */

/* 点式加载器 */
.loader-dots {
    display: inline-flex;
    gap: 6px;
}

.loader-dots span {
    width: 10px;
    height: 10px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: loaderDot 1.4s ease-in-out infinite both;
}

.loader-dots span:nth-child(1) { animation-delay: 0ms; }
.loader-dots span:nth-child(2) { animation-delay: 160ms; }
.loader-dots span:nth-child(3) { animation-delay: 320ms; }

@keyframes loaderDot {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 圆环加载器 */
.loader-ring {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 脉冲加载器 */
.loader-pulse {
    width: 40px;
    height: 40px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: pulse 1s ease infinite;
}

/* 骨架屏动画 */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-gray-200) 25%,
        var(--color-gray-100) 50%,
        var(--color-gray-200) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

/* -----------------------------------
   8. 文字动画
   ----------------------------------- */

/* 文字逐字淡入 */
.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    animation: textReveal 0.6s ease forwards;
}

@keyframes textReveal {
    to {
        transform: translateY(0);
    }
}

/* 打字机效果 */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--color-primary);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink 0.75s step-end infinite;
}

/* 文字渐变动画 */
.text-gradient-animate {
    background: linear-gradient(
        270deg,
        var(--color-primary),
        var(--color-secondary),
        var(--color-primary)
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

/* -----------------------------------
   9. 特效动画
   ----------------------------------- */

/* 粒子效果容器 */
.particles-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--color-primary);
    border-radius: 50%;
    opacity: 0.5;
    animation: particleFloat 10s linear infinite;
}

/* 光晕效果 */
.glow {
    box-shadow: 0 0 20px rgba(0, 102, 255, 0.5);
}

.glow-pulse {
    animation: glowPulse 2s ease infinite;
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 102, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 102, 255, 0.6);
    }
}

/* 视差滚动效果基础 */
.parallax-layer {
    will-change: transform;
}

/* -----------------------------------
   10. 科技感特效动画
   ----------------------------------- */

/* 神经网络连接线动画 */
@keyframes neuralPulse {
    0% {
        stroke-dashoffset: 1000;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 0;
    }
}

.neural-line {
    stroke-dasharray: 1000;
    animation: neuralPulse 3s linear infinite;
}

/* 数据流动画 - 科技感 */
@keyframes dataStream {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100%);
        opacity: 0;
    }
}

.data-stream {
    animation: dataStream 2s linear infinite;
}

/* 智能脉冲效果 */
@keyframes aiPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 0 0 0 rgba(0, 102, 255, 0.4),
            0 0 0 0 rgba(139, 92, 246, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow:
            0 0 20px 10px rgba(0, 102, 255, 0),
            0 0 40px 20px rgba(139, 92, 246, 0);
    }
}

.ai-pulse {
    animation: aiPulse 3s ease-in-out infinite;
}

/* 科技扫描线 */
@keyframes scanLine {
    0% {
        top: 0%;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

.scan-line {
    position: relative;
    overflow: hidden;
}

.scan-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent,
        var(--color-primary),
        var(--color-secondary),
        transparent
    );
    box-shadow: 0 0 20px var(--color-primary);
    animation: scanLine 4s linear infinite;
}

/* 全息扫描效果 */
@keyframes hologramScan {
    0%, 100% {
        opacity: 0.8;
        transform: translateY(0) scaleY(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-2px) scaleY(1.01);
    }
}

.hologram {
    position: relative;
    animation: hologramScan 2s ease-in-out infinite;
}

.hologram::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 102, 255, 0.1) 50%,
        transparent 100%
    );
    animation: shimmer 3s linear infinite;
}

/* 代码雨效果 */
@keyframes codeRain {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(calc(100vh + 100%));
        opacity: 0;
    }
}

.code-rain {
    position: absolute;
    font-family: var(--font-family-mono);
    font-size: 14px;
    color: var(--color-primary);
    text-shadow: 0 0 10px var(--color-primary);
    white-space: nowrap;
    animation: codeRain 8s linear infinite;
    pointer-events: none;
}

/* 电路线动画 */
@keyframes circuitFlow {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.circuit-path {
    stroke-dasharray: 5, 5;
    animation: circuitFlow 1s linear infinite;
}

/* 智能节点呼吸 */
@keyframes nodeBreath {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(0, 102, 255, 0.3);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 40px rgba(0, 102, 255, 0.6);
    }
}

.node-breath {
    animation: nodeBreath 2s ease-in-out infinite;
}

/* 信号波纹 */
@keyframes signalRipple {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.signal-ripple {
    position: relative;
}

.signal-ripple::before,
.signal-ripple::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid var(--color-primary);
    border-radius: 50%;
    animation: signalRipple 2s linear infinite;
}

.signal-ripple::after {
    animation-delay: 1s;
}

/* 矩阵雨背景 */
@keyframes matrixRain {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

.matrix-column {
    position: absolute;
    top: 0;
    font-family: var(--font-family-mono);
    font-size: 16px;
    line-height: 1.2;
    color: var(--color-primary);
    text-shadow: 0 0 8px var(--color-primary);
    animation: matrixRain 10s linear infinite;
    pointer-events: none;
}

/* 玻璃态动画 */
@keyframes glassShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.glass-effect {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-effect::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    background-size: 200% 100%;
    animation: glassShimmer 3s linear infinite;
}

/* 3D 卡片倾斜效果 */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.tilt-card:hover {
    transform: perspective(1000px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
}

/* 鼠标追踪光效 */
.cursor-spotlight {
    position: relative;
    overflow: hidden;
}

.cursor-spotlight::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(
        circle,
        rgba(0, 102, 255, 0.15) 0%,
        transparent 70%
    );
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: translate(-50%, -50%);
}

.cursor-spotlight:hover::after {
    opacity: 1;
}

/* 能量环动画 */
@keyframes energyRing {
    0% {
        transform: rotate(0deg);
        stroke-dashoffset: 0;
    }
    100% {
        transform: rotate(360deg);
        stroke-dashoffset: 283;
    }
}

.energy-ring {
    animation: energyRing 2s linear infinite;
}

/* 芯片闪烁 */
@keyframes chipBlink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chip-blink {
    animation: chipBlink 1s ease-in-out infinite;
}

/* ASCII 波浪效果 */
@keyframes asciiWave {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-5px);
    }
    75% {
        transform: translateY(5px);
    }
}

.ascii-wave {
    display: inline-block;
    animation: asciiWave 2s ease-in-out infinite;
}

/* 发光文字脉冲 */
@keyframes glowTextPulse {
    0%, 100% {
        text-shadow:
            0 0 5px var(--color-primary),
            0 0 10px var(--color-primary),
            0 0 20px var(--color-primary);
    }
    50% {
        text-shadow:
            0 0 10px var(--color-primary),
            0 0 20px var(--color-primary),
            0 0 40px var(--color-primary),
            0 0 80px var(--color-primary);
    }
}

.glow-text-pulse {
    animation: glowTextPulse 2s ease-in-out infinite;
}

/* 数字变化效果 */
@keyframes numberFlip {
    0% {
        transform: rotateX(0deg);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

.number-flip {
    display: inline-block;
    animation: numberFlip 0.5s ease-in-out;
}

/* -----------------------------------
   11. 动画辅助类
   ----------------------------------- */

/* 初始隐藏 */
.animate-hidden {
    opacity: 0;
}

/* 无限循环 */
.animate-infinite {
    animation-iteration-count: infinite;
}

/* 暂停动画 */
.animate-paused {
    animation-play-state: paused;
}

/* 运行动画 */
.animate-running {
    animation-play-state: running;
}

/* 正向播放 */
.animate-normal {
    animation-direction: normal;
}

/* 反向播放 */
.animate-reverse {
    animation-direction: reverse;
}

/* 交替播放 */
.animate-alternate {
    animation-direction: alternate;
}

/* 保持最终状态 */
.animate-fill-forwards {
    animation-fill-mode: forwards;
}

.animate-fill-both {
    animation-fill-mode: both;
}

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

/* 性能优化类 */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}
