/* ============================================================
   1. CSS 自定义属性（全局变量）
   ============================================================ */
:root {
  /* 背景色：主背景、柔和背景 */
  --bg: #f8f6f2;
  --bg-soft: #fffdfa;
  /* 面板半透明背景：普通/强调 */
  --panel: rgba(255, 255, 255, 0.7);
  --panel-strong: rgba(255, 255, 255, 0.9);
  /* 文字颜色：主色/柔和色 */
  --text: #e5cfda;
  --text-soft: #dab9ca;
  /* 分割线颜色：普通/强调 */
  --line: rgba(240, 191, 192, 0.11);
  --line-strong: rgba(235, 161, 161, 0.18);
  /* 强调色：普通/深色 */
  --accent: #dfb1c3;
  --accent-strong: #d4afc2;
  /* 阴影 */
  --shadow: 0 24px 60px rgba(36, 52, 70, 0.06);
  /* 通用圆角 */
  --radius: 24px;
  /* 布局尺寸变量 */
  --sidebar-width: min(18rem, 27vw);   /* 侧边栏宽度 */
  --content-width: 44rem;              /* 正文内容宽度 */
  --toc-width: 13.5rem;                /* 目录（TOC）宽度 */
  --post-shell-width: calc(var(--content-width) + var(--toc-width) + 3rem); /* 文章区域总宽度 */
  /* 字体族：衬线体/无衬线体 */
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Songti SC", "STSong", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", sans-serif;
}

/* ============================================================
   2. 全局盒模型重置
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box; /* 统一使用 border-box，避免宽高计算问题 */
}

/* ============================================================
   3. HTML 根元素基础样式
   ============================================================ */
html {
  font-size: 15px;          /* 基准字号 */
  scroll-behavior: smooth;  /* 平滑滚动 */
}

/* ============================================================
   4. Body 页面主体
   ============================================================ */
body {
  margin: 0;
  min-height: 100vh;
  /* 深色渐变背景（放射状 + 线性渐变叠加） */
  background:
    radial-gradient(circle at top left, rgba(69, 62, 7, 0.741), transparent 32%),
    linear-gradient(180deg, #271a37 15%, #321d3f 46%, #3b2d52 100%);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.68;
}

/* ============================================================
   5. 基础元素重置
   ============================================================ */
/* 按钮继承父级字体 */
button {
  font: inherit;
}

/* 链接取消下划线，颜色继承 */
a {
  color: inherit;
  text-decoration: none;
}

/* 图片响应式处理 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============================================================
   6. 页面光晕装饰（背景模糊圆形光效）
   ============================================================ */
/* 光晕基础样式：固定定位，不捕获鼠标事件 */
.page-aura {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(88px);
  opacity: 0.22;
}

/* 光晕一：右上角，蓝灰色调 */
.page-aura--one {
  top: 8vh;
  right: 11vw;
  width: 15rem;
  height: 15rem;
  background: rgba(154, 178, 200, 0.18);
}

/* 光晕二：左下角，暖黄色调 */
.page-aura--two {
  bottom: 10vh;
  left: 22vw;
  width: 14rem;
  height: 14rem;
  background: rgba(216, 186, 154, 0.18);
}

/* ============================================================
   7. 阅读进度条
   ============================================================ */
/* 进度条容器：固定在页面顶部，侧边栏右侧 */
.reading-progress {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 12;
  height: 2px;
  background: rgba(91, 124, 153, 0.06);
  pointer-events: none;
}

/* 进度条本体：通过 scaleX 缩放实现进度动画 */
.reading-progress__bar {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(92, 119, 147, 0.82), rgba(140, 165, 188, 0.78));
  transform-origin: left center;
  transform: scaleX(0);  /* 初始宽度为 0，由 JS 控制 */
  transition: transform 90ms linear;
}

/* ============================================================
   8. 页面整体框架
   ============================================================ */
/* 页面外层容器，叠放于背景光晕之上 */
.site-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* ============================================================
   9. 侧边栏
   ============================================================ */
/* 侧边栏固定在左侧 */
.site-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  z-index: 3;
}

/* 侧边栏容器，隐藏溢出（用于背景模糊裁切） */
.sidebar {
  position: relative;
  height: 100%;
  overflow: hidden;
}

/* 背景层与遮罩层共用绝对定位铺满 */
.sidebar__backdrop,
.sidebar__overlay {
  position: absolute;
  inset: 0;
}

/* 背景层：封面图，轻微放大 + 模糊 + 饱和度降低 */
.sidebar__backdrop {
  background-size: cover;
  background-position: center;
  transform: scale(1.06);
  filter: blur(5px) saturate(0.92);
}

/* 遮罩层：双层渐变叠加，增强文字可读性 */
.sidebar__overlay {
  background:
    linear-gradient(180deg, rgba(66, 55, 46, 0.18), rgba(21, 19, 18, 0.52)),
    linear-gradient(140deg, rgba(255, 247, 237, 0.2), rgba(255, 255, 255, 0.03));
}

/* 侧边栏内容区：flex 纵向布局 */
.sidebar__content {
  position: relative;
  height: 100%;
  padding: 2.2rem 1.7rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: #fffdf9;
}

/* 侧边栏品牌区（头像 + 标题） */
.sidebar__brand {
  display: grid;
  gap: 0.85rem;
  justify-items: start;
}

/* 头像：圆形，带边框和阴影 */
.sidebar__avatar {
  width: 4.6rem;
  height: 4.6rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 250, 246, 0.78);
  box-shadow: 0 16px 32px rgba(18, 17, 16, 0.2);
}

/* 站点标题：大字、紧凑行高、小写 */
.sidebar__title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(1.95rem, 2.3vw, 2.4rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
  text-transform: lowercase;
}

/* 站点副标题：衬线字体，半透明 */
.sidebar__subtitle {
  margin: 0.55rem 0 0;
  max-width: 15.5rem;
  font-family: var(--font-serif);
  font-size: 0.92rem;
  line-height: 1.58;
  letter-spacing: 0.01em;
  color: rgba(255, 250, 246, 0.82);
}

/* 站点简介描述 */
.sidebar__description {
  margin: 0;
  max-width: 15rem;
  color: rgba(255, 250, 246, 0.7);
  font-size: 0.84rem;
  line-height: 1.72;
}

/* 导航与社交链接：grid 纵向排列 */
.sidebar__nav,
.sidebar__social {
  display: grid;
  gap: 0.6rem;
}

/* 导航区上边距 */
.sidebar__nav {
  margin-top: 0.95rem;
}

/* 导航 / 社交链接：带过渡动画 */
.sidebar__nav a,
.sidebar__social a {
  width: fit-content;
  font-size: 0.9rem;
  color: rgba(255, 250, 246, 0.86);
  transition: transform 160ms ease, color 160ms ease, opacity 160ms ease;
}

/* 悬停 / 激活：变白并向右偏移 */
.sidebar__nav a:hover,
.sidebar__nav a.is-active,
.sidebar__social a:hover {
  color: #ffffff;
  transform: translateX(4px);
}

/* 当前激活链接：文字发光效果 */
.sidebar__nav a.is-active {
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.2);
}

/* 社交链接区：推到底部，间距更小 */
.sidebar__social {
  margin-top: auto;
  gap: 0.35rem;
}

/* ============================================================
   10. 主内容区
   ============================================================ */
/* 主内容区：左侧留出侧边栏宽度，内边距响应式 */
.site-main {
  margin-left: var(--sidebar-width);
  padding: 2.7rem clamp(1.7rem, 3.6vw, 3.3rem) 4rem;
}

/* ============================================================
   11. 内容区通用宽度限制
   ============================================================ */
/* 各主要内容区块最大宽度限制并居中 */
.hero,
.page-intro,
.article,
.post-list,
.friend-grid,
.tax-grid,
.not-found {
  width: min(100%, var(--content-width));
  margin: 0 auto;
}

/* 以下区块：去掉背景、边框、阴影、毛玻璃效果（透明化处理） */
.hero,
.page-intro,
.article,
.not-found {
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

/* ============================================================
   12. 文章布局（含目录）
   ============================================================ */
/* 文章外层容器：最大宽度包含内容 + 目录 */
.article-layout {
  width: min(100%, var(--post-shell-width));
  margin: 0 auto;
}

/* 含目录的文章布局：双列 Grid，左内容右目录 */
.article-layout--with-toc {
  display: grid;
  grid-template-columns: minmax(0, var(--content-width)) minmax(11.5rem, var(--toc-width));
  grid-template-areas: "main toc";
  column-gap: clamp(1.4rem, 3vw, 3rem);
  align-items: start;
}

/* 文章主体占据 grid 的 main 区域 */
.article-layout .article {
  grid-area: main;
  width: 100%;
  margin: 0;
}

/* ============================================================
   13. 首页 Hero 区
   ============================================================ */
/* Hero 区底部间距与分割线 */
.hero {
  padding: 0 0 1.8rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}

/* 顶部小标签（kicker / eyebrow）：大写字母，强调色 */
.hero__kicker,
.page-intro__kicker,
.article__eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 600;
}

/* 各主标题通用样式：衬线字体，深强调色 */
.hero__title,
.page-intro__title,
.article__title,
.post-card__title,
.not-found__title {
  margin: 0;
  font-family: var(--font-serif);
  color: var(--accent-strong);
  line-height: 1.16;
}

/* Hero 标题：无衬线，响应式大字 */
.hero__title {
  font-family: var(--font-sans);
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  letter-spacing: -0.05em;
}

/* 各区块描述文字：柔和文字色，较小字号 */
.hero__description,
.page-intro__description,
.empty-state__text,
.not-found__text {
  max-width: 42rem;
  margin: 0.85rem 0 0;
  color: var(--text-soft);
  font-size: 0.92rem;
}

/* ============================================================
   14. 文章列表（post-list / post-card）
   ============================================================ */
/* 文章列表容器：透明，无边框 */
.post-list {
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* 单篇文章卡片：下边框分割 */
.post-card {
  padding: 1.35rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
}

/* 最后一篇文章去掉底部边框 */
.post-card:last-child {
  border-bottom: 0;
}

/* 首页第一篇文章减少顶部间距 */
.view-home .post-card:first-child {
  padding-top: 0.15rem;
}

/* 文章卡片标题区：grid 纵向排列 */
.post-card__header {
  display: grid;
  gap: 0.34rem;
}

/* 文章标题：大字，加粗，紧凑行高 */
.post-card__title {
  font-size: clamp(1.34rem, 2.25vw, 1.72rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.28;
}

/* 文章标题链接、元数据链接、"更多"链接等悬停颜色统一 */
.post-card__title a,
.post-card__meta-link,
.post-card__more,
.tax-card:hover .tax-card__name,
.friend-card:hover .friend-card__name,
.article__eyebrow a:hover,
.article__tag:hover,
.post-nav__item:hover strong {
  color: var(--accent);
}

/* 元信息文字：柔和色，小字号 */
.post-card__meta,
.article__meta,
.site-footer,
.tax-card__count,
.friend-card__blog,
.post-nav__label {
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.6;
}

/* 文章摘要与友链描述：柔和文字色 */
.post-card__summary,
.friend-card__desc {
  margin: 0.5rem 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.72;
}

/* 文章摘要：单行截断，超出省略号 */
.post-card__summary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

/* "阅读更多"按钮样式 */
.post-card__more {
  display: inline-flex;
  margin-top: 0.72rem;
  font-weight: 600;
  font-size: 0.84rem;
}

/* ============================================================
   15. 分页
   ============================================================ */
/* 分页容器 */
.pagination {
  width: min(100%, var(--content-width));
  margin: 1.1rem auto 0;
}

/* 页码 / 省略号按钮基础样式 */
.pagination .page-number,
.pagination .extend {
  display: inline-block;
  margin-right: 1rem;
  padding: 0.25rem 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  color: var(--text-soft);
  font-size: 0.86rem;
}

/* 当前页码：深强调色，加粗 */
.pagination .current {
  background: transparent;
  color: var(--accent-strong);
  font-weight: 600;
}

/* ============================================================
   16. 归档列表
   ============================================================ */
/* 归档容器 */
.archive-list {
  width: min(100%, var(--content-width));
  margin: 0 auto;
}

/* 按年份分组的归档行：年份列 + 文章列表列 */
.archive-group {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: 1.15rem;
  padding: 1.15rem 0 1.25rem;
  border-bottom: 1px solid var(--line);
}

/* 第一个年份组减少顶部间距 */
.archive-group:first-child {
  padding-top: 0.2rem;
}

/* 最后一个年份组去掉底部边框 */
.archive-group:last-child {
  border-bottom: 0;
}

/* 年份标签：加粗，强调色 */
.archive-group__year {
  margin: 0;
  padding-top: 0.18rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-strong);
  letter-spacing: -0.02em;
}

/* 年份下文章列表区 */
.archive-group__items {
  min-width: 0;
}

/* 单条归档条目：日期 + 标题 + 分类，baseline 对齐 */
.archive-entry {
  display: grid;
  grid-template-columns: 3.8rem minmax(0, 1fr) auto;
  gap: 0.95rem;
  align-items: baseline;
  padding: 0.55rem 0;
}

/* 归档日期与元信息：柔和小字 */
.archive-entry__date,
.archive-entry__meta {
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* 归档日期：等宽数字 */
.archive-entry__date {
  font-variant-numeric: tabular-nums;
}

/* 归档条目标题：衬线字体，强调深色 */
.archive-entry__title {
  min-width: 0;
  font-family: var(--font-serif);
  font-size: 1.02rem;
  line-height: 1.45;
  color: var(--accent-strong);
}

/* 悬停时标题变为强调色 */
.archive-entry:hover .archive-entry__title {
  color: var(--accent);
}

/* ============================================================
   17. 分类/标签列表（tax-list / tax-row）
   ============================================================ */
/* 分类列表容器，顶部分割线 */
.tax-list {
  width: min(100%, var(--content-width));
  margin: 0 auto;
  border-top: 1px solid var(--line);
}

/* 单行分类/标签：名称 + 数量 两列 */
.tax-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

/* 分类/标签名称：衬线字体，强调深色 */
.tax-row__name {
  min-width: 0;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.42;
  color: var(--accent-strong);
}

/* 数量：柔和小字，不换行 */
.tax-row__count {
  color: var(--text-soft);
  font-size: 0.84rem;
  white-space: nowrap;
}

/* 分类行 / 标签云悬停时名称变为强调色 */
.tax-row:hover .tax-row__name,
.tag-cloud__item:hover .tag-cloud__name {
  color: var(--accent);
}

/* ============================================================
   18. 标签云
   ============================================================ */
/* 标签云容器：flex 自动换行 */
.tag-cloud {
  width: min(100%, var(--content-width));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 0.6rem;
}

/* 单个标签胶囊：圆角，半透明白色背景 */
.tag-cloud__item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.76rem;
  border-radius: 999px;
  background: rgba(55, 15, 51, 0.72);
  border: 1px solid rgba(215, 118, 118, 0.1);
}

/* 标签名：强调深色 */
.tag-cloud__name {
  font-size: 0.9rem;
  color: var(--accent-strong);
}

/* 标签计数：柔和小字 */
.tag-cloud__count {
  color: var(--text-soft);
  font-size: 0.78rem;
}

/* ============================================================
   19. 页面介绍区 / 文章页 / 404 页面
   ============================================================ */
/* 三者去掉内边距 */
.page-intro,
.article,
.not-found {
  padding: 0;
}

/* 页面介绍区：底部间距 + 分割线 */
.page-intro {
  margin-bottom: 1rem;
  padding-bottom: 1.3rem;
  border-bottom: 1px solid var(--line);
}

/* 页面介绍、文章、404 标题字号响应式 */
.page-intro__title,
.article__title,
.not-found__title {
  font-size: clamp(1.82rem, 3.4vw, 2.42rem);
  letter-spacing: -0.035em;
}

/* 普通页面文章（非博文）无顶部边距 */
.article--page {
  margin-top: 0;
}

/* 文章头部区：grid，底部分割线 */
.article__header {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.8rem;
  padding-bottom: 1.45rem;
  border-bottom: 1px solid var(--line);
}

/* 分隔符（·）：柔和色 */
.article__divider,
.post-card__dot {
  margin: 0 0.5rem;
  color: var(--text-soft);
}

/* 文章标签区：flex 换行 */
.article__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

/* 单个文章标签：胶囊形，半透明背景 */
.article__tag {
  padding: 0.24rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(98, 54, 90, 0.5);
  font-size: 0.82rem;
}

/* ============================================================
   20. 文章正文内容排版
   ============================================================ */
/* 正文容器：无衬线字体，舒适行高 */
.article__content {
  font-family: var(--font-sans);
  font-size: 0.93rem;
  line-height: 1.84;
  color: var(--text);
}

/* 正文第一个子元素去掉顶部边距 */
.article__content > *:first-child {
  margin-top: 0;
}

/* 正文最后一个子元素去掉底部边距 */
.article__content > *:last-child {
  margin-bottom: 0;
}

/* 正文第一个 h1 隐藏（标题已在 header 中显示） */
.article__content > h1:first-child {
  display: none;
}

/* 正文段落、列表、引用、代码块、表格间距统一 */
.article__content p,
.article__content ul,
.article__content ol,
.article__content blockquote,
.article__content pre,
.article__content table {
  margin: 1.05rem 0;
}

/* 正文各级标题：衬线字体，强调深色，带锚点偏移 */
.article__content h1,
.article__content h2,
.article__content h3,
.article__content h4,
.article__content h5,
.article__content h6 {
  margin: 1.8rem 0 0.72rem;
  line-height: 1.28;
  color: var(--accent-strong);
  font-family: var(--font-serif);
  letter-spacing: -0.02em;
  scroll-margin-top: 5.8rem; /* 锚点跳转时留出顶部空间 */
}

/* h2 字号 */
.article__content h2 {
  font-size: 1.3rem;
}

/* h3 字号 */
.article__content h3 {
  font-size: 1.08rem;
}

/* 正文链接：带下划线，下划线半透明 */
.article__content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(91, 124, 153, 0.3);
  text-underline-offset: 0.18em;
}

/* 隐藏 Hexo 自动生成的标题锚点 # 符号 */
.article__content .headerlink {
  display: none;
}

/* 引用块：左侧边线，浅背景，圆角 */
.article__content blockquote {
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--accent);
  background: rgba(92, 119, 147, 0.06);
  border-radius: 0 0.85rem 0.85rem 0;
  color: var(--text-soft);
}

/* 行内代码：浅灰背景，等宽字体 */
.article__content code {
  padding: 0.12rem 0.36rem;
  border-radius: 0.32rem;
  background: rgba(52, 76, 100, 0.08);
  font-family: "SFMono-Regular", "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.82em;
}

/* ============================================================
   21. 代码块（code-frame 组件）
   ============================================================ */
/* 代码框外层：深色背景，圆角，阴影 */
.article__content .code-frame {
  margin: 1.2rem 0 1.35rem;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(25, 39, 53, 0.16);
  background:
    linear-gradient(180deg, rgba(34, 44, 56, 0.96), rgba(24, 31, 40, 0.98));
  box-shadow: 0 18px 30px rgba(23, 34, 46, 0.1);
}

/* 代码框顶部标题栏：三列（traffic light + 文件名 + 复制按钮） */
.article__content .code-frame__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.8rem;
  min-height: 2.75rem;
  padding: 0.7rem 0.9rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Traffic light 按钮容器（macOS 风格三圆点） */
.article__content .code-frame__traffic {
  display: inline-flex;
  gap: 0.34rem;
}

/* Traffic light 圆点基础样式 */
.article__content .code-frame__traffic span {
  width: 0.56rem;
  height: 0.56rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

/* 关闭按钮（红色） */
.article__content .code-frame__traffic span:nth-child(1) {
  background: #ff5f57;
}

/* 最小化按钮（黄色） */
.article__content .code-frame__traffic span:nth-child(2) {
  background: #febc2e;
}

/* 最大化按钮（绿色） */
.article__content .code-frame__traffic span:nth-child(3) {
  background: #28c840;
}

/* 代码框文件名标签：半透明，大写字母，超出省略 */
.article__content .code-frame__label {
  min-width: 0;
  color: rgba(245, 248, 252, 0.72);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 复制按钮：胶囊形，半透明白色 */
.article__content .code-frame__copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.2rem;
  padding: 0.38rem 0.65rem;
  border: 0;
  border-radius: 999px;
  background: rgba(245, 248, 252, 0.08);
  color: rgba(245, 248, 252, 0.82);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

/* 复制按钮悬停/聚焦：变亮，微上移 */
.article__content .code-frame__copy:hover,
.article__content .code-frame__copy:focus-visible {
  background: rgba(245, 248, 252, 0.16);
  color: #ffffff;
  transform: translateY(-1px);
}

/* 复制成功状态：蓝灰色背景 */
.article__content .code-frame__copy.is-copied {
  background: rgba(91, 124, 153, 0.34);
  color: #ffffff;
}

/* 代码块本体：透明背景，白色文字，可横向滚动 */
.article__content pre {
  margin: 0;
  padding: 1rem 1.05rem 1.08rem;
  overflow: auto;
  border-radius: 0;
  background: transparent;
  color: #f8fafc;
  box-shadow: none;
}

/* 代码块内 code：继承颜色，去掉背景和内边距 */
.article__content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 0.9em;
  line-height: 1.72;
}

/* 表格：全宽，合并边框 */
.article__content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

/* 表格单元格：内边距，下边框 */
.article__content th,
.article__content td {
  padding: 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

/* 正文图片：居中，圆角，阴影 */
.article__content img {
  margin: 1.3rem auto;
  border-radius: 0.9rem;
  box-shadow: 0 16px 28px rgba(38, 54, 74, 0.1);
}

/* 媒体图片容器（figure） */
.article__content figure.article-media {
  margin: 1.55rem 0 1.75rem;
}

/* 媒体图片居中 */
.article__content figure.article-media img {
  margin: 0 auto;
}

/* 图片说明文字：居中，小字 */
.article__content figcaption.article-media__caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.32rem;
  margin-top: 0.65rem;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.7;
  text-align: center;
}

/* 图片说明标签：大写，较小字号 */
.article-media__label {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

/* 图片说明文本 */
.article-media__text {
  max-width: 100%;
}

/* ============================================================
   22. 文章目录（post-outline / post-toc）
   ============================================================ */
/* 目录外层：sticky 粘性定位，贴近顶部 */
.post-outline {
  grid-area: toc;
  position: sticky;
  top: 2.7rem;
  align-self: start;
  padding-top: 0.25rem;
}

/* 目录小标签与标题：去掉默认边距 */
.post-outline__eyebrow,
.post-outline__title {
  margin: 0;
}

/* 目录小标签：大写，强调色 */
.post-outline__eyebrow {
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.68rem;
  font-weight: 600;
}

/* 目录标题：衬线字体，强调深色 */
.post-outline__title {
  margin-top: 0.42rem;
  margin-bottom: 0.9rem;
  color: var(--accent-strong);
  font-family: var(--font-serif);
  font-size: 0.98rem;
  line-height: 1.42;
}

/* 目录列表容器：最大高度可滚动，左侧边线 */
.post-toc {
  max-height: calc(100vh - 5rem);
  overflow: auto;
  padding-left: 1rem;
  border-left: 1px solid var(--line);
}

/* 目录各级列表：去掉默认 list-style 和 padding */
.post-toc .post-toc__list,
.post-toc .post-toc__list-child,
.post-toc .toc-child {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 目录条目间距 */
.post-toc .post-toc__list-item + .post-toc__list-item,
.post-toc .toc-item + .toc-item {
  margin-top: 0.38rem;
}

/* 二级及子级目录：缩进 + 左侧细线 */
.post-toc .post-toc__list-child,
.post-toc .toc-child {
  margin-top: 0.28rem;
  margin-left: 0.1rem;
  padding-left: 0.75rem;
  border-left: 1px solid rgba(51, 68, 86, 0.08);
}

/* 目录链接：柔和色，小字，过渡动画 */
.post-toc .post-toc__list-link,
.post-toc .toc-link {
  display: block;
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.55;
  transition: color 160ms ease, transform 160ms ease;
}

/* 目录链接悬停/激活：深强调色，微右移 */
.post-toc .post-toc__list-link:hover,
.post-toc .post-toc__list-link.is-active,
.post-toc .toc-link:hover,
.post-toc .toc-link.is-active {
  color: var(--accent-strong);
  transform: translateX(2px);
}

/* 激活目录项加粗 */
.post-toc .post-toc__list-link.is-active,
.post-toc .toc-link.is-active {
  font-weight: 600;
}

/* 隐藏目录序号 */
.post-toc .post-toc__list-number,
.post-toc .toc-number {
  display: none;
}

/* ============================================================
   23. 文章前后导航（post-nav）
   ============================================================ */
/* 前后导航：两列等宽 Grid */
.post-nav {
  width: min(100%, var(--content-width));
  margin: 1.25rem auto 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  text-align: center; /* 让文字居中显示 */
}

/* 单个导航项：顶部边线，透明背景 */
.post-nav__item {
  padding: 0.9rem 0.15rem;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-top: 1px solid var(--line);
}

/* 导航文章标题：加粗，强调深色 */
.post-nav__item strong {
  display: block;
  margin-top: 0.3rem;
  color: var(--accent-strong);
  font-size: 0.92rem;
}

/* 文章页的前后导航使用更宽的容器 */
.view-post .post-nav {
  width: min(100%, var(--post-shell-width));
}

/* ============================================================
   24. 分类/友链卡片（tax-card / friend-card）
   ============================================================ */
/* 卡片通用样式：半透明白色背景，圆角，阴影，悬停过渡 */
.tax-card,
.friend-card {
  background: rgba(34, 19, 69, 0.62);
  border: 1px solid rgba(187, 150, 150, 0.45);
  border-radius: 1.15rem;
  padding: 1.05rem 1.1rem;
  box-shadow: 0 12px 22px rgba(212, 220, 230, 0.004);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

/* 卡片悬停：上浮，加深阴影，边框蓝灰 */
.tax-card:hover,
.friend-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 42px rgba(76, 100, 129, 0);
  border-color: rgba(125, 153, 178, 0.28);
}

/* 分类卡片：flex 两端对齐 */
.tax-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* 标签类卡片：略带暖色背景 */
.tax-card--tag {
  background: rgba(255, 246, 255, 0.88);
}

/* 卡片名称：强调深色 */
.tax-card__name,
.friend-card__name {
  color: var(--accent-strong);
  font-size: 1rem;
}

/* 友链网格：两列 */
.friend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

/* 友链网格顶部边距 */
.friend-grid {
  margin-top: 1.25rem;
}

/* 友链卡片：头像 + 内容两列 */
.friend-card {
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 1rem;
  align-items: start;
}

/* 友链头像：圆形裁切 */
.friend-card__avatar {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  object-fit: cover;
}

/* 友链卡片内容区：防止溢出 */
.friend-card__body {
  min-width: 0;
}

/* 友链博客地址：块级显示 */
.friend-card__blog {
  display: block;
  margin-top: 0.22rem;
}

/* 友链描述：去掉底部边距 */
.friend-card__desc {
  margin-bottom: 0;
  font-size: 0.9rem;
}

/* ============================================================
   25. 空状态 / 404 页面
   ============================================================ */
/* 两者均左对齐 */
.empty-state,
.not-found {
  text-align: left;
}

/* 空状态：居中，透明背景，无边框阴影 */
.empty-state {
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: 2rem 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* 空状态标题 / 404 错误码 */
.empty-state__title,
.not-found__code {
  margin: 0;
  font-family: var(--font-serif);
  color: var(--accent-strong);
}

/* 404 错误码：大写字母间距，强调色 */
.not-found__code {
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

/* 404 返回链接：胶囊按钮，强调色背景 */
.not-found__link {
  display: inline-flex;
  margin-top: 1.1rem;
  padding: 0.8rem 1.1rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

/* ============================================================
   26. 页脚
   ============================================================ */
/* 页脚：与主内容区同左边距（让出侧边栏） */
.site-footer {
  margin-left: var(--sidebar-width);
  padding: 1.5rem 3rem 2rem;
  text-align: left;
}

/* 页脚文字与版权信息：内容宽度限制居中 */
.site-footer__text,
.site-footer__license {
  width: min(100%, var(--content-width));
  margin: 0.4rem auto 0;
}

/* 赞助/支持区：胶囊形，半透明白色 */
/* .site-footer__support {
  width: fit-content;
  margin: 1rem auto 0 0;
  padding: 0.6rem 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(73, 107, 140, 0.08);
} */

/* 赞助 Logo：小圆角正方形 */
.site-footer__support-logo {
  width: 1.9rem;
  height: 1.9rem;
  object-fit: contain;
  border-radius: 0.45rem;
  background: #fff;
}

/* 赞助说明文字 */
.site-footer__support-copy {
  color: var(--text-soft);
  font-size: 0.84rem;
}

/* 赞助说明中加粗部分 */
.site-footer__support-copy strong {
  color: var(--accent-strong);
}

/* 版权区链接颜色 */
.site-footer__license a {
  color: var(--accent);
}

/* ============================================================
   27. 移动端组件（默认隐藏）
   ============================================================ */
/* 移动端顶栏、抽屉、遮罩默认隐藏，仅在小屏幕下启用 */
.mobile-topbar,
.mobile-drawer,
.mobile-backdrop {
  display: none;
}

/* ============================================================
   28. 移动端响应式（屏幕宽度 ≤ 980px）
   ============================================================ */
@media (max-width: 980px) {
  /* 在移动端将内容宽度和文章区域宽度重置为 100% */
  :root {
    --content-width: 100%;
    --post-shell-width: 100%;
  }

  /* 阅读进度条从左侧开始（不再偏移侧边栏宽度） */
  .reading-progress {
    left: 0;
  }

  /* 隐藏左侧固定侧边栏 */
  .site-sidebar {
    display: none;
  }

  /* ---- 移动端顶部导航栏 ---- */
  /* sticky 顶栏：三列（菜单按钮 + 标题 + 头像），毛玻璃背景 */
  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 0.82rem 0.95rem;
    background: rgba(255, 251, 246, 0.84);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(81, 103, 126, 0.1);
  }

  /* 汉堡菜单按钮：圆形背景，内含三条横线 */
  .mobile-topbar__toggle {
    width: 2.45rem;
    height: 2.45rem;
    padding: 0.62rem;
    display: inline-grid;
    align-content: center;
    gap: 0.28rem;
    border: 0;
    border-radius: 50%;
    background: rgba(91, 124, 153, 0.08);
    cursor: pointer;
  }

  /* 汉堡菜单的每条横线 */
  .mobile-topbar__toggle span {
    display: block;
    height: 2px;
    border-radius: 999px;
    background: var(--accent-strong);
  }

  /* 顶栏标题：居中，小写 */
  .mobile-topbar__title {
    font-family: var(--font-sans);
    font-size: 1.24rem;
    color: var(--accent-strong);
    text-align: center;
    letter-spacing: -0.04em;
    text-transform: lowercase;
  }

  /* 顶栏头像：圆形小头像 */
  .mobile-topbar__avatar img {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 50%;
    object-fit: cover;
  }

  /* ---- 移动端抽屉与遮罩 ---- */
  /* 展示抽屉和遮罩（默认 block，通过 transform / opacity 控制显隐） */
  .mobile-drawer,
  .mobile-backdrop {
    display: block;
  }

  /* 抽屉：固定在左侧，默认平移到屏幕外，打开时滑入 */
  .mobile-drawer {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    width: min(82vw, 20rem);
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }

  /* 抽屉面板：撑满容器，带阴影 */
  .mobile-drawer__panel {
    position: relative;
    width: 100%;
    height: 100%;
    box-shadow: 30px 0 80px rgba(15, 18, 22, 0.22);
  }

  /* 遮罩层：半透明黑色，默认不可见 */
  .mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9;
    background: rgba(12, 16, 20, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }

  /* 抽屉打开时：抽屉滑入 */
  body.drawer-open .mobile-drawer {
    transform: translateX(0);
  }

  /* 抽屉打开时：遮罩显示并响应点击 */
  body.drawer-open .mobile-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* 主内容区和页脚去掉左侧边距 */
  .site-main,
  .site-footer {
    margin-left: 0;
  }

  /* 主内容区移动端内边距 */
  .site-main {
    padding: 1rem 0.95rem 2.8rem;
  }

  /* 页脚移动端内边距 */
  .site-footer {
    padding: 0 0.95rem 1.5rem;
  }

  /* 含目录的文章布局：移动端改为单列，目录在上、内容在下 */
  .article-layout--with-toc {
    grid-template-columns: 1fr;
    grid-template-areas:
      "toc"
      "main";
    gap: 1.15rem;
  }

  /* 各主标题移动端字号收小 */
  .hero__title,
  .page-intro__title,
  .article__title,
  .not-found__title {
    font-size: clamp(1.72rem, 9vw, 2.15rem);
  }

  /* 文章列表标题移动端字号收小 */
  .post-card__title {
    font-size: clamp(1.25rem, 7.6vw, 1.5rem);
  }

  /* 正文字号与行高移动端微调 */
  .article__content {
    font-size: 0.92rem;
    line-height: 1.82;
  }

  /* 代码块移动端：左右略收缩，圆角减小 */
  .article__content .code-frame {
    margin-left: -0.1rem;
    margin-right: -0.1rem;
    border-radius: 0.92rem;
  }

  /* 代码块顶栏移动端：内边距与间距收小 */
  .article__content .code-frame__head {
    padding: 0.62rem 0.75rem;
    gap: 0.6rem;
  }

  /* 复制按钮移动端：宽度与内边距收小 */
  .article__content .code-frame__copy {
    min-width: 3.85rem;
    padding: 0.34rem 0.56rem;
  }

  /* 目录移动端：取消 sticky，静态定位 */
  .post-outline {
    position: static;
    padding-top: 0;
  }

  /* 目录标题移动端字号收小 */
  .post-outline__title {
    margin-bottom: 0.7rem;
    font-size: 0.92rem;
  }

  /* 目录移动端：高度限制 + 改为顶部边线（不再是左侧边线） */
  .post-toc {
    max-height: 12rem;
    padding-top: 0.72rem;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  /* 前后导航和友链网格移动端改为单列 */
  .post-nav,
  .friend-grid {
    grid-template-columns: 1fr;
  }

  /* 归档分组移动端改为单列，减小间距 */
  .archive-group {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  /* 归档年份移动端字号收小 */
  .archive-group__year {
    padding-top: 0;
    font-size: 0.88rem;
  }

  /* 归档条目移动端：隐藏分类列，两列布局（日期 + 标题） */
  .archive-entry {
    grid-template-columns: 3.3rem minmax(0, 1fr);
    gap: 0.75rem;
  }

  /* 归档条目分类元信息移动端隐藏 */
  .archive-entry__meta {
    display: none;
  }

  /* 分类行移动端内边距调整 */
  .tax-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0.92rem 0;
  }

  /* 标签云移动端间距收小 */
  .tag-cloud {
    gap: 0.55rem 0.5rem;
  }

  /* 赞助区移动端内边距收小 */
  .site-footer__support {
    padding: 0.56rem 0.72rem;
  }

  /* 移动端侧边栏内容区顶部留出顶栏高度 */
  .sidebar--mobile .sidebar__content {
    padding-top: 4.25rem;
  }

}


/* ============== */
/* 29.搜索 */
/* ============== */
/* --- 搜索框样式 --- 怎么把高度缩小一点空间不够用了 */
.sidebar__search input[id^="local-search-input-"] {
  all: unset !important;
  display: block !important;
  width: 100% !important;
  padding: 10px 6px !important;
  font-size: 14px !important;
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
  margin-top: 6px !important;
}

/* --- 初始状态隐藏结果框，防止出现空紫色方块 --- */
#local-search-result-desktop, 
#local-search-result-mobile {
  display: none; /* 默认完全隐藏 */
}

/* --- 2. 搜索结果传送门通用样式 --- */
.search-result-portal {
  display: none; /* 默认隐藏 */
  position: fixed !important;
  z-index: 99999 !important; /* 确保在最顶层 */
  background: #2a1b3d !important; /* 匹配你网页的深紫色 */
  border: 1px solid var(--accent);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  padding: 15px !important;
  overflow-y: auto;
}

/* --- 3. 电脑版：显示在输入框右上方 --- */
@media (min-width: 981px) {
  #local-search-result-desktop {
    bottom: 160px; /* 距离底部 80px，刚好在输入框上方 */
    left: 20px;
    width: 320px;
    max-height: 60vh;
  }
}

/* --- 4. 手机版：成为独立的悬浮窗口，不挤占侧边栏 --- */
@media (max-width: 980px) {
  #local-search-result-mobile {
    bottom: 180px; /* 距离手机端底部输入框一定高度 */
    left: 5vw;
    right: 5vw;
    width: 90vw;
    max-height: 50vh;
    /* 增加动画效果让它看起来更像独立窗口 */
    animation: slideUp 0.3s ease-out;
  }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* --- 5. 结果内容格式化（去除圆点，代码过滤） --- */
.search-result-list {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.search-result-item {
  margin-bottom: 15px !important;
  padding-bottom: 10px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.search-result-title {
  color: var(--accent) !important;
  font-weight: bold !important;
  font-size: 15px !important;
  display: block !important;
  margin-bottom: 5px !important;
}

.search-result-content {
  font-size: 13px !important;
  color: var(--text-soft) !important;
  line-height: 1.6 !important;
  /* 限制摘要行数，保持整洁 */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-keyword {
  color: #ffeb3b !important;
  font-style: normal !important;
  font-weight: bold !important;
}