/* ==========================================================================
   RESET & SYSTEM TOKENS
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Tavolozza Glassmorphism per l'Header */
    --header-glass-bg: rgba(255, 255, 255, 0.65);
    --header-glass-scrolled: rgba(255, 255, 255, 0.85);
    --header-border: rgba(255, 255, 255, 0.4);
    --header-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);

    /* Responsive Drawer Mobile Glassmorphism */
    --mobile-drawer-bg: rgba(15, 16, 22, 0.82);
    --mobile-drawer-border: rgba(255, 255, 255, 0.15);

    /* Colori Identitari e Accenti */
    --brand-dark: #1a1a2e;
    --brand-accent: #ff7e5f;
    --brand-accent-hover: #feb47b;
    --brand-blue: #0056b3;

    /* Timing per Animazioni */
    --ease-out-cubic: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: 0.25s var(--ease-out-cubic);
    --transition-normal: 0.4s var(--ease-out-cubic);
}

body.no-scroll {
    overflow: hidden !important;
}

/* ==========================================================================
   SITE HEADER (Sticky + Glassmorphism Dynamic)
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--header-glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--header-shadow);
    transition: transform 0.4s var(--ease-out-cubic), 
                background 0.3s ease, 
                box-shadow 0.3s ease;
    will-change: transform, background;
}

/* Stato allo scroll (maggiore opacità per contrasto durante la lettura) */
.site-header.scrolled {
    background: var(--header-glass-scrolled);
    box-shadow: 0 12px 40px -10px rgba(0, 0, 0, 0.15);
}

/* Header Auto-Hide allo scroll verso il basso */
.site-header.header-hidden {
    transform: translateY(-100%);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 5%;
    max-width: 1300px;
    margin: 0 auto;
}

/* Logo con Micro-Interazione */
.logo {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.logo img {
    height: 55px;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.logo:hover img {
    transform: scale(1.04);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

/* ==========================================================================
   DESKTOP NAVIGATION (Hover Underline & Active Link)
   ========================================================================== */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 2.2rem;
    align-items: center;
}

.nav-item {
    position: relative;
}

.nav-link {
    text-decoration: none;
    color: var(--brand-dark);
    font-weight: 600;
    font-size: 1.05rem;
    padding: 8px 0;
    position: relative;
    transition: color 0.3s ease;
    display: inline-block;
}

/* Tratto Sottostante Animato (Underline) */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-accent), var(--brand-accent-hover));
    border-radius: 4px;
    transition: width 0.35s var(--ease-out-cubic);
}

.nav-link:hover {
    color: var(--brand-accent);
}

.nav-link:hover::after {
    width: 100%;
}

/* Pagina Attiva (Active Link Status) */
.nav-link.active-link {
    color: var(--brand-accent);
    font-weight: 700;
}

.nav-link.active-link::after {
    width: 100%;
}

/* ==========================================================================
   HAMBURGER BUTTON (Morphing Animation to "X")
   ========================================================================== */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    cursor: pointer;
    z-index: 1010;
    background: transparent;
    border: none;
    outline: none;
}

.hamburger .bar {
    width: 100%;
    height: 3px;
    background-color: var(--brand-dark);
    border-radius: 3px;
    transition: transform 0.35s var(--ease-out-cubic), 
                opacity 0.25s ease, 
                background-color 0.3s ease;
    transform-origin: left center;
}

/* Morphing in "X" al click */
.hamburger.is-active .bar:nth-child(1) {
    transform: rotate(45deg) translate(2px, -1px);
    background-color: #ffffff;
}

.hamburger.is-active .bar:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.hamburger.is-active .bar:nth-child(3) {
    transform: rotate(-45deg) translate(2px, 1px);
    background-color: #ffffff;
}

/* Sfondo Scurito e Sfocato (Mobile Backdrop) */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    z-index: 1001;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   RESPONSIVE MOBILE DRAWER (Glassmorphic Slide-in & Staggered Items)
   ========================================================================== */
@media (max-width: 820px) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 380px;
        height: 100vh;
        background: var(--mobile-drawer-bg);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        border-left: 1px solid var(--mobile-drawer-border);
        box-shadow: -15px 0 35px rgba(0, 0, 0, 0.4);
        
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        z-index: 1005;
        
        transition: right 0.45s cubic-bezier(0.77, 0, 0.175, 1);
        padding: 2rem;
    }

    /* Apertura Menu Mobile */
    .nav-menu.active {
        right: 0;
    }

    /* Stile e Colori dei Link dentro il Drawer Scuro */
    .nav-menu .nav-link {
        color: rgba(255, 255, 255, 0.85);
        font-size: 1.4rem;
        font-weight: 500;
        letter-spacing: 0.5px;
        opacity: 0;
        transform: translateX(30px);
        transition: opacity 0.3s ease, transform 0.4s var(--ease-out-cubic), color 0.3s ease;
    }

    .nav-menu .nav-link:hover,
    .nav-menu .nav-link.active-link {
        color: var(--brand-accent);
    }

    /* Animazione Sequenziale (Staggered Entrance) dei link al click dell'hamburger */
    .nav-menu.active .nav-link {
        opacity: 1;
        transform: translateX(0);
    }

    .nav-menu.active .nav-item:nth-child(1) .nav-link { transition-delay: 0.15s; }
    .nav-menu.active .nav-item:nth-child(2) .nav-link { transition-delay: 0.22s; }
    .nav-menu.active .nav-item:nth-child(3) .nav-link { transition-delay: 0.29s; }
    .nav-menu.active .nav-item:nth-child(4) .nav-link { transition-delay: 0.36s; }
}




/* ==========================================================================
   FOOTER STYLES (Glassmorphism & Clean Grid)
   ========================================================================== */
.site-footer {
    background: rgba(15, 16, 22, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8f9fa;
    padding: 60px 8% 25px;
    margin-top: auto;
    font-family: 'Tenor Sans', sans-serif, system-ui, -apple-system;
}

.footer-container {
    max-width: 1300px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand h3 {
    font-size: 1.8rem;
    font-weight: 400;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #ff7e5f, #feb47b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.footer-brand p, 
.footer-contact p {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 10px;
}

.footer-links-group h4, 
.footer-contact h4 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.footer-links-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links-group li {
    margin-bottom: 12px;
}

.footer-links-group a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: color 0.3s ease, transform 0.3s ease;
    display: inline-block;
}

.footer-links-group a:hover {
    color: #ff7e5f;
    transform: translateX(4px);
}

.footer-bottom {
    max-width: 1300px;
    margin: 30px auto 0;
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   RESPONSIVE FOOTER
   ========================================================================== */
@media (max-width: 768px) {
    .site-footer {
        padding: 40px 5% 20px;
    }
    
    .footer-container {
        gap: 30px;
        text-align: center;
    }

    .footer-links-group a:hover {
        transform: none; /* Disattiva lo shift laterale su mobile per pulizia */
    }
}