/* =============================================================
 * xw-mobile-motion.css —— 手机端动画增强（仅 ≤768px 生效）
 * 设计原则：
 *   1) 零侵入：全部样式只在 body.xw-motion-on 下生效；该 class 由 JS 在
 *      「手机端 + 未开启减少动态」时添加。JS 不跑 = 完全没有动画 = 内容照常显示。
 *   2) 可降级：系统开启「减少动态效果」时 JS 不加 class，样式自动全部失效。
 *   3) 高性能：只动 opacity / transform，进场结束即清 will-change。
 * 更新标识：v=20261130a
 * ============================================================= */

@media (max-width: 768px) {

  /* ---------- 1. 滚动错落进场：帖子卡片 / 列表项 / 卡片 ---------- */
  body.xw-motion-on .xwm-rise {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
    transition: opacity .55s cubic-bezier(.22,.61,.36,1),
                transform .55s cubic-bezier(.22,.61,.36,1);
  }
  body.xw-motion-on .xwm-rise.xwm-in {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
  /* 侧栏列表项：从右侧轻微滑入，和帖子上下进场区分开 */
  body.xw-motion-on .xwm-rise-x.xwm-rise {
    transform: translate3d(16px, 0, 0);
  }
  body.xw-motion-on .xwm-rise-x.xwm-rise.xwm-in {
    transform: translate3d(0, 0, 0);
  }

  /* ---------- 2. 顶部导航栏：页面加载时下滑淡入 ---------- */
  body.xw-motion-on .navbar-fixed-top {
    animation: xwmNavDown .55s cubic-bezier(.22,.61,.36,1) both;
  }
  @keyframes xwmNavDown {
    from { opacity: 0; transform: translate3d(0, -100%, 0); }
    to   { opacity: 1; transform: translate3d(0, 0, 0); }
  }

  /* ---------- 3. 主内容区整体淡入（首屏柔化） ---------- */
  body.xw-motion-on .xwm-page-in {
    animation: xwmPageIn .5s ease-out both;
  }
  @keyframes xwmPageIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  /* ---------- 4. 按压反馈：按钮 / 可点区域 ---------- */
  /* 触屏上 :active 需文档级 touchstart 监听，JS 已绑定 */
  body.xw-motion-on .btn:active,
  body.xw-motion-on .pointer:active,
  body.xw-motion-on .xwm-press:active {
    transform: scale(.965);
    filter: brightness(.96);
    transition: transform .09s ease-out, filter .09s ease-out;
  }
  body.xw-motion-on .btn,
  body.xw-motion-on .pointer,
  body.xw-motion-on .xwm-press {
    transition: transform .18s cubic-bezier(.34,1.56,.64,1), filter .18s ease-out;
  }

  /* 帖子卡片按下：轻微下沉，抬手回弹（比按钮更柔和） */
  body.xw-motion-on .post-container:active {
    transform: scale(.992);
    transition: transform .1s ease-out;
  }

  /* ---------- 5. 头像轻触放大 ---------- */
  body.xw-motion-on .timelineuserpropic img:active,
  body.xw-motion-on .post-user-avatar img:active,
  body.xw-motion-on [data-toggle="dropdown"] > img:active {
    transform: scale(1.08);
    transition: transform .14s cubic-bezier(.34,1.56,.64,1);
  }

  /* ---------- 6. 点赞 / 收藏 / 表情 弹跳（JS 点击时加 .xwm-pop） ---------- */
  body.xw-motion-on .xwm-pop {
    animation: xwmPop .4s cubic-bezier(.34,1.56,.64,1);
  }
  @keyframes xwmPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.32) rotate(-6deg); }
    70%  { transform: scale(.92) rotate(3deg); }
    100% { transform: scale(1); }
  }

  /* ---------- 7. 加载更多：脉冲呼吸 + 图标旋转 ---------- */
  body.xw-motion-on .load-more,
  body.xw-motion-on #load-more-posts {
    animation: xwmBreath 2.2s ease-in-out infinite;
  }
  @keyframes xwmBreath {
    0%, 100% { opacity: .72; }
    50%      { opacity: 1; }
  }
  body.xw-motion-on .load-more.loading .progress-icon,
  body.xw-motion-on #load-more-posts.loading .progress-icon {
    animation: xwmSpin 1s linear infinite;
  }
  @keyframes xwmSpin { to { transform: rotate(360deg); } }

  /* ---------- 8. Tab 切换：内容淡入 ---------- */
  body.xw-motion-on .tab-content .tab-pane.active {
    animation: xwmTabIn .3s ease-out;
  }
  @keyframes xwmTabIn {
    from { opacity: 0; transform: translate3d(0, 8px, 0); }
    to   { opacity: 1; transform: translate3d(0, 0, 0); }
  }

  /* ---------- 9. 通知红点：轻微跳动 ---------- */
  body.xw-motion-on .nav-notify-badge,
  body.xw-motion-on .badge,
  body.xw-motion-on .label-notify {
    animation: xwmDot 2.6s ease-in-out infinite;
  }
  @keyframes xwmDot {
    0%, 86%, 100% { transform: scale(1); }
    92%           { transform: scale(1.18); }
  }

  /* ---------- 10. 顶部 Message/好友等图标点按旋转反馈 ---------- */
  body.xw-motion-on .navbar-header .zmdi:active,
  body.xw-motion-on .navbar-nav > li > a:active .zmdi {
    animation: xwmIconTap .35s ease-out;
  }
  @keyframes xwmIconTap {
    0% { transform: rotate(0) scale(1); }
    50% { transform: rotate(-12deg) scale(1.15); }
    100% { transform: rotate(0) scale(1); }
  }

  /* ---------- 兜底：系统开启减少动态时，JS 已不加 class，此处双保险 ---------- */
  @media (prefers-reduced-motion: reduce) {
    body.xw-motion-on .xwm-rise,
    body.xw-motion-on .navbar-fixed-top,
    body.xw-motion-on .xwm-page-in,
    body.xw-motion-on .load-more,
    body.xw-motion-on #load-more-posts {
      animation: none !important;
      transition: none !important;
      opacity: 1 !important;
      transform: none !important;
    }
  }
}
