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

main.reading:has(.prose) {
  padding-top: 24px;
}

main.reading > nav[aria-label] > p {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

main.reading > article > header,
main.reading > header.article-hero {
  padding-top: 8px;
  padding-bottom: 12px;
}

main.reading > article > header h1,
main.reading > header.article-hero h1 {
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  line-height: 1.32;
}

main.reading > article > header > p:last-child,
main.reading > header.article-hero > p:last-child {
  margin-bottom: 0;
}

main.reading .prose {
  padding-top: 20px;
}

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

.blog-skip {
  position: fixed;
  top: 0.75rem;
  left: var(--gutter);
  z-index: 100;
  padding: 0.75rem 1rem;
  color: var(--on-dark);
  background: var(--accent);
  border-radius: var(--radius);
  transform: translateY(-180%);
}

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

.blog-hero {
  position: relative;
  overflow: hidden;
  padding-block: 3.5rem;
  color: var(--on-dark);
  background: linear-gradient(180deg, var(--hero-top), var(--hero-bottom));
}

.blog-hero .wrap {
  position: relative;
}

.blog-kicker {
  margin: 0 0 1rem;
  color: var(--on-dark-muted);
  font-size: 0.8125rem;
  font-weight: var(--weight-medium);
  letter-spacing: 0.06em;
}

.blog-hero h1 {
  max-width: 100%;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
  font-weight: var(--weight-normal);
  line-height: 1.25;
}

.blog-hero-lead {
  max-width: var(--reading-width);
  margin: 1.25rem 0 0;
  color: var(--on-dark-muted);
  font-size: 1.0625rem;
  line-height: 1.8;
}

.blog-library {
  padding-block: 2.5rem 4rem;
}

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

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

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

.blog-filters {
  display: flex;
  gap: 0.625rem;
  overflow-x: auto;
  padding: 0.25rem 0.125rem 0.75rem;
  margin-bottom: 1.25rem;
  scrollbar-width: thin;
}

.blog-filter {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: var(--weight-medium);
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--time-fast) var(--ease),
    background-color var(--time-fast) var(--ease);
}

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

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

.blog-filter:focus-visible,
.blog-skip: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: 2px solid var(--accent);
  outline-offset: 3px;
}

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

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

.blog-post-grid .post-card,
#related-posts .post-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--bg-panel);
}

.post-card .post-meta,
.article-hero .post-meta,
.article-hero .article-meta,
.article-head .post-meta,
.article-head .article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.875rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}

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

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

.post-card .tag,
.article-hero .tag,
.article-head .tag {
  max-width: 100%;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent-dark);
  background: var(--bg);
  font-size: 0.8125rem;
  font-weight: var(--weight-medium);
  line-height: 1.5;
  white-space: normal;
}

.blog-post-grid .post-card h3,
#related-posts .post-card h3 {
  max-width: 100%;
  margin: 0 0 0.875rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: var(--weight-medium);
  line-height: 1.6;
  overflow-wrap: break-word;
}

.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 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.85;
}

.post-card > .more {
  align-self: flex-start;
  margin-top: auto;
  padding-block: 0.375rem;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: var(--weight-medium);
  line-height: 1.6;
  text-decoration: none;
}

.post-card > .more:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

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

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

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

.blog-breadcrumb.section,
nav.breadcrumb.section,
nav.breadcrumbs.section {
  padding-top: 0;
  padding-bottom: 0;
}

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

.blog-breadcrumb [aria-hidden="true"],
nav.breadcrumb [aria-hidden="true"],
nav.breadcrumbs [aria-hidden="true"] {
  flex: 0 0 auto;
  color: var(--text-muted);
  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;
}

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

.article-hero,
.article-head {
  padding-top: 0.5rem;
  padding-bottom: 1.75rem;
  color: var(--text);
  background: var(--bg);
}

.article-hero.section,
.article-head.section {
  padding-top: 0.5rem;
  padding-bottom: 1.75rem;
}

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

.article-hero h1,
.article-head h1 {
  max-width: 100%;
  margin: 0.875rem 0 0.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  font-weight: var(--weight-normal);
  line-height: 1.32;
  overflow-wrap: break-word;
}

.article-hero .article-lead,
.article-hero .lede,
.article-hero > p,
.article-head .article-lead,
.article-head .lede,
.article-head > p {
  max-width: 100%;
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  line-height: 1.7;
}

.article-content,
.article-body {
  min-width: 0;
  padding-top: 0;
  padding-bottom: 2rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.85;
  overflow-wrap: break-word;
}

.article-content.section,
.article-body.section {
  padding-top: 0;
  padding-bottom: 2rem;
}

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

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

.article-content h2,
.article-body h2,
.blog-article .prose h2,
.article-page .prose h2 {
  max-width: 100%;
  margin: 2rem 0 1rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1rem + 0.75vw, 1.5rem);
  font-weight: var(--weight-medium);
  line-height: 1.5;
}

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

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

.article-content p,
.article-body p {
  margin: 0 0 1rem;
}

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

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

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

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

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

.article-content code,
.article-body code {
  color: var(--accent-dark);
  background: var(--code-bg);
  border-radius: var(--radius-inner);
  font-family: var(--font-mono);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

.article-content :not(pre) > code,
.article-body :not(pre) > code {
  padding: 0.125rem 0.3rem;
}

.article-content pre,
.article-body pre {
  max-width: 100%;
  margin: 1.25rem 0;
  padding: 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.75;
  white-space: pre;
}

.article-content pre code,
.article-body pre code {
  padding: 0;
  color: inherit;
  background: var(--clear);
  overflow-wrap: normal;
  word-break: normal;
  white-space: pre;
}

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

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

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

.article-content img,
.article-body img,
.article-content video,
.article-body video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

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

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

.article-download h2,
.prose .article-download h2 {
  margin: 0 0 0.625rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: var(--weight-normal);
  line-height: 1.5;
}

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

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

#related-posts {
  min-width: 0;
  margin-block: 2rem;
}

#related-posts .related-heading {
  margin: 0 0 1.25rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: var(--weight-normal);
  line-height: 1.5;
}

#related-posts .related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 1rem;
  width: min(100%, var(--reading-width));
  max-width: 800px;
}

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

#related-posts .post-card h3 {
  font-size: 1.125rem;
}

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

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

#post-nav .post-nav-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--bg);
  text-decoration: none;
}

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

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

#post-nav .post-nav-title {
  color: var(--accent);
  font-size: 1rem;
  line-height: 1.7;
  overflow-wrap: break-word;
}

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

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

  .blog-hero h1 {
    font-size: clamp(1.5rem, 1rem + 3vw, 1.875rem);
  }

  .blog-hero-lead {
    font-size: 1rem;
  }

  .blog-library {
    padding-block: 1.75rem 2.5rem;
  }

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

  .blog-post-grid .post-card {
    padding: 1.25rem;
  }

  .blog-post-grid .post-card h3 {
    font-size: 1.125rem;
  }

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

  .article-hero,
  .article-head {
    padding-bottom: 1.5rem;
  }

  .article-download {
    padding: 1.25rem;
  }

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

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