/* =============================================================================
   PMO - stili di base (tipografia, elementi HTML, focus, utilità minime)
   Solo token: nessun valore di colore in questo file.
   ============================================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px; /* radice fissa su tutti i dispositivi (DESIGN_SYSTEM.md §3.2) */
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--rv-color-bg);
    color: var(--rv-color-text);
    font-family: var(--rv-font-sans);
    font-size: var(--rv-font-size-md);
    font-weight: var(--rv-font-weight-regular);
    line-height: var(--rv-line-height-normal);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
    margin: 0 0 var(--rv-space-3);
    color: var(--rv-color-text);
    line-height: var(--rv-line-height-tight);
}

h1 {
    font-family: var(--rv-font-heading);
    font-size: var(--rv-font-size-xl);
    font-weight: var(--rv-font-weight-semibold);
}

h2 {
    font-family: var(--rv-font-heading);
    font-size: var(--rv-font-size-lg);
    font-weight: var(--rv-font-weight-semibold);
}

h3 {
    font-size: var(--rv-font-size-base);
    font-weight: var(--rv-font-weight-semibold);
}

p {
    margin: 0 0 var(--rv-space-3);
}

a {
    color: var(--rv-color-primary-text);
    text-underline-offset: 2px;
}

@media (hover: hover) {
    a:hover {
        text-decoration-thickness: 2px;
    }
}

code,
pre {
    font-family: var(--rv-font-mono);
    font-size: var(--rv-font-size-sm);
}

img {
    max-width: 100%;
    height: auto;
}

/* Focus sempre visibile da tastiera (WCAG 2.4.7): mai outline: none senza sostituto. */
:focus-visible {
    outline: 2px solid var(--rv-color-focus);
    outline-offset: 2px;
}

/* L'attributo hidden nasconde sempre, anche gli elementi le cui classi dichiarano display (campi, griglie dei form, pagine
   delle tabelle): è il modo in cui JavaScript e viste mostrano e nascondono, quindi qui serve !important. */
[hidden] {
    display: none !important;
}

/* Testo per i soli lettori di schermo */
.rv-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Link "Vai al contenuto": visibile solo al focus */
.rv-skip-link {
    position: absolute;
    top: var(--rv-space-2);
    left: var(--rv-space-2);
    z-index: calc(var(--rv-z-drawer) + 10);
    padding: var(--rv-space-2) var(--rv-space-4);
    border-radius: var(--rv-radius-sm);
    background: var(--rv-color-surface-raised);
    color: var(--rv-color-text);
    transform: translateY(-200%);
}

.rv-skip-link:focus {
    transform: none;
}

@media (min-width: 768px) {
    h1 {
        font-size: var(--rv-font-size-2xl);
    }
}

/* Input almeno a 16px su smartphone: evita lo zoom automatico di iOS */
@media (max-width: 767.98px) {
    input,
    select,
    textarea {
        font-size: var(--rv-font-size-base);
    }
}
