/* v207a1d: identical compact heading spacing in written reader, chapter editor and preview.
   No saved markup is changed. Explicit inline author margins remain authoritative. */
:is(#chapter-text,#rich-content,#safe-preview-panel .chapter-prose) :is(h1,h2,h3,h4,h5,h6){margin-block:.45em .4em;line-height:1.35}
/* Image-only heading blocks and artwork next to a text heading must not stack
   the generic heading, figure, paragraph and illustration default margins. */
:is(#chapter-text,#rich-content,#safe-preview-panel .chapter-prose) :is(h1,h2,h3,h4,h5,h6):has(img),
:is(#chapter-text,#rich-content,#safe-preview-panel .chapter-prose) :is(p,div,figure):has(img):not(:has(figcaption,table,blockquote,ul,ol,aside,details,p,div,h1,h2,h3,h4,h5,h6)):has(+ :is(h1,h2,h3,h4,h5,h6)),
:is(#chapter-text,#rich-content,#safe-preview-panel .chapter-prose) :is(h1,h2,h3,h4,h5,h6) + :is(p,div,figure):has(img):not(:has(figcaption,table,blockquote,ul,ol,aside,details,p,div,h1,h2,h3,h4,h5,h6)){
 margin-block:.35rem;
}
:is(#chapter-text,#rich-content,#safe-preview-panel .chapter-prose) :is(h1,h2,h3,h4,h5,h6) img,
:is(#chapter-text,#rich-content,#safe-preview-panel .chapter-prose) :is(p,div,figure):has(img):not(:has(figcaption,table,blockquote,ul,ol,aside,details,p,div,h1,h2,h3,h4,h5,h6)):has(+ :is(h1,h2,h3,h4,h5,h6)) img,
:is(#chapter-text,#rich-content,#safe-preview-panel .chapter-prose) :is(h1,h2,h3,h4,h5,h6) + :is(p,div,figure):has(img):not(:has(figcaption,table,blockquote,ul,ol,aside,details,p,div,h1,h2,h3,h4,h5,h6)) img{
 margin-block:0;
}
/* Keep the title-to-decoration gap compact even when the title is very large. */
:is(#chapter-text,#rich-content,#safe-preview-panel .chapter-prose) :is(p,div,figure,h1,h2,h3,h4,h5,h6):has(img) + :is(h1,h2,h3,h4,h5,h6):not(:has(img)),
:is(#chapter-text,#rich-content,#safe-preview-panel .chapter-prose) :is(h1,h2,h3,h4,h5,h6):not(:has(img)):has(+ :is(p,div,figure,h1,h2,h3,h4,h5,h6) img){
 margin-block:.5rem;
}
