:root {
  --blog-size-small: 0.8125rem;
  --blog-size-body: 1rem;
  --blog-size-card: 1.25rem;
  --blog-size-h1: clamp(1.75rem, 1.1rem + 2.4vw, 3rem);
  --blog-size-article-h1: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  --blog-size-lead: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  --blog-size-h2: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  --blog-size-h3: clamp(1.125rem, 1rem + 0.3vw, 1.25rem);
  --blog-size-code: 0.875rem;
  --blog-rule: 1px solid var(--border);
}

.blog-index {
  padding-top: 2.5rem;
  padding-bottom: 4rem;
  min-width: 0;
}

.blog-index__hero {
  padding-block: 1.5rem 2.5rem;
  max-width: 100%;
}

.blog-eyebrow {
  margin: 0 0 1rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--blog-size-small);
  font-weight: var(--weight-normal);
  letter-spacing: 0.1em;
}

.blog-index__hero h1 {
  margin: 0;
  max-width: 100%;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-size-h1);
  font-weight: var(--weight-normal);
  line-height: 1.25;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.blog-index__lead {
  margin: 1.25rem 0;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: var(--blog-size-lead);
  line-height: 1.7;
}

.blog-reference {
  color: var(--accent-dark);
  font-size: var(--blog-size-body);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.blog-reference:hover {
  color: var(--text);
}

.blog-directory {
  min-width: 0;
  border-top: var(--blog-rule);
  padding-top: 1.75rem;
}

.blog-directory__title {
  margin: 0 0 1.25rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-size-h2);
  font-weight: var(--weight-normal);
}

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

.blog-filters button {
  min-height: 44px;
  max-width: 100%;
  padding: 0.6rem 1rem;
  border: var(--blog-rule);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: var(--blog-size-code);
  font-weight: var(--weight-normal);
  cursor: pointer;
}

.blog-filters button:hover,
.blog-filters button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--panel-2);
  color: var(--accent-dark);
}

.blog-filters button:focus-visible,
.post-card:focus-visible,
.post-nav__item:focus-visible,
.blog-reference: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: 1rem 0;
  min-height: 1.5em;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: var(--blog-size-small);
  line-height: 1.6;
}

.blog-posts {
  min-width: 0;
  border-top: var(--blog-rule);
}

.blog-posts .post-card {
  display: grid;
  grid-template-columns: minmax(140px, 0.65fr) minmax(0, 2fr) minmax(0, 1.5fr);
  align-items: start;
  column-gap: 2rem;
}

.post-card {
  display: block;
  min-width: 0;
  padding: 1.75rem 1rem;
  border-bottom: var(--blog-rule);
  background: var(--clear);
  color: var(--text);
  text-decoration: none;
}

.post-card:hover {
  background: var(--panel-2);
}

.post-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.75rem;
  min-width: 0;
  color: var(--muted);
  font-size: var(--blog-size-small);
  line-height: 1.6;
}

.post-card__meta time {
  font-family: var(--font-mono);
  white-space: nowrap;
}

.post-card .tag,
.article-meta .tag,
.article-hero__meta .tag,
.article-header__meta .tag {
  display: inline-block;
  max-width: 100%;
  padding: 0.2rem 0.55rem;
  border: var(--blog-rule);
  border-radius: var(--r-xs);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: var(--blog-size-small);
  font-weight: var(--weight-normal);
  line-height: 1.6;
  white-space: normal;
}

.post-card h3 {
  margin: 0;
  min-width: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-size-card);
  font-weight: var(--weight-normal);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.post-card p {
  margin: 0;
  min-width: 0;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: var(--blog-size-code);
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.post-card__link {
  display: block;
  margin-top: 1rem;
  color: var(--accent-dark);
  font-family: var(--font-body);
  font-size: var(--blog-size-code);
}

.blog-posts .post-card__link {
  grid-column: 2 / -1;
}

.blog-empty {
  margin: 0;
  padding-block: 1.5rem;
  color: var(--muted);
  font-size: var(--blog-size-body);
  line-height: 1.8;
}

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

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

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

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

.blog-breadcrumb > :not(a):not([aria-current="page"]),
nav.breadcrumb > :not(a):not([aria-current="page"]),
nav.breadcrumbs > :not(a):not([aria-current="page"]) {
  flex: 0 0 auto;
  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;
  color: var(--muted);
}

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

main.wrap:has(> article) {
  max-width: calc(var(--reading-width) + var(--gutter) * 2);
  padding-top: 2rem;
}

.article-page,
.article-shell,
.article-container {
  min-width: 0;
}

.article-hero,
.article-header,
.article-hero.section,
.article-header.section {
  min-width: 0;
  padding-top: 0.5rem;
  padding-bottom: 1.5rem;
}

.article-meta,
.article-hero__meta,
.article-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin: 0 0 1rem;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: var(--blog-size-small);
  line-height: 1.6;
}

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

main.wrap > article h1,
.article-page h1,
.article-hero h1,
.article-header h1,
.article-title {
  display: block;
  margin: 0.875rem 0 0.75rem;
  min-width: 0;
  max-width: 100%;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-size-article-h1);
  font-weight: var(--weight-normal);
  line-height: 1.32;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.article-lead,
.article-summary,
.article-hero__lead,
.article-header__lead {
  margin: 1rem 0 0;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: var(--blog-size-lead);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

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

.article-body > :first-child,
.prose > :first-child,
.article-body > section:first-child > :first-child,
.prose > section:first-child > :first-child {
  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: 2rem;
}

.article-body h2,
.prose h2 {
  display: block;
  margin: 2rem 0 1rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-size-h2);
  font-weight: var(--weight-normal);
  line-height: 1.5;
}

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

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

.article-body p,
.prose p,
.article-body ul,
.prose ul,
.article-body ol,
.prose ol {
  margin: 0 0 1rem;
}

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

.article-body li,
.prose li {
  margin-block: 0.4rem;
}

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

.article-body a:not([class*="btn"]):not([class*="button"]):hover,
.prose a:not([class*="btn"]):not([class*="button"]):hover {
  color: var(--text);
}

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

.article-body :not(pre) > code,
.prose :not(pre) > code {
  padding: 0.1em 0.3em;
  border-radius: var(--r-xs);
  background: var(--panel-2);
  color: var(--accent-dark);
  overflow-wrap: anywhere;
  white-space: normal;
}

.article-body pre,
.prose pre {
  max-width: 100%;
  margin: 1.25rem 0;
  padding: 1rem;
  overflow-x: auto;
  border: var(--blog-rule);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--blog-size-code);
  line-height: 1.75;
  white-space: pre;
  overflow-wrap: normal;
  tab-size: 2;
}

.article-body pre code,
.prose pre code {
  white-space: inherit;
  overflow-wrap: normal;
}

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

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

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

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

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

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

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

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

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

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

.article-download__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

#related-posts {
  min-width: 0;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: var(--blog-rule);
}

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

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

#related-posts .post-card {
  min-width: 0;
  padding: 1.25rem;
  border: var(--blog-rule);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}

#related-posts .post-card:hover {
  background: var(--panel-2);
}

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

#related-posts .post-card p {
  margin: 0;
}

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

.post-nav__item {
  display: block;
  min-width: 0;
  padding: 1.25rem;
  border: var(--blog-rule);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}

.post-nav__item:hover {
  background: var(--panel-2);
}

.post-nav__item--previous {
  grid-column: 1;
}

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

.post-nav__label,
.post-nav__date {
  display: block;
  color: var(--muted);
  font-size: var(--blog-size-small);
  line-height: 1.6;
}

.post-nav__title {
  display: block;
  margin-block: 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-size-body);
  font-weight: var(--weight-normal);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.post-nav__date {
  font-family: var(--font-mono);
}

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

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

  .blog-index__hero {
    padding-block: 0.75rem 2rem;
  }

  .blog-index__hero h1 {
    font-size: min(var(--blog-size-h1), 1.875rem);
  }

  .blog-posts .post-card {
    display: block;
    padding: 1.5rem 0.75rem;
  }

  .blog-posts .post-card h3 {
    margin: 1rem 0 0.75rem;
  }

  .article-page h1,
  .article-hero h1,
  .article-header h1,
  .article-title {
    font-size: 1.5rem;
  }

  .article-download {
    padding: 1.25rem;
  }

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

  .post-nav__item--previous,
  .post-nav__item--next {
    grid-column: 1;
  }
}

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