/* =====================================================================
    Blog Design System
   全站换肤，暗色(默认)/亮色双模式，侧栏 Grid 布局，卡片化组件。
   ===================================================================== */

/* ---------- 1. 设计令牌 (Design Tokens) ---------- */
:root {
  --neut-L90: rgba(255,255,255,0.9);
  --neut-L75: rgba(255,255,255,0.75);
  --neut-L50: rgba(255,255,255,0.5);
  --neut-L30: rgba(255,255,255,0.3);
  --neut-L10: rgba(255,255,255,0.1);
  --nav-link: rgba(255,255,255,0.62);   /* 导航菜单文字（压横幅上，降对比更柔和，不抢标题） */
  --banner-dim: rgba(0,0,0,0.2);
  --primary-hue: 250;            /* ♥ 全站唯一色相，改它即换肤 */
  --primary-chroma: 0.14;       /* ♥ 主色彩度；石墨灰等预设由 _head.php 注入更低值以灰化强调色 */
  --nav-p: 0;                    /* 顶部导航收缩进度 0~1：theme.js 随滚动写入，
                                    导航高度/字号/图标/侧栏吸附位都由它 calc() 派生 */
  --nav-h-full: 58px;            /* 导航未收缩的最大高度；横幅上提垫底用同一真源，保持同步 */
  --nav-h: calc(var(--nav-h-full) - 14px * var(--nav-p));   /* 导航实时高度（唯一真源）：58 → 44px */
  --hero-overlap: 56px;          /* 有横幅时，内容压上横幅下缘的高度。
                                    原站取 56px（= 导航 58px − 网格行距 2px 近似），且仅 ≥768px 生效 */
  --grid-lead: 40px;             /* #main-grid 自身的前导留白 = padding-top 24 + 首行空隙 16,
                                    压边时要把这段留白一并抵掉 */
  --main-title: rgba(255,255,255,0.9);
  --btn-content: var(--neut-L75);
  --btn-content-hover: var(--btn-content);
  --card-btn-bg: var(--card-background);
  --card-btn-icon: var(--primary);
  --btn-text-neutral-text: var(--neut-L75);
  --btn-text-content: var(--primary);
  --btn-text-light-text: var(--primary);
  --title-hover: var(--primary);
  --light-dot: var(--primary);
  --article-meta: rgba(255,255,255,0.5);
  --article-text: rgba(255,255,255,0.75);
  --info-name: rgba(255,255,255,0.9);
  --info-sub: rgba(255,255,255,0.5);
  --link: var(--primary);
  --color-picker-border: var(--primary);
  --color-picker-thumb: var(--primary);
  --pagenav-curr-bg: var(--primary);
  --widget-title: var(--main-title);
  --archive-year: var(--neut-L75);
  --archive-date: var(--neut-L50);
  --archive-title: var(--neut-L75);
  --archive-tags: var(--neut-L30);
  --archive-dashline: var(--neut-L10);
  --primary-btn-bg: var(--primary);
  --img-overlay: rgba(0,0,0,0.1);
  --sidebar-width: 280px;
  --display-light-icon: 0;
  --display-dark-icon: 1;
}

/* 现代浏览器：OKLCH 色彩空间 */
@supports (color: oklch(0 0 0)) {
  :root {
    --primary: oklch(0.75 var(--primary-chroma,0.14) var(--primary-hue));
    --nav-dropdown-bg: oklch(0.2 0.02 var(--primary-hue));
    --page-background: oklch(0.16 0.014 var(--primary-hue));
    --card-background: oklch(0.25 0.02 var(--primary-hue));
    --btn-bg: oklch(0.38 0.04 var(--primary-hue));
    --btn-hover: oklch(0.45 0.045 var(--primary-hue));
    --btn-active: oklch(0.5 0.05 var(--primary-hue));
    --card-btn-hover: oklch(0.3 0.03 var(--primary-hue));
    --card-btn-active: oklch(0.35 0.035 var(--primary-hue));
    --btn-text-hover: oklch(0.2 0.02 var(--primary-hue));
    --btn-text-active: oklch(0.17 0.017 var(--primary-hue));
    --timeline-dim-dot: oklch(0.5 0.05 var(--primary-hue));
    --title-active: oklch(0.65 0.12 var(--primary-hue));
    --tag-dot: oklch(0.25 0.02 var(--primary-hue));
    --highlight-selection: oklch(0.35 0.035 var(--primary-hue));
    --article-code-bg: oklch(0.4 0.04 var(--primary-hue));
    --article-block: oklch(0.2 0.02 var(--primary-hue));
    --link-hover-bg: oklch(0.4 0.08 var(--primary-hue));
    --link-active-bg: oklch(0.35 0.07 var(--primary-hue));
    --blockquote-bg: oklch(0.2 0.02 var(--primary-hue));
    --blockquote-bar: oklch(0.4 0.04 var(--primary-hue));
    --table-bg: oklch(0.22 0.02 var(--primary-hue));
    --table-row-deep: oklch(0.2 0.02 var(--primary-hue));
    --color-picker-range: oklch(0.4 0.04 var(--primary-hue));
    --badge-bg: oklch(0.75 0.12 var(--primary-hue));
    --text-on-light: oklch(0.25 0.02 var(--primary-hue));
    --pagenav-curr-text: oklch(0.25 0.02 var(--primary-hue));
    --input-field: oklch(0.2 0.02 var(--primary-hue));
    --primary-btn-text: oklch(0.25 0.02 var(--primary-hue));
    --enter-btn-bg: oklch(0.2 0.02 var(--primary-hue));
    --enter-btn-hover: oklch(0.3 0.03 var(--primary-hue));
    --enter-btn-active: oklch(0.35 0.035 var(--primary-hue));
    --selection-bg: oklch(0.4 0.08 var(--primary-hue));
    --code-block-selection-bg: oklch(0.4 0.08 var(--primary-hue));
    --code-comment: oklch(0.55 0.02 var(--primary-hue));
    --code-keyword: oklch(0.78 0.13 305);
    --code-string: oklch(0.8 0.12 150);
    --code-number: oklch(0.8 0.12 70);
    --code-title: oklch(0.78 0.11 230);
    --code-attr: oklch(0.78 0.1 185);
    --code-tag: oklch(0.72 0.13 25);
  }
}

/* 旧浏览器降级：hex */
@supports not (color: oklch(0 0 0)) {
  :root {
    --primary: #63b3ff;
    --nav-dropdown-bg: #0f171f;
    --page-background: #090e13;
    --card-background: #1a222b;
    --btn-bg: #324457;
    --btn-hover: #42576e;
    --btn-active: #4d667f;
    --card-btn-hover: #222f3c;
    --card-btn-active: #2d3c4c;
    --btn-text-hover: #0f171f;
    --btn-text-active: #0a1017;
    --timeline-dim-dot: #4d667f;
    --title-active: #5194d5;
    --tag-dot: #1a222b;
    --highlight-selection: #2d3c4c;
    --article-code-bg: #374a5d;
    --article-block: #0f171f;
    --link-hover-bg: #224a71;
    --link-active-bg: #1b3c5d;
    --blockquote-bg: #0f171f;
    --blockquote-bar: #374a5d;
    --table-bg: #141b24;
    --table-row-deep: #0f171f;
    --color-picker-range: #374a5d;
    --badge-bg: #70b3f7;
    --text-on-light: #1a222b;
    --pagenav-curr-text: #1a222b;
    --input-field: #0f171f;
    --primary-btn-text: #1a222b;
    --enter-btn-bg: #0f171f;
    --enter-btn-hover: #222f3c;
    --enter-btn-active: #2d3c4c;
    --selection-bg: #224a71;
    --code-block-selection-bg: #224a71;
    --code-comment: #6d819a;
    --code-keyword: #c792ea;
    --code-string: #a5e0a0;
    --code-number: #f0b76a;
    --code-title: #79b8f0;
    --code-attr: #7fd4d4;
    --code-tag: #f08080;
  }
}

/* 亮色模式覆盖 */
:root[theme='light'] {
  --card-background: #fff;
  --banner-dim: none;
  --neut-L90: rgba(0,0,0,0.9);
  --neut-L75: rgba(0,0,0,0.75);
  --nav-link: rgba(0,0,0,0.7);          /* 亮色模式：导航菜单文字（黑偏灰，清晰不抢标题） */
  --neut-L50: rgba(0,0,0,0.5);
  --neut-L30: rgba(0,0,0,0.3);
  --neut-L10: rgba(0,0,0,0.1);
  --main-title: rgba(0,0,0,0.9);
  --article-meta: rgba(0,0,0,0.5);
  --article-text: rgba(0,0,0,0.75);
  --btn-text-neutral-text: rgba(0,0,0,0.75);
  --info-name: rgba(0,0,0,0.9);
  --info-sub: rgba(0,0,0,0.5);
  --tag-dot: var(--btn-content);
  --img-overlay: rgba(0,0,0,0);
  --pagenav-curr-text: rgba(255,255,255,0.9);
  --primary-btn-text: rgba(255,255,255,0.9);
  --display-light-icon: 1;
  --display-dark-icon: 0;
}
@supports (color: oklch(0 0 0)) {
  :root[theme='light'] {
    --primary: oklch(0.7 var(--primary-chroma,0.14) var(--primary-hue));
    --page-background: oklch(0.95 0.01 var(--primary-hue));
    --nav-dropdown-bg: oklch(0.98 0.005 var(--primary-hue));
    --btn-bg: oklch(0.95 0.025 var(--primary-hue));
    --btn-content: oklch(0.55 0.12 var(--primary-hue));
    --btn-hover: oklch(0.9 0.05 var(--primary-hue));
    --btn-active: oklch(0.85 0.08 var(--primary-hue));
    --btn-text-hover: oklch(0.95 0.025 var(--primary-hue));
    --btn-text-active: oklch(0.98 0.01 var(--primary-hue));
    --btn-text-content: oklch(0.7 var(--primary-chroma,0.14) var(--primary-hue));
    --card-btn-hover: oklch(0.98 0.005 var(--primary-hue));
    --card-btn-active: oklch(0.9 0.03 var(--primary-hue));
    --title-active: oklch(0.6 0.12 var(--primary-hue));
    --link-hover-bg: oklch(0.95 0.025 var(--primary-hue));
    --link-active-bg: oklch(0.9 0.05 var(--primary-hue));
    --article-code-bg: oklch(0.92 0.035 var(--primary-hue));
    --blockquote-bg: oklch(0.98 0.005 var(--primary-hue));
    --blockquote-bar: oklch(0.9 0.04 var(--primary-hue));
    --table-bg: oklch(0.99 0.005 var(--primary-hue));
    --table-row-deep: oklch(0.97 0.012 var(--primary-hue));
    --badge-bg: oklch(0.95 0.02 var(--primary-hue));
    --text-on-light: oklch(0.55 0.12 var(--primary-hue));
    --color-picker-range: oklch(0.95 0.02 var(--primary-hue));
    --input-field: oklch(0.98 0.005 var(--primary-hue));
    --enter-btn-bg: oklch(0.98 0.005 var(--primary-hue));
    --enter-btn-hover: oklch(0.96 0.015 var(--primary-hue));
    --enter-btn-active: oklch(0.9 0.03 var(--primary-hue));
    --selection-bg: oklch(0.9 0.05 var(--primary-hue));
    --code-comment: oklch(0.5 0.02 var(--primary-hue));
    --code-keyword: oklch(0.5 0.19 305);
    --code-string: oklch(0.52 0.13 150);
    --code-number: oklch(0.55 0.13 60);
    --code-title: oklch(0.52 0.15 250);
    --code-attr: oklch(0.5 0.11 210);
    --code-tag: oklch(0.52 0.17 25);
  }
}
@supports not (color: oklch(0 0 0)) {
  :root[theme='light'] {
    --primary: #53a3f2;
    --page-background: #eaeff5;
    --nav-dropdown-bg: #f6f9fc;
    --btn-bg: #e2f0ff;
    --btn-content: #3275b4;
    --btn-hover: #c6e1ff;
    --btn-active: #a6d2ff;
    --btn-text-hover: #e2f0ff;
    --btn-text-active: #f4f9ff;
    --btn-text-content: #53a3f2;
    --card-btn-hover: #f6f9fc;
    --card-btn-active: #d0e0f2;
    --title-active: #4284c5;
    --link-hover-bg: #e2f0ff;
    --link-active-bg: #c6e1ff;
    --article-code-bg: #d4e7fc;
    --blockquote-bg: #f6f9fc;
    --blockquote-bar: #cbe1f8;
    --table-bg: #f9fcff;
    --table-row-deep: #eff6fd;
    --badge-bg: #e5f0fc;
    --text-on-light: #3275b4;
    --color-picker-range: #e5f0fc;
    --input-field: #f6f9fc;
    --enter-btn-bg: #f6f9fc;
    --enter-btn-hover: #ebf3fc;
    --enter-btn-active: #d0e0f2;
    --selection-bg: #c6e1ff;
    --code-comment: #7a8ba0;
    --code-keyword: #9d4edd;
    --code-string: #2f8a3e;
    --code-number: #b26205;
    --code-title: #1f6fd0;
    --code-attr: #0e7c86;
    --code-tag: #d63b3b;
  }
}

/* ---------- 2. 基础重置 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  width: 100%;
  min-height: 100vh;
  background: var(--page-background);
  color: var(--neut-L75);
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease-out, color 0.25s ease-out;
}
a { color: var(--link); text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background-color: var(--selection-bg); }

/* ---------- 3. 顶部导航 ----------
   默认全透明、无模糊——完全透出横幅顶部；滚动超过阈值切 .nav-scrolled，
   高度(58→44)、品牌字号/logo、链接字号、操作按钮尺寸、侧栏吸附位、背景 65% 半透明、blur(3px) 玻璃、
   细边框/下投影——全部由同一阈值(0/1)驱动、0.5s ease-in-out 一次性干净缓动
   （丝滑、无逐帧拖尾、无弹性回弹）。--nav-p 由 base.php 在 scrollY>阈值 写 1、否则写 0。 */
#nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: transparent;                 /* 默认全透明、无模糊——纯透出横幅 */
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  border-bottom: 1px solid transparent;    /* 常驻 1px 占位，避免切态时布局抖动 */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); /* 常驻轻投影（复刻 Fluid：透明态也有一条浅浅的暗边，导航在横幅上「浮」起来） */
  transition: height 0.5s ease-in-out, background 0.5s ease-in-out, border-color 0.5s ease-in-out, backdrop-filter 0.5s ease-in-out;
}
#nav.nav-scrolled {
  background: color-mix(in srgb, var(--page-background) 65%, transparent);
  border-bottom-color: var(--neut-L10);
  backdrop-filter: blur(3px);              /* 仅滚动后上玻璃模糊 */
  -webkit-backdrop-filter: blur(3px);
}
/* 收缩后条变更薄，卡片从下方掠过更多面积 —— 下投影随 .nav-scrolled 一次性淡入，
   让导航在内容之上「浮」起来（默认完全透明，不影响首屏观感）。 */
#nav::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -16px;
  height: 16px; pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  background: linear-gradient(to bottom, rgba(0,0,0,0.09), rgba(0,0,0,0));
}
#nav.nav-scrolled::after { opacity: 1; }
.nav-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-title {
  color: var(--main-title);
  font-weight: 700;
  font-size: calc(1.25em - 0.20em * var(--nav-p));
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: font-size 0.5s ease-in-out;
}
.site-title .logo-dot {
  width: calc(12px - 3px * var(--nav-p));
  height: calc(12px - 3px * var(--nav-p));
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
  transition: width 0.5s ease-in-out, height 0.5s ease-in-out;
}
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a {
  color: var(--nav-link);
  font-size: calc(0.92em - 0.08em * var(--nav-p));
  font-weight: 500;
  transition: color 0.15s ease-out, font-size 0.5s ease-in-out;
}
.nav-links a:hover, .nav-links a.active { color: var(--title-hover); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: calc(38px - 8px * var(--nav-p));
  height: calc(38px - 8px * var(--nav-p));
  border: none; cursor: pointer;
  border-radius: 10px;
  background: var(--btn-bg);
  color: var(--btn-content);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease-out, color 0.15s ease-out, width 0.5s ease-in-out, height 0.5s ease-in-out;
}
.icon-btn:hover { background: var(--btn-hover); color: var(--btn-content-hover); }
/* 导航内的图标按钮（主题切换）：裸图标无方形底框（对齐参考站），
   颜色随菜单文字；hover 才浮现轻底色 + 主题色，保留可发现性 */
#nav .icon-btn { background: transparent; color: var(--nav-link); }
#nav .icon-btn:hover { background: var(--btn-hover); color: var(--title-hover); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- 4. 横幅 Banner ---------- */
#banner {
  position: relative;
  width: 100%;
  height: 40vh;
  min-height: 220px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(120% 120% at 20% 10%, oklch(0.6 0.17 var(--primary-hue) / 0.95), transparent 60%),
    linear-gradient(135deg, oklch(0.5 var(--primary-chroma,0.14) var(--primary-hue)), oklch(0.32 0.09 var(--primary-hue)));
  transition: background 0.25s ease-out, opacity 0.15s ease-out;
}
#banner.is_home { height: calc(60vh - 40px); min-height: 320px; }   /* 首页横幅比内页矮 40px（原为 60vh） */
/* 横幅背景=图片（后台可配）：内联 background-image 覆盖渐变；压暗层 (::after) 保留保证标题可读 */
#banner.is-img {
  background-color: oklch(0.32 0.09 var(--primary-hue));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
#banner::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--banner-dim);
}
.banner-inner { position: relative; z-index: 1; padding: 0 24px; }
.banner-inner h1 {
  font-size: clamp(2.2em, 6vw, 4em);
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.25);
}
.banner-inner p {
  margin-top: 10px;
  font-size: 1.05em;
  opacity: 0.9;
  letter-spacing: 0.5px;
}

/* ---------- 5. 主网格布局 ---------- */
#main-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  align-items: start;
}
/* 侧栏吸附位跟着导航一起上移（88px = 导航高 + 16px 间隙），否则收缩后侧栏顶部会空出一截 */
#sidebar-wrapper { grid-row: 2; grid-column: 1; position: sticky; top: calc(var(--nav-h) + 16px); transition: top 0.5s ease-in-out; }
/* 文章大纲 TOC（文章页/单页左栏 #toc）：列出正文 h2/h3，平滑滚动 + 滚动高亮当前章节 */
.toc { font-size: 0.9em; line-height: 1.7; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-item a {
  display: block; padding: 4px 0 4px 12px;
  color: var(--neut-L50, rgba(255,255,255,0.6));
  border-left: 2px solid transparent;
  transition: color 0.15s ease-out, border-color 0.15s ease-out;
}
.toc-item.toc-h3 a { padding-left: 26px; }   /* H3 相对 H2 缩进一级 */
.toc-item a:hover { color: var(--title-hover); }
.toc-item a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
/* 锚点跳转不被 sticky 导航遮挡 */
.article-entry h2, .article-entry h3 { scroll-margin-top: calc(var(--nav-h-full) + 20px); }
/* 正文无小标题的文章：隐藏左栏，单列铺满 */
/* 侧边栏位置：默认在左（基准 #main-grid 已是「左栏 + 右内容」）。
   后台「侧边栏位置 = right」时整体翻到右，首页/分类/文章页/TOC 统一生效。
   限定 ≥1024px，窄屏仍走 max-width:1023px 的单列堆叠（避免单列下被推成隐式第二列）。 */
@media (min-width: 1024px) {
  body.sidebar-right #main-grid { grid-template-columns: minmax(0, 1fr) var(--sidebar-width); }
  body.sidebar-right #content-body { grid-column: 1; }
  body.sidebar-right #sidebar-wrapper { grid-column: 2; }
}
#content-body {
  grid-row: 2; grid-column: 2; min-width: 0;
  /* 卡片/封面为做弧形叠加自带 position+z-index:50，若直接参与根层叠上下文，
     滚动时会反压 sticky 导航（z-index:40）。用 isolation 把内部层级关在本区内：
     区内叠加照旧（50 > 面板 auto），对外则只算一个整体，永远在导航之下。 */
  isolation: isolate;
}
#footer-wrapper { grid-row: 3; grid-column: 1 / span 2; }

/* 有横幅的页面（首页 / 文章页）：整块内容上提，压住横幅下缘（复刻原站）。
   刻意写成「横幅自身的负下边距」而不是给 #main-grid 加负上边距：
   关掉横幅开关时元素是 display:none，边距会随之一同失效，
   不会出现"横幅没了、内容却仍上提 96px 顶进导航"的错位。
   负边距 = 网格前导留白 --grid-lead + 重叠量 --hero-overlap。
   窄屏 ≤767px 原站不压边（横幅常规排在导航下方、留 40px 间距），故限定 min-width。 */
#banner + #main-grid { position: relative; z-index: 1; }   /* 内容绘制在横幅之上 */
@media (min-width: 768px) {
  /* 横幅上提垫进透明导航之下（overlay 结构，参考站同款）：
     未滚动时导航=全透明玻璃、透出横幅顶部；下拉后导航缩矮+渐增半透明。
     全局 border-box → 同步补 padding-top 与高度，横幅可视高度/标题视觉位置均不变。
     关掉横幅时元素 display:none，整套随之中性化，不会出现内容顶进导航的错位。 */
  #banner {
    margin-top: calc(-1 * var(--nav-h-full));
    padding-top: var(--nav-h-full);
    height: calc(40vh + var(--nav-h-full));
    min-height: calc(220px + var(--nav-h-full));
  }
  #banner.is_home {
    height: calc(60vh - 40px + var(--nav-h-full));
    min-height: calc(320px + var(--nav-h-full));
  }
  #banner { margin-bottom: calc(-1 * (var(--grid-lead) + var(--hero-overlap))); }
}

@media (max-width: 1023px) {
  #main-grid { grid-template-columns: 1fr; }
  #sidebar-wrapper { grid-row: 3; grid-column: 1; position: static; margin-top: 16px; }
  #content-body { grid-row: 2; grid-column: 1; }
  #footer-wrapper { grid-row: 4; grid-column: 1; }
}

/* ---------- 6. 侧栏组件 ---------- */
.widget {
  background: var(--card-background);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  transition: background 0.15s ease-out;
}
.widget-title {
  color: var(--widget-title);
  font-size: 1.02em;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex; align-items: center;
}
/* .widget-title:before：4×14 主色竖条（原站 margin-left:-4px → 距卡片左沿 16px，
   margin-right:10px → 文字起于 30px）。这里改用 align-items:center 做垂直居中，几何等价。 */
.widget-title::before {
  content: ""; flex: none;
  width: 4px; height: 14px; border-radius: 2px;
  background: var(--primary);
  margin-left: -4px; margin-right: 10px;
}
.info-card { text-align: center; }
.avatar {
  width: 86px; height: 86px; border-radius: 50%;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, oklch(0.62 0.16 var(--primary-hue)), oklch(0.4 0.1 var(--primary-hue)));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2.1em; font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.info-name { color: var(--info-name); font-weight: 700; font-size: 1.15em; }
.info-sub { color: var(--info-sub); font-size: 0.85em; margin: 4px 0 14px; }
.social-links { display: flex; gap: 10px; justify-content: center; }
.social-links a {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--btn-bg); color: var(--btn-content);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease-out, color 0.15s ease-out;
}
.social-links a:hover { background: var(--btn-hover); color: var(--btn-content-hover); }
.social-links svg { width: 17px; height: 17px; }

.widget-list { list-style: none; margin: 0; padding: 0; }
.widget-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--archive-dashline);
}
.widget-list li:last-child { border-bottom: none; }
.widget-list a { color: var(--neut-L75); transition: color 0.15s ease-out; }
.widget-list a:hover { color: var(--title-hover); }
.widget-list .count { color: var(--article-meta); font-size: 0.78em; }
/* 后台 widget 片段的空态提示（暂无分类/标签/文章） */
.widget-empty { color: var(--article-meta); font-size: 0.85em; margin: 0; }
/* 后台 widget：搜索框（与评论输入区同语言：圆角输入框 + 主色按钮） */
.widget-search { display: flex; gap: 8px; }
.widget-search-input {
  flex: 1 1 0; min-width: 0; height: 38px;
  border: none; border-radius: 8px;
  background: var(--input-field); color: var(--neut-L75);
  padding: 0 12px; font-size: 14px; font-family: inherit;
}
.widget-search-input:focus { outline: none; }
.widget-search-input::placeholder { color: var(--neut-L30); }
.widget-search-btn {
  height: 38px; padding: 0 16px;
  border: none; border-radius: 8px;
  background: var(--primary); color: var(--card-background);
  font-size: 14px; font-family: inherit;
  cursor: pointer; transition: opacity 0.15s ease-out;
}
.widget-search-btn:hover { opacity: 0.85; }
/* 后台 widget：最新评论（首行 作者+《文章》，次行摘要两行截断） */
.widget-comments .wc-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
}
.widget-comments .wc-author { color: var(--main-title); font-size: 0.9em; flex: none; }
.widget-comments .wc-post {
  color: var(--article-meta); font-size: 0.8em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.widget-comments .wc-post a { color: inherit; transition: color 0.15s ease-out; }
.widget-comments .wc-post a:hover { color: var(--title-hover); }
.widget-comments .wc-excerpt {
  margin-top: 4px;
  color: var(--article-meta); font-size: 0.82em; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* 后台 widget：友链 logo 小图标 */
.widget-list .wl-logo {
  width: 18px; height: 18px; border-radius: 4px;
  vertical-align: -3px; margin-right: 6px;
}

/* ---------- 7. 首页文章卡片（复刻 Vivia article-inner + right-panel） ---------- */
.idx-card {
  display: flex;
  background: var(--card-background);
  border-radius: 16px;
  margin-bottom: 16px;
  overflow: hidden;
  transition: background 0.15s ease-out;
}
/* 文字面板压在缩略图之上：自身 16px 圆角 + margin-right:-16px 反向叠进图片 16px，
   于是圆角缺口处透出底下的图片，交界处自然形成凹弧（复刻原版 .article-main 手法）
   卡片整体高度 = 内边距 + 标题 + 元信息 + 摘要 + 标签，故压缩高度只调「外围留白与段间距」，
   不动字号与行高（文本密度不变，只是卡片更紧凑）。 */
.idx-main {
  width: 100%; min-width: 0;
  margin-right: -16px;
  padding: 26px 40px 22px;
  background: var(--card-background);
  border-radius: 16px;
  position: relative;
  z-index: 50;
  transition: background 0.15s ease-out;
}
.idx-title { margin: 0 0 8px; font-size: 1.55em; line-height: 1.3; font-weight: 700; position: relative; }
/* .main-title-dot：4×20 主色竖条，绝对定位悬在标题左侧的 padding 区，
   不占位、不推移标题文字（原站 left:-16px / top:9.5px 的等比换算） */
.idx-title::before {
  content: ""; position: absolute;
  left: -16px; top: calc((1.3em - 20px) / 2);
  width: 4px; height: 20px; border-radius: 2px;
  background: var(--primary);
}
.idx-title a { color: var(--main-title); text-decoration: none; transition: color 0.15s ease-out; }
.idx-title a:hover { color: var(--title-hover); }
.idx-meta {
  display: flex; flex-wrap: wrap; align-items: center;
  color: var(--article-meta); font-size: 0.88em;
}
.idx-meta > span { white-space: nowrap; }
/* 卡片元信息里的分类不做链接变色（含 hover），与日期/字数同灰 */
.idx-meta a,
.idx-meta a:hover { color: var(--article-meta); }
.idx-meta .dot {
  width: 4px; height: 4px; border-radius: 50%; flex: none;
  background: var(--neut-L30); margin: 0 10px;
}
.idx-entry { color: var(--article-text); line-height: 1.75; margin-top: 10px; }
.idx-entry p {
  margin: 0; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3;
  -webkit-box-orient: vertical;
}
.idx-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* 右侧面板：有缩略图 → 背景图铺满；无缩略图 → 箭头按钮 */
.idx-panel {
  flex: none;
  display: flex; align-items: center; justify-content: flex-end;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  transition: all 0.15s ease-out;
}
/* 原站为 35%；此处收窄到 30%，让文字区更宽、缩略图更克制 */
.idx-panel.with-pic { min-width: 30%; }
.idx-panel.with-pic .overlay {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: var(--img-overlay);
  transition: background 0.15s ease-out;
}
.idx-panel .ico { width: 24px; height: 24px; flex: none; }
.idx-panel.with-pic .overlay .ico {
  width: 40px; height: 40px; color: #fff; opacity: 0;
  transition: opacity 0.15s ease-out;
}
.idx-panel.with-pic .overlay:hover { background: rgba(0,0,0,0.5); }
.idx-panel.with-pic .overlay:hover .ico { opacity: 1; }
.idx-panel.non-pic { min-width: 76px; background: var(--enter-btn-bg); }
.idx-panel.non-pic .ico { color: var(--primary); margin-right: 24px; }
.idx-panel.non-pic:hover { background: var(--enter-btn-hover); }
.idx-panel.non-pic:active { background: var(--enter-btn-active); }
/* ---------- 8. 按钮 / 标签 chip ---------- */
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--btn-bg); color: var(--btn-content);
  border: none; border-radius: 8px; padding: 6px 13px;
  font-size: 0.82em; cursor: pointer;
  transition: background 0.15s ease-out, color 0.15s ease-out;
  text-decoration: none;
}
.chip:hover { background: var(--btn-hover); color: var(--btn-content-hover); }
.chip:active { background: var(--btn-active); }
.chip .c-count { opacity: 0.6; font-size: 0.85em; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- 9. 分页 ---------- */
/* #page-nav 是外层容器（内置分页直接放 .page-nav-btn，后端分页放 <nav class="pager">）。
   这里统一居中：容器按 justify-content:center 排子项，子项 .pager 再撑满一行内部居中，
   这样不论几条分页按钮都稳定居中，不会因内容宽度变化而左右漂移。 */
#page-nav { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; justify-content: center; }
.page-nav-btn, .num-bar {
  background: var(--card-background);
  border-radius: 8px; padding: 9px 15px;
  color: var(--btn-content); text-decoration: none;
  transition: background 0.15s ease-out, color 0.15s ease-out;
}
.page-nav-btn:hover, .num-bar:hover { background: var(--card-btn-hover); }
#page-nav .current {
  background: var(--pagenav-curr-bg);
  color: var(--pagenav-curr-text);
  font-weight: 700;
}

/* ---------- 10. 独立页卡片（归档 / 标签 / 分类共用一张卡） ---------- */
.archive-main-card,
.page-card {
  background: var(--card-background);
  border-radius: 16px;
  padding: 32px 0;
  transition: background 0.15s ease-out;
}
.archive-main-card .archive-top,
.page-card .card-top { padding: 0 40px; }
/* 标题条 + 左侧强调色竖条：原版为全局组件，归档/独立页/文章页共用 */
.main-title-bar {
  display: flex; align-items: center;
  margin-bottom: 6px; position: relative;
}
.main-title-bar h1 { width: 100%; margin: 0; }
.main-title-dot {
  width: 4px; height: 20px; position: absolute;
  left: -16px; top: 9.5px;
  background: var(--primary); border-radius: 2px;
}
.archive-main-card h1,
.page-card h1 {
  margin: 0; font-size: 32px; font-weight: bold;
  color: var(--main-title); line-height: 40px;
}
.archive-main-card .archive-sub,
.page-card .card-sub {
  color: var(--article-meta); font-size: 0.85em; margin-top: 2px;
}
/* 卡片内正文区的统一内边距 */
.page-card .card-body { padding: 12px 40px 0; }
.page-card .card-body.rows { padding: 8px 24px 0; }
.archive-main-card .year-line {
  display: flex; align-items: center;
  margin: 8px 44px 0; height: 60px;
}
.archive-main-card .year-num {
  font-size: 24px; color: var(--archive-year); font-weight: bold;
  width: 10%; text-align: right;
  transition: color 0.15s ease-out;
}
.archive-main-card .dot-wrapper {
  width: 10%; display: flex; align-items: center; justify-content: center;
}
.archive-main-card .dot-wrapper .dot {
  width: 12px; height: 12px; border-radius: 50%;
  outline: 3px solid var(--light-dot); outline-offset: -2px; z-index: 1;
}
.archive-main-card .article-count {
  width: 40%; color: var(--neut-L50);
  transition: color 0.15s ease-out;
}
.archive-main-card .archive-article-link {
  display: flex; align-items: center; height: 40px;
  margin: 0 24px; padding: 0 20px; border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s ease-out;
}
.archive-main-card .archive-article-link:hover { background: var(--btn-text-hover); }
.archive-main-card .archive-article-link:hover .title-inner {
  color: var(--btn-text-light-text); padding-left: 4px;
}
.archive-main-card .archive-article-link:hover .dot {
  height: 20px; background: var(--light-dot); outline-color: var(--btn-text-hover);
}
.archive-main-card .archive-article-link:active { background: var(--btn-text-active); }
.archive-main-card .archive-article-link:active .dot { outline-color: var(--btn-text-active); }
.archive-main-card .archive-article-link .date {
  font-size: 14px; color: var(--archive-date); width: 10%;
  text-align: right; transition: color 0.15s ease-out;
}
.archive-main-card .archive-article-link .line {
  width: 10%; height: 100%; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.archive-main-card .archive-article-link .line::before {
  content: ''; position: absolute;
  left: calc(50% - 1px); top: -50%; height: 100%;
  border-left: 2px dashed var(--archive-dashline);
  pointer-events: none;
  transition: border-color 0.15s ease-out;
}
.archive-main-card .archive-article-link .dot {
  width: 4px; height: 4px; border-radius: 2px;
  background: var(--timeline-dim-dot);
  outline: 8px solid var(--card-background); z-index: 10;
  transition: background 0.15s ease-out, height 0.15s ease-out, outline-color 0.15s ease-out;
}
.archive-main-card .archive-article-link .title { width: 65%; min-width: 0; }
.archive-main-card .archive-article-link .title-inner {
  font-size: 16px; padding-right: 32px; font-weight: bold;
  color: var(--archive-title);
  white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
  transition: padding-left 0.15s ease-out, color 0.15s ease-out;
}
.archive-main-card .archive-article-link .tags {
  color: var(--archive-tags); font-size: 14px; width: 15%;
  white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
  transition: color 0.15s ease-out;
}
@media (max-width: 767px) {
  .archive-main-card .year-num,
  .archive-main-card .archive-article-link .date { width: 20%; }
  .archive-main-card .dot-wrapper,
  .archive-main-card .archive-article-link .line { width: 15%; }
  .archive-main-card .archive-article-link .tags { display: none; }
  .archive-main-card .archive-article-link .title { width: 80%; }
  .archive-main-card .archive-top { padding: 0 28px; }
}

/* ---------- 11. 标签云 / 分类列表（均落在 .page-card 卡片内） ---------- */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-cloud .chip { padding: 9px 15px; font-size: 0.86em; }

.cat-rows { display: flex; flex-direction: column; }
.cat-row {
  display: flex; align-items: center; gap: 16px;
  height: 52px; padding: 0 20px; border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s ease-out;
}
.cat-row:hover { background: var(--btn-text-hover); }
.cat-row:active { background: var(--btn-text-active); }
.cat-row .c-name {
  flex: 1 1 auto; min-width: 0; color: var(--main-title);
  font-weight: 700; font-size: 1.05em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cat-row .c-count { flex: none; color: var(--article-meta); font-size: 0.85em; }
.cat-row .c-bar {
  flex: none; width: 180px; height: 6px; border-radius: 6px;
  background: var(--btn-bg); overflow: hidden;
}
.cat-row .c-bar > i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }

/* ---------- 12. 文章封面 / 文章正文 (article-gallery / article-entry) ---------- */

/* 文章封面：上圆角 + 反向叠进下方文章卡 16px
   → 文章卡自身的 16px 上圆角缺口透出封面，两块的交接处即形成弧形 */
.article-gallery {
  position: relative;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  margin-bottom: -16px;
}
.article-gallery-photos { position: relative; overflow: hidden; }
.article-gallery-img { display: block; }
.article-gallery-img img {
  display: block; width: 100%;
  object-fit: cover; margin: 0 auto;
  max-height: 40vh;
}

/* 文章卡：position + z-index 使其压在封面上方，只有圆角缺口处才透出封面 */
.article-inner {
  position: relative;
  z-index: 50;
  background: var(--card-background);
  border-radius: 16px;
  padding: 32px 40px 40px;
  margin-bottom: 16px;
  transition: background 0.15s ease-out;
}
.article-header { margin-bottom: 20px; }
.article-title { font-size: 2em; font-weight: 800; color: var(--main-title); margin: 0 0 0.3em; line-height: 1.25; }

/* 元信息（日期 · 分类 · 字数）——分隔圆点由 .need-seperator 生成 */
.meta-info-bar {
  color: var(--article-meta); font-size: 0.95em;
  display: flex; flex-wrap: wrap; align-items: center;
}
.meta-info-bar .need-seperator { display: flex; align-items: center; }
.meta-info-bar .need-seperator::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: var(--neut-L30); margin: 0 16px;
}
.meta-info-bar a { color: var(--article-meta); text-decoration: none; transition: color 0.15s ease-out; }
.meta-info-bar a:hover { color: var(--link); }
.article-tag-list {
  margin-top: 12px; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; row-gap: 10px; column-gap: 8px;
}

.article-entry { color: var(--article-text); padding: 0; line-height: 1.85; }
.article-entry > *:first-child { margin-top: 0; }
.article-entry h2 { font-size: 1.5em; margin: 1.5em 0 0.6em; color: var(--main-title); font-weight: 700; }
.article-entry h3 { font-size: 1.25em; margin: 1.3em 0 0.5em; color: var(--main-title); font-weight: 700; }
.article-entry p { margin: 0 0 1.1em; }
.article-entry a { color: var(--link); text-decoration: none; border-bottom: 1px solid var(--link); }
.article-entry a:hover { background: var(--link-hover-bg); }
.article-entry strong { color: var(--main-title); }
.article-entry ul, .article-entry ol { margin: 0 0 1.1em 22px; line-height: 1.8; }
.article-entry li { margin: 0.3em 0; }
.article-entry blockquote {
  border-left: 4px solid var(--blockquote-bar);
  background: var(--blockquote-bg);
  margin: 1.3em 0; padding: 14px 22px; border-radius: 0 10px 10px 0;
  color: var(--article-text);
}
.article-entry blockquote p:last-child { margin-bottom: 0; }
.article-entry code {
  background: var(--article-code-bg); padding: 2px 7px; border-radius: 6px;
  font-family: "JetBrains Mono", "Source Code Pro", Consolas, Monaco, Menlo, monospace;
  font-size: 0.86em;
}
.article-entry pre {
  background: var(--article-code-bg); padding: 16px 20px; border-radius: 12px;
  overflow: auto; margin: 1.3em 0;
}
.article-entry pre code { background: none; padding: 0; font-size: 0.85em; line-height: 1.6; }
/* ---------- 12b. 代码高亮（highlight.js 令牌 → 主题双模式变量，暗/亮自动跟随 html[theme]） ---------- */
.hljs-comment, .hljs-quote { color: var(--code-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-doctag, .hljs-meta .hljs-keyword { color: var(--code-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition { color: var(--code-string); }
.hljs-number, .hljs-literal, .hljs-bullet, .hljs-link, .hljs-meta { color: var(--code-number); }
.hljs-title, .hljs-title.function_, .hljs-section, .hljs-name { color: var(--code-title); }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-type,
.hljs-built_in, .hljs-builtin-name, .hljs-symbol, .hljs-selector-attr, .hljs-selector-pseudo,
.hljs-selector-class, .hljs-selector-id { color: var(--code-attr); }
.hljs-tag, .hljs-deletion { color: var(--code-tag); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }
.article-entry img {
  max-width: 100%; border-radius: 12px; margin: 1.2em 0;
  border: 1px solid var(--img-overlay);
}
.article-entry table {
  width: 100%; border-collapse: collapse; margin: 1.3em 0;
  background: var(--table-bg); border-radius: 12px; overflow: hidden;
}
.article-entry th, .article-entry td { padding: 11px 15px; text-align: left; }
.article-entry thead th { color: var(--main-title); font-weight: 700; border-bottom: 1px solid var(--neut-L10); }
.article-entry tbody tr:nth-child(even) { background: var(--table-row-deep); }
.article-entry del { text-decoration: line-through; opacity: 0.7; }
.article-entry ul.task-list { list-style: none; padding-left: 0; }
.article-entry ul.task-list li.task-item { padding-left: 0; }
.article-entry ul.task-list li.task-item > label { display: flex; align-items: flex-start; gap: 9px; cursor: default; }
.article-entry ul.task-list input[type="checkbox"] { flex: none; width: 15px; height: 15px; margin: .3em 0 0; vertical-align: -1px; accent-color: var(--primary, #066fd1); }
.article-entry ul.task-list input[type="checkbox"]:checked + .task-text { opacity: .7; text-decoration: line-through; }

/* 上一篇 / 下一篇（单行：箭头 + 标题，无文字标签） */
#article-nav { display: flex; gap: 16px; margin: 16px 0; }
.article-nav-btn {
  flex: 1; background: var(--card-background); border-radius: 16px;
  padding: 18px 24px; text-decoration: none;
  transition: background 0.15s ease-out;
  display: flex; align-items: center; gap: 10px;
}
.article-nav-btn:hover { background: var(--card-btn-hover); }
.article-nav-btn .nav-arrow {
  flex: none; color: var(--article-meta); line-height: 1;
  transition: color 0.15s ease-out, transform 0.15s ease-out;
}
.article-nav-btn .nav-arrow svg { width: 24px; height: 24px; display: block; }
.article-nav-btn .nav-title { color: var(--main-title); font-weight: 700; min-width: 0; }
.article-nav-btn.next { justify-content: flex-end; text-align: right; }
.article-nav-btn.prev:hover .nav-arrow { color: var(--primary); transform: translateX(-3px); }
.article-nav-btn.next:hover .nav-arrow { color: var(--primary); transform: translateX(3px); }

/* ---------- 13. 评论区 ----------
   原站结构：#comment-card > .main-title-bar + #vcomments（Valine 挂载点）。
   下列数值均取自原站实测（computed style），非估计值。 */
.comment-card {
  background: var(--card-background);
  border-radius: 16px;
  padding: 32px 40px 32px 40px;   /* 底部留白：原站靠 .vpower 收尾，本主题不渲染该元素 → 直接给足 */
  margin-bottom: 16px;
  transition: background 0.15s ease-out;
}
/* 原站显式禁用卡内一切过渡（.comment-card * { transition: none }） */
.comment-card * { transition: none; }
.comment-card .main-title-bar { margin-bottom: 24px; }
.comment-card .main-title { font-size: 32px; font-weight: bold; color: var(--main-title); line-height: 40px; }
#vcomments { margin-top: 16px; }

/* --- 评论输入区 --- */
.vwrap { margin-bottom: 10px; }
.vheader.item3 { display: flex; gap: 12px; margin-bottom: 12px; }
.vinput {
  font-size: 14px; color: var(--neut-L75);
  background: var(--input-field);
  border: none; border-radius: 8px;
  padding: 10px 5px 10px 16px;
  font-family: inherit;
}
.vinput:focus, .veditor:focus { outline: none; }
.vheader.item3 .vinput { flex: 1 1 0; min-width: 0; height: 45px; }
.vedit {
  background: var(--input-field); border-radius: 8px;
  padding: 16px; margin-bottom: 12px;
}
.veditor {
  display: block; width: 100%; height: 123px;
  background: transparent; border: none; resize: vertical;
  padding: 10px 5px;
}
.comment-card ::placeholder { color: var(--neut-L30); }

.vrow { display: flex; align-items: center; }
.vcol-30 { width: 30%; } .vcol-40 { width: 40%; }
.vcol-60 { width: 60%; } .vcol-70 { width: 70%; }
.text-right { text-align: right; }
.status-bar { font-size: 13px; color: var(--neut-L30); }   /* 校验/状态提示（ .status-bar 位） */

/* --- 表单校验高亮：未通过时输入框描边转为系统主色 ---
   边框用 --primary（跟随后台/hue 换肤），与全站强调色一致；
   不出现红色文字提示，仅靠描边 + 自动定位表达「这一项要填」。
   用 inset 阴影做描边（不改变盒尺寸、不引起布局跳动）。 */
.vwrap .vinput.is-invalid,
.vwrap .veditor.is-invalid,
.vwrap .vedit.is-invalid { box-shadow: 0 0 0 1px var(--primary) inset; }
/* 校验失败时输入框加一圈同色外描边，聚焦感更明确 */
.vwrap .vinput.is-invalid:focus,
.vwrap .veditor.is-invalid:focus { box-shadow: 0 0 0 1px var(--primary) inset, 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
/* 校验反馈只靠「描边 + 自动定位」，不再有文字提示行 */
/* 预览区：点「预览」时把编辑器内容做一次极简 Markdown 渲染 */
.vpreview { display: none; margin-top: 10px; padding: 12px 16px; }
.vpreview p { margin: 0 0 8px; font-size: 14px; line-height: 24.5px; color: var(--neut-L75); }
.vpreview p:last-child { margin-bottom: 0; }
.vpreview strong { color: var(--main-title); }
.vpreview code {
  background: var(--article-code-bg); padding: 2px 6px; border-radius: 6px;
  font-family: "JetBrains Mono", "Source Code Pro", Consolas, Monaco, Menlo, monospace;
  font-size: 0.88em;
}
.vctrl .vicon { display: inline-flex; margin-left: 10px; cursor: pointer; color: var(--primary); }
.vctrl .vicon:hover, .vat:hover, .vsubmit:hover { opacity: 0.78; }
.vbtn:active { opacity: 0.65; }
.comment-card svg path { fill: var(--primary); }   /* 原站：卡内图标一律填主色 */
.vctrl .vicon svg { width: 22px; height: 22px; }   /* 仅正文工具图标 22px，Markdown 徽标保持 16px */
.vatx { color: var(--primary); }                   /* 正文里的 @提及 */
.vsubmit {
  height: 32px; min-width: 80px;
  border: none; border-radius: 8px;
  background: var(--primary); color: var(--card-background);
  font-size: 14px; font-weight: bold; font-family: inherit;
  cursor: pointer;
}
/* 「取消回复」条：常驻 DOM，默认 display:none，进入回复态才显示 */
.cancel-reply { display: none; margin: 0 0 10px; cursor: pointer; color: var(--neut-L50); }
.cancel-reply svg { width: 20px; height: 20px; vertical-align: middle; }
.vwrap.replying .cancel-reply { display: block; }

/* --- 评论数 --- */
.vcount { font-size: 20px; font-weight: 600; color: var(--neut-L50); padding: 5px 0; }

/* =====================================================================
   评论列表（重新设计：条目化 + 收紧间距）
   问题：原实现只有纵向堆叠，条目之间没有任何视觉边界，回复按钮 float:right
   又把「时间」推到卡片最左、与条目首行分属两行 → 观感松散、条目不清。
   方案：每条评论 = 一张独立轻卡片（浅底 + 1px 描边 + 12px 圆角 + 14/16 内边距），
   头部一行放下「头像 + 昵称 + 博主徽章 + 时间」，回复按钮 float:right 与头部同高，
   正文紧贴头部（间距 6px），子回复装在父卡内部、缩进 46px + 极淡底色区分层级。
   间距收敛：条目间 10px、卡片内边距 14px 16px、正文行高 23px。
   ===================================================================== */
.vcards { line-height: 1.6; }
.vcards > .vcard + .vcard { margin-top: 16px; }        /* 条目间距：稍大一点，区块之间更透气 */

.vcard {
  position: relative;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--input-field);                       /* 与卡片底色区分：暗色更深、亮色更浅 */
  border: 1px solid var(--neut-L10);
}
.vcard::after { content: ""; display: block; clear: both; }   /* 清除头像浮动 */

/* --- 头部：两行式（第一行 昵称+徽章，第二行 时间），回复按钮绝对定位贴右 ---
   标记契约（_comments.php）：.vh 内依次是 .vhead(昵称+徽章) / .vmeta(时间+回复) / .vcontent。
   布局：.vh 为 flex 换行容器 → .vhead 与 .vmeta 各占一行（宽度 100%）；
   .vtime 在 .vmeta 内首个位置左对齐（与昵称左缘对齐）；.vat 抽出为绝对于 .vcard 的右上角按钮，
   这样它既不会挤占时间的位置，也不会把头部撑成额外一行。 */
/* 注意：.vimg 是 float:left，.vh 作为块级盒子会**自动避开**它（左缘已被推到 65px），
   所以这里绝不能再加 padding-left，否则会二次缩进、正文与头部一起右移 48px。 */
.vh { display: flex; flex-wrap: wrap; align-items: center; min-width: 0; }
.vimg {
  display: block; float: left;
  width: 38px; height: 38px; padding: 1px;
  margin-right: 10px; border-radius: 10px;
  border: 1px solid var(--neut-L30);                    /* 头像描边：让头像更醒目 */
}
.vhead { display: flex; align-items: center; flex: 0 0 100%; min-height: 20px; }
.vnick {
  font-size: 14px; font-weight: 600; color: var(--neut-L90);
  line-height: 20px; max-width: 40%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vnick:hover { color: var(--primary); }
.vsys {
  flex: none; margin-left: 8px; padding: 1px 6px;
  font-size: 11px; line-height: 16px; border-radius: 4px;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, transparent);
}
.vmeta { flex: 0 0 100%; display: block; margin: 0; min-width: 0; }
.vtime { display: block; font-size: 12px; line-height: 18px; color: var(--neut-L30); }
/* 回复按钮：绝对定位到卡片右上（与卡片 14px 上内边距、16px 右内边距对齐），不占头部行。
   悬停才显形（鼠标移到这条评论上时，右侧才出现「回复」）：
   --focus 承载键盘可见性，opacity 做淡入淡出；
   ⛔ 不能用 display/visibility 切换——那会把元素从可聚焦树里摘掉，键盘用户永远够不到。
   ⛔ 标记必须是 <button> 而非 <span>：span 不可聚焦，键盘 Tab 根本走不到它
   （实测 span.focus() 后 activeElement 仍是 BODY）→ 悬停显形就等于对键盘用户彻底隐藏。
   所以这里要显式清掉浏览器给 button 的默认外观（底色/描边/字体）。 */
.vat { position: absolute; top: 14px; right: 16px; z-index: 1;
       font-size: 13px; line-height: 20px; color: var(--primary); cursor: pointer;
       /* 清 button 默认外观 */
       appearance: none; -webkit-appearance: none;
       background: none; border: 0; padding: 0; margin: 0;
       font-family: inherit;
       opacity: 0; transition: opacity 0.15s ease-out; }
.vcard:hover .vat,
.vcard:focus-within .vat { opacity: 0.85; }
.vat:hover { opacity: 1; }
/* 焦点指示：键盘 Tab 到按钮上时给一圈主色描边（仅键盘，鼠标点击不显示） */
.vat:focus-visible { opacity: 1; outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
/* 昵称宽度上限收窄，避免长昵称顶到绝对定位的回复按钮下方 */
.vhead { padding-right: 52px; }

/* --- 正文：flex-basis:100% 独占一行，紧贴头部 --- */
.vcontent { flex: 0 1 100%; min-width: 0; margin: 5px 0 0; padding: 0; font-size: 14px; overflow-wrap: anywhere; }
.vcontent p { margin: 0; font-size: 14px; line-height: 23px; color: var(--neut-L75); }
.vcontent p + p { margin-top: 6px; }
/* --- 子回复：缩进 + 极淡主色底，层级一眼可辨 ---
   缩进收敛（关键）：原写死 46px 会**逐层累加**，三层就缩掉 138px、卡片被挤成窄条。
   这里用选择器链逐层递减追加量（46 / 54 / 62，封顶 62px），不依赖 JS 或 CSS 变量，
   无论嵌套多深，子卡左缘都不超过 62px，深层回复仍有足够正文宽度。
   父卡内边距 16px，故负边距 -16px 让子卡列表贴满父卡右侧。 */
.vquote {
  margin: 10px -16px -14px 0;
  padding: 10px 16px 12px 0;
  border-top: 1px solid var(--neut-L10);
}
.vquote .vcard {
  margin-left: 46px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--primary) 5%, transparent);
  border-color: var(--neut-L10);
}
.vquote .vquote .vcard { margin-left: 54px; }
.vquote .vquote .vquote .vcard { margin-left: 62px; }
.vquote .vquote .vquote .vquote .vcard { margin-left: 62px; }   /* 第 4 层及更深：封顶 */
.vquote .vcard + .vcard { margin-top: 8px; }
.vquote .vimg { width: 32px; height: 32px; margin-right: 9px; border-radius: 8px; }
.vquote .vhead { min-height: 30px; padding-right: 46px; }
.vquote .vnick { font-size: 13.5px; }
.vquote .vtime { font-size: 11.5px; line-height: 17px; }
.vquote .vat { top: 12px; right: 14px; font-size: 12.5px; }
.vquote .vcontent { margin-top: 5px; }
.vquote .vcontent p { font-size: 13.5px; line-height: 22px; }

/* --- 窄屏（≤768px）：侧栏折叠后正文区仅约 260px。嵌套卡片会被**每层父卡的 padding 逐级吃掉**
    宽度（实测 263→219→177→135px），所以移动端不再做「卡中卡」：
    取消子卡的内边距与外层 padding，改为「统一的纯左缩进条」，宽度不再衰减。
    层级改由左侧竖条颜色深浅 + 底色提示。 --- */
@media (max-width: 768px) {
  .vcard { padding: 12px 13px; }
  .vimg { width: 32px; height: 32px; margin-right: 9px; border-radius: 8px; }
  .vhead { min-height: 30px; padding-right: 46px; }
  .vnick { font-size: 13.5px; max-width: 40%; }
  .vsys { margin-left: 6px; }
  .vtime { font-size: 11.5px; line-height: 17px; }
  .vat { top: 12px; right: 13px; font-size: 12.5px; }
  .vcontent { margin-top: 5px; }
  .vcontent p { font-size: 13.5px; line-height: 22px; }
  /* 子回复区：去掉负边距与外层内边距，只留顶部细线 */
  .vquote {
    margin: 8px 0 0;
    padding: 8px 0 0;
    border-top: 1px solid var(--neut-L10);
  }
  /* 子卡：这是关键——把子卡**反向抵消父卡的左右内边距**，让每一层的可用宽度都等于父卡宽度，
     否则每层父卡的 13px padding + 14px margin 会逐级叠加，四层就吃掉近 100px（实测曾从 263 掉到 135px）。
     做法：margin-left 抵消 13px、margin-right 抵消 13px，再用 padding-left 表达 14px 缩进。 */
  .vquote .vcard,
  .vquote .vquote .vcard,
  .vquote .vquote .vquote .vcard,
  .vquote .vquote .vquote .vquote .vcard {
    margin: 0 -13px 0 0;
    padding: 10px 0 0 27px;
    border: none;
    border-left: 2px solid var(--neut-L10);
    background: transparent;
  }
  /* 第 2 层起左侧竖条加深，替代缩进承担层级提示 */
  .vquote .vquote .vcard,
  .vquote .vquote .vquote .vcard,
  .vquote .vquote .vquote .vquote .vcard {
    border-left-color: color-mix(in srgb, var(--primary) 45%, transparent);
  }
  .vquote .vcard + .vcard { margin-top: 10px; }
}

/* --- 无悬停能力设备（触屏）：悬停显形会变成「永远看不到」，
   所以交还为常显。用 @media (hover:none) 而非宽度断点——带触屏的宽屏设备同样适用。 --- */
@media (hover: none) {
  .vat { opacity: 0.85; }
}

/* --- 加载更多 / 版权 --- */
.vpage { text-align: center; }
.vmore {
  margin-top: 14px; padding: 7px 17.5px;
  font-size: 14px; font-family: inherit; cursor: pointer;
  background: transparent; color: var(--neut-L75);
  border: 1px solid var(--neut-L10); border-radius: 4.2px;
}
.vmore:hover { color: var(--primary); border-color: var(--primary); }
.vpower { padding-bottom: 24px; font-size: 14px; line-height: 14px; color: #999; text-align: right; }
.vpower a { color: var(--link); }

/* ---------- 14. 页脚 ---------- */
#footer-wrapper {
  color: var(--article-meta); text-align: center;
  padding: 28px 0 8px; font-size: 0.85em; line-height: 1.8;
}
#footer-wrapper a { color: var(--link); }

/* ---------- 15. 设置面板（明暗 / 色相 / Banner）+ 右下角悬浮按钮组 ---------- */
#settings {
  position: fixed; right: 20px; bottom: 82px; z-index: 60;
  width: 250px;
  background: var(--card-background);
  border-radius: 16px;
  padding: 16px 15px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  transition: background 0.15s ease-out, opacity 0.22s ease-out, transform 0.22s ease-out;
  opacity: 0; transform: translateY(10px); pointer-events: none;
}
#settings.open { opacity: 1; transform: none; pointer-events: auto; }
#settings h4 {
  margin: 0; padding: 0 3px; color: var(--widget-title); font-size: 0.92em;
  user-select: none; -webkit-user-select: none;
}
#settings .body {
  margin-top: 12px; padding: 0 3px;
  overflow: hidden;
}
#settings .row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 10px;
}
#settings label { color: var(--article-meta); font-size: 0.82em; }
#settings input[type="range"] {
  width: 130px; accent-color: var(--primary); cursor: pointer;
}
#settings .switch { position: relative; width: 42px; height: 24px; }
#settings .switch input { opacity: 0; width: 0; height: 0; }
#settings .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--btn-bg); border-radius: 24px; transition: 0.2s;
}
#settings .slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: var(--btn-content); border-radius: 50%; transition: 0.2s;
}
#settings .switch input:checked + .slider { background: var(--primary); }
#settings .switch input:checked + .slider::before { transform: translateX(18px); background: #fff; }
#settings .preset-row { display: flex; gap: 8px; margin-top: 4px; }
#settings .preset {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; transition: transform 0.15s ease-out;
}
#settings .preset:hover { transform: scale(1.12); }
/* 色相滑块右侧实时色块（与后台 .schema-swatch 同观感） */
#settings .hue-control { display: inline-flex; align-items: center; gap: 8px; }
#settings .hue-swatch {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  border: 1px solid rgba(0,0,0,0.18);
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
  transition: background 0.12s ease-out;
}

/* 右下角悬浮按钮组：返回顶部 + 主题设置 */
#fab-stack {
  position: fixed; right: 20px; bottom: 20px; z-index: 61;
  display: flex; flex-direction: column; gap: 10px;
}
#fab-stack button {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card-background); color: var(--btn-content);
  border: 1px solid var(--border-color, transparent);
  box-shadow: 0 6px 20px rgba(0,0,0,0.22);
  cursor: pointer; padding: 0;
  transition: background 0.15s ease-out, color 0.15s ease-out, opacity 0.22s ease-out, transform 0.22s ease-out;
}
#fab-stack button:hover { background: var(--primary); color: var(--btn-content-hover); }
#fab-stack button svg { width: 18px; height: 18px; }
#back-top { opacity: 0; transform: translateY(8px); pointer-events: none; }
#back-top.show { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- 16. 响应式微调 ---------- */
@media (max-width: 767px) {
  /* 导航：链接整行折到第二行，避免右侧按钮被挤出视口产生横向滚动。
     移动端不缩矮（JS 在 <768px 写 --nav-p:0 且不切 .nav-scrolled），内容直接滚到导航之下，
     故交还「近实心底 + 玻璃模糊 + 细边框」保证可读，且隐藏桌面滚动专用的下投影。 */
  #nav {
    height: auto; min-height: 60px; padding: 10px 0;
    background: var(--nav-dropdown-bg);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border-bottom: 1px solid var(--neut-L10);
  }
  #nav::after { display: none; }
  .nav-inner { flex-wrap: wrap; row-gap: 8px; }
  .site-title { font-size: 1.1em; }
  .nav-links { flex-wrap: wrap; gap: 14px; order: 3; width: 100%; }
  .nav-links a { font-size: 0.85em; }
  .article-inner { padding: 22px 20px 28px; }
  .article-entry { padding: 0; }
  .meta-info-bar .need-seperator::before { margin: 0 12px; }
  .idx-main { padding: 20px 24px 18px; }
  .idx-panel { display: none; }          /* 与参考站点一致：窄屏隐藏右侧面板 */
  .article-entry table { display: block; overflow-x: auto; }  /* 宽表格改为卡内横向滚动，不撑破页面 */
  .cat-row { padding: 0 12px; }
  .cat-row .c-bar { display: none; }
  #settings { left: 12px; right: 12px; width: auto; bottom: 82px; }
  #fab-stack { right: 14px; bottom: 14px; }
}

/* =====================================================================
   15. QiLog 集成层（PHP 主题运行时需要的补充样式）
   ---------------------------------------------------------------------
   后端分页输出的是 <nav class="pager">（.cur / .gap / a），映射成 page-nav 外观；
   评论走真实系统（.vat 回复、.is-init 头像兜底）；搜索框 / 404 / 友链行为新增组件。
   全部沿用既有设计令牌，不引入新色值。
   ===================================================================== */

/* --- 后端分页 ---
   参考站结构：‹ 按钮 | #num-bar（数字装在同一张卡里、彼此紧贴）| › 按钮。
   实测数值：按钮 40×40 / border-radius 8px / 三组间距 12px；
   #num-bar 自身是卡片底色，其内 .page-number 背景透明、文字 0.75 白、字重 700；
   仅 .current 铺 --primary；箭头是 FontAwesome 图标，本站改纯 CSS chevron。

   本站后端输出的是一维平铺：<a>上一页</a> <a>1</a> <span.cur>2</span> <a>下一页</a>
   （没有 #num-bar 包裹，也无法从主题改内核）→ 纯 CSS 还原：
   ① flex order 把「上一页/下一页」推到两端，当独立卡片箭头；
   ② 数字项相邻两两用 -8px 负边距咬合，圆角互相盖住 → 视觉连成一张卡。 */
#content-body .pager {
  display: flex; gap: 0; margin-top: 24px;
  justify-content: center; align-items: center;
  flex-wrap: nowrap;
}
/* 数字项：自带卡片底 + 与相邻数字咬合（首/尾保持外侧圆角） */
#content-body .pager .pn-num,
#content-body .pager .cur,
#content-body .pager .gap {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; padding: 0;
  background: var(--card-background);
  color: var(--article-meta); font-weight: 700;
  text-decoration: none; font-size: 16px; box-sizing: border-box;
  transition: background 0.15s ease-out, color 0.15s ease-out;
}

/* 箭头用类名定位（内核 pager() 输出 .pn-prev / .pn-next）。
   ⛔ 别用 a:first-child / a:last-child：末页无「下一页」时 a:last-child
   会落到数字项上 → 箭头样式整个失效；也别用 [href*="page="]：
   数字 1 的 href(?page=1) 与「上一页」完全相同，无法区分（两处都踩过）。 */

/* 咬合：数字项右移 -8px 盖住前一项的右圆角，形成连续色块。
   只作用于数字组内部（.pn-num/.cur/.gap），箭头天然被排除。 */
#content-body .pager > :is(.pn-num, .cur, .gap) + :is(.pn-num, .cur, .gap) { margin-left: -8px; }
#content-body .pager > .cur { background: var(--pagenav-curr-bg); color: var(--pagenav-curr-text); position: relative; z-index: 2; }
#content-body .pager > .gap { background: var(--card-background); }

/* 「上一页 / 下一页」→ 两端箭头按钮（参考站 #prev-btn / #next-btn）
   独立卡片：与数字组之间留 12px，不参与咬合。 */
#content-body .pager > .pn-prev,
#content-body .pager > .pn-next {
  font-size: 0;                       /* 隐去「上一页 / 下一页」文字 */
  width: 40px; height: 40px; flex: 0 0 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; padding: 0; box-sizing: border-box;
  background: var(--card-background);
  color: var(--primary);              /* 箭头取主色（参考站 prev-btn 实测色） */
  text-decoration: none;
  transition: background 0.15s ease-out, opacity 0.15s ease-out;
}
#content-body .pager > .pn-prev { margin-left: 0; margin-right: 12px; }
#content-body .pager > .pn-next { margin-left: 12px; margin-right: 0; }
#content-body .pager > .pn-prev:hover,
#content-body .pager > .pn-next:hover { background: var(--card-btn-hover); opacity: 0.85; }

/* 箭头字形：用内联 SVG 描边路径做 chevron，笔画粗细 / 圆角端点都可控，
   比 border 拼的直角三角更接近参考站 fa-angle-left/right 的字形手感（无字体依赖）。
   mask 只用 SVG 的 alpha 挖形状，涂色仍走 background: currentColor → 跟随主色/悬停态。 */
#content-body .pager {
  --chev-l: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='14.5 5 7.5 12 14.5 19'/%3E%3C/svg%3E");
  --chev-r: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9.5 5 16.5 12 9.5 19'/%3E%3C/svg%3E");
}
#content-body .pager > .pn-prev::before,
#content-body .pager > .pn-next::before {
  content: ""; width: 16px; height: 16px; flex: none;
  background: currentColor;
  -webkit-mask: var(--chev-l) center / 16px 16px no-repeat;
  mask: var(--chev-l) center / 16px 16px no-repeat;
}
#content-body .pager > .pn-next::before {
  -webkit-mask-image: var(--chev-r);
  mask-image: var(--chev-r);
}
#page-nav .pager { margin-top: 0; flex: 1 1 100%; }   /* 撑满一行，内部再居中（配合 #page-nav 的 justify-content） */

/* --- 评论：头像兜底（与主头像同尺寸同形，尺寸差异由 .vquote 覆写） --- */
.vimg.is-init {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--btn-bg); color: var(--primary); font-weight: 700; font-size: 15px;
  border: 1px solid var(--neut-L30);
  flex: none;
}
.comment-card .hp { display: none; }

.vquote .vimg.is-init { width: 32px; height: 32px; border-radius: 8px; font-size: 13px; }

/* --- 评论分页（与文章分页一致：整行居中） --- */
.comment-pager { margin: 4px 0 20px; justify-content: center; }

/* --- 搜索表单（search.php 卡片内） --- */
.vsearch-form { display: flex; gap: 10px; padding: 4px 0 8px; }
.vsearch-form input {
  flex: 1; height: 45px;
  background: var(--input-field); border: none; border-radius: 8px;
  padding: 10px 16px; color: var(--neut-L75); font-family: inherit; font-size: 14px;
}
.vsearch-form input:focus { outline: none; }
.vsearch-form button {
  height: 45px; min-width: 88px; border: none; border-radius: 8px;
  background: var(--primary); color: var(--card-background);
  font-size: 14px; font-weight: bold; font-family: inherit; cursor: pointer;
}
.vsearch-form button:hover { opacity: 0.85; }

/* --- 404 --- */
.nf-box { text-align: center; padding: 64px 40px 72px; }
.nf-code { margin: 0; font-size: 88px; font-weight: 700; line-height: 1; color: var(--primary); letter-spacing: 4px; }
.nf-msg { margin: 14px 0 26px; color: var(--article-meta); }

/* --- 友链行 --- */
.link-rows { display: flex; flex-direction: column; }
.link-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: 10px;
  color: inherit; text-decoration: none;
  transition: background 0.15s ease-out;
}
.link-row:hover { background: var(--btn-text-hover); }
.link-row:active { background: var(--btn-text-active); }
.link-row.is-empty { cursor: default; }
.link-row.is-empty:hover { background: transparent; }
.link-row .lk-logo {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  object-fit: cover;
}
.link-row .lk-logo.is-init {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--btn-bg); color: var(--primary); font-weight: 700; font-size: 16px;
}
.link-row .lk-body { display: flex; flex-direction: column; min-width: 0; }
.link-row .lk-name { color: var(--main-title); font-weight: 600; }
.link-row .lk-url {
  color: var(--article-meta); font-size: 0.78em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --- 上下篇禁用态（span 兜底） --- */
.article-nav-btn.is-off { opacity: 0.45; cursor: default; }
a.article-nav-btn { display: flex; }

/* --- 名片：自定义头像（圆形，与默认色块同位同尺寸） --- */
.info-card .avatar.avatar-img {
  object-fit: cover;
  padding: 0;
  background: var(--btn-bg);
}

/* --- 名片：大卡片封面（通铺顶部，圆角随卡片裁切） --- */
.info-card.has-cover { padding-top: 0; overflow: hidden; }
.info-card .avatar-cover {
  display: block;
  width: calc(100% + 40px);
  max-width: none;   /* 全局 img{max-width:100%} 会把 +40px 压回内容宽，右侧留白边 */
  margin: 0 -20px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.info-card.has-cover .info-name { margin-top: 14px; }
/* 封面样式下名称下方加主色短分隔线（复刻原站大卡片版式） */
.info-card.has-cover .info-name::after {
  content: "";
  display: block;
  width: 26px; height: 3px; border-radius: 2px;
  background: var(--primary);
  margin: 8px auto 0;
}
.info-card.has-cover .info-sub { margin-top: 10px; }

/* --- 标签云单页模板（page-tags.php） --- */
.prism-tag-cloud {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 10px 12px; padding: 8px 0 4px;
}
.prism-tag-item {
  display: inline-flex; align-items: baseline; gap: 2px;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--archive-dashline);
  background: var(--card-background);
  color: var(--neut-L75);
  line-height: 1.2; text-decoration: none;
  transition: border-color .18s ease-out, color .18s ease-out, background .18s ease-out, transform .18s ease-out;
}
.prism-tag-item:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--link-hover-bg, transparent);
  transform: translateY(-2px);
}
.prism-tag-count {
  font-size: .66em; font-weight: 700;
  color: var(--article-meta);
  margin-left: 2px;
}
.prism-tag-item:hover .prism-tag-count { color: var(--primary); }

/* --- 友链页：长条卡片墙（page-links.php） --- */
.prism-links-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 1024px) { .prism-links-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .prism-links-grid { grid-template-columns: 1fr; } }
/* 用 a.prism-link-card 提高优先级（0,1,1），以压住 .article-entry a 的同级边框/颜色规则 */
a.prism-link-card,
.prism-link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  height: 76px;                       /* 固定卡高（宽度随三列栅格自适应） */
  padding: 12px 16px;
  border-radius: 12px;                /* 长条形 + 弧角 */
  background: var(--card-background); /* 无图卡片：系统底色 */
  /* 四边统一浅灰描边；底边用 a. 前缀提权，彻底压掉 .article-entry a 的底部色条 */
  border: 1px solid var(--neut-L10);
  border-bottom: 1px solid var(--neut-L10);
  text-decoration: none;
  overflow: hidden;
  position: relative;
  transition: border-color .18s ease-out, transform .18s ease-out, box-shadow .18s ease-out;
}
/* 有 logo 的卡片：将图标作为底纹。
   蒙版 = 横向渐变（左淡右完全不透明）× 纵向渐隐（上下边缘淡出），
   避免卡片顶部/底部边缘渗出图片颜色；右侧文字区落在干净底色上 */
.prism-link-card.is-img {
  background-image:
    linear-gradient(90deg, rgba(255,255,255,.72) 0%, rgba(255,255,255,.88) 55%, rgba(255,255,255,1) 100%),
    linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(255,255,255,0) 22%, rgba(255,255,255,0) 78%, rgba(255,255,255,.96) 100%),
    var(--lk-bg);
  background-size: cover, cover, cover;
  background-position: center, center, right center;
  background-repeat: no-repeat, no-repeat, no-repeat;
}
/* 暗色主题（默认无 theme 属性）下改用深色渐变蒙版，避免白底刺眼 */
:root:not([theme='light']) .prism-link-card.is-img {
  background-image:
    linear-gradient(90deg, rgba(20,26,34,.74) 0%, rgba(20,26,34,.88) 55%, rgba(20,26,34,1) 100%),
    linear-gradient(180deg, rgba(20,26,34,.96) 0%, rgba(20,26,34,0) 22%, rgba(20,26,34,0) 78%, rgba(20,26,34,.96) 100%),
    var(--lk-bg);
}
.prism-link-card > * { position: relative; z-index: 1; }
a.prism-link-card:hover,
.prism-link-card:hover {
  /* 四边同步浅灰（保持与静止态一致，不做变色）；a. 前缀提权压住 .article-entry a:hover */
  border-color: var(--neut-L10);
  border-bottom-color: var(--neut-L10);
  border-bottom-style: solid;
  /* .article-entry a:hover 的 background 简写会清掉背景图，故显式重申，hover 保留渐变图标底 */
  background-color: var(--card-background);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.10);
}
a.prism-link-card.is-img:hover,
.prism-link-card.is-img:hover {
  background-image:
    linear-gradient(90deg, rgba(255,255,255,.72) 0%, rgba(255,255,255,.88) 55%, rgba(255,255,255,1) 100%),
    linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(255,255,255,0) 22%, rgba(255,255,255,0) 78%, rgba(255,255,255,.96) 100%),
    var(--lk-bg);
  background-size: cover, cover, cover;
  background-position: center, center, right center;
  background-repeat: no-repeat, no-repeat, no-repeat;
}
:root:not([theme='light']) a.prism-link-card.is-img:hover,
:root:not([theme='light']) .prism-link-card.is-img:hover {
  background-image:
    linear-gradient(90deg, rgba(20,26,34,.74) 0%, rgba(20,26,34,.88) 55%, rgba(20,26,34,1) 100%),
    linear-gradient(180deg, rgba(20,26,34,.96) 0%, rgba(20,26,34,0) 22%, rgba(20,26,34,0) 78%, rgba(20,26,34,.96) 100%),
    var(--lk-bg);
}
.prism-link-avatar {
  flex: none;
  width: 46px; height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--neut-L10);
}
.prism-link-avatar.is-init {
  display: flex;
  align-items: center; justify-content: center;
  font-size: 20px; font-weight: 600;
  color: var(--primary);
  background: var(--neut-L10);
}
.prism-link-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.prism-link-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--main-title);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prism-link-desc {
  font-size: 12px;
  color: var(--article-meta);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* hover 时文字保持原色（压住 .article-entry a / a:hover 的链接色） */
.prism-link-card,
.prism-link-card:hover { color: var(--main-title); }
.prism-link-card .prism-link-name,
.prism-link-card:hover .prism-link-name { color: var(--main-title); }
.prism-link-card .prism-link-desc,
.prism-link-card:hover .prism-link-desc { color: var(--article-meta); }

