/*
 * HTML5 compatibility layer (loaded by header.php before the theme CSS).
 *
 * Until November 2026 the site used the "HTML 4.01 Transitional" doctype without a URL,
 * which puts browsers in quirks mode, and the design was built in that mode. With
 * <!DOCTYPE html> the browser uses standards mode, so this file re-creates the quirks-mode
 * defaults the layout depends on (the browser's own quirks stylesheet).
 *
 * Every selector is wrapped in :where() (zero specificity) so any rule in the theme CSS or
 * all_themes.css still wins - as it did over the browser's quirks stylesheet.
 */

/* Quirks: tables do not inherit font settings from the page */
:where(table) {
    font-size: medium;
    font-weight: normal;
    font-style: normal;
    font-variant: normal;
    line-height: normal;
    white-space: normal;
    text-align: start;
}

/* Quirks: text inputs and textareas use border-box sizing */
:where(input:not([type="image" i]), textarea) {
    box-sizing: border-box;
}

/* Quirks: forms have a bottom margin */
:where(form) {
    margin-bottom: 1em;
}

/* Quirks: images with align=left/right get a 3px side margin */
:where(img[align="left" i]) {
    margin-right: 3px;
}
:where(img[align="right" i]) {
    margin-left: 3px;
}

/* Quirks: body and table cells ignore the default top margin of a first p/heading/list and the
   default bottom margin of a last p/pre, also inside wrappers. html_quirk_lines() in mainfile.php
   marks them (it knows the cells and what is first/last), body is done here. */
:where(.qmt, body > :where(p, h1, h2, h3, h4, h5, h6, ul, ol, dl, menu, dir, blockquote, pre):first-child) {
    margin-top: 0;
}
:where(.qmb, body > :where(p, pre):last-child) {
    margin-bottom: 0;
}

/* Quirks: a line with one image/field and no text is exactly as tall as it (.qvb from html_quirk_lines()) */
:where(.qvb) {
    vertical-align: bottom;
}

/* Quirks: the body fills the window, so height:100% boxes keep working */
:where(html) {
    height: 100%;
}
:where(body) {
    min-height: 100%;
}
