:root {
  --blog-reading-width: 820px;
  --blog-list-title-size: clamp(1.75rem, 1.2rem + 2vw, 3rem);
  --blog-article-title-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  --blog-lead-size: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  --blog-h2-size: clamp(1.25rem, 1rem + 0.6vw, 1.5rem);
  --blog-h3-size: clamp(1.125rem, 1rem + 0.3vw, 1.25rem);
  --blog-card-title-size: 1.25rem;
  --blog-body-size: 1rem;
  --blog-meta-size: 0.8125rem;
  --blog-code-size: 0.875rem;
  --blog-title-weight: 400;
  --blog-body-weight: 400;
  --blog-label-weight: 500;
  --blog-title-tracking: -0.035em;
  --blog-crumb-link-opacity: 0.65;
  --blog-crumb-separator-opacity: 0.35;
}

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

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

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

.blog-list-main {
  padding-bottom: 4rem;
}

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

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

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

.blog-breadcrumb .breadcrumb-separator,
.blog-breadcrumb .separator,
nav.breadcrumb .breadcrumb-separator,
nav.breadcrumb .separator,
nav.breadcrumbs .breadcrumb-separator,
nav.breadcrumbs .separator,
.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);
  opacity: var(--blog-crumb-separator-opacity);
}

.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 > main.section,
main.article-page.section,
.blog-article.section,
.article-shell.section,
.section:has(> .blog-breadcrumb),
.section:has(> nav.breadcrumb),
.section:has(> nav.breadcrumbs) {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

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

main.wrap:has(> article.prose) {
  padding-top: 24px;
}

main.wrap:has(> article.prose) > nav:first-child {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: var(--blog-meta-size);
  line-height: 1.6;
}

main.wrap > article.prose > header > .post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: var(--blog-meta-size);
  line-height: 1.6;
}

main.wrap > article.prose > header > h1 {
  margin-bottom: 12px;
}

main.wrap > article.prose > header > h1 + p {
  margin-top: 12px;
}

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

.blog-eyebrow {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--blog-meta-size);
  line-height: 1.7;
}

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

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

.blog-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-block: 1rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

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

.blog-filter {
  min-height: 44px;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-code-size);
  font-weight: var(--blog-body-weight);
  line-height: 1.5;
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast);
}

.blog-filter:hover {
  background: var(--bg-panel);
  color: var(--text);
}

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

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

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

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

.blog-post-card,
.related-post-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--text);
}

.blog-post-card .post-meta,
.related-post-card .post-meta,
.article-meta,
.post-hero-meta,
.article-hero .post-meta,
.article-header .post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-meta-size);
  line-height: 1.6;
}

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

.blog-post-card .tag,
.related-post-card .tag,
.article-meta .tag,
.article-hero .tag,
.article-header .tag {
  max-width: 100%;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-meta-size);
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}

.blog-post-card h2,
.related-post-card h3 {
  max-width: 100%;
  margin: 0 0 0.875rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-card-title-size);
  font-weight: var(--blog-title-weight);
  line-height: 1.55;
  letter-spacing: var(--blog-title-tracking);
  overflow-wrap: anywhere;
}

.blog-post-card h2 a,
.related-post-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.blog-post-card h2 a:hover,
.related-post-card h3 a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.blog-post-summary {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: var(--blog-body-size);
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.blog-read-link {
  align-self: flex-start;
  margin-top: auto;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: var(--blog-code-size);
  line-height: 1.7;
  text-underline-offset: 0.2em;
}

.blog-read-link:hover {
  color: var(--accent-dark);
}

.blog-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: var(--blog-body-size);
  line-height: 1.8;
}

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

.article-shell,
article.blog-article {
  width: 100%;
  max-width: var(--blog-reading-width);
  margin-inline: auto;
}

.article-hero,
.article-header {
  padding-block: 0.5rem 1.75rem;
}

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

.article-hero h1,
.article-header h1,
.blog-article h1,
.article-page h1,
.article-shell h1,
.prose h1 {
  max-width: 100%;
  margin: 0 0 1rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-article-title-size);
  font-weight: var(--blog-title-weight);
  line-height: 1.32;
  letter-spacing: var(--blog-title-tracking);
  overflow-wrap: anywhere;
}

.article-lead,
.article-summary,
.article-hero .lead,
.article-header .lead,
.article-hero > p:last-child,
.article-header > p:last-child {
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-lead-size);
  font-weight: var(--blog-body-weight);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

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

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

.article-body h2,
.article-content h2,
.prose h2 {
  max-width: 100%;
  margin: 2rem 0 1rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-h2-size);
  font-weight: var(--blog-title-weight);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

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

.article-body h2 ~ h2,
.article-content h2 ~ h2,
.prose h2 ~ h2 {
  margin-top: 2rem;
}

.article-body h3,
.article-content h3,
.prose h3 {
  max-width: 100%;
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-h3-size);
  font-weight: var(--blog-title-weight);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

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

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

.article-body p,
.article-content p,
.prose p {
  margin-block: 0 1.125rem;
}

.article-body ul,
.article-body ol,
.article-content ul,
.article-content ol,
.prose ul,
.prose ol {
  margin-block: 0 1.25rem;
  padding-inline-start: 1.5rem;
}

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

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

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

.article-body code,
.article-content code,
.prose code {
  padding: 0.12em 0.3em;
  border-radius: var(--radius-notice);
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--blog-code-size);
  overflow-wrap: anywhere;
}

.article-body pre,
.article-content pre,
.prose pre {
  max-width: 100%;
  margin-block: 1.25rem;
  padding: 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--blog-code-size);
  line-height: 1.75;
  tab-size: 2;
}

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

.article-body blockquote,
.article-content blockquote,
.prose blockquote {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  border-inline-start: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text-muted);
}

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

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

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

.article-body table,
.article-content table,
.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(--blog-code-size);
  line-height: 1.7;
}

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

.article-body th,
.article-content th,
.prose th {
  background: var(--bg-panel);
  color: var(--text);
  font-weight: var(--blog-label-weight);
}

.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(--radius-lg);
  background: var(--bg-panel);
  color: var(--text);
}

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

.article-download h2 {
  margin: 0 0 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-h2-size);
  font-weight: var(--blog-title-weight);
  line-height: 1.5;
}

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

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

#related-posts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: var(--blog-reading-width);
  margin: 2rem auto 0;
  padding: 0;
}

#related-posts .related-heading {
  grid-column: 1 / -1;
  margin: 0 0 0.25rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-h2-size);
  font-weight: var(--blog-title-weight);
  line-height: 1.5;
}

#post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: var(--blog-reading-width);
  margin: 2rem auto;
  padding: 0;
}

.post-nav-card {
  display: block;
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  transition: background var(--motion-fast);
}

.post-nav-card:hover {
  background: var(--bg-panel);
  color: var(--text);
}

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

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

.post-nav-label {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-meta-size);
  line-height: 1.6;
}

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

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

.blog-index :focus-visible,
.blog-article :focus-visible,
.article-page :focus-visible,
.article-shell :focus-visible,
#related-posts :focus-visible,
#post-nav :focus-visible {
  outline: var(--focus-width) solid var(--text);
  outline-offset: 4px;
}

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

@media (max-width: 680px) {
  :root {
    --blog-list-title-size: clamp(1.75rem, 5vw, 1.875rem);
    --blog-article-title-size: 1.5rem;
  }

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

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

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

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

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

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

  .blog-list-main {
    padding-bottom: 2.5rem;
  }
}

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