/* ==========================================================================
   blog.css — 博客列表页与文章页专属样式（zh-CN）
   只被 blog/index.html 与 blog/articles/*.html 引用。
   颜色 / 字体 / 圆角 / 投影一律引用 base.css 的设计令牌；
   components.css 里的按钮与 .dl-fab 皮肤不在这里重定义。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 兜底与页面节奏
   -------------------------------------------------------------------------- */

.nowrap { white-space: nowrap; }

@media (max-width: 760px) {
  /* 窄屏下术语不再强制不换行，避免长词把版心撑破（横向溢出） */
  .nowrap { white-space: normal; overflow-wrap: break-word; }
}

/* H1 尺度安全网：博客页面上的 h1 一律不超过文章标题尺度 */
h1 {
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  line-height: 1.32;
}

.blog-shell,
.article-page,
.post-page,
.blog-article {
  color: var(--ink);
}

/* 博客页面统一紧凑节间距：首页级 112px 节奏放进文章就是大片空带。
   页脚在 main 之外，不受这条规则影响。 */
#main .section, #main .sec,
#main.section, #main.sec,
main .section, main .sec,
main.section, main.sec,
body > .section, body > .sec,
.article-page .section, .article-page .sec,
.post-page .section, .post-page .sec,
.blog-article .section, .blog-article .sec {
  padding-block: 1.25rem;
}

/* 文章阅读版心 */
.article-page .wrap,
.post-page .wrap,
.blog-article .wrap,
.post-hero .wrap,
.post-body .wrap,
.article-hero .wrap,
.article-body .wrap,
main.surf-paper > .wrap,
.article-shell,
.post-shell {
  max-width: 820px;
  margin-inline: auto;
}

/* --------------------------------------------------------------------------
   2. 列表页 hero
   -------------------------------------------------------------------------- */

.blog-hero {
  padding-block: clamp(2rem, 1.5rem + 2vw, 3rem) 1.25rem;
}

.blog-hero .eyebrow {
  margin: 0 0 0.875rem;
}

.blog-title {
  margin: 0 0 0.875rem;
  max-width: 100%;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.75rem, 1.1rem + 1.9vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.blog-lead {
  margin: 0;
  max-width: 64ch;
  font-size: clamp(0.9375rem, 0.88rem + 0.35vw, 1.0625rem);
  line-height: 1.75;
  color: var(--ink-2);
}

.blog-list-sec {
  padding-block: 1rem 4rem;
}

/* --------------------------------------------------------------------------
   3. 标签筛选条
   -------------------------------------------------------------------------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.filter-btn {
  padding: 0.55rem 0.95rem;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.2;
  color: var(--ink-2);
  background: var(--paper-hi);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.filter-btn:hover {
  color: var(--accent-ink);
  border-color: var(--accent-line);
}

.filter-btn:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}

.filter-btn.is-on {
  color: var(--accent-ink);
  background: var(--accent-veil);
  border-color: var(--accent-line);
}

.filter-count {
  margin: 0 0 1.25rem;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}

.filter-count:empty {
  display: none;
}

/* --------------------------------------------------------------------------
   4. 文章卡列表
   -------------------------------------------------------------------------- */

.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 720px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1060px) {
  .post-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.post-grid .post-card {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  height: 100%;
  padding: 1.35rem 1.4rem 1.25rem;
  color: var(--ink);
  background: var(--paper-hi);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.post-grid .post-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-card);
}

.post-grid .post-card[hidden] {
  display: none;
}

.post-grid .post-card .post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-3);
}

.post-grid .post-card .post-tag {
  padding: 0.2rem 0.55rem;
  color: var(--accent-ink);
  background: var(--accent-veil);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-pill);
  line-height: 1.3;
}

.post-grid .post-card .post-meta time {
  color: var(--ink-3);
}

.post-grid .post-card .post-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.1875rem;
  line-height: 1.42;
  color: var(--ink);
}

.post-grid .post-card .post-sum {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--ink-2);
}

.post-grid .post-card .post-more {
  margin-top: auto;
  padding-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--accent-ink);
}

.post-empty {
  margin: 0;
  padding: 2.5rem 0;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.post-noscript {
  margin: 1.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--ink-2);
}

.post-noscript a {
  color: var(--accent-ink);
}

/* --------------------------------------------------------------------------
   5. 面包屑（含类名别名兜底：nav.breadcrumb / nav.breadcrumbs 同款）
   -------------------------------------------------------------------------- */

.blog-breadcrumb,
.article-breadcrumb,
nav.breadcrumb,
nav.breadcrumbs,
.breadcrumb,
.breadcrumbs {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1.5rem 0 1.25rem;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
}

.blog-breadcrumb a,
.article-breadcrumb a,
nav.breadcrumb a,
nav.breadcrumbs a,
.breadcrumb a,
.breadcrumbs a {
  color: var(--ink-3);
  text-decoration: none;
  transition: color 0.16s ease;
}

.blog-breadcrumb a:hover,
.article-breadcrumb a:hover,
nav.breadcrumb a:hover,
nav.breadcrumbs a:hover,
.breadcrumb a:hover,
.breadcrumbs a:hover {
  color: var(--accent-ink);
  text-decoration: none;
}

.blog-breadcrumb a:focus-visible,
.article-breadcrumb a:focus-visible,
nav.breadcrumb a:focus-visible,
nav.breadcrumbs a:focus-visible,
.breadcrumb a:focus-visible,
.breadcrumbs a:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
  border-radius: 4px;
}

.blog-breadcrumb .sep,
.blog-breadcrumb .breadcrumb-sep,
.blog-breadcrumb [aria-hidden="true"],
.article-breadcrumb .sep,
.article-breadcrumb .breadcrumb-sep,
.article-breadcrumb [aria-hidden="true"],
nav.breadcrumb .sep,
nav.breadcrumb .breadcrumb-sep,
nav.breadcrumb [aria-hidden="true"],
nav.breadcrumbs .sep,
nav.breadcrumbs .breadcrumb-sep,
nav.breadcrumbs [aria-hidden="true"],
.breadcrumb .sep,
.breadcrumb .breadcrumb-sep,
.breadcrumb [aria-hidden="true"],
.breadcrumbs .sep,
.breadcrumbs .breadcrumb-sep,
.breadcrumbs [aria-hidden="true"] {
  color: var(--line-mid);
}

.blog-breadcrumb [aria-current="page"],
.article-breadcrumb [aria-current="page"],
nav.breadcrumb [aria-current="page"],
nav.breadcrumbs [aria-current="page"],
.breadcrumb [aria-current="page"],
.breadcrumbs [aria-current="page"],
.blog-breadcrumb > :last-child,
.article-breadcrumb > :last-child,
nav.breadcrumb > :last-child,
nav.breadcrumbs > :last-child,
.breadcrumb > :last-child,
.breadcrumbs > :last-child {
  max-width: 30ch;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}

.blog-breadcrumb [aria-current="page"],
.article-breadcrumb [aria-current="page"],
nav.breadcrumb [aria-current="page"],
nav.breadcrumbs [aria-current="page"],
.breadcrumb [aria-current="page"],
.breadcrumbs [aria-current="page"] {
  color: var(--ink-2);
}

/* 面包屑类名别名兜底：post-crumbs / post-crumb / crumbs 同款节奏
   （面包屑下距 20px，与 meta 行之间留出呼吸空间） */
.post-crumbs,
.post-crumb,
.crumbs {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
}

.crumbs {
  margin: 0 0 20px;
  padding-top: 24px;
}

.post-crumbs a,
.post-crumb a,
.crumbs a {
  color: var(--ink-3);
  text-decoration: none;
  transition: color 0.16s ease;
}

.post-crumbs a:hover,
.post-crumb a:hover,
.crumbs a:hover {
  color: var(--accent-ink);
  text-decoration: none;
}

.post-crumbs a:focus-visible,
.post-crumb a:focus-visible,
.crumbs a:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
  border-radius: 4px;
}

.post-crumbs [aria-hidden="true"],
.post-crumb [aria-hidden="true"],
.crumbs [aria-hidden="true"] {
  color: var(--line-mid);
}

.post-crumbs [aria-current="page"],
.post-crumb [aria-current="page"],
.crumbs [aria-current="page"],
.post-crumbs > :last-child,
.post-crumb > :last-child,
.crumbs > :last-child {
  max-width: 30ch;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}

.post-crumbs [aria-current="page"],
.post-crumb [aria-current="page"],
.crumbs [aria-current="page"] {
  color: var(--ink-2);
}

/* 文章页尾：上一篇/下一篇与相关文章直接挂在 main 下时补上版心 */
main > #post-nav,
main > #related-posts {
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --------------------------------------------------------------------------
   6. 文章页 hero（紧凑节奏：面包屑到正文首段之间不留空带）
   -------------------------------------------------------------------------- */

.article-hero,
.article-head {
  padding-block: 0.5rem 1.75rem;
}

/* 文章页头：顶栏到面包屑留 28px 呼吸空间（规范带 14~64px） */
.post-hero {
  padding-block: 28px 1.75rem;
}

.article-hero .article-meta,
.article-hero .post-meta,
.article-hero .post-meta-row,
.post-hero .article-meta,
.post-hero .post-meta,
.post-hero .post-meta-row,
.article-head .article-meta,
.article-head .post-meta,
.article-meta,
.post-meta,
.post-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-3);
}

.article-hero .post-tag,
.article-hero .article-tag,
.post-hero .post-tag,
.post-hero .article-tag,
.article-head .post-tag,
.article-head .article-tag {
  padding: 0.2rem 0.55rem;
  color: var(--accent-ink);
  background: var(--accent-veil);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-pill);
  line-height: 1.3;
}

.article-hero h1,
.post-hero h1,
.article-head h1 {
  margin-block: 0.9375rem;
  margin-inline: 0;
  max-width: 100%;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  line-height: 1.32;
  letter-spacing: 0;
  color: var(--ink);
}

.article-hero .lead,
.article-hero .article-lead,
.article-hero .post-lead,
.article-hero .post-summary,
.post-hero .lead,
.post-hero .article-lead,
.post-hero .post-lead,
.post-hero .post-summary,
.article-head .lead,
.article-head .article-lead,
.article-lead,
.post-lead {
  margin: 0;
  max-width: 68ch;
  font-size: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  line-height: 1.7;
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   7. 正文排版
   -------------------------------------------------------------------------- */

.prose {
  max-width: 46rem;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink);
}

.prose > :first-child {
  margin-top: 0;
}

.prose p {
  margin: 0 0 1.15rem;
}

.prose section {
  margin: 0;
}

.prose section + section {
  margin-top: 2.5rem;
}

.prose section > :first-child {
  margin-top: 0;
}

.prose h2 {
  margin: 2.5rem 0 0.875rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.25rem, 1.05rem + 0.6vw, 1.5rem);
  line-height: 1.4;
  letter-spacing: 0;
  color: var(--ink);
}

.prose h2:first-of-type {
  margin-top: 0;
}

.prose h3 {
  margin: 1.75rem 0 0.625rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(1.0625rem, 0.98rem + 0.3vw, 1.25rem);
  line-height: 1.45;
  color: var(--ink);
}

.prose ul,
.prose ol {
  margin: 0 0 1.15rem;
  padding-left: 1.35rem;
}

.prose li {
  margin: 0.35rem 0;
}

.prose li::marker {
  color: var(--line-mid);
}

.prose a:not([class*="btn"]):not([class*="button"]) {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose a:not([class*="btn"]):not([class*="button"]):hover {
  color: var(--accent-dark);
}

.prose strong {
  font-weight: 600;
  color: var(--ink);
}

.prose blockquote {
  margin: 0 0 1.15rem;
  padding: 0.9rem 1.15rem;
  color: var(--ink-2);
  background: var(--veil-ink);
  border-left: 3px solid var(--accent-line);
  border-radius: 0 var(--r-chip) var(--r-chip) 0;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose code {
  padding: 0.15em 0.4em;
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--ink);
  background: var(--veil-ink-2);
  border-radius: 6px;
}

.prose pre {
  margin: 0 0 1.15rem;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--warm-line);
  border-radius: var(--r-chip);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
}

.prose pre code {
  padding: 0;
  font-size: inherit;
  color: inherit;
  background: none;
  border-radius: 0;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-chip);
}

.prose hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose table:not(.data-table) {
  width: 100%;
  margin: 0 0 1.15rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.prose table:not(.data-table) th,
.prose table:not(.data-table) td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.prose table:not(.data-table) th {
  font-weight: 600;
  color: var(--ink);
  background: var(--veil-ink);
}

/* --------------------------------------------------------------------------
   8. 文末下载引导卡（正文里只出现一次）
   -------------------------------------------------------------------------- */

.dl-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  margin: 2.5rem 0 0;
  padding: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  color: var(--ink);
  background: var(--paper-hi);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
}

.dl-cta-text {
  flex: 1 1 20rem;
  min-width: 0;
}

.dl-cta .dl-cta-title {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  line-height: 1.35;
  color: var(--ink);
}

.dl-cta .dl-cta-note {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--ink-2);
}

.dl-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* --------------------------------------------------------------------------
   9. 延伸阅读（阅读版心内最多两列，卡片宽度不小于 300px）
   -------------------------------------------------------------------------- */

#related-posts {
  margin-top: 3rem;
}

#related-posts:empty {
  display: none;
}

#related-posts .post-tail-title,
#post-nav .post-tail-title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  line-height: 1.35;
  color: var(--ink);
}

.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 720px) {
  .related-grid {
    grid-template-columns: repeat(2, minmax(300px, 1fr));
  }
}

.related-item {
  display: flex;
}

.related-card {
  display: block;
  width: 100%;
  height: 100%;
  padding: 1rem 1.15rem 1.1rem;
  color: var(--ink);
  background: var(--paper-hi);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.related-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-soft);
}

.related-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-3);
}

.related-tag {
  color: var(--accent-ink);
}

.related-meta time {
  color: var(--ink-3);
}

.related-title {
  margin: 0.5rem 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.45;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   10. 上一篇 / 下一篇
   -------------------------------------------------------------------------- */

#post-nav {
  margin-top: 2.5rem;
}

#post-nav:empty {
  display: none;
}

.post-nav-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}

@media (min-width: 640px) {
  .post-nav-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

.post-nav-card {
  display: block;
  padding: 0.95rem 1.15rem;
  color: var(--ink);
  background: var(--paper-hi);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  text-decoration: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.post-nav-card:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-soft);
}

.post-nav-dir {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.post-nav-title {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   11. 窄屏收口
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .blog-hero {
    padding-block: 1.75rem 1rem;
  }

  .blog-list-sec {
    padding-block: 0.75rem 3rem;
  }

  .filter-bar {
    gap: 0.4rem;
  }

  .filter-btn {
    padding: 0.5rem 0.8rem;
    font-size: 12px;
  }

  .dl-cta {
    gap: 1rem;
  }

  .dl-cta-actions {
    width: 100%;
  }
}