/* ============================================================
   站点布局 v3 —— 2026-10-22
   1) 文章卡片：与「知识库」卡片同一套视觉
      （封面上 / 分类角标 / 虚线分隔的 meta 药丸）
      区别：知识库是一本书（meta 是文档数），文章是一篇篇帖子
   2) 分页：所有列表页统一 —— 靠下、靠左、与知识库同款按钮
   3) 整张卡片可点（角标和标签仍可单独点）
   4) 列表页轻量标题（替代大 banner）
   ============================================================ */

/* ---------- 0. 基础布局：页脚吸底 ---------- */
html {
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* .site-bg 是 position:fixed，不参与 flex 流，不会被拉伸 */
.site-main {
  flex: 1 0 auto;
}

.site-footer {
  margin-top: auto;
}

/* ---------- 1. 只给读屏和 SEO 用的隐藏标题 ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 1b. 分类页精简标题（保留备用） ---------- */
.category-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.category-head-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text);
}

.category-head-desc {
  margin: 0;
  max-width: 72ch;
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text-secondary);
}

.category-head-count {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ---------- 2. 列表页轻量标题（替代 tags 的大 banner） ---------- */
.list-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.list-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text);
}

.list-count {
  font-size: 13px;
  color: var(--color-text-muted);
}

.list-count b {
  color: var(--color-primary);
  font-weight: 700;
}

/* ============================================================
   3. 文章卡片 —— 知识库卡片同款
   ============================================================ */

.article-list.card-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  justify-content: start;
  gap: 16px;
}

.article-list.card-view .article-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin-bottom: 0;
  padding: 0;
  border-radius: 18px;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  box-shadow: 0 2px 12px #0f172a0f;
  overflow: hidden;
  position: relative;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s, background 0.18s;
}

.article-list.card-view .article-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-hover);
}

/* 封面 15:9，顶部压暗 —— 和知识库封面同一套 */
.article-list.card-view .article-thumb {
  flex: none;
  width: 100%;
  height: auto;
  aspect-ratio: 15 / 9;
  align-self: stretch;
  border-radius: 0;
  background: var(--color-border-light);
  overflow: hidden;
}

.article-list.card-view .article-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(#00000029, #0000 42%);
}

.article-list.card-view .article-thumb img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  transition: transform 0.4s;
}

.article-list.card-view .article-card:hover .article-thumb img {
  transform: scale(1.05);
}

/* 整张卡片可点：这层透明链接铺满卡片（标题链接保持可右键/可新开） */
.article-list.card-view .article-card-link {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 18px;
}

/* 分类角标浮在封面左上 —— 和知识库的标签 chip 同一位置 */
.article-list.card-view .article-card-cat {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  margin: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  vertical-align: 0;
  text-decoration: none;
  box-shadow: 0 2px 8px #0000001f;
}

.article-list.card-view .article-card-cat:hover {
  color: #fff;
  opacity: 0.85;
}

/* 置顶标记也放封面右上 */
.article-list.card-view .pinned-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  margin: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: #00000066;
  backdrop-filter: blur(5px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
}

/* 标题区 */
.article-list.card-view .article-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 0;
  padding: 13px 15px 0;
}

.article-list.card-view .article-card-title {
  margin: 0 0 6px;
  min-height: 36px;
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1.45;
  color: var(--color-text);
  overflow: visible;
}

.article-list.card-view .article-card-title a:last-child {
  color: inherit;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-list.card-view .article-card-title a:last-child:hover {
  color: var(--color-primary);
}

.article-list.card-view .article-card-text {
  gap: 4px;
}

.article-list.card-view .article-card-excerpt {
  margin: 0;
  min-height: 32px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--color-text-secondary);
  -webkit-line-clamp: 2;
}

.article-list.card-view .article-card-tags {
  margin-top: 6px;
}

/* 标签要压在「整卡可点」那层上面，单独点标签仍然跳标签页 */
.article-list.card-view .article-card-tags a {
  position: relative;
  z-index: 3;
}

/* 底部 meta：虚线分隔 + 药丸，和知识库卡片同一套 */
.article-list.card-view .article-card-meta {
  margin: auto -15px 0;
  padding: 9px 15px 12px;
  border-top: 1px dashed var(--color-border);
  gap: 12px;
  font-size: 12px;
  align-items: center;
  color: var(--color-text-muted);
}

.article-list.card-view .article-card-meta .meta-item {
  gap: 3px;
  padding: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}

.article-list.card-view .article-card-meta svg {
  width: 13px;
  height: 13px;
}

.article-list.card-view .article-card-meta .meta-date {
  order: 1;
}

.article-list.card-view .article-card-meta .meta-views {
  order: 2;
}

.article-list.card-view .article-card-meta .meta-cat {
  order: 3;
}

.article-list.card-view .article-card-meta .meta-author {
  order: 4;
  margin-left: auto;
}

/* ============================================================
   4. 分页 —— 全站统一（列表页 + 知识库同一套）
   形态：[ ‹ 1 2 3 › ]  + [ 跳至 (___) 跳转 ]      共 N 篇 · 第 x / y 页
   颜色全部走知识库的 --md-* 令牌，所以列表页也加载 docs-C7aZbkoz.css
   ============================================================ */
.pagination,
.kb-page .md-pager-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--md-border);
}

/* --- 胶囊页码组 --- */
.pagination .pager,
.kb-page .md-pager {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
}

.pagination .pager-btn,
.kb-page .md-pager button.pager-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--md-border);
  border-radius: 999px;
  background: var(--md-card);
  color: var(--md-sub);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s;
}

.pagination .pager-btn svg,
.kb-page .md-pager button.pager-btn svg {
  width: 15px;
  height: 15px;
}

.pagination .pager-btn:hover:not(.is-disabled):not(.is-active),
.kb-page .md-pager button.pager-btn:hover:not(:disabled):not(.is-active) {
  border-color: var(--md-primary-soft);
  color: var(--md-primary-deep);
}

/* 当前页 = 主色渐变胶囊 */
.pagination .pager-btn.is-active,
.kb-page .md-pager button.pager-btn.is-active {
  background: linear-gradient(135deg, var(--md-primary-soft), var(--md-primary-deep));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px var(--md-primary-glow);
}

/* 禁用态必须退回卡片底色：留主色渐变会像蒙了层蓝膜 */
.pagination .pager-btn.is-disabled,
.kb-page .md-pager button.pager-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  background: var(--md-card);
  border-color: var(--md-border);
  color: var(--md-sub);
  box-shadow: none;
}

/* 省略号 */
.pagination .pager-btn.page-sep,
.kb-page .md-pager button.page-sep {
  min-width: 20px;
  padding: 0;
  border: none;
  background: none;
  color: var(--md-muted);
  opacity: 1;
  cursor: default;
  font-weight: 700;
}

/* --- 页码跳转框 --- */
.pager-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.pager-jump-label {
  color: var(--md-sub);
  font-size: 13px;
  white-space: nowrap;
}

.pager-jump-input {
  width: 62px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--md-border);
  border-radius: 999px;
  background: var(--md-input-bg);
  color: var(--md-title);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pager-jump-input::-webkit-outer-spin-button,
.pager-jump-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pager-jump-input:focus {
  border-color: var(--md-primary-soft);
  box-shadow: 0 0 0 3px var(--md-primary-glow);
}

.pager-jump-btn {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--md-border);
  border-radius: 999px;
  background: var(--md-card);
  color: var(--md-sub);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.pager-jump-btn:hover {
  border-color: var(--md-primary-soft);
  color: var(--md-primary-deep);
}

/* --- 右侧统计 --- */
.pagination-count,
.kb-page .md-pager-wrap .md-count {
  margin-left: auto;
  color: var(--md-sub);
  font-size: 13px;
  white-space: nowrap;
}

.pagination-count b,
.kb-page .md-pager-wrap .md-count b {
  color: var(--md-primary-deep);
  font-weight: 700;
}

/* 知识库分页条默认 space-between，插入跳转框后改成左对齐 + 统计右推 */
.kb-page .md-pager-wrap {
  justify-content: flex-start;
}

/* 左右对齐列表页：列表页的分页条贴在容器内容边（左右 20px），
   知识库的 .md-content 自己又加了 22px 内边距，分页条会缩进去一截。
   这里用负边距把它拉回容器边，和列表页严丝合缝地对齐。
   负边距要跟着 .md-content 的内边距走（22 / 16 / 12 三档）。 */
.kb-page .md-pager-wrap {
  margin-left: -22px;
  margin-right: -22px;
}

/* 分页条到页脚的间距：列表页 .site-main 的 padding-bottom 是 32px，
   知识库页被 docs 样式压成 12px，分页条就贴得离页脚更近。
   知识库的 .md-app 是固定高度 + overflow:hidden，
   在分页条自己身上加 padding 不会顶开页脚，只能改主区下边距。 */
.site-main:has(.kb-page):has(.md-pager-wrap) {
  padding-bottom: 20px;
}

@media (max-width: 1080px) {
  .kb-page .md-pager-wrap {
    margin-left: -16px;
    margin-right: -16px;
  }
}

@media (max-width: 640px) {
  .kb-page .md-pager-wrap {
    margin-left: -12px;
    margin-right: -12px;
  }
}
/* ============================================================
   5. 列表页：分页压到页脚上方（和知识库一样的排布）
   ============================================================ */
.site-main:has(.pagination) {
  display: flex;
  flex-direction: column;
}

.site-main:has(.pagination) > .container {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  /* .container 有 margin:0 auto，进 flex 布局后 auto 外边距会吃掉剩余空间，
     导致容器宽度塌成内容宽（1560px → 842px），分页会被顶到中间。
     必须显式给 width:100%，再由 max-width 收口。 */
  width: 100%;
}

.site-main:has(.pagination) > .container > .layout-grid {
  flex: 1 0 auto;
}

.site-main:has(.pagination) .layout-grid.no-sidebar {
  align-items: stretch;
}

/* 带侧栏的列表页（标签页）：主题的 .layout-grid 是 align-items:start，
   内容区不会撑到行高，分页就停在内容末尾、离页脚很远。
   这里只把内容区拉满行高（侧栏不受影响），分页才能和其他列表页一样贴到页脚上方。 */
.site-main:has(.pagination) .layout-grid > .content-area {
  align-self: stretch;
}

.content-area:has(.pagination) {
  display: flex;
  flex-direction: column;
}

/* 分页所在的包装层（博客页在 th:with 容器里，分类页是直接子级）
   也要变成纵向 flex 并撑开，分页才能被顶到页脚上方 */
.content-area:has(.pagination) > .pagination,
.content-area:has(.pagination) > *:has(> .pagination) {
  margin-top: auto;
}

.content-area:has(.pagination) > *:has(> .pagination) {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
}

/* 列表撑开，多出来的空间留在列表和分页之间 */
.content-area:has(.pagination) > .article-list,
.content-area:has(.pagination) > *:has(> .pagination) > .article-list,
.content-area:has(.pagination) > .archive-timeline,
.content-area:has(.pagination) > *:has(> .pagination) > .archive-timeline {
  flex: 1 0 auto;
  align-content: start;
}

/* 分类页的卡片不再显示分类角标（页面本身就是这个分类，属重复） */
.article-list.no-cat-chip .article-card-cat {
  display: none;
}

/* ============================================================
   5. 移动端：列表卡片更紧凑
   ============================================================ */
@media (max-width: 768px) {
  /* 手机上列表页不放封面：索引页看标题摘要就够，
     封面点进文章页看（首页展示位保留封面）。 */
  .article-list.card-view {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .article-list.card-view .article-thumb {
    display: none;
  }

  .article-list.card-view .article-body {
    display: flex;
    flex-direction: column;
    padding: 12px 12px 0;
  }

  .article-list.card-view .article-card-title {
    min-height: 0;
    font-size: 14px;
  }

  /* 标题不夹两行，角标回到标题前面（和手机上一致的样子） */
  .article-list.card-view .article-card-title a:last-child {
    display: inline;
    -webkit-line-clamp: none;
    overflow: visible;
  }

  .article-list.card-view .article-card-cat {
    position: static;
    display: inline-flex;
    vertical-align: 2px;
    margin-right: 6px;
    padding: 1px 8px;
    font-size: 11px;
  }

  .article-list.card-view .article-card-excerpt {
    min-height: 0;
    font-size: 12px;
  }

  .article-list.card-view .article-card-meta {
    margin: 8px -12px 0;
    padding: 8px 12px 10px;
  }

  /* 主题在窄屏把作者和日期都藏了，只剩一个孤零零的眼睛图标 → 把日期放回来 */
  .article-list.card-view .article-card-meta .meta-item.meta-date {
    display: flex;
  }

  .pagination {
    margin-top: 28px;
    padding-top: 12px;
  }

  .pagination-count {
    width: 100%;
    margin-left: 0;
  }
}

/* ============================================================
   6. 与知识库卡片对齐
   知识库卡片原本是固定 286px，文章卡片是自适应列宽，
   两边宽度不一样会显得不是一套东西 → 统一成同一套栅格。
   ============================================================ */
.md-grid.is-card {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)) !important;
  gap: 16px !important;
}

/* 分页按钮只留箭头，和知识库分页完全同款（文字在 title / aria-label 里） */
.pagination .pager-btn-label {
  display: none;
}

/* ============================================================
   7. 分类筛选条（博客页 + 分类页共用同一套）
   这段样式原来在 categories.html 和 category.html 两个模板里各写了一份内联
   <style>，两页很容易走样（博客页那份还漏了 .is-active）。
   现在统一收到这里，两页引同一份文件，长得必然一模一样。
   筛选条内容由主题配置 category_nav_exclude 决定：
   默认排除 cases（项目案例），因为它在顶部导航有独立入口。
   ============================================================ */
.cat-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.cat-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-card);
  color: var(--color-text);
  font-size: 0.9rem;
  line-height: 1.5;
  text-decoration: none;
  transition: all var(--transition);
}

.cat-nav-item:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  text-decoration: none;
  background: var(--color-card-hover);
}

/* 当前所在的分类 */
.cat-nav-item.is-active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-bg);
}

.cat-nav-count {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border-radius: var(--radius-full);
  padding: 0 6px;
  min-width: 18px;
  text-align: center;
}

.cat-nav-item:hover .cat-nav-count,
.cat-nav-item.is-active .cat-nav-count {
  color: var(--color-primary);
}

/* ============================================================
   8. 知识库卡片底部的三个计数（文档数 / 访问量 / 点赞数）
   原来是主色蓝药丸，和列表页文章卡片底部的灰字 meta 不是一套东西。
   这里改成完全同款：灰字、无药丸底色、12px/400、图标 13px。
   ============================================================ */
.kb-page .md-foot .md-title-badge {
  color: var(--color-text-muted);
  background: none;
  border-radius: 0;
  padding: 0;
  font-size: 12px;
  font-weight: 400;
}

.kb-page .md-foot .md-title-badge svg {
  width: 13px;
  height: 13px;
}

.kb-page .md-foot .md-meta-row {
  gap: 12px;
}
