/* ---------- TABLET GRANDE (fino a 1400px) ---------- */
@media screen and (max-width: 1400px) {
    html, body {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
    }
    header {
    
        position: sticky;
        top: 0;
        z-index: 1000;  
        max-width:100%;
    }

    .title-grid{
        width: 90%;
        height: auto;
        min-height: 100px;
        padding: 20px;
    }
 
    .card{
        grid-template-columns: 1fr 1fr;
        width: 90%;
        margin-left: auto;
        margin-right: auto;
    }
}
 
/* ---------- TABLET (fino a 1024px) ---------- */
@media screen and (max-width: 1024px) {
 
    body{
        font-size: 18px;
    }
 
    .section-navbar{
        padding: 10px 5%;
        flex-wrap: wrap;
    }
 
    .sezione-colonne{
        flex-direction: column;
        gap: 30px;
    }
 
    .colonna{
        max-width: 100%;
    }
 
    .colonna-immagine{
        margin-right: 0;
        margin-top: 40px;
        margin-bottom: 40px;
        height: auto;
    }
 
    .colonna-immagine img{
        height: 220px;
    }
 
    .title-grid h1{
        font-size: 2.8rem;
    }
 
    .btn-grid{
        grid-template-columns: auto auto;
        width: 100%;
        justify-items: center;
        row-gap: 15px;
    }
 
    .carousel-container{
        width: 90%;
        height: 350px;
    }
}
 
/* ---------- MOBILE LANDSCAPE / TABLET PICCOLO (fino a 768px) ---------- */
@media screen and (max-width: 768px) {
    html, body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        margin: 0;
        padding: 0;
    }
    body{
        font-size: 16px;
    }
 
    .section-navbar{
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
 
    /* Il layout a navbar fissa laterale (.navbar) non è adatto al mobile:
       la trasformiamo in una barra orizzontale scorrevole in alto */
    .navbar{
        position: static;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        overflow: visible;
        width: 100%;
        box-shadow: none;
        background-color: transparent;
    }

    .figure{
        min-width: 50px;
        padding: 10px;
    }
 
    .figure p{
        font-size: 18px;
    }
 
    .btn-navbar{
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-top: 6px;
        margin-left: 0;
        width: max-content;
        min-width: 180px;
        max-width: min(85vw, 300px);
    }
    .btn-container:first-child .btn-navbar{
        left: 0;
        transform: none;
    }

    .btn-container:last-child .btn-navbar{
        left: auto;
        right: 0;
        transform: none;
        height: 0;
    }
 
    .table{
        margin-top: 50px;
    }
 
    .colonna-testo{
        padding: 10px;
    }
 
    .colonna-testo h2{
        max-width: 250px;
        height: 45px;
        font-size: 1.1rem;
        padding: 5px;
        text-align: center;
    }
 
    .title-grid{
        width: 65%;
        margin-top: 25px;
    }
 
    .title-grid h1{
        font-size: 2rem;
    }
 
    .btn-grid{
        grid-template-columns: 1fr;
        width: 90%;
    }
 
    .btn-grid button{
        max-width: 250px;
        font-size: 20px;
        max-height: 45px;
    }
 
    .card{
        grid-template-columns: 1fr;
        width: 95%;
    }
 
    .carousel-container{
        width: 95%;
        height: 260px;
    }
 
    .nav-btn{
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
 
    .contenitore-ricerca{
        width: 300px;
        margin-top: 5%;
    }
 
    .input-ricerca{
        font-size: 18px;
        padding: 12px;
    }
    #nav-contatti{
        left: 50%;
        transform: translateX(-50%);
        line-height: 30px;
    }
    #nav-contatti p{
        font-size: 15px;
        line-height: 20px;
    }
    #nav-contatti .par-contatti{
        font-size: 17px;
        line-height: 30px;
        font-weight:bold;
    }
}
 
/* ---------- MOBILE (fino a 480px) ---------- */
@media screen and (max-width: 480px) {
 
    body{
        font-size: 15px;
    }
 
    .section-navbar h3{
        font-size: 0.9rem;
        padding: 5px;
    }
    .section-navbar img{
        width: 210px;
        height: 55px;
    }
    .section-navbar h3{
        font-size: 10px;
    }

 
    .custom-logo,
    .custom-emoji{
        width: 24px;
        height: 24px;
    }

    .custom-logo,
    .custom-emoji :hover{
        all:unset;
        cursor: default;
    }
 
    .colonna-immagine img{
        height: 160px;
    }
 
    .title-grid h1{
        font-size: 1.5rem;
    }
 
    .title-grid h2{
        font-size: 1rem;
    }
 
    .btn-grid button{
        font-size: 16px;
        height: 50px;
    }
 
    .carousel-container{
        height: 200px;
    }
 
    .footer-content h3{
        font-size: 1.2rem;
    }
 
    .footer-content p{
        font-size: 0.85rem;
    }
 
    .btn-contatti{
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    .navbar{
        max-width: 480px;
        height: 60px;
    }
    .btn-container .figure img{
        max-width: 30px;
        max-height: 30px;
    }
    .figure:hover{
        all:unset;
    }
}
@media screen and (max-width: 360px) {
    .navbar{
        max-width: 100%;
        height: 55px;
    }
    .btn-container .figure img{
        max-width: 26px;
        max-height: 26px;
    }
    .figure:hover{
        all:unset;
    }

    /* Riduce l'altezza fissa delle celle della navbar per non tagliare le icone */
    .figure{
        height: 55px;
        min-width: 44px;
        padding: 8px 6px;
    }
    .figure p{
        font-size: 15px;
    }

    body{
        font-size: 14px;
    }

    .section-navbar{
        padding: 8px 4%;
    }
    .section-navbar img{
        width: 170px;
        height: 45px;
    }
    .section-navbar h3{
        font-size: 9px;
        padding: 4px;
    }

    .title-grid{
        width: 92%;
        padding: 12px;
    }
    .title-grid h1{
        font-size: 1.3rem;
    }
    .title-grid h2{
        font-size: 0.85rem;
    }

    .card{
        width: 98%;
    }

    .colonna-testo{
        padding: 8px;
    }
    .colonna-testo h2{
        max-width: 220px;
        font-size: 1rem;
    }

    .colonna-immagine{
        margin-top: 20px;
        margin-bottom: 20px;
    }
    .colonna-immagine img{
        height: auto;
        max-height: 140px;
    }

    .carousel-container{
        width: 100% !important;
        max-width: 280px;
        height: 170px !important;
    }

    .btn-grid button{
        width: 200px;
        max-width: 200px;
        font-size: 15px;
        height: 45px;
    }

    /* Pannello di ricerca: evita che sfondi la larghezza dello schermo */
    .contenitore-ricerca{
        width: 100%;
        max-width: 260px;
        margin-top: 5%;
    }
    .input-ricerca{
        font-size: 15px;
        padding: 10px;
    }
    .menu-tendina a{
        padding: 10px;
        font-size: 14px;
    }
    #nav-contatti{
        transform: translateX(-70%);
    }
    #nav-contatti p{
        font-size: 13px;
        line-height: 18px;
    }
    #nav-contatti .par-contatti{
        font-size: 15px;
        line-height: 24px;
    }
    #nav-contatti a{
        font-size: 15px;
    }
}