:root {
  --blog-list-title: clamp(2rem, 1.3rem + 2vw, 3rem);
  --blog-article-title: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  --blog-lead-size: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  --blog-body-size: 1rem;
  --blog-small-size: 0.8125rem;
  --blog-card-title: 1.25rem;
  --blog-h2-size: 1.5rem;
  --blog-h3-size: 1.25rem;
  --blog-weight-regular: 400;
  --blog-weight-medium: 500;
  --blog-weight-bold: 700;
  --blog-weight-display: 800;
  --blog-link-opacity: 0.65;
  --blog-separator-opacity: 0.35;
}

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

.blog-hero {
  padding-block: 2rem 2.5rem;
  max-width: var(--reading-width);
}

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

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

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

.blog-library {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.blog-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 2rem;
}

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

.blog-filter {
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-body-size);
  font-weight: var(--blog-weight-medium);
  line-height: 1.4;
  cursor: pointer;
  transition: border-color var(--ease), color var(--ease), background var(--ease);
}

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

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

.blog-filter:focus-visible,
.blog-skip:focus-visible,
.article-card a:focus-visible,
.post-nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.blog-count {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--blog-small-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-grid > * {
  min-width: 0;
}

.blog-post-grid .article-card,
#related-posts .article-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-1);
  transition: border-color var(--ease), box-shadow var(--ease);
}

.blog-post-grid .article-card:hover,
#related-posts .article-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-1-hover);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem 1rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-small-size);
  line-height: 1.6;
}

.article-meta time {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--blog-small-size);
}

.blog-post-grid .article-card h2,
#related-posts .article-card h3 {
  display: block;
  max-width: 100%;
  margin: 1rem 0 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-card-title);
  font-weight: var(--blog-weight-bold);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

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

.blog-post-grid .article-card h2 a:hover,
#related-posts .article-card h3 a:hover {
  color: var(--accent);
}

.blog-post-grid .article-card > p,
#related-posts .article-card > p {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-body-size);
  line-height: 1.8;
}

.blog-post-grid .article-more,
#related-posts .article-more {
  align-self: flex-start;
  margin-top: auto;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: var(--blog-body-size);
  font-weight: var(--blog-weight-medium);
  line-height: 1.6;
  text-decoration: none;
}

.blog-post-grid .article-more:hover,
#related-posts .article-more:hover {
  color: var(--accent-dark);
  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-lg);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-family: var(--font-body);
  line-height: 1.8;
}

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

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

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

.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: var(--blog-small-size);
  line-height: 1.6;
  white-space: nowrap;
}

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

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

.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: var(--blog-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;
}

.has-dl-fab main.section,
.article-page main.section,
.blog-article main.section,
.has-dl-fab main > .section:first-child,
.article-page main > .section:first-child,
.blog-article main > .section:first-child {
  padding-top: 1.5rem;
}

.has-dl-fab .section:has(> .blog-breadcrumb),
.has-dl-fab .section:has(> nav.breadcrumb),
.has-dl-fab .section:has(> nav.breadcrumbs),
.article-page .section:has(> .blog-breadcrumb),
.article-page .section:has(> nav.breadcrumb),
.article-page .section:has(> nav.breadcrumbs) {
  padding-block: 1.5rem 0;
}

.has-dl-fab main.wrap {
  padding-top: 2rem;
}

.has-dl-fab main > .reading > nav {
  margin: 0 0 1.25rem;
}

.has-dl-fab main > .reading > nav > p {
  margin: 0;
}

.has-dl-fab main article > header {
  padding-block: 0 1.75rem;
}

.has-dl-fab main article > header .article-meta {
  margin: 0 0 0.875rem;
}

.has-dl-fab main article > header h1 {
  margin: 0 0 0.75rem;
  font-size: var(--blog-article-title);
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.has-dl-fab main article > header > p {
  margin: 0;
}

.article-hero,
.article-header {
  padding-block: 0.5rem 1.75rem;
  color: var(--text);
}

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

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

.article-hero .article-lead,
.article-header .article-lead,
.article-hero .article-summary,
.article-header .article-summary,
.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-weight-regular);
  line-height: 1.7;
}

.article-body {
  min-width: 0;
  max-width: 100%;
  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 {
  margin-top: 0;
}

.article-body h2,
.has-dl-fab .prose h2,
.article-page .prose h2,
.blog-article .prose h2 {
  display: block;
  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-weight-bold);
  line-height: 1.5;
}

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

.article-body h3,
.has-dl-fab .prose h3,
.article-page .prose h3,
.blog-article .prose h3 {
  display: block;
  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-weight-bold);
  line-height: 1.5;
}

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

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

.article-body section + section > h2:first-child,
.has-dl-fab .prose section + section > h2:first-child,
.article-page .prose section + section > h2:first-child,
.blog-article .prose section + section > h2:first-child {
  margin-top: 0;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body pre,
.article-body blockquote,
.article-body figure {
  margin-block: 0 1.25rem;
}

.article-body ul,
.article-body ol {
  padding-inline-start: 1.5rem;
}

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

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

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

.article-body code {
  padding: 0.125em 0.35em;
  border-radius: var(--r-tiny);
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.article-body pre {
  max-width: 100%;
  padding: 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-panel);
  color: var(--text);
  line-height: 1.7;
  white-space: pre;
}

.article-body pre code {
  padding: 0;
  border-radius: 0;
  background: var(--clear);
  color: var(--text);
  overflow-wrap: normal;
  word-break: normal;
}

.article-body blockquote {
  padding: 1rem 1.25rem;
  border-inline-start: 3px solid var(--border-strong);
  border-radius: var(--r-xs);
  background: var(--bg-panel);
  color: var(--text-muted);
}

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

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

.article-body img {
  height: auto;
}

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

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

.article-body th,
.article-body td,
.has-dl-fab .prose th,
.has-dl-fab .prose td {
  min-width: 7em;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  text-align: start;
  vertical-align: top;
}

.article-body th,
.has-dl-fab .prose th {
  background: var(--bg-panel);
  color: var(--text);
  font-weight: var(--blog-weight-bold);
}

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

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

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

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

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

#related-posts {
  min-width: 0;
  margin-block: 2rem;
  padding-block: 1.5rem 0;
  border-top: 1px solid var(--border);
}

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

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

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

#post-nav .post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}

#post-nav .post-nav-link:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-1);
}

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

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

.post-nav-label {
  color: var(--accent);
  font-family: var(--font-body);
  font-size: var(--blog-small-size);
  line-height: 1.6;
}

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

#post-nav time {
  margin-top: auto;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--blog-small-size);
  line-height: 1.6;
}

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

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

@media (max-width: 640px) {
  .blog-main {
    padding-top: 1.25rem;
    padding-bottom: 2.5rem;
  }

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

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

  .article-hero h1,
  .article-header h1,
  .article-body h1 {
    font-size: 1.5rem;
    line-height: 1.32;
  }

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

  .blog-filter-bar {
    align-items: flex-start;
    margin-bottom: 1.5rem;
  }

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

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

  .article-download {
    padding: 1.25rem;
  }

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

@media (prefers-reduced-motion: reduce) {
  .blog-filter,
  .blog-post-grid .article-card,
  #related-posts .article-card,
  #post-nav .post-nav-link {
    transition: none;
  }
}