/* Beta publication reading layout. Deliberately scoped away from Lab and cards. */
.rv-publication.post-template .gh-main-post {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(260px, 22vw, 300px);
  gap: clamp(32px, 3vw, 48px);
  max-width: 1560px;
  margin-inline: auto;
  padding: 32px 24px 0;
}

.rv-publication.post-template .gh-main-post:not(:has(.gh-article-right-sidebar)) {
  display: block;
  max-width: 1120px;
}

.rv-publication.post-template .gh-article-right-sidebar { min-width: 0; }

.rv-publication.post-template .gh-article {
  --tw-prose-body: var(--rv-ink);
  --tw-prose-headings: var(--rv-ink);
  --tw-prose-links: var(--rv-primary);
  --tw-prose-bold: var(--rv-ink);
  --tw-prose-counters: var(--rv-muted);
  --tw-prose-bullets: var(--rv-muted);
  --tw-prose-quotes: var(--rv-ink);
  --tw-prose-code: var(--rv-ink);
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 32px clamp(24px, 3vw, 40px) 56px;
  color: var(--rv-ink);
  background: var(--rv-surface);
  border: 1px solid var(--rv-line);
  border-radius: 12px;
  box-shadow: none;
  overflow-wrap: anywhere;
  word-break: normal;
}

.rv-publication.post-template .gh-article-header {
  margin: 0 0 24px;
  padding: 0;
}

.rv-publication.post-template .gh-article-title {
  margin: 0 0 16px;
  color: var(--rv-ink);
  font-size: clamp(26px, 2.5vw, 36px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.rv-publication.post-template .gh-article-tag {
  margin: 0 0 12px;
  padding: 4px 8px;
  background: var(--rv-soft);
  color: var(--rv-primary);
  font-size: 12px;
  line-height: 1.5;
  text-decoration: none;
}

.rv-publication.post-template .gh-article-excerpt {
  margin: 0 0 20px;
  color: var(--rv-muted);
  font-size: 18px;
  line-height: 1.6;
  opacity: 1;
}

.rv-publication.post-template .gh-article-meta {
  margin: 0;
  padding: 0 0 16px;
  border-color: var(--rv-line);
}

.rv-publication.post-template .gh-article-meta-wrapper { min-width: 0; }
.rv-publication.post-template .gh-article-meta-content { color: var(--rv-muted); line-height: 1.5; }
.rv-publication.post-template .gh-article-author-name { color: var(--rv-ink); font-size: 14px; }
.rv-publication.post-template .gh-article-header figure { margin: 24px 0 0; }
.rv-publication.post-template :is(.gh-article-meta-updated, .gh-article-meta-rating, .gh-share-btn) {
  background: var(--rv-soft);
  color: var(--rv-muted);
}
.rv-publication.post-template :is(.gh-rating-btn:hover, .gh-rating-btn.active, .gh-share-btn:hover) {
  background: var(--rv-line);
  color: var(--rv-primary);
}

.rv-publication.post-template .gh-content-body {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  color: var(--rv-ink);
  font-family: var(--rv-font), "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.7;
  text-align: start;
  text-wrap: pretty;
  overflow-wrap: anywhere;
  word-break: normal;
}

.rv-publication.post-template .gh-content-body::first-letter {
  float: none;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

/* Imported HTML headings must not outweigh the article title. */
.rv-publication.post-template .gh-content-body :is(h1, h2, h3, h4, h5, h6):not(:where(.kg-card *, .gh-members-cta *)) {
  color: var(--rv-ink);
  font-family: inherit;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -.015em;
  margin: 1.5em 0 .6em;
  scroll-margin-top: 80px;
}
.rv-publication.post-template .gh-content-body :is(h1, h2):not(:where(.kg-card *, .gh-members-cta *)) { font-size: 24px; }
.rv-publication.post-template .gh-content-body h3:not(:where(.kg-card *, .gh-members-cta *)) { font-size: 21px; }
.rv-publication.post-template .gh-content-body :is(h4, h5, h6):not(:where(.kg-card *, .gh-members-cta *)) { font-size: 18px; }
.rv-publication.post-template .gh-content-body :is(h1, h2, h3, h4, h5, h6) + :is(h2, h3, h4, h5, h6) { margin-top: .8em; }
.rv-publication.post-template .gh-content-body p:not(:where(.kg-card *, .gh-members-cta *)) { margin: 0 0 1em; line-height: inherit; }
.rv-publication.post-template .gh-content-body :is(ul, ol):not(:where(.kg-card *)) { margin: 1em 0; padding-inline-start: 1.4em; }
.rv-publication.post-template .gh-content-body ul { list-style: disc; }
.rv-publication.post-template .gh-content-body ol { list-style: decimal; }
.rv-publication.post-template .gh-content-body li { margin: .35em 0; padding-inline-start: .15em; }
.rv-publication.post-template .gh-content-body li > p { margin: .35em 0; }
.rv-publication.post-template .gh-content-body li > :is(ul, ol) { margin-block: .35em; }
.rv-publication.post-template .gh-content-body li::marker { color: var(--rv-muted); }
.rv-publication.post-template .gh-content-body :is(strong, b) { color: var(--rv-ink); font-weight: 650; }
.rv-publication.post-template .gh-content-body a:not(.gh-btn):not([class*="kg-"]):not(:where(.kg-card *)) {
  color: var(--rv-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}
.rv-publication.post-template .gh-content-body a:hover { text-decoration-thickness: 2px; }
.rv-publication.post-template .gh-article :is(a, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--rv-primary);
  outline-offset: 4px;
}
.rv-publication.post-template .gh-content-body blockquote {
  margin: 1.25em 0;
  padding: 14px 18px;
  border-inline-start: 3px solid var(--rv-primary);
  background: var(--rv-soft);
  color: var(--rv-muted);
  font-style: normal;
  font-weight: 400;
}
.rv-publication.post-template .gh-content-body blockquote p:last-child { margin-bottom: 0; }
.rv-publication.post-template .gh-content-body blockquote p::before,
.rv-publication.post-template .gh-content-body blockquote p::after { content: none; }
.rv-publication.post-template .gh-content-body hr { margin: 1.75em 0; border-color: var(--rv-line); }

/* Constrain overflow to technical content, preserving the page's reading width. */
.rv-publication.post-template .gh-content-body pre {
  max-width: 100%;
  margin: 1.25em 0;
  padding: 16px;
  overflow-x: auto;
  background: var(--rv-soft);
  color: var(--rv-ink);
  border: 1px solid var(--rv-line);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
}
.rv-publication.post-template .gh-content-body code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88em; }
.rv-publication.post-template .gh-content-body :not(pre) > code { padding: .15em .35em; background: var(--rv-soft); border-radius: 4px; color: var(--rv-ink); }
.rv-publication.post-template .gh-content-body code::before,
.rv-publication.post-template .gh-content-body code::after { content: none; }
.rv-publication.post-template .gh-content-body pre code { padding: 0; background: none; font-size: inherit; color: inherit; }
.rv-publication.post-template .gh-content-body math { color: inherit; font-size: 1.05em; }
.rv-publication.post-template .gh-content-body math[display="block"] { max-width: 100%; margin-block: 1.25em; padding-block: .4em; overflow-x: auto; }
.rv-publication.post-template .gh-content-body td math[display="block"] { margin-block: 0; }
.rv-publication.post-template .rv-asciidoc .rv-admonition { margin: 1.25em 0; padding: 14px 18px; border-inline-start: 3px solid var(--rv-primary); border-radius: 0 6px 6px 0; background: var(--rv-soft); }
.rv-publication.post-template .rv-asciidoc .rv-admonition > strong { display: block; margin-bottom: 6px; }
.rv-publication.post-template .rv-asciidoc :is(.title, caption) { padding: 0 0 8px; color: var(--rv-muted); font-size: 13px; line-height: 1.55; text-align: start; }
.rv-publication.post-template .rv-asciidoc td > p:last-child,
.rv-publication.post-template .rv-asciidoc .rv-admonition p:last-child { margin-bottom: 0; }
.rv-publication.post-template .rv-asciidoc div.footnote { margin: 8px 0; font-size: 14px; line-height: 1.7; color: var(--rv-muted); }
.rv-publication.post-template .rv-table-scroll { min-width: 0; max-width: 100%; margin: 1.25em 0; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--rv-line); border-radius: 8px; }
.rv-publication.post-template .gh-content-body table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin: 1.25em 0;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.55;
  text-align: start;
  font-variant-numeric: tabular-nums;
}
.rv-publication.post-template .rv-table-scroll table { display: table; overflow: visible; margin: 0; }
.rv-publication.post-template .gh-content-body :is(th, td) { padding: 10px 12px; min-width: 88px; border-bottom: 1px solid var(--rv-line); vertical-align: top; color: var(--rv-ink); overflow-wrap: normal; word-break: normal; }
.rv-publication.post-template .gh-content-body th { background: var(--rv-soft); font-weight: 650; }
.rv-publication.post-template .gh-content-body tbody tr:nth-child(even) { background: var(--rv-soft); }
.rv-publication.post-template .gh-content-body :is(img, video, iframe) { max-width: 100%; }
.rv-publication.post-template .gh-content-body :is(img, video) { height: auto; }
.rv-publication.post-template .gh-content-body figure { margin: 1.25em 0; max-width: 100%; }
.rv-publication.post-template .gh-content-body figcaption { margin-top: 8px; color: var(--rv-muted); font-size: 13px; line-height: 1.55; text-align: start; }
.rv-publication.post-template .gh-content-body > :first-child,
.rv-publication.post-template .gh-content-body > .rv-asciidoc > :first-child { margin-top: 0; }
.rv-publication.post-template .gh-content-body > :last-child,
.rv-publication.post-template .gh-content-body > .rv-asciidoc > :last-child { margin-bottom: 0; }

/* No script is needed for typography or Ghost's server-rendered member gate. */
.rv-publication.post-template .gh-members-cta { margin: 40px 0 0; padding: 28px; background: var(--rv-soft); border: 1px solid var(--rv-line); border-radius: 10px; }
.rv-publication.post-template .gh-members-cta h2 { margin: 0 0 12px; font-size: 24px; }
.rv-publication.post-template .gh-members-cta p { margin-bottom: 20px; color: var(--rv-muted); }
.rv-publication.post-template .gh-members-cta .gh-btn { display: inline-block; padding: 12px 20px; background: #514bd5; color: #fff; font-size: 16px; line-height: 1.5; text-decoration: none; border-radius: 8px; }

.rv-publication.post-template .rv-article-toc { margin: 0 0 32px; padding: 0 20px; border: 1px solid var(--rv-line); border-radius: 8px; background: var(--rv-soft); color: var(--rv-ink); font: 14px/1.6 var(--rv-font); }
.rv-publication.post-template .rv-article-toc summary { padding: 15px 0; cursor: pointer; font-weight: 600; }
.rv-publication.post-template .rv-article-toc nav { max-height: 320px; overflow-y: auto; padding: 0 4px 16px; }
.rv-publication.post-template .rv-article-toc ol { list-style: none; margin: 0; padding: 0; }
.rv-publication.post-template .rv-article-toc li { margin: 0; padding: 0; }
.rv-publication.post-template .rv-article-toc a { display: block; padding: 8px 0; font-weight: 400; color: var(--rv-muted); text-decoration: none; }
.rv-publication.post-template .rv-article-toc a:hover { color: var(--rv-primary); text-decoration: underline; }
.rv-publication.post-template .rv-article-toc .rv-toc-subsection { padding-inline-start: 18px; }

@media (max-width: 1199px) {
  .rv-publication.post-template .gh-main-post { display: block; max-width: 1120px; }
  .rv-publication.post-template .gh-article-right-sidebar { display: none; }
}

@media (max-width: 600px) {
  .rv-publication.post-template .gh-main-content { padding: 0; }
  .rv-publication.post-template .gh-main-post,
  .rv-publication.post-template .gh-main-post:not(:has(.gh-article-right-sidebar)) { padding: 0; }
  .rv-publication.post-template .gh-article { padding: 24px 20px 40px; border: 0; border-radius: 0; }
  .rv-publication.post-template .gh-article-header { margin-bottom: 20px; }
  .rv-publication.post-template .gh-article-title { font-size: 26px; text-wrap: pretty; }
  .rv-publication.post-template .gh-content-body { font-size: 17px; line-height: 1.75; }
  .rv-publication.post-template .gh-content-body :is(h1, h2):not(:where(.kg-card *, .gh-members-cta *)) { font-size: 22px; }
  .rv-publication.post-template .gh-content-body h3:not(:where(.kg-card *, .gh-members-cta *)) { font-size: 20px; }
  .rv-publication.post-template .gh-article-excerpt { font-size: 18px; }
  .rv-publication.post-template .gh-members-cta { padding: 22px; }
  .rv-publication.post-template .gh-content-body pre { padding: 14px; font-size: 13px; }
  .rv-publication.post-template .gh-content-body :is(th, td) { padding: 9px 10px; }
  .rv-publication.post-template .gh-comments { padding: 24px 12px; }
  .rv-publication.post-template .gh-comments-content { padding: 16px; }
}

@media print {
  .rv-publication.post-template .rv-article-toc,
  .rv-publication.post-template .gh-article-meta-rating,
  .rv-publication.post-template .gh-share-btn { display: none; }
  .rv-publication.post-template .gh-article { padding: 0; border: 0; }
  .rv-publication.post-template .gh-content-body { font-size: 12pt; line-height: 1.6; }
  .rv-publication.post-template .gh-content-body :is(h1, h2, h3, h4) { break-after: avoid; }
}
