/*move operator properties closer to their bold "heading"*/
blockquote > p {
    margin: 0 0 1px !important;
}

/* nested lists add no gap before the sub-list (any parent, not just ul) */
.rst-content li > ul,
.rst-content li > ol {
    margin-top: 0px !important;
    margin-bottom: 0px !important;
}

/* avoid gap in (changelog) lists when keeping empty lines in markdown for better readability*/
li > p {
    margin-bottom: 0px !important;
}

/* a paragraph leading into a list sits tight to it - zero the paragraph's own bottom
   margin (theme: p is margin 0 0 24px, lists are margin-top:0, so this nets flush)
   rather than negative-margining the list up to cancel it */
.rst-content p:has(+ ul),
.rst-content p:has(+ ol) {
    margin-bottom: 0 !important;
}

/* a version-number heading sits tight to its date blockquote - only headings directly
   followed by a blockquote, so real blockquotes elsewhere are left alone */
.rst-content h1:has(+ blockquote),
.rst-content h2:has(+ blockquote) {
    margin-bottom: 0 !important;
}

/* youtube iframe embeds - responsive 16:9 wrapper (used via <div class='video'>) */
div.video {
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 56.25% !important;
    margin-bottom: 20px !important;
}

/* the iframe fills that wrapper - so the markup itself can stay minimal */
div.video iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
}

/* self-hosted video embeds - autoplay/loop mp4s via a bare <video> tag,
   optionally wrapped in a link (<a href=...mp4>) to open it full-size */
video {
    display: block !important;
    width: 100% !important;
    margin-bottom: 0 !important;
}

a:has(> video) {
    display: block !important;
}

/* keep a video's caption tight underneath it, just like an image caption -
   covering both the bare <video> and the link-wrapped form */
video + p,
a:has(> video) + p {
    margin-top: 0 !important;
}
