/* =============================================================
 * animations.css
 * 动效: 进入动画、悬停、滚动揭示、计数器、加载条等
 * 所有动画用 prefers-reduced-motion 兼容
 * ============================================================= */

/* ---- 通用 keyframes ---- */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 97, 55, 0.5);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(255, 97, 55, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 97, 55, 0);
  }
}

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

@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(39, 115, 247, 0); }
  50% { box-shadow: 0 0 0 8px rgba(39, 115, 247, 0.15); }
}

/* ---- Hero 进入动画 (页面加载时) ---- */
.hero__title,
.hero__desc,
.hero__cta,
.hero__sub {
  opacity: 0;
  animation: fade-in-up 0.8s var(--ease-out) forwards;
}

.hero__title    { animation-delay: 0.1s; }
.hero__desc     { animation-delay: 0.25s; }
.hero__cta      { animation-delay: 0.4s; }
.hero__sub      { animation-delay: 0.55s; }

/* ---- Section 滚动揭示 ---- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  will-change: opacity, transform;
}

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

.reveal--left {
  transform: translateX(-30px);
}
.reveal--left.is-visible {
  transform: translateX(0);
}

.reveal--right {
  transform: translateX(30px);
}
.reveal--right.is-visible {
  transform: translateX(0);
}

/* ---- 下载卡: 进入序列 ---- */
.download-card {
  opacity: 0;
  animation: fade-in-up 0.6s var(--ease-out) forwards;
}

.download-card:nth-child(1) { animation-delay: 0.1s; }
.download-card:nth-child(2) { animation-delay: 0.25s; }
.download-card:nth-child(3) { animation-delay: 0.4s; }

/* ---- 浮动效果 (装饰) ---- */
.feature__img {
  transition: transform var(--duration-slow) var(--ease-out);
}

.feature__img:hover {
  transform: scale(1.02);
}

/* ---- 按钮按下反馈 ---- */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.2);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
  pointer-events: none;
}

.btn:active::after {
  opacity: 1;
  transition: opacity 0s;
}

/* ---- 减少动画: 系统/用户偏好 ---- */
@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 {
    opacity: 1;
    transform: none;
  }
}
