/* For legacy reading systems */
article,
aside,
figure,
figcaption,
footer,
header,
main,
nav,
section{
	display: block;
}

/* Epub2 compatibility CSS */
img[epub|type~="z3998:publisher-logo"]{
	width: 222px; /* This gets scaled up by 2px when adding the white outside path during the build process */
}

/* Give PNGs a white background for night mode compatibility... */
img[epub|type~="se:image.color-depth.black-on-transparent"]{
	background: #fff !important; /* `!important` is required to make sure readers respect the BG color */
}

/* Except our house PNGs, which were rendered from SVGs with a white stroke... */
[epub|type~="titlepage"] img[epub|type~="se:image.color-depth.black-on-transparent"],
img[epub|type~="se:image.color-depth.black-on-transparent"][epub|type~="z3998:publisher-logo"]{
	background: transparent !important;
}

/* And except in Apple Books, where we can target night mode specifically */
:root[__ibooks_internal_theme] img[epub|type~="se:image.color-depth.black-on-transparent"]{
	background: transparent !important;
}

/* Enable night mode in Apple Books */
:root[__ibooks_internal_theme*="Night"] img[epub|type~="se:image.color-depth.black-on-transparent"],
:root[__ibooks_internal_theme*="Gray"] img[epub|type~="se:image.color-depth.black-on-transparent"]{
	filter: invert(100%);
}

/* Help preserve poetry formatting after Kobo adds its special <span>s */
[epub|type~="z3998:poem"] p span.koboSpan,
[epub|type~="z3998:song"] p span.koboSpan,
[epub|type~="z3998:verse"] p span.koboSpan{
	display: inline !important;
	text-indent: 0 !important;
	padding-left: 0 !important;
}

/* Vertical align any MathML images we might have */
img.mathml{
	vertical-align: middle;
}
