:root {
  --blog-font-small: 0.8125rem;
  --blog-font-label: 0.875rem;
  --blog-font-body: 1rem;
  --blog-font-card: 1.1875rem;
  --blog-font-h3: 1.25rem;
  --blog-font-h2: 1.5rem;
  --blog-font-list-title: clamp(1.75rem, 1.1rem + 2.4vw, 3rem);
  --blog-font-article-title: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  --blog-font-lead: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  --blog-focus-width: 2px;
  --blog-link-opacity: 0.68;
  --blog-separator-opacity: 0.35;
}

.blog-index,
.article-page main,
.blog-article-page main {
  min-width: 0;
}

.blog-index {
  padding-top: 1.5rem;
  padding-bottom: var(--space-section);
}

.blog-skip {
  position: absolute;
  z-index: 1000;
  top: 0.75rem;
  left: 1.125rem;
  transform: translateY(-200%);
  padding: 0.625rem 1rem;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--blog-font-label);
  text-decoration: none;
}

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

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

.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-dark);
  opacity: 1;
}

.blog-breadcrumb .breadcrumb-separator,
nav.breadcrumb .breadcrumb-separator,
nav.breadcrumbs .breadcrumb-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-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;
}

.blog-list-hero {
  padding-block: 1.25rem 2.5rem;
  border-bottom: 1px solid var(--border);
}

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

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

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

.blog-collection {
  padding-top: 2rem;
}

.blog-collection-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.125rem;
}

.blog-collection-heading h2,
#related-posts > h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-font-h2);
  font-weight: var(--weight-display);
  line-height: 1.5;
}

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

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

.blog-filter {
  min-height: 44px;
  padding: 0.5625rem 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-font-label);
  font-weight: var(--weight-display);
  line-height: 1.5;
  cursor: pointer;
}

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

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

.blog-filter: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(--blog-focus-width) solid var(--text);
  outline-offset: 3px;
}

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

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

.post-card:hover {
  border-color: var(--border-strong);
  box-shadow: none;
  transform: none;
}

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

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

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

.post-meta .badge,
.article-meta .badge {
  max-width: 100%;
  padding: 0.1875rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-font-small);
  font-weight: var(--weight-display);
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}

.post-card h3 {
  max-width: 100%;
  margin: 0 0 0.875rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-font-card);
  font-weight: var(--weight-display);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

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

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

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

.post-card .post-link {
  align-self: flex-start;
  margin-top: auto;
  padding-block: 0.375rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--blog-font-label);
  line-height: 1.6;
  text-decoration: none;
}

.post-card .post-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.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-family: var(--font-body);
  font-size: var(--blog-font-body);
  line-height: 1.8;
}

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

.article-page main.section,
.blog-article-page main.section,
.article-page main > .section:first-child,
.blog-article-page main > .section:first-child,
.article-page main .section:has(> .blog-breadcrumb),
.article-page main .section:has(> nav.breadcrumb),
.article-page main .section:has(> nav.breadcrumbs),
.blog-article-page main .section:has(> .blog-breadcrumb),
.blog-article-page main .section:has(> nav.breadcrumb),
.blog-article-page main .section:has(> nav.breadcrumbs),
main.section:has(.article-hero) {
  padding-top: 1.25rem;
}

.section:has(> .blog-breadcrumb),
.section:has(> nav.breadcrumb),
.section:has(> nav.breadcrumbs) {
  padding-block: 1.25rem 0;
}

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

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

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

.article-hero .article-lead,
.article-hero .lead,
.article-hero h1 + p {
  max-width: 100%;
  margin: 0.9rem 0 0;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-font-lead);
  line-height: 1.7;
}

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

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

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

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

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

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

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

.article-body p,
.prose p,
.article-body ul,
.article-body ol,
.prose ul,
.prose ol {
  margin: 0 0 1rem;
}

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

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

.article-body strong,
.prose strong {
  color: var(--text);
  font-weight: var(--weight-medium);
}

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

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

.article-body code,
.prose code {
  border-radius: var(--radius-xs);
  background: var(--bg-panel-2);
  color: var(--text);
  padding: 0.1em 0.3em;
  font-family: var(--font-mono);
  font-size: var(--blog-font-label);
  white-space: normal;
  overflow-wrap: anywhere;
}

.article-body pre,
.prose pre {
  max-width: 100%;
  margin: 1.25rem 0;
  padding: 1.125rem;
  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-font-label);
  line-height: 1.8;
  tab-size: 2;
}

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

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

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

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

.article-body table,
.prose table {
  width: 100%;
  margin: 1.25rem 0;
  border-collapse: collapse;
  color: var(--text);
  font-size: var(--blog-font-label);
  line-height: 1.7;
}

.article-body > table,
.prose > table,
.article-body section > table,
.prose section > table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.article-body .table-wrap table,
.prose .table-wrap table {
  margin: 0;
}

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

.article-body th,
.prose th {
  background: var(--bg-panel);
  font-weight: var(--weight-medium);
}

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

.article-body hr,
.prose hr {
  margin: 1.75rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

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

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

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

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

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

#related-posts {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

#related-posts > h2 {
  margin-bottom: 1.25rem;
}

#related-posts .related-post-grid {
  grid-template-columns: repeat(2, minmax(300px, 1fr));
}

#related-posts .post-card h3 {
  margin-top: 0;
  font-size: var(--blog-font-card);
}

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

#post-nav .post-nav-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.625rem;
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  text-decoration: none;
  overflow-wrap: anywhere;
}

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

.post-nav-label,
.post-nav-date {
  color: var(--text-muted);
  font-size: var(--blog-font-small);
  line-height: 1.6;
}

.post-nav-date {
  margin-top: auto;
  font-family: var(--font-mono);
}

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

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

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

@media (max-width: 820px) {
  #related-posts .related-post-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  }
}

@media (max-width: 640px) {
  :root {
    --blog-font-list-title: 1.875rem;
    --blog-font-article-title: 1.5rem;
  }

  .blog-index {
    padding-top: 0.5rem;
  }

  .blog-index.wrap,
  .article-page .wrap,
  .blog-article-page .wrap {
    padding-left: 18px;
    padding-right: 18px;
  }

  .blog-list-hero {
    padding-block: 0.75rem 1.75rem;
  }

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

  .post-card {
    padding: 1.25rem;
  }

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

  .article-download {
    padding: 1.25rem;
  }

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

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