/* 博客仅使用 base.css 中的设计令牌，不覆盖共享按钮与下载浮层。 */
.blog-index,
.blog-article,
.article-page {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

.blog-main {
  padding-bottom: 5rem;
}

.blog-skip {
  position: absolute;
  top: 0.75rem;
  left: 1rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: var(--r-card);
  background: var(--bg-panel);
  color: var(--accent);
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.blog-skip:focus {
  width: auto;
  height: auto;
  padding: 0.75rem 1rem;
  overflow: visible;
  clip-path: none;
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.blog-hero {
  padding-block: 3.5rem 2.5rem;
  text-align: center;
}

.blog-kicker {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: var(--weight-medium);
}

.blog-hero h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 1.2rem + 2vw, 3rem);
  font-weight: var(--weight-display);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.blog-intro {
  max-width: 44rem;
  margin: 1.25rem auto 0;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.8;
}

.blog-library {
  padding: 2rem;
  border-radius: var(--r-shell);
  background: var(--bg-panel-2);
}

.blog-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.625rem;
}

.blog-filters button {
  min-height: 44px;
  padding: 0.625rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: var(--weight-medium);
  line-height: 1.5;
  cursor: pointer;
}

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

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

.blog-filters button:focus-visible,
.post-card a:focus-visible,
.post-nav-card: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-status {
  margin: 1.5rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}

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

.blog-post-grid > *,
.related-grid > *,
#post-nav > * {
  min-width: 0;
}

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

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

.post-card .tag,
.article-meta .tag,
.post-meta .tag {
  display: inline-block;
  max-width: 100%;
  padding: 0.25rem 0.625rem;
  border-radius: var(--r-pill);
  background: var(--bg-panel-2);
  color: var(--accent-dark);
  font-size: 0.8125rem;
  font-weight: var(--weight-medium);
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}

.post-card h2,
.post-card h3 {
  max-width: 100%;
  margin: 1rem 0 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: var(--weight-bold);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.post-card h2 a,
.post-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.post-card h2 a:hover,
.post-card h3 a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.post-card .post-summary {
  margin: 1rem 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.post-card .post-read {
  align-self: flex-start;
  margin-top: auto;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: var(--weight-semibold);
  line-height: 1.7;
  text-decoration: none;
}

.post-card .post-read:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

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

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

/* 路标始终单行；当前标题只占剩余空间。 */
.blog-breadcrumb,
nav.breadcrumb,
nav.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  min-width: 0;
  margin-top: 1.5rem;
  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;
  opacity: 0.65;
}

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

.blog-breadcrumb > span:not([aria-current]),
nav.breadcrumb > span:not([aria-current]),
nav.breadcrumbs > span:not([aria-current]),
.blog-breadcrumb .breadcrumb-separator,
nav.breadcrumb .breadcrumb-separator,
nav.breadcrumbs .breadcrumb-separator {
  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;
}

/* 即使文章误带通用 section 类，也保持首屏与章节的紧凑节奏。 */
.blog-article main.section,
.article-page main.section,
.article-main.section,
.blog-article main > .section,
.article-page main > .section,
.section:has(> .blog-breadcrumb),
.section:has(> nav.breadcrumb),
.section:has(> nav.breadcrumbs) {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.article-main {
  padding-bottom: 3rem;
}

main.wrap.reading {
  padding-top: 2rem;
}

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

.article-hero.section,
.article-header.section,
.post-hero.section {
  padding-block: 0.5rem 1.75rem;
}

.article-hero .article-meta,
.article-hero .post-meta,
.article-header .article-meta,
.article-header .post-meta,
.post-hero .article-meta,
.post-hero .post-meta {
  margin: 0 0 1rem;
}

.article-hero h1,
.article-header h1,
.post-hero h1,
.blog-article .prose h1,
.article-page .prose h1,
main.reading .prose h1 {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-block: 0.875rem 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  font-weight: var(--weight-display);
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.article-lead,
.post-lead,
.article-hero .lead,
.article-header .lead,
.post-hero .lead {
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  line-height: 1.7;
}

.article-hero > p:last-child:not(.article-meta):not(.post-meta),
.article-header > p:last-child:not(.article-meta):not(.post-meta),
.post-hero > p:last-child:not(.article-meta):not(.post-meta) {
  margin-top: 1rem;
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  line-height: 1.7;
}

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

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

.prose h2,
.prose h3 {
  display: block;
  max-width: 100%;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  overflow-wrap: anywhere;
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

.prose h2 {
  margin: 2rem 0 1rem;
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  line-height: 1.45;
}

.prose h3 {
  margin: 1.5rem 0 0.75rem;
  font-size: clamp(1.125rem, 1rem + 0.4vw, 1.25rem);
  line-height: 1.5;
}

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

.prose section {
  margin-block: 0;
  padding-block: 0;
}

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

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

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose .table-wrap {
  margin-block: 0 1.25rem;
}

.prose ul,
.prose ol {
  padding-left: 1.5rem;
}

.prose li + li {
  margin-top: 0.375rem;
}

.prose li > ul,
.prose li > ol {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

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

.prose code {
  padding: 0.125rem 0.375rem;
  border-radius: var(--r-cell);
  background: var(--bg-panel-2);
  color: var(--accent-dark);
  font-family: var(--font-mono);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

.prose pre {
  max-width: 100%;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-panel-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.8;
  white-space: pre;
  overflow-x: auto;
  overflow-wrap: normal;
  tab-size: 2;
}

.prose pre code {
  padding: 0;
  border-radius: var(--r-cell);
  background: var(--clear);
  color: inherit;
  font-size: inherit;
  white-space: inherit;
  word-break: normal;
  overflow-wrap: normal;
}

.prose blockquote {
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--accent);
  border-radius: var(--r-card);
  background: var(--bg-panel-2);
  color: var(--text-muted);
}

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

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

.prose .table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.prose table {
  display: block;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  overflow-x: auto;
}

.prose th,
.prose td {
  min-width: 7em;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--bg-panel-2);
  color: var(--text);
  font-weight: var(--weight-semibold);
}

.prose td {
  background: var(--bg-panel);
}

.article-download {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-block: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-window);
  background: var(--bg-panel-2);
  color: var(--text);
}

.article-download > div {
  min-width: 0;
}

.article-download h2,
.prose .article-download h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  line-height: 1.5;
}

.article-download p,
.prose .article-download p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.article-download .article-download-actions,
.article-download .button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

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

#related-posts > h2 {
  display: block;
  margin: 0 0 1.25rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: var(--weight-bold);
  line-height: 1.45;
}

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

#related-posts .post-card {
  padding: 1.25rem;
  border-radius: var(--r-window);
}

#related-posts .post-card h3 {
  margin: 1rem 0 0;
  font-size: 1.125rem;
}

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

.post-nav-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r-window);
  background: var(--bg-panel);
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}

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

.post-nav-label,
.post-nav-card time {
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.post-nav-title {
  color: var(--text);
  font-size: 1rem;
  font-weight: var(--weight-semibold);
  line-height: 1.65;
}

.post-nav-card:hover .post-nav-title {
  color: var(--accent);
}

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

#related-posts[hidden],
#post-nav[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .blog-library {
    padding: 1.5rem;
  }

  .blog-post-grid .post-card {
    padding: 1.5rem;
  }
}

@media (max-width: 640px) {
  .blog-main {
    padding-bottom: 3rem;
  }

  .blog-hero {
    padding-block: 2.5rem 2rem;
  }

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

  .blog-intro {
    margin-top: 1rem;
    font-size: 0.9375rem;
  }

  .blog-library {
    padding: 1rem;
    border-radius: var(--r-window);
  }

  .blog-filters {
    justify-content: flex-start;
    gap: 0.5rem;
  }

  .blog-filters button {
    padding-inline: 0.875rem;
  }

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

  .blog-post-grid .post-card {
    padding: 1.25rem;
    border-radius: var(--r-window);
  }

  .article-hero h1,
  .article-header h1,
  .post-hero h1,
  .blog-article .prose h1,
  .article-page .prose h1,
main.reading .prose h1 {
    font-size: 1.5rem;
  }

  .article-download {
    align-items: flex-start;
    padding: 1.25rem;
  }

  .post-nav-next {
    grid-column: auto;
  }

  .prose pre {
    padding: 1rem;
  }
}