/* Camada 2: fundação tipográfica, acessibilidade e comportamento global. */
html {
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-width: 20rem;
    font-family: var(--ui-font-sans);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

:where(button, input, select, textarea) {
    font: inherit;
}

@media (max-width: 47.998rem) {
    /*
     * O Safari móvel amplia automaticamente campos menores que 16px.
     * Manter esse tamanho evita zoom, deslocamento lateral e perda de contexto
     * durante formulários operacionais.
     */
    :where(input, select, textarea) {
        font-size: 16px;
    }
}

:where(a, button, input, select, textarea, summary):focus-visible {
    outline: 2px solid var(--ui-brand);
    outline-offset: 2px;
    box-shadow: var(--ui-shadow-focus);
}

:where(h1, h2, h3, h4, h5, h6) {
    color: var(--ui-text);
    text-wrap: balance;
}

:where(p, li, td, th, label, small) {
    text-wrap: pretty;
}

::selection {
    color: #ffffff;
    background: var(--ui-brand);
}

[hidden] {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
