/* Header Base */
.custom-site-header {
    background-color: var(--principale);
    padding: 10px 0;
    position: relative;
    z-index: 1000;
}

.custom-header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    /*justify-content: space-between;*/
    justify-content: center;
    align-items: center;
    position: relative;
}

.custom-header-container a,
.custom-header-container h1 {
    font-size: 26px !important;
    font-weight: bold !important;
}

.custom-menu .menu-item {
    margin: 0 20px;
    width: max-content;
}

.menu-item-spacing > div,
.menu-item > div {
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 1.2rem;
} 

.custom-menu .menu-item a,
.custom-menu .menu-item h1 {
    color: #2c1810;
    text-decoration: none;
    font-size: 1.2rem !important;
    font-weight: 500;
    letter-spacing: 1px;
    transition: opacity 0.3s ease;
}

.custom-menu .menu-item a:hover {
    color: var(--testo);
    opacity: 0.5;
    transition: all .2s linear;
}

/* Brand/Logo */
.header-brand {
    margin-right: 35px;
    flex-shrink: 0;
}

.header-brand h1,
.custom-header-container h1 {
    font-size: 26px !important;
    font-weight: bold !important;
    margin: 0;
    line-height: 1.2;
}

.fix-logo-subtitle {
    font-size: 16px !important;
    font-weight: normal !important;
    opacity: 0.9;
}

/* Hamburger Menu (nascosto su desktop) */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background-color: #2c1810;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Hamburger animazione quando attivo */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Navigation */
.custom-navigation {
    max-width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

.custom-menu {
    width: 100%;
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    /*justify-content: center;*/
    justify-content: space-between;
    /*flex-wrap: wrap;*/
}

.custom-menu .menu-item-spacing {
    margin-left: 20vw;
}

.custom-menu .menu-item a {
    color: #2c1810;
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    display: block;
    padding: 10px 0;
}

.custom-menu .menu-item a:hover {
    color: var(--testo);
    opacity: 0.7;
}

.custom-menu .menu-item a.selected {
    color: #fff;
    border-bottom: 2px solid #fff;
}

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .custom-menu .menu-item-spacing {
        margin-left: 10vw;
    }
    
    .custom-menu .menu-item {
        margin: 0 15px;
    }
    
    .custom-menu .menu-item a {
        font-size: 16px;
    }
}

/* Mobile (fino a 768px) */
@media (max-width: 768px) {
    
    .menu-item-spacing > div, 
    .menu-item > div {
        flex-direction: column;    
    }
    .custom-header-container {
        flex-direction: row;
        justify-content: space-between;
        padding: 0 15px;
    }
    
    .header-brand h1 {
        font-size: 20px !important;
    }
    
    .fix-logo-subtitle {
        font-size: 14px !important;
    }
    
    /* Mostra hamburger menu */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Menu mobile */
    .custom-navigation {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: var(--principale);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
    }
    
    .custom-navigation.active {
        transform: translateX(0);
    }
    
    .custom-menu {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        height: 100%;
        gap: 30px;
    }
    
    .custom-menu .menu-item {
        margin: 0;
        opacity: 0;
        transform: translateY(20px);
        transition: all 0.3s ease;
    }
    
    .custom-navigation.active .custom-menu .menu-item {
        opacity: 1;
        transform: translateY(0);
    }
    
    /* Stagger animation per le voci del menu */
    .custom-navigation.active .custom-menu .menu-item:nth-child(1) {
        transition-delay: 0.1s;
    }
    
    .custom-navigation.active .custom-menu .menu-item:nth-child(2) {
        transition-delay: 0.2s;
    }
    
    .custom-navigation.active .custom-menu .menu-item:nth-child(3) {
        transition-delay: 0.3s;
    }
    
    .custom-navigation.active .custom-menu .menu-item:nth-child(4) {
        transition-delay: 0.4s;
    }
    
    .custom-menu .menu-item-spacing {
        margin-left: 0;
    }
    
    .custom-menu .menu-item a {
        font-size: 24px;
        padding: 15px 0;
        color: #2c1810;
    }
    
    .custom-menu .menu-item a:hover {
        color: #fff;
    }
}

/* Mobile piccolo (fino a 480px) */
@media (max-width: 480px) {
    .custom-header-container {
        padding: 0 10px;
    }
    
    .header-brand h1 {
        font-size: 18px !important;
    }
    
    .fix-logo-subtitle {
        font-size: 12px !important;
    }
    
    .custom-menu .menu-item a {
        font-size: 20px;
    }
}

/* Overlay per chiudere il menu mobile */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Previeni scroll quando il menu mobile è aperto */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}