* RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* TIPOGRAFIA GENERALE */
body {
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: #222;
    background-color: #f4f7fa;
    padding-top: 130px; /* spazio per l’header fisso */
}

/* TITOLI */
h1 {
    color: #fff;
    font-size: 32px;
    font-weight: 600;
    text-align: center;
}

h2 {
    color: #ff6600;
    font-size: 26px;
    text-align: center;
    margin: 20px 0;
}

/* PARAGRAFI */
p {
    margin-bottom: 20px;
    text-align: justify;
}

p.centrato {
    margin-bottom: 20px;
    text-align: center;
}


/* HEADER */
#header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 120px;
    background-color: #098fff;
    display: flex;
    align-items: center;
    padding: 10px 20px;
    z-index: 1000;
}

#header img {
    height: 90px;
}

.box1 {
    margin-left: 20px;
}

.box2 {
    margin-left: auto;
    margin-right: 40px;
    display: flex;
    gap: 25px;
    align-items: center;
}

.box2 a {
    font-size: 20px;
    color: #fff;
    font-weight: bold;
}

/* LAYOUT A TRE COLONNE */
#page {
    display: flex;
    width: 100%;
    max-width: 1400px;
    margin: auto;
    padding: 20px;
    gap: 20px;
}

/* MENU SINISTRO */
#left {
    width: 22%;
}

.overflow {
    position: sticky;
    top: 140px;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    max-height: 500px;
    overflow-y: auto;
    font-size: 16px;
    color: #098fff;
}

/* CONTENUTO CENTRALE */
#middle {
    width: 56%;
    background: #fff;
    padding: 25px;
    border-radius: 8px;
}

/* COLONNA DESTRA */
#right {
    width: 22%;
    text-align: center;
}

/* IMMAGINI */
img.centrata {
    display: block;
    margin: 25px auto;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* LINK */
a {
    text-decoration: none;
    color: #8b4513;
    transition: 0.2s;
}

a:hover {
    color: red;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    #page {
        flex-direction: column;
    }

    #left, #middle, #right {
        width: 100%;
    }

    #header {
        height: auto;
        flex-wrap: wrap;
        justify-content: center;
        padding-bottom: 20px;
    }

    body {
        padding-top: 180px;
    }

    .box2 {
        margin: 10px auto 0;
    }
}

/* --- VERSIONE MOBILE COMPLETA --- */
@media (max-width: 600px) {

    /* Corpo più leggibile e adattato all’header mobile */
    body {
        font-size: 15px;
        line-height: 1.5;
        padding-top: 110px; /* spazio corretto per l’header */
    }

    /* HEADER: compatto, stabile, senza elementi che scompaiono */
    #header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        background-color: #098fff;

        height: auto;          /* si adatta al contenuto */
        padding: 8px 12px;     /* più compatto */
        display: flex;
        flex-wrap: wrap;       /* permette di andare a capo */
        justify-content: center;
        align-items: center;
        gap: 6px;              /* spazio tra logo, titolo e bottoni */
        z-index: 1000;
    }

    /* Logo più piccolo */
    #header img {
        height: 40px;
    }

    /* Titolo dell’argomento */
    h1 {
        font-size: 18px;
        margin: 0;
        width: 100%;
        text-align: center;
        color: #fff;
    }

    /* Bottoni avanti/indietro */
    .box2 {
        display: flex;
        gap: 10px;
        margin: 0;
        justify-content: center;
        width: 100%;
    }

    .box2 a {
        font-size: 14px;
        padding: 4px 6px;
        color: #fff;
        font-weight: bold;
    }

    /* NASCONDERE LE COLONNE LATERALI */
    #left,
    #right {
        display: none;
    }

    /* Contenuto centrale a tutta larghezza */
    #middle {
        width: 100%;
        padding: 18px;
    }

    /* IMMAGINI OTTIMIZZATE */
    img.centrata {
        max-width: 100%;
        height: auto;
        border-radius: 4px;
        margin: 15px auto;
    }

    /* Riduzione immagini molto alte */
    img.tall {
        max-height: 300px;
        object-fit: cover;
    }

    /* FOOTER ottimizzato */
    footer {
        font-size: 13px;
        padding: 10px 5px;
        margin-top: 20px;
        color: #666;
        text-align: center;
        line-height: 1.4;
    }
}