:root {
  --blog-title-size: clamp(1.875rem, 3.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-body-size: 1rem;
  --blog-meta-size: 0.8125rem;
  --blog-card-title-size: 1.25rem;
  --blog-h2-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  --blog-h3-size: clamp(1.125rem, 1rem + 0.35vw, 1.25rem);
  --blog-code-size: 0.875em;
  --blog-card-gap: 1.25rem;
  --blog-crumb-link-opacity: 0.68;
  --blog-crumb-divider-opacity: 0.35;
}

.blog-main,
.article-main {
  min-width: 0;
  padding-bottom: 4rem;
}

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

.blog-hero .eyebrow {
  margin: 0 0 1rem;
}

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

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

.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--c-border);
}

.blog-filters button {
  position: relative;
  min-height: 44px;
  padding: 0.5rem 0.125rem 0.75rem;
  border: 0;
  border-radius: var(--r-key);
  background: var(--c-clear);
  color: var(--c-text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-body-size);
  font-weight: var(--weight-normal);
  line-height: 1.6;
  cursor: pointer;
}

.blog-filters button::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: var(--r-bar);
  background: var(--c-clear);
  content: "";
}

.blog-filters button[aria-pressed="true"] {
  color: var(--c-text);
  font-weight: var(--weight-strong);
}

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

.blog-filters button:hover {
  color: var(--c-accent);
}

.blog-result {
  min-height: 1.5em;
  margin: 1.25rem 0;
  color: var(--c-text-muted);
  font-size: var(--blog-meta-size);
  line-height: 1.6;
}

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

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

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

.post-meta time,
.article-meta time {
  font-variant-numeric: tabular-nums;
}

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

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

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

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

.post-card .post-read {
  align-self: flex-start;
  margin-top: auto;
  padding-block: 0.5rem;
  color: var(--c-accent);
  font-size: var(--blog-body-size);
  line-height: 1.5;
  text-underline-offset: 0.2em;
}

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

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

.blog-breadcrumb a,
nav.breadcrumb a,
nav.breadcrumbs a {
  flex: 0 0 auto;
  color: var(--c-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(--c-accent);
  opacity: 1;
}

.blog-breadcrumb [aria-hidden="true"],
nav.breadcrumb [aria-hidden="true"],
nav.breadcrumbs [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;
}

main.reading:has(> article) {
  padding-top: 1.5rem;
}

.article-page .article-main,
.article-page main.section,
.article-main.section,
.article-page .section:has(.blog-breadcrumb, nav.breadcrumb, nav.breadcrumbs) {
  padding-top: 0.25rem;
}

.article-page .section:has(.blog-breadcrumb, nav.breadcrumb, nav.breadcrumbs) {
  padding-bottom: 0;
}

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

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

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

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

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

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

.article-body h2,
.article-body h3 {
  display: block;
  max-width: 100%;
  color: var(--c-text);
  font-family: var(--font-display);
  font-weight: var(--weight-title);
  overflow-wrap: anywhere;
}

.article-body h2 {
  margin: 2rem 0 1rem;
  font-size: var(--blog-h2-size);
  line-height: 1.5;
}

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

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

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

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

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

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

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

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

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

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

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

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

.article-body pre {
  max-width: 100%;
  padding: 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--r-card-small);
  background: var(--c-panel);
  color: var(--c-text);
  font-family: var(--font-mono);
  line-height: 1.75;
  tab-size: 2;
}

.article-body pre code {
  padding: 0;
  background: var(--c-clear);
  white-space: pre;
  overflow-wrap: normal;
}

.article-body blockquote {
  padding: 0.5rem 1.25rem;
  border-inline-start: 2px solid var(--c-accent);
  border-radius: var(--r-item);
  background: var(--c-panel);
  color: var(--c-text-muted);
}

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

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

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

.article-body table,
.article-page .prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  color: var(--c-text);
  font-size: var(--blog-body-size);
  line-height: 1.75;
}

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

.article-body th,
.article-page .prose th {
  background: var(--c-panel);
  font-weight: var(--weight-strong);
}

.article-body img,
.article-body video {
  display: block;
  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: 1px solid var(--c-border);
  border-radius: var(--r-card);
  background: var(--c-panel);
  box-shadow: var(--shadow-xs);
}

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

.article-download h3,
.article-body .article-download h3 {
  margin: 0;
  font-size: var(--blog-h3-size);
  line-height: 1.5;
}

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

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

#related-posts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, max(300px, calc((100% - var(--blog-card-gap)) / 2))), 1fr));
  gap: var(--blog-card-gap);
  min-width: 0;
  margin-top: 2.5rem;
}

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

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

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

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

.post-nav-label {
  color: var(--c-text-muted);
  font-size: var(--blog-meta-size);
  line-height: 1.7;
}

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

#post-nav a:hover .post-nav-title {
  color: var(--c-accent);
}

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

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

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

.blog-filters button:focus-visible,
.blog-skip:focus-visible,
.post-card a:focus-visible,
#post-nav a:focus-visible,
.blog-breadcrumb a:focus-visible,
nav.breadcrumb a:focus-visible,
nav.breadcrumbs a:focus-visible,
.article-body a:focus-visible,
.article-body .table-scroll:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 4px;
}

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

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

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

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

  #post-nav .post-nav-next {
    grid-column: auto;
  }

  .blog-filters {
    column-gap: 1.125rem;
  }

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

  .article-download .button-row {
    width: 100%;
  }

  .article-download .button-row .btn {
    flex: 1 1 auto;
  }

  .article-body pre {
    padding: 1rem;
  }

  .blog-main,
  .article-main {
    padding-bottom: 3rem;
  }
}