/* ============================================================
 * 德森动力 — 动画样式表 (animations.css)
 * 首页动态特效：滚动揭示、粒子背景、产品拆解、参数曲线
 * ============================================================ */

/* ---------- Scroll Reveal 初始状态 ---------- */
.cf-reveal-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.22, 0.61, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.cf-reveal-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.cf-reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s cubic-bezier(0.22, 0.61, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.cf-reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.cf-reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.6s cubic-bezier(0.22, 0.61, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.cf-reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Stagger delay helpers */
.cf-stagger-1 { transition-delay: 0.00s; }
.cf-stagger-2 { transition-delay: 0.12s; }
.cf-stagger-3 { transition-delay: 0.24s; }
.cf-stagger-4 { transition-delay: 0.36s; }
.cf-stagger-5 { transition-delay: 0.48s; }

/* ---------- Hero Canvas 粒子层 ---------- */
.cf-hero__particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ---------- 科技感网格背景 ---------- */
.cf-tech-bg {
    position: relative;
    background-color: #f8fafd;
    background-image:
        linear-gradient(rgba(51, 93, 167, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(51, 93, 167, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    overflow: hidden;
}

/* 扫描线效果 */
.cf-tech-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(234, 169, 49, 0.4), transparent);
    animation: scan-line 4s linear infinite;
    pointer-events: none;
    z-index: 2;
}

@keyframes scan-line {
    0%   { top: -2px; opacity: 0; }
    5%   { opacity: 1; }
    10%  { opacity: 0.5; }
    95%  { opacity: 0.5; }
    100% { top: 100%; opacity: 0; }
}

/* ---------- 产品拆解舞台 ---------- */
.cf-explode {
    background: #0a0e17;
    color: #fff;
    padding: 60px 0 0;
    overflow: hidden;
}

.cf-explode .section__title h2 {
    color: #fff;
}
.cf-explode .section__title p {
    color: rgba(255, 255, 255, 0.6);
}

/* Tab 切换器 */
.cf-explode__tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 0 auto;
    max-width: 700px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 4px;
}

.cf-explode__tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-family: var(--cf-font-cn);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-weight: 500;
}

.cf-explode__tab:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.cf-explode__tab.active {
    background: var(--cf-primary);
    color: #fff;
    box-shadow: 0 2px 12px rgba(51, 93, 167, 0.4);
}

/* 拆解舞台 */
.cf-explode__stage {
    position: relative;
    width: 100%;
    height: 600px;
    overflow: hidden;
    margin: 40px 0 0;
    background: #0d1117;
}

.cf-explode__layers {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cf-explode__group {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
}

.cf-explode__group.active {
    display: flex;
}

/* 拆解图层 */
.cf-explode__layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    will-change: transform, opacity;
    pointer-events: none;
}

.cf-explode__layer svg {
    display: block;
    width: auto;
    height: auto;
    max-width: 600px;
    max-height: 500px;
}

.cf-explode__layer img {
    display: block;
    max-width: 550px;
    max-height: 500px;
    object-fit: contain;
}

/* 各层初始状态 */
.cf-explode__layer--casing-left,
.cf-explode__layer--casing-right,
.cf-explode__layer--stator,
.cf-explode__layer--rotor,
.cf-explode__layer--bearings,
.cf-explode__layer--annotations {
    opacity: 0;
}

/* 滚动提示 */
.cf-explode__scroll-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    animation: hint-bounce 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes hint-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(-6px); }
}

/* ---------- 参数曲线区 ---------- */
.cf-explode__curves {
    background: #0d111a;
    padding: 40px 20px 60px;
    text-align: center;
}

.cf-explode__curves h3 {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin-bottom: 24px;
    font-weight: 500;
}

#cfCurveCanvas {
    width: 100%;
    max-width: 860px;
    height: auto;
    aspect-ratio: 2/1;
    margin: 0 auto 16px;
    display: block;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.cf-explode__curve-legend {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.cf-explode__legend-item {
    font-size: 13px;
    font-family: var(--cf-font-cn);
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 6px;
}

.cf-explode__legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ---------- 标注线系统 ---------- */
.cf-annotation__line {
    stroke: var(--cf-accent);
    stroke-width: 1.2;
    stroke-dasharray: 5 3;
    opacity: 0.8;
}

.cf-annotation__line--dashed {
    stroke-dasharray: 3 4;
}

.cf-annotation__dot {
    fill: var(--cf-accent);
    filter: drop-shadow(0 0 4px rgba(234, 169, 49, 0.5));
}

.cf-annotation__text {
    font-family: var(--cf-font-cn);
    font-size: 12px;
    fill: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

.cf-annotation__sub {
    font-family: var(--cf-font-cn);
    font-size: 10px;
    fill: rgba(255, 255, 255, 0.5);
}

/* ---------- 统计数字动画 ---------- */
.cf-stat__count {
    font-variant-numeric: tabular-nums;
    display: inline-block;
}

@keyframes stat-glow {
    0%, 100% { text-shadow: 0 0 20px rgba(234, 169, 49, 0.15); }
    50%      { text-shadow: 0 0 40px rgba(234, 169, 49, 0.35); }
}

.cf-stat__number.counted {
    animation: stat-glow 3s ease-in-out infinite;
}

/* ---------- CTA 脉冲光晕 ---------- */
@keyframes pulse-glow {
    0%   { box-shadow: 0 0 0 0 rgba(234, 169, 49, 0.5); }
    70%  { box-shadow: 0 0 0 18px rgba(234, 169, 49, 0); }
    100% { box-shadow: 0 0 0 0 rgba(234, 169, 49, 0); }
}

.btn--accent.pulse {
    animation: pulse-glow 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ---------- 视差图片 ---------- */
.cf-parallax-image {
    transition: transform 0.1s linear;
}

/* ---------- 高亮边框 ---------- */
.cf-glow-border {
    transition: box-shadow 0.4s ease;
}
.cf-glow-border:hover {
    box-shadow: 0 0 0 2px rgba(51, 93, 167, 0.3), var(--cf-shadow-lg);
}

/* ---------- 响应式 ---------- */
@media (max-width: 992px) {
    .cf-explode__stage {
        height: 450px;
    }
    .cf-explode__tab {
        font-size: 12px;
        padding: 10px 14px;
    }
    .cf-explode__layer svg {
        max-width: 400px;
        max-height: 380px;
    }
}

@media (max-width: 768px) {
    .cf-explode {
        padding: 40px 0 0;
    }
    .cf-explode__stage {
        height: 340px;
    }
    .cf-explode__tabs {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .cf-explode__tab {
        font-size: 12px;
        padding: 8px 10px;
        flex: unset;
    }
    .cf-explode__layer svg {
        max-width: 280px;
        max-height: 260px;
    }
    .cf-explode__scroll-hint {
        display: none;
    }
    .cf-hero__particles {
        display: none;
    }
    .cf-parallax-image {
        transform: none !important;
    }
    #cfCurveCanvas {
        max-width: 100%;
    }
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .cf-reveal-up,
    .cf-reveal-left,
    .cf-reveal-right {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .cf-explode__layer {
        transition: none !important;
    }
    .cf-explode__scroll-hint,
    .cf-hero__particles,
    .cf-tech-bg::after {
        animation: none;
        display: none;
    }
    .cf-stat__number.counted {
        animation: none;
    }
    .btn--accent.pulse {
        animation: none;
    }
}
