/* 博客页面沿用 base.css 的颜色、字体与圆角令牌。 */
.blog-index main,
.article-page main,
.blog-article main {
  min-width: 0;
}

main.reading:has(> article) {
  padding-top: 32px;
}

main.reading:has(> article) > nav {
  margin: 0 0 20px;
}

main.reading:has(> article) > nav > p {
  margin: 0;
}

main.reading > article > header {
  padding-bottom: 24px;
}

main.reading > article > header > .post-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

main.reading > article > header > h1 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  line-height: 1.32;
  overflow-wrap: anywhere;
}

main.reading > article > header > .section-lead {
  margin: 0;
  line-height: 1.7;
}

.blog-skip {
  position: absolute;
  top: 8px;
  left: 16px;
  z-index: 100;
  padding: 12px 20px;
  transform: translateY(-160%);
  background: var(--bg);
  color: var(--accent-dark);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
}

.blog-skip:focus {
  transform: translateY(0);
}

.blog-hero {
  padding-block: 48px 32px;
}

.blog-eyebrow {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.blog-hero h1 {
  display: block;
  max-width: 100%;
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 3.4vw, 3rem);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.blog-intro {
  max-width: 46em;
  margin: 20px 0 0;
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1.8;
}

.blog-shelf {
  padding-bottom: 72px;
}

.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.blog-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  max-width: 100%;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  white-space: normal;
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.blog-filter:hover {
  background: var(--bg-panel);
  color: var(--text);
}

.blog-filter[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: var(--accent);
}

.blog-filter:focus-visible,
.blog-skip:focus-visible,
.blog-post-grid a:focus-visible,
#related-posts a:focus-visible,
#post-nav a:focus-visible,
.blog-breadcrumb a:focus-visible,
nav.breadcrumb a:focus-visible,
nav.breadcrumbs a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.blog-results {
  min-height: 1.6em;
  margin: 22px 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.blog-post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.blog-post-grid .post-card,
#related-posts .post-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.blog-post-grid .post-card__meta,
#related-posts .post-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.blog-post-grid .tag,
#related-posts .tag {
  max-width: 100%;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--bg-panel-2);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.blog-post-grid .post-card__title,
#related-posts .post-card__title {
  display: block;
  max-width: 100%;
  margin: 0 0 16px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.blog-post-grid .post-card__title a,
#related-posts .post-card__title a {
  color: var(--text);
  text-decoration: none;
}

.blog-post-grid .post-card__title a:hover,
#related-posts .post-card__title a:hover {
  color: var(--accent-dark);
}

.blog-post-grid .post-card__summary,
#related-posts .post-card__summary {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.blog-post-grid .post-card__more,
#related-posts .post-card__more {
  align-self: flex-start;
  margin-top: auto;
  padding-block: 8px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  text-decoration: none;
}

.blog-post-grid .post-card__more:hover,
#related-posts .post-card__more:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.blog-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--bg-panel);
  color: var(--text-muted);
  line-height: 1.8;
}

.blog-empty a {
  color: var(--accent-dark);
}

/* 常见文章面包屑别名共用同一套单行截断规则。 */
.blog-breadcrumb,
nav.breadcrumb,
nav.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  padding-block: 0;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.7;
  white-space: nowrap;
  overflow: hidden;
}

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

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

.blog-breadcrumb [aria-hidden="true"],
nav.breadcrumb [aria-hidden="true"],
nav.breadcrumbs [aria-hidden="true"] {
  flex: 0 0 auto;
  opacity: 0.35;
}

.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;
}

.article-page main.section,
.blog-article main.section,
main.reading.section,
.article-page .section:has(.blog-breadcrumb, nav.breadcrumb, nav.breadcrumbs),
.blog-article .section:has(.blog-breadcrumb, nav.breadcrumb, nav.breadcrumbs),
.section:has(> .blog-breadcrumb, > nav.breadcrumb, > nav.breadcrumbs) {
  padding-top: 12px;
}

.article-hero,
.article-header {
  padding-block: 8px 24px;
}

.article-meta,
.article-hero__meta,
.article-header__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

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

.article-lead,
.article-hero__lead,
.article-header__lead,
.article-hero > p:not([class]),
.article-header > p:not([class]) {
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  line-height: 1.7;
}

.article-body,
.prose {
  min-width: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

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

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

.article-body h2,
.prose h2 {
  display: block;
  max-width: 100%;
  margin: 32px 0 16px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1rem + 0.6vw, 1.5rem);
  font-weight: 800;
  line-height: 1.5;
  scroll-margin-top: calc(var(--nav-h) + 20px);
}

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

.article-body h3,
.prose h3 {
  display: block;
  max-width: 100%;
  margin: 24px 0 12px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.5;
}

.article-body p,
.prose p {
  margin-block: 0 18px;
}

.article-body ul,
.article-body ol,
.prose ul,
.prose ol {
  margin-block: 12px 20px;
  padding-left: 1.5em;
}

.article-body li + li,
.prose li + li {
  margin-top: 8px;
}

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

.article-body code,
.prose code {
  padding: 2px 5px;
  border-radius: var(--r-xs);
  background: var(--bg-panel-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

.article-body pre,
.prose pre {
  max-width: 100%;
  margin: 20px 0;
  padding: 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-panel);
  color: var(--text);
  line-height: 1.75;
}

.article-body pre code,
.prose pre code {
  padding: 0;
  background: var(--clear);
  color: inherit;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
}

.article-body blockquote,
.prose blockquote {
  margin: 20px 0;
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  border-radius: var(--r-xs);
  background: var(--bg-panel);
  color: var(--text-muted);
}

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

.article-body .table-scroll,
.prose .table-scroll {
  max-width: 100%;
  margin-block: 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.article-body table,
.prose table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-block: 20px;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.75;
}

.article-body .table-scroll table,
.prose .table-scroll table {
  display: table;
  margin: 0;
}

.article-body th,
.article-body td,
.prose th,
.prose td {
  min-width: 7em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.article-body th,
.prose th {
  background: var(--bg-panel);
  color: var(--text);
  font-weight: 700;
}

.article-body img,
.prose img,
.article-body svg,
.prose svg {
  max-width: 100%;
}

.article-body img,
.prose img {
  height: auto;
}

.article-download {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px 28px;
  margin-block: 32px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--bg-panel);
  color: var(--text);
}

.article-download > div:first-child {
  flex: 1 1 280px;
  min-width: 0;
}

.article-download h2 {
  display: block;
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.5;
}

.article-download p {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.8;
}

.article-download .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

#related-posts {
  margin-block: 32px;
  padding-block: 0;
}

#related-posts:empty,
#post-nav:empty {
  display: none;
}

#related-posts .related-heading {
  display: block;
  margin: 0 0 20px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.5;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

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

#post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-block: 28px 48px;
  padding-block: 0;
}

#post-nav .post-nav__link {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

#post-nav .post-nav__link:hover {
  border-color: var(--accent);
  background: var(--bg-panel);
}

#post-nav .post-nav__link--prev {
  grid-column: 1;
}

#post-nav .post-nav__link--next {
  grid-column: 2;
}

#post-nav .post-nav__label {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

#post-nav .post-nav__title {
  color: var(--accent-dark);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

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

@media (max-width: 700px) {
  #related-posts .related-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .blog-hero {
    padding-block: 32px 28px;
  }

  .blog-hero h1 {
    font-size: clamp(1.5rem, 6.5vw, 1.875rem);
  }

  .blog-intro {
    font-size: 16px;
  }

  .blog-shelf {
    padding-bottom: 48px;
  }

  .blog-filter {
    padding-inline: 16px;
  }

  .blog-post-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .blog-post-grid .post-card,
  #related-posts .post-card {
    padding: 24px;
    transform: none;
  }

  .article-hero h1,
  .article-header h1,
  .article-body h1,
  .prose h1 {
    font-size: 24px;
  }

  .article-download {
    padding: 24px;
  }

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

  #post-nav .post-nav__link--prev,
  #post-nav .post-nav__link--next {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .blog-filter {
    transition: none;
  }
}