/* ============================================================
 * animations.css —— 动画与滚动淡入
 * ============================================================ */

/* ============ 关键帧 ============ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

@keyframes shimmer {
  0%   { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Hero 入场编舞：淡入 + 上移 */
@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 数据弹性入场：用于 Stats */
@keyframes popIn {
  0%   { opacity: 0; transform: translateY(40px) scale(0.85); }
  60%  { opacity: 1; transform: translateY(-4px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============ 滚动淡入工具类 ============ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
  will-change: opacity, transform;
}

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

/* 错开延迟 (stagger) —— 用于卡片网格 */
.reveal[data-delay="100"] { transition-delay: 100ms; }
.reveal[data-delay="200"] { transition-delay: 200ms; }
.reveal[data-delay="300"] { transition-delay: 300ms; }
.reveal[data-delay="400"] { transition-delay: 400ms; }
.reveal[data-delay="500"] { transition-delay: 500ms; }

/* Hero 装饰浮动 */
.hero-decor-shape {
  animation: float 6s ease-in-out infinite;
}

/* ============ Hero 入场编舞 (stagger) ============ */
.hero-content .hero-badge,
.hero-content .hero-title,
.hero-content .hero-subtitle,
.hero-content .hero-cta,
.hero-content .hero-meta,
.hero-visual {
  opacity: 0;
  animation: heroFadeUp 800ms var(--ease-out) forwards;
}
.hero-content .hero-badge    { animation-delay: 100ms; }
.hero-content .hero-title    { animation-delay: 200ms; }
.hero-content .hero-subtitle { animation-delay: 320ms; }
.hero-content .hero-cta      { animation-delay: 440ms; }
.hero-content .hero-meta     { animation-delay: 560ms; }
.hero-visual {
  animation-duration: 1000ms;
  animation-delay: 300ms;
}

/* ============ Stats 弹性 pop-in ============ */
.stats .stat.reveal {
  opacity: 0;
  transform: translateY(40px) scale(0.85);
  transition: none; /* 用 keyframe 代替 transition */
}
.stats .stat.reveal.is-visible {
  animation: popIn 800ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.stats .stat.reveal.is-visible[data-delay="100"] { animation-delay: 80ms; }
.stats .stat.reveal.is-visible[data-delay="200"] { animation-delay: 160ms; }
.stats .stat.reveal.is-visible[data-delay="300"] { animation-delay: 240ms; }

/* ============ 用户偏好：减少动画 ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal,
  .hero-content .hero-badge,
  .hero-content .hero-title,
  .hero-content .hero-subtitle,
  .hero-content .hero-cta,
  .hero-content .hero-meta,
  .hero-visual,
  .stats .stat.reveal {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}
