.blog-index,
.article-page {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

.blog-index main,
.article-page main {
  min-width: 0;
}

.blog-skip-link {
  position: absolute;
  top: 0.75rem;
  left: var(--gutter);
  z-index: 100;
  padding: 0.75rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--r-ctl);
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font-body);
  transform: translateY(-180%);
}

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

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

.blog-eyebrow {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--size-small);
  font-weight: var(--weight-regular);
}

.blog-list-hero h1 {
  max-width: 100%;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.4rem + 2vw, 3rem);
  font-weight: var(--weight-regular);
  line-height: 1.25;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

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

.blog-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.blog-facts span {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--size-micro);
  line-height: 1.5;
}

.blog-catalogue {
  padding-block: 1rem 4.5rem;
}

.blog-catalogue-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.25rem;
}

.blog-catalogue-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1rem + 0.6vw, 1.5rem);
  font-weight: var(--weight-regular);
  line-height: 1.4;
}

.blog-result-count {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--size-small);
}

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

.blog-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  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: var(--size-small);
  font-weight: var(--weight-regular);
  line-height: 1.5;
  cursor: pointer;
  transition: border-color var(--duration) var(--ease), color var(--duration) var(--ease);
}

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

.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-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: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  background: var(--bg-panel);
  color: var(--text);
}

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

.post-meta time,
.article-meta time {
  font-variant-numeric: tabular-nums;
}

.post-meta .tag,
.article-meta .tag {
  max-width: 100%;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-tag);
  background: var(--bg-panel-2);
  color: var(--text-muted);
  font-family: var(--font-body);
  white-space: normal;
  overflow-wrap: anywhere;
}

.post-card h3 {
  max-width: 100%;
  margin: 1rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 1rem + 0.35vw, 1.25rem);
  font-weight: var(--weight-regular);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.post-card h3 a {
  color: var(--text);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}

.post-card h3 a:hover {
  color: var(--accent);
}

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

.post-card .post-read {
  align-self: flex-start;
  margin-top: auto;
  color: var(--accent);
  font-size: var(--size-small);
  line-height: 1.6;
  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: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-panel);
  color: var(--text-muted);
  line-height: 1.8;
}

.blog-empty a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

.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: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  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 > span:not([aria-current]),
nav.breadcrumb > span:not([aria-current]),
nav.breadcrumbs > span:not([aria-current]) {
  flex: 0 0 auto;
  color: var(--text-muted);
  opacity: 0.6;
}

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

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

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

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

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

.article-hero h1 {
  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-regular);
  line-height: 1.32;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.article-hero .article-lead,
.article-hero .article-summary,
.article-hero .lead,
.article-hero > p:not(.post-meta):not(.article-meta) {
  max-width: 100%;
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  font-weight: var(--weight-regular);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

main.reading-wrap {
  padding-top: 32px;
}

main.reading-wrap > nav:first-child {
  margin-bottom: 20px;
}

main.reading-wrap > nav:first-child > p {
  margin: 0;
}

main.reading-wrap header:has(> h1) {
  margin-bottom: 0;
  padding-bottom: 24px;
}

main.reading-wrap header:has(> h1) > .post-meta {
  margin-bottom: 14px;
}

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

main.reading-wrap header:has(> h1) > p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
}

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

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

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

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

.article-body h2,
.article-page .prose h2 {
  max-width: 100%;
  margin: 2rem 0 1rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  font-weight: var(--weight-regular);
  line-height: 1.5;
  scroll-margin-top: calc(var(--nav-h) + 1rem);
}

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

.article-body h3,
.article-page .prose h3 {
  max-width: 100%;
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 1rem + 0.35vw, 1.25rem);
  font-weight: var(--weight-regular);
  line-height: 1.55;
}

.article-body p,
.article-page .prose p {
  margin-block: 0 1rem;
}

.article-body ul,
.article-body ol,
.article-page .prose ul,
.article-page .prose ol {
  margin-block: 0 1.25rem;
  padding-left: 1.5rem;
}

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

.article-body a:not([class*="btn"]):not([class*="button"]),
.article-page .prose a:not([class*="btn"]):not([class*="button"]) {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}

.article-body code,
.article-page .prose code {
  padding: 0.1em 0.3em;
  border-radius: var(--r-tag);
  background: var(--bg-panel-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9em;
  white-space: normal;
  overflow-wrap: anywhere;
}

.article-body pre,
.article-page .prose pre {
  max-width: 100%;
  margin: 1.25rem 0;
  padding: 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-canvas);
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--size-small);
  line-height: 1.8;
  tab-size: 2;
}

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

.article-body blockquote,
.article-page .prose blockquote {
  margin: 1.25rem 0;
  padding: 0.75rem 1rem;
  border-left: 2px solid var(--accent);
  background: var(--bg-panel);
  color: var(--text-muted);
}

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

.article-body .table-scroll,
.article-page .prose .table-scroll {
  max-width: 100%;
  margin-block: 1.25rem;
  overflow-x: auto;
}

.article-body table,
.article-page .prose table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-block: 1.25rem;
  overflow-x: auto;
  border-collapse: collapse;
  color: var(--text);
  font-size: var(--size-small);
  line-height: 1.7;
}

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

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

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

.article-body td,
.article-page .prose td {
  background: var(--bg-panel);
  color: var(--text);
}

.article-body img,
.article-page .prose img {
  max-width: 100%;
  height: auto;
}

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

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

.article-download h2,
.article-body .article-download h2,
.article-page .prose .article-download h2 {
  margin: 0 0 0.625rem;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  font-weight: var(--weight-regular);
  line-height: 1.5;
}

.article-download p,
.article-body .article-download p,
.article-page .prose .article-download p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--size-small);
  line-height: 1.8;
}

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

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

#related-posts > h2 {
  margin: 0 0 1.25rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  font-weight: var(--weight-regular);
  line-height: 1.5;
}

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

#related-posts .post-card {
  padding: 1.5rem;
}

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

#post-nav .post-nav-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-panel);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--duration) var(--ease);
}

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

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

.post-nav-label {
  color: var(--accent);
  font-size: var(--size-small);
  line-height: 1.5;
}

.post-nav-title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--size-body);
  font-weight: var(--weight-regular);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.post-nav-date {
  margin-top: auto;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
}

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

@media (max-width: 640px) {
  .blog-list-hero {
    padding-block: 2.5rem 2rem;
  }

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

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

  .post-card {
    padding: 1.5rem;
  }

  .blog-filters {
    gap: 0.5rem;
  }

  .blog-filter {
    padding-inline: 0.875rem;
  }

  .article-hero h1 {
    font-size: 1.5rem;
  }

  .article-download {
    padding: 1.25rem;
  }

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

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

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

@media (prefers-reduced-motion: reduce) {
  .blog-filter,
  .post-card h3 a,
  #post-nav .post-nav-card {
    transition: none;
  }
}