@charset "UTF-8";
/* ============================================================================
   互动特效（effects.css）—— 与 effects.js 成对，开关来自「主题 → 互动特效」那一组。

   三条约定，改这个文件前先看：

   1. **一份真值**。开关由 CmsSiteRenderer#fxFlags 拼成一段编码串，挂在
      <html data-fx="progress readTime …"> 上。这里每条规则都写成
      `html[data-fx~="xxx"] .目标`，所以关掉那一项，样式与脚本一起失效 ——
      不会出现"JS 已经不跑了，CSS 还留个空框"。

   2. **只用主题自己的变量**。颜色一律读 --brand / --ink / --muted / --line / --soft，
      它们背后是 --wj-*（后台「样式配置」）。这里不写死任何色值，
      否则换主色时这十几个效应当中总有一半不跟着变。

   3. **prefers-reduced-motion 一律降级**（文件末尾一整段）。扫光、光环、播报滚动、
      猫咪摆动都是"动得好看"，不是功能；关掉动效的人要看到的是同一份内容，只是不动。

   新增一项特效的步骤：这里加样式 → effects.js 里加初始化 → CmsSiteRenderer#FX_KEYS 加编码
   → theme.json 的 fx 组加开关。四处少一处就是"界面上有这个开关，但打开没反应"。
   ============================================================================ */

/* ---------------------------------------------------------------- 1. 顶部阅读进度条
   一条 fixed 的彩条，宽度由 effects.js 按滚动比例写 style.width。
   不用 transform: scaleX 是因为它的"进度"要在 RTL / 缩放下也对得上，宽度最直白。
   短于一屏的页面（无可滚动距离）JS 直接不创建它 —— 一条永远 100% 的条只会让人以为卡住了。 */
.fx-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 300;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand), var(--wj-secondary, #f5007c));
    box-shadow: 0 0 10px rgb(0 0 0 / 12%);
    pointer-events: none;
    transition: width 0.12s linear;
    will-change: width;
}

html[data-fx~="progress"] .fx-progress {
    display: block;
}

/* ---------------------------------------------------------------- 2. 彩色滚动条
   只对 WebKit 生效（Chrome / Edge / Safari）；Firefox 用 standards 的
   scrollbar-color + thin，两套写法不冲突，同一份配色。
   track 透明而不是白色：页面底色与卡片底色不同，画死一个白槽会在浅灰页面上多出一条白边。 */
html[data-fx~="scrollbar"] {
    scrollbar-color: var(--brand) transparent;
    scrollbar-width: thin;
}

html[data-fx~="scrollbar"] ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

html[data-fx~="scrollbar"] ::-webkit-scrollbar-track {
    background: transparent;
}

html[data-fx~="scrollbar"] ::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--brand), var(--wj-secondary, #f5007c));
    background-clip: padding-box;
    border: 3px solid transparent;
    border-radius: 999px;
}

html[data-fx~="scrollbar"] ::-webkit-scrollbar-thumb:hover {
    border-width: 2px;
}

/* 代码块自己也有滚动条：那里用中性色，一块正文里出现第二条彩虹会更吵 */
html[data-fx~="scrollbar"] pre::-webkit-scrollbar-thumb {
    background: var(--line);
    border: 3px solid transparent;
}

/* ---------------------------------------------------------------- 3. Logo 扫光
   ::after 是一道斜向高光，靠 transform 从左扫到右。
   为什么不用 background-position 动画：那会让 .nav__brand 的背景从"无"变成"有"，
   图片型 Logo（<img> 在 a 里）就扫不到了 —— 覆盖层才能同时盖住文字与图片。

   ⚠️ overflow:hidden 只加在同一块上，且品牌区本身是 flex 单行；
   如果哪天 Logo 里塞了下拉菜单，记得把它挪到外面，否则会被裁掉。 */
html[data-fx~="logoShine"] .nav__brand {
    position: relative;
    overflow: hidden;
}

html[data-fx~="logoShine"] .nav__brand::after {
    position: absolute;
    top: 0;
    left: 0;
    width: 60%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgb(255 255 255 / 55%), transparent);
    content: "";
    transform: translateX(-160%) skewX(-18deg);
    transition: transform 0.7s var(--motion);
    pointer-events: none;
}

html[data-fx~="logoShine"] .nav__brand:hover::after {
    transform: translateX(280%) skewX(-18deg);
}

/* ---------------------------------------------------------------- 4. 头像呼吸光环
   用 box-shadow 扩散而不是 outline / border：不占布局、不影响圆形裁切，
   浅色底与深色底都能看见（外圈是主色的低透明度）。
   三处头像是主题里真实存在的：侧栏「我」那张卡、文章作者、评论区。 */
@keyframes fx-halo {
    0%,
    100% {
        box-shadow: 0 0 0 0 var(--brand-line), 0 0 0 0 rgb(0 0 0 / 0%);
    }

    50% {
        box-shadow: 0 0 0 4px var(--brand-line), 0 0 14px 2px rgb(0 0 0 / 8%);
    }
}

html[data-fx~="avatarHalo"] .me-card__avatar-wrap,
html[data-fx~="avatarHalo"] .article__author-avatar-wrap,
html[data-fx~="avatarHalo"] .k-comment__avatar {
    border-radius: 50%;
    animation: fx-halo 3.8s ease-in-out infinite;
}

/* ---------------------------------------------------------------- 5. 侧边栏跟随
   只有"整栏比视口矮"时才吸顶（effects.js 量完加 .is-sticky）。
   CSS 里没法判断内容高度，硬给 position:sticky 会出现长栏读到一半被钉住、
   下面几块永远看不到 —— 那比不吸顶更难用。 */
html[data-fx~="stickySide"] .article-aside.fx-aside--sticky {
    position: sticky;
    top: calc(var(--fx-head, 88px) + 12px);
    align-self: start;
}

/* ---------------------------------------------------------------- 6. 侧栏标签页
   「热门 / 最新 / 标签」合成一块，省掉一屏高度。按钮组 + 三块面板，
   切换由 effects.js 挂 click（aria-selected 与 hidden 一起改，读屏才跟得上）。 */
/* 整块默认不渲染：关掉「侧栏标签页」时它连占位都不该留（同 .fx-cat） */
.fx-tabs {
    display: none;
}

html[data-fx~="hotTabs"] .fx-tabs {
    display: block;
}

.fx-tabs__nav {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 10px;
    background: var(--soft);
    border-radius: var(--radius-sm);
}

.fx-tabs__btn {
    flex: 1;
    padding: 6px 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: none;
    border: 0;
    border-radius: calc(var(--radius-sm) - 2px);
    cursor: pointer;
    transition: color var(--dur), background var(--dur);
}

.fx-tabs__btn:hover {
    color: var(--ink);
}

.fx-tabs__btn[aria-selected="true"] {
    color: var(--ink);
    background: #fff;
    box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}

/* 没有数据的那一页签灰掉而不是隐藏：三颗按钮一直是三颗，位置不会随数据多少而跳 */
.fx-tabs__btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* 「最新」那一页：一行一条，日期推到右边，标题超出就打点。
   不做封面 —— 「最新」要的是扫标题，不是看图。 */
.fx-tabs__list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.fx-tabs__list li {
    display: flex;
    gap: 10px;
    align-items: baseline;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
}

.fx-tabs__list li:last-child {
    border-bottom: 0;
}

.fx-tabs__list a {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    color: var(--body);
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fx-tabs__list a:hover {
    color: var(--brand);
}

.fx-tabs__list time {
    flex: none;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.fx-tabs__panel[hidden] {
    display: none;
}

/* ---------------------------------------------------------------- 7. 底部站点统计
   页脚底线上面一排小字。数字用等宽字形：换页时数字宽度不变，不会左右跳。 */
.foot__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    padding: 18px 0 0;
    margin: 0 0 14px;
    font-size: 12px;
    color: var(--muted);
    border-top: 1px solid var(--line);
}

.foot__stats b {
    margin-right: 4px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

/* ---------------------------------------------------------------- 8. 底部可爱提示 */
.foot__tip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

.foot__tip::before,
.foot__tip::after {
    width: 18px;
    height: 1px;
    background: var(--line);
    content: "";
}

/* ---------------------------------------------------------------- 9. 悬挂猫咪
   右下角一只 SVG 猫，抓着绳子轻轻晃。点一下缩回去（再点回来）。
   整块 pointer-events 只在猫身上开：不能挡住右下角那一片的点击（主题在那儿有回顶按钮）。 */
.fx-cat {
    position: fixed;
    right: 22px;
    bottom: 96px;
    z-index: 120;
    display: none;
    flex-direction: column;
    align-items: center;
    transform-origin: top center;
    animation: fx-cat-swing 4.6s ease-in-out infinite;
    pointer-events: none;
}

html[data-fx~="cat"] .fx-cat {
    display: flex;
}

.fx-cat__btn {
    display: block;
    padding: 0;
    color: var(--ink);
    background: none;
    border: 0;
    cursor: pointer;
    pointer-events: auto;
}

.fx-cat__rope {
    display: block;
    width: 2px;
    height: 42px;
    margin: 0 auto;
    background: linear-gradient(var(--line), transparent);
}

.fx-cat__svg {
    display: block;
    width: 62px;
    height: auto;
    filter: drop-shadow(0 6px 10px rgb(0 0 0 / 12%));
}

/* 缩起来的状态：只剩一根绳，猫藏到上面去 */
.fx-cat.is-hidden .fx-cat__svg {
    opacity: 0;
    transform: translateY(-14px) scale(0.9);
}

.fx-cat__svg {
    transition: opacity var(--dur), transform var(--dur) var(--motion);
}

@keyframes fx-cat-swing {
    0%,
    100% {
        transform: rotate(-3deg);
    }

    50% {
        transform: rotate(3deg);
    }
}

/* ---------------------------------------------------------------- 10. 复制提示
   复制成功后在右下角浮一句「已复制」，1.6s 自己消失。
   位置避开猫咪（bottom 更高一层），两块不会叠在一起。 */
.fx-toast {
    position: fixed;
    right: 22px;
    bottom: 168px;
    z-index: 400;
    padding: 8px 14px;
    font-size: 13px;
    color: #fff;
    background: rgb(17 17 17 / 88%);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.22s var(--motion), transform 0.22s var(--motion);
    pointer-events: none;
}

.fx-toast.is-on {
    opacity: 1;
    transform: none;
}

/* 代码块的复制按钮：出现在右上角，只在代码块被悬停 / 聚焦时显形 */
.fx-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 9px;
    font: inherit;
    font-size: 11px;
    color: var(--muted);
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    opacity: 0;
    cursor: pointer;
    transition: opacity var(--dur), color var(--dur), border-color var(--dur);
}

.article__body pre:hover .fx-copy-btn,
.fx-copy-btn:focus-visible {
    opacity: 1;
}

.fx-copy-btn:hover {
    color: var(--brand);
    border-color: var(--brand-line);
}

/* ---------------------------------------------------------------- 11. 字数与阅读时长
   这一项没有自己的视觉，只是一段跟着信息条排版走的行内文字。
   留一个类名是为了让 effects.js 找得到落点，也方便主题覆写。 */
.fx-read {
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- 12. 帧率显示
   左下角半透明角标：当前 FPS + 最近 2 秒内最差的一帧。
   「最差一帧」比平均值有用得多 —— 平均 58 但偶发 200ms 卡顿，页面就是"一卡一卡"的。 */
.fx-fps {
    position: fixed;
    bottom: 10px;
    left: 10px;
    z-index: 400;
    padding: 4px 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1.4;
    color: var(--muted);
    background: rgb(255 255 255 / 82%);
    border: 1px solid var(--line);
    border-radius: 6px;
    pointer-events: none;
    backdrop-filter: blur(6px);
}

.fx-fps b {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- 13. 动态标题
   纯 JS（改 document.title），没有样式。这里只留一条说明，免得下一个人到处找。 */

/* ---------------------------------------------------------------- 14. 评论框底纹
   地址由后台「互动特效 → 评论框背景图」给，经 CmsSiteRenderer#cssUrl 的形状白名单后
   拼成 --wj-comment-bg。没配时这个变量为空，var() 落到 none，等于什么都不做。

   !important 是有意的：评论组件是打包进来的（comment-widget.css 里选择器带
   [data-v-xxxx] 属性，比这里多一位），且它在本文件之后加载。不加重音就永远盖不住；
   这一条只改 background-image，不动背景色与边框。 */
.k-comment__textarea {
    background-image: var(--wj-comment-bg, none) !important;
    background-position: center !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
}

/* ---------------------------------------------------------------- 15. 降级
   关掉所有装饰性动画。内容与功能一项不减：进度条还在（只是不补间）、
   播报还在（停在第一屏，可以手动横向滚）、猫咪还在（不晃）。 */
@media (prefers-reduced-motion: reduce) {
    .fx-progress,
    .fx-cat__svg {
        transition: none;
    }

    html[data-fx~="avatarHalo"] .me-card__avatar-wrap,
    html[data-fx~="avatarHalo"] .article__author-avatar-wrap,
    html[data-fx~="avatarHalo"] .k-comment__avatar,
    .fx-cat {
        animation: none;
    }

    html[data-fx~="logoShine"] .nav__brand::after {
        display: none;
    }
}

/* 手机上不挂猫：右下方是回顶按钮与底部工具条的地盘，多一只猫只会挡住它们 */
@media (max-width: 720px) {
    .fx-cat {
        display: none;
    }
}
