/* Base font-size per il calcolo dei rem */
html {
    font-size: 16px; /* 1rem = 16px su desktop */
    width: 100%;
    overflow-x: hidden; /* Previene scroll orizzontale */
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
}

body {
    font-family: Arial, sans-serif;
    color: white;
    position: relative;
    background-color: #000000;
    margin: 0;
    padding: 0;
    margin-bottom: auto;
    font-size: 1rem; /* 16px */
    width: 100%;
    overflow-x: hidden; /* Previene scroll orizzontale */
    max-width: 100vw; /* Limita larghezza allo schermo */
}

#hero {
    background: linear-gradient(to bottom, #8A2BE2, #000000); 
    width: 100%; 
    max-width: 100vw;
    height: 80dvh; 
    color: white;
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 100px 20px; 
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
}

h1 {
    font-size: 3.125rem; /* 50px */
    margin-bottom: 1.25rem; /* 20px */
}

h2 {
    text-align: center;
    color: #8A2BE2;
    margin: 1.25rem 0; /* 20px */
    font-size: 1.5rem; /* 24px */
}

h2 .about-section {
    text-align: left;
    color: #8A2BE2;
    margin: 1.25rem 0; /* 20px */
    font-size: 1.5rem; /* 24px */
}

h3 {
    font-size: 1.25rem; /* 20px */
    color: #8A2BE2; /* Viola come gli altri titoli */
    margin: 1rem 0;
}

.hero-logo {
    display: block;
    width: 200px;
    height: auto;
    margin-bottom: 2rem;
    filter: brightness(0) invert(1);
}

.epigrafe {
    font-style: italic;
    max-width: 50rem; /* 800px */
    margin: 0 auto;
    padding: 1.25rem; /* 20px */
    border-radius: 0.625rem; /* 10px */
}

.epigrafe p {
    text-align: center;
}

#CV {
    padding-bottom: -100px;
}

#CV a:hover {
    color: white; 
    text-decoration: underline; 
}

.navbar {
    position: sticky;
    top: 2rem;
    height: 38px;
    width: 30%;
    margin: 0 auto;
    z-index: 1000;
    border-radius: 40px;
    padding: 10px 0;
    background-color: transparent;
    transition: background-color 0.3s ease;
}
  
  .navbar.scrolled {
    background-color: #4a167be7; 
  }

.navbar a {
    background-color: rgba(245, 245, 245, 0); 
    color: white; 
    border: 0px solid white; 
    padding: 0.625rem 1.25rem; /* 10px 20px */
    font-size: 0.875rem; /* 14px */
}

.navbar a:hover {
    background-color: rgba(245, 245, 245, 0); 
    color: #b361ff;
} 

.navbar {
    border: 2px solid #8A2BE2;
    border-radius: 40px; 
    padding: 15px; 
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

#case-studies {
    display: grid;
    grid-template-columns: repeat(2, 750px);
    justify-content: center; /* Centra la griglia */ 
    grid-template-rows: repeat(2, 500px); 
    padding: 100px;
    background-color: rgb(0, 0, 0);
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
    position: relative;
    z-index: 2;
}

.case-study {
    width: 70%;
    margin-bottom: 50px;
    display: grid;
    text-align: left;
    color: #ccc;
}

.preview{
    border: 2px solid #8A2BE2;
    width: 550px;
    height: 300px;
    border-radius: 10px;
    overflow: hidden; /* Nasconde parti eccedenti */
}

#img-left,
#img-right {
    width: 100%;
    height: 100%; 
    object-fit: cover; /* Riempie il contenitore mantenendo proporzioni */
    border-radius: 10px;
}


#archivio {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    grid-template-rows: repeat(4, 400px); /* Altezza fissa verticale */
    gap: 20px;
    padding: 26px;
    padding-top: 3rem; /* Spazio tra contatti e archivio */
    background-color: rgb(0, 0, 0);
    justify-content: center; /* Centra la griglia */
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    overflow-x: hidden;
}

.rettangolo {
    color: white;
    display: grid;
    border: 2px solid #8A2BE2;
    width: 100%;
    height: 100%;
}

#container { 
    max-width: 90%; /* Adjusted to fit content */
    width: 100%;
    margin: 5rem;
    margin-left: 3rem;
    margin: 3rem auto 5rem auto;
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two equal columns */
    gap: 5rem;
    display: flex;
    flex-direction: space-around;
    box-sizing: border-box;
    overflow-x: hidden;
}

.me {
    grid-column: 1; /* Left column */
    max-width: 70%;
}

.contact-info {
    grid-column: 2; /* Right column */
    text-align: left; 
}

.titolini {
    color: #8A2BE2;
    margin-top: 0px;
    padding-top: 2px;
}

.titolo-about,
.titolo-certificazioni,
.titolo-contatti,
.titolo-competenze {
    color: #8A2BE2;
    font-weight: bold;
    text-align: left;
}

.titolo-certificazioni,
.titolo-contatti {
    font-size: 1.5rem; /* 24px */
}

.titolo-certificazioni {
    margin-top: 0 !important; /* Rimuove margin top certificazioni */
}

.titolo-competenze {
    margin-bottom: 13px;
    margin-top: 2rem; /* Spazio tra Formazione e Competenze tecniche */
}

.contact-info {
    text-align: left;
    margin-bottom: 3rem; /* Spazio tra contact-info e archivio */
}

.contact-info p {
    margin: 10px 0; 
}

a {
    text-decoration: underline; 
    color: #b361ff; 
}

.social-media {
    padding-top: 10px;
}

.social-media a:hover {
    text-decoration: underline; 
}

/*hover*/
.rettangolo {
    display: flex;
    gap: 20px;
}

.rettangolo {
    position: relative;
    width: 350px;
    height: 500px;
    overflow: hidden;
}

.rettangolo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Overlay disabilitato */
.overlay {
    display: none !important; /* Nasconde completamente l'overlay */
}
.rettangolo:hover .overlay {
    display: none !important;
}

.footer{
    margin-top: 7.5rem; /* 120px */
    padding: 1.25rem 1rem; /* 20px */
    font-size: 0.8rem; /* equivalente a 0.8em */
    text-align: center;
    color: #000000;
    background-color: #b361ff;
    width: auto;
    height: auto;
}

.footer-links {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #000000;
    text-decoration: none;
    padding: 0 0.5rem;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Back Arrow for Case Studies */
.back-arrow {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 1000;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.back-arrow:hover {
    transform: scale(1.1);
}

.back-arrow svg {
    width: 100%;
    height: 100%;
}

#content-section {
    padding: 20px;
    background-color: #000;
    color: white;
}

.content-container {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 40px;
}

.vertical-image {
    width: 30%;
    height: auto;
    border-radius: 10px;
}

.text-content {
    flex: 1;
}

.preview-image-container {
    text-align: center;
    margin: 2rem 0;
}

.preview-image {
    width: 80%;
    max-width: 800px;
    height: auto;
    border: 2px solid #8A2BE2;
    border-radius: 0;
}

.video-container {
    position: relative;
    text-align: center;
    margin-bottom: 40px;
}

video {
    width: 70%;
    max-height: 80vh; /* Adatta l'altezza al viewport */
    border: 2px solid #8A2BE2;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

video:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    object-fit: cover;
}

.carousel-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%; /* Adatta alla larghezza dello schermo */
    overflow: hidden;
}

.carousel {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 10px;
    width: 100%; /* Adatta alla larghezza del contenitore */
}

.carousel img {
    width: 100%; /* Adatta alla larghezza del contenitore */
    max-width: 600px; /* Limita la larghezza massima */
    height: auto; /* Mantiene le proporzioni */
    object-fit: cover;
    border: 2px solid #8A2BE2;
    border-radius: 10px;
}

/* Personalizzazione della scrollbar */
.carousel::-webkit-scrollbar {
    height: 8px; /* Altezza della scrollbar */
}

.carousel::-webkit-scrollbar-thumb {
    background-color: #8A2BE2; /* Colore viola per il thumb */
    border-radius: 10px; /* Arrotondamento */
}

.carousel::-webkit-scrollbar-track {
    background-color: #333; /* Colore grigio scuro per il track */
}

/* Rimuovere gli stili delle frecce */
.carousel-arrow {
    display: none;
}

/* Lightbox Styles */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.lightbox-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border: 2px solid #8A2BE2;
    cursor: default;
}

.carousel img {
    cursor: pointer;
}

/* Media query per schermi più piccoli */
@media (max-width: 768px) {
    .carousel img {
        max-width: 200px; /* Riduce la dimensione delle immagini */
    }

    /* Case Study 1 Mobile Styles */
    body.case-study-page {
        height: 100vh;
        position: relative;
        overflow: hidden;
    }

    html:has(.case-study-page) {
        overflow: hidden;
        height: 100vh;
    }

    /* Case Study 2 Mobile Styles */
    body.case-study-page-2 {
        height: 100vh;
        position: relative;
        overflow: hidden;
    }

    html:has(.case-study-page-2) {
        overflow: hidden;
        height: 100vh;
    }

    body.case-study-page-2 .text-columns {
        display: block !important;
    }

    body.case-study-page-2 .content-container,
    body.case-study-page-2 .description-column {
        width: 100% !important;
    }

    body.case-study-page-2 .descrizione-casestudy {
        margin-top: 1rem !important;
    }

    body.case-study-page-2 .back-arrow {
        top: auto;
        bottom: 1.5rem;
        left: auto;
        right: 1.5rem;
    }

    body.case-study-page-2 .video-container {
        margin-bottom: 1rem;
    }

    body.case-study-page-2 footer {
        display: none !important;
    }

    /* Case Study 3 Mobile Styles */
    body.case-study-page-3 {
        height: 100vh;
        position: relative;
        overflow: hidden;
    }

    html:has(.case-study-page-3) {
        overflow: hidden;
        height: 100vh;
    }

    body.case-study-page-3 .desktop-top-section {
        display: block !important;
    }

    body.case-study-page-3 .content-container {
        width: 100% !important;
        margin-bottom: 1rem !important;
    }

    body.case-study-page-3 .media-grid-container {
        display: grid !important;
    }

    body.case-study-page-3 .images-grid-3 {
        display: none !important;
    }

    body.case-study-page-3 .video-preview-vertical {
        display: block !important;
    }

    body.case-study-page-3 .back-arrow {
        top: auto;
        bottom: 1.5rem;
        left: auto;
        right: 1.5rem;
    }

    body.case-study-page-3 footer {
        display: none !important;
    }

    body.case-study-page-3 .video-container,
    body.case-study-page-3 .carousel-container,
    body.case-study-page-3 #content-section h2 {
        display: none;
    }

    body.case-study-page-3 .media-grid-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        margin-top: 1rem;
        height: 50vh;
    }

    body.case-study-page-3 .video-preview-vertical {
        width: 100%;
        height: 100%;
    }

    body.case-study-page-3 .video-preview-vertical video {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border: 2px solid #8A2BE2;
        border-radius: 0;
    }

    body.case-study-page-3 .vertical-carousel-wrapper {
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    body.case-study-page-3 .vertical-carousel-3 {
        display: flex;
        flex-direction: row;
        gap: 0;
        overflow-x: auto;
        overflow-y: hidden;
        height: 100%;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
    }

    body.case-study-page-3 .vertical-carousel-3 img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border: 2px solid #8A2BE2;
        border-radius: 0;
        cursor: pointer;
        flex-shrink: 0;
        scroll-snap-align: start;
    }

    body.case-study-page-3 .vertical-carousel-3::-webkit-scrollbar {
        height: 4px;
    }

    body.case-study-page-3 .vertical-carousel-3::-webkit-scrollbar-thumb {
        background-color: #8A2BE2;
        border-radius: 10px;
    }

    body.case-study-page-3 .vertical-carousel-3::-webkit-scrollbar-track {
        background-color: #333;
    }

    /* Case Study 4 Mobile Styles */
    body.case-study-page-4 {
        height: 100vh;
        position: relative;
        overflow: hidden;
    }

    html:has(.case-study-page-4) {
        overflow: hidden;
        height: 100vh;
    }

    body.case-study-page-4 .back-arrow {
        top: auto;
        bottom: 1.5rem;
        left: auto;
        right: 1.5rem;
    }

    body.case-study-page-4 footer {
        display: none !important;
    }

    body.case-study-page-4 .video-container,
    body.case-study-page-4 #content-section h2 {
        display: none;
    }

    body.case-study-page-4 .carousel-container-4 {
        width: 100%;
        margin-top: 1rem;
        display: flex;
        align-items: flex-start;
    }

    body.case-study-page-4 .carousel-4 {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        width: 100%;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        gap: 0;
        align-items: flex-start;
    }

    body.case-study-page-4 .carousel-4-img {
        width: auto;
        height: auto;
        max-height: 50vh;
        max-width: 100%;
        object-fit: contain;
        border: 2px solid #8A2BE2;
        border-radius: 0;
        cursor: pointer;
        flex-shrink: 0;
        scroll-snap-align: center;
        display: block;
    }

    body.case-study-page-4 .carousel-4::-webkit-scrollbar {
        height: 6px;
    }

    body.case-study-page-4 .carousel-4::-webkit-scrollbar-thumb {
        background-color: #8A2BE2;
        border-radius: 10px;
    }

    body.case-study-page-4 .carousel-4::-webkit-scrollbar-track {
        background-color: #333;
    }

    body.case-study-page-4 .case-study-link-4 {
        display: block !important;
        text-align: center !important;
        margin-top: 1rem !important;
        margin-left: auto !important;
        margin-right: auto !important;
        font-size: 0.85rem;
    }

    body.case-study-page-4 .text-content {
        display: block !important;
    }

    body.case-study-page-4 .carousel-container-4 {
        width: 100% !important;
        margin-top: 1rem !important;
        display: flex !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
    }

    #content-section {
        padding: 2rem 1rem 0 1rem;
        height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow: hidden;
    }

    .content-container {
        flex-direction: column;
        margin-bottom: 0;
    }

    body.case-study-page .content-container {
        margin-bottom: 1rem;
    }

    #content-section h1 {
        font-size: 1.5rem;
        margin-top: 0;
        margin-bottom: 0.5rem;
    }

    #content-section .text-content > p:first-of-type {
        font-size: 0.85rem;
        margin-bottom: 3rem;
        text-align: center;
    }

    .descrizione-casestudy {
        font-size: 0.85rem;
        margin-bottom: 0.5rem !important;
    }

    .preview-image-container {
        margin: 0;
        flex: 0 0 auto;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        padding-top: 1rem;
    }

    .case-study-link {
        font-size: 0.85rem;
        margin-top: 1rem;
        display: block;
        text-align: center;
    }
        padding-top: 1rem;
    }

    .preview-image {
        width: auto;
        max-width: 90%;
        max-height: 40vh;
        height: auto;
        object-fit: contain;
        border: 2px solid #8A2BE2;
        border-radius: 0;
    }

    body.case-study-page .video-container,
    body.case-study-page .carousel-container,
    body.case-study-page #content-section h2 {
        display: none;
    }

    body.case-study-page footer {
        display: none !important;
    }

    body.case-study-page .preview-image-container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        width: 100% !important;
    }

    body.case-study-page .preview-image {
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 50vh !important;
        object-fit: contain !important;
    }

    body.case-study-page .case-study-link {
        display: block !important;
        text-align: center !important;
        margin-top: 1rem !important;
    }

    body.case-study-page .back-arrow {
        top: auto;
        bottom: 1.5rem;
        left: auto;
        right: 1.5rem;
    }

    #content-section {
        padding: 5rem 1rem 0 1rem;
        height: 100vh;
}

/* Media query per schermi molto piccoli */
@media (max-width: 480px) {
    .carousel img {
        max-width: 150px; /* Ulteriore riduzione per schermi piccoli */
    }
}

/*responsivee!!*/

@media (max-width: 768px) {
    /* Sezione Case Studies */

    /* Break visibili solo su mobile per formazione */
    .mobile-br {
        display: inline;
    }

    /* Nascondi break tablet su mobile */
    .tablet-br {
        display: none;
    }

    .tablet-hide {
        display: inline;
    }

    .navbar {
        position: sticky;
        height: 10px;
        width: 50%;
        border-radius: 40px;
        padding: 10px 0;
        background-color: #b361ff;
        transition: background-color 0.3s ease;
    }
      
    
    .navbar a {
        background-color: rgba(245, 245, 245, 0); 
        color: white; 
        border: 0px solid white; 
        padding: 0.625rem 1.25rem; /* 10px 20px */
        font-size: 0.875rem; /* 14px */
    }

    .navbar.scrolled {
        background-color: #b361ff; 
      }
    
    .navbar {
        border-radius: 40px; 
        padding: 15px; 
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    #case-studies {
        display: grid;
        grid-template-columns: repeat(2, 1fr) !important; /* 2 colonne */
        grid-template-rows: repeat(2, auto); /* 2 righe */
        gap: 15px; 
        padding: 20px;
        justify-content: center;
    }

    .case-study {
        width: 100%; 
        margin-bottom: 0;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .preview {
        width: 100%;
        max-width: 250px; /* Larghezza massima per mobile */
        height: 140px; /* Altezza fissa uniforme */
        border-radius: 8px;
    }

    .case-study h2 {
        font-size: 0.85rem !important;
        margin-top: 0.5rem;
    }    
    
    /* archivio */

        #archivio {
            display: grid;
            grid-template-columns: repeat(3, 1fr) !important; /* 3 colonne per mobile */
            grid-template-rows: repeat(5, 220px); /* 5 righe con immagini più grandi */
            gap: 10px; /* Gap visibile tra immagini */
            padding: 18px; /* Padding laterale visibile */
            background-color: rgb(0, 0, 0);
            justify-content: center; /* Centra la griglia */
            max-width: 100%;
            margin: 0 auto;
        }
    
            .rettangolo {
            color: white;
            border: 2px solid #8A2BE2; 
            width: 100%; 
            height: 100%;
            margin: 0;
        }

        .rettangolo img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }


    .footer{
        margin-top: 5rem !important; /* 5rem tra archivio e footer */
        padding: 0.25rem 0.5rem !important; /* Padding ridotto */
        font-size: 0.55rem !important; /* Testo più piccolo */
        text-align: center;
        color: #000000;
        background-color: #b361ff;
        width: 100%;
        min-height: 1rem !important; /* Altezza 1rem */
        display: flex;
        flex-direction: row !important; /* Elementi in riga */
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
    }

    .footer-links {
        margin-bottom: 0;
        font-size: 0.55rem;
    }

    .footer-links a {
        color: #000000;
        text-decoration: none;
        padding: 0 0.2rem;
    }

    .footer-links a:hover {
        text-decoration: underline;
    }

    .footer-copyright {
        font-size: 0.55rem;
    }

    .content-container {
        flex-direction: column; /* Disporre gli elementi in colonna */
        align-items: center; /* Centrare gli elementi */
        gap: 10px;
    }

    .vertical-image {
        width: 80%; /* Occupa l'80% della larghezza dello schermo */
        max-width: 300px; /* Limita la larghezza massima */
    }

    .text-content {
        text-align: center; /* Centrare il testo */
    }

    #container {
        display: flex;
        flex-direction: column; /* Stack items vertically */
        align-items: center; /* Centra il contenuto */
        gap: 0 !important; /* Rimuove spazio tra me e contact-info */
        margin: 2rem auto !important; /* Centra il container */
        padding: 0 1.5rem !important; /* Padding laterale uniforme */
        max-width: 100% !important; /* Larghezza completa */
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .me, .contact-info {
        max-width: 100% !important; /* Ensure full width for each column */
        width: 100% !important;
        text-align: center !important; /* Allineamento al centro su mobile */
        box-sizing: border-box !important;
        padding: 0 !important;
    }

    .me h1,
    .me h2,
    .me h3,
    .me p,
    .contact-info h2 {
        text-align: center !important;
    }

    /* Titolo Certificazioni centrato */
    .me .titolo-certificazioni {
        text-align: center !important;
    }

    /* Formazione: titolo centrato, lista allineata a sinistra */
    .me h3 {
        text-align: center !important;
    }

    .me ul {
        text-align: left !important;
        list-style-position: outside !important;
        padding-left: 1.5rem !important;
        margin-left: 0 !important;
        margin-right: auto !important;
    }

    .me ul li {
        text-align: left !important;
        margin-bottom: 1rem !important;
    }

    .me > ul {
        margin-bottom: 3rem !important; /* Spazio tra formazione e certificazioni */
    }

    /* Certificazioni: titolo centrato */
    .me .titolo-certificazioni {
        text-align: center !important;
    }

    /* Certificazioni list: due colonne, 3 righe - 3 elementi a sinistra e 2 a destra */
    .certificazioni-list {
        display: grid !important;
        grid-template-columns: auto auto !important;
        grid-template-rows: auto auto auto !important;
        gap: 0.5rem 1rem !important;
        list-style: none !important;
        max-width: 100% !important;
    }

    .certificazioni-list li {
        text-align: left !important;
        margin: 0 !important;
    }

    /* Adobe Illustrator - riga 1, colonna 1 */
    .certificazioni-list li:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }

    /* Adobe Photoshop - riga 2, colonna 1 */
    .certificazioni-list li:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
    }

    /* Adobe After Effects - riga 3, colonna 1 */
    .certificazioni-list li:nth-child(3) {
        grid-column: 1;
        grid-row: 3;
    }

    /* HTML&CSS - riga 1, colonna 2 (allineato con Adobe Illustrator) */
    .certificazioni-list li:nth-child(4) {
        grid-column: 2;
        grid-row: 1;
    }

    /* UI Executive - riga 2, colonna 2 */
    .certificazioni-list li:nth-child(5) {
        grid-column: 2;
        grid-row: 2;
    }

    /* Contatti: testi allineati a sinistra ma centrati */
    .contact-info p,
    .contact-info .social-media {
        text-align: left !important;
        margin-left: auto !important;
        margin-right: auto !important;
        max-width: fit-content !important;
    }

    /* Testo biografico lungo allineato a sinistra */
    .me .bio-text {
        text-align: left !important;
        margin-bottom: 3rem !important; /* Spazio sotto il paragrafo biografico */
    }

    /* Competenze tecniche: liste allineate a sinistra */
    .lists ul {
        text-align: left !important;
        list-style-position: outside !important;
        padding-left: 1.5rem !important;
        margin-bottom: 0 !important;
    }

    .lists ul li {
        text-align: left !important;
        margin-bottom: 0 !important;
    }

    /* Rimuovi spazio dopo competenze tecniche */
    .lists {
        margin-bottom: 0 !important;
    }

    /* Spazio tra certificazioni e contatti */
    .titolo-contatti {
        margin-top: 3rem !important;
    }

    /* Sezione Contatti centrata */
    #contatti {
        text-align: center !important;
        padding: 0 1.5rem 2rem 1.5rem !important;
        margin: 0 auto !important;
        max-width: 100% !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    #contatti h2 {
        text-align: center !important;
    }

    /* Row per telefono ed email */
    .contatti-row {
        display: grid !important;
        grid-template-columns: auto auto !important;
        gap: 1rem !important;
        justify-content: center !important;
        margin-bottom: 0.5rem !important;
    }

    .contatti-row p {
        text-align: left !important;
        margin: 0 !important;
        line-height: 1.2 !important;
    }

    #contatti .social-media {
        text-align: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
        max-width: fit-content !important;
        line-height: 1.2 !important;
        margin-top: 0.5rem !important;
    }
}

.close-button {
    position: fixed; /* Fissa in alto a destra dello schermo */
    top: 3rem;
    right: 3rem;
    font-size: 1.875rem; /* 30px */
    color: #8A2BE2;
    text-decoration: none;
    font-weight: bold;
    background-color: transparent;
    border: none;
    cursor: pointer;
    z-index: 1000;
}

.close-button:hover {
    color: #b361ff;
}

.menu-container {
    position: fixed;
    top: 3rem;
    right: 3rem;
    z-index: 1000;
}

.menu-button {
    width: 50px;
    height: 50px;
    background-color: #8A2BE2;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.menu-icon {
    width: 25px;
    height: 3px;
    background-color: white;
    position: relative;
    display: block;
}

.menu-icon::before,
.menu-icon::after {
    content: '';
    width: 25px;
    height: 3px;
    background-color: white;
    position: absolute;
    left: 0;
    transition: transform 0.3s ease;
}

.menu-icon::before {
    top: -8px;
}

.menu-icon::after {
    top: 8px;
}

.menu-button.active .menu-icon {
    background-color: transparent;
}

.menu-button.active .menu-icon::before {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-button.active .menu-icon::after {
    transform: rotate(-45deg) translate(5px, -5px);
}

.dropdown-menu {
    position: absolute;
    top: 0;
    right: 60px;
    display: none;
    flex-direction: row;
    align-items: center;
    background-color: #8A2BE2;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.dropdown-menu.open {
    display: flex;
    opacity: 1;
    transform: translateX(0);
}

.menu-item {
    text-decoration: none;
    margin: 0 10px;
}

.menu-icon-home {
    width: 30px;
    height: 30px;
}

p {
    text-align: left;
}
.descrizione-casestudy {
    max-width: 50rem;
    text-align: left;

}

.lists {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    text-align: left;
}

.lists ul {
    list-style-position: outside;
    padding-left: 1.5rem;
}

.lists p {
    text-align: left;
    margin-bottom: 0.5rem;
}

/* Mobile Navbar */
.menu-container {
    display: none; /* Hidden by default */
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

.menu-button {
    width: 50px;
    height: 50px;
    background-color: #8A2BE2;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.menu-icon {
    width: 25px;
    height: 3px;
    background-color: white;
    position: relative;
    display: block;
}

.menu-icon::before,
.menu-icon::after {
    content: '';
    width: 25px;
    height: 3px;
    background-color: white;
    position: absolute;
    left: 0;
    transition: transform 0.3s ease;
}

.menu-icon::before {
    top: -8px;
}

.menu-icon::after {
    top: 8px;
}

.menu-button.active .menu-icon {
    background-color: transparent;
}

.menu-button.active .menu-icon::before {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-button.active .menu-icon::after {
    transform: rotate(-45deg) translate(5px, -5px);
}

.dropdown-menu {
    display: none;
    position: fixed;
    top: 4rem;
    right: 1rem;
    flex-direction: column;
    background-color: #8A2BE2;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.dropdown-menu.open {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-menu a {
    text-decoration: none;
    color: white;
    padding: 0.625rem 1.25rem; /* 10px 20px */
    font-size: 0.875rem; /* 14px */
    text-align: center;
}

.dropdown-menu a:hover {
    background-color: #b361ff;
    border-radius: 5px;
}

/* Fix overflow mobile - tutte le sezioni */
@media (max-width: 1400px) {
    * {
        max-width: 100vw;
        box-sizing: border-box;
    }

    section {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
}

/* Navbar mobile con effetto glass e icone */
@media (max-width: 1024px) {
    .navbar {
        display: flex !important;
        position: fixed !important; /* Fissa in basso */
        top: auto !important; /* Rimuove posizionamento top */
        bottom: 2rem !important; /* 2rem dal basso */
        width: 70% !important; /* Navbar più corta */
        max-width: 400px !important;
        left: 50% !important;
        transform: translateX(-50%) !important; /* Centra orizzontalmente */
        padding: 0.9rem 0.75rem !important; /* Altezza aumentata */
        height: auto !important;
        gap: 0 !important;
        justify-content: space-around !important; /* Distribuisce icone uniformemente */
        background: rgba(138, 43, 226, 0.15) !important; /* Glass effect viola */
        backdrop-filter: blur(10px) !important; /* Effetto blur glass */
        -webkit-backdrop-filter: blur(10px) !important;
        border: 2px solid rgba(138, 43, 226, 0.3) !important;
        box-shadow: 0 4px 20px rgba(138, 43, 226, 0.2) !important;
    }

    .navbar.scrolled {
        background: rgba(138, 43, 226, 0.2) !important; /* Leggermente più opaco quando scrollato */
    }

    .navbar a {
        padding: 0.5rem !important;
        font-size: 0 !important; /* Nascondi il testo */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: auto !important;
        height: auto !important;
        border-radius: 50% !important;
        position: relative !important;
    }

    /* Icone SVG inline con silhouette */
    .navbar a::before {
        content: '';
        width: 1.4rem;
        height: 1.4rem;
        display: block;
        background-color: white;
        mask-size: contain;
        mask-repeat: no-repeat;
        mask-position: center;
        -webkit-mask-size: contain;
        -webkit-mask-repeat: no-repeat;
        -webkit-mask-position: center;
    }

    .navbar a[href="#hero"]::before {
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M10 20v-6h4v6h5v-8h3L12 3L2 12h3v8z'/%3E%3C/svg%3E");
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M10 20v-6h4v6h5v-8h3L12 3L2 12h3v8z'/%3E%3C/svg%3E");
    }

    .navbar a[href="#case-studies"]::before {
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2z'/%3E%3C/svg%3E");
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2z'/%3E%3C/svg%3E");
    }

    .navbar a[href="#container"]::before {
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4s-4 1.79-4 4s1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4s-4 1.79-4 4s1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
    }

    .navbar a[href="#archivio"]::before {
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9H9V9h10v2zm-4 4H9v-2h6v2zm4-8H9V5h10v2z'/%3E%3C/svg%3E");
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9H9V9h10v2zm-4 4H9v-2h6v2zm4-8H9V5h10v2z'/%3E%3C/svg%3E");
    }

    .navbar a:hover {
        background-color: rgba(179, 97, 255, 0.2) !important;
    }

    .navbar a:hover::before {
        background-color: #b361ff; /* Colore icona al hover */
    }

    .menu-container {
        display: none !important; /* Nascondi il menu hamburger */
    }
}

/* Desktop Navbar */
.desktop-navbar-container {
    display: none; /* Hidden by default */
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

.desktop-menu-button {
    width: 50px;
    height: 50px;
    background-color: #8A2BE2;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.desktop-menu-icon {
    width: 25px;
    height: 3px;
    background-color: white;
    position: relative;
    display: block;
}

.desktop-menu-icon::before,
.desktop-menu-icon::after {
    content: '';
    width: 25px;
    height: 3px;
    background-color: white;
    position: absolute;
    left: 0;
    transition: transform 0.3s ease;
}

.desktop-menu-icon::before {
    top: -8px;
}

.desktop-menu-icon::after {
    top: 8px;
}

.desktop-menu-button.active .desktop-menu-icon {
    background-color: transparent;
}

.desktop-menu-button.active .desktop-menu-icon::before {
    transform: rotate(45deg) translate(5px, 5px);
}

.desktop-menu-button.active .desktop-menu-icon::after {
    transform: rotate(-45deg) translate(5px, -5px);
}

.desktop-dropdown-menu {
    display: none;
    position: fixed;
    top: 1rem;
    right: 5rem;
    flex-direction: column;
    background-color: #8A2BE2;
    padding: 10px;
    border-radius: 10px 10px 10px 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.desktop-dropdown-menu.open {
    display: flex;
    opacity: 1;
    transform: translateX(0);
}

.desktop-dropdown-menu a {
    text-decoration: none;
    color: white;
    padding: 0.625rem 1.25rem; /* 10px 20px */
    font-size: 0.875rem; /* 14px */
    text-align: center;
}

.desktop-dropdown-menu a:hover {
    background-color: #b361ff;
    border-radius: 5px;
}

/* Show desktop navbar only on larger screens */
@media (min-width: 1401px) {
    .desktop-navbar-container {
        display: flex; /* Show the desktop navbar */
    }
}

/* ===== RESPONSIVE TYPOGRAPHY ===== */

/* Mobile (320px - 767px) */
@media (max-width: 767px) {
    html {
        font-size: 14px; /* 1rem = 14px su mobile */
    }
    
    h1 {
        font-size: 2rem; /* 28px */
    }
    
    h2 {
        font-size: 1.5rem !important; /* Aumentato per essere uguale a h3/Formazione */
    }

    h3 {
        font-size: 1.5rem !important; /* Uguale a h2 */
    }
    
    body {
        font-size: 0.875rem; /* 12.25px */
    }

    /* Layout mobile specifico */
    #archivio {
        grid-template-columns: repeat(3, 1fr) !important; /* 3 colonne su mobile */
        grid-template-rows: repeat(5, 220px); /* 5 righe con immagini più grandi */
        padding: 15px !important; /* Padding laterale visibile */
        gap: 8px !important; /* Gap visibile tra immagini */
        max-width: 100%;
        margin: 0 auto;
    }

    .placeholder-archivio {
        background-color: rgba(138, 43, 226, 0.05) !important;
        border: 2px dashed #8A2BE2 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .placeholder-archivio::before {
        content: '+';
        font-size: 2.5rem;
        color: #8A2BE2;
        opacity: 0.3;
    }

    #container {
        margin: 1.5rem auto !important; /* Centra il container */
        padding: 0 1rem !important; /* Padding uniforme laterale */
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }

    .me, .contact-info {
        padding: 0 !important;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        text-align: center !important;
    }

    .me h1,
    .me h2,
    .me h3,
    .me p,
    .contact-info h2 {
        text-align: center !important;
    }

    /* Certificazioni e contatti: testi allineati a sinistra ma centrati */
    .contact-info p,
    .contact-info .social-media {
        text-align: left !important;
        margin-left: auto !important;
        margin-right: auto !important;
        max-width: fit-content !important;
    }

    /* Testo biografico giustificato e centrato nella pagina */
    .me .bio-text {
        text-align: justify !important; /* Testo giustificato */
        margin-bottom: 3rem !important;
        padding: 0 2rem !important; /* Padding laterale per ridurre larghezza */
        margin-left: auto !important; /* Centra il blocco */
        margin-right: auto !important;
        max-width: 100% !important;
    }

    /* Formazione e Competenze tecniche diventano h2 su mobile */
    .me h3 {
        font-size: 1.5rem !important; /* Dimensione h2 */
        font-weight: bold !important;
    }

    /* Hero section estesa fino alla navbar su mobile */
    #hero {
        padding: 60px 15px 5rem 15px !important; /* Padding bottom aumentato per navbar */
        height: 100vh !important; /* Altezza piena dello schermo */
        min-height: 100vh !important;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
    }

    /* modifica a caso */

    .hero-logo {
        display: block !important;
        width: 150px !important;
        height: auto !important;
        margin-bottom: 0 !important;
        filter: brightness(0) invert(1) !important;
    }

    #hero h1 {
        width: 100%;
        max-width: 100%;
        margin-bottom: 3rem !important;
    }

    #hero .epigrafe {
        width: 100%;
        max-width: 100%;
        margin-bottom: 5rem !important;
    }

    #hero #CV {
        width: 100%;
        max-width: 100%;
    }

    /* Case studies su mobile */
    #case-studies {
        padding: 15px !important;
        justify-content: center;
    }

    .case-study h2 {
        font-size: 1rem !important;
    }

    /* Lists (competenze) su mobile - 2 colonne */
    .lists {
        grid-template-columns: 1fr 1fr !important; /* 2 colonne: sinistra Design, destra Programmazione */
        gap: 1rem;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .lists ul {
        padding-left: 1.5rem !important;
        width: 100%;
        box-sizing: border-box;
        text-align: left !important; /* Allineato a sinistra */
        list-style-position: outside; /* Pallini fuori per elenco a sinistra */
        margin-top: 0 !important; /* Rimuove margin top */
    }

    .lists p {
        text-align: left !important; /* Titolo liste allineato a sinistra */
        margin-bottom: 0.5rem !important; /* Riduce spazio sotto il titolo */
    }

    /* Overlay disabilitato anche su mobile */
    .overlay {
        display: none !important;
    }
}

/* Tablet (768px - 1400px) */
@media (min-width: 768px) and (max-width: 1400px) {
    html {
        font-size: 15px; /* 1rem = 15px su tablet */
    }

    /* Nascondi break mobile su tablet */
    .mobile-br {
        display: none;
    }

    /* Mostra pipe su tablet */
    .mobile-hide {
        display: inline;
    }
    
    h1 {
        font-size: 2.5rem; /* 37.5px */
    }
    
    h2 {
        font-size: 1.35rem; /* 20.25px */
    }

    h3 {
        font-size: 1.15rem;
    }
    
    body {
        font-size: 1rem; /* 15px */
    }

    /* Hero ridotto su tablet */
    #hero {
        height: 50vh !important;
        padding: 60px 20px !important;
        overflow: hidden !important;
    }

    /* Case studies su tablet - 2x2 dentro lo schermo */
    #case-studies {
        display: grid;
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: repeat(2, auto);
        gap: 20px;
        padding: 30px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .case-study {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .preview {
        width: 100%;
        max-width: 350px;
        height: 200px;
        border-radius: 8px;
    }

    .case-study h2 {
        font-size: 1.1rem !important;
        margin-top: 0.75rem;
        text-align: center;
    }

    /* Archivio su tablet - 4 colonne con immagini rettangolari verticali */
    #archivio {
        grid-template-columns: repeat(4, 1fr) !important;
        grid-template-rows: repeat(4, 350px); /* Altezza maggiore per forma rettangolare */
        padding: 20px !important;
        gap: 12px !important; /* Gap visibile tra immagini */
        justify-content: center;
        max-width: 100%;
        margin: 0 auto;
    }

    .rettangolo {
        width: 100%;
        height: 100%;
    }

    .rettangolo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* Container su tablet - layout a due colonne + row per competenze */
    #container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto auto auto auto;
        column-gap: 2rem;
        row-gap: 0;
        margin: 2.5rem auto;
        padding: 0 2rem;
        max-width: 100%;
    }

    /* Colonna sinistra - About (titolo) */
    .me h1 {
        grid-column: 1;
        grid-row: 1;
        text-align: center !important;
        width: 100%;
        margin: 0 0 1rem 0;
    }

    /* Nascondi data di nascita su tablet */
    .me > p:not(.bio-text) {
        display: none;
    }

    /* Colonna sinistra - About (bio) */
    .me .bio-text {
        grid-column: 1;
        grid-row: 2 / 5;
        text-align: justify !important;
        width: 100%;
        padding: 0;
        margin: 0;
        align-self: start;
    }

    /* Colonna destra, riga 1-2 - Formazione section */
    .formazione-section {
        grid-column: 2;
        grid-row: 1 / 3;
        text-align: left !important;
        width: 100%;
        align-self: start;
        margin-bottom: 2rem;
    }

    .formazione-section h3 {
        font-size: 1.5rem !important;
        color: #8A2BE2;
        margin: 0 0 1rem 0;
        text-align: center !important;
    }

    .formazione-section ul {
        list-style-position: inside;
        padding-left: 0;
        margin: 0;
        text-align: center !important;
    }

    .formazione-section ul li {
        margin-bottom: 1rem;
    }

    /* Colonna destra, riga 3-4 - Certificazioni section */
    .certificazioni-section {
        grid-column: 2;
        grid-row: 3 / 5;
        text-align: left !important;
        width: 100%;
        align-self: start;
    }

    .certificazioni-section h2 {
        font-size: 1.5rem !important;
        color: #8A2BE2;
        margin: 0 0 1rem 0;
        text-align: center !important;
    }

    .certificazioni-section .certificazioni-list {
        display: block !important;
        list-style-position: inside !important;
        padding-left: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        text-align: center !important;
    }

    .certificazioni-list li {
        display: list-item !important;
        text-align: center !important;
        margin-bottom: 1rem !important;
    }

    /* Row 5 completa - Competenze Tecniche titolo */
    .me .titolo-competenze {
        grid-column: 1 / 3;
        grid-row: 5;
        text-align: center !important;
        margin: 2rem 0 1rem 0;
        width: 100%;
    }

    /* Row 6 completa - Competenze Tecniche liste */
    .lists {
        grid-column: 1 / 3;
        grid-row: 6;
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        width: 100%;
        max-width: 80%;
        margin: 0 auto !important;
    }

    .lists ul {
        list-style-position: outside;
        padding-left: 1.5rem;
        margin-left: auto;
        margin-right: auto;
        width: fit-content;
        text-align: left;
    }

    /* Nascondi elementi non necessari */
    .me {
        display: contents;
    }

    .contact-info {
        display: none;
    }

    /* Break visibili solo su tablet per formazione */
    .tablet-br {
        display: inline;
    }

    .tablet-hide {
        display: none;
    }

    /* Certificazioni su tablet con br */
    .me .titolo-certificazioni ~ p {
        display: inline-block;
        width: 48%;
        text-align: left !important;
        vertical-align: top;
        margin: 0;
        padding: 0;
    }

    .me .titolo-competenze {
        clear: both;
        display: block;
        width: 100%;
        margin-top: 3rem;
        margin-bottom: 1rem;
    }

    .contact-info {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .contact-info h2 {
        text-align: center !important;
    }

    .contact-info p,
    .contact-info .social-media {
        text-align: center !important;
    }

    /* Lists (competenze) su tablet */
    .lists {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
        width: 80%;
        margin: 0 auto;
        padding: 0 !important;
    }

    /* Navbar su tablet */
    .navbar {
        width: 50%;
    }

    /* Contatti su tablet */
    #contatti {
        text-align: center !important;
        padding: 3rem 2rem !important;
        margin: 0 auto !important;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #contatti h2 {
        text-align: center !important;
        margin-bottom: 2rem !important;
    }

    .contatti-row {
        display: grid !important;
        grid-template-columns: auto auto !important;
        gap: 2rem !important;
        justify-content: center !important;
        margin-bottom: 1rem !important;
    }

    .contatti-row p {
        text-align: center !important;
        margin: 0 !important;
    }

    #contatti .social-media {
        text-align: center !important;
        margin-top: 1rem !important;
    }

    /* Footer su tablet */
    .footer {
        height: 1rem !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 2rem !important;
        margin-top: 5rem !important;
    }

    .footer-links {
        margin-bottom: 0 !important;
    }

    .footer-copyright {
        margin: 0 !important;
    }

    /* Back Arrow Tablet Styles for Case Studies */
    .back-arrow {
        top: auto;
        bottom: 1.5rem;
        left: auto;
        right: 1.5rem;
    }

    /* Hide Footer in Case Studies on Tablet */
    body.case-study-page footer,
    body.case-study-page-2 footer,
    body.case-study-page-3 footer,
    body.case-study-page-4 footer {
        display: none !important;
    }

    /* Case Study 1 Tablet Styles */
    body.case-study-page #content-section h1,
    body.case-study-page #content-section p,
    body.case-study-page #content-section a,
    body.case-study-page .text-content > p:first-of-type,
    body.case-study-page .descrizione-casestudy {
        text-align: center !important;
    }

    body.case-study-page .case-study-link {
        display: block !important;
        text-align: center !important;
        margin-top: 1rem;
    }

    body.case-study-page .text-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    body.case-study-page .text-content p {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    /* Case Study 2 Tablet Styles */
    body.case-study-page-2 #content-section h1,
    body.case-study-page-2 #content-section p,
    body.case-study-page-2 #content-section a,
    body.case-study-page-2 .text-content > p:first-of-type,
    body.case-study-page-2 .descrizione-casestudy {
        text-align: center !important;
    }

    body.case-study-page-2 #content-section h2 {
        display: none !important;
    }

    body.case-study-page-2 .text-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    body.case-study-page-2 .text-content p {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    body.case-study-page-2 > section > .descrizione-casestudy,
    body.case-study-page-2 #content-section > .descrizione-casestudy {
        text-align: justify !important;
        max-width: 90%;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Case Study 4 Tablet Styles */
    body.case-study-page-4 #content-section h1,
    body.case-study-page-4 #content-section a,
    body.case-study-page-4 .text-content > p:first-of-type {
        text-align: center !important;
    }

    body.case-study-page-4 .descrizione-casestudy {
        text-align: left !important;
        max-width: 90%;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    body.case-study-page-4 .case-study-link-4 {
        text-align: center !important;
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
        margin-top: 2rem !important;
    }

    body.case-study-page-4 .text-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    body.case-study-page-4 .text-content p {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    body.case-study-page-4 .carousel-container-4 {
        width: 100%;
        height: auto;
        margin-top: 2rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body.case-study-page-4 .carousel-4 {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        width: 100%;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        gap: 0;
    }

    body.case-study-page-4 .carousel-4-img {
        width: 100%;
        height: auto;
        max-height: 50vh;
        object-fit: contain;
        border: 2px solid #8A2BE2;
        border-radius: 0;
        cursor: pointer;
        flex-shrink: 0;
        scroll-snap-align: center;
        display: block;
    }
}

/* Desktop (1400px+) - valori di default già impostati */
@media (min-width: 1400px) {
    html {
        font-size: 16px; /* 1rem = 16px su desktop */
    }

    /* Nascondi break mobile su desktop */
    .mobile-br {
        display: none;
    }

    /* Mostra pipe su desktop */
    .mobile-hide {
        display: inline;
    }

    /* Nascondi break tablet su desktop */
    .tablet-br {
        display: none;
    }

    .tablet-hide {
        display: inline;
    }

    /* Case studies centrato su desktop */
    #case-studies {
        padding-left: 10vw !important;
        padding-right: 10vw !important;
        max-width: 100vw !important;
        margin: 0 auto !important;
    }

    .case-study {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 auto !important;
    }

    /* Layout About su desktop - come tablet */
    #container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto auto auto auto;
        column-gap: 3rem;
        row-gap: 0;
        margin: 3rem auto;
        padding: 0 10vw;
        max-width: 100%;
    }

    .me {
        display: contents;
    }

    .me h1 {
        grid-column: 1;
        grid-row: 1;
        text-align: center !important;
        margin: 0 0 2rem 0;
    }

    .me > p:not(.bio-text) {
        display: none;
    }

    .me .bio-text {
        grid-column: 1;
        grid-row: 2 / 5;
        text-align: justify !important;
        padding: 0;
        margin: 0;
        align-self: start;
    }

    .formazione-section {
        grid-column: 2;
        grid-row: 1 / 3;
        text-align: left !important;
        align-self: start;
        margin-bottom: 3rem;
    }

    .formazione-section h3 {
        font-size: 1.5rem !important;
        color: #8A2BE2;
        margin: 0 0 2rem 0;
        text-align: center !important;
    }

    .formazione-section ul {
        list-style-position: inside;
        padding-left: 0;
        margin: 0;
        text-align: center !important;
    }

    .formazione-section ul li {
        margin-bottom: 1.5rem;
    }

    .certificazioni-section {
        grid-column: 2;
        grid-row: 3 / 5;
        text-align: left !important;
        align-self: start;
    }

    .certificazioni-section h2 {
        font-size: 1.5rem !important;
        color: #8A2BE2;
        margin: 0 0 2rem 0;
        text-align: center !important;
    }

    .certificazioni-section .certificazioni-list {
        display: block !important;
        list-style-position: inside !important;
        padding-left: 0 !important;
        margin: 0 !important;
        text-align: center !important;
    }

    .certificazioni-list li {
        display: list-item !important;
        text-align: center !important;
        margin-bottom: 1rem !important;
    }

    .me .titolo-competenze {
        grid-column: 1 / 3;
        grid-row: 5;
        text-align: center !important;
        margin: 3rem 0 2rem 0;
    }

    .lists {
        grid-column: 1 / 3;
        grid-row: 6;
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
        width: 100%;
        max-width: 80%;
        margin: 0 auto !important;
    }

    .lists ul {
        list-style-position: outside;
        padding-left: 1.5rem;
        margin-left: auto;
        margin-right: auto;
        width: fit-content;
        text-align: left;
    }

    .contact-info {
        display: none;
    }

    /* Archivio su desktop */
    #archivio {
        grid-template-columns: repeat(4, 1fr) !important;
        grid-template-rows: repeat(4, 450px) !important;
        padding: 3rem 10vw !important;
        gap: 20px !important;
        max-width: 100vw !important;
        margin: 0 auto !important;
    }

    .rettangolo {
        width: 100%;
        height: 100%;
    }

    .rettangolo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* Contatti su desktop */
    #contatti {
        text-align: center !important;
        padding: 3rem 10vw !important;
        margin: 0 auto !important;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #contatti h2 {
        text-align: center !important;
        margin-bottom: 2rem !important;
    }

    .contatti-row {
        display: grid !important;
        grid-template-columns: auto auto !important;
        gap: 2rem !important;
        justify-content: center !important;
        margin-bottom: 1rem !important;
    }

    .contatti-row p {
        text-align: center !important;
        margin: 0 !important;
    }

    #contatti .social-media {
        text-align: center !important;
        margin-top: 1rem !important;
    }

    /* Navbar fixed in basso su desktop con transizione */
    .navbar {
        position: fixed !important;
        top: auto !important;
        bottom: 2rem !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 1000 !important;
        background-color: rgba(138, 43, 226, 0.15) !important;
        backdrop-filter: blur(10px) !important;
        transition: background-color 0.3s ease, backdrop-filter 0.3s ease !important;
        width: 30% !important;
    }

    .navbar.scrolled {
        background-color: #4a167be7 !important;
    }

    /* Footer su desktop */
    .footer {
        height: 2rem !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 10vw !important;
        margin-top: 5rem !important;
    }

    .footer-links {
        margin-bottom: 0 !important;
    }

    .footer-copyright {
        margin: 0 !important;
    }

    /* Desktop Case Studies Styles */
    /* Back Arrow Desktop - Top Right */
    body.case-study-page .back-arrow,
    body.case-study-page-2 .back-arrow,
    body.case-study-page-3 .back-arrow,
    body.case-study-page-4 .back-arrow {
        top: 1.5rem;
        bottom: auto;
        left: auto;
        right: 1.5rem;
    }

    /* Case Study 1 Desktop */
    body.case-study-page {
        overflow: hidden !important;
        height: 100vh !important;
    }

    body.case-study-page .menu-container,
    body.case-study-page .desktop-navbar-container {
        display: none !important;
    }

    body.case-study-page footer {
        display: none !important;
    }

    body.case-study-page #content-section {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto auto !important;
        gap: 2rem !important;
        padding: 5rem 3rem 5rem 3rem !important;
        height: 100vh !important;
        align-items: start !important;
    }

    body.case-study-page .content-container {
        grid-column: 1 !important;
        grid-row: 1 / 3 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: flex-start !important;
    }

    body.case-study-page .text-content {
        text-align: left !important;
    }

    body.case-study-page #content-section h1,
    body.case-study-page .text-content > p:first-of-type,
    body.case-study-page .descrizione-casestudy {
        text-align: left !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body.case-study-page .preview-image-container {
        grid-column: 2 !important;
        grid-row: 1 / 3 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: auto !important;
        gap: 2rem !important;
    }

    body.case-study-page .preview-image {
        max-width: 100% !important;
        max-height: 70vh !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain !important;
        cursor: pointer !important;
    }

    body.case-study-page .case-study-link {
        text-align: center !important;
        display: block !important;
        margin: 0 !important;
    }

    /* Case Study 2 Desktop */
    body.case-study-page-2 {
        overflow: visible !important;
        height: auto !important;
        min-height: auto !important;
    }

    body.case-study-page-2 .menu-container,
    body.case-study-page-2 .desktop-navbar-container {
        display: none !important;
    }

    body.case-study-page-2 footer {
        display: none !important;
    }

    body.case-study-page-2 #content-section {
        padding: 5rem 3rem !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 2rem !important;
    }

    body.case-study-page-2 .text-columns {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 2rem !important;
    }

    body.case-study-page-2 .content-container {
        text-align: left !important;
    }

    body.case-study-page-2 .text-content {
        text-align: left !important;
    }

    body.case-study-page-2 #content-section h1,
    body.case-study-page-2 .text-content > p {
        text-align: left !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body.case-study-page-2 #content-section h1 {
        margin-top: 0 !important;
    }

    body.case-study-page-2 .description-column {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: flex-start !important;
    }

    body.case-study-page-2 .descrizione-casestudy {
        text-align: left !important;
        margin: 0 !important;
    }

    body.case-study-page-2 .video-container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    body.case-study-page-2 .carousel-container {
        width: 100% !important;
        margin: 0 !important;
        display: block !important;
        overflow: visible !important;
        padding-bottom: 3rem !important;
    }

    body.case-study-page-2 .carousel {
        display: flex !important;
        gap: 1rem !important;
        overflow-x: auto !important;
    }

    body.case-study-page-2 .carousel img {
        width: auto !important;
        height: 300px !important;
        object-fit: contain !important;
        border: 2px solid #8A2BE2 !important;
        cursor: pointer !important;
    }

    body.case-study-page-2 h2 {
        display: none !important;
    }

    /* Case Study 3 Desktop */
    body.case-study-page-3 {
        overflow: visible !important;
        height: auto !important;
        min-height: auto !important;
    }

    body.case-study-page-3 .menu-container,
    body.case-study-page-3 .desktop-navbar-container {
        display: none !important;
    }

    body.case-study-page-3 footer {
        display: none !important;
    }

    body.case-study-page-3 #content-section {
        padding: 5rem 3rem !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto 1fr !important;
        gap: 2rem !important;
    }

    body.case-study-page-3 .content-container {
        grid-column: 1 !important;
        grid-row: 1 !important;
        text-align: left !important;
    }

    body.case-study-page-3 .video-preview-vertical {
        grid-column: 2 !important;
        grid-row: 1 !important;
        width: 100% !important;
        height: auto !important;
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important;
    }

    body.case-study-page-3 .media-grid-container {
        display: none !important;
    }

    body.case-study-page-3 .images-grid-3 {
        grid-column: 1 / 3 !important;
        grid-row: 2 !important;
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
        width: 100% !important;
        padding-bottom: 3rem !important;
    }

    body.case-study-page-3 .desktop-top-section {
        display: none !important;
    }

    body.case-study-page-3 .text-content {
        text-align: left !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
    }

    body.case-study-page-3 #content-section h1,
    body.case-study-page-3 .text-content > p,
    body.case-study-page-3 .descrizione-casestudy {
        text-align: left !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body.case-study-page-3 #content-section h1 {
        margin-top: 0 !important;
    }

    body.case-study-page-3 .video-preview-vertical {
        width: 100% !important;
        height: auto !important;
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important;
    }

    body.case-study-page-3 .video-preview-vertical video {
        width: auto !important;
        height: 60vh !important;
        max-width: 40vw !important;
        object-fit: cover !important;
        aspect-ratio: 9/16 !important;
    }

    body.case-study-page-3 .images-grid-3 {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
        width: 100% !important;
        padding-bottom: 3rem !important;
    }

    body.case-study-page-3 .grid-img-3 {
        width: 100% !important;
        height: 40vh !important;
        object-fit: cover !important;
        aspect-ratio: 9/16 !important;
        border: 2px solid #8A2BE2 !important;
        cursor: pointer !important;
    }

    body.case-study-page-3 .media-grid-container,
    body.case-study-page-3 .carousel-container,
    body.case-study-page-3 h2 {
        display: none !important;
    }

    /* Case Study 4 Desktop */
    body.case-study-page-4 {
        overflow: visible !important;
        height: auto !important;
        min-height: auto !important;
    }

    body.case-study-page-4 .menu-container,
    body.case-study-page-4 .desktop-navbar-container {
        display: none !important;
    }

    body.case-study-page-4 footer {
        display: none !important;
    }

    body.case-study-page-4 #content-section {
        padding: 5rem 3rem !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 2rem !important;
    }

    body.case-study-page-4 .content-container {
        text-align: left !important;
    }

    body.case-study-page-4 .text-content {
        text-align: left !important;
    }

    body.case-study-page-4 #content-section h1,
    body.case-study-page-4 .text-content > p,
    body.case-study-page-4 .descrizione-casestudy {
        text-align: left !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body.case-study-page-4 #content-section h1 {
        margin-top: 0 !important;
    }

    body.case-study-page-4 .carousel-container-4 {
        width: 100% !important;
        margin: 2rem 0 !important;
        overflow: visible !important;
        display: flex !important;
        justify-content: center !important;
    }

    body.case-study-page-4 .carousel-4 {
        display: flex !important;
        overflow-x: auto !important;
        scroll-behavior: smooth !important;
        scroll-snap-type: x mandatory !important;
        gap: 0 !important;
        width: auto !important;
        max-width: 100% !important;
    }

    body.case-study-page-4 .carousel-4-img {
        width: auto !important;
        height: 60vh !important;
        object-fit: contain !important;
        flex-shrink: 0 !important;
        scroll-snap-align: center !important;
        border: 2px solid #8A2BE2 !important;
        cursor: pointer !important;
    }

    body.case-study-page-4 .case-study-link-4 {
        text-align: left !important;
        display: block !important;
        margin: 1rem 0 0 0 !important;
    }
}

/* Mobile molto piccoli (320px - 480px) */
@media (max-width: 480px) {
    html {
        font-size: 13px; /* Ancora più piccolo per smartphone compatti */
    }

    #archivio {
        grid-template-columns: repeat(3, 1fr) !important; /* 3 colonne anche su schermi piccoli */
        grid-template-rows: repeat(5, 170px); /* 5 righe con altezza ottimizzata per piccoli schermi */
        padding: 12px !important; /* Padding laterale visibile */
        gap: 6px !important; /* Gap visibile tra immagini */
        max-width: 100%;
        margin: 0 auto;
    }

    .rettangolo {
        width: 100%;
        height: 100%;
    }

    .navbar {
        width: 85% !important; /* Navbar più larga su schermi molto piccoli */
        padding: 0.75rem 0.6rem !important;
    }

    .navbar a {
        padding: 0.4rem !important;
    }

    .navbar a::before {
        width: 1.25rem !important;
        height: 1.25rem !important;
    }

    h1 {
        font-size: 1.75rem; /* Titolo più piccolo */
    }
}