/* ============================================
   动效系统 — 关键帧 / 入场 / 加载
   一会去哪儿 · Motion
   ============================================ */

/* ── 浮动呼吸 ── 天气图标等装饰元素 ── */
@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(2deg);
  }
}

@keyframes breathe {
  0%, 100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

/* ── 光晕呼吸 ── 天气卡片背景 ── */
@keyframes glowPulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.05);
  }
}

/* ── 罗盘旋转 ── AI 生成动画降级方案 ── */
@keyframes compassSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ── 粒子脉冲 ── */
@keyframes particlePulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.4);
    opacity: 1;
  }
}

/* ── 上浮淡入 ── 卡片入场 ── */
@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── 缩放淡入 ── 弹窗/抽屉 ── */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── 从底部滑入 ── 详情抽屉 ── */
@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

/* ── 遮罩淡入 ── */
@keyframes overlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ── 从左滑入 ── 详情返回等 ── */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── 宽度展开 ── 进度条 ── */
@keyframes widthGrow {
  from {
    width: 0;
  }
}

/* ── 打勾弹出 ── 步骤清单 ── */
@keyframes checkPop {
  0% {
    transform: scale(0) rotate(-45deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.2) rotate(0deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* ── 文字闪烁 ── 加载状态 ── */
@keyframes textShimmer {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* ── 心形弹跳 ── 收藏 ── */
@keyframes heartBeat {
  0%, 100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.3);
  }
  50% {
    transform: scale(0.95);
  }
  75% {
    transform: scale(1.15);
  }
}

/* ── 装饰线条绘制 ── */
@keyframes drawLine {
  from {
    stroke-dashoffset: 100;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* ── 入场工具类 ── */
.rise-in {
  animation: riseIn var(--duration-slow) var(--ease-out) both;
}

.scale-in {
  animation: scaleIn var(--duration-normal) var(--ease-spring) both;
}

.slide-up {
  animation: slideUp var(--duration-slower) var(--ease-out) both;
}

.overlay-in {
  animation: overlayIn var(--duration-normal) var(--ease-smooth) both;
}

/* ── 错峰入场（JS 设置 --i 变量） ── */
.stagger {
  animation: riseIn var(--duration-slow) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 120ms);
}

/* ── 持续动画工具类 ── */
.float {
  animation: float 4s var(--ease-in-out) infinite;
}

.breathe {
  animation: breathe 3s var(--ease-in-out) infinite;
}

.compass-spin {
  animation: compassSpin 2.5s var(--ease-smooth) infinite;
}

.shimmer {
  animation: textShimmer 1.5s var(--ease-in-out) infinite;
}

/* ── 按钮波纹 ── */
@keyframes ripple {
  to { transform: scale(2.5); opacity: 0; }
}

/* ── 渐变流光 ── 加载条 */
@keyframes shimmerFlow {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── 数字滚动 ── 匹配度 */
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── 卡片悬浮微动 ── */
@keyframes cardHover {
  to { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(42,37,32,0.12); }
}

/* ── 渐入展开 ── 提示条 */
@keyframes expandIn {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 60px; }
}

/* ── reduced-motion 降级 ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .float,
  .breathe,
  .compass-spin,
  .shimmer {
    animation: none !important;
  }

  .slide-up {
    animation: overlayIn var(--duration-normal) var(--ease-smooth) both;
  }
}
