/* Shared reading surface only: no site chrome or editor controls.
   Optional prose-* classes describe rendered semantics, never stored rewrites.
   :root gives typography enough specificity to survive workspace-wide resets
   while authored inline styles remain authoritative on both reading surfaces. */
.article-prose {
  --prose-muted: var(--vw-muted, var(--secondary-text, #666));
  --prose-border: var(--vw-border, var(--theme-line, #d8d8d8));
  --prose-accent: var(--vw-accent, var(--editor-accent, currentColor));
  min-width: 0;
  max-width: 100%;
  font-family: var(--vw-font, var(--font-grotesk, "Inter", Arial, sans-serif));
  letter-spacing: 0;
  font-size: 1.125rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
  word-break: normal;
}
.article-prose :where(div, section, figure, p, li, blockquote) { min-width: 0; max-width: 100%; }
.article-prose :where(p, ul, ol, dl, blockquote, figure, table, pre) { margin-block: 0 1.5rem; }
:root .article-prose :where(p, li, a, span, strong, b, em, i, s, u) { font-size: inherit; line-height: inherit; letter-spacing: inherit; }
.article-prose p { opacity: 1; }
:root .article-prose :is(h1, h2, h3, h4, h5, h6) {
  margin-block: 2.5rem 1rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
  text-wrap: balance;
  scroll-margin-top: 2rem;
  clear: both;
}
:root .article-prose h1 { font-size: clamp(2rem, 4.7vw, 3.25rem); line-height: 1.15; letter-spacing: -.035em; }
.article-prose h2 { font-size: clamp(1.5rem, 2.5vw, 1.875rem); }
.article-prose h3 { font-size: 1.375rem; }
.article-prose h4 { font-size: 1.1875rem; }
.article-prose h5 { font-size: 1.125rem; }
:root .article-prose h6 { font-size: 1rem; letter-spacing: 0; }
:root .article-prose :is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6) { margin-top: .75rem; }
:root .article-prose > :first-child,
:root .article-prose > :first-child > :is(h1, h2, h3, h4, h5, h6):first-child { margin-top: 0; }
:root .article-prose > :last-child { margin-bottom: 0; }
/* Intro semantics must not turn every first h2 into a subtitle. */
:root .article-prose :is(.prose-intro, h1 + h2, h1 + p:has(a[href^="/#"]) + h2, h1 + .prose-tags + h2) {
  margin-block: 1.5rem;
  color: inherit;
  font-size: clamp(1.1875rem, 2vw, 1.375rem);
  line-height: 1.6;
  font-weight: 450;
  letter-spacing: -.01em;
  text-wrap: pretty;
}
.article-prose :is(.prose-tags, h1 + p:has(a[href^="/#"])) { margin-block: 0 1.5rem; font-size: .8125rem; line-height: 1.65; color: var(--prose-muted); }
:root .article-prose :is(.prose-tags, h1 + p:has(a[href^="/#"])) :is(a, .prose-hashtag) { color: inherit; text-decoration: none; }
:root .article-prose .prose-byline { margin-block: 1rem 1.75rem; font-size: .875rem; line-height: 1.6; color: var(--prose-muted); font-weight: 400; letter-spacing: 0; }
:root .article-prose :is(a, .prose-hashtag) { color: var(--prose-accent); text-decoration: underline; text-underline-offset: .18em; overflow-wrap: anywhere; }
.article-prose :is(a, .prose-hashtag):hover { text-decoration-thickness: .12em; }
.article-prose a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.article-prose :is(sup, sub) { font-size: .75em; line-height: 0; }
.article-prose :is(ul, ol) { padding-inline-start: 1.6em; }
.article-prose li { padding-inline-start: .15em; }
.article-prose li + li { margin-top: .5em; }
.article-prose li > p { margin-block: .5em; }
.article-prose li > :first-child { margin-top: 0; }
.article-prose li > :last-child { margin-bottom: 0; }
.article-prose li > :is(ul, ol) { margin-block: .65em; }
.article-prose dt { font-weight: 600; }
.article-prose dd { margin-inline-start: 1.5em; margin-block-end: 1em; }
.article-prose blockquote { margin-block: 2rem; margin-inline: 0; padding: .25rem 0 .25rem clamp(.875rem, 3vw, 1.5rem); border-inline-start: 2px solid var(--prose-border); color: inherit; }
.article-prose blockquote > :first-child { margin-top: 0; }
.article-prose blockquote > :last-child { margin-bottom: 0; }
.article-prose blockquote blockquote { margin-block: 1rem; }
.article-prose hr { margin-block: 2.5rem; border: 0; border-top: 1px solid var(--prose-border); }
/* Preserve authored inline widths (including percentages); only safety
   constraints outrank inline styling. Legacy heights must not stretch images. */
.article-prose img { display: block; width: auto; max-width: 100% !important; height: auto !important; box-sizing: border-box; margin-block: 1.75rem; }
.article-prose :is(p, h1, h2, h3, h4, h5, h6, figure, .prose-media) img { margin-block: 0; }
:root .article-prose :is(p, h1, h2, h3, h4, h5, h6):has(img),
:root .article-prose div:has(> img),
:root .article-prose .prose-media { margin-block: 1.75rem; }
.article-prose figure { margin-inline: 0; display: flow-root; }
.article-prose .prose-media { display: flow-root; }
:root .article-prose :is(figcaption, .image-caption, .prose-caption) { margin-block: .75rem 1.75rem; color: var(--prose-muted); font-size: .875rem; line-height: 1.6; font-style: italic; letter-spacing: 0; }
:root .article-prose :is(img, figure, .prose-media, .image-caption, .prose-caption, figcaption, p:has(img), div:has(img), h1:has(img), h2:has(img), h3:has(img), h4:has(img), h5:has(img), h6:has(img)) + :is(h1, h2, h3, h4, h5, h6),
:root .article-prose :is(img, figure, .prose-media, .image-caption, .prose-caption) + div:has(> h1:first-child) { margin-top: 2rem; }
:root .article-prose img + :is(.image-caption, .prose-caption) { margin-top: -.75rem; }
/* Bare legacy tables scroll locally; editor wrappers retain table layout. */
.article-prose table { display: block; width: 100%; max-width: 100% !important; overflow-x: auto; border-collapse: collapse; overscroll-behavior-inline: contain; scrollbar-width: thin; font-size: .9375rem; line-height: 1.6; }
.article-prose :is(td, th) { min-width: 7ch; padding: .75rem; border: 1px solid var(--prose-border); vertical-align: top; text-align: start; }
.article-prose th { font-weight: 600; }
.article-prose :is(td, th) > :first-child { margin-top: 0; }
.article-prose :is(td, th) > :last-child { margin-bottom: 0; }
.article-prose :is(.tableWrapper, .prose-table-scroll) { max-width: 100%; overflow-x: auto; margin-block: 1.75rem; overscroll-behavior-inline: contain; }
.article-prose :is(.tableWrapper, .prose-table-scroll) table { display: table; margin: 0; }
.article-prose caption { text-align: start; color: var(--prose-muted); padding-block: .5rem; }
.article-prose pre { max-width: 100%; overflow-x: auto; padding: 1rem; border: 1px solid var(--prose-border); font-size: .875em; line-height: 1.6; }
.article-prose code { overflow-wrap: anywhere; }
.article-prose pre code { overflow-wrap: normal; }
.article-prose :is(iframe, video, audio, embed, object) { display: block; max-width: 100% !important; box-sizing: border-box; margin-block: 1.75rem; }
.article-prose iframe { width: 100%; border: 0; }
.article-prose iframe:is([src*="youtube"], [src*="youtu.be"], [src*="vimeo"]) { height: auto !important; aspect-ratio: 16 / 9; }
.article-prose video { height: auto !important; }
.article-prose audio { width: 100%; }
/* Never collapse editable caret positions. NBSP-only blocks need a semantic
   renderer class, not a heuristic based on arbitrary italic body text. */
.article-prose:not([contenteditable="true"]) :is(p, h1, h2, h3, h4, h5, h6):empty,
.article-prose:not([contenteditable="true"]) .prose-spacer { display: none; }
@media (max-width: 479px) {
  .article-prose { font-size: 1.0625rem; }
  .article-prose :is(td, th) { padding: .5rem; }
}
