/**
 * 全站入场动效 - 自然、柔和
 * 尊重用户偏好：prefers-reduced-motion 时关闭动效
 */

/* ========== 关键帧 ========== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== 入场动效基础 ========== */
.animate-entrance {
    opacity: 0;
}

.animate-entrance.animated {
    animation: fadeInUp 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* 仅子项错峰、区块本身不单独动效 */
.animate-entrance.animated.has-stagger {
    animation: none;
    opacity: 1;
}

.animate-entrance.animate-fade.animated {
    animation: fadeIn 0.5s ease-out forwards;
}

.animate-entrance.animate-down.animated {
    animation: fadeInDown 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* 子元素错峰延迟（列表、卡片等） */
.animate-entrance.animated .stagger-1 { animation-delay: 0.06s; }
.animate-entrance.animated .stagger-2 { animation-delay: 0.12s; }
.animate-entrance.animated .stagger-3 { animation-delay: 0.18s; }
.animate-entrance.animated .stagger-4 { animation-delay: 0.24s; }
.animate-entrance.animated .stagger-5 { animation-delay: 0.30s; }
.animate-entrance.animated .stagger-6 { animation-delay: 0.36s; }
.animate-entrance.animated .stagger-7 { animation-delay: 0.42s; }
.animate-entrance.animated .stagger-8 { animation-delay: 0.48s; }
.animate-entrance.animated .stagger-9 { animation-delay: 0.54s; }
.animate-entrance.animated .stagger-10 { animation-delay: 0.60s; }

/* 子元素继承父级动画但带延迟，需自身也有动画 */
.animate-entrance .stagger-item {
    opacity: 0;
    animation: fadeInUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.animate-entrance.animated .stagger-item.stagger-1 { animation-delay: 0.08s; }
.animate-entrance.animated .stagger-item.stagger-2 { animation-delay: 0.16s; }
.animate-entrance.animated .stagger-item.stagger-3 { animation-delay: 0.24s; }
.animate-entrance.animated .stagger-item.stagger-4 { animation-delay: 0.32s; }
.animate-entrance.animated .stagger-item.stagger-5 { animation-delay: 0.40s; }
.animate-entrance.animated .stagger-item.stagger-6 { animation-delay: 0.48s; }
.animate-entrance.animated .stagger-item.stagger-7 { animation-delay: 0.56s; }
.animate-entrance.animated .stagger-item.stagger-8 { animation-delay: 0.64s; }
.animate-entrance.animated .stagger-item.stagger-9 { animation-delay: 0.72s; }
.animate-entrance.animated .stagger-item.stagger-10 { animation-delay: 0.80s; }

/* 首屏内容（如 hero 文案）延迟入场 */
.animate-on-load {
    opacity: 0;
}
body.page-ready .animate-on-load {
    animation: fadeInUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
body.page-ready .animate-on-load.delay-1 { animation-delay: 0.15s; }
body.page-ready .animate-on-load.delay-2 { animation-delay: 0.3s; }
body.page-ready .animate-on-load.delay-3 { animation-delay: 0.45s; }

/* 尊重「减少动态」偏好 */
@media (prefers-reduced-motion: reduce) {
    .animate-entrance,
    .animate-on-load {
        opacity: 1;
        animation: none !important;
    }
    .animate-entrance .stagger-item {
        opacity: 1;
        animation: none !important;
    }
}
