/* Let the document scroll so the blog header and desktop TOC can stick. */
#app.article-root {
  overflow: visible;
}

.blog-shell {
  --blog-gutter: clamp(20px, 4vw, 56px);
  --blog-sticky-offset: 112px;
  --blog-copy: color-mix(in srgb, var(--text) 88%, var(--muted));
  --blog-secondary: color-mix(in srgb, var(--text) 35%, var(--muted));
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  text-transform: none;
  text-shadow: none;
  color-scheme: dark;
}

.blog-shell :where(a, summary) {
  color: inherit;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

.blog-shell :focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 5px;
}

.blog-shell :where([id], a, summary) {
  scroll-margin-top: var(--blog-sticky-offset);
}

.blog-shell :where(img, video, iframe) {
  max-width: 100%;
}

.blog-shell :where(h1, h2, h3, h4, h5, h6) {
  color: var(--text);
  text-transform: none;
  text-shadow: none;
  text-wrap: pretty;
}

.blog-skip {
  position: fixed;
  top: 12px;
  left: var(--blog-gutter);
  z-index: 30;
  padding: 12px 18px;
  border: 1px solid var(--text);
  border-radius: 6px;
  background: var(--panel);
  transform: translateY(calc(-100% - 24px));
}

.blog-skip:focus {
  transform: none;
}

.blog-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  min-height: 88px;
  padding: 14px max(var(--blog-gutter), calc((100% - 1320px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.blog-brand {
  display: grid;
  gap: 3px;
  min-width: 0;
  max-width: 360px;
  text-decoration: none;
  line-height: 1.3;
}

.blog-brand img {
  display: block;
  width: auto;
  max-width: min(100%, 220px);
  height: 32px;
  object-fit: contain;
  object-position: left center;
}

.blog-brand strong {
  font-size: 18px;
  font-weight: 750;
}

.blog-brand span {
  color: var(--blog-secondary);
  font-size: 12px;
}

.blog-header > nav {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.blog-header > nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border-bottom: 2px solid transparent;
  color: var(--blog-secondary);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.blog-header > nav a:hover,
.blog-header > nav a[aria-current] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.blog-main,
.blog-footer {
  width: min(1320px, calc(100% - var(--blog-gutter) * 2));
  margin-inline: auto;
}

.blog-main {
  padding-block: 28px 80px;
}

.blog-breadcrumb {
  margin-bottom: 40px;
  color: var(--blog-secondary);
  font-size: 13px;
}

.blog-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.blog-breadcrumb li {
  min-width: 0;
}

.blog-breadcrumb li + li::before {
  content: "/";
  margin-right: 12px;
  color: var(--muted);
}

.blog-breadcrumb a:hover,
.blog-footer a:hover {
  color: var(--text);
}

.blog-index-heading,
.blog-post-header {
  margin-bottom: 40px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--line);
}

.blog-eyebrow {
  margin: 0 0 16px;
  color: color-mix(in srgb, var(--accent) 65%, var(--text));
  font-size: 14px;
  font-weight: 600;
}

.blog-index-heading h1,
.blog-post-header h1 {
  max-width: 1040px;
  margin: 0;
  font-size: clamp(36px, 4.6vw, 64px);
  font-weight: 750;
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.blog-index-heading > p:last-child,
.blog-lead {
  max-width: 760px;
  margin: 22px 0 0;
  color: var(--blog-secondary);
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.65;
}

.blog-post-header h1,
.blog-lead {
  max-width: 100%;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px 24px;
}

.blog-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  text-decoration: none;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.blog-card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: var(--panel);
}

.blog-card-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 9px 9px 0 0;
  background: var(--panel);
}

.blog-card-placeholder {
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(ellipse at 15% 10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    linear-gradient(145deg, var(--panel), var(--panel-2));
  color: var(--blog-secondary);
  text-align: center;
  font-size: 24px;
  font-weight: 650;
  line-height: 1.3;
}

.blog-card-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 24px;
}

.blog-card h2 {
  margin: 0;
  font-size: 23px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.blog-card-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  margin: 0 0 8px;
  color: var(--blog-secondary);
  font-size: 15px;
  line-height: 1.7;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  width: 100%;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--blog-secondary);
  font-size: 12px;
}

.blog-card-author {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.blog-avatar {
  display: inline-grid;
  flex: 0 0 32px;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  object-fit: cover;
}

.blog-avatar-fallback {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.blog-empty {
  padding: clamp(24px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--blog-secondary);
}

.blog-empty > :first-child {
  margin-top: 0;
  color: var(--text);
}

.blog-empty > :last-child {
  margin-bottom: 0;
}

.blog-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px 48px;
  margin-top: 32px;
}

.blog-author {
  flex: 1 1 360px;
  min-width: 0;
  max-width: 760px;
}

.blog-author-identity {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.blog-author-identity > div {
  min-width: 0;
}

.blog-author-identity .blog-avatar {
  flex-basis: 44px;
  width: 44px;
  height: 44px;
}

.blog-author-identity strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.blog-label {
  display: block;
  color: var(--blog-secondary);
  font-size: 12px;
  line-height: 1.6;
}

.blog-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.blog-socials a {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  color: var(--blog-secondary);
}

.blog-socials a:hover {
  background: var(--panel);
  color: var(--text);
}

.blog-socials svg {
  width: 20px;
  height: 20px;
}

.blog-author-bio {
  margin-top: 14px;
  color: var(--blog-secondary);
  font-size: 14px;
}

.blog-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  max-width: 100%;
  font-size: 14px;
}

.blog-dates > div {
  min-width: 0;
}

.blog-post-grid {
  display: grid;
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
  align-items: start;
  gap: 32px;
}

.blog-post-grid > * {
  min-width: 0;
}

.blog-toc-desktop {
  display: none;
}

.blog-toc-mobile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.blog-toc-mobile summary {
  min-height: 48px;
  padding: 12px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.blog-toc-mobile[open] summary {
  border-bottom: 1px solid var(--line);
}

.blog-toc-mobile nav {
  padding: 12px;
}

.blog-toc h2 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 650;
}

.blog-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.blog-toc li + li {
  margin-top: 4px;
}

.blog-toc a {
  display: block;
  padding: 10px 12px;
  border-left: 2px solid var(--line);
  color: var(--blog-secondary);
  font-size: 13px;
  line-height: 1.6;
  text-decoration: none;
}

.blog-toc a:hover,
.blog-toc a[aria-current="location"] {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg));
  color: var(--text);
}

.blog-prose {
  width: 100%;
  max-width: 760px;
}

/* Reset shared rich-content rules, including their legacy mobile width cap. */
.blog-shell .article-body {
  display: block;
  width: 100%;
  max-width: 760px;
  color: var(--blog-copy);
  font-size: 18px;
  line-height: 1.8;
}

.blog-shell .article-body > * {
  margin-block: 0 1.4em;
}

.blog-shell .article-body :is(h2, h3, h4, h5, h6) {
  margin-block: 1.8em 0.7em;
  scroll-margin-top: var(--blog-sticky-offset);
  color: var(--text);
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.02em;
  text-transform: none;
}

.blog-shell .article-body h2 {
  font-size: clamp(26px, 2.6vw, 32px);
}

.blog-shell .article-body h3 {
  font-size: 24px;
}

.blog-shell .article-body :is(h4, h5, h6) {
  font-size: 20px;
}

.blog-shell .article-body :is(p, li, blockquote) {
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.blog-shell .article-body a,
.blog-author-bio a,
.blog-promotion-copy a {
  color: color-mix(in srgb, var(--accent) 55%, var(--text));
  text-decoration: underline;
}

.blog-shell .article-body a:hover,
.blog-author-bio a:hover,
.blog-promotion-copy a:hover {
  color: var(--text);
}

.blog-shell .article-body :is(ul, ol) {
  display: block;
  padding-left: 1.5em;
}

.blog-shell .article-body li + li {
  margin-top: 0.6em;
}

.blog-shell .article-body li :is(ul, ol) {
  margin-top: 0.6em;
}

.blog-shell .article-body li span {
  display: inline;
  color: inherit;
}

.blog-shell .article-body blockquote {
  padding: 20px 24px;
  border-left: 3px solid var(--accent);
  background: var(--panel-2);
}

.blog-shell .article-body code {
  border-color: var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text);
}

.blog-shell .article-body pre {
  min-width: 0;
  padding: 20px;
  border-color: var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  font-size: 14px;
  overflow-wrap: normal;
}

.blog-shell .article-body pre code {
  border: 0;
  background: transparent;
}

.blog-shell .article-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 15px;
}

.blog-shell .article-body :is(th, td) {
  padding: 12px 16px;
  border: 1px solid var(--line);
  text-align: left;
}

.blog-shell .article-body th {
  background: var(--panel);
  color: var(--text);
}

.blog-shell .article-body hr {
  margin-block: 36px;
  border: 0;
  border-top: 1px solid var(--line);
}

.blog-shell .article-hero-image,
.blog-shell .article-media {
  width: 100%;
  max-width: 100%;
  margin: 0 0 28px;
}

.blog-shell .article-hero-image img,
.blog-shell .article-media img {
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
}

.blog-shell :is(.article-hero-image, .article-media) figcaption {
  margin-top: 10px;
  color: var(--blog-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.blog-promotion,
.blog-shell .article-cta {
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 10px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 75%),
    var(--panel-2);
  color: var(--text);
}

.blog-promotion > img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 9px 9px 0 0;
}

.blog-promotion-content {
  padding: 24px;
}

.blog-promotion h2 {
  margin: 0 0 14px;
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.blog-promotion-copy {
  color: var(--blog-secondary);
  font-size: 14px;
  line-height: 1.75;
}

.blog-shell :is(.blog-author-bio, .blog-promotion-copy) .article-body {
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.blog-shell :is(.blog-author-bio, .blog-promotion-copy) :is(h2, h3, h4, h5, h6) {
  font-size: 18px;
}

.blog-author-bio > :first-child,
.blog-promotion-copy > :first-child {
  margin-top: 0;
}

.blog-author-bio > :last-child,
.blog-promotion-copy > :last-child,
.blog-shell .article-body > :last-child {
  margin-bottom: 0;
}

.blog-cta-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  margin-top: 22px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 65%, var(--text));
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 16%, var(--bg));
  color: var(--text);
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.5;
}

.blog-cta-button:hover {
  background: color-mix(in srgb, var(--accent) 24%, var(--bg));
  text-decoration: underline;
}

.blog-shell .article-cta {
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  padding: 24px;
}

.blog-shell .article-cta strong {
  color: var(--text);
  font-size: 20px;
  text-transform: none;
}

.blog-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px 48px;
  padding-block: 28px 40px;
  border-top: 1px solid var(--line);
  color: var(--blog-secondary);
  font-size: 13px;
}

.blog-footer p {
  max-width: 760px;
  margin: 0;
}

.blog-footer nav {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 24px;
}

@media (min-width: 1200px) {
  .blog-post-grid {
    grid-template-columns: minmax(0, 720px);
    column-gap: 40px;
  }

  .blog-post-grid.has-toc {
    grid-template-columns: 220px minmax(0, 720px);
  }

  .blog-post-grid.has-cta {
    grid-template-columns: minmax(0, 720px) 250px;
  }

  .blog-post-grid.has-toc.has-cta {
    grid-template-columns: 220px minmax(0, 720px) 250px;
  }

  .blog-toc {
    position: sticky;
    top: var(--blog-sticky-offset);
    max-height: calc(100dvh - var(--blog-sticky-offset) - 24px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
    padding: 6px;
  }

  .blog-toc-desktop {
    display: block;
  }

  .blog-promotion {
    position: sticky;
    top: var(--blog-sticky-offset);
    max-height: calc(100dvh - var(--blog-sticky-offset) - 24px);
    overflow-y: auto;
  }

  .blog-toc-mobile {
    display: none;
  }
}

@media (max-width: 999px) {
  .blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  .blog-shell {
    --blog-sticky-offset: 128px;
  }

  .blog-header {
    gap: 12px;
    min-height: 76px;
    padding-block: 12px;
  }

  .blog-brand strong {
    font-size: 15px;
  }

  .blog-brand img {
    height: auto;
    max-height: 32px;
  }

  .blog-header > nav {
    gap: 0;
  }

  .blog-header > nav a {
    min-width: 44px;
    padding-inline: 10px;
  }

  .blog-main {
    padding-block: 20px 48px;
  }

  .blog-breadcrumb {
    margin-bottom: 28px;
  }

  .blog-index-heading,
  .blog-post-header {
    margin-bottom: 28px;
    padding-bottom: 28px;
  }

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

  .blog-card-content {
    padding: 20px;
  }

  .blog-facts {
    gap: 24px;
  }

  .blog-shell .article-body {
    font-size: 17px;
  }

  .blog-shell .article-body blockquote {
    padding: 16px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .blog-shell *,
  .blog-shell *::before,
  .blog-shell *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
