/* ============================================================================
 * WooYun 的博客 —— 交互与组件定制
 * ----------------------------------------------------------------------------
 * 分工：
 *   everforest.css  → 只管「颜色」（覆盖主题的 --* 变量）
 *   本文件          → 只管「行为与结构」（点击、展开、挂件……）
 *
 * 原则：不修改 themes/butterfly/ 源码，全部走 inject 注入，
 *       主题随时可以 git pull 升级。
 * 配套脚本：source/js/custom.js
 * ========================================================================= */


/* ============================================================================
 * 一、侧栏作者卡片
 * ========================================================================= */

/* ---- 1.1 作者名变成通往「关于」页的链接 -------------------------------- */
html #aside-content .card-info .author-info-link {
  color: var(--font-color);
  transition: color .2s;
}
html #aside-content .card-info .author-info-link:hover {
  color: var(--ef-green);
}

/* ---- 1.2 座右铭：点击展开下半句 ---------------------------------------- */
/* 第一句常显；第二句默认收起（max-height 过渡，不能用 display:none，
   否则没有动画）。下半句用强调绿，和「火焰」的意象对得上。 */
/* 座右铭展开：首页把作者卡搬到了 .home-side，所以两份选择器都要覆盖，
   否则左列点击没反应（class 切了但样式不匹配）。 */
html #aside-content .card-info .author-info-description,
html .home-side .card-info .author-info-description {
  cursor: pointer;
  user-select: none;
}

html #aside-content .card-info .motto-extra,
html .home-side .card-info .motto-extra {
  display: block;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  color: var(--ef-green);
  transition: max-height .35s ease, opacity .35s ease, margin-top .35s ease;
}

html #aside-content .card-info .author-info-description.revealed .motto-extra,
html .home-side .card-info .author-info-description.revealed .motto-extra {
  max-height: 3em;   /* 足够容纳一行，留出换行的余量 */
  margin-top: .2em;
  opacity: 1;
}


/* ============================================================================
 * 二、侧栏「正在循环」歌词卡
 * ----------------------------------------------------------------------------
 * 歌词数据 → source/js/lyrics-data.js
 * 滚动/切歌逻辑 → source/js/custom.js（initLyricsCard）
 * 这里只管外观：3 行视窗、向上滚动、中间那行高亮。
 * ========================================================================= */

html .card-lyrics .lyrics {
  margin: 2px 0 0;
}

/* 歌词卡的内容是异步填的（/site.json + 每首歌的 .lrc）。widget.yml 里的
   兜底内容比最终结构矮几十像素，留个下限，填充前后右栏不会整块跳。
   注意主题的卡片里没有 .card-content 这层，高度要钉在 #lyrics-root 上。 */
html .card-lyrics #lyrics-root {
  min-height: 170px;
}

/* 整张卡也给个下限：歌词是异步填的，兜底内容 ≈ 254px 高。
   任何「内容还没到位」的瞬间都不该让下面的标签卡往上缩。 */
html.home-mode #aside-content #card-lyrics {
  min-height: 254px;
}

/* 视窗：固定 3 行高，多出来的裁掉。
   font-size 定在这里，下面行高用 em 才能和视窗高对应上。 */
html .card-lyrics .lyrics-viewport {
  position: relative;
  height: calc(3 * 1.9em);
  overflow: hidden;
  font-size: .92em;
  /* 上下边缘淡出，歌词进出视窗时不会硬切 */
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0) 0, #000 15%, #000 85%, rgba(0,0,0,0) 100%);
          mask-image: linear-gradient(to bottom, rgba(0,0,0,0) 0, #000 15%, #000 85%, rgba(0,0,0,0) 100%);
}

/* 滚动轨道：一整条歌词上下平移（位移由 JS 算） */
html .card-lyrics .lyrics-track {
  transition: transform .6s cubic-bezier(.25, .46, .45, .94);
  will-change: transform;
}

html .card-lyrics .lyric-line {
  height: 1.9em;
  margin: 0;
  line-height: 1.9em;
  color: var(--ef-grey0);
  opacity: .8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .4s, opacity .4s;
}

/* 正在唱的那一行：绿色 + 完全不透明 */
html .card-lyrics .lyric-line.is-active {
  color: var(--ef-green);
  opacity: 1;
}

/* 双语歌词：有翻译时所有行统一加高，播放器的行高实测才不会错位 */
html .card-lyrics .lyrics-track.has-sub .lyric-line {
  height: 3.4em;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

html .card-lyrics .lyric-line .lyric-main,
html .card-lyrics .lyric-line .lyric-sub {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html .card-lyrics .lyric-line .lyric-sub {
  color: var(--ef-grey0);
  font-size: .72em;
  line-height: 1.4;
}

/* 卡片底部：歌名 + 去网易云听（右边是「换一首」按钮） */
/* 歌词卡的感想：默认只露一两行，卡片 hover 时展开 */
html .card-lyrics .lyrics-note {
  max-height: 2.2em;
  margin-top: 8px;
  overflow: hidden;
  color: var(--ef-grey0);
  font-size: .78em;
  line-height: 1.6;
  transition: max-height .3s ease;
}
/* 只有内容真的被折叠时才加渐变，单行感想不会被遮 */
html .card-lyrics .lyrics-note.is-collapsible {
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
          mask-image: linear-gradient(to bottom, #000 70%, transparent);
}
html .card-lyrics:hover .lyrics-note {
  max-height: 60em;
  -webkit-mask-image: none;
          mask-image: none;
}
html .card-lyrics .lyrics-note p { margin: 0 0 4px; }
html .card-lyrics .lyrics-note p:last-child { margin-bottom: 0; }
html .card-lyrics .lyrics-note a { color: var(--ef-blue); }
html .card-lyrics .lyrics-note code {
  padding: 0 3px;
  border-radius: 3px;
  background: var(--ef-bg2);
}
html .card-lyrics .lyrics-note img { max-width: 100%; border-radius: 6px; }

html .card-lyrics .lyrics-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--ef-bg3);
  font-size: .86em;
}


/* ----------------------------------------------------------------------------
 * 播放控制行：▶ 按钮 + 进度条 + 当前时间/总时长
 * 只有拿到 LRC 时间轴时才由 JS 创建（没有 LRC 就没有播放可言）。
 * ------------------------------------------------------------------------- */

html .card-lyrics .lyrics-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

html .card-lyrics .lyrics-toggle {
  flex: none;
  width: 1.5em;
  height: 1.5em;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ef-bg2);
  color: var(--ef-grey2);
  font-size: .86em;
  line-height: 1;
  cursor: pointer;
  transition: background-color .25s, color .25s;
}
html .card-lyrics .lyrics-toggle:hover {
  background: var(--ef-green);
  color: #2d353b;   /* fg_on_green —— 强调色底上的文字 */
}

html .card-lyrics .lyrics-progress {
  flex: 1 1 auto;
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--ef-bg2);
}

html .card-lyrics .lyrics-progress-bar {
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: var(--ef-green);
  transition: width .2s linear;   /* 跟得上 200ms 的时钟滴答 */
}

html .card-lyrics .lyrics-time {
  flex: none;
  color: var(--ef-grey0);
  font-size: .78em;
  font-variant-numeric: tabular-nums;   /* 数字等宽，跳动时不抖 */
}

/* 歌词还在加载（本地文件，一闪而过） */
html .card-lyrics .lyrics-loading {
  margin: 8px 0;
  color: var(--ef-grey0);
  font-size: .86em;
}

html .card-lyrics .lyrics-source {
  overflow: hidden;
  color: var(--ef-grey2);
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: color .25s;
}
html .card-lyrics .lyrics-source:hover {
  color: var(--ef-green);
}

/* 「换一首」：歌单只有一首时不会出现（由 JS 控制） */
html .card-lyrics .lyrics-shuffle {
  flex: none;
  padding: 2px 5px;
  border: 0;
  background: none;
  color: var(--ef-grey2);
  font-size: 1em;
  line-height: 1;
  cursor: pointer;
  transition: color .25s, transform .45s;
}
html .card-lyrics .lyrics-shuffle:hover {
  color: var(--ef-green);
  transform: rotate(180deg);
}


/* ============================================================================
 * 三、页脚里的二次元动图
 * ----------------------------------------------------------------------------
 * 元素由 source/js/custom.js 插入（图不存在时会自动移除）。
 *
 * 现用图是**透明背景**的立绘动画：图片直接坐在页脚内侧的底边（bottom: 0），
 * 上半身溢出到页脚之上 —— 自然得像人从页脚里探出头来。
 *
 * 透明图不需要边框/圆角/阴影，也不建议加 opacity，揉合会发灰。
 * 尺寸/位置不满意时只改下面几行。
 * ========================================================================= */

html #footer .footer-mascot {
  position: absolute;
  left: 2.5rem;
  bottom: 0;        /* 坐在页脚内部的底边上 */
  height: 10rem;    /* 宽度按 16:9 自动，约 17.8rem */
  width: auto;
  pointer-events: none;   /* 不挡着版权文字被点到 */
}

/* 窄屏：页脚本来就不高，图缩小并贴左边 */
@media screen and (max-width: 768px) {
  html #footer .footer-mascot {
    left: .5rem;
    height: 6.5rem;
  }
}


/* ============================================================================
 * 四、文章库页面（/library/）
 * ----------------------------------------------------------------------------
 * 左侧分类树 + 右侧文章列表。数据来自 /library.json，渲染在 source/js/library.js。
 * 配色全部走 --ef-* 变量，所以明暗两套模式自动适配。
 * ========================================================================= */

html .library { margin: 0; }

/* 这一页里的链接一律不加下划线（标题、标签、卡片都是块级元素，
   下划线会让 hover 显得脏）。 */
html .library a,
html .library a:hover {
  text-decoration: none;
}

/* 这一页没有侧栏（front-matter aside: false），主题会给 .layout 加 hide-aside，
   并已把主区宽度设成 100%。这里只把 1000px 的上限放宽一点，
   否则「树 + 列表」两栏在 1000px 内会显挤。 */
html .layout.hide-aside { max-width: 1180px; }

/* ---- 4.1 工具条：搜索框 + 总数 ---- */
html .library-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

html .library-search-wrap { position: relative; flex: 1 1 auto; }

html .library-search-wrap i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ef-grey1);
  font-size: .85em;
  pointer-events: none;
}

html .library-search {
  width: 100%;
  padding: 9px 12px 9px 34px;
  background: var(--ef-bg1);
  border: 1px solid var(--ef-bg3);
  border-radius: 8px;
  color: var(--font-color);
  font-size: .92em;
  transition: border-color .25s, background-color .25s;
}
html .library-search::placeholder { color: var(--ef-grey0); }
html .library-search:focus {
  outline: none;
  border-color: var(--ef-green);
  background: var(--ef-bg2);
}

html .library-total {
  flex: none;
  color: var(--ef-grey1);
  font-size: .84em;
  font-variant-numeric: tabular-nums;
}

/* 标签筛选 chip：从文章页点标签跳过来时显示，可一键清除 */
html .library-filters { margin-bottom: 12px; }
html .library-filters[hidden] { display: none; }

html .lib-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px 3px 10px;
  border-radius: 20px;
  background: var(--ef-bg2);
  color: var(--ef-green);
  font-size: .82em;
}

html .lib-chip-close {
  padding: 0 3px;
  border: 0;
  background: none;
  color: var(--ef-grey1);
  font-size: .9em;
  line-height: 1;
  cursor: pointer;
  transition: color .2s;
}
html .lib-chip-close:hover { color: var(--ef-red); }

/* ---- 4.2 两栏布局 ---- */
html .library-body {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

/* ---- 4.3 分类树 ---- */
html .library-tree {
  position: sticky;
  top: 84px;                 /* 避开固定导航栏 */
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 10px 8px;
  background: var(--ef-bg1);
  border: 1px solid var(--ef-bg3);
  border-radius: 10px;
}

html .lib-node {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 1px 0;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ef-grey2);
  font-size: .88em;
  text-align: left;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
html .lib-node:hover {
  background: var(--ef-bg2);
  color: var(--font-color);
}
/* 当前选中的分类：绿底 + fg_on_green 文字 */
html .lib-node.is-active {
  background: var(--ef-green);
  color: #2d353b;
  font-weight: 600;
}

html .lib-node i {
  flex: none;
  width: 1em;
  text-align: center;
  color: var(--ef-green);
  font-size: .92em;
}
html .lib-node.is-active i { color: #2d353b; }

html .lib-node-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

html .lib-node-count {
  flex: none;
  min-width: 1.5em;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 20px;
  background: var(--ef-bg2);
  color: var(--ef-grey0);
  font-size: .78em;
  line-height: 1.7;
  text-align: center;
}
html .lib-node.is-active .lib-node-count {
  background: rgba(45, 53, 59, .2);
  color: #2d353b;
}

/* ---- 4.4 文章条目 ---- */
html .lib-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
  padding: 14px 16px;
  background: var(--ef-bg1);
  border: 1px solid var(--ef-bg3);
  border-radius: 10px;
  transition: border-color .25s, transform .25s;
}
html .lib-item:hover {
  border-color: var(--ef-green);
  transform: translateX(3px);
}

/* 主体（标题 + 简介）本身是链接：撑满左侧，标题/简介都不加下划线 */
html .lib-item-main {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  color: inherit;
}

html .lib-item-title {
  color: var(--font-color);
  font-weight: 600;
  font-size: 1em;
  line-height: 1.5;
}
html .lib-item:hover .lib-item-title { color: var(--ef-green); }

html .lib-item-desc {
  margin: 5px 0 0;
  color: var(--ef-grey1);
  font-size: .86em;
  line-height: 1.65;
}

/* 右侧：时间 + 标签 */
html .lib-item-side { flex: none; text-align: right; }

html .lib-item-date {
  color: var(--ef-grey0);
  font-size: .8em;
  font-variant-numeric: tabular-nums;
}

html .lib-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  margin-top: 6px;
}

html .lib-tag {
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--ef-bg2);
  font-size: .74em;
  line-height: 1.7;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
html .lib-tag:hover {
  background: var(--ef-bg3);
}

/* 标签色：与 library.js 的 TAG_COLORS 一一对应（按标签名哈希，颜色稳定） */
html .lib-tag.tag-red    { color: var(--ef-red); }
html .lib-tag.tag-orange { color: var(--ef-orange); }
html .lib-tag.tag-yellow { color: var(--ef-yellow); }
html .lib-tag.tag-green  { color: var(--ef-green); }
html .lib-tag.tag-aqua   { color: var(--ef-aqua); }
html .lib-tag.tag-blue   { color: var(--ef-blue); }
html .lib-tag.tag-purple { color: var(--ef-purple); }

/* ---- 4.5 加载 / 空态 / 出错 ---- */
html .library-loading { color: var(--ef-grey1); }
html .library-empty,
html .library-error {
  padding: 32px 0;
  color: var(--ef-grey1);
  text-align: center;
}
html .library-error { color: var(--ef-red); }

/* ---- 4.6 窄屏：树放到列表上方 ---- */
@media screen and (max-width: 900px) {
  html .library-body { grid-template-columns: 1fr; }
  html .library-tree {
    position: static;
    max-height: 42vh;
  }
  html .lib-item {
    flex-direction: column;
    gap: 10px;
  }
  html .lib-item:hover { transform: none; }
  html .lib-item-side {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
  }
  html .lib-item-tags {
    margin-top: 0;
    justify-content: flex-start;
  }
}


/* ============================================================================
 * 五、首页主从视图（左列表 + 中预览）
 * ----------------------------------------------------------------------------
 * 渲染逻辑在 source/js/home.js：它把 #recent-posts 里的卡片流换成两栏。
 * 侧栏的「最新文章」卡片已关掉（card_recent_post.enable = false）。
 * ========================================================================= */

html #recent-posts.home-split {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 20px;          /* 左列 ↔ 中列 */
  align-items: start;
  /* flex item 默认 min-width:auto —— 中栏里任何「最小宽度」大于列宽的东西
     （图片组、长 URL、长单词、宽表格）都会把 #recent-posts 撑宽，
     进而把右栏从 304px 挤到 160px，三栏来回跳。必须钉成 0。 */
  min-width: 0;
}

/* 同一类问题：这几层都是 flex/grid 的子项，min-width:auto 会让内容撑破容器 */
html .home-side,
html .home-main,
html .home-feed,
html .feed-item { min-width: 0; }

/* 中列 ↔ 右栏的间距：不再用 #aside-content 的 padding-left 凑，
   而是让主区 flex 吃掉剩余宽度、自己留 20px 右外边距。
   这样两处间距严格相等（都是 20px），不会因为盒子模型/滚动条出现误差。 */
@media screen and (min-width: 900px) {
  /* 注意：类加在 <html> 上（_config.butterfly.yml 的 head 内联脚本），
     不要写成 body.home-mode —— 那是 runtime 才有的，会导致右栏先排版再挪动 */
  html.home-mode .layout > div:first-child {
    width: auto;
    /* 保持 basis:auto（basis:0 会让主区在内容插入前先缩成 0，
       右栏会瞬间跳到最左边，CLS 反而飙到 0.65）。
       真正让三栏稳定的是下面右栏的 flex-shrink:0：
       容器宽度固定，右栏不让位，主区就只能吃剩下的空间。 */
    flex: 1 1 auto;
    min-width: 0;
    margin-right: 20px;
  }
  html.home-mode #aside-content {
    flex-shrink: 0;    /* 右栏宽度固定，不被主区的内容挤掉（三栏抖动的根因） */
    padding-left: 0;   /* 间距已由主区的 margin-right 提供 */
  }
}

/* 这一页里的链接不加下划线（按钮和卡片都是块级元素） */
html .home-split a,
html .home-split a:hover {
  text-decoration: none;
}

/* ---- 5.1 左列：时间倒序的小卡片 ---- */
html .home-list {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  /* 不能留 padding-right：它会把卡片右边缘往里推，
     使左列↔中列的间距比中列↔右栏大几像素。 */
  padding-right: 0;
}

html .home-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ef-bg3);   /* 默认就带边框，与预览窗格、作者卡一致 */
  border-radius: 8px;
  background: var(--ef-bg1);
  text-align: left;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, transform .2s;
}
html .home-item:hover {
  border-color: var(--ef-green);
}
html .home-item.is-active {
  border-color: var(--ef-green);
  background: var(--ef-bg2);
}

html .home-item-date {
  display: block;
  color: var(--ef-grey0);
  font-size: .72em;
  font-variant-numeric: tabular-nums;
}

html .home-item-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 3px 0 4px;
  color: var(--font-color);
  font-size: .9em;
  font-weight: 600;
  line-height: 1.5;
}
html .home-item.is-active .home-item-title { color: var(--ef-green); }

html .home-item-meta {
  display: block;
  overflow: hidden;
  color: var(--ef-grey0);
  font-size: .72em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---- 5.2 中列：预览窗格 ---- */
html .home-preview {
  min-height: 460px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 30px 32px;
  background: var(--ef-bg1);
  border: 1px solid var(--ef-bg3);
  border-radius: 12px;
}

/* 默认面板：自我介绍 */
html .home-intro {
  padding: 34px 8px;
  text-align: center;
}

html .home-intro-avatar {
  width: 88px;
  height: 88px;
  border: 2px solid var(--ef-bg3);
  border-radius: 50%;
  object-fit: cover;
}

html .home-intro-name {
  margin-top: 16px;
  color: var(--font-color);
  font-size: 1.4em;
  font-weight: 600;
}

html .home-intro-motto {
  margin-top: 10px;
  color: var(--ef-green);
  font-size: .95em;
}

html .home-intro-text {
  max-width: 460px;
  margin: 16px auto 0;
  color: var(--ef-grey1);
  font-size: .86em;
  line-height: 1.9;
}

html .home-intro-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 24px;
}

html .home-intro-btn {
  padding: 7px 16px;
  border-radius: 20px;
  background: var(--ef-green);
  /* 必须 !important：everforest.css 的 html[data-theme='dark'] a { color: blue }
     特异性比这里高，会把绿底按钮的文字染成蓝色，直接看不见。 */
  color: #2d353b !important;   /* fg_on_green */
  font-size: .84em;
  font-weight: 600;
  transition: transform .2s, opacity .2s;
}
html .home-intro-btn:hover {
  color: #2d353b !important;
  transform: translateY(-1px);
  opacity: .92;
}

html .home-intro-btn--ghost {
  background: var(--ef-bg2);
  color: var(--ef-fg) !important;
}
html .home-intro-btn--ghost:hover { color: var(--ef-green) !important; }

/* 文章预览 */
html .home-preview-title {
  margin: 0;
  color: var(--font-color);
  font-size: 1.38em;
  line-height: 1.5;
}

html .home-preview-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--ef-grey0);
  font-size: .8em;
}
html .home-preview-date { font-variant-numeric: tabular-nums; }

html .home-preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

html .home-preview-tag {
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--ef-bg2);
  color: var(--ef-green);
  font-size: .76em;
  cursor: pointer;
  transition: background-color .2s;
}
html .home-preview-tag:hover { background: var(--ef-bg3); }

html .home-preview-desc {
  margin: 20px 0 0;
  color: var(--ef-fg);
  font-size: .95em;
  line-height: 1.9;
}

html .home-preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 26px;
  padding: 8px 18px;
  border-radius: 20px;
  background: var(--ef-green);
  /* 同 .home-intro-btn：必须 !important，否则被全局链接色盖成蓝字 */
  color: #2d353b !important;
  font-size: .86em;
  font-weight: 600;
  transition: transform .2s, opacity .2s;
}
html .home-preview-btn:hover {
  color: #2d353b !important;
  transform: translateX(3px);
  opacity: .92;
}

/* ---- 5.3 窄屏：不分栏，点卡片直接进文章 ---- */
@media screen and (max-width: 900px) {
  html #recent-posts.home-split { grid-template-columns: 1fr; }
  html .home-list {
    position: static;
    max-height: none;
  }
  html .home-preview { display: none; }
}

/* ---- 5.4 左列顶部的作者卡（点击回到自我介绍） ---- */
html .home-author {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--ef-bg3);
  border-radius: 8px;
  background: var(--ef-bg2);
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
html .home-author:hover { border-color: var(--ef-green); }
html .home-author.is-active { border-color: var(--ef-green); }

html .home-author-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

html .home-author-name {
  overflow: hidden;
  color: var(--font-color);
  font-size: .9em;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

html .home-author-hint {
  flex: none;
  margin-left: auto;
  color: var(--ef-grey0);
  font-size: .72em;
}


/* ---- 5.5 防首次闪烁 ------------------------------------------------ */
/* 首页的 HTML 里先渲染的是主题的卡片流，home.js 拿到数据后才换成三栏。
   不加这段的话，用户会先看到旧页面、再“跳”成新布局。
   head 里的内联脚本会给 <html> 打上 home-pending（早于 body 渲染），
   这里先把旧内容藏起来；home.js 加上 .home-split 后自动恢复显示。
   用 :not(.home-split) 而不是直接隐藏，是为了渲染完成后即使类还在也不影响。 */
html.home-pending #recent-posts:not(.home-split) > * {
  visibility: hidden;
}

/* 骨架：脚本 + 数据还没回来的这几秒里，左列和中栏原本是空白（屏幕上只剩右列），
   看着像“只有右栏”。这里画两块占位，让三栏的形从第一帧就在。
   旧卡片流虽然被 visibility: hidden 藏着但仍然占着高度，所以骨架用绝对定位盖上去，
   不参与布局；home.js 渲染完成后 .home-split 出现，骨架自动失效。
   窄屏（<900px，真实布局是单列）只画一块。 */
html.home-pending #recent-posts:not(.home-split) {
  position: relative;
}

/* 右栏的作者卡会被 home.js 整块搬到左列顶部（按设计如此）。它一直在右栏
   待着会先占 ~300px，搬走时右栏其余卡片（歌词卡 / 标签 / 网站信息）
   整体上跳一大截 —— 首屏量到最明显的一笔 CLS。
   骨架期就先不占位：搬走之后 .home-pending 才被摘掉，两边不会互相打架；
   万一 home.js 挂了、兜底摘掉 .home-pending，作者卡会照常回到右栏。 */
html.home-pending #aside-content .card-info {
  display: none;
}

html.home-pending #recent-posts:not(.home-split)::before,
html.home-pending #recent-posts:not(.home-split)::after {
  content: '';
  position: absolute;
  top: 0;
  height: 320px;
  border-radius: 10px;
  background: var(--ef-bg1);
  animation: ef-home-skeleton 1.6s ease-in-out infinite;
  pointer-events: none;
}

/* 左列（老作者卡的位置） */
html.home-pending #recent-posts:not(.home-split)::before {
  left: 0;
  width: 268px;
}

/* 中栏（时间流） */
html.home-pending #recent-posts:not(.home-split)::after {
  left: 288px;   /* 268px + 20px 间距，和 .home-split 的 gap 一致 */
  right: 0;
}

@keyframes ef-home-skeleton {
  0%,
  100% { opacity: .32; }
  50%  { opacity: .58; }
}

@media screen and (max-width: 900px) {
  html.home-pending #recent-posts:not(.home-split)::before {
    display: none;
  }
  html.home-pending #recent-posts:not(.home-split)::after {
    left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.home-pending #recent-posts:not(.home-split)::before,
  html.home-pending #recent-posts:not(.home-split)::after {
    animation: none;
  }
}


/* ---- 5.6 首页左列的分区标题（文章 / 笔记） ---- */
html .home-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

html .home-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px 2px;
  color: var(--ef-grey1);
  font-size: .76em;
  font-weight: 600;
  letter-spacing: .05em;
}
html .home-group-name::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: .95em;
  margin-right: 6px;
  border-radius: 2px;
  background: var(--ef-green);
  vertical-align: -1px;
}
html .home-group-count {
  color: var(--ef-grey0);
  font-weight: 400;
}

/* ---- 5.7 预览窗格里的「笔记」标记 ---- */
html .home-preview-type {
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--ef-bg2);
  color: var(--ef-orange);
  font-size: .92em;
}

/* ---- 5.8 文章库列表里的「笔记」标记 ---- */
html .lib-type {
  margin-right: 6px;
  color: var(--ef-orange);
  font-size: .8em;
}

/* 文章库里的置顶标记：与「笔记」同行放在日期左侧。
   数据来自 library.json 的 top 字段（front-matter 的 top: true 或 sticky > 0）。 */
html .lib-pin {
  margin-right: 6px;
  color: var(--ef-green);
  font-size: .8em;
  font-weight: 600;
}


/* ============================================================================
 * 六、说说页 / 友链页的排版微调
 * ========================================================================= */

/* 说说里「混排段落」的图片（文字中间夹一张图）：按原比例限制高度，
   否则一张竖图会把整条说说撑到屏幕外。
   ⚠️ 必须限定 > p img，不能写成 .shuoshuo-content img ——
      那样会连 div.ph-imgs 里的分组图片一起命中，
      用 width:auto 把网格的 aspect-ratio 顶掉（踩过，表现为九宫格变成高矮不一的竖图）。 */
html #article-container .shuoshuo-item .shuoshuo-content > p img {
  width: auto;
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 8px;
}

/* 友链：改成两列。主题默认三列，在 900~1024px 宽度下卡片只有 240px 左右，
   标题会被截成 "Butterfly ..." —— 两列空间更从容。
   前缀用 #page：友链页 DOM 是 main#content-inner > #page > .flink，
   没有 .container（只有文章页的 article#article-container 带这个类）。 */
@media screen and (min-width: 601px) {
  html #page .flink .flink-list > .flink-list-item {
    width: calc(50% - 15px) !important;
  }
}


/* ---- 6.1 说说里的图片组 ------------------------------------------------ */
/* 连续图片在渲染期就被包成 <div class="ph-imgs ph-imgs--N">
   （scripts/img-group.js），样式统一在第十一节，这里不再单独猜选择器。
   历史上这里用过 `p:has(> a:nth-of-type(2) > img)`，数不出张数、也分不开
   「文字 + 一张图」的段落，已经删掉。 */

/* ---- 6.2 首页中栏预览里的封面图 -------------------------------------- */
html .home-preview-cover {
  display: block;
  width: 100%;
  height: 200px;
  margin-bottom: 20px;
  border: 1px solid var(--ef-bg3);
  border-radius: 8px;
  object-fit: cover;
}


/* ============================================================================
 * 七、首页时间流（方案 A：左侧筛选 + 中栏混合流）
 * ----------------------------------------------------------------------------
 * 数据来自 /feed.json，文章 / 笔记 / 说说混排，按时间倒序。
 * 旧的 .home-list / .home-preview 样式保留着但已不再使用。
 * ========================================================================= */

/* ---- 7.1 左列：作者卡 + 筛选 ---- */
html .home-side {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 左右栏吸附在同一个高度（导航下方），滚动时顶部才对得齐。
   主题默认 top: 20px，会被导航挡住，也导致和左栏错位。 */
html.home-mode #aside-content .sticky_layout {
  /* 主题在 #page-header.fixed + .layout 下把 top 写成了 70px（特异性更高），
     这里必须 !important 才能和左栏的 88px 对齐 */
  top: 88px !important;
}

/* 右栏内容比「视口 - 导航 - 页脚」还高的话，滚到底部时会被父容器挤上去。
   首页隐藏信息量最小的「网站信息」卡，右栏就装得下，可以全程保持吸附。 */
html.home-mode #aside-content .card-webinfo {
  display: none;
}

html .home-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

html .home-filter {
  padding: 6px 13px;
  border: 1px solid var(--ef-bg3);
  border-radius: 20px;
  background: var(--ef-bg1);
  color: var(--ef-grey2);
  font-size: .82em;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s;
}
html .home-filter:hover {
  border-color: var(--ef-green);
  color: var(--ef-green);
}
html .home-filter.is-active {
  background: var(--ef-green);
  border-color: var(--ef-green);
  color: #2d353b;
  font-weight: 600;
}

/* ---- 7.2 中栏：时间流 ---- */
html .home-feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

html .feed-item {
  padding: 18px 22px;
  background: var(--ef-bg1);
  border: 1px solid var(--ef-bg3);
  border-radius: 10px;
  transition: border-color .25s;
}
html .feed-item:hover { border-color: var(--ef-bg3); }

html .feed-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

html .feed-avatar {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

html .feed-name {
  color: var(--font-color);
  font-size: .9em;
  font-weight: 600;
}

html .feed-date {
  margin-left: auto;
  color: var(--ef-grey0);
  font-size: .76em;
  font-variant-numeric: tabular-nums;
}

/* 类型徽章 */
html .feed-kind {
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--ef-bg2);
  font-size: .74em;
  font-weight: 600;
}
html .feed-kind--note { color: var(--ef-orange); }
html .feed-kind--post { color: var(--ef-aqua); }
/* 置顶徽章：与卡片顶部的类型徽章同形，用主强调绿区分 */
html .feed-kind--pin { color: var(--ef-green); }

html .feed-title {
  margin: 0 0 6px;
  font-size: 1.1em;
  line-height: 1.5;
}
html .feed-title a { color: var(--font-color); }
html .feed-title a:hover { color: var(--ef-green); }

html .feed-desc {
  margin: 0;
  color: var(--ef-grey1);
  font-size: .88em;
  line-height: 1.8;
}

/* 说说正文 */
html .feed-body {
  color: var(--font-color);
  font-size: .92em;
  line-height: 1.9;
}
html .feed-body > *:first-child { margin-top: 0; }
html .feed-body > *:last-child { margin-bottom: 0; }
/* 混排段落里的单图（不在图片组里的） */
html .feed-body img {
  width: auto;
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 8px;
}

/* 图片组（.ph-imgs）在首页比正文更紧凑；分档规则见第十一节 */
html .feed-body .ph-imgs { gap: 6px; margin: 12px 0; }
html .feed-body .ph-imgs--1 img { max-height: 360px; }

/* 封面缩略图 */
html .feed-thumb {
  display: block;
  margin-top: 12px;
}
html .feed-thumb img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border: 1px solid var(--ef-bg3);
  border-radius: 8px;
}

html .feed-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
html .feed-tag {
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--ef-bg2);
  color: var(--ef-grey2);
  font-size: .76em;
  transition: color .2s;
}
html .feed-tag:hover { color: var(--ef-green); }

html .home-empty {
  padding: 40px 0;
  color: var(--ef-grey1);
  text-align: center;
}

/* ---- 7.3 窄屏 ---- */
@media screen and (max-width: 900px) {
  html .home-side { position: static; }
}


/* ---- 7.4 左列的补充内容：搜索 / 分类 / 快捷链接 ---- */
html .home-search-wrap {
  position: relative;
}

html .home-search-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ef-grey1);
  font-size: .8em;
  pointer-events: none;
}

html .home-search {
  width: 100%;
  padding: 8px 10px 8px 32px;
  border: 1px solid var(--ef-bg3);
  border-radius: 8px;
  background: var(--ef-bg1);
  color: var(--font-color);
  font-size: .85em;
  transition: border-color .2s, background-color .2s;
}
html .home-search::placeholder { color: var(--ef-grey0); }
html .home-search:focus {
  outline: none;
  border-color: var(--ef-green);
  background: var(--ef-bg2);
}

/* 筛选按钮里的数字 */
html .home-filter-count {
  margin-left: 6px;
  color: inherit;
  opacity: .7;
  font-size: .9em;
}

/* 分类快速入口 */
html .home-cats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  border: 1px solid var(--ef-bg3);
  border-radius: 8px;
  background: var(--ef-bg1);
}

html .home-cats-title {
  margin-bottom: 4px;
  padding: 0 4px;
  color: var(--ef-grey0);
  font-size: .74em;
  letter-spacing: .05em;
}

html .home-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px;
  border-radius: 6px;
  color: var(--ef-grey2);
  font-size: .85em;
  transition: background-color .2s, color .2s;
}
html .home-cat:hover {
  background: var(--ef-bg2);
  color: var(--ef-green);
}
html .home-cat i {
  flex: none;
  width: 1em;
  color: var(--ef-green);
  font-size: .9em;
}
html .home-cat-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
html .home-cat-count {
  margin-left: auto;
  color: var(--ef-grey0);
  font-size: .85em;
}

/* 底部快捷链接 */
html .home-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px;
}
html .home-link {
  color: var(--ef-grey1);
  font-size: .8em;
  transition: color .2s;
}
html .home-link:hover { color: var(--ef-green); }


/* ---- 7.5 左列改版：大作者卡 + 公告板 + 两列筛选 ---- */

/* 作者卡加大：头像 56px，名字更醒目 */
html .home-author {
  gap: 14px;
  padding: 16px 16px;
}
html .home-author-avatar {
  width: 56px;
  height: 56px;
}
html .home-author-name {
  font-size: 1.05em;
  font-weight: 600;
}
html .home-author-hint {
  font-size: .78em;
}

/* 筛选条已移到中栏顶部：横向排列，不再用网格 */
html .home-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
html .home-filter {
  padding: 7px 14px;
  white-space: nowrap;
}
html .home-filter-count {
  margin-left: 6px;
}

/* 中栏容器：筛选 + 时间流 */
html .home-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* 公告板 */
html .home-board {
  padding: 14px 16px;
  border: 1px solid var(--ef-bg3);
  border-radius: 8px;
  background: var(--ef-bg1);
}
html .home-board-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--ef-green);
  font-size: .82em;
  font-weight: 600;
}
html .home-board-text {
  margin: 0;
  color: var(--ef-grey1);
  font-size: .84em;
  line-height: 1.8;
  /* home.js 用 textContent 塞进来（不解析 HTML），所以 site.yml 里的换行
     必须靠这个保留，否则 \n\n 会被折叠成一个空格。 */
  white-space: pre-wrap;
  overflow-wrap: break-word;
}


/* ---- 7.6 左列的置顶文章 ---- */
html .home-pins {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

html .home-pins-title {
  padding: 0 2px 2px;
  color: var(--ef-grey1);
  font-size: .76em;
  font-weight: 600;
  letter-spacing: .05em;
}
html .home-pins-title i {
  color: var(--ef-orange);
}

/* 复用旧的 .home-item 卡片样式，这里只需要让 <a> 表现一致 */
html .home-pins .home-item {
  border-color: var(--ef-bg3);
  text-decoration: none;
}
html .home-pins .home-item:hover {
  border-color: var(--ef-green);
}


/* ---- 7.7 搬到左列的作者卡 ----
   主题的卡片背景/圆角是靠 `#aside-content .card-widget` 这个选择器给的，
   卡片被搬到 #aside-content 外面后就不匹配了，会变成「裸」内容。
   这里把同样的外观补回来。 */
html .home-side .card-widget {
  position: relative;
  overflow: hidden;
  margin-bottom: 0;
  padding: 20px 18px;
  background: var(--card-bg);
  border: 1px solid var(--ef-bg3);
  border-radius: 8px;
}

/* 复刻主题给 #aside-content 里作者卡的排版 —— 这些规则带 `#aside-content` 前缀，
   卡片搬到左列后全部失效，会导致名字缩回默认字号、座右铭间距消失。
   这里原样照抄，保证左右两张卡看起来一模一样。 */
html .home-side .card-info .author-info-name {
  font-weight: 500;
  font-size: 1.57em;
  color: var(--font-color);
}
html .home-side .card-info .author-info-description {
  margin-top: -0.42em;
  color: var(--font-color);
}
html .home-side .card-info .site-data {
  margin: 14px 0 4px;
}

/* 统计栏：标签 / 数字两行的字号与颜色（主题那两条没带前缀，本来就得生效，
   显式写一遍是为了防止以后主题改版把它包进 #aside-content） */
html .home-side .card-info .site-data .headline {
  color: var(--font-color);
  font-size: .95em;
}
html .home-side .card-info .site-data .length-num {
  margin-top: -0.45em;
  color: var(--text-highlight-color);
  font-size: 1.2em;
}


/* ============================================================================
 * 7.8 首页三栏的竖向间距统一
 * ----------------------------------------------------------------------------
 * 之前左栏（.home-side gap:10px）、中栏（.home-main/.home-feed gap:14px）、
 * 右栏（主题 .card-widget margin-bottom:20px）各用各的数字，观感不一致。
 * 这里统一成 16px —— 只在首页生效，文章页的侧栏保持主题原样。
 * ========================================================================= */

html.home-mode .home-side,
html.home-mode .home-main,
html.home-mode .home-feed {
  gap: 16px;
}

html.home-mode #aside-content .card-widget {
  margin-bottom: 16px;
}

/* 置顶那一组里的文章小卡片属于同一组，内部保持紧凑的 6px，
   只把「标题 → 第一张卡片」的间距对齐到组间距 */
html.home-mode .home-pins {
  gap: 6px;
}
html.home-mode .home-pins-title {
  padding: 0 2px 4px;
}


/* ---- 4.7 文章库的「搜正文」开关 ---- */
html .library-fulltext {
  flex: none;
  padding: 8px 13px;
  border: 1px solid var(--ef-bg3);
  border-radius: 8px;
  background: var(--ef-bg1);
  color: var(--ef-grey1);
  font-size: .82em;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s;
}
html .library-fulltext:hover {
  border-color: var(--ef-green);
  color: var(--ef-green);
}
html .library-fulltext.is-active {
  background: var(--ef-green);
  border-color: var(--ef-green);
  color: #2d353b;
  font-weight: 600;
}


/* ============================================================================
 * 八、去掉搜索框原生的清除按钮
 * ----------------------------------------------------------------------------
 * <input type="search"> 在 Chrome / Edge 下会自带一个清除按钮
 * （::-webkit-search-cancel-button），它是浏览器原生 UI，颜色由系统决定，
 * 用 color 改不了 —— 所以在深色背景上会显得又蓝又突兀。
 * 这里直接隐藏：清除靠手动删字符即可。
 * ========================================================================= */

html input[type='search']::-webkit-search-cancel-button,
html input[type='search']::-webkit-search-decoration,
html input[type='search']::-webkit-search-results-button,
html input[type='search']::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}


/* ============================================================================
 * 九、KaTeX 公式：说说页 / 首页时间流里也要显示
 * ----------------------------------------------------------------------------
 * 主题为了避免「先看到没排版的公式再跳一下」，把 .katex 默认设成 display:none，
 * 等 JS 加载完公式样式后再给元素补 .katex-show 类（见主题
 * includes/third-party/math/katex.pug）。但说说页和首页的时间流内容是
 * fetch / JSON 之后动态插进 DOM 的：
 *   1. 那一刻已经错过了主题扫 #article-container .katex 的时机；
 *   2. 这两个页面也没有 page.katex 开关，主题根本不会加载公式样式。
 * 结果就是公式整块空白。
 *
 * 这里直接让公式显示（样式由 inject.head 里的本地 katex.min.css 提供），
 * 不再依赖那次「加载完再加类」的时序。
 * ========================================================================= */

html .katex {
  display: inline !important;
}

/* 块级公式（$$...$$）还是按块显示，才能居中、换行 */
html .katex-display .katex {
  display: block !important;
}

/* ============================================================================
 * 十、歌曲页面（/songs/）
 * ========================================================================= */

html #songs-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

html .song-card {
  padding: 14px 16px;
  background: var(--ef-bg1);
  border: 1px solid var(--ef-bg3);
  border-radius: 10px;
}

html .song-card-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

html .song-card-title {
  margin: 0;
  font-size: 1.08em;
  color: var(--ef-fg);
}

html .song-card-artist {
  color: var(--ef-grey1);
}

html .song-card-meta {
  margin-left: auto;
  color: var(--ef-grey0);
  font-size: .8em;
}

html .song-card-badge {
  padding: 1px 8px;
  border-radius: 20px;
  background: var(--ef-bg2);
  color: var(--ef-yellow);
  font-size: .72em;
}

html .song-note {
  margin: 8px 0 0;
  color: var(--ef-grey1);
  font-size: .92em;
  line-height: 1.7;
}

/* 感想是 Markdown 渲染出来的，兼容段落 / 列表 / 链接 / 行内代码 */
html .song-note p { margin: 0 0 6px; }
html .song-note p:last-child { margin-bottom: 0; }
html .song-note a { color: var(--ef-blue); }
html .song-note code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--ef-bg2);
  font-size: .94em;
}
html .song-note ul,
html .song-note ol {
  margin: 4px 0;
  padding-left: 20px;
}
html .song-note img { max-width: 100%; border-radius: 6px; }

html .song-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

html .song-link,
html .song-lyrics-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border: 1px solid var(--ef-bg3);
  border-radius: 20px;
  background: none;
  color: var(--ef-grey1);
  font-size: .8em;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

html .song-link:hover,
html .song-lyrics-btn:hover {
  border-color: var(--ef-green);
  color: var(--ef-green);
}

html .song-lyrics {
  display: none;
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--ef-bg0);
  color: var(--ef-grey1);
  /* 歌词用等宽字体对齐时间轴（--ef-mono 的字体栈见 everforest.css 第六节） */
  font-family: var(--ef-mono, monospace);
  font-size: .84em;
  line-height: 1.9;
  white-space: pre-wrap;
}

html .song-lyrics.is-open { display: block; }

html .songs-empty {
  color: var(--ef-grey0);
  text-align: center;
  padding: 40px 0;
}


/* ============================================================================
 * 十一、图片组（.ph-imgs）：按张数分档
 * ──────────────────────────────────────────────────────────────────────────
 * 连续写的图片（中间不空行）由 scripts/img-group.js 在 **Markdown 阶段**
 * 就包成一段现成的 HTML：
 *
 *     <div class="ph-imgs ph-imgs--N">     ← N = 1 / 2 / 3 / 4 / many
 *
 * 张数在渲染期就数好了，CSS 只按 class 排版。为什么不再用
 * `p:has(> a:nth-of-type(2) > img)` 那种写法（踩过，见 AGENTS.md 第 8 条）：
 *   ① 选择器数不出「这一段到底几张」，只能判断「≥2」；
 *   ② 它会连「一段文字 + 一张图」的段落一起命中，把文字拆进网格；
 *   ③ `:has()` 里再套 `:has()` 是非法语法，整条规则被浏览器静默丢弃。
 *
 * 分档：1 张完整显示（不裁切）/ 2 张两列 / 3 张三列 / 4 张 2×2 /
 *       5 张以上九宫格。多图用固定比例的格子 + cover，裁掉的部分点开看原图。
 *
 * 想给某一组图指定列数：说说在 shuoshuo.yml 里写 `layout: grid2`
 * （single / grid1 / grid2 / grid3 / grid4），管理页有下拉框。
 * 正文里没有显式覆盖，按张数自动。
 *
 * ⚠️ 文章页的容器带 ID，主题对 #article-container img 有自己的基础样式
 *    （margin / max-width），所以 img 相关规则要带上同样的 ID 前缀才压得住；
 *    文章页是 article#article-container、说说页是 div#article-container，
 *    统一写 #article-container 就能两处都命中；首页 feed 没有这层容器，
 *    走不带前缀的那条。
 * ========================================================================= */

html .ph-imgs {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

/* 包裹层（分组时直接输出的 <a>，或 fancybox 事后包的）撑满格子，
   否则图片按自身宽度缩回去、网格对齐就乱了 */
html .ph-imgs > a,
html .ph-imgs > p > a {
  display: block;
  min-width: 0;          /* 同上：别让图片的 min-content 撑开网格 */
  overflow: hidden;
  border-radius: 8px;
}

html #article-container .ph-imgs img,
html .ph-imgs img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  border-radius: 8px;
  object-fit: cover;
  object-position: center;
}

/* 单张：完整显示（竖图不再被裁）、居中，太高时按视口收 */
html .ph-imgs--1 { grid-template-columns: 1fr; justify-items: center; }
html .ph-imgs--1 > a,
html .ph-imgs--1 > p > a { width: fit-content; max-width: 100%; }

html #article-container .ph-imgs--1 img,
html .ph-imgs--1 img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

/* 列宽一律 minmax(0, 1fr)：`1fr` 的最小宽度是 min-content，
   而图片/链接的 min-content 是图片内在宽度（缩略图也有 1000px）。
   首页三栏里中栏被这种「最小宽度」撑宽，会把右栏从 304px 挤到 160px
   —— 三栏来回跳的根因（实测 CLS 0.13 → 见 docs/agent/01）。 */
html .ph-imgs--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html .ph-imgs--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* 4 张 → 2×2，比 3 + 1 好看 */
html .ph-imgs--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* 5 张以上 → 九宫格 */
html .ph-imgs--many { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* 比例放在 img 上（width:100% + height:auto + aspect-ratio + object-fit:cover）：
   不要放在包裹层 <a> 上 —— grid item 默认 stretch，行高由图片内在高度决定，
   aspect-ratio 会被忽略；而 img 的 height:100% 又找不到确定的父高度（都踩过）。 */
html #article-container .ph-imgs--2 img,
html .ph-imgs--2 img { aspect-ratio: 4 / 3; }

html #article-container .ph-imgs--3 img,
html .ph-imgs--3 img,
html #article-container .ph-imgs--4 img,
html .ph-imgs--4 img,
html #article-container .ph-imgs--many img,
html .ph-imgs--many img { aspect-ratio: 1; }

/* 窄屏：三列太挤，降到两列；单图照旧完整显示 */
@media screen and (max-width: 600px) {
  html .ph-imgs--3,
  html .ph-imgs--many { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================================
 * 十二、文章正文里的视频
 * ──────────────────────────────────────────────────────────────────────────
 * 站内没有 {% video %} 标签（主题 tag 插件只有 button/chartjs/flink/gallery/
 * hide/inlineImg/label/mermaid/note/score/series/tabs/timeline），所以正文直接写裸 HTML：
 *
 *     <video controls playsinline preload="metadata"
 *            src="../videos/demo.mp4" poster="../images/demo.jpg"></video>
 *
 * `../videos/` 与图片同理，由 scripts/img-path.js 改写成 `/videos/` ——
 * VSCode 预览能播，线上路径也对。
 *
 * ⚠️ 单文件必须 ≤ 25 MiB：超过后 Cloudflare Workers 静态资源会整包部署失败
 *    （`Asset too large`），比 GitHub Pages 的 100 MB 单文件限制更紧。
 *
 * 注意：
 *   1. 主题对 <video> 没有任何样式，不加这段会按视频原始像素尺寸撑破正文栏；
 *   2. background 用最暗的 bg0：首帧解码前不闪一块白（暗色站特别明显）；
 *   3. 控件条是浏览器原生的（Safari/Chrome 偏亮），纯 CSS 改不动，接受即可。
 * ========================================================================= */

html article#article-container video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 16px 0;
  border-radius: 8px;
  background: var(--ef-bg0);
}

/* ============================================================================
 * 十三、正文字号
 * ──────────────────────────────────────────────────────────────────────────
 * 主题把 body 和 #article-container 的字号都绑在 --global-font-size 上，
 * 而 _config.butterfly.yml 的 font.global_font_size 是空值 → 默认 14px。
 * 14px 中文长文偏小，正文单独放大到 16px。
 *
 * 为什么不去改 font.global_font_size：那个变量是全站 em 的基准，
 * 侧栏 / 三栏首页 / 管理页预览里几十处 .72em / .86em 都按它折算，
 * 一改会连带把布局挤坏。这里只放大正文容器，其它区域维持原样。
 *
 * 注意（有意为之，别当成没生效）：
 *   1. 行内 `code` 不受影响（主题自己绑了 var(--global-font-size)，是绝对值）；
 *   2. 代码块默认会跟着变大（主题的 .line 是 0.92em，父级 14px → 16px 时
 *      从 12.88px 涨到 14.72px，行宽一起变、横向滚动更多），所以下面把它
 *      钉回 14px，保持原来的观感；
 *   3. 行高沿用主题的 2（→32px）。中文 16px 配 2 倍行高偏松但读起来稳，
 *      想紧凑就把 #article-container 的 line-height 调到 1.85 左右。
 * ========================================================================= */

html #article-container {
  font-size: 16px;
}

/* 代码块保持原大小（详情见本节注释第 2 条） */
html #article-container figure.highlight,
html #article-container .code-wrapper {
  font-size: 14px;
}


/* ============================================================================
 * 十四、壁纸与亚克力（#web_bg + backdrop-filter）
 * ──────────────────────────────────────────────────────────────────────────
 * 壁纸层由 _config.butterfly.yml 的 `background` 触发（主题 layout.pug 只在
 * 该配置非空时生成 #web_bg）。配色相关内容——遮罩浓度、明暗换图、--ef-glass
 * 的定义——在 everforest.css 第十七节与 1.1 / 2.1 色板里。这一节只管两件事：
 *   1. 把硬写 `background: var(--ef-bg1)` 的自定义卡片改成 --ef-glass
 *      （主题卡片走 --card-bg，改一个变量就已经半透明了）；
 *   2. 给「大面板」加 backdrop-filter 模糊。
 *
 * 三条硬规矩：
 *   · 列表行（.lib-item 那种几十条的）只半透明、不加 blur —— 每个 blur 层
 *     在滚动时都要逐帧重采样，长列表会掉帧；卡片背后本来就被上层卡片盖住，
 *     少一层模糊几乎看不出来；
 *   · 按钮 / 输入框 / chip（.home-filter、.library-search…）保持实色：
 *     玻璃叠玻璃会糊成一片，字也不好读；
 *   · 不支持 backdrop-filter 的浏览器整块回退成不透明 bg1，
 *     --card-bg 和 background 要一起回退，只改一半会出现「半透明但没模糊」。
 * ========================================================================= */

/* ---- 14.1 自定义卡片：实色 bg1 → 半透明玻璃底 ---- */
html .lib-item,
html .home-item,
html .home-preview,
html .feed-item,
html .home-board,
html .song-card,
html .library-tree,
html #page .category-lists li.category-list-item {
  background: var(--ef-glass);
}

/* ---- 14.2 大面板加模糊（主题卡片 + 自定义卡片）---- */
html .cardHover,
html #recent-posts .recent-post-item,
html .card-widget,
html #article-container .shuoshuo-item,
html .feed-item,
html .home-board,
html .home-item,
html .song-card,
html .library-tree,
html #page .category-lists li.category-list-item {
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
}

/* ---- 14.3 固定导航也吃玻璃（原来只有 rgba 底，没有 blur）---- */
html[data-theme='dark'] #page-header.nav-fixed > #nav,
html[data-theme='dark'] #page-header.not-top-img > #nav,
html:root:not([data-theme='dark']) #page-header.nav-fixed > #nav,
html:root:not([data-theme='dark']) #page-header.not-top-img > #nav {
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  backdrop-filter: blur(12px) saturate(1.1);
}

/* ---- 14.4 窄屏减负：手机 GPU 弱，壁纸收益也小 ---- */
@media screen and (max-width: 768px) {
  html .cardHover,
  html #recent-posts .recent-post-item,
  html .card-widget,
  html #article-container .shuoshuo-item,
  html .feed-item,
  html .home-board,
  html .home-item,
  html .song-card,
  html .library-tree,
  html #page .category-lists li.category-list-item {
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
    backdrop-filter: blur(10px) saturate(1.1);
  }
}

/* ---- 14.5 不支持模糊时回退实色（变量与自定义卡片一起回退）---- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-theme='dark'] {
    --card-bg: var(--ef-bg1);
  }
  html:root:not([data-theme='dark']) {
    --card-bg: var(--ef-bg1);
  }
  html .lib-item,
  html .home-item,
  html .home-preview,
  html .feed-item,
  html .home-board,
  html .song-card,
  html .library-tree,
  html #page .category-lists li.category-list-item {
    background: var(--ef-bg1);
  }
}
