main.reading:has(> nav [aria-current="page"]) {
  padding-top: 24px;
}

main.reading > nav:has([aria-current="page"]) > p {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  margin: 0 0 1.25rem;
  font-size: 13px;
  line-height: 1.7;
  white-space: nowrap;
}

main.reading > nav:has([aria-current="page"]) a {
  flex: 0 0 auto;
}

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

.prose .btn-primary,
.prose .btn-primary:hover,
.prose .btn-primary:active {
  color: var(--on-accent);
  text-decoration: none;
}

.blog-main {
  padding-bottom: 4rem;
  min-width: 0;
}

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

.blog-hero .kicker {
  margin: 0 0 1rem;
  color: var(--accent);
}

.blog-hero h1 {
  max-width: 100%;
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, 3rem);
  font-weight: 800;
  line-height: 1.3;
}

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

.blog-catalogue {
  min-width: 0;
}

.blog-catalogue-title {
  margin: 0 0 1.25rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.4;
}

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

.blog-filter {
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.5;
  cursor: pointer;
}

.blog-filter:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.blog-filter[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.3em;
}

.blog-filter: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.25rem 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.7;
}

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

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

.post-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.post-card .post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem 0.875rem;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.post-card .tag {
  max-width: 100%;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-panel-2);
  color: var(--text-muted);
  white-space: normal;
}

.post-card .meta {
  color: var(--text-muted);
}

.post-card .post-title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

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

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

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

.post-card .post-read {
  align-self: flex-start;
  margin-top: auto;
  color: var(--accent-dark);
  font-size: 0.9375rem;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.25em;
}

.blog-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding-block: 1.5rem;
  color: var(--text-muted);
  line-height: 1.8;
}

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

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

.blog-breadcrumb [aria-hidden="true"],
nav.breadcrumb [aria-hidden="true"],
nav.breadcrumbs [aria-hidden="true"] {
  flex: 0 0 auto;
  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;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section:has(> .blog-breadcrumb),
.section:has(> nav.breadcrumb),
.section:has(> nav.breadcrumbs) {
  padding-top: 1.5rem;
  padding-bottom: 0;
}

.section > .blog-breadcrumb,
.section > nav.breadcrumb,
.section > nav.breadcrumbs {
  margin-top: 0;
}

.article-hero,
.article-hero.section {
  padding-block: 0.5rem 1.5rem;
}

.article-meta,
.article-hero > .badge-row,
.article-hero > .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem 1rem;
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

.article-hero h1,
.blog-article h1,
.article-body h1,
.article-content h1,
.prose h1 {
  max-width: 100%;
  margin-block: 1rem;
  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;
  overflow-wrap: break-word;
}

.article-lead,
.article-summary,
.article-hero > p:not(.kicker):not(.meta):not(.article-meta) {
  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,
.article-content,
.blog-article,
.prose {
  min-width: 0;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.85;
  overflow-wrap: break-word;
}

.article-body.section,
.article-content.section,
.blog-article.section,
.prose.section {
  padding-top: 0;
  padding-bottom: 2rem;
}

:is(.article-body, .article-content, .blog-article, .prose) section {
  margin-block: 1.5rem 0;
  padding-block: 0;
}

:is(.article-body, .article-content, .blog-article, .prose) h2 {
  margin: 2rem 0 1rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1rem + 0.7vw, 1.5rem);
  font-weight: 800;
  line-height: 1.5;
}

:is(.article-body, .article-content, .blog-article, .prose) > h2:first-of-type,
:is(.article-body, .article-content, .blog-article, .prose) > section:first-of-type,
:is(.article-body, .article-content, .blog-article, .prose) section > h2:first-child {
  margin-top: 0;
}

:is(.article-body, .article-content, .blog-article, .prose) h3 {
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.5;
}

:is(.article-body, .article-content, .blog-article, .prose) p,
:is(.article-body, .article-content, .blog-article, .prose) ul,
:is(.article-body, .article-content, .blog-article, .prose) ol {
  margin-block: 0 1rem;
}

:is(.article-body, .article-content, .blog-article, .prose) li + li {
  margin-top: 0.375rem;
}

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

:is(.article-body, .article-content, .blog-article, .prose) code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

:is(.article-body, .article-content, .blog-article, .prose) :not(pre) > code {
  padding: 0.125rem 0.3rem;
  border-radius: var(--r-sm);
  background: var(--bg-panel-2);
  color: var(--text);
  overflow-wrap: anywhere;
}

:is(.article-body, .article-content, .blog-article, .prose) pre {
  max-width: 100%;
  margin-block: 1rem 1.5rem;
  padding: 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-inset);
  color: var(--text);
  line-height: 1.75;
  white-space: pre;
  overflow-wrap: normal;
}

:is(.article-body, .article-content, .blog-article, .prose) pre code {
  white-space: inherit;
  overflow-wrap: normal;
  word-break: normal;
}

:is(.article-body, .article-content, .blog-article, .prose) blockquote {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--border-strong);
  background: var(--bg-panel);
  color: var(--text-muted);
}

:is(.article-body, .article-content, .blog-article, .prose) blockquote > :last-child {
  margin-bottom: 0;
}

:is(.article-body, .article-content, .blog-article, .prose) img {
  max-width: 100%;
  height: auto;
}

:is(.article-body, .article-content, .blog-article, .prose) .table-scroll {
  max-width: 100%;
  margin-block: 1.25rem;
  overflow-x: auto;
}

:is(.article-body, .article-content, .blog-article, .prose) table {
  display: block;
  max-width: 100%;
  margin-block: 1.25rem;
  overflow-x: auto;
  border-collapse: collapse;
  color: var(--text);
  font-size: 0.9375rem;
}

:is(.article-body, .article-content, .blog-article, .prose) .table-scroll table {
  display: table;
  width: 100%;
  max-width: none;
  margin: 0;
}

:is(.article-body, .article-content, .blog-article, .prose) :is(th, td) {
  min-width: 7em;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
  word-break: normal;
}

:is(.article-body, .article-content, .blog-article, .prose) th {
  background: var(--bg-panel-2);
  font-weight: 700;
}

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

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

.article-download h2 {
  margin: 0 0 0.625rem;
  font-size: 1.5rem;
  line-height: 1.5;
}

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

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

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

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

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

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

#post-nav .post-nav-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
}

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

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

.post-nav-title {
  color: var(--text);
  font-weight: 700;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.post-nav-card:hover .post-nav-title {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.2em;
}

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

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

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

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

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

  .blog-hero h1 {
    font-size: 1.75rem;
  }

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

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

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

  .post-card,
  .article-download {
    padding: 1.25rem;
  }

  .article-hero h1,
  .blog-article h1,
  .article-body h1,
  .article-content h1,
  .prose h1 {
    font-size: 1.5rem;
  }

  .article-download-actions {
    width: 100%;
  }
}