,
h4 img,
h5 img,
h6 img {
    margin: 0 0.5em 0.2em 0;
    vertical-align: middle;
    display: inline-block;
}

img + h1 {
    margin-top: 0.5em;
}

img + h1,
img + h2,
img + h3,
img + h4,
img + h5,
img + h6 {
    margin-top: 0.3em;
}

h1 + *,
h2 + *,
h3 + *,
h4 + *,
h5 + *,
h6 + * {
    margin-top: 0.8em;
}

:is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6) {
    margin-top: 0.4em;
}

:matches(h1, h2, h3, h4, h5, h6) + :matches(h1, h2, h3, h4, h5, h6) {
    margin-top: 0.4em;
}

:is(p, ul, ol) + 