/* ============================================================================
 * TOUCH: thumb-sized controls on phones and tablets.
 *
 * Linked from every page. It only applies where the main pointer is a finger
 * (pointer: coarse), so a desktop with a mouse looks exactly as it did.
 *
 * Every button, field, picker and tab is at least 44 by 44 pixels, the size a
 * thumb can hit without catching its neighbour. A link that sits inside a line
 * of text is left alone (min-height does not apply to inline text): the line is
 * the target. A checkbox or radio is pressed through its label, which grows
 * instead. A slider keeps its height and is pressed along its track.
 *
 * npm run audit checks every page against this.
 * ==========================================================================*/
@media (pointer: coarse) {
    button, [role="button"], [role="tab"], summary, select,
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]) {
        min-height: 44px !important;
    }
    /* a text box is always taller than a thumb unless a page shrinks it: 44px is only the floor here (no
       !important, no weight), so a page's own taller minimum (a journal entry, a recap, a blog post) still holds */
    :where(textarea) { min-height: 44px; }
    button, [role="button"], [role="tab"], input[type="submit"], input[type="button"], input[type="color"] {
        min-width: 44px !important;
    }
    /* a link drawn as a block or a button: its box grows, its words stay in the middle */
    a { min-height: 44px; }
    a.btn, a[class*="btn"], a[role="button"] { display: inline-flex; align-items: center; justify-content: center; }
    label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { min-height: 44px; display: inline-flex; align-items: center; }
    input[type="checkbox"], input[type="radio"] { min-width: 20px; min-height: 20px; }
    /* a slider: a taller strip to press along */
    input[type="range"] { min-height: 32px; }
    /* a link that stands on its own line ("Back to…", "More about me"): a full-height target */
    a.touch-link { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; }
}
