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

.blog-skip {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-start: 16px;
  z-index: 100;
  padding: 12px 18px;
  transform: translateY(-160%);
  border-radius: var(--r-btn);
  background: var(--c-accent);
  color: var(--c-text);
}

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

.blog-hero {
  padding-block: 40px;
  border-radius: 0 0 var(--r-sheet) var(--r-sheet);
  background: var(--c-dark);
  color: var(--d-on);
}

.blog-hero__eyebrow {
  margin: 0 0 16px;
  color: var(--c-accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.blog-hero h1 {
  margin: 0;
  max-width: 100%;
  font-family: var(--f-display);
  font-size: clamp(2rem, 1.25rem + 2.5vw, 3rem);
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.blog-hero__lead {
  max-width: var(--read);
  margin: 20px 0 0;
  color: var(--d-muted);
  font-size: 17px;
  line-height: 1.75;
}

.blog-hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.blog-hero__facts span {
  padding: 8px 14px;
  border: 1px solid var(--d-line);
  border-radius: var(--r-pill);
  background: var(--d-cell-1);
  color: var(--d-on);
  font-size: 13px;
}

.blog-library {
  padding-block: 40px 64px;
}

.blog-library__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.blog-library__heading h2 {
  margin: 0;
  font-family: var(--f-display);
  font-size: 24px;
  line-height: 1.4;
}

.blog-count {
  margin: 0;
  color: var(--c-muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.blog-filters button {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  background: var(--c-bg);
  color: var(--c-muted);
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

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

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

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

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

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

.post-card__meta,
.article-meta,
.article-hero__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: var(--c-muted);
  font-size: 13px;
  line-height: 1.6;
}

.post-card__meta time {
  font-family: var(--f-mono);
  font-size: 12px;
}

.blog-post-grid .tag,
#related-posts .tag,
.article-meta .tag,
.article-hero__meta .tag {
  max-width: 100%;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--c-panel);
  color: var(--c-muted);
  white-space: normal;
  overflow-wrap: anywhere;
}

.post-card h3 {
  margin: 18px 0 12px;
  font-family: var(--f-display);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

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

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

.post-card > p {
  margin: 0 0 24px;
  color: var(--c-muted);
  font-size: 15px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.post-card .post-card__more {
  align-self: flex-start;
  margin-top: auto;
  color: var(--c-accent-dark);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.7;
  text-decoration: none;
}

.post-card__more:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

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

.blog-empty a {
  color: var(--c-accent-dark);
  text-underline-offset: 4px;
}

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

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

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

.blog-breadcrumb [aria-hidden="true"],
nav.breadcrumb [aria-hidden="true"],
nav.breadcrumbs [aria-hidden="true"] {
  flex: 0 0 auto;
  color: var(--c-muted);
  opacity: 0.55;
}

.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-article main.section,
.blog-article main > .section:first-child,
main.section:has(.article-hero),
.section:has(> .blog-breadcrumb),
.section:has(> nav.breadcrumb),
.section:has(> nav.breadcrumbs) {
  padding-top: 20px;
  padding-bottom: 32px;
}

main.read-wrap:has(.article-body) {
  padding-top: 32px;
}

.article-hero {
  padding-block: 8px 24px;
  color: var(--c-text);
}

.article-hero .article-meta,
.article-hero .article-hero__meta {
  margin-top: 0;
  margin-bottom: 0.875rem;
}

main.read-wrap:has(.article-body) h1,
.article-hero h1 {
  max-width: 100%;
  margin-block: 0.875rem 0.75rem;
  font-family: var(--f-display);
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  font-weight: 800;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.article-hero__lead,
.article-lead,
.article-hero > p:not(.article-meta):not(.article-hero__meta) {
  margin: 1rem 0 0;
  color: var(--c-muted);
  font-size: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

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

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

.article-body h2,
.prose h2 {
  margin: 32px 0 16px;
  font-family: var(--f-display);
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  font-weight: 800;
  line-height: 1.5;
}

.article-body h3,
.prose h3 {
  margin: 24px 0 12px;
  font-family: var(--f-display);
  font-size: 20px;
  line-height: 1.55;
}

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

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

.article-body section + section,
.prose section + section {
  margin-top: 32px;
}

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

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

.article-body p,
.prose p,
.article-body ul,
.prose ul,
.article-body ol,
.prose ol {
  margin-block: 0 16px;
}

.article-body ul,
.prose ul,
.article-body ol,
.prose ol {
  padding-inline-start: 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(--c-accent-dark);
  text-underline-offset: 4px;
}

.article-body blockquote,
.prose blockquote {
  margin: 24px 0;
  padding: 16px 20px;
  border-inline-start: 3px solid var(--c-accent-dark);
  border-radius: 0 var(--r-field) var(--r-field) 0;
  background: var(--c-panel);
  color: var(--c-text);
}

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

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

.article-body pre,
.prose pre {
  max-width: 100%;
  margin: 24px 0;
  padding: 20px;
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--r-card);
  background: var(--c-panel);
  color: var(--c-text);
  font-family: var(--f-mono);
  font-size: 14px;
  line-height: 1.75;
  white-space: pre;
  overflow-wrap: normal;
  tab-size: 2;
}

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

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

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

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

.article-body th,
.article-body td,
.prose th,
.prose td {
  min-width: 7em;
  padding: 12px 16px;
  border: 1px solid var(--c-border);
  text-align: start;
  vertical-align: top;
  word-break: normal;
  overflow-wrap: normal;
}

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

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

.article-download {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin: 32px 0;
  padding: 28px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-card);
  background: var(--c-panel);
  color: var(--c-text);
}

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

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

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

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

#related-posts {
  display: grid;
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  gap: 20px;
  margin-block: 32px;
  padding: 0;
}

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

#related-posts > .related-posts__heading {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--c-text);
  font-family: var(--f-display);
  font-size: 24px;
  line-height: 1.4;
}

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

#post-nav .post-nav__card {
  display: block;
  padding: 22px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-card);
  background: var(--c-panel);
  color: var(--c-text);
  text-decoration: none;
}

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

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

.post-nav__label {
  display: block;
  margin-bottom: 10px;
  color: var(--c-muted);
  font-size: 13px;
  line-height: 1.6;
}

.post-nav__title {
  display: block;
  color: var(--c-text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.blog-filters button:focus-visible,
.blog-skip:focus-visible,
.post-card a:focus-visible,
.blog-breadcrumb a:focus-visible,
nav.breadcrumb a:focus-visible,
nav.breadcrumbs a:focus-visible,
#post-nav a:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 4px;
}

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

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

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

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

  .blog-library {
    padding-block: 28px 40px;
  }

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

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

  main.read-wrap:has(.article-body) h1,
  .article-hero h1 {
    font-size: 1.5rem;
  }

  .article-hero {
    padding-block: 4px 24px;
  }

  .article-download {
    align-items: flex-start;
    padding: 20px;
  }

  .article-download .btn-row {
    width: 100%;
  }

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

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

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