/* Section 4 特定样式 */

/* Section 4 标题样式 */
.section4-title {
    position: absolute;
    top: 160px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3.5rem;
    color: var(--primary-dark);
    text-align: center;
    margin: 0;
    padding: 0;
    z-index: 10;
    width: 100%;
}

.section4-title .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 0.3em;
}

/* Section 4 进入时的动画 */
.section-team.active .section4-title .word {
    opacity: 1;
    transform: translateY(0);
}

/* 为每个word设置延迟 */
.section-team.active .section4-title .word:nth-child(1) {
    transition-delay: 0.1s;
}

.section-team.active .section4-title .word:nth-child(2) {
    transition-delay: 0.3s;
}

.section-team.active .section4-title .word:nth-child(3) {
    transition-delay: 0.5s;
}

.section-team.active .section4-title .word:nth-child(4) {
    transition-delay: 0.7s;
}

.section-team.active .section4-title .word:nth-child(5) {
    transition-delay: 0.9s;
}

/* Section 4 离开时的动画 - 移除标题消失效果,保持可见 */
.section-team.leaving .section4-title .word {
    /* 不改变opacity和transform,保持原样 */
}

/* 调整网格布局以适应标题 */
.section-team .image-stack-grid {
    margin-top: 180px;
    margin-bottom: 80px;
}

/* 图标容器初始状态 */
.section-team .image-stack-container {
    opacity: 0;
    /* 性能优化: 使用硬件加速 translateZ(0) */
    transform: translateY(50px) scale(0.9) translateZ(0);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* 在非active状态下,隐藏图标内部的所有图片以减少渲染负担 */
.section-team:not(.active) .stacked-image {
    visibility: hidden;
}

/* active状态下才显示图片 */
.section-team.active .stacked-image {
    visibility: visible;
}

/* Section 4 进入时图标动画 */
.section-team.active .image-stack-container {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* 动画完成后移除 will-change */
.section-team.active .image-stack-container {
    animation: removeWillChange 0s 2s forwards;
}

@keyframes removeWillChange {
    to {
        will-change: auto;
    }
}

/* 性能优化: 在动画期间禁用图标内部图片的hover动画 */
.section-team:not(.animation-complete) .image-stack-container:hover .image-stack {
    pointer-events: none;
}

.section-team:not(.animation-complete) .stacked-image {
    transition: none !important;
    animation: none !important;
}

/* 为8个图标设置不同的延迟 */
.section-team.active .image-stack-container:nth-child(1) {
    transition-delay: 0.9s;
}

.section-team.active .image-stack-container:nth-child(2) {
    transition-delay: 1.0s;
}

.section-team.active .image-stack-container:nth-child(3) {
    transition-delay: 1.1s;
}

.section-team.active .image-stack-container:nth-child(4) {
    transition-delay: 1.2s;
}

.section-team.active .image-stack-container:nth-child(5) {
    transition-delay: 1.3s;
}

.section-team.active .image-stack-container:nth-child(6) {
    transition-delay: 1.4s;
}

.section-team.active .image-stack-container:nth-child(7) {
    transition-delay: 1.5s;
}

.section-team.active .image-stack-container:nth-child(8) {
    transition-delay: 1.6s;
}



/* 跳过动画的工具类 */
.section-team.skip-animation,
.section-team.skip-animation * {
    transition: none !important;
}

/* 响应式调整 */
@media (max-width: 1400px) {
    .section4-title {
        font-size: 3rem;
        top: 100px;
    }

    .section-team .image-stack-grid {
        margin-top: 150px;
        margin-bottom: 70px;
    }
}

@media (max-width: 1024px) {
    .section4-title {
        font-size: 2.5rem;
        top: 80px;
    }

    .section-team .image-stack-grid {
        margin-top: 130px;
        margin-bottom: 60px;
    }
}

@media (max-width: 768px) {
    .section4-title {
        font-size: 2rem;
        top: 60px;
    }

    .section-team .image-stack-grid {
        margin-top: 110px;
        margin-bottom: 50px;
    }
}