:root {
  --blog-list-title-size: clamp(1.75rem, 1.2rem + 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, 1rem + 0.7vw, 1.5rem);
  --blog-h3-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  --blog-card-title-size: 1.25rem;
  --blog-body-size: 1rem;
  --blog-small-size: 0.875rem;
  --blog-meta-size: 13px;
  --blog-code-size: 0.875em;
  --blog-reading-line: 1.85;
  --blog-related-width: 820px;
}

.blog-index,
.article-page,
.blog-article {
  min-width: 0;
  color: var(--text);
  font-family: var(--font-body);
}

.blog-skip {
  position: absolute;
  z-index: 100;
  top: 0.75rem;
  left: var(--gutter);
  padding: 0.65rem 1rem;
  transform: translateY(-200%);
  background: var(--bg);
  color: var(--accent-dark);
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
}

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

.blog-list-hero {
  padding-block: 3rem;
  background: var(--bg-panel);
  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-small-size);
}

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

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

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

.blog-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

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

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

.blog-filters button {
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--r-chip);
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-small-size);
  font-weight: var(--weight-medium);
  line-height: 1.5;
  cursor: pointer;
}

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

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

.blog-filters button:focus-visible,
.blog-index a:focus-visible,
.blog-breadcrumb a:focus-visible,
nav.breadcrumb a:focus-visible,
nav.breadcrumbs a:focus-visible,
#related-posts a:focus-visible,
#post-nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.blog-list-status {
  min-height: 1.5em;
  margin: 1rem 0 1.5rem;
  color: var(--text-muted);
  font-size: var(--blog-small-size);
  line-height: 1.5;
}

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

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

.blog-post-grid .post-card:nth-child(even) {
  background: var(--bg-panel);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  color: var(--text-muted);
  font-size: var(--blog-meta-size);
  line-height: 1.6;
}

.post-meta time,
.post-nav-date {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.post-tag {
  max-width: 100%;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-chip);
  background: var(--bg-panel-2);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-meta-size);
  font-weight: var(--weight-normal);
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}

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

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

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

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

.post-card .read-link {
  align-self: flex-start;
  margin-top: auto;
  padding-block: 0.35rem;
  color: var(--accent-dark);
  font-size: var(--blog-small-size);
  text-decoration: none;
  text-underline-offset: 0.2em;
}

.post-card .read-link:hover {
  text-decoration: underline;
}

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

.blog-noscript {
  margin-top: 1rem;
}

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

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

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;
  color: var(--text-muted);
  font-size: var(--blog-meta-size);
  line-height: 1.6;
  white-space: nowrap;
}

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

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-breadcrumb,
nav.breadcrumb,
nav.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  padding: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--blog-meta-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);
  text-decoration: none;
}

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

.blog-breadcrumb [aria-hidden="true"],
nav.breadcrumb [aria-hidden="true"],
nav.breadcrumbs [aria-hidden="true"] {
  flex: 0 0 auto;
  color: var(--text);
  opacity: 0.35;
}

.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;
}

main.reading.section,
.article-page.section,
.blog-article.section,
.article-page > .section,
.blog-article > .section,
.section:has(> .blog-breadcrumb),
.section:has(> nav.breadcrumb),
.section:has(> nav.breadcrumbs) {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.article-page .blog-breadcrumb,
.article-page nav.breadcrumb,
.article-page nav.breadcrumbs,
.blog-article .blog-breadcrumb,
.blog-article nav.breadcrumb,
.blog-article nav.breadcrumbs,
main.reading > .blog-breadcrumb,
main.reading > nav.breadcrumb,
main.reading > nav.breadcrumbs {
  margin-top: 1.25rem;
}

.article-hero,
.post-header {
  min-width: 0;
  margin: 0 0 1.75rem;
  padding-block: 0.5rem 0;
}

.article-hero.section,
.post-header.section {
  padding-block: 0.5rem 0;
}

.article-hero .post-meta,
.article-hero .article-meta,
.post-header .post-meta,
.post-header .article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: var(--blog-meta-size);
  line-height: 1.6;
}

.article-hero h1,
.post-header h1,
.article-page h1,
.blog-article h1,
main.reading h1 {
  display: block;
  max-width: 100%;
  margin-block: 0.875rem 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-article-title-size);
  font-weight: var(--weight-normal);
  line-height: 1.32;
  overflow-wrap: anywhere;
}

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

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

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

.prose p,
.article-body p,
.article-content p {
  margin-block: 0 1.1rem;
}

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

.prose h2 .keep,
.article-body h2 .keep,
.article-content h2 .keep {
  white-space: normal;
}

.prose h3,
.article-body h3,
.article-content 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(--weight-medium);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

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

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

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

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

.prose ul,
.prose ol {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
}

.prose li + li {
  margin-top: 0.4rem;
}

.prose a:not([class*="btn"]):not([class*="button"]) {
  color: var(--accent-dark);
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}

.prose a:not([class*="btn"]):not([class*="button"]):hover {
  text-decoration-thickness: 2px;
}

.prose code {
  padding: 0.12em 0.3em;
  border-radius: var(--r-mini);
  background: var(--bg-panel-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--blog-code-size);
  white-space: normal;
  overflow-wrap: anywhere;
}

.prose pre {
  max-width: 100%;
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  background: var(--bg-panel);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--blog-small-size);
  line-height: 1.75;
  tab-size: 2;
  overscroll-behavior-inline: contain;
}

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

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

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

.prose .callout {
  margin-block: 1.25rem;
}

.prose .table-scroll {
  max-width: 100%;
  margin-block: 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  overscroll-behavior-inline: contain;
}

.prose table {
  display: block;
  max-width: 100%;
  margin-block: 1.25rem;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--blog-small-size);
  line-height: 1.7;
  overscroll-behavior-inline: contain;
}

.prose .table-scroll table {
  display: table;
  width: 100%;
  max-width: none;
  margin: 0;
}

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

.prose th {
  background: var(--bg-panel-2);
  color: var(--text);
  font-weight: var(--weight-medium);
}

.prose td {
  background: var(--bg);
  color: var(--text);
}

.prose tbody tr:last-child td {
  border-bottom: 0;
}

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

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

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

.article-download h2,
.article-download h3,
.prose .article-download h2,
.prose .article-download h3 {
  display: block;
  margin: 0 0 0.5rem;
  font-size: var(--blog-h3-size);
  line-height: 1.5;
}

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

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

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

#related-posts > h2,
#related-posts .related-heading {
  display: block;
  grid-column: 1 / -1;
  margin: 0 0 0.25rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--blog-h2-size);
  font-weight: var(--weight-normal);
  line-height: 1.45;
}

#related-posts .post-card {
  margin: 0;
}

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

#related-posts .post-summary {
  margin-block: 0.9rem 1.25rem;
}

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

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

.post-nav-card:hover {
  border-color: var(--accent-40);
  background: var(--bg-panel-2);
}

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

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

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

.post-nav-date {
  margin-top: auto;
  color: var(--text-muted);
  font-size: var(--blog-meta-size);
  line-height: 1.6;
}

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

@media (max-width: 767px) {
  :root {
    --blog-list-title-size: clamp(1.5rem, 1rem + 3vw, 1.875rem);
    --blog-article-title-size: 1.5rem;
  }

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

  .blog-list-section {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
  }

  .blog-list-toolbar {
    align-items: flex-start;
  }

  .blog-filters {
    width: 100%;
  }

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

  .post-card {
    padding: 1.25rem;
  }

  .article-download {
    padding: 1.25rem;
  }

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

  main.reading.section,
  .article-page.section,
  .blog-article.section,
  .article-page > .section,
  .blog-article > .section {
    padding-top: 1.25rem;
  }
}

@media (max-width: 599px) {
  #post-nav {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 8rem;
  }

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

  .prose pre {
    padding: 0.875rem;
  }
}

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