/* 博客列表与阅读页：使用共享设计令牌，不改写全站按钮及浮层皮肤。 */
.blog-index,
.article-page {
  background: var(--bg);
  color: var(--text);
}

.blog-breadcrumb,
nav.breadcrumb,
nav.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.blog-breadcrumb a,
nav.breadcrumb a,
nav.breadcrumbs a {
  flex: none;
  color: var(--text-muted);
  text-decoration: none;
}

.blog-breadcrumb a:hover,
nav.breadcrumb a:hover,
nav.breadcrumbs a:hover {
  color: var(--accent);
}

.blog-breadcrumb .breadcrumb-separator,
nav.breadcrumb .breadcrumb-separator,
nav.breadcrumbs .breadcrumb-separator {
  flex: none;
  color: var(--text-faint);
}

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

.blog-hero {
  max-width: 52rem;
  padding: 0.75rem 0 2.25rem;
}

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

.blog-hero h1 {
  max-width: 100%;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 1.4rem + 1.7vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.blog-intro {
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
}

.blog-catalog {
  padding: 0.75rem 0 5rem;
}

.blog-catalog > h2,
#related-posts > h2 {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  line-height: 1.35;
}

.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-bottom: 1.75rem;
}

.blog-filters button {
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.blog-filters button:hover,
.blog-filters button:focus-visible {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.blog-filters button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

.blog-post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.post-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(1.25rem, 2.5vw, 2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg);
  box-shadow: var(--shadow-soft);
  color: var(--text);
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.post-card:hover,
.post-card:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--shadow-card);
}

.post-meta,
.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.625rem;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.post-card .tag,
.article-meta .tag {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-pill);
  background: var(--bg-panel);
  color: var(--accent-dark);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.post-card h3 {
  margin: 1rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.post-card p {
  margin: 0.875rem 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.8;
}

.post-more {
  display: inline-block;
  margin-top: auto;
  padding-top: 1rem;
  color: var(--accent-dark);
  font-size: 0.875rem;
  font-weight: 700;
}

.blog-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  color: var(--text-muted);
}

/* Keep the full article (including its introduction) in the same reading column. */
main.wrap:has(.article-body),
main:has(> .wrap.article-body) > .wrap {
  max-width: 820px;
  margin-inline: auto;
}
main.wrap:has(.article-body) { padding-top: 24px; }

.article-page > .wrap,
.article-page .article-shell {
  max-width: min(100% - 2 * var(--gutter), 820px);
  margin-inline: auto;
}

main:has(.article-body) > nav:first-child {
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
}

.article-page .blog-breadcrumb,
.article-page nav.breadcrumb,
.article-page nav.breadcrumbs {
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
}

/* 页首独立于首页的大节奏 .section，避免首屏空带。 */
.article-page .section,
.article-page .article-section {
  padding-block: 0;
}

.article-hero {
  padding-top: 0;
  padding-bottom: 1.5rem;
}

.article-hero .article-meta,
.article-hero .post-meta,
.article-hero > p:first-child:not(:last-child) {
  margin-bottom: 0.875rem;
}

.article-hero h1 {
  max-width: 100%;
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.article-hero .article-lead,
.article-hero .lead,
.article-hero > p:last-child {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  line-height: 1.7;
}

.article-body,
.prose {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.85;
  overflow-wrap: break-word;
}

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

.article-body h2,
.prose h2 {
  margin: 2rem 0 0.875rem;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  font-weight: 800;
  line-height: 1.4;
}

.article-body h2:first-child,
.prose h2:first-child,
.article-body section:first-child > h2:first-child,
.prose section:first-child > h2:first-child {
  margin-top: 0;
}

.article-body h3,
.prose h3 {
  margin: 1.5rem 0 0.625rem;
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 1rem + 0.45vw, 1.25rem);
  line-height: 1.45;
}

.article-body p,
.prose p,
.article-body ul,
.prose ul,
.article-body ol,
.prose ol,
.article-body blockquote,
.prose blockquote {
  margin: 0 0 1rem;
}

.article-body li + li,
.prose li + li {
  margin-top: 0.35rem;
}

.article-body section + section,
.prose section + section {
  margin-top: 2rem;
}

.article-body section,
.prose section {
  padding-block: 0;
}

.article-body section > h2:first-child,
.prose section > h2:first-child {
  margin-top: 0;
}

.article-body a:not([class*="btn"]):not([class*="button"]),
.prose a:not([class*="btn"]):not([class*="button"]) {
  color: var(--accent-dark);
  text-underline-offset: 0.2em;
}

.article-body blockquote,
.prose blockquote {
  padding: 0.875rem 1.25rem;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
}

.article-body blockquote > :last-child,
.prose blockquote > :last-child {
  margin-bottom: 0;
}

.article-body :not(pre) > code,
.prose :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

.article-body pre,
.prose pre {
  max-width: 100%;
  margin: 1rem 0 1.5rem;
  padding: 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
}

.article-body pre code,
.prose pre code {
  font: inherit;
}

.article-body .table-scroll,
.prose .table-scroll,
.article-body table,
.prose table {
  max-width: 100%;
  overflow-x: auto;
}

.article-body table,
.prose table {
  display: block;
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.article-body th,
.article-body td,
.prose th,
.prose td {
  padding: 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
  word-break: normal;
  overflow-wrap: normal;
}

.end-download {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 2rem 0;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-panel);
}

.end-download h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.375rem;
  line-height: 1.4;
}

.end-download p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
}

.end-download .end-download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

#related-posts {
  margin: 2.5rem 0 0;
}

#related-posts .related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  gap: 1rem;
}

#related-posts .post-card {
  min-height: 11rem;
  padding: 1.25rem;
}

#related-posts .post-card h3 {
  font-size: 1.0625rem;
}

#post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 4rem;
}

.post-nav-link {
  display: block;
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.post-nav-link:hover,
.post-nav-link:focus-visible {
  border-color: var(--accent);
}

.post-nav-next {
  grid-column: 2;
  text-align: right;
}

.post-nav-caption,
.post-nav-title {
  display: block;
}

.post-nav-caption {
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.post-nav-title {
  font-weight: 700;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

@media (max-width: 700px) {
  .blog-hero h1 {
    font-size: clamp(1.5rem, 5vw, 1.875rem);
  }

  .blog-post-grid,
  #related-posts .related-grid,
  #post-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-nav-next {
    grid-column: 1;
    text-align: left;
  }

  .article-page > .wrap,
  .article-page .article-shell {
    max-width: none;
  }
}