:root {
  --blog-title-list: clamp(2rem, 1.35rem + 2vw, 3rem);
  --blog-title-article: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  --blog-lead-size: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  --blog-title-mobile: 1.875rem;
  --blog-line-heading: 1.32;
  --blog-line-reading: 1.8;
  --blog-line-lead: 1.7;
  --blog-line-card: 1.5;
  --blog-crumb-link-opacity: 0.72;
  --blog-crumb-separator-opacity: 0.35;
}

.blog-skip {
  position: absolute;
  top: 0.75rem;
  left: var(--gutter);
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--panel);
  color: var(--accent-dark);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.blog-skip:not(:focus) {
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.blog-list-page {
  padding-top: 3rem;
  padding-bottom: 5rem;
}

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

.blog-eyebrow {
  margin: 0 0 1rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-13);
}

.blog-list-hero h1 {
  display: block;
  max-width: 100%;
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-title-list);
  font-weight: var(--weight-normal);
  line-height: var(--blog-line-heading);
}

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

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

.blog-filter {
  max-width: 100%;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-14);
  font-weight: var(--weight-normal);
  line-height: var(--line-body);
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.blog-filter:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

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

.blog-filter:focus-visible,
.blog-skip:focus-visible,
.post-card 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-result-status {
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: var(--fs-13);
  line-height: var(--line-body);
}

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

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

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

.post-card__meta,
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem 1rem;
  color: var(--muted);
  font-size: var(--fs-13);
  line-height: var(--line-body);
}

.post-card__meta time,
.article-meta time {
  font-family: var(--font-mono);
}

.post-card .tag,
.article-meta .tag {
  display: inline-block;
  max-width: 100%;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--panel-2);
  color: var(--text);
  font-size: var(--fs-13);
  white-space: normal;
  overflow-wrap: anywhere;
}

.post-card h2,
.post-card h3 {
  display: block;
  max-width: 100%;
  margin: 1.125rem 0 0;
  font-family: var(--font-display);
  font-size: var(--fs-20);
  font-weight: var(--weight-normal);
  line-height: var(--blog-line-card);
  overflow-wrap: break-word;
}

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

.post-card .post-card__summary {
  margin: 1rem 0 1.5rem;
  color: var(--muted);
  font-size: var(--fs-15);
  line-height: var(--blog-line-reading);
}

.post-card a.post-card__link {
  align-self: flex-start;
  margin-top: auto;
  padding-block: 0.375rem;
  color: var(--accent-dark);
  font-size: var(--fs-14);
  text-decoration: none;
}

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

.blog-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1.5rem;
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  line-height: var(--line-copy);
}

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

/* Reading-page spacing is independent of the landing-page section rhythm. */
.article-page,
.article-page.section {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.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: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: var(--fs-13);
  line-height: var(--line-body);
  white-space: nowrap;
}

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

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

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

:is(.blog-breadcrumb, nav.breadcrumb, nav.breadcrumbs) [aria-current="page"] {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 30ch;
  overflow: hidden;
  color: var(--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;
}

.article-hero,
.article-hero.section {
  padding-top: 0.5rem;
  padding-bottom: 0.75rem;
}

.article-page > nav {
  margin-bottom: 1.25rem;
}

.article-page > nav > p {
  margin: 0;
}

.article-hero .post-card__meta {
  margin-bottom: 0.875rem;
}

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

.article-hero h1 {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1rem 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-title-article);
  font-weight: var(--weight-normal);
  line-height: var(--blog-line-heading);
  overflow-wrap: break-word;
}

.article-lead,
.article-hero > p:last-child {
  max-width: 100%;
  margin: 1rem 0 0;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: var(--blog-lead-size);
  line-height: var(--blog-line-lead);
}

.article-body,
.article-page .prose,
article.prose {
  min-width: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-16);
  line-height: var(--blog-line-reading);
  overflow-wrap: break-word;
}

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

:is(.article-body, .article-page .prose, article.prose) h2,
:is(.article-body, .article-page .prose, article.prose) h3 {
  display: block;
  max-width: 100%;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: var(--weight-normal);
  line-height: var(--blog-line-heading);
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

:is(.article-body, .article-page .prose, article.prose) h2 {
  margin: 2rem 0 1rem;
  font-size: var(--fs-24);
}

:is(.article-body, .article-page .prose, article.prose) h3 {
  margin: 1.5rem 0 0.75rem;
  font-size: var(--fs-20);
}

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

:is(.article-body, .article-page .prose, article.prose) section {
  margin: 0;
  padding: 0;
}

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

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

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

:is(.article-body, .article-page .prose, article.prose) ul,
:is(.article-body, .article-page .prose, article.prose) ol {
  padding-left: 1.5rem;
}

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

:is(.article-body, .prose) code {
  font-family: var(--font-mono);
  font-size: var(--fs-14);
  overflow-wrap: anywhere;
}

:is(.article-body, .prose) :not(pre) > code {
  padding: 0.125rem 0.3rem;
  border-radius: var(--r-xs);
  background: var(--panel-2);
  color: var(--text);
}

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

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

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

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

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

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

:is(.article-body, .prose) th,
:is(.article-body, .prose) 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, .prose) th {
  background: var(--panel-2);
  color: var(--text);
  font-weight: var(--weight-medium);
}

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

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

.article-download h2,
.prose .article-download h2 {
  display: block;
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: var(--fs-24);
  font-weight: var(--weight-normal);
  line-height: var(--blog-line-heading);
}

.article-download p,
.prose .article-download p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-15);
  line-height: var(--blog-line-lead);
}

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

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

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

#related-posts > h2 {
  display: block;
  margin: 0 0 1.25rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--fs-24);
  font-weight: var(--weight-normal);
  line-height: var(--blog-line-heading);
}

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

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

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

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

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

.post-nav__label {
  color: var(--muted);
  font-size: var(--fs-13);
  line-height: var(--line-body);
}

.post-nav__title {
  color: var(--text);
  font-size: var(--fs-16);
  line-height: var(--blog-line-lead);
  overflow-wrap: break-word;
}

@media (max-width: 767px) {
  .blog-list-page {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
  }

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

  .blog-list-hero h1 {
    font-size: min(var(--blog-title-list), var(--blog-title-mobile));
  }

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

  .blog-post-grid .post-card,
  #related-posts .post-card {
    padding: 1.25rem;
  }

  .article-hero h1 {
    font-size: var(--fs-24);
  }

  .article-page,
  .article-page.section {
    padding-top: 1.25rem;
  }

  .article-download {
    padding: 1.25rem;
  }

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

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

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