/* =========================================================
   motion.css —— 全站动效增强层（2026-11-14 加）
   只叠加，不覆盖 base / components / 各页原有样式。
   所有动效都尊重「减少动态效果」系统偏好。
   ========================================================= */

@media (prefers-reduced-motion: no-preference) {
  /* ---------- 1. 跟随鼠标的柔光 ---------- */
  .cursor-glow {
    position: fixed;
    z-index: -1;
    top: 0;
    left: 0;
    width: 560px;
    height: 560px;
    border-radius: 50%;
    margin: -280px 0 0 -280px;
    background: radial-gradient(
      circle,
      rgba(255, 178, 208, 0.3) 0%,
      rgba(146, 228, 221, 0.16) 42%,
      transparent 70%
    );
    filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
    will-change: transform;
  }

  .cursor-glow.is-on {
    opacity: 1;
  }

  /* ---------- 2. 背景光斑的视差 ---------- */
  .ambient {
    transform: translate3d(0, calc(var(--fx-par, 0px) * -1), 0);
    transition: transform 0.2s linear;
    will-change: transform;
  }

  /* ---------- 3. 导航滚动时的收缩感 ---------- */
  .inner-nav {
    transition:
      box-shadow 0.45s var(--ease-soft),
      background 0.45s ease;
  }

  .inner-nav.is-scrolled {
    background: rgba(255, 251, 253, 0.9);
    box-shadow: 0 12px 34px rgba(84, 132, 131, 0.1);
  }

  .inner-nav.is-scrolled .brand-mark {
    transform: scale(0.94);
  }

  .brand-mark {
    transition: transform 0.45s var(--ease-soft);
  }

  /* ---------- 4. 悬停抬升（由 motion.js 自动挂类） ---------- */
  .fx-lift {
    transition:
      transform 0.5s var(--ease-soft),
      box-shadow 0.5s ease,
      border-color 0.5s ease;
  }

  /* ---------- 5. 卡片跟随鼠标的微倾斜 + 高光 ---------- */
  .fx-tilt {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s var(--ease-soft);
  }

  .fx-tilt.is-tilting {
    transition: transform 0.12s linear;
  }

  .fx-tilt::after {
    position: absolute;
    z-index: 1;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
      240px circle at var(--fx-mx, 50%) var(--fx-my, 50%),
      rgba(255, 255, 255, 0.55),
      transparent 62%
    );
    content: "";
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
  }

  .fx-tilt.is-tilting::after {
    opacity: 1;
  }

  /* ---------- 6. 按钮涟漪 ---------- */
  .fx-ripple {
    position: relative;
    overflow: hidden;
  }

  .fx-ripple__wave {
    position: absolute;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.22;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
    animation: fx-ripple 0.62s ease-out forwards;
  }

  /* ---------- 7. 渐变色文字缓缓流动 ---------- */
  .gradient-text {
    background-size: 220% 100%;
    animation: fx-sheen 11s ease-in-out infinite;
  }

  /* ---------- 8. 心跳 ---------- */
  .site-footer__heart {
    display: inline-block;
    animation: heart-beat 2.6s ease-in-out infinite;
  }

  /* ---------- 9. 正在加载的点点 ---------- */
  .fx-dots::after {
    content: "";
    animation: fx-dots 1.4s steps(4, end) infinite;
  }

  @keyframes fx-ripple {
    to {
      opacity: 0;
      transform: translate(-50%, -50%) scale(1);
    }
  }

  @keyframes fx-sheen {
    0%,
    100% {
      background-position: 0% 50%;
    }
    50% {
      background-position: 100% 50%;
    }
  }

  @keyframes fx-dots {
    0% {
      content: "";
    }
    25% {
      content: "·";
    }
    50% {
      content: "··";
    }
    75% {
      content: "···";
    }
  }
}

/* ---------- 只在真鼠标上做悬停动效，别让手机上粘住 ---------- */
@media (hover: hover) and (pointer: fine) {
  .fx-lift:hover {
    transform: translateY(-4px);
  }

  .fx-lift:active {
    transform: translateY(-1px);
  }
}

/* 减少动态效果时，把这些层直接关掉 */
@media (prefers-reduced-motion: reduce) {
  .cursor-glow,
  .fx-tilt::after {
    display: none;
  }

  .ambient,
  .inner-nav,
  .fx-lift,
  .fx-tilt {
    transform: none !important;
    transition: none !important;
  }
}

/* ---------------- 静止页：给 body 加 .page-static（11-14 老大要的） ----------------
   去掉鼠标光圈、花瓣、光斑漂移、视差、文字渐变流动、心跳，页面就定住不动。 */
.page-static .cursor-glow,
.page-static .petal,
.page-static .fx-tilt::after {
  display: none !important;
}

.page-static .ambient {
  transform: none !important;
}

.page-static .ambient__orb,
.page-static .gradient-text,
.page-static .site-footer__heart {
  animation: none !important;
}

/* ---------------- 首页入场：文字与图片（11-14 老大要的） ----------------
   首屏淡入上浮 + 轻微模糊消散，图片放大落定；下方内容随滚动分组入场。
   只在用户没要求「减少动态效果」时生效。 */
@media (prefers-reduced-motion: no-preference) {
  /* ---- 首屏大图：从略放大、略虚，落定 ---- */
  .home-page .hero__media img {
    animation:
      hero-zoom 2.2s var(--ease-soft) both,
      home-photo-settle 1.6s ease-out both;
  }

  .home-page .hero__shade,
  .home-page .hero__grain {
    animation: home-fade 1.4s ease-out 0.1s both;
  }

  /* ---- 首屏文字：逐行上浮 + 模糊散开 ---- */
  .home-page .hero__content > * {
    animation: home-text-in 1.15s var(--ease-soft) both;
  }

  .home-page .hero__content > *:nth-child(1) {
    animation-delay: 0.28s;
  }

  .home-page .hero__content > *:nth-child(2) {
    animation-delay: 0.42s;
  }

  .home-page .hero__content > *:nth-child(3) {
    animation-delay: 0.58s;
  }

  .home-page .hero__content > *:nth-child(4) {
    animation-delay: 0.74s;
  }

  .home-page .home-header {
    animation: home-head-drop 1s var(--ease-soft) 0.12s both;
  }

  .home-page .side-nav-wrap {
    animation: home-fade-right 1.1s var(--ease-soft) 0.9s both;
  }

  .home-page .hero__footer {
    animation: home-text-in 1.1s var(--ease-soft) 1.05s both;
  }

  .home-page .hero__floating-heart {
    animation:
      home-fade 1.2s ease-out 1.2s both,
      float-y 6s ease-in-out 2.4s infinite;
  }

  /* ---- 故事区：每行文字、每张照片分开进场 ---- */
  .home-page .story-copy.reveal.is-visible > * {
    animation: home-text-in 0.95s var(--ease-soft) backwards;
  }

  .home-page .story-copy.reveal.is-visible > *:nth-child(2) {
    animation-delay: 0.1s;
  }

  .home-page .story-copy.reveal.is-visible > *:nth-child(3) {
    animation-delay: 0.2s;
  }

  .home-page .story-copy.reveal.is-visible > *:nth-child(4) {
    animation-delay: 0.3s;
  }

  .home-page .story-copy.reveal.is-visible > *:nth-child(5) {
    animation-delay: 0.4s;
  }

  .home-page .reveal.is-visible .story-photo--main {
    animation: home-photo-settle 1s var(--ease-soft) 0.12s backwards;
  }

  .home-page .reveal.is-visible .story-photo--small {
    animation: home-photo-settle 1s var(--ease-soft) 0.3s backwards;
  }

  .home-page .reveal.is-visible .story-stamp {
    animation: home-fade 1s ease-out 0.5s both;
  }

  /* ---- 统计条：一格一格抬起来 ---- */
  .home-page .reveal.is-visible .stat {
    animation: home-text-in 0.8s var(--ease-soft) backwards;
  }

  .home-page .reveal.is-visible .stat:nth-child(2) {
    animation-delay: 0.1s;
  }

  .home-page .reveal.is-visible .stat:nth-child(3) {
    animation-delay: 0.2s;
  }

  .home-page .reveal.is-visible .stat:nth-child(4) {
    animation-delay: 0.3s;
  }

  /* ---- 章节卡片：图片先放大再落定，文字跟上 ---- */
  .home-page .reveal.is-visible .chapter-card__img {
    animation: home-photo-settle 1.15s var(--ease-soft) backwards;
  }

  .home-page .chapter-card:nth-child(2) .chapter-card__img {
    animation-delay: 0.12s;
  }

  .home-page .chapter-card:nth-child(3) .chapter-card__img {
    animation-delay: 0.24s;
  }

  .home-page .reveal.is-visible .chapter-card__body > * {
    animation: home-text-in 0.85s var(--ease-soft) 0.18s backwards;
  }

  .home-page .reveal.is-visible .chapter-card__body > *:nth-child(2) {
    animation-delay: 0.28s;
  }

  .home-page .reveal.is-visible .chapter-card__body > *:nth-child(3) {
    animation-delay: 0.36s;
  }

  /* ---- 结尾引言 / 去年今天 ---- */
  .home-page .home-quote .reveal.is-visible,
  .home-page .lastyear .reveal.is-visible {
    animation: home-text-in 1s var(--ease-soft) backwards;
  }

  .home-page .reveal.is-visible .lastyear-media img {
    animation: home-photo-settle 1.2s var(--ease-soft) 0.1s backwards;
  }
}

@keyframes home-text-in {
  from {
    opacity: 0;
    filter: blur(6px);
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes home-head-drop {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes home-fade-right {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes home-photo-settle {
  from {
    opacity: 0;
    transform: scale(1.09);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
