/* =========================================
   1. VARIABILI & RESET (BASE)
   ========================================= */
:root {
    --bg-color: #0f1115;       
    --text-main: #e0e0e0;      
    --active-theme: #ffffff;
    --active-theme-rgb: 255, 255, 255;
    --nav-height: 80px;
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Roboto', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: default; 
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow-x: hidden; /* Evita scroll orizzontale */
}

a { text-decoration: none; color: inherit; transition: 0.3s; cursor: pointer; }
ul { list-style: none; }
button { cursor: pointer; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* =========================================
   2. NAVBAR & MENU DESKTOP
   ========================================= */
.navbar {
    position: fixed; top: 0; left: 0; width: 100%;
    height: var(--nav-height);
    background: rgba(15, 17, 21, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    border-bottom: 1px solid rgba(255,255,255, 0.05);
}

.nav-content { display: flex; justify-content: space-between; align-items: center; height: 100%; }

.logo { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; color: white; }
.logo .dot { color: var(--active-theme); }

.nav-links { display: flex; gap: 30px; align-items: center; }
.nav-links a { font-size: 0.9rem; font-weight: 500; text-transform: uppercase; color: var(--text-main); }
.nav-links a:hover { color: var(--active-theme); }

/* Bottone Contatti Desktop */
.btn-contact { 
    border: 1px solid var(--active-theme); 
    padding: 8px 20px; 
    border-radius: 4px; 
    color: var(--active-theme) !important; 
    transition: 0.3s;
}
.btn-contact:hover { background: var(--active-theme); color: black !important; }

/* Icona Hamburger (Nascosta su Desktop) */
.hamburger { display: none; color: white; font-size: 1.5rem; }

/* --- DROPDOWN DESKTOP --- */
.dropdown-parent { position: relative; height: 100%; display: flex; align-items: center; }

.dropdown-menu {
    position: absolute;
    top: 100%; left: -20px;
    background: #1a1d24;
    width: 240px;
    padding: 15px 0;
    border-radius: 0 0 8px 8px;
    border: 1px solid rgba(255,255,255,0.1); border-top: none;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    
    /* Stato Iniziale (Nascosto) */
    opacity: 0; visibility: hidden; transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000; 
}

/* Hover Desktop */
.dropdown-parent:hover .dropdown-menu {
    opacity: 1; visibility: visible; transform: translateY(0);
}

.dropdown-menu li a {
    display: block; padding: 12px 25px;
    color: #a0a0a0; font-size: 0.9rem;
    border-left: 3px solid transparent;
}

.dropdown-menu li:hover a {
    background: rgba(255,255,255,0.05);
    color: white; padding-left: 35px;
    border-left-color: var(--item-color, white);
}

/* =========================================
   3. HERO & SEZIONI
   ========================================= */
.hero {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    position: relative; padding-top: 80px;
}

/* Animazione Testo Hero */
.hero h1 { 
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 5vw, 4.5rem); /* Adatta dimensione */
    line-height: 1.1; margin-bottom: 20px; color: white;
}
.tagline { display: inline-block; border-bottom: 2px solid; padding-bottom: 5px; margin-bottom: 1rem; font-weight: 700; letter-spacing: 2px; }

/* Scroll Down Arrow */
.hero-scroll-down { margin-top: 50px; opacity: 0.7; }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 40% {transform: translateY(-10px);} 60% {transform: translateY(-5px);} }

/* Sezioni Settori */
.sector-section { min-height: 100vh; display: flex; align-items: center; padding: 100px 20px; position: relative; z-index: 1; }
.sector-content { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 50px; align-items: center; }

.sector-label { font-size: 0.8rem; font-weight: 700; letter-spacing: 4px; display: block; margin-bottom: 10px; opacity: 0.8; }
.sector-text h2 { font-size: clamp(2rem, 4vw, 3.5rem); font-family: var(--font-heading); margin-bottom: 20px; color: white; }
.tech-subtitle { font-size: 1.5rem; color: white; font-weight: 300; margin-bottom: 20px; border-left: 2px solid rgba(255,255,255,0.2); padding-left: 15px; }
.tech-desc { font-size: 1rem; color: #a0a0a0; margin-bottom: 30px; line-height: 1.6; }
.tech-list li { color: #e0e0e0; margin-bottom: 15px; display: flex; align-items: center; gap: 15px; font-size: 1.1rem; }

.btn-outline { background: transparent; border: 1px solid; padding: 12px 30px; border-radius: 4px; font-weight: 600; text-transform: uppercase; cursor: pointer; display: inline-block; transition: 0.3s; }
.btn-outline:hover { background: rgba(255,255,255,0.1); }

/* Icona Settore */
.sector-visual-clean { display: flex; justify-content: center; align-items: center; height: 100%; }
.icon-box { width: 200px; height: 200px; border: 1px solid; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 4rem; background: rgba(0,0,0,0.2); backdrop-filter: blur(5px); }

/* =========================================
   4. RECENSIONI (SCROLL INFINITO FIX)
   ========================================= */
.reviews-section {
    padding: 50px 0;
    background: #0a0a0a;
    border-top: 1px solid #222; border-bottom: 1px solid #222;
    overflow: hidden; /* Nasconde ciò che esce */
}

.scrolling-text-container {
    width: 100%;
    overflow: hidden;
}

.scrolling-text {
    display: flex; /* Mette gli elementi in riga */
    width: max-content; /* Forza la larghezza al contenuto (così non va a capo) */
    animation: scroll 30s linear infinite; /* Animazione lenta e continua */
}

.review-item {
    color: #888; font-size: 1.1rem;
    padding: 0 40px; /* Spazio tra le recensioni */
    white-space: nowrap; /* Evita a capo del testo */
    display: flex; align-items: center; gap: 10px;
}
.review-item strong { color: white; }

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); } /* Si sposta di metà (perché il contenuto è duplicato) */
}

/* =========================================
   5. GLOW MOUSE & ANIMAZIONI
   ========================================= */
.cursor-glow {
    position: fixed; top: 0; left: 0; width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(var(--active-theme-rgb), 0.15) 0%, transparent 60%);
    border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%);
    z-index: 0; mix-blend-mode: screen; transition: background 0.5s ease;
}

.reveal-section { opacity: 0; transform: translateY(50px); transition: all 1s ease-out; }
.reveal-section.active { opacity: 1; transform: translateY(0); }
.skill-tag { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.2); padding: 5px 15px; border-radius: 50px; font-size: 0.8rem; color: white; }

/* Animazione Menu Mobile (Fade In) */
@keyframes navLinkFade {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   6. MOBILE OPTIMIZATION (IL FIX TOTALE)
   ========================================= */
@media (max-width: 768px) {
    
    /* 1. HAMBURGER VISIBILE */
    .hamburger { display: block !important; z-index: 10001; cursor: pointer; }

    /* 2. MENU CASSETTO (SIDE DRAWER) */
    .nav-links {
        position: fixed;
        top: 0;
        right: -85%; /* Nascosto a destra */
        width: 85%;  /* Larghezza comoda */
        height: 100vh;
        background: #0f1115; /* Sfondo scuro */
        
        display: flex;
        flex-direction: column;
        justify-content: flex-start; /* TUTTO IN ALTO */
        align-items: flex-start;     /* Allineato a sinistra */
        
        padding-top: 90px; /* Spazio per evitare la X di chiusura */
        padding-left: 0;
        gap: 0; /* NESSUNO SPAZIO EXTRA */
        
        transition: right 0.3s ease-in-out;
        box-shadow: -10px 0 50px rgba(0,0,0,0.9);
        z-index: 10000;
    }

    /* Classe aggiunta da JS per aprire */
    .nav-links.mobile-active {
        right: 0; 
    }

    /* 3. VOCI DI MENU */
    .nav-links li {
        width: 100%;
        margin: 0 !important; /* Forza zero margini */
        padding: 0;
        border-bottom: 1px solid rgba(255,255,255,0.08); /* Riga divisoria */
        display: block;
        
        /* Reset animazioni desktop */
        opacity: 0; 
        transform: translateX(20px);
        transition: opacity 0.5s ease, transform 0.5s ease;
    }

    /* Quando attivo, le voci appaiono */
    .nav-links.mobile-active li {
        opacity: 1; transform: translateX(0);
    }

    .nav-links a {
        font-size: 1.1rem; /* Dimensione leggibile */
        font-weight: 600;
        color: white;
        text-transform: uppercase;
        letter-spacing: 1px;
        display: block;
        padding: 20px 30px; /* Area cliccabile grande */
        width: 100%;
    }

    /* 4. BOTTONE CONTATTI (Trasformato in link normale su mobile) */
    .btn-contact {
        border: none !important;
        background: transparent !important;
        padding: 20px 30px !important;
        text-align: left !important;
        color: var(--active-theme) !important;
        width: 100% !important;
        display: block !important;
    }

    /* 5. DROPDOWN MOBILE (FISARMONICA) */
    /* Link Padre (Flex per separare testo e freccia) */
    .dropdown-parent > a {
        display: flex; justify-content: space-between; align-items: center;
    }

    /* Sottomenu */
    .dropdown-menu {
        position: static; /* SOTTO, NON DI LATO */
        width: 100%;
        background: #16181d; /* Grigio leggermente diverso */
        box-shadow: none; border: none; padding: 0; margin: 0;
        display: none; /* Nascosto di base */
        opacity: 1; visibility: visible; transform: none; /* Reset effetti desktop */
    }
    
    /* Quando aperto via JS */
    .dropdown-parent.active .dropdown-menu {
        display: block;
        animation: slideDown 0.3s ease;
    }

    .dropdown-menu li {
        border-bottom: none;
        opacity: 1 !important; transform: none !important; /* Niente animazione fade sui figli */
    }

    .dropdown-menu li a {
        font-size: 0.95rem;
        color: #bbb;
        padding: 15px 0 15px 40px; /* Rientro a sinistra */
        text-transform: capitalize; /* Non maiuscolo */
        border-left: 2px solid rgba(255,255,255,0.1);
    }

    /* 6. LAYOUT GENERALE MOBILE */
    .sector-content {
        grid-template-columns: 1fr; /* Una colonna */
        text-align: left;
        padding: 0 15px;
    }
    
    .contact-grid { grid-template-columns: 1fr !important; gap: 40px !important; }
    #about .container { grid-template-columns: 1fr !important; }
    
    /* Nascondi elementi decorativi pesanti */
    .about-img, .sector-visual, .sector-visual-clean, .cursor-glow { 
        display: none !important; 
    }
    
    .btn, .btn-outline {
        width: 100%; display: block; text-align: center; margin-top: 20px;
    }
}