/* ============================================================================
 * motion.css —— 全站过渡动效（P2）
 * ----------------------------------------------------------------------------
 * ## 为什么做（实测，不是推断）
 * ```
 *   __t1.html 探测页，2026-10-29 03:40：
 *     .app-main        transition=all   duration=**1e-05s**
 *     [role="tab"]     transition=transform,opacity  duration=**1e-05s**
 *
 *   ★ 而 CSS 里搜 "1e-05s" ⇒ **0 处**
 *   ★ grep .app-main 的 transition 原始声明 ⇒ **不存在**
 *   ⇒ duration=1e-05s 是浏览器对「未定义」的默认计算值（约等于 0）
 *   ⇒ **这两个元素根本没有过渡，tab 切换是瞬间替换**
 *
 *   实测切换「排行榜」时的子节点数：
 *     切换前 123 → 50ms:75 → 150ms:323 → 250ms:1462 → 400ms:2599
 *     opacity 全程 = 1（不同取值数 = 1）
 *   ⇒ 一次切换瞬间插入 2,500+ 个节点，视觉上是"闪一下"
 * ```
 *
 * ## 做什么（只有三件事）
 * ```
 *   ① 内容区切换时轻量淡入 + 上移 4px（120ms）
 *   ② tab 按钮的颜色/背景/位移过渡（120ms）
 *   ③ 所有卡片/列表项 hover 时的过渡补齐（80ms）
 * ```
 *
 * ## 三条纪律（与 rb-effects.css 同一套）
 * ```
 *   ① ⛔ 不写死颜色 —— 只用 opacity / transform，不碰 color/background-color
 *   ② ⛔ 不改布局 —— 只动 opacity 和 transform（合成层，不触发 reflow）
 *   ③ ⛔ 必须有 prefers-reduced-motion 兜底
 * ```
 *
 * ## 时长选择
 * ```
 *   主 CSS 现有分布：.15s × 26、.12s × 16、.18s × 13
 *   ⇒ 本文件统一用 **120ms**（.12s），与已有节奏一致
 *   ⇒ hover 类用 80ms（更快，避免"拖沓"）
 * ```
 * ========================================================================== */

/* ── ① tab 切换时内容区淡入 ─────────────────────────────────────────────
 * JS 加 .agh-motion-in，动画播完自动移除（animation 比 transition 可靠：
 * 即使元素刚被插入也能触发，不需要两次强制 reflow）
 * ────────────────────────────────────────────────────────────────────── */
@keyframes agh-motion-fade-up {
    from {
        opacity: 0.72;
        transform: translate3d(0, 5px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.agh-motion-in {
    animation: agh-motion-fade-up 120ms cubic-bezier(.22, .61, .36, 1) both;
    will-change: opacity, transform;
}

/* 动画播完后移除 will-change，避免长期占用合成层 */
.agh-motion-in.agh-motion-done {
    animation: none;
    will-change: auto;
}

/* ── ② tab 按钮过渡 ─────────────────────────────────────────────────────
 * ⛔ 只过渡 opacity/transform/box-shadow（不写 color，避免与主题变量冲突）
 * ────────────────────────────────────────────────────────────────────── */
[role="tab"] {
    transition: opacity 120ms ease,
                transform 120ms cubic-bezier(.22, .61, .36, 1);
}

[role="tab"]:hover {
    opacity: 0.86;
}

[role="tab"]:active {
    transform: scale(0.96);
}

/* ── ③ 卡片 / 列表项 hover 补齐 ─────────────────────────────────────────
 * ⛔ 只为「没有自己 transition」的常见容器补，⛔ 不覆盖已有声明
 * ────────────────────────────────────────────────────────────────────── */
.rank-row,
.ip-row,
.fbv-item,
.chv-msg,
.mv-mdtabs button {
    transition: transform 80ms ease, opacity 80ms ease;
}

.rank-row:hover,
.ip-row:hover,
.fbv-item:hover {
    transform: translate3d(0, -1px, 0);
}

/* ── ④ 无障碍兜底（必须）──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .agh-motion-in,
    .agh-motion-in.agh-motion-done {
        animation: none !important;
        will-change: auto !important;
    }

    [role="tab"],
    .rank-row,
    .ip-row,
    .fbv-item,
    .chv-msg,
    .mv-mdtabs button {
        transition: none !important;
    }

    [role="tab"]:active,
    .rank-row:hover,
    .ip-row:hover,
    .fbv-item:hover {
        transform: none !important;
    }
}
