/* ==========================================================================
   BASE — reset, tipografia, elementi globali. Usa solo token.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding-top: var(--header-height);
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
}

body.transparent-header { padding-top: 0; }

h1, h2, h3, h4, h5, h6, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding-left: 1.25em; }

img, svg, video { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-underline-offset: 0.2em; }
a:hover { color: var(--color-accent); }

:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 3px;
}

/* --- Tipografia --------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--weight-heading);
    line-height: var(--leading-snug);
    letter-spacing: var(--tracking-snug);
    text-wrap: balance;
}

h1, .text-5xl { font-size: var(--text-5xl); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
h2, .text-4xl { font-size: var(--text-4xl); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
h3, .text-3xl { font-size: var(--text-3xl); }
h4, .text-2xl { font-size: var(--text-2xl); }
h5, .text-xl  { font-size: var(--text-xl); }
h6, .text-lg  { font-size: var(--text-lg); }

p { text-wrap: pretty; }

.lead {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
    max-width: 60ch;
}

/* --- Bottoni ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--btn-padding);
    border: 1px solid var(--btn-border);
    border-radius: var(--btn-radius);
    background: var(--btn-bg);
    color: var(--btn-color);
    font-family: var(--btn-font);
    font-size: var(--text-base);
    font-weight: var(--btn-weight);
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--duration-fast) ease, color var(--duration-fast) ease, transform var(--duration-fast) ease;
}

.btn:hover { background: var(--btn-bg-hover); color: var(--btn-color); }
.btn:active { transform: translateY(1px); }

.btn--secondary {
    --btn-bg: transparent;
    --btn-bg-hover: var(--color-surface);
    --btn-color: var(--color-text);
    --btn-border: var(--color-border);
}

/* --- Contenuto editoriale (the_content) --------------------------------- */
.prose { max-width: var(--container-narrow); margin-inline: auto; }
.prose > * + * { margin-top: 1.25em; }
.prose h2, .prose h3 { margin-top: 2em; }
.prose h2 { font-size: var(--text-3xl); }
.prose h3 { font-size: var(--text-2xl); }
.prose img { border-radius: var(--radius-card); }

/* --- Accessibilità ------------------------------------------------------ */
.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

.skip-link:focus {
    position: fixed;
    top: var(--space-2);
    left: var(--space-2);
    z-index: calc(var(--z-overlay) + 1);
    width: auto; height: auto;
    clip: auto;
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg);
    color: var(--color-text);
}

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