/* ==========================================================================
   Butterfly × Solitude 主题覆盖

   结构说明：
     1. 通用令牌（与主题无关的圆角、边框、过渡）
     2. 浅色令牌 [data-theme="light"]
        对照 Solitude source/css/_mode/index.styl 的 [data-theme=light]
        以及 source/css/_global/index.styl 的全局变量
     3. 深色令牌 [data-theme="dark"]
        对照 Solitude source/css/_mode/index.styl 的 [data-theme=dark]
     4. 组件规则（只引用令牌，不再写死颜色）

   维护约定：
     - 新增颜色一律先加令牌，再在组件中引用；
     - 组件规则保持"主题无关"，深浅差异只由令牌控制；
     - 如确实需要按模式区分，使用 [data-theme="light"] / [data-theme="dark"]。
   ========================================================================== */

/* ==========================================================================
   1. 通用令牌
   ========================================================================== */

:root {
  --btf-radius: 12px;
  --btf-radius-sm: 8px;
  --btf-radius-pill: 99px;
  --btf-border-width: 1px;
  --btf-transition: .3s ease;
  --btf-main-width: 1030px;
  /* Sidebar width: the single source of truth.
     Change this one value and the sidebar column, every card inside it
     and the total layout width all follow automatically. */
  --btf-aside-width: 315px;
  /* Structural constant: inner gap between sidebar and main column.
     Normally you do NOT need to touch this. */
  --btf-aside-gap: 10px;
  /* Vertical gap between sidebar cards. */
  --btf-aside-card-gap: 10px;
  --btf-layout-gutter: 30px;
  --btf-layout-width: calc(var(--btf-main-width) + var(--btf-aside-width) + var(--btf-layout-gutter));
  /* Post header cover width (right side of the post top image). */
  --btf-header-cover-width: 300px;
  /* Navigation buttons: keep the hit area and icon size in one place. */
  --btf-nav-button-size: 35px;
  --btf-nav-icon-size: 22px;
  --btf-nav-right-gap: 6px;
  --btf-nav-right-padding: 4px;
  /* Solitude: --efu-gray / --efu-gray-op */
  --btf-gray: #999999;
  --btf-gray-op: #9999992b;
  /* Solitude: --efu-shadow-main / --efu-shadow-black */
  --btf-shadow-main: 0 8px 12px -3px var(--btf-theme-op);
  --btf-shadow-theme: 0 8px 12px -3px var(--btf-theme-op);
  --btf-shadow-lightblack: 0 5px 12px -5px rgba(102, 68, 68, 0);
  --btf-shadow-black: 0 0 12px 4px rgba(0, 0, 0, .05);
  /* 导航玻璃胶囊不要投影。
     最初用 0 5px 100px -5px 会在滚动后铺出一大片淡灰；收敛到 16px 贴边后，
     每颗胶囊下方仍挂着一条可见的淡影（4px / 8px 向下偏移），滚动时很显脏。
     胶囊靠半透明玻璃底 + backdrop-filter 就已经能立住，这里直接给 none。 */
  --btf-shadow-glass: none;
}

/* ==========================================================================
   2. 浅色令牌
   对照：Solitude [data-theme=light] + Solitude 全局变量
   主色 #425AEF / 背景 #f7f9fe / 卡片 #fff / 边框 #e3e8f7
   ========================================================================== */

[data-theme="light"] {
  color-scheme: light;

  /* Solitude: --efu-theme / --efu-theme-op / --efu-theme-op-deep / --efu-theme-none */
  --btf-theme: #425AEF;
  --btf-theme-op: #425AEF23;
  --btf-theme-op-deep: #425AEFdd;
  --btf-theme-op-light: #4259ef0d;
  --btf-theme-none: #425AEF00;
  --btf-nav-hover-text: #ffffff;
  --btf-hovertext: var(--btf-theme);

  /* Solitude: --efu-fontcolor / --efu-secondtext / --efu-white / --efu-reverse */
  --btf-font-color: #363636;
  --btf-second-text: rgba(60, 60, 67, .8);
  --btf-white: #ffffff;
  --btf-reverse: #000000;

  /* Solitude: --efu-background / --efu-card-bg / --efu-secondbg / --efu-card-btn-bg */
  --btf-background: #f7f9fe;
  --btf-card-bg: #ffffff;
  --btf-card-bg-none: rgba(255, 255, 255, 0);
  --btf-second-bg: #f7f7f9;
  --btf-second-bg-strong: #f7f7f9;
  --btf-card-btn-bg: #edf0f7;
  --btf-blockquote-bg: #f7f7f9;
  --btf-tabs-bg: #f2f5f8;
  --btf-sidebar-bg: #f6f8fa;
  /* 页脚底色：与卡片同色，只靠一条发丝线跟正文分隔，不要整块色块 */
  --btf-footer-bg: #ffffff;
  --btf-nav-bg: linear-gradient(to bottom, rgba(255, 255, 255, .6), rgba(255, 255, 255, .85));
  --btf-nav-border: rgba(227, 232, 247, .7);
  --btf-mask-bg: rgba(255, 255, 255, .6);
  --btf-mask-bg-deep: rgba(255, 255, 255, .85);

  /* Solitude: --efu-card-border / --style-border / --style-border-hover */
  --btf-card-border: #e3e8f7;
  --btf-card-border-hover: var(--btf-theme);
  --btf-border: var(--btf-border-width) solid var(--btf-card-border);

  /* Solitude: --efu-shadow-border（卡片按你的要求不使用阴影） */
  --btf-shadow-border: 0 8px 16px -4px #2c2d300c;
  --btf-shadow-card: none;
  --btf-shadow-card-hover: none;

  /* 映射到 Butterfly 变量 */
  --global-bg: var(--btf-background);
  --card-bg: var(--btf-card-bg);
  --card-meta: var(--btf-second-text);
  --font-color: var(--btf-font-color);
  --text-highlight-color: #1f2d3d;
  --white: var(--btf-white);
  --card-box-shadow: var(--btf-shadow-card);
  --card-hover-box-shadow: var(--btf-shadow-card-hover);

  --sidebar-bg: var(--btf-sidebar-bg);
  --sidebar-menu-bg: var(--btf-card-bg);

  --btn-bg: var(--btf-card-btn-bg);
  --btn-color: var(--btf-font-color);
  --btn-hover-color: var(--btf-theme);

  --text-bg-hover: var(--btf-second-bg);
  --search-bg: var(--btf-second-bg);
  --search-input-color: #4c4948;
  --search-a-color: #4c4948;

  --blockquote-bg: var(--btf-blockquote-bg);
  --blockquote-color: #6a737d;
  --reward-pop: #f5f5f5;
  --toc-link-color: #666261;

  --light-grey: #eeeeee;
  --dark-grey: #cacaca;
  --hr-border: var(--btf-theme-op);
  --hr-before-color: var(--btf-theme);

  --tab-border-color: #f0f0f0;
  --tab-button-bg: #f0f0f0;
  --tab-button-color: #1f2d3d;
  --tab-button-hover-bg: #dcdcdc;
  --tab-button-active-bg: #ffffff;

  --scrollbar-color: rgba(60, 60, 67, .4);
  --mark-bg: rgba(0, 0, 0, .3);
  --zoom-bg: #ffffff;
  --timeline-bg: #f7f7f9;

  /* Code block palette is intentionally NOT overridden here.
     Butterfly's code_blocks.theme (darker / pale night / light / ocean)
     owns --hl-bg / --hl-color / --hltools-* in both color modes. */
}

/* ==========================================================================
   3. 深色令牌
   对照：Solitude [data-theme=dark]
   主色 #ffc848 / 背景 #18171d / 卡片 #1b1c20 / 边框 #3d3d3f
   ========================================================================== */

[data-theme="dark"] {
  color-scheme: dark;

  /* Solitude: --efu-theme / --efu-theme-op / --efu-theme-op-deep / --efu-theme-none */
  --btf-theme: #ffc848;
  --btf-theme-op: #ffc84823;
  --btf-theme-op-deep: #ffc848dd;
  --btf-theme-op-light: #ffc8480d;
  --btf-theme-none: #ffc84800;
  --btf-nav-hover-text: #1b1c20;
  --btf-hovertext: #0a84ff;

  /* Solitude: --efu-fontcolor / --efu-secondtext / --efu-white / --efu-reverse */
  --btf-font-color: #f7f7fa;
  --btf-second-text: #a1a2b8;
  --btf-white: #ffffff;
  --btf-reverse: #ffffff;

  /* Solitude: --efu-background / --efu-card-bg / --efu-secondbg / --efu-card-btn-bg */
  --btf-background: #18171d;
  --btf-card-bg: #1b1c20;
  --btf-card-bg-none: #1d1b2600;
  --btf-second-bg: #30343f;
  --btf-second-bg-strong: #21232a;
  --btf-card-btn-bg: #30343f;
  --btf-blockquote-bg: #30343f;
  --btf-tabs-bg: #121212;
  --btf-sidebar-bg: #121212;
  /* 页脚底色：与卡片同档 */
  --btf-footer-bg: #1b1c20;
  --btf-nav-bg: linear-gradient(to bottom, rgba(0, 0, 0, .6), rgba(0, 0, 0, .85));
  --btf-nav-border: rgba(61, 61, 63, .65);
  --btf-mask-bg: rgba(0, 0, 0, .6);
  --btf-mask-bg-deep: rgba(0, 0, 0, .85);

  /* Solitude: --efu-card-border / --style-border / --style-border-hover */
  --btf-card-border: #3d3d3f;
  --btf-card-border-hover: var(--btf-theme);
  --btf-border: var(--btf-border-width) solid var(--btf-card-border);

  /* Solitude: --efu-shadow-border（卡片按你的要求不使用阴影） */
  --btf-shadow-border: 0 8px 16px -4px #00000050;
  --btf-shadow-card: none;
  --btf-shadow-card-hover: none;
  /* 深色下导航胶囊同样不给投影，沿用 :root 的 none */

  /* 映射到 Butterfly 变量 */
  --global-bg: var(--btf-background);
  --card-bg: var(--btf-card-bg);
  --card-meta: var(--btf-second-text);
  --font-color: var(--btf-font-color);
  --text-highlight-color: var(--btf-font-color);
  --white: var(--btf-white);
  --card-box-shadow: var(--btf-shadow-card);
  --card-hover-box-shadow: var(--btf-shadow-card-hover);

  --sidebar-bg: var(--btf-sidebar-bg);
  --sidebar-menu-bg: var(--btf-card-bg);

  --btn-bg: var(--btf-card-btn-bg);
  --btn-color: var(--btf-font-color);
  --btn-hover-color: var(--btf-theme);

  --text-bg-hover: var(--btf-second-bg);
  --search-bg: var(--btf-second-bg);
  --search-input-color: var(--btf-font-color);
  --search-a-color: var(--btf-font-color);

  --blockquote-bg: var(--btf-blockquote-bg);
  --blockquote-color: var(--btf-second-text);
  --reward-pop: #21232a;
  --toc-link-color: var(--btf-second-text);

  --light-grey: #eeeeee;
  --dark-grey: #cacaca;
  --hr-border: var(--btf-theme-op);
  --hr-before-color: var(--btf-theme);

  --tab-border-color: #2c2c2c;
  --tab-button-bg: #2c2c2c;
  --tab-button-color: rgba(255, 255, 255, .7);
  --tab-button-hover-bg: #383838;
  --tab-button-active-bg: #121212;

  --scrollbar-color: rgba(200, 200, 223, .4);
  --mark-bg: rgba(0, 0, 0, .6);
  --zoom-bg: #121212;
  --timeline-bg: #1a1a1a;

  /* Code block palette follows Butterfly's code_blocks.theme. */
}

/* ---------- 4.0.1 暗色：顶部导航胶囊底色 ----------
   主题原本给品牌 / 菜单 / 右侧按钮用的是 rgba(0,0,0,.6→.85) 的黑色玻璃渐变，
   在 #18171d 的底色上几乎看不出胶囊形状。改成 30% 的卡片表面色（与轻语页卡片同源 #2a2b31），
   暗色下胶囊会比底色亮一档，边界更清楚。只在暗色生效。
   只覆盖原本就有玻璃底的两个状态：无头图页面 / 滚动后。
   顶部有头图时胶囊本来是透明压在横幅上的，这里保持不动。 */
/* 二级菜单（导航下拉浮层）：原本是 --btf-mask-bg-deep（暗色≈rgba(0,0,0,.85)），改成同一档卡片表面色 */
[data-theme="dark"] #nav .menus_items .menus_item > .menus_item_child {
  background: color-mix(in srgb, #2a2b31 30%, transparent) !important;
}

/* 文章页滚动后居中的标题胶囊（#nav > .nav-page-title） */
[data-theme="dark"] #nav > .nav-page-title {
  background: color-mix(in srgb, #2a2b31 30%, transparent);
}
/* 悬停文字色跟着染色底的明暗走：custom.js 取到封面色后会按亮度把
   --btf-nav-hover-text 改成白字或深字（暗色头图/深蓝封面 → 白字，
   浅色封面 → 深字），所以这里直接用变量，不再写死。 */

[data-theme="dark"] #page-header.not-top-img #nav #blog-info,
[data-theme="dark"] #page-header.not-top-img #nav #nav-right,
[data-theme="dark"] #page-header.not-top-img #nav #menus > .menus_items,
[data-theme="dark"] #page-header.nav-fixed #nav #blog-info,
[data-theme="dark"] #page-header.nav-fixed #nav #nav-right,
[data-theme="dark"] #page-header.nav-fixed #nav #menus > .menus_items {
  background: color-mix(in srgb, #2a2b31 30%, transparent) !important;
}

/* ==========================================================================
   4. 组件规则
   ========================================================================== */

/* ---------- 4.1 页面底色 ---------- */

#web_bg {
  background-color: var(--btf-background) !important;
}

#web_bg::before {
  display: none !important;
}

.layout {
  max-width: var(--btf-layout-width);
  padding: 20px 15px;
}

@media screen and (min-width: 900px) {
  .layout > #aside-content.aside-content {
    flex: 0 0 var(--btf-aside-width);
    width: var(--btf-aside-width);
    max-width: var(--btf-aside-width);
    padding-left: var(--btf-aside-gap);
  }

  .layout > div:first-child {
    flex: 0 1 var(--btf-main-width);
    width: var(--btf-main-width);
    max-width: var(--btf-main-width);
    min-width: 0;
  }

  html.hide-aside .layout > div:first-child {
    width: 80%;
  }
}

/* ---------- 4.1.1 sidebar width normalization ----------
   Every sidebar width comes from --btf-aside-width:
   #aside-content  -> var(--btf-aside-width)          (310px)
   .sticky_layout  -> 100% of the sidebar content box (300px)
   .card-widget    -> 100% of .sticky_layout          (300px)
   So all cards always share one width; no per-card overrides. */

#aside-content > .sticky_layout {
  width: 100%;
  max-width: 100%;
}

/* ---------- 4.1.2 侧栏 sticky 避开固定导航 ----------
   #nav 被我们改成常驻 fixed（高 60px），但 Butterfly 原生的 .sticky_layout
   仍是 top: 20px。滚动后目录卡片会钻到导航底下，右上角正好被 #nav-right
   那组胶囊（随机文章 / 搜索 / 进度）盖住，标题和进度数字都看不见。

   Solitude 的做法是 .sticky_layout { top: 60px }，让卡片停在导航下沿；
   这里再留 12px 呼吸空间，取 72px。选择器刻意写满三级 id，
   是为了压过主题 #page-header.fixed + .layout 那条 top: 70px 的动态覆盖。 */
@media screen and (min-width: 900px) {
  #body-wrap #content-inner.layout > #aside-content > .sticky_layout {
    top: 72px;
  }
}

#aside-content .card-widget {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: var(--btf-aside-card-gap);
  box-sizing: border-box;
}

#aside-content .card-widget:last-child {
  margin-bottom: 0;
}

.footer-flex {
  max-width: var(--btf-layout-width);
}

/* ---------- aside: false 的页面：铺满「正文 + 侧栏」的总宽 ----------
   front-matter 里写 aside: false 只是让主题不渲染侧栏，
   容器宽度还是原来那条 5/6（1375 × 5/6 ≈ 1146），正文又卡在 --btf-main-width（1030），
   于是右边空出一条，看着像「侧栏没了但位置还留着」。
   这里让这类页面直接吃到 --btf-layout-width，和分类 / 标签 / 统计页一个宽度。
   分类那种页另有 #body-wrap.type-xxx 的专属规则，不受影响。 */
.layout.hide-aside {
  max-width: var(--btf-layout-width);
}

.layout.hide-aside > div:first-child {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
}

/* ---------- 4.2 卡片：细边框、无阴影 ---------- */

#recent-posts .recent-post-item,
#aside-content .card-widget,
.layout > div:first-child:not(.nc),
#article-container .shuoshuo-item,
.flink-list-item,
.gallery-group {
  background: var(--btf-card-bg);
  box-shadow: var(--btf-shadow-card) !important;
  border: var(--btf-border);
  border-radius: var(--btf-radius);
  transition: border-color var(--btf-transition), background-color var(--btf-transition);
}

#recent-posts .recent-post-item:hover,
#aside-content .card-widget:hover,
#article-container .shuoshuo-item:hover,
.flink-list-item:hover,
.gallery-group:hover {
  box-shadow: var(--btf-shadow-card-hover) !important;
  border-color: var(--btf-card-border-hover);
}

/* 主栏卡片（文章 / 归档 / 标签页等）的内边距：
   主题原本是 padding: 50px 40px，上下留白偏大，这里收紧成 25px 40px。
   只在桌面端生效，移动端沿用主题原本的 36px 14px。 */
@media screen and (min-width: 769px) {
  .layout > div:first-child:not(.nc) {
    padding: 25px 40px;
  }
}

/* ---------- 4.3 导航栏 ---------- */

@media (min-width: 769px) {
  /* 对齐 Solitude：导航条本身透明，只有品牌/菜单/搜索是玻璃胶囊 */
  #page-header.nav-fixed > #nav,
  #page-header.not-top-img > #nav {
    background: transparent !important;
    box-shadow: none !important;
    border-bottom: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

/* 对齐 Solitude：滚动后导航条始终固定在顶部，只收起菜单胶囊。
   Butterfly 默认把 #nav 上移到 -60px 整条隐藏，这里恢复为 top: 0。 */
#page-header.nav-fixed > #nav {
  top: 0 !important;
}
}

#page-header.nav-fixed #nav a:hover,
#page-header.nav-fixed #nav span.site-page:hover,
#page-header.nav-fixed #nav #toggle-menu:hover,
#page-header.nav-fixed #nav #blog-info:hover,
#page-header.not-top-img #nav a:hover,
#page-header.not-top-img #nav span.site-page:hover {
  color: var(--btf-theme) !important;
}

#nav .site-page:not(.child)::after {
  background-color: var(--btf-theme);
}

/* 下拉菜单：对齐 Solitude .menus_item_child 的胶囊浮层
   注意：主题的 #nav .menus_items .menus_item .menus_item_child 优先级更高，
   所以这里必须使用同等级（或更高）的选择器，否则圆角/内边距会被覆盖。 */
#nav .menus_items .menus_item > .menus_item_child {
  top: 35px;
  right: auto;
  left: 50%;
  display: none;
  margin-top: 8px;
  padding: 6px 3.5px;
  border: var(--btf-border);
  border-radius: 100px;
  background-color: var(--btf-mask-bg-deep) !important;
  box-shadow: var(--btf-shadow-black) !important;
  /* 主题的 sub_menus 动画会把 opacity/transform 锁死在结束帧，
     导致下拉常显且 translateX(-50%) 居中失效，这里必须关掉 */
  animation: none !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-10px) scale(.8);
  transition: .3s;
}

#nav .menus_items .menus_item:hover > .menus_item_child {
  display: block;
  border-color: var(--btf-header-theme, var(--btf-theme));
  box-shadow: 0 8px 12px -3px var(--btf-header-theme-op, var(--btf-theme-op)) !important;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* Solitude 的菜单没有下拉箭头，这里隐藏 Butterfly 默认的 chevron */
#nav .menus_items .menus_item > .site-page.group > i.fa-chevron-down {
  display: none;
}

#nav .menus_items .menus_item > .menus_item_child li {
  display: inline-flex;
  margin: 0 4px;
  border-radius: 5px;
  list-style: none;
}

#nav .menus_items .menus_item > .menus_item_child li:hover {
  background: transparent;
}

#nav .menus_items .menus_item > .menus_item_child .site-page.child {
  display: flex;
  align-items: center;
  padding: .3rem .8rem;
  border-radius: 100px;
  color: var(--btf-font-color) !important;
  letter-spacing: 0;
  text-shadow: none;
  transition: background-color .3s, color .3s, padding .3s;
}

#nav .menus_items .menus_item > .menus_item_child .site-page.child:hover {
  padding: .3rem 1rem;
  background: var(--btf-header-theme, var(--btf-theme));
  box-shadow: 0 8px 12px -3px var(--btf-header-theme-op, var(--btf-theme-op));
  color: var(--btf-nav-hover-text) !important;
  transform: scale(1);
}

/* 滚动后导航处于 nav-fixed / not-top-img 状态时，站点级
   `#page-header.nav-fixed #nav a:hover`（双 ID）优先级高于上面的下拉项规则，
   会把二级菜单文字染成主题色，出现“蓝底蓝字看不见”。
   这里补上 #page-header 前缀（同为双 ID）并放在后面，锁回下拉项的颜色。 */
#page-header #nav .menus_items .menus_item > .menus_item_child .site-page.child {
  color: var(--btf-font-color) !important;
}

#page-header #nav .menus_items .menus_item > .menus_item_child .site-page.child:hover {
  background: var(--btf-header-theme, var(--btf-theme));
  color: var(--btf-nav-hover-text) !important;
}

#nav .menus_items .menus_item > .menus_item_child .site-page.child i {
  margin-right: 8px;
  font-size: 22px;
  line-height: 1;
}

/* ---------- 4.3.1 导航菜单：对齐 Solitude #menus ----------
   结构：nav#nav > #menus > .menus_items > .menus_item > a.site-page
   Solitude 把 .menus_items 做成居中的玻璃胶囊，单个菜单项是 35px 高的圆角块，
   悬停/当前页用主题色填充。这里逐条对齐它的计算样式。 */

@media (min-width: 769px) {
  #nav {
    justify-content: center;
    align-items: center;
    padding: 0;
  }

#nav #menus {
  position: absolute;
  left: 0;
  display: flex;
  justify-content: center;
  width: 100%;
  height: 60px;
  margin: 0;
  transform: translateZ(0);
}

#nav #menus > .menus_items {
  position: relative;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  width: fit-content;
  height: 44px;
  margin: auto 0;
  padding: 0 4px;
  border-radius: 99px;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  transform: scale(1);
  transition: top .5s, transform .5s, opacity .5s, box-shadow .5s, backdrop-filter .5s, background-color .5s;
}

#nav #menus > .menus_items > .menus_item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto;
  padding: 0;
}

#nav #menus > .menus_items > .menus_item > .site-page {
  display: flex;
  align-items: center;
  max-width: 10rem;
  height: 35px;
  padding: 0 12px;
  border-radius: 40px;
  color: var(--btf-font-color);
  font-size: 16px;
  font-weight: 700;
  line-height: 35px;
  letter-spacing: 0;
  text-shadow: none;
  white-space: nowrap;
  transition: background-color .3s, color .3s, box-shadow .3s;
}

#nav #menus > .menus_items > .menus_item > .site-page > span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#nav #menus > .menus_items > .menus_item > .site-page > i {
  margin-right: 6px;
  font-size: 16px;
  line-height: 1;
}

#nav #menus > .menus_items > .menus_item > .site-page:hover {
  background: var(--btf-header-theme, var(--btf-theme));
  box-shadow: 0 8px 12px -3px var(--btf-header-theme-op, var(--btf-theme-op));
  color: var(--btf-nav-hover-text) !important;
}

#nav #menus > .menus_items > .menus_item > .site-page:hover > span {
  color: var(--btf-nav-hover-text);
}

#nav #menus > .menus_items > .menus_item > .site-page:not(.child)::after {
  display: none;
}

/* 滚动后：菜单胶囊收起，改为显示文章标题胶囊（对齐 Solitude #page-name） */
#page-header.nav-fixed #nav #menus > .menus_items {
  top: -60px;
  opacity: 0;
  transform: scale(0);
  pointer-events: none;
  transition: top .3s, transform .3s, opacity .3s;
}

#page-header.nav-fixed.nav-visible #nav #menus > .menus_items {
  top: 0;
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  background: linear-gradient(to bottom, var(--btf-mask-bg), var(--btf-mask-bg-deep));
  box-shadow: var(--btf-shadow-glass, none);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

/* 顶部有头图时：胶囊透明、文字白色，悬停只加一层白色薄底（对齐 Solitude 顶部行为） */
#page-header:not(.nav-fixed):not(.not-top-img) #nav #menus > .menus_items > .menus_item > .site-page {
  color: var(--btf-white);
}

#page-header:not(.nav-fixed):not(.not-top-img) #nav #menus > .menus_items > .menus_item > .site-page:hover {
  background: var(--btf-header-white-op, rgba(255, 255, 255, .2));
  box-shadow: none;
  color: var(--btf-white) !important;
}

#page-header:not(.nav-fixed):not(.not-top-img) #nav #menus > .menus_items > .menus_item > .site-page:hover > span {
  color: var(--btf-white);
}

/* 没有头图的页面（404 等）：导航直接压在页面背景上，胶囊需要常驻玻璃底 */
#page-header.not-top-img #nav #menus > .menus_items {
  background: linear-gradient(to bottom, var(--btf-mask-bg), var(--btf-mask-bg-deep));
  box-shadow: var(--btf-shadow-glass, none);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
}

/* 右侧按钮区：对齐 Solitude #nav-right
   结构：nav#nav > #nav-group > #nav-right > #random-post-button / #search-button / #nav-totop
   #menus 只负责居中菜单，右侧按钮不再参与菜单布局。

   注意：尺寸与排列规则放在媒体查询外。之前这些公共规则被包进
   min-width: 769px，移动端按钮会因为没有宽高而被压成 0。 */
#nav > #nav-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  max-width: var(--btf-layout-width);
  margin: 0 auto;
  padding: 0 15px;
}

#nav #nav-right {
  position: absolute;
  top: 50%;
  right: 15px;
  z-index: 102;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--btf-nav-right-gap);
  padding: var(--btf-nav-right-padding);
  overflow: hidden;
  border: var(--btf-border-width) solid transparent;
  border-radius: 99px;
  transform: translateY(-50%);
  transition: background-color .3s, border-color .3s, box-shadow .3s, backdrop-filter .3s;
}

#nav #nav-right .nav-button,
#nav #nav-right #toggle-menu {
  display: flex;
  flex: 0 0 var(--btf-nav-button-size);
  align-items: center;
  justify-content: center;
  width: var(--btf-nav-button-size);
  height: var(--btf-nav-button-size);
  margin: 0;
  padding: 0;
}

#nav #nav-right .nav-button > .site-page,
#nav #nav-right #toggle-menu > .site-page {
  display: flex;
  flex: 0 0 var(--btf-nav-button-size);
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--btf-nav-button-size);
  height: var(--btf-nav-button-size);
  margin: 0;
  padding: 0;
  border-radius: 40px;
  color: var(--btf-font-color);
  font-size: 16px;
  line-height: 1;
  text-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .3s, color .3s, box-shadow .3s;
}

#nav #nav-right .nav-button > .site-page > i,
#nav #nav-right #toggle-menu > .site-page > i {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--btf-nav-icon-size);
  height: var(--btf-nav-icon-size);
  font-size: var(--btf-nav-icon-size);
  line-height: 1;
  overflow: visible;
}

/* 随机文章使用内联 SVG，保持与 Font Awesome 图标相同的视觉尺寸。 */
#nav #nav-right .random-cube {
  width: var(--btf-nav-icon-size);
  height: var(--btf-nav-icon-size);
  fill: currentColor;
  overflow: visible;
}

/* 导航按钮统一使用内联描边 SVG，避免依赖外部图标字体。 */
#nav #nav-right .nav-icon {
  width: var(--btf-nav-icon-size);
  height: var(--btf-nav-icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

#nav #nav-right .nav-button:not(#nav-totop) > .site-page > span {
  display: none;
}

/* Butterfly 的 #search-button 默认是 inline，图标会被压成 0 高；
   Solitude 的搜索是 35px 的独立按钮，这里恢复完整盒模型。 */
#nav #nav-right #search-button {
  display: flex;
  flex: 0 0 var(--btf-nav-button-size);
  align-items: center;
  justify-content: center;
  width: var(--btf-nav-button-size);
  height: var(--btf-nav-button-size);
  padding: 0;
}

#nav #nav-right #search-button > .site-page.social-icon.search {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--btf-nav-button-size);
  height: var(--btf-nav-button-size);
  margin: 0;
  padding: 0;
  font-size: var(--btf-nav-icon-size);
}

/* 桌面端不显示移动端汉堡按钮；移动端在下方媒体查询中恢复。
   注意：主题的 #nav #toggle-menu 选择器优先级更高，这里必须用
   #page-header 前缀，否则顶部状态仍会显示汉堡按钮。 */
#page-header #nav #nav-right #toggle-menu {
  display: none;
}

#nav #nav-right .nav-button > .site-page:hover,
#nav #nav-right #toggle-menu > .site-page:hover {
  background: var(--btf-header-theme, var(--btf-theme));
  box-shadow: 0 8px 12px -3px var(--btf-header-theme-op, var(--btf-theme-op));
  color: var(--btf-nav-hover-text) !important;
}

/* 主题给所有 .site-page 加了悬停下划线（::after），右侧按钮是圆形图标按钮，
   这里去掉，避免悬停时出现一条横条。 */
#nav #nav-right .site-page:not(.child)::after {
  display: none;
}

/* 搜索/菜单是 span.site-page，会被上面站点级的 span.site-page:hover 规则
   （color: var(--btf-theme) !important）覆盖成蓝底蓝图标，这里提高优先级锁回按钮前景色。 */
#page-header #nav #nav-right .nav-button > .site-page:hover,
#page-header #nav #nav-right #toggle-menu > .site-page:hover {
  color: var(--btf-nav-hover-text) !important;
}

#nav #nav-right .nav-button > .site-page:focus-visible,
#nav #nav-right #toggle-menu > .site-page:focus-visible {
  outline: 2px solid var(--btf-theme);
  outline-offset: 2px;
}

/* 返回顶部：顶部时收起；滚动后展开成 35px；接近底部时拉长成“返回顶部”。
   收起时用 display:none 彻底移出布局——它虽然透明、宽度为 0，
   但仍会作为 flex 子项占位，把右上角胶囊撑出一块空白
   （轻语页、标签页这类短页面尤其明显）。这条是通用规则，
   所有页面都不需要再单独特判。 */
#nav #nav-right #nav-totop {
  display: none;
  position: relative;
  flex: 0 0 auto;
  align-items: center;
  width: 0;
  height: var(--btf-nav-button-size);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 40px;
  opacity: 0;
  transform: scale(0);
  transition: width .3s, opacity .3s, transform .3s;
}

#page-header.nav-fixed #nav #nav-right #nav-totop {
  display: flex;
  width: var(--btf-nav-button-size);
  opacity: 1;
  transform: scale(1);
}

#nav #nav-right #nav-totop.long,
#page-header.nav-fixed #nav #nav-right #nav-totop.long {
  width: 106px;
}

#nav #nav-right #nav-totop .totopbtn {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 40px;
  background: var(--btf-font-color);
  color: var(--btf-card-bg);
  transition: background-color .3s, transform .3s;
}

#nav #nav-right #nav-totop.long .totopbtn {
  width: 96px;
}

#nav #nav-right #nav-totop .totopbtn > i {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  color: var(--btf-card-bg);
  font-size: 17px;
  line-height: 1;
  /* 常态显示进度数字/文字，鼠标移上去才换成箭头 */
  opacity: 0;
  transition: opacity .3s;
}

/* Solitude 的返回顶部文字按钮是 80px 胶囊，左右内边距 12px。 */
#nav #nav-right #nav-totop.long .totopbtn {
  top: 2px;
  right: 2px;
  left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 96px;
  padding: 0 8px;
}

#nav #nav-right #nav-totop #percent {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 35px;
  color: var(--btf-card-bg);
  font-size: 13px;
  line-height: 1;
  /* 常态显示滚动进度百分比（到底时由 JS 换成「返回顶部」文字） */
  opacity: 1;
  white-space: nowrap;
  transition: opacity .3s;
}

/* 悬停时保持深色圆钮（不再变成主题蓝），只用放大做反馈 */
#nav #nav-right #nav-totop:hover .totopbtn {
  background: var(--btf-font-color);
}

/* 长条状态：平时只显示「返回顶部」文字，不带箭头 */
#nav #nav-right #nav-totop.long .totopbtn > i {
  opacity: 0;
}

#nav #nav-right #nav-totop.long #percent {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 0;
  color: var(--btf-card-bg);
  font-size: 13px;
  opacity: 1;
  transform: translate(-50%, -50%);
}

/* 鼠标移上去时：数字/文字换成箭头（圆钮与长条通用） */
#nav #nav-right #nav-totop:hover .totopbtn > i {
  opacity: 1;
}

#nav #nav-right #nav-totop:hover #percent {
  opacity: 0;
  font-weight: 700;
}

#nav #nav-right #nav-totop:not(.long):hover .totopbtn {
  transform: scale(1.167);
}

/* 顶部有头图时：右侧图标为白色，悬停只加一层白色薄底（对齐 Solitude 顶部行为）。 */
#page-header:not(.nav-fixed):not(.not-top-img) #nav #nav-right .nav-button > .site-page,
#page-header:not(.nav-fixed):not(.not-top-img) #nav #nav-right #toggle-menu > .site-page {
  color: var(--btf-white);
}

#page-header:not(.nav-fixed):not(.not-top-img) #nav #nav-right .nav-button > .site-page:hover,
#page-header:not(.nav-fixed):not(.not-top-img) #nav #nav-right #toggle-menu > .site-page:hover {
  background: var(--btf-header-white-op, rgba(255, 255, 255, .2));
  box-shadow: none;
  color: var(--btf-white) !important;
}

/* 滚动后 / 无头图页面：右侧按钮区显示玻璃胶囊底。 */
#page-header.nav-fixed #nav #nav-right,
#page-header.not-top-img #nav #nav-right {
  background: linear-gradient(to bottom, var(--btf-mask-bg), var(--btf-mask-bg-deep));
  box-shadow: var(--btf-shadow-glass, none);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

/* 导航按钮气泡提示：对齐 Solitude .custom-tooltip */
.btf-tooltip {
  position: fixed;
  z-index: 9999;
  display: none;
  max-width: 200px;
  padding: 8px 12px;
  border: var(--btf-border-width) solid var(--btf-card-border);
  border-radius: 12px;
  background: var(--btf-mask-bg-deep);
  box-shadow: var(--btf-shadow-border);
  color: var(--btf-font-color);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s;
}

/* 移动端：保留随机文章与搜索，隐藏返回顶部，避免挤占汉堡按钮。 */
@media (max-width: 768px) {
  #nav > #nav-group {
    /* 左侧不留白：#nav 有 16px 内边距，卡片左边距 15px，差 1px 忽略。 */
    padding: 0 12px 0 0;
  }

  #nav #menus {
    display: none;
  }

  #nav #blog-info {
    position: static;
    flex: 0 1 auto;
    min-width: 0;
    width: fit-content;
    max-width: calc(100% - 132px);
    padding: 0 10px;
    border-radius: 99px;
    overflow: hidden;
    background: transparent;
    box-shadow: none;
    transition: background-color .3s, box-shadow .3s;
  }

  /* 移动端头像保持圆形（去掉内边距后主题的圆形样式不再命中） */
  #nav #blog-info .site-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
  }

  #nav #blog-info .nav-site-title {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 35px;
    border-radius: 40px;
    overflow: hidden;
    transition: background-color .3s;
  }

  /* 移动端没有 hover：首页图标默认压在站名底下不显示，按住胶囊时才淡入。
     这段定位/透明度之前只写在 ≥769px 里，移动端图标会掉回文档流，
     和站名并排粘在一起（就是截图上「春煦景明🏠」的样子）。 */
  #nav #blog-info .nav-site-title > i.fas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 18px;
    line-height: 1;
    color: inherit;
    opacity: 0;
    transition: opacity .3s;
  }

  #nav #blog-info .nav-site-title > span.site-name {
    transition: opacity .3s;
  }

  /* 按住时给一层薄底，和桌面端的 hover 是同一套观感 */
  #nav #blog-info .nav-site-title:active {
    background: var(--btf-header-white-op, rgba(255, 255, 255, .22));
  }

  /* 按住时不要 iOS 默认的灰色方块高亮，否则会盖住刚浮现的首页图标 */
  #nav #blog-info .nav-site-title {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }

  #nav #blog-info .nav-site-title:active > span.site-name {
    opacity: 0;
  }

  #nav #blog-info .nav-site-title:active > i.fas {
    opacity: 1;
  }

  #nav #blog-info .site-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 右侧按钮胶囊贴到 #nav-group 的右边界（即 #nav 的 16px 内边距处），
     和左侧站名胶囊的左边界对称。
     原来写 right:12px，等于在 #nav 的 16px 之外又叠了 #nav-group 的 12px 右内边距，
     实际离屏幕右沿 28px，比左边多出 12px。 */
  #nav #nav-right {
    right: 0;
  }

  /* 滚动后 / 无头图页面：不再铺满整条导航的浅色玻璃带，
     改成和桌面端一致的「左侧站名胶囊 + 右侧按钮胶囊」两颗悬浮胶囊。
     原来这条透明处理只写在 ≥769px 里，移动端会留下一条贯穿全屏的底色。 */
  #page-header.nav-fixed > #nav,
  #page-header.not-top-img > #nav {
    background: transparent !important;
    box-shadow: none !important;
    border-bottom: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  #page-header.nav-fixed #nav #blog-info,
  #page-header.not-top-img #nav #blog-info {
    background: linear-gradient(to bottom, var(--btf-mask-bg), var(--btf-mask-bg-deep));
    box-shadow: none;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
  }

  /* 窄屏空间不足时隐藏随机文章，保证品牌、搜索和菜单不重叠。 */
  @media (max-width: 480px) {
    #nav #nav-right #random-post-button {
      display: none;
    }

    #nav #blog-info {
      max-width: calc(100% - 116px);
    }
  }

  #nav #nav-right #nav-totop {
    display: none;
  }

  #page-header #nav #nav-right #toggle-menu {
    display: flex !important;
  }
}

/* 左侧品牌胶囊（对齐 Solitude #blog_name） */
@media (min-width: 769px) {
  #nav #blog-info {
    position: absolute;
    /* 与主内容卡片左边界对齐：#nav-group 与 .layout 同宽同起点，
       卡片还有 .layout 的 15px 左内边距，所以这里取 15px。
       之前写死 24px 会比卡片右移 9px，视觉上“没左对齐”。 */
    left: 15px;
    z-index: 102;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: flex-start;
    height: 44px;
    /* 上下环约 4.5px（44 - 35 再平分），左右也收到 5px，
       与文章标题胶囊 hover 内圈的 5px 同心环保持一致 */
    padding: 2px 5px;
    border-radius: 99px;
    transition: background-color .3s, box-shadow .3s, backdrop-filter .3s;
  }

  #nav #blog-info .nav-site-title {
    display: flex;
    align-items: center;
    height: 35px;
    padding: 0 6px;
    border-radius: 40px;
  }

  #nav #blog-info .site-icon {
    height: 26px;
    margin-right: 8px;
    border-radius: 50%;
    vertical-align: middle;
  }

  #nav #blog-info .site-name {
    color: var(--btf-font-color);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    text-shadow: none;
    white-space: nowrap;
  }

  /* Butterfly 在 nav-fixed 下把 #blog-info 宽度压到 20px，这里恢复自适应 */
  #page-header.nav-fixed #nav #blog-info {
    width: auto;
  }

  #page-header.nav-fixed #nav #blog-info,
  #page-header.not-top-img #nav #blog-info {
    background: linear-gradient(to bottom, var(--btf-mask-bg), var(--btf-mask-bg-deep));
    box-shadow: none;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
  }

  #page-header.nav-fixed #nav #blog-info .site-name,
  #page-header.not-top-img #nav #blog-info .site-name {
    color: var(--btf-font-color);
  }

  /* Butterfly 在 nav-fixed 时会隐藏站点标题，这里保留它（Solitude 始终显示） */
  #page-header.nav-fixed #nav #blog-info > a:first-child {
    display: flex;
  }

  .post #page-header.post-bg:not(.not-top-img):not(.nav-fixed) #nav #blog-info {
    background: transparent;
    box-shadow: none;
  }

  .post #page-header.post-bg:not(.not-top-img):not(.nav-fixed) #nav #blog-info .site-name {
    color: var(--btf-white);
  }

  /* 其它带顶部图的页面（标签/分类/归档等）在页面顶部同样用白字 */
  #page-header:not(.nav-fixed):not(.not-top-img) #nav #blog-info .site-name {
    color: var(--btf-white);
  }

  /* 左侧站点胶囊：对齐 Solitude #site-name
     常态显示 Logo + 站名，鼠标移上去后 Logo/站名淡出、首页图标淡入。 */
  #nav #blog-info .nav-site-title {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 35px;
    min-width: 50px;
    padding: 0 8px;
    border-radius: 40px;
    transition: background-color .3s;
  }

  #nav #blog-info .nav-site-title > img.site-icon,
  #nav #blog-info .nav-site-title > span.site-name {
    transition: opacity .3s;
  }

  #nav #blog-info .nav-site-title > i.fas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 20px;
    line-height: 1;
    color: inherit;
    opacity: 0;
    transition: opacity .3s;
  }

  /* 带顶部图的页面，首页图标同样用白字 */
  #page-header:not(.nav-fixed):not(.not-top-img) #nav #blog-info .nav-site-title > i.fas {
    color: var(--btf-white);
  }

  @media screen and (min-width: 900px) {
    /* 与右侧「随机一篇文章」等按钮的 hover 完全同源：
       同样用封面提取的 --btf-header-theme 打底 + 同一层阴影 + 白色图标，
       不另用 --btf-theme（饱和蓝会和右侧的雾蓝对不上）。 */
    #nav #blog-info .nav-site-title:hover {
      background: var(--btf-header-theme, var(--btf-theme));
      box-shadow: 0 8px 12px -3px var(--btf-header-theme-op, var(--btf-theme-op));
    }

    #nav #blog-info .nav-site-title:hover > img.site-icon,
    #nav #blog-info .nav-site-title:hover > span.site-name {
      opacity: 0;
    }

    #nav #blog-info .nav-site-title:hover > i.fas {
      color: var(--btf-nav-hover-text);
      opacity: 1;
    }
  }

  /* 顶部有头图时：悬停用白色薄底，首页图标保持白色（对齐右侧按钮行为） */
  #page-header:not(.nav-fixed):not(.not-top-img) #nav #blog-info .nav-site-title:hover {
    background: var(--btf-header-white-op, rgba(255, 255, 255, .2));
  }

  #page-header:not(.nav-fixed):not(.not-top-img) #nav #blog-info .nav-site-title:hover > i.fas {
    color: var(--btf-white);
  }

  /* 居中文章标题胶囊（对齐 Solitude #page-name） */
  #nav > .nav-page-title {
    position: absolute;
    top: 8px;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: calc(100vw - 420px);
    height: 44px;
    padding: 0 16px;
    overflow: hidden;
    border-radius: 99px;
    background: linear-gradient(to bottom, var(--btf-mask-bg), var(--btf-mask-bg-deep));
    box-shadow: var(--btf-shadow-glass, none);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    /* 给 ::before 的悬停染色层单独建层叠上下文，否则负层级会掉到胶囊背后 */
    isolation: isolate;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) scale(1.1);
    transition: top .3s, transform .3s, opacity .3s, box-shadow .3s;
  }

  /* 悬停染色层：直接用右侧「随机一篇文章」按钮 hover 的同一个色
     --btf-header-theme，两者背景色完全一致。
     常态是 linear-gradient（background-image 无法做颜色过渡），
     所以叠一层纯色、只动 opacity，才能平滑地"染"上去而不闪一下。

     四周用同一个 5px（原来是上下 4 / 左右 10，左右比上下宽一倍）：
     胶囊两端是半圆，只有四边等距，同心环看起来才均匀，不会左右像被拉长。
     外圈露出常态玻璃渐变、内圈染色，和左上角品牌胶囊的双层结构同一路子。

     注意这颗胶囊只在 nav-fixed（滚动后）出现，此时它悬在玻璃导航 / 正文上方，
     而不是页面顶部那张同色头图上，所以不存在"染成封面色就融进背景"的问题。 */
  #nav > .nav-page-title::before {
    content: '';
    position: absolute;
    inset: 5px;
    z-index: -1;
    border-radius: inherit;
    background: var(--btf-header-theme, var(--btf-theme));
    opacity: 0;
    transition: opacity .3s;
  }

  #nav > .nav-page-title:hover {
    box-shadow: 0 8px 12px -3px var(--btf-header-theme-op, var(--btf-theme-op));
  }

  #nav > .nav-page-title:hover::before {
    opacity: 1;
  }

  #nav > .nav-page-title > .site-name {
    position: static;
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: var(--btf-font-color);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 1;
    transform: none;
    transition: color .3s;
  }

  /* 主题对首/末子元素有悬停淡出规则，这里锁定标题始终显示；
     同时把字色翻成白色，和随机文章按钮 hover 时的白色图标一致 */
  #nav > .nav-page-title:hover > .site-name {
    color: var(--btf-nav-hover-text);
    opacity: 1;
    transform: none;
  }

  /* Butterfly 默认 display:none，这里按 Solitude 的滚动状态显示 */
  #page-header.nav-fixed #nav > .nav-page-title {
    display: flex;
  }

  #page-header.nav-fixed:not(.nav-visible) #nav > .nav-page-title {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) scale(1);
  }
}

/* ---------- 4.4 页脚 ---------- */

/* 通栏色块 + 顶部一条主题色细线收尾；
   内部 .footer-inner 与正文等宽，左品牌右信息，中间一条竖向分隔线。
   所有元素都是原有的（站名 / 版权 / 字数 / 运行时间 / 框架 / 一句话），只重排 + 加层级。 */

#footer {
  position: relative;
  background-color: var(--btf-footer-bg) !important;
  background-image: none !important;
  border-top: var(--btf-border);
  padding: 0;
}

#footer::before {
  display: none !important;
}

#footer .footer-wrap {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

#footer .footer-inner {
  max-width: var(--btf-layout-width);
  margin: 0 auto;
  padding: 30px 15px 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px 48px;
  color: var(--btf-second-text);
  font-size: 0.8rem;
  line-height: 1.6;
}

/* ---- 左：品牌 + 版权 + 字数 ---- */
#footer .footer-main {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

#footer .footer-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 14px;
}

#footer .footer-title {
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .2px;
  color: var(--btf-font-color);
}

#footer .footer-copyright {
  font-size: 0.78rem;
  color: var(--btf-second-text);
  opacity: .9;
}

/* 字数：数字做成主题色小徽章，比原来整句同色更好读 */
#footer .footer-wordcount {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--btf-second-text);
}

#footer .footer-wordcount-prefix,
#footer .footer-wordcount-suffix {
  color: var(--btf-second-text);
}

#footer .footer-wordcount-num {
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--btf-theme-op-light);
  color: var(--btf-theme);
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

#footer .footer-wordcount-note {
  color: var(--btf-second-text);
  opacity: .85;
}

/* ---- 中：今日宜忌（居中，每天换一组，纯前端算） ---- */
#footer .footer-today {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  max-width: 420px;
  text-align: center;
}

#footer .footer-today-date {
  font-size: 0.72rem;
  letter-spacing: .4px;
  color: var(--btf-second-text);
  opacity: .8;
  font-variant-numeric: tabular-nums;
}

#footer .footer-today-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

#footer .footer-today-yi,
#footer .footer-today-ji {
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 0.74rem;
  line-height: 1.7;
  text-align: center;
}

/* 宜 / 忌 沿用黄历习惯：宜绿忌红，低饱和不抢眼 */
#footer .footer-today-yi {
  background: rgba(46, 143, 110, .1);
  color: #2e8f6e;
}

#footer .footer-today-ji {
  background: rgba(217, 83, 79, .09);
  color: #c9504c;
}

[data-theme="dark"] #footer .footer-today-yi {
  background: rgba(84, 195, 156, .14);
  color: #54c39c;
}

[data-theme="dark"] #footer .footer-today-ji {
  background: rgba(255, 122, 122, .14);
  color: #ff8b8b;
}

/* ---- 右：运行时间 / 框架版本 / 一句话 ---- */
#footer .footer-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-size: 0.78rem;
}

#footer .footer-runtime,
#footer .footer-meta,
#footer .footer-custom {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

#footer .footer-ico {
  font-size: 11px;
  opacity: .5;
}

#footer .footer-runtime-label {
  color: var(--btf-second-text);
}

#footer .footer-runtime-value {
  color: var(--btf-theme);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .2px;
}

#footer .footer-meta,
#footer .footer-custom {
  color: var(--btf-second-text);
}

#footer .footer-separator {
  margin: 0 1px;
  opacity: .55;
}

#footer a {
  color: var(--btf-second-text);
  transition: color var(--btf-transition);
}

#footer a:hover {
  color: var(--btf-theme) !important;
}

/* 宽屏：左右两栏之间加一条竖向分隔线 */
@media screen and (min-width: 900px) {
  /* 右下角的悬浮按钮会压到页脚，这里留出安全距离 */
  #footer .footer-inner {
    padding-right: 70px;
  }

}

@media screen and (max-width: 768px) {
  #footer .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding: 24px 15px 28px;
  }

  #footer .footer-side {
    align-items: flex-start;
    padding-left: 0;
    border-left: 0;
  }
}

/* ---------- 4.5 文章正文 ---------- */

#article-container a,
.container a {
  color: var(--btf-theme);
}

#article-container a:hover,
.container a:hover {
  color: var(--btf-theme);
  text-decoration: underline;
}

.container .flink a,
.container .flink a:hover,
.container .flink .flink-item-name,
.container .flink .flink-item-desc {
  color: var(--btf-font-color);
  text-decoration: none;
}

.container code:not([class*="language-"]):not(.hljs) {
  padding: .4em;
  border: var(--btf-border);
  border-radius: 4px;
  background: var(--btf-card-bg);
  color: var(--btf-font-color);
  box-shadow: none;
  font-size: 12px;
  line-height: 1.5;
}

.container pre > code {
  background: transparent;
  border: none;
  padding: 0;
}

.container blockquote {
  margin: .5rem 0;
  padding: .5rem .8rem;
  border: var(--btf-border);
  border-radius: var(--btf-radius-sm);
  background: var(--btf-second-bg);
  color: var(--btf-second-text);
}

.container table thead {
  background: var(--btf-second-bg);
}

.container table,
.container th,
.container td {
  border-color: var(--btf-card-border);
}

.container kbd {
  border: var(--btf-border);
  border-radius: 4px;
  background: var(--btf-second-bg);
  color: var(--btf-font-color);
  box-shadow: none;
}

/* ---------- 4.5.1 时间轴（{% timeline %} 标签）---------- */
/* Butterfly 给节点圆圈描边用的是全局 --pseudo-hover，而本站
   theme_color.button_hover 被设成了主色蓝，于是「橙色时间轴」会变成
   「橙色竖线 + 蓝色圆点」，而且鼠标悬停时圆点还会再变一次蓝。
   这里让圆圈跟随时间轴自身的颜色 --timeline-color，与竖线、内容块保持一致。 */
.container .timeline .timeline-item .item-circle::before {
  border-color: var(--timeline-color, var(--btf-theme));
}

.container .timeline .timeline-item.headline:hover .item-circle::before {
  border-color: var(--timeline-color, var(--btf-theme));
}

/* ---------- 4.6 文章信息 / 版权 / 标签 ---------- */

#post > #post-info #post-meta,
#post > #post-info #post-meta a {
  color: var(--btf-second-text);
}

#post .tag_share .post-meta__tags {
  border-color: var(--btf-theme);
  color: var(--btf-theme);
}

#post .tag_share .post-meta__tags:hover {
  background: var(--btf-theme);
  border-color: var(--btf-theme);
  color: var(--btf-nav-hover-text);
}

/* 版权卡整套样式移到 post.css 里维护（结构已改为标题 + 四列信息） */

/* ---------- 4.7 分页 ---------- */

.layout .pagination > *:not(.space) {
  background: var(--btf-card-bg);
  border: var(--btf-border);
  border-radius: var(--btf-radius-pill);
  color: var(--btf-font-color);
  box-shadow: none !important;
  transition: border-color var(--btf-transition), color var(--btf-transition);
}

.layout .pagination > *:not(.space):hover {
  background: var(--btf-card-bg);
  border-color: var(--btf-theme);
  color: var(--btf-theme);
}

/* 当前页码：主题在 index.css 里写死了
   #pagination .page-number.current { background: #425aef; }
   （ID + 两个类）。下面这组选择器原本只有三个类，特异性不够、一直没生效：
   亮色下 #425aef 刚好等于主题色，看不出问题；深色下主题色变黄，就会残留蓝色。
   前缀 #pagination 把特异性抬到 ID + 三个类，压过主题那条，
   颜色重新走令牌 —— 亮色 #425AEF / 深色 #ffc848，与导航胶囊、信息卡按钮同源。 */
#pagination .pagination .page-number.current,
#pagination .pagination .page-number.current:hover {
  background: var(--btf-theme);
  border-color: var(--btf-theme);
  color: var(--btf-nav-hover-text);
  box-shadow: none;
}

/* ---------- 4.8 按钮 / 右下角工具栏 ---------- */

#aside-content .card-info #card-info-btn {
  background: var(--btf-theme);
  color: var(--btf-nav-hover-text);
  box-shadow: none;
}

#aside-content .card-info #card-info-btn:hover {
  background: var(--btf-theme-op-deep);
  color: var(--btf-nav-hover-text);
  box-shadow: none !important;
}

#rightside > div > button,
#rightside > div > a {
  box-shadow: none;
}

#rightside > div > button:hover,
#rightside > div > a:hover {
  color: var(--btf-nav-hover-text) !important;
  box-shadow: none !important;
}

/* ---------- 4.9 侧栏 / 目录 / 标签云 ---------- */

#aside-content #card-toc .toc-link {
  color: var(--btf-toc-link-color, var(--btf-second-text));
  border-radius: var(--btf-radius-sm);
}

#aside-content #card-toc .toc-link:hover {
  color: var(--btf-theme);
}

#aside-content #card-toc .toc-link.active {
  background: var(--btf-theme-op);
  color: var(--btf-theme);
}

/* 目录隐藏滚动条：保留滚轮 / 触控板 / 触摸滚动，只是不显示轨道 */
#aside-content #card-toc .toc-content {
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* 旧版 Edge / IE */
}

#aside-content #card-toc .toc-content::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none; /* Chrome / Edge / Safari */
}

#aside-content .site-data a:hover div,
#aside-content .aside-list .content .title:hover,
#aside-content .aside-list .content .name:hover {
  color: var(--btf-theme) !important;
}

#aside-content .aside-list > .aside-list-item:not(:last-child) {
  border-bottom: 1px dashed var(--btf-card-border);
}

#aside-content .card-archives ul.card-archive-list > .card-archive-list-item a:hover,
#aside-content .card-categories ul.card-category-list > .card-category-list-item a:hover {
  background: var(--btf-theme-op);
  color: var(--btf-theme);
}

#aside-content .card-tags .card-tag-cloud {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 5px;
}

#aside-content .card-tags .card-tag-cloud a {
  padding: 0 .3rem;
  font-size: 14px;
  line-height: 1.9;
  font-weight: 400;
  color: var(--btf-font-color);
  border-radius: 8px;
  transition: all .3s;
}

#aside-content .card-tags .card-tag-cloud a:hover {
  background: var(--btf-theme);
  color: var(--btf-nav-hover-text) !important;
}

/* {% checkbox %} / {% radio %} 标签样式 —— 与思源任务列表共用一套皮肤
   移植自 hexo-butterfly-tag-plugins-plus 的 checkbox 样式。

   设计取向（2026-11-15 重定）：
     · 未选中：灰色细描边 + 4px 圆角，安静地待在文字左边，不抢正文注意力
     · 选中：整块填色（默认主题色；写了 red / green / … 就用自己的色）+ 白勾
     · 颜色只收在 --cb-color 一个变量里：描边、选中底色、+ − × 图形都取它，
       所以加一种颜色 = 改一个变量，勾和图形自动跟上

   一条规则两个选择器，就是这套"共用皮肤"的做法：
     .checkbox > input …                             ← 外挂标签 {%% checkbox %%}
     :where(#article-container li:has(…)) > input …   ← 思源任务列表 - [ ]
   marked 把 - [ ] 渲染成 <li><input disabled type="checkbox">文字</li>，
   既不给 class 也去不掉圆点，只能按结构选（去圆点、排两列在 post.css 里做）。
   皮肤只有这一份：文章里无论走标签还是走 markdown，出来的都是同一个方框。

   为什么任务列表那半边套 :where() 而不是 :is()：:is() 会把里面最狠的选择器
   （#article-container）的优先级算进来，一算进来就压过 .checkbox.red 这些颜色
   修饰类，所有方框全变主题色。:where() 一律算 0 优先级，才不会喧宾夺主。 */

.checkbox,
.radio {
  display: flex;
  /* 长文字折行时方框留在第一行（原来 center 会把方框吊到整段中间） */
  align-items: flex-start;
  margin: 4px 0;
}

.checkbox > input,
.radio > input,
:where(#article-container li:has(> input[type="checkbox"])) > input {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  /* 写死 border-box：方框的 16px 是含描边的外廓，里面永远剩 13px。
     不写的话在不同页面上可能被主题的 * 选择器 / 无重置的预览页算出两种盒模型，
     短条和勾的居中坐标就会飘。 */
  box-sizing: border-box;
  height: 16px;
  width: 16px;
  transition: all .15s ease-out 0s;
  cursor: pointer;
  display: inline-block;
  outline: none;
  flex-shrink: 0;
  /* 正文行高 2、1em=16px 时行盒 32px，方框 16px，
     与首行文字垂直居中的偏移就是 (32 - 16) / 2 = 8px */
  margin: .5em 8px 0 0;
  pointer-events: none;
}

.checkbox > input[type="checkbox"],
:where(#article-container li:has(> input[type="checkbox"])) > input[type="checkbox"] {
  /* 两个变量管住整只方框：
       --cb-color 未选中时的描边（默认灰，写 .red 等就换成那个色）
       --cb-fill  选中后填的底色（默认站点主题色）
     颜色修饰类两个一起改，所以"红叉""绿加号"永远同色。 */
  --cb-color: var(--btf-gray);
  --cb-fill: var(--btf-theme);
  border: 1.5px solid var(--cb-color);
  border-radius: 4px;
}

/* 选中态：整块填色 + 居中的白色勾。
   勾用内联 SVG 而不是原来那两根绝对定位的短条 —— 短条要一点点凑 left/top，
   换个描边粗细或方框尺寸就跑偏（放大看会明显偏左上角）；SVG 交给
   background-position: center，方框变成 18px 或圆角改成 6px 都不用再调。
   尺寸：viewBox 16 格、勾本身占 10 格，占内宽 13px 的九成、约 8.7px 宽（笔帽再撑一点）——
   之前 74% 配 24 格 viewBox，实际只有 6.8px，所以看着小。 */

/* 先填色（所有复选框都走这条） */
.checkbox > input[type="checkbox"]:is(:checked, [checked]),
:where(#article-container li:has(> input[type="checkbox"])) > input[type="checkbox"]:is(:checked, [checked]) {
  border-color: var(--cb-fill);
  background-color: var(--cb-fill);
}

/* 再贴勾 —— 但 plus / minus / times 例外：它们自己用伪元素画符号，
   贴了勾就成了「勾 + 符号」两层叠在一起（放大看是一团糊的）。
   所以这里用 :not() 把三种符号变体排除掉。 */
.checkbox:not(.plus, .minus, .times) > input[type="checkbox"]:is(:checked, [checked]),
:where(#article-container li:has(> input[type="checkbox"])) > input[type="checkbox"]:is(:checked, [checked]) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.4l3.4 3.4L13 4.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 90%;
}

/* 暗色主题里站点主题色是亮黄 #ffc848，白勾压在上面对比度只有 1.7:1，
   换个深色勾。只对"没写颜色、也不是符号变体"的方框生效 —— 写了 red/green
   之类底色是那个颜色，白勾该留着；符号变体压根不贴勾。 */
[data-theme="dark"] :is(.checkbox, #article-container li:has(> input[type="checkbox"])):not(.red, .green, .yellow, .cyan, .blue):not(.plus, .minus, .times) > input[type="checkbox"]:is(:checked, [checked]) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%231b1c20' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.4l3.4 3.4L13 4.6'/%3E%3C/svg%3E");
}

.radio input[type="radio"] {
  border-radius: 50%;
  border: 2px solid var(--btf-theme);
}

.radio input[type="radio"]:before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin: 2px;
  background: var(--btf-theme);
  transform: scale(0);
  transition: all .25s ease-out;
}

.radio input[type="radio"]:checked:before {
  transform: scale(1);
}

/* 颜色修饰类：只改 --cb-color 一个变量。
   描边、选中底色、+ − × 图形都取这个变量，所以一条声明就够；
   不写颜色时是灰色（见上面 --cb-color 的默认值），跟正文一样安静。
   给 .radio 补 border-color：它的描边是 2px 主题色，不吃 --cb-color。 */
.checkbox.red > input,
.radio.red > input {
  --cb-color: #fe5f58;
  --cb-fill: #fe5f58;
  border-color: #fe5f58;
}

.checkbox.green > input,
.radio.green > input {
  --cb-color: #3dc550;
  --cb-fill: #3dc550;
  border-color: #3dc550;
}

.checkbox.yellow > input,
.radio.yellow > input {
  --cb-color: #ffbd2b;
  --cb-fill: #ffbd2b;
  border-color: #ffbd2b;
}

.checkbox.cyan > input,
.radio.cyan > input {
  --cb-color: #1bcdfc;
  --cb-fill: #1bcdfc;
  border-color: #1bcdfc;
}

.checkbox.blue > input,
.radio.blue > input {
  --cb-color: #2196f3;
  --cb-fill: #2196f3;
  border-color: #2196f3;
}

/* 标签文字：markdown 会再包一层 <p>，这里压掉它的默认间距。
   原来靠 margin-top: 2px 去凑对齐，现在方框自己带 .5em 上边距，
   <p> 归零才正好顶到同一行。 */
.checkbox p,
.radio p {
  display: inline-block;
  margin: 0 !important;
}

/* plus / minus / times：把勾换成 + − ×
   这份移植原来漏了这三种变体，写了也只有普通的勾。图形用两根 2px 短条拼，
   不额外引图：未选中时用 --cb-color 画（默认灰、写了颜色就是那个色），
   选中后填色块、图形转白。

   几何全部用 left/right（或 top/bottom）互相撑开，不写死长度：
   方框内宽是 16 - 1.5×2 = 13px，±2px 内缩后短条自动居中。
   这样改方框尺寸、改描边粗细都不用回来重算坐标。 */
.checkbox:is(.plus, .minus, .times) > input[type="checkbox"]:before,
.checkbox:is(.plus, .minus, .times) > input[type="checkbox"]:after {
  content: "";
  position: absolute;
  background: var(--cb-color);
  transition: none;
}

.checkbox.plus > input[type="checkbox"]:before {
  top: 5.5px;
  left: 2px;
  right: 2px;
  width: auto;
  height: 2px;
  transform: none;
}

.checkbox.plus > input[type="checkbox"]:after {
  top: 2px;
  bottom: 2px;
  left: 5.5px;
  width: 2px;
  height: auto;
  transform: none;
}

.checkbox.minus > input[type="checkbox"]:before {
  top: 5.5px;
  left: 2px;
  right: 2px;
  width: auto;
  height: 2px;
  transform: none;
}

.checkbox.minus > input[type="checkbox"]:after {
  display: none;
}

.checkbox.times > input[type="checkbox"]:before {
  top: 5.5px;
  left: 1.5px;
  right: 1.5px;
  width: auto;
  height: 2px;
  transform: rotate(45deg);
}

.checkbox.times > input[type="checkbox"]:after {
  top: 5.5px;
  left: 1.5px;
  right: 1.5px;
  width: auto;
  height: 2px;
  transform: rotate(-45deg);
}

.checkbox:is(.plus, .minus, .times) > input[type="checkbox"]:is(:checked, [checked]):before,
.checkbox:is(.plus, .minus, .times) > input[type="checkbox"]:is(:checked, [checked]):after {
  background: #fff;
}

/* 暗色 + 没写颜色：底色是亮黄 #ffc848，白图形看不清，换深色（同勾的处理） */
[data-theme="dark"] .checkbox:is(.plus, .minus, .times):not(.red, .green, .yellow, .cyan, .blue) > input[type="checkbox"]:is(:checked, [checked]):before,
[data-theme="dark"] .checkbox:is(.plus, .minus, .times):not(.red, .green, .yellow, .cyan, .blue) > input[type="checkbox"]:is(:checked, [checked]):after {
  background: #1b1c20;
}

#sidebar-menus {
  background: var(--btf-sidebar-bg);
}

#sidebar-menus .menus_items {
  background: var(--btf-card-bg);
  border: var(--btf-border);
  box-shadow: none;
}

#sidebar-menus .menus_items .site-page:hover {
  background: var(--btf-theme-op);
  color: var(--btf-theme);
  box-shadow: none;
}

/* ---------- 4.10 搜索 ---------- */

.search-dialog {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: none;
  flex-direction: column;
  gap: 16px;
  margin: auto;
  padding: 1rem;
  width: 30rem;
  height: fit-content;
  max-height: 90dvh;
  overflow: hidden;
  background: var(--btf-card-bg);
  border: var(--btf-border);
  border-radius: 12px;
  box-shadow: var(--btf-shadow-lightblack);
  transition: border-color var(--btf-transition), box-shadow var(--btf-transition);
  animation: btf-search-slide-in .6s ease 0s 1 normal none running;
}

.search-dialog:hover {
  border-color: var(--btf-theme);
  box-shadow: var(--btf-shadow-theme);
}

@keyframes btf-search-slide-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-dialog .search-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-dialog .search-dialog-title {
  color: var(--btf-theme);
  font-size: 1.4em;
  font-weight: 700;
  line-height: 1;
}

.search-dialog #loading-status[hidden] {
  display: none !important;
}

.search-dialog .search-nav .search-close-button {
  display: inline-flex;
  flex: 0 0 32px;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: auto;
  padding: 4px;
  color: var(--btf-gray);
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 1.4em;
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease-in-out, background .2s ease-in-out;
}

.search-dialog .search-nav .search-close-button:hover {
  color: var(--btf-theme);
  background: var(--btf-theme-op);
}

.search-dialog .search-nav .search-close-icon {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-dialog .search-nav .search-close-icon::before,
.search-dialog .search-nav .search-close-icon::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.search-dialog .search-nav .search-close-icon::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.search-dialog .search-nav .search-close-icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.search-dialog .search-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: hidden;
}

.search-dialog .search-box {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.search-dialog .search-box input,
.search-dialog .local-search-input input,
.search-dialog #algolia-search-input input,
.search-dialog .ais-SearchBox-input {
  width: 100%;
  height: 44px;
  padding: .25rem .7rem;
  outline: 0;
  color: var(--btf-font-color);
  background: var(--btf-second-bg);
  border: var(--btf-border);
  border-radius: 12px;
  caret-color: var(--btf-theme);
  -webkit-appearance: none;
}

.search-dialog .search-box input:focus,
.search-dialog .local-search-input input:focus,
.search-dialog #algolia-search-input input:focus,
.search-dialog .ais-SearchBox-input:focus {
  border-color: var(--btf-theme);
}

.search-dialog .search-box input::placeholder,
.search-dialog .local-search-input input::placeholder,
.search-dialog #algolia-search-input input::placeholder,
.search-dialog .ais-SearchBox-input::placeholder {
  color: var(--btf-gray);
  opacity: .8;
}

.search-dialog #search-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-dialog #search-suggestions[hidden] {
  display: none;
}

.search-dialog #search-suggestions .tag-list {
  min-height: 30px;
  padding: 3px 8px;
  color: var(--btf-font-color);
  background: transparent;
  border: var(--btf-border);
  border-radius: 8px;
  line-height: 1.2;
  cursor: pointer;
  transition: color .2s ease-in-out, background .2s ease-in-out, border-color .2s ease-in-out;
}

.search-dialog #search-suggestions .tag-list:hover,
.search-dialog #search-suggestions .tag-list:focus-visible {
  color: var(--btf-white);
  background: var(--btf-theme);
  border-color: var(--btf-theme);
  outline: 0;
}

.search-dialog #search-results {
  display: flex;
  flex-direction: column;
  flex: 1;
  max-height: calc(90dvh - 250px);
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.search-dialog #search-results[hidden] {
  display: none;
}

.search-dialog #search-results .search-result-item {
  width: 100%;
  padding-left: 0;
  font-weight: 700;
  line-height: 1.5;
}

.search-dialog #search-results .search-result-title {
  position: relative;
  display: block;
  width: 100%;
  padding: 3px 0;
  overflow: hidden;
  color: var(--btf-font-color);
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: color .2s ease-in-out;
}

.search-dialog #search-results .search-result-title:hover {
  color: var(--btf-hovertext);
}

.search-dialog #search-results .search-result-title em,
.search-dialog #search-results .search-result-title .search-keyword {
  color: var(--btf-theme);
  font-style: normal;
}

.search-dialog #search-results .search-result-empty,
.search-dialog #search-results .search-result-error,
.search-dialog #search-results .search-result-loading {
  color: var(--btf-second-text);
}

.search-dialog #search-pagination:empty {
  display: none;
}

.search-dialog #search-pagination .pagination-list {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.search-dialog #search-pagination .pagination-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0;
  color: var(--btf-font-color);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.search-dialog #search-pagination .pagination-button:hover {
  color: var(--btf-theme);
}

.search-dialog #search-pagination .pagination-button.select {
  color: var(--btf-white);
  background: var(--btf-theme);
  cursor: default;
}

.search-dialog #search-tips {
  width: 100%;
  color: var(--btf-second-text);
}

.search-dialog #search-tips:empty {
  display: none;
}

.search-dialog #search-tips .search-result-count {
  color: var(--btf-gray);
  font-size: 12px;
}

.search-dialog #search-tips .search-result-count b {
  color: var(--btf-theme);
}

.search-dialog #loading-database {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--btf-second-text);
}

.search-dialog #loading-database span {
  margin-left: 8px;
}

#search-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  background: var(--btf-mask-bg-deep);
  transform: translateZ(0);
}

html.search-open {
  overflow: hidden;
}

@media screen and (max-width: 767px) {
  .search-dialog {
    inset: 0;
    width: 100vw;
    height: var(--search-height, 100dvh);
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 1rem;
    border: 0;
    border-radius: 0;
    animation: none;
  }

  .search-dialog:hover {
    border: 0;
    box-shadow: var(--btf-shadow-lightblack);
  }

  .search-dialog .search-wrap {
    flex: 1;
    min-height: 0;
  }

  .search-dialog #search-results {
    max-height: none;
    flex: 1;
    min-height: 0;
  }
}

/* ---------- 4.11 标签页 / 分类页 ---------- */

/* 标签云：白底圆角胶囊 + 彩色文字（标签名颜色随机，数字为文章数） */
.tag-cloud-list.is-center {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  flex-direction: row;
  margin: 0 0 1em;
}

/* 标签页 / 分类页去掉卡片外壳，内容直接铺在页面背景上并占满可用宽度 */
#body-wrap.type-tags #content-inner.layout,
#body-wrap.type-categories #content-inner.layout {
  max-width: var(--btf-layout-width);
}

#body-wrap.type-tags #content-inner.layout > #page.nc,
#body-wrap.type-categories #content-inner.layout > #page.nc {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  padding: 0;
}

/* ---------- 标签页（/tags/）标签云：仿 Solitude ---------- */
/* 白底描边胶囊 + 淡色 # 前缀 + 独立的计数徽章，不用随机配色 */
#page .category-lists {
  padding: 1rem 0 1.5rem;
}

.tag-cloud-list.is-center {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
}

.tag-cloud-list a {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: fit-content;
  padding: .2em .5em;
  background: var(--btf-card-bg);
  border: 1px solid var(--btf-card-border);
  border-radius: 12px;
  box-shadow: 0 8px 16px -4px #2c2d300c;
  color: var(--btf-font-color) !important;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  transition: all .3s ease 0s;
}

.tag-cloud-list a:hover {
  background: var(--btf-theme) !important;
  border-color: var(--btf-theme);
  color: var(--btf-nav-hover-text) !important;
  box-shadow: var(--btf-shadow-theme);
}

/* 悬停单个标签时，其余标签保持原样（覆盖主题「整排变暗 + 缩小」效果） */
.tag-cloud-list:hover a:not(:hover) {
  opacity: 1 !important;
  transform: none !important;
}

.tag-cloud-list .tags-punctuation {
  display: inline-flex;
  align-items: center;
}

/* 右侧独立的计数徽章 */
.tag-cloud-list .tagsPageCount {
  margin-left: 8px;
  padding: 4px 7px;
  border-radius: 8px;
  background: var(--btf-second-bg);
  color: var(--btf-second-text);
  font-size: .7em;
  font-weight: 500;
  line-height: 1;
  text-align: center;
}

/* 悬停时徽章反色：浅色底 + 主题色数字，保证在彩色胶囊上清晰可读 */
.tag-cloud-list a:hover .tagsPageCount {
  background: var(--btf-card-bg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
  color: var(--btf-theme);
  opacity: 1;
}

.card-tag-cloud .tag-cloud-count {
  margin-left: 3px;
  font-size: .62em;
  font-weight: 500;
  line-height: 1;
  vertical-align: super;
  /* 数字跟随标签名颜色，悬停时随标签名一起变白 */
  color: inherit;
}

.card-tag-cloud a:hover .tag-cloud-count {
  color: var(--btf-nav-hover-text);
  opacity: .85;
}

.card-tag-cloud .tag-cloud-count {
  opacity: .6;
}

/* 标签云暗色模式适配（浅底浅边 → 深底深边） */
[data-theme='dark'] .tag-cloud-list a {
  border-color: var(--btf-card-border);
  box-shadow: 0 8px 16px -4px rgba(0, 0, 0, .35) !important;
}

/* ---------- 4.12 友情链接 ---------- */

.flink-list-item a {
  color: var(--btf-font-color);
}

.flink-list-item .flink-item-name,
.flink-list-item .flink-item-desc {
  color: var(--btf-font-color);
}

.flink-list-item::before {
  background: var(--btf-theme);
}

.flink-list-item:hover a,
.flink-list-item:hover .flink-item-name,
.flink-list-item:hover .flink-item-desc {
  color: var(--btf-nav-hover-text);
}

/* ---------- 4.13 说说 ---------- */

#article-container .shuoshuo-date {
  color: var(--btf-second-text);
}

#article-container .shuoshuo-tag {
  border-color: var(--btf-theme);
  color: var(--btf-theme);
}

#article-container .shuoshuo-tag:hover {
  background: var(--btf-theme);
  color: var(--btf-nav-hover-text);
}

#article-container .shuoshuo-comment-btn:hover {
  color: var(--btf-theme);
}

.shuoshuo-navigation button {
  background: var(--btf-card-btn-bg);
  color: var(--btf-font-color);
}

.shuoshuo-navigation button:hover:not(:disabled) {
  background: var(--btf-theme);
  color: var(--btf-nav-hover-text);
  box-shadow: none;
}

.shuoshuo-navigation button:disabled {
  background: var(--btf-second-bg);
  color: var(--btf-second-text);
  opacity: .5;
}

.shuoshuo-navigation .shuoshuo-page-info {
  color: var(--btf-second-text);
}

.shuoshuo-navigation .shuoshuo-page-input {
  background: var(--btf-second-bg);
  border: var(--btf-border);
  color: var(--btf-font-color);
}

/* ---------- 4.14 代码块 ---------- */

.container figure.highlight {
  background: var(--hl-bg);
  border: var(--btf-border);
  border-radius: var(--btf-radius-sm);
  box-shadow: none !important;
}

.container .highlight-tools {
  background: var(--hltools-bg);
  border-bottom: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

/* ---------- 4.15 仅深色需要的修正 ---------- */

[data-theme="dark"] img:not(.cover) {
  filter: none !important;
}

[data-theme="dark"] #post-comment .comment-switch {
  background: var(--btf-second-bg) !important;
}

/* ==========================================================================
   5. 文章头图：对齐 Solitude post header
   ========================================================================== */

/* ---------- 5.1 头图容器 ---------- */

.post #page-header.post-bg:not(.not-top-img) {
  /* 头部底色占位：封面主色要等 custom.js 取到后才替换，
     占位色如果用饱和的主题色，首屏会先闪出一整块蓝。
     这里用低饱和的雾蓝兜底，替换时几乎看不出跳变。 */
  --btf-header-theme: #8fa3bf;
  --btf-header-theme: color-mix(in srgb, var(--btf-theme) 22%, #9fb0c6);
  --btf-header-theme-op: color-mix(in srgb, var(--btf-header-theme) 14%, transparent);
  --btf-header-theme-op-deep: color-mix(in srgb, var(--btf-header-theme) 87%, transparent);
  --btf-header-white-op: rgba(255, 255, 255, .2);
  position: relative;
  height: 470px;
  margin-bottom: 0;
  overflow: hidden;
  background-color: var(--btf-background);
  background-image: none !important;
  transition: .6s;
}

.post #page-header.post-bg:not(.not-top-img)::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  background-color: var(--btf-header-theme);
  content: "";
  opacity: 1;
  transition: background-color .2s ease;
}

.post #page-header.post-bg:not(.not-top-img) #nav {
  z-index: 90;
}

.post #page-header.post-bg:not(.not-top-img):not(.nav-fixed) #nav a,
.post #page-header.post-bg:not(.not-top-img):not(.nav-fixed) #nav span.site-page,
.post #page-header.post-bg:not(.not-top-img):not(.nav-fixed) #nav #toggle-menu,
.post #page-header.post-bg:not(.not-top-img):not(.nav-fixed) #nav #blog-info {
  color: var(--btf-white);
  text-shadow: none;
}

.post #page-header.post-bg:not(.not-top-img):not(.nav-fixed) #nav a:hover,
.post #page-header.post-bg:not(.not-top-img):not(.nav-fixed) #nav span.site-page:hover,
.post #page-header.post-bg:not(.not-top-img):not(.nav-fixed) #nav #toggle-menu:hover {
  color: var(--btf-white) !important;
}

/* ---------- 5.2 左侧文章信息 ---------- */

.post #page-header.post-bg:not(.not-top-img) #post-info {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: var(--btf-layout-width);
  height: calc(100% - 30px);
  margin: 0 auto;
  padding: 0 30px;
  color: var(--btf-white);
  font-family: inherit;
  font-size: 16px;
  transform: translateX(-50%);
  animation: btf-post-info-in .6s 0s backwards;
}

.post #page-header.post-bg:not(.not-top-img) #post-firstinfo,
.post #page-header.post-bg:not(.not-top-img) .post-title,
.post #page-header.post-bg:not(.not-top-img) #post-meta {
  width: calc(100% - var(--btf-header-cover-width) - 80px);
  max-width: none;
  margin-left: 40px;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
}

.post #page-header.post-bg:not(.not-top-img) #post-firstinfo {
  display: flex;
  color: var(--btf-white);
  text-align: left;
  white-space: nowrap;
  user-select: none;
}

.post #page-header.post-bg:not(.not-top-img) #post-firstinfo .meta-firstline {
  display: flex;
  align-items: center;
  height: 32px;
}

.post #page-header.post-bg:not(.not-top-img) #post-info .post-title {
  max-width: none;
}

.post #page-header.post-bg:not(.not-top-img) .post-meta-original,
.post #page-header.post-bg:not(.not-top-img) span.post-meta-categories {
  height: 32px;
  border-radius: var(--btf-radius-pill);
  background: var(--btf-header-white-op);
  line-height: 32px;
  transition: background-color .3s ease, color .3s ease;
}

.post #page-header.post-bg:not(.not-top-img) .post-meta-original {
  display: flex;
  width: auto;
  margin: 0;
  padding: 0 10px;
  color: var(--btf-white);
  font-size: 14px;
  font-weight: 700;
}

.post #page-header.post-bg:not(.not-top-img) .post-meta-original:hover {
  background: var(--btf-white);
  color: var(--btf-header-theme);
}

.post #page-header.post-bg:not(.not-top-img) span.post-meta-categories {
  margin-left: 8px;
}

.post #page-header.post-bg:not(.not-top-img) span.post-meta-categories:hover {
  background: var(--btf-white);
}

.post #page-header.post-bg:not(.not-top-img) span.post-meta-categories:hover a.post-meta-categories {
  color: var(--btf-header-theme);
}

.post #page-header.post-bg:not(.not-top-img) a.post-meta-categories {
  display: flex;
  width: 100%;
  height: 100%;
  padding: 0 10px;
  color: var(--btf-white);
  font-size: 14px;
}

.post #page-header.post-bg:not(.not-top-img) #post-firstinfo .tag_share {
  display: flex;
  align-items: center;
  margin-left: 20px;
}

.post #page-header.post-bg:not(.not-top-img) #post-firstinfo .post-meta__tag-list {
  display: flex;
  flex-direction: row;
  align-items: center;
  height: 32px;
  overflow: hidden;
}

.post #page-header.post-bg:not(.not-top-img) #post-firstinfo .post-meta__tags {
  display: flex;
  flex-direction: row;
  align-items: center;
  height: 32px;
  margin-right: 8px;
  padding: 0 8px 0 4px;
  border-radius: var(--btf-radius-pill);
  color: var(--btf-white);
  font-size: 16px;
  line-height: 32px;
  opacity: .8;
  transition: background-color .3s ease, opacity .3s ease;
}

.post #page-header.post-bg:not(.not-top-img) #post-firstinfo .post-meta__tags:hover {
  background: var(--btf-header-white-op);
  color: var(--btf-white);
  opacity: 1;
}

.post #page-header.post-bg:not(.not-top-img) #post-firstinfo .tags-name {
  display: flex;
  align-items: center;
  height: 100%;
}

.post #page-header.post-bg:not(.not-top-img) #post-firstinfo .tags-name i {
  font-size: 14px;
  line-height: 32px;
  margin-right: 2px;
  opacity: .4;
}

/* ---------- 5.3 标题与元信息 ---------- */

.post #page-header.post-bg:not(.not-top-img) #post-info .post-title {
  display: -webkit-box;
  height: calc(2 * 1.38em);
  min-height: calc(2 * 1.38em);
  margin: 4px 0 8px 40px;
  padding: 0;
  overflow: hidden;
  color: var(--btf-white);
  font-size: 42px;
  font-weight: 700;
  line-height: 1.38;
  text-align: left;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.post #page-header.post-bg:not(.not-top-img) #post-info .post-title .post-edit-link {
  padding-left: 10px;
  color: var(--btf-white);
}

.post #page-header.post-bg:not(.not-top-img) #post-info #post-meta {
  display: flex;
  color: var(--btf-white);
  font-size: 95%;
  user-select: none;
  transition: .3s;
}

.post #page-header.post-bg:not(.not-top-img) #post-info #post-meta a {
  color: inherit;
  text-decoration: none;
  transition: color .3s ease;
}

.post #page-header.post-bg:not(.not-top-img) #post-info #post-meta i {
  margin-right: 4px;
  font-size: 16px;
  line-height: 1;
}

.post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline > span,
.post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline > a.post-meta-pv {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  height: 32px;
  margin: 0;
  padding: 0 10px;
  border-radius: var(--btf-radius-pill);
  background: var(--btf-header-white-op);
  color: var(--btf-white);
  font-size: 15.2px;
  line-height: 1;
  opacity: 1;
  transition: background-color .3s ease-out, color .3s ease-out;
}

.post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline > span:hover,
.post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline > a.post-meta-pv:hover {
  background: var(--btf-white);
  color: var(--btf-header-theme);
}

.post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline .post-meta-separator,
.post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline .post-meta-label {
  display: none;
}

.post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline .post-meta-commentcount {
  cursor: pointer;
}

.post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline .word-count,
.post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline .leancloud-visitors-count,
.post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline #busuanzi_value_page_pv,
.post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline #busuanzi_page_pv {
  font-weight: 800;
}

.post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline > span:empty {
  display: none;
}

/* ---------- 5.4 右侧封面卡片 ---------- */

.post #page-header.post-bg:not(.not-top-img) .post-cover-aside {
  --post-cover-img-x: 0px;
  --post-cover-img-y: 0px;
  --post-cover-rotate-x: 0deg;
  --post-cover-rotate-y: 0deg;
  --post-cover-scale: 1;
  position: absolute;
  top: 50%;
  right: max(calc((100vw - var(--btf-layout-width)) / 2 + 30px), 30px);
  z-index: 11;
  display: block;
  width: var(--btf-header-cover-width);
  aspect-ratio: 16 / 9;
  overflow: visible;
  /* 无描边、无柔光：避免大范围渐变在 8 位色深下产生同心环纹 */
  border: none;
  border-radius: 16px;
  box-shadow: none;
  filter: none;
  transform: translate3d(0, -50%, 0) perspective(900px) rotateX(var(--post-cover-rotate-x)) rotateY(var(--post-cover-rotate-y)) scale3d(var(--post-cover-scale), var(--post-cover-scale), 1);
  transform-style: preserve-3d;
  transition: transform .18s ease-out, filter .35s ease-out, box-shadow .35s ease-out;
}

.post #page-header.post-bg:not(.not-top-img) .post-cover-aside:hover {
  --post-cover-scale: 1.035;
  /* 悬停只做轻微上浮的暗色投影，不使用任何柔光 */
  filter: none;
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .22);
}

.post #page-header.post-bg:not(.not-top-img) .post-cover-aside-link {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  line-height: 0;
}

.post #page-header.post-bg:not(.not-top-img) .post-cover-aside-img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  transform: translate3d(var(--post-cover-img-x), var(--post-cover-img-y), 0) scale(1.08);
  transition: transform .18s ease-out;
}

/* ---------- 5.5 底部圆角过渡 ---------- */

.post #page-header.post-bg:not(.not-top-img) .post-radius-bottom {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  height: 10px;
  border-radius: var(--btf-radius) var(--btf-radius) 0 0;
  background: var(--btf-background);
  pointer-events: none;
}

/* ---------- 5.6 响应式 ---------- */

@media screen and (max-width: 1200px) {
  .post #page-header.post-bg:not(.not-top-img) .post-cover-aside {
    display: none;
  }

  .post #page-header.post-bg:not(.not-top-img) #post-firstinfo,
  .post #page-header.post-bg:not(.not-top-img) .post-title,
  .post #page-header.post-bg:not(.not-top-img) #post-meta {
    width: calc(100% - 80px);
    margin-left: 40px;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }
}

@media screen and (max-width: 768px) {
  .post #page-header.post-bg:not(.not-top-img) {
    height: 470px;
    margin-bottom: -12px;
  }

  .post #page-header.post-bg:not(.not-top-img) #post-info {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    align-items: center;
    justify-content: normal;
    gap: 0;
    width: 100%;
    max-width: none;
    height: fit-content;
    margin: 0;
    padding: 7rem 1rem 60px;
    background-image: linear-gradient(to bottom, transparent, var(--btf-header-theme));
    text-align: center;
    transform: none;
    animation: none;
  }

  .post #page-header.post-bg:not(.not-top-img) #post-firstinfo,
  .post #page-header.post-bg:not(.not-top-img) .post-title,
  .post #page-header.post-bg:not(.not-top-img) #post-meta {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .post #page-header.post-bg:not(.not-top-img) #post-firstinfo {
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    text-align: center;
    white-space: normal;
  }

  .post #page-header.post-bg:not(.not-top-img) #post-firstinfo .meta-firstline {
    flex-wrap: wrap;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    height: auto;
    margin: 0 auto .4rem;
  }

  .post #page-header.post-bg:not(.not-top-img) #post-firstinfo .tag_share {
    display: none;
  }

  .post #page-header.post-bg:not(.not-top-img) #post-info .post-title {
    z-index: 1;
    width: 100%;
    height: auto;
    min-height: 0;
    margin: .2rem 0 !important;
    font-size: 24px;
    line-height: 1.2;
    text-align: center;
    -webkit-line-clamp: 3;
  }

  .post #page-header.post-bg:not(.not-top-img) #post-info #post-meta {
    z-index: 1;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-left: 0;
    font-size: 90%;
  }

  .post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline {
    justify-content: center;
    width: 100%;
    text-align: center;
    gap: 6px;
  }

  .post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline > span,
  .post #page-header.post-bg:not(.not-top-img) #post-info .meta-secondline > a.post-meta-pv {
    height: 30px;
    padding: 0 9px;
    font-size: 14.4px;
  }
}

@media screen and (prefers-reduced-motion: reduce) {
  .post #page-header.post-bg:not(.not-top-img) .post-cover-aside,
  .post #page-header.post-bg:not(.not-top-img) .post-cover-aside-img {
    transition: none;
  }

  .post #page-header.post-bg:not(.not-top-img) .post-cover-aside:hover {
    --post-cover-scale: 1;
  }
}

@keyframes btf-post-info-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ==========================================================================
   Fancybox 灯箱：对齐 E://Blog 的 Fancybox 3 观感
   v5 默认的工具栏按钮带深灰底、连成一条「框」，会压住图片顶部；
   改成：按钮透明、只留白色图标悬浮在图上；图片四周留 44px（F3 默认）呼吸空间；
   遮罩半透明能透出页面。
   （双写类名 + !important 是为了压过后加载的 fancybox.min.css）
   ========================================================================== */

.fancybox__container.fancybox__container {
  --fancybox-bg: rgba(0, 0, 0, .85);
}

.fancybox__toolbar.fancybox__toolbar {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 20;
  --f-button-bg: transparent;
  --f-button-hover-bg: rgba(0, 0, 0, .4);
  --f-button-active-bg: rgba(0, 0, 0, .55);
}

.fancybox__slide.fancybox__slide {
  /* 图片到工具栏的距离 = 图片到底部的距离：顶部多留 46px(工具栏) + 24px 间隙，底部留 24px */
  padding: 70px 44px 24px 44px !important;
}

/* 首页文章卡片之间的上下间距 */
#recent-posts .recent-post-item {
  margin-bottom: 10px;
}

/* ==========================================================================
   首页头图：站点标题与副标题字号
   作用域限制在 #site-info 内：
   - #site-info / #site-subtitle 只存在于首页（header/index.pug 的 home 分支）
   - 文章页用的是 #post-info + h1.post-title，标签/分类页用的是 #page-site-info，
     两者都不在 #site-info 里，所以完全不会被这条规则影响
   ========================================================================== */

#site-info #site-title {
  font-size: 1.6em;
}

#site-info #site-subtitle {
  font-size: 1em;
}

@media screen and (min-width: 768px) {
  #site-info #site-title {
    font-size: 2.45em;
  }

  #site-info #site-subtitle {
    font-size: 1.45em;
  }
}

/* ==========================================================================
   深色模式：主题交互色覆盖

   Butterfly 把 _config.butterfly.yml 的 theme_color.main 在构建时编译成字面量
   #425aef（写在 css/index.css 里），深色模式不会跟着 --btf-theme 变，
   于是暗色下 hover 出来的还是亮色的蓝。

   下面用 [data-theme="dark"] 前缀提高优先级、只覆盖深色模式；浅色保持原样。
   只处理 color / border-color，不碰 background —— 深色主色是黄色，
   拿它当底色再配白字会看不清。
   若日后升级主题后又有遗漏，重新生成这份列表即可。
   ========================================================================== */

[data-theme="dark"] a:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] .container .highlight-tools i:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] .article-sort-item.year:hover:before {
  border-color: var(--btf-theme);
}

[data-theme="dark"] .article-sort-item-title:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] .category-lists .category-list a:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] #recent-posts .recent-post-item >.recent-post-info > .article-title:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] #recent-posts .recent-post-item >.recent-post-info > .article-meta-wrap a:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] #article-container .shuoshuo-footer .shuoshuo-tag {
  color: var(--btf-theme);
}

[data-theme="dark"] #article-container .shuoshuo-footer .shuoshuo-comment-btn:hover {
  color: var(--btf-theme);
}

/* 暗色模式：主题色是金色，标签悬停若继续用「金色文字 + 金色实底」会糊成一片，
   什么也看不见。改用和侧栏「Follow Me」按钮同一套气质——半透明主题色底 + 浅色文字。 */
[data-theme="dark"] #aside-content .card-tags .card-tag-cloud a:hover {
  background: var(--btf-theme-soft);
  color: var(--btf-font-color) !important;
}

[data-theme="dark"] #aside-content .card-tags .card-tag-cloud a:hover .tag-cloud-count {
  color: var(--btf-font-color);
  opacity: .9;
}

[data-theme="dark"] #aside-content .aside-list > .aside-list-item .content > .title:hover,
[data-theme="dark"] #aside-content .aside-list > .aside-list-item .content > .comment:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] #aside-content #card-toc .toc-content .toc-link:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] .site-data > a:hover div {
  color: var(--btf-theme) !important;
}

[data-theme="dark"] #footer a:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] #page-header.nav-fixed #nav #blog-info:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] #page-header.nav-fixed #nav a:hover,
[data-theme="dark"] #page-header.nav-fixed #nav span.site-page:hover,
[data-theme="dark"] #page-header.nav-fixed #nav #toggle-menu:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] #post-info #post-meta a:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] .container a {
  color: var(--btf-theme);
}

[data-theme="dark"] #post .tag_share .post-meta__tags {
  color: var(--btf-theme);
}

[data-theme="dark"] #waline-wrap {
  --waline-theme-color: var(--btf-theme);
  --waline-active-color: var(--btf-theme);
}

[data-theme="dark"] .container .tabs > .tab-to-top button:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] .container .timeline .timeline-item:hover .item-circle:before {
  border-color: var(--btf-theme);
}

[data-theme="dark"] .search-dialog .search-nav {
  color: var(--btf-theme);
}

[data-theme="dark"] .search-dialog .search-nav .search-close-button:hover {
  color: var(--btf-theme);
}

[data-theme="dark"] .search-dialog .search-result-list .local-search-hit-item[value]::before,
[data-theme="dark"] .search-dialog .ais-Hits-list .local-search-hit-item[value]::before,
[data-theme="dark"] .search-dialog .search-result-list .ais-Hits-item[value]::before,
[data-theme="dark"] .search-dialog .ais-Hits-list .ais-Hits-item[value]::before {
  color: var(--btf-theme);
}

[data-theme="dark"] .search-dialog .search-result-list .local-search-hit-item a:hover,
[data-theme="dark"] .search-dialog .ais-Hits-list .local-search-hit-item a:hover,
[data-theme="dark"] .search-dialog .search-result-list .ais-Hits-item a:hover,
[data-theme="dark"] .search-dialog .ais-Hits-list .ais-Hits-item a:hover {
  color: var(--btf-theme);
}


/* ==========================================================================
   深色模式：文字选中色
   主题把 theme_color.text_selection 编译成字面量 #425aef（*::selection），
   深色下不会跟随 --btf-theme。这里只在深色模式覆盖：
   底色取 --btf-cover-theme（custom.js 从当前文章封面提取、同步到根节点的主色），
   和右侧「随机一篇文章」按钮的 hover 底色同源；没有封面的页面回落到 --btf-theme。
   降透明度是为了在深色底上不抢眼、且浅色文字仍然可读。
   ========================================================================== */

[data-theme="dark"] *::selection {
  background: color-mix(in srgb, var(--btf-cover-theme, var(--btf-theme)) 42%, transparent);
  color: var(--btf-font-color);
}


/* ==========================================================================
   深色模式：回到顶部圆钮跟随文章封面主色
   亮色是深灰圆钮 + 白字；暗色原本会翻成近白圆钮（--btf-font-color）。
   这里改成读 --btf-cover-theme —— custom.js 从当前文章封面取色后同步到根节点，
   右侧「随机一篇文章」按钮 hover 用的也是这个值，所以两者天然一致；
   没有封面的页面该变量被清除，回落到主题色 --btf-theme。
   数字/箭头本就是深色文字，压在雾蓝底上仍然清楚。
   hover 态一起锁住，否则会被上面「悬停时保持深色圆钮」那条改回白色。
   ========================================================================== */

[data-theme="dark"] #nav #nav-right #nav-totop .totopbtn,
[data-theme="dark"] #nav #nav-right #nav-totop:hover .totopbtn {
  background: var(--btf-cover-theme, var(--btf-theme-soft));
}


/* ==========================================================================
   暗色：圆钮数字 / 引述块文字跟随正文字体色
   正文在暗色下是 --btf-font-color (#f7f7fa)。
   圆钮数字原本用 --btf-card-bg（深色），引述块用 --btf-second-text（#a1a2b8，
   比正文淡一档）。引述块统一回正文色；圆钮则用 --btf-on-cover 做条件：
   有封面色时是正文浅色，没有封面色（底色回落主题黄）时自动变成深色。
   只作用于暗色；亮色的深灰圆钮 + 白字保持原样。
   ========================================================================== */

[data-theme="dark"] #nav #nav-right #nav-totop .totopbtn > i,
[data-theme="dark"] #nav #nav-right #nav-totop #percent,
[data-theme="dark"] #nav #nav-right #nav-totop.long #percent {
  /* 文章页有封面色（雾蓝底）→ 正文浅色；首页等无封面页（主题黄底）→ 深色 */
  color: var(--btf-on-cover, var(--btf-font-color));
}

[data-theme="dark"] .post-content blockquote,
[data-theme="dark"] .container blockquote {
  color: var(--btf-font-color);
}

[data-theme="dark"] {
  --blockquote-color: var(--btf-font-color);
}


/* ==========================================================================
   暗色：悬停时的背景 / 图标色跟随头图（封面）主色
   页面头图主色由 custom.js 提取后写在根节点的 --btf-cover-theme 上：
   首页取 index_img，文章页取封面，圆钮、随机按钮、选中色也都用它。
   这里把导航各处的「悬停背景」统一换成它 —— 常态胶囊底色保持原样，
   只有鼠标移上去时才变成头图色；文字用 --btf-on-cover（正文浅色），
   没有头面色时回落到深色，避免深底深字。
   原规则带 !important，这里同样用 !important 并加 [data-theme="dark"] 前缀。
   ========================================================================== */

[data-theme="dark"] #nav .menus_items .menus_item > .menus_item_child .site-page.child:hover,
[data-theme="dark"] #page-header #nav .menus_items .menus_item > .menus_item_child .site-page.child:hover,
[data-theme="dark"] #nav #menus > .menus_items > .menus_item > .site-page:hover,
[data-theme="dark"] #nav #nav-right .nav-button > .site-page:hover,
[data-theme="dark"] #nav #nav-right #toggle-menu > .site-page:hover,
[data-theme="dark"] #page-header #nav #nav-right .nav-button > .site-page:hover,
[data-theme="dark"] #page-header #nav #nav-right #toggle-menu > .site-page:hover,
[data-theme="dark"] #nav #blog-info .nav-site-title:hover > i.fas {
  color: var(--btf-on-cover, var(--btf-font-color)) !important;
}

[data-theme="dark"] #nav .menus_items .menus_item > .menus_item_child .site-page.child:hover,
[data-theme="dark"] #page-header #nav .menus_items .menus_item > .menus_item_child .site-page.child:hover,
[data-theme="dark"] #nav #menus > .menus_items > .menus_item > .site-page:hover,
[data-theme="dark"] #nav #nav-right .nav-button > .site-page:hover,
[data-theme="dark"] #nav #nav-right #toggle-menu > .site-page:hover,
[data-theme="dark"] #nav #blog-info .nav-site-title:hover {
  background: var(--btf-cover-theme, var(--btf-theme-soft));
  box-shadow: 0 8px 12px -3px var(--btf-header-theme-op, var(--btf-theme-op));
}

/* 首页例外：头图主色偏沉，悬停时不跟它走，改用弱化的暗色主题色。
   45% 的主题黄叠在深色底上就是暗琥珀，和文章页的封面雾蓝是两种气质；
   文字 / 图标颜色维持上一条规则（正文浅色）不变。
   只作用于首页：首页 DOM 里有 #site-info，文章页没有。 */
[data-theme="dark"] body:has(#site-info) #nav .menus_items .menus_item > .menus_item_child .site-page.child:hover,
[data-theme="dark"] body:has(#site-info) #page-header #nav .menus_items .menus_item > .menus_item_child .site-page.child:hover,
[data-theme="dark"] body:has(#site-info) #nav #menus > .menus_items > .menus_item > .site-page:hover,
[data-theme="dark"] body:has(#site-info) #nav #nav-right .nav-button > .site-page:hover,
[data-theme="dark"] body:has(#site-info) #nav #nav-right #toggle-menu > .site-page:hover,
[data-theme="dark"] body:has(#site-info) #nav #blog-info .nav-site-title:hover {
  background: var(--btf-theme-soft);
}

/* 回到顶部的圆钮：常态底色在首页也改用弱化主题色（悬停态一起带上，
   否则鼠标移上去会闪回深色）。数字颜色不变，仍是正文浅色。 */
[data-theme="dark"] body:has(#site-info) #nav #nav-right #nav-totop .totopbtn,
[data-theme="dark"] body:has(#site-info) #nav #nav-right #nav-totop:hover .totopbtn {
  background: var(--btf-theme-soft);
}


/* ==========================================================================
   暗色：弱主题色 + 侧栏 Follow Me 按钮
   --btf-theme-soft：暗色主题黄降透明度，叠在深底上呈暗琥珀，
   用在悬停底色、回到顶部圆钮、侧栏按钮等处，保持整站同一套暗色气质。
   ========================================================================== */

[data-theme="dark"] {
  --btf-theme-soft: color-mix(in srgb, var(--btf-theme) 45%, transparent);
}

[data-theme="dark"] #aside-content .card-info #card-info-btn {
  background: var(--btf-theme-soft);
  color: var(--btf-font-color);
}

/* 悬停时稍微加深一点做反馈，文字仍是浅色 */
[data-theme="dark"] #aside-content .card-info #card-info-btn:hover {
  background: color-mix(in srgb, var(--btf-theme) 62%, transparent);
  color: var(--btf-font-color);
}


/* ==========================================================================
   文章内 label 标签：{% label text color %}
   主题自带 .hl-label 的文字色取 var(--btn-color)，而本站把 --btn-color
   定义成了正文色（亮色模式下是深灰），导致彩色底上出现深色小字。
   这里单独给 label 用浅色文字，彩色底 + 白字更清晰，也与 Solitude 一致。
   ========================================================================== */

.hl-label {
  color: var(--btf-white, #fff);
}


/* ==========================================================================
   归档 / 分类 / 标签页：年份后面的生肖图标（2026-11-14）
   --------------------------------------------------------------------------
   图标是内联 SVG symbol（见 scripts/zodiac-year.js + data/zodiac-symbols.json），
   和年份文字一起放在 .article-sort-item.year 这个 flex 行里，
   所以用 margin-left 撑开间距，尺寸跟着年份字号（1.43em）走，不用写死 px。

   暗色模式：图标自带的黑色描边是 #231F20，叠在深色卡片上几乎看不见。
   <use> 引 symbol 时内容会被复制进影子树，外部 CSS 选择器进不去，
   所以描边色不能靠属性选择器覆盖，只能在 symbol 里写成
   fill:var(--zodiac-line, #231F20)（CSS 变量能穿过影子树继承下来），
   这里只负责按主题给 --zodiac-line 换个值。
   身体那几块马卡龙色（橙/粉/绿/蓝）在深底上反而更清爽，保持原样不动。
   ========================================================================== */

.zodiac-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.article-sort-item.year .zodiac-icon {
  flex: 0 0 auto;
  width: 1.5em;
  height: 1.5em;
  margin-left: .35em;
  vertical-align: -.15em;
  --zodiac-line: #231F20;
}

[data-theme="dark"] .article-sort-item.year .zodiac-icon {
  --zodiac-line: #d8d8d8;
}


/* ==========================================================================
   头图入场：模糊 → 清晰（2026-11-15）
   --------------------------------------------------------------------------
   出处是常见的 Butterfly 小配方（blur 渐变清晰），这里按本站情况改了三处：

   1. 时长 10s → .9s。10 秒里用户已经在读文章了，画面还是糊的，像没加载完；
      0.9s 刚好是「一眼对焦」的时间。
   2. 去掉 #web_bg。本站背景是纯色 #f7f9fe（_config.butterfly.yml 的 background），
      没有背景图可糊，对整屏固定元素做滤镜只会白烧显卡。
   3. 补上 .luna-banner。本站大多数页面（归档 / 统计 / 友链…）的顶图是自定义横幅，
      不是 #page-header，只写原配方的话那些页面根本没有效果。

   两个细节：
   - 不加 animation-fill-mode（默认 none）。只要动画结束还留着 filter，
     首页 header 的 background-attachment: fixed 就会失效（filter 会新建层叠上下文），
     首图视差就没了。
   - prefers-reduced-motion 下直接关掉，晕动症用户不受影响。
   ========================================================================== */

@keyframes imgblur {
  from { filter: blur(8px); }
  to { filter: blur(0); }
}

/* .not-top-img 是主题给「没有顶图」的页面加的类，跳过它们免得白跑一遍动画 */
#page-header:not(.not-top-img),
.luna-banner {
  animation: imgblur .9s cubic-bezier(.22, .61, .36, 1);
}

@media (prefers-reduced-motion: reduce) {
  #page-header:not(.not-top-img),
  .luna-banner {
    animation: none;
  }
}


/* ==========================================================================
   时间轴（{% timeline %}）里的图片间距（2026-11-15）
   --------------------------------------------------------------------------
   主题给 #article-container img 的是 margin: 0 auto 20px，
   放进时间轴的粉色内容块里，图片下方会多留 20px，块底显得空。
   这里把上边距留 4px（跟上一行文字贴住）、下边距归 0，
   水平仍居中，不影响普通文章里的图片。
   ========================================================================== */

.container .timeline .timeline-item-content img {
  margin: 4px auto 0;
}


/* ==========================================================================
   时间轴的月份锚点（2026-11-15）
   --------------------------------------------------------------------------
   由 scripts/timeline-month-toc.js 在每个月第一条前插一个看不见的 <h2>，
   作用只是让原生目录能扫到它（toc() 只认 h1~h6）。
   这里把它裁成 1px 不占位，正文视觉保持不变；屏幕阅读器仍能读到月份。
   ========================================================================== */

#article-container .tl-month-anchor {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
