/* Blog listing and article layout; shared buttons and download overlay use components.css. */
.blog-index,
.blog-article {
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-body);
}

.blog-index .wrap,
.blog-article .wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

.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;
  overflow: hidden;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

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

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

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

.breadcrumb-separator,
.blog-breadcrumb > span[aria-hidden="true"],
nav.breadcrumb > span[aria-hidden="true"],
nav.breadcrumbs > span[aria-hidden="true"] {
  flex: 0 0 auto;
  opacity: 0.35;
}

.blog-list-hero {
  padding: clamp(2rem, 5vw, 4rem);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  background: var(--bg-panel);
}

.blog-eyebrow {
  display: inline-block;
  color: var(--accent-dark);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.blog-list-hero h1 {
  margin: 1rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 3.3vw, 3rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.blog-list-hero p {
  max-width: 44rem;
  margin: 1.25rem 0 0;
  color: var(--text-muted);
  font-size: 1.0625rem;
  line-height: 1.75;
}

.blog-list-section {
  padding-block: clamp(2.5rem, 5vw, 4.5rem) 5rem;
}

.blog-list-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.blog-list-heading h2 {
  margin: 0.45rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.5vw, 2.125rem);
  line-height: 1.3;
}

.blog-list-heading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

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

.blog-filters button {
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--text-muted);
  font: 600 0.875rem var(--font-body);
  cursor: pointer;
}

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

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

.blog-filters button:focus-visible,
.post-card a:focus-visible,
.related-card:focus-visible,
#post-nav a:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 3px;
}

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

.post-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(1.4rem, 3vw, 2rem);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: var(--shadow-card);
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.post-tag {
  padding: 0.3rem 0.65rem;
  border-radius: var(--r-pill);
  background: var(--bg-panel);
  color: var(--accent-dark);
  font-family: var(--font-body);
  font-weight: 700;
}

.post-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 1.7vw, 1.4rem);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

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

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

.post-card p {
  margin: 0.9rem 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.75;
}

.post-card-action {
  align-self: flex-start;
  margin-top: auto;
  color: var(--accent-dark);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
}

.post-card-action::after {
  content: " →";
}

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

.blog-empty {
  grid-column: 1 / -1;
  padding: 2rem;
  border-radius: var(--r-lg);
  background: var(--bg-panel);
  color: var(--text-muted);
}

/* Match the actual article DOM, which does not use .blog-article/.article-hero. */
main.page:has(.post-meta) > .wrap {
  max-width: 820px;
}
main.page:has(.post-meta) > .wrap:first-child {
  padding-top: 32px;
}
main.page:has(.post-meta) .wrap > nav[aria-label] {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  margin: 0 0 20px;
  overflow: hidden;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}
main.page:has(.post-meta) .wrap > nav[aria-label] > a {
  flex: 0 0 auto;
}
main.page:has(.post-meta) .wrap > nav[aria-label] > [aria-current="page"] {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 30ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
main.page:has(.post-meta) article > header {
  margin-bottom: 16px;
}
main.page:has(.post-meta) article > header > .post-meta {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}
main.page:has(.post-meta) article > header > h1 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  line-height: 1.32;
  overflow-wrap: anywhere;
}
main.page:has(.post-meta) article > header > p:last-child {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
}
main.page:has(.post-meta) article > .prose > h2:first-child {
  margin-top: 0;
}

/* Keep article spacing compact rather than inheriting home section spacing. */
.blog-article .article-layout,
.blog-article .article-shell {
  max-width: 820px;
  margin-inline: auto;
}

.blog-article .section {
  padding-block: 0;
}

.blog-article .blog-breadcrumb,
.blog-article nav.breadcrumb,
.blog-article nav.breadcrumbs {
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
}

.article-hero {
  padding-block: 0 1.5rem;
}

.article-hero .post-meta,
.article-hero .article-meta {
  margin: 0 0 0.875rem;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

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

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

.article-body,
.blog-article .prose {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.85;
  overflow-wrap: break-word;
}

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

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

.article-body h2,
.blog-article .prose h2 {
  margin: 2rem 0 0.85rem;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1rem + 0.8vw, 1.5rem);
  line-height: 1.4;
}

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

.article-body h3,
.blog-article .prose h3 {
  margin: 1.5rem 0 0.65rem;
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 1rem + 0.4vw, 1.25rem);
  line-height: 1.45;
}

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

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

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

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

.article-body code,
.blog-article .prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.article-body :not(pre) > code,
.blog-article .prose :not(pre) > code {
  padding: 0.1em 0.3em;
  border-radius: var(--r-xs);
  background: var(--bg-panel);
  color: var(--text);
}

.article-body pre,
.blog-article .prose pre {
  max-width: 100%;
  margin: 1rem 0 1.5rem;
  padding: 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-panel);
  line-height: 1.65;
}

.article-body pre code,
.blog-article .prose pre code {
  overflow-wrap: normal;
}

.article-body blockquote,
.blog-article .prose blockquote {
  margin: 1.25rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--bg-panel);
  color: var(--text-muted);
}

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

.article-body table,
.blog-article .prose table {
  display: block;
  max-width: 100%;
  margin-block: 1rem;
  overflow-x: auto;
  border-collapse: collapse;
}

.article-body th,
.article-body td,
.blog-article .prose th,
.blog-article .prose td {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

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

.download-endnote {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-block: 2rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--bg-panel);
}

.download-endnote h2 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
  line-height: 1.4;
}

.download-endnote p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.65;
}

.download-endnote .btn {
  flex: 0 0 auto;
}

#related-posts {
  margin-top: 2rem;
}

#related-posts > h2 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  line-height: 1.4;
}

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

.related-card,
#post-nav a {
  display: block;
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: var(--shadow-card);
  color: var(--text);
  text-decoration: none;
}

.related-card:hover,
#post-nav a:hover {
  border-color: var(--accent);
}

.related-card .post-meta,
#post-nav span {
  display: block;
  margin-bottom: 0.65rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.related-card strong,
#post-nav strong {
  display: block;
  font-size: 0.975rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

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

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

@media (max-width: 700px) {
  .blog-list-heading {
    display: block;
  }

  .blog-list-heading p {
    margin-top: 0.65rem;
  }

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

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

  .blog-list-hero h1 {
    font-size: clamp(1.75rem, 7vw, 1.875rem);
  }

  .download-endnote {
    align-items: flex-start;
    flex-direction: column;
  }
}