:root {
  --blog-title-size: clamp(2rem, 1.25rem + 2.5vw, 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, 1.05rem + 0.6vw, 1.5rem);
  --blog-h3-size: 1.25rem;
  --blog-meta-size: 0.8125rem;
  --blog-body-size: 1rem;
  --blog-code-size: 0.875rem;
  --blog-card-title-size: 1.25rem;
  --blog-title-leading: 1.32;
  --blog-body-leading: 1.8;
  --blog-lead-leading: 1.7;
  --blog-card-leading: 1.5;
  --blog-breadcrumb-opacity: 0.68;
  --blog-separator-opacity: 0.35;
  --blog-scroll-offset: calc(var(--nav-h) + 1.5rem);
}

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

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

.has-dl-fab main.reading > nav:first-child > p {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  min-width: 0;
  margin: 0 0 1.25rem;
  padding-block: 0.25rem;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: var(--blog-meta-size);
  line-height: var(--blog-card-leading);
}

.has-dl-fab main.reading > nav:first-child a,
.has-dl-fab main.reading > nav:first-child [aria-hidden="true"] {
  flex: 0 0 auto;
}

.has-dl-fab main.reading > nav:first-child [aria-current="page"] {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 30ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.blog-kicker {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: var(--blog-meta-size);
  overflow-wrap: anywhere;
}

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

.blog-hero .lead {
  margin: 1.25rem 0 0;
  color: var(--text-muted);
  font-size: var(--text-lead);
  line-height: var(--blog-lead-leading);
}

.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem;
  width: fit-content;
  max-width: 100%;
  background: var(--bg-panel-2);
  border-radius: var(--radius-xl);
}

.blog-filters button {
  min-height: 44px;
  padding: 0.625rem 1rem;
  border: 1px solid var(--clear);
  border-radius: var(--radius-pill);
  background: var(--clear);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--blog-body-size);
  font-weight: var(--weight-medium);
  line-height: var(--blog-card-leading);
  cursor: pointer;
  transition: background var(--speed-fast) var(--ease), color var(--speed-fast) var(--ease);
}

.blog-filters button:hover {
  background: var(--bg);
  color: var(--accent-dark);
}

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

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

.blog-count {
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: var(--blog-meta-size);
}

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

.blog-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 2rem;
  color: var(--text-muted);
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
}

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

.post-card__meta,
.article-meta,
.article-hero__meta,
.article-header__meta,
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem 1rem;
  color: var(--text-muted);
  font-size: var(--blog-meta-size);
  line-height: var(--blog-card-leading);
}

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

.post-card__title {
  margin: 1rem 0 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-card-title-size);
  font-weight: var(--weight-strong);
  line-height: var(--blog-card-leading);
  overflow-wrap: anywhere;
}

.post-card__title a {
  color: var(--text);
  text-decoration: none;
}

.post-card__title a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

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

.post-card__read {
  align-self: flex-start;
  margin-top: auto;
}

.blog-breadcrumb,
nav.breadcrumb,
nav.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  min-width: 0;
  margin-top: 1.5rem;
  margin-bottom: 1.25rem;
  padding-block: 0.25rem;
  overflow: hidden;
  white-space: nowrap;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-meta-size);
  line-height: var(--blog-card-leading);
}

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

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

.blog-breadcrumb [aria-hidden="true"],
nav.breadcrumb [aria-hidden="true"],
nav.breadcrumbs [aria-hidden="true"],
.blog-breadcrumb .separator,
nav.breadcrumb .separator,
nav.breadcrumbs .separator {
  flex: 0 0 auto;
  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;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.has-dl-fab main.section,
.has-dl-fab main > .section:first-child,
.has-dl-fab .section:has(> .blog-breadcrumb),
.has-dl-fab .section:has(> nav.breadcrumb),
.has-dl-fab .section:has(> nav.breadcrumbs) {
  padding-top: 1.5rem;
  padding-bottom: 0;
}

.article-hero,
.article-header,
.has-dl-fab .article-hero.section,
.has-dl-fab .article-header.section {
  margin-block: 0;
  padding-block: 0.5rem 1.5rem;
}

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

.article-hero h1,
.article-header h1,
.has-dl-fab main h1 {
  display: block;
  max-width: 100%;
  margin: 0.875rem 0 1rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-article-title-size);
  font-weight: var(--weight-display);
  line-height: var(--blog-title-leading);
  letter-spacing: normal;
  overflow-wrap: break-word;
}

.article-lead,
.article-hero .lead,
.article-header .lead,
.article-hero__summary,
.article-header__summary {
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: var(--blog-lead-size);
  line-height: var(--blog-lead-leading);
}

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

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

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

.article-body h2,
.has-dl-fab .prose h2 {
  display: block;
  margin: 2rem 0 1rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-h2-size);
  font-weight: var(--weight-strong);
  line-height: var(--blog-title-leading);
  scroll-margin-top: var(--blog-scroll-offset);
}

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

.article-body h3,
.has-dl-fab .prose h3 {
  display: block;
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-h3-size);
  font-weight: var(--weight-strong);
  line-height: var(--blog-card-leading);
  scroll-margin-top: var(--blog-scroll-offset);
}

.article-body p,
.article-body ul,
.article-body ol,
.has-dl-fab .prose p,
.has-dl-fab .prose ul,
.has-dl-fab .prose ol {
  margin-block: 0 1.25rem;
}

.article-body li + li,
.has-dl-fab .prose li + li {
  margin-top: 0.375rem;
}

.article-body a:not([class*="btn"]):not([class*="button"]),
.has-dl-fab .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,
.has-dl-fab .prose a:not([class*="btn"]):not([class*="button"]):hover {
  color: var(--accent-dark);
}

.article-body code,
.has-dl-fab .prose code {
  font-family: var(--font-mono);
  font-size: var(--blog-code-size);
  overflow-wrap: anywhere;
}

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

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

.article-body pre code,
.has-dl-fab .prose pre code {
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
}

.article-body blockquote,
.has-dl-fab .prose blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--text-muted);
}

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

.article-body img,
.has-dl-fab .prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

.article-body .table-scroll,
.has-dl-fab .prose .table-scroll {
  max-width: 100%;
  margin-block: 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

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

.article-body .table-scroll table,
.has-dl-fab .prose .table-scroll table {
  display: table;
  width: 100%;
  margin: 0;
}

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

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

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

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

.article-download h2,
.article-body .article-download h2,
.has-dl-fab .prose .article-download h2 {
  margin: 0 0 0.75rem;
  font-size: var(--blog-h2-size);
}

.article-download p,
.article-body .article-download p,
.has-dl-fab .prose .article-download p {
  margin: 0;
  color: var(--text-muted);
}

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

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

#related-posts > h2 {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--blog-h2-size);
  font-weight: var(--weight-strong);
  line-height: var(--blog-title-leading);
}

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

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

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

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

.post-nav__label {
  color: var(--text-muted);
  font-size: var(--blog-meta-size);
}

.post-nav__title {
  color: var(--text);
  font-size: var(--blog-body-size);
  font-weight: var(--weight-strong);
  line-height: var(--blog-card-leading);
  overflow-wrap: anywhere;
}

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

@media (max-width: 680px) {
  .blog-hero {
    padding-block: 2rem 1.5rem;
  }

  .blog-hero h1 {
    font-size: var(--text-h1);
    max-width: 100%;
  }

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

  .post-card {
    padding: 1.25rem;
  }

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

  .article-download {
    padding: 1.25rem;
  }

  .article-download .actions {
    width: 100%;
  }
}

@media (max-width: 480px) {
  :root {
    --blog-mobile-title-size: 1.75rem;
    --blog-mobile-article-title-size: 1.5rem;
  }

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

  .article-hero h1,
  .article-header h1,
  .has-dl-fab main h1 {
    font-size: var(--blog-mobile-article-title-size);
  }
}

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