:root {
  --blog-title-list: clamp(2rem, 1.4rem + 2vw, 3rem);
  --blog-title-article: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  --blog-lead-size: clamp(0.9375rem, 0.85rem + 0.45vw, 1.125rem);
  --blog-meta-size: 13px;
  --blog-body-size: 1rem;
  --blog-h2-size: 1.5rem;
  --blog-h3-size: 1.25rem;
}

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

main.wrap.reading {
  padding-top: 32px;
}
main.wrap.reading > nav:first-child p {
  margin-top: 0;
}

.blog-list-hero {
  padding-block: 88px 120px;
  background: var(--c-bg);
  text-align: center;
}

.blog-eyebrow {
  margin: 0 0 1.25rem;
  color: var(--c-muted);
  font-size: var(--blog-meta-size);
  letter-spacing: 0.08em;
}

.blog-list-hero h1 {
  margin: 0;
  max-width: 100%;
  color: var(--c-text);
  font-family: var(--f-display);
  font-size: var(--blog-title-list);
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.blog-list-hero .kw {
  text-decoration-line: underline;
  text-decoration-color: var(--c-accent);
  text-decoration-thickness: 6px;
  text-underline-offset: 0.2em;
  text-decoration-skip-ink: none;
}

.blog-list-intro {
  max-width: 42rem;
  margin: 1.5rem auto 0;
  color: var(--c-muted);
  font-size: var(--blog-lead-size);
  line-height: 1.8;
}

.blog-topic-notes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2rem;
}

.blog-list-section {
  padding-block: var(--section-space);
  background: var(--c-panel);
}

.blog-list-heading {
  margin: 0 0 1.5rem;
  color: var(--c-text);
  font-family: var(--f-display);
  font-size: var(--blog-h2-size);
  line-height: 1.4;
}

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

.blog-filter {
  min-height: 44px;
  padding: 0.625rem 1.125rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  background: var(--c-bg);
  color: var(--c-muted);
  font-family: var(--f-body);
  font-size: var(--blog-body-size);
  line-height: 1.5;
  cursor: pointer;
  transition: color var(--time-ui) var(--ease-out),
    border-color var(--time-ui) var(--ease-out);
}

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

.blog-filter[aria-pressed="true"] {
  border-color: var(--c-accent);
  background: var(--c-bg);
  color: var(--c-accent-dark);
  box-shadow: var(--sh-pill);
}

.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: 2px solid var(--c-accent-dark);
  outline-offset: 4px;
}

.blog-result-status {
  min-height: 1.5em;
  margin: 1.25rem 0 1.5rem;
  color: var(--c-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: 1.5rem;
}

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

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

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

.post-card h3 {
  margin: 0;
  max-width: 100%;
  color: var(--c-text);
  font-family: var(--f-display);
  font-size: var(--blog-h3-size);
  font-weight: 700;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.post-card h3 a {
  color: inherit;
  text-decoration: none;
}

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

.post-card .post-summary {
  margin: 1rem 0 1.5rem;
  color: var(--c-muted);
  font-size: var(--blog-body-size);
  line-height: 1.8;
  overflow-wrap: break-word;
}

.post-card .post-link {
  align-self: flex-start;
  margin-top: auto;
  color: var(--c-accent-dark);
  font-size: var(--blog-body-size);
  font-weight: 600;
  line-height: 1.6;
  text-decoration: none;
}

.post-card .post-link:hover {
  text-decoration: underline;
  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);
  background: var(--c-bg);
  color: var(--c-muted);
  line-height: 1.8;
}

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

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

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

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

.blog-breadcrumb > span:not([aria-current]),
nav.breadcrumb > span:not([aria-current]),
nav.breadcrumbs > span:not([aria-current]) {
  flex: 0 0 auto;
  color: var(--c-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;
  color: var(--c-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.section:has(.blog-breadcrumb) .blog-breadcrumb,
.section:has(nav.breadcrumb) nav.breadcrumb,
.section:has(nav.breadcrumbs) nav.breadcrumbs {
  margin-top: 0;
}

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

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

.article-hero h1,
.article-header h1,
.blog-article h1,
.article-page h1 {
  display: block;
  max-width: 100%;
  margin-block: 0.875rem 1rem;
  color: var(--c-text);
  font-family: var(--f-display);
  font-size: var(--blog-title-article);
  font-weight: 800;
  line-height: 1.32;
  overflow-wrap: break-word;
}

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

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

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

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

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

.article-body h2,
.prose h2 {
  display: block;
  max-width: 100%;
  margin: 2rem 0 1rem;
  color: var(--c-text);
  font-family: var(--f-display);
  font-size: var(--blog-h2-size);
  line-height: 1.5;
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

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

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

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

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

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

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

.article-body code,
.prose code {
  padding: 0.125em 0.35em;
  border-radius: var(--r-xs);
  background: var(--c-panel);
  color: var(--c-text);
  font-family: var(--f-mono);
  font-size: 0.9em;
  white-space: normal;
  overflow-wrap: anywhere;
}

.article-body pre,
.prose pre {
  max-width: 100%;
  margin: 1.25rem 0;
  padding: 1.25rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-panel);
  color: var(--c-text);
  font-family: var(--f-mono);
  font-size: 0.875rem;
  line-height: 1.75;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

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

.article-body blockquote,
.prose blockquote {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--c-border);
  border-radius: var(--r-control);
  background: var(--c-panel);
  color: var(--c-text-2);
}

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

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

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

.article-body .table-scroll table,
.prose .table-scroll table {
  display: table;
  min-width: 100%;
  margin-block: 0;
}

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

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

.article-body td code,
.prose td code {
  overflow-wrap: anywhere;
}

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

.article-download > div:first-child {
  flex: 1 1 16rem;
  min-width: 0;
}

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

.article-download p,
.prose .article-download p,
.article-body .article-download p {
  margin: 0;
  color: var(--c-muted);
  line-height: 1.7;
}

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

.article-related,
.related-section {
  margin-top: 2.5rem;
  padding-block: 0;
}

.article-related h2,
.related-section h2 {
  margin: 0 0 1.25rem;
  color: var(--c-text);
  font-family: var(--f-display);
  font-size: var(--blog-h2-size);
  line-height: 1.5;
}

#related-posts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  min-width: 0;
}

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

#related-posts .post-card h3 {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.6;
}

#related-posts .post-summary {
  margin-block: 0.875rem 1.25rem;
  font-size: 0.9375rem;
}

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

#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);
  background: var(--c-panel);
  color: var(--c-text);
  text-decoration: none;
}

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

#post-nav .post-nav-caption,
#post-nav .post-nav-date {
  color: var(--c-muted);
  font-size: var(--blog-meta-size);
  line-height: 1.6;
}

#post-nav .post-nav-title {
  color: var(--c-text);
  font-family: var(--f-display);
  font-size: var(--blog-body-size);
  font-weight: 600;
  line-height: 1.7;
  overflow-wrap: break-word;
}

#post-nav .post-nav-date {
  margin-top: auto;
}

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

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

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

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

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

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

@media (max-width: 480px) {
  .blog-list-hero {
    padding-block: 56px 80px;
  }

  .blog-list-hero h1 {
    font-size: 1.875rem;
  }

  .blog-list-intro {
    margin-top: 1.25rem;
  }

  .blog-topic-notes {
    gap: 0.5rem;
    margin-top: 1.5rem;
  }

  .blog-filter {
    padding-inline: 0.875rem;
    font-size: 0.9375rem;
  }

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

  .article-download {
    padding: 1.25rem;
  }

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

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

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