:root {
  --blog-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-meta-size: 0.8125rem;
  --blog-body-size: 1rem;
  --blog-h2-size: clamp(1.25rem, 1.05rem + 0.6vw, 1.5rem);
  --blog-h3-size: 1.25rem;
  --blog-crumb-link-opacity: 0.65;
  --blog-crumb-divider-opacity: 0.35;
}

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

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

.blog-skip {
  position: absolute;
  z-index: 100;
  top: 0.75rem;
  left: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-body);
  opacity: 0;
  pointer-events: none;
}

.blog-skip:focus {
  opacity: 1;
  pointer-events: auto;
}

.blog-breadcrumb,
nav.breadcrumb,
nav.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  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);
  line-height: 1.7;
}

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

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

.blog-breadcrumb .breadcrumb-separator,
nav.breadcrumb .breadcrumb-separator,
nav.breadcrumbs .breadcrumb-separator,
.blog-breadcrumb > span[aria-hidden="true"],
nav.breadcrumb > span[aria-hidden="true"],
nav.breadcrumbs > span[aria-hidden="true"] {
  flex: 0 0 auto;
  opacity: var(--blog-crumb-divider-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;
}

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

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

.blog-eyebrow {
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: var(--blog-meta-size);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
}

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

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

.blog-library-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.25rem;
}

.blog-library-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--blog-h2-size);
  font-weight: var(--weight-display);
  line-height: 1.4;
}

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

.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-bottom: 1.75rem;
}

.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-meta-size);
  font-weight: var(--weight-semibold);
  line-height: 1.5;
  cursor: pointer;
  transition: border-color var(--motion-fast), background-color var(--motion-fast);
}

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

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

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

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

.blog-post-grid .post-card,
#related-posts .post-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-float);
}

.post-card .post-meta,
.article-meta,
.article-hero .post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem 0.875rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-meta-size);
  line-height: 1.7;
}

.post-card .post-meta {
  margin: 0;
}

.post-card .tag,
.article-hero .tag {
  display: inline-block;
  max-width: 100%;
  padding: 0.25rem 0.625rem;
  border-radius: var(--r-pill);
  background: var(--bg-panel);
  color: var(--accent-dark);
  font-size: var(--blog-meta-size);
  font-weight: var(--weight-semibold);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.post-card time {
  font-variant-numeric: tabular-nums;
}

.blog-post-grid .post-card h3,
#related-posts .post-card h3 {
  max-width: 100%;
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--blog-h3-size);
  font-weight: var(--weight-heavy);
  line-height: 1.55;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

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

.post-card h3 a:hover {
  color: var(--accent);
}

.blog-post-grid .post-card > p,
#related-posts .post-card > p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.post-card .post-read {
  margin-top: auto;
  padding-top: 0.25rem;
  color: var(--accent-dark);
  font-size: 0.9375rem;
  font-weight: var(--weight-semibold);
  line-height: 1.8;
  text-underline-offset: 0.2em;
}

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

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

.has-dl-fab main#main.wrap {
  --reading-width: 800px;
  max-width: calc(var(--reading-width) + var(--gutter) * 2);
  padding-top: 32px;
}

.has-dl-fab main#main > nav {
  margin-bottom: 20px;
}

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

.has-dl-fab main#main > article > header .post-meta {
  margin: 0 0 14px;
}

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

.has-dl-fab main#main > article > header > p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--blog-lead-size);
  line-height: 1.7;
}

.article-shell {
  width: 100%;
  max-width: calc(var(--reading-width) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.article-hero .article-meta,
.article-hero .post-meta {
  margin-top: 0;
  margin-bottom: 0.9rem;
}

.article-hero h1 {
  max-width: 100%;
  margin: 0.875rem 0 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-article-title-size);
  font-weight: var(--weight-display);
  line-height: 1.32;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.article-hero .article-lead,
.article-hero .article-summary,
.article-hero .lead,
.article-hero > p:not(.article-meta):not(.post-meta) {
  margin-top: 1rem;
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: var(--blog-lead-size);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

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

.article-body > :first-child {
  margin-top: 0;
}

.article-body h2 {
  margin: 2rem 0 0.875rem;
  font-family: var(--font-display);
  font-size: var(--blog-h2-size);
  font-weight: var(--weight-display);
  line-height: 1.5;
  scroll-margin-top: calc(var(--topbar-h) + 1rem);
}

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

.article-body h3 {
  margin: 1.5rem 0 0.75rem;
  font-family: var(--font-display);
  font-size: var(--blog-h3-size);
  font-weight: var(--weight-heavy);
  line-height: 1.5;
}

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

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

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

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

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

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

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

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

.article-body pre {
  max-width: 100%;
  padding: 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.8;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
}

.article-body pre code {
  padding: 0;
  border-radius: 0;
  background: var(--clear);
  color: inherit;
  font-size: inherit;
  white-space: inherit;
  overflow-wrap: normal;
}

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

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

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

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

.article-body table {
  display: block;
  max-width: 100%;
  margin-block: 1rem 1.25rem;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

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

.article-body th {
  background: var(--bg-panel);
  color: var(--text);
  font-weight: var(--weight-semibold);
}

.article-download {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 1.5rem;
  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 h2 {
  margin: 0 0 0.625rem;
  font-family: var(--font-display);
  font-size: var(--blog-h2-size);
  font-weight: var(--weight-display);
  line-height: 1.5;
}

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

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

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

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

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

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

.post-nav-card {
  display: block;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-panel);
  color: var(--text);
  text-decoration: none;
}

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

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

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

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

.blog-filter:focus-visible,
.blog-skip:focus-visible,
.blog-breadcrumb a:focus-visible,
nav.breadcrumb a:focus-visible,
nav.breadcrumbs a:focus-visible,
.post-card a:focus-visible,
.post-nav-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

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

@media (max-width: 767px) {
  .blog-hero h1 {
    font-size: clamp(1.5rem, 1.2rem + 1.5vw, 1.875rem);
  }

  .article-hero h1 {
    font-size: 1.5rem;
  }

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

@media (max-width: 680px) {
  .blog-post-grid,
  #related-posts,
  #post-nav {
    grid-template-columns: minmax(0, 1fr);
  }

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

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

  .article-download {
    padding: 1.25rem;
  }

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

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