/* POPPINS e Lexend */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;500;600&display=swap');

/* --- CONFIGURAZIONE VARIABILI --- */
:root {
    /* DEFAULT DARK THEME */
    --bg-body: #121212;
    --text-main: #eeeeee;
    --text-muted: #d4d4d8; 
    --accent: #ff9100;
    --accent-glow: rgba(255, 190, 92, 0.4);
    
    /* Vetro */
    --glass-bg: rgba(40, 40, 45, 0.65); 
    --glass-border: rgba(255, 255, 255, 0.1); 
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);

    --radius-std: 24px;
    --radius-pill: 100px;
    --nav-width: 90%;
    --max-w: 1100px;
}

[data-theme="light"] {
    --bg-body: #dddddd;
    --text-main: #1a1a1a;
    --text-muted: #555555;
    --accent: #E08E00;
    --accent-glow: rgba(224, 142, 0, 0.2);
    --glass-bg: rgba(220, 220, 222, 0.75);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(50, 50, 50, 0.1);
}

/* --- BASE --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    overflow-x: hidden;
    line-height: 1.6;
    transition: background-color 0.5s ease, color 0.5s ease;
}
a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* --- SFONDO --- */
.background-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; overflow: hidden;
    background: var(--bg-body); 
}
.orb {
    position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.4;
    animation: float 20s infinite ease-in-out;
}
.orb-1 { width: 70vh; height: 70vh; background: var(--accent); top: -20%; left: -20%; opacity: 0.15; }
.orb-2 { width: 60vh; height: 60vh; background: #ff6b00; bottom: -20%; right: -20%; animation-delay: -10s; opacity: 0.1; }

@keyframes float { 
    0%, 100% { transform: translate(0, 0); } 
    50% { transform: translate(20px, 30px); } 
}

/* --- GLASS PANEL GENERALE --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
    transition: all 0.3s ease;
}

/* --- NAVBAR FLOATING (Layout Fisso) --- */
/* Nota: Rimosso glass-panel da qui per non bloccare il menu mobile */
.floating-nav {
    position: fixed; top: 20px; left: 0; right: 0; margin: 0 auto;
    width: var(--nav-width); max-width: 900px; height: 70px;
    z-index: 1000;
    /* Nessun sfondo qui, usiamo il figlio .nav-glass-bg */
}

/* Sfondo Vetro Navbar (Figlio separato) */
.nav-glass-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    border-radius: var(--radius-pill);
    z-index: -1; /* Va dietro al contenuto */
}

.nav-content { 
    position: relative; /* Per stare sopra lo sfondo */
    display: flex; justify-content: space-between; align-items: center; 
    width: 100%; height: 100%; padding: 0 2rem;
}

/* Icona Profilo */
.logo-container { display: flex; align-items: center; gap: 12px; }
.profile-icon {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    color: var(--accent);
    border: 1px solid var(--glass-border);
}
.logo { font-weight: 800; letter-spacing: 1px; font-size: 1.2rem; }

/* Menu Desktop */
.menu { display: flex; gap: 2rem; align-items: center; }
.menu a:hover { color: var(--accent); }

/* --- HAMBURGER MENU --- */
.hamburger { display: none; cursor: pointer; z-index: 1002; }
.bar {
    display: block; width: 25px; height: 3px; margin: 5px auto;
    transition: all 0.3s ease-in-out;
    background-color: var(--text-main); border-radius: 3px;
}

/* Theme Toggle */
.icon-btn { background: none; border: none; cursor: pointer; color: var(--text-main); font-size: 1.1rem; transition: transform 0.3s; }
.icon-btn:hover { transform: rotate(15deg) scale(1.1); color: var(--accent); }

/* --- LAYOUT & ANIMATION --- */
.container { max-width: var(--max-w); margin: 0 auto; padding: 120px 20px 50px; }

.module-section { 
    margin-bottom: 80px;
    opacity: 0;
    transform: scale(0.95) translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}
.module-section.visible { opacity: 1; transform: scale(1) translateY(0); }

.center-content { display: flex; justify-content: center; text-align: center; }
.hero-panel { padding: 4rem; border-radius: var(--radius-std); max-width: 800px; width: 100%; }
.tag { text-transform: uppercase; font-size: 0.8rem; letter-spacing: 3px; color: var(--accent); font-weight: 700; display: block; margin-bottom: 1rem;}
h1 { font-size: 3.5rem; line-height: 1.1; margin-bottom: 1.5rem; }
.highlight { color: var(--accent); }
.hero-panel p { font-size: 1.2rem; color: var(--text-muted); margin-bottom: 2rem; max-width: 600px; margin-left: auto; margin-right: auto; }

/* Buttons */
.btn-group { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn { padding: 0.8rem 2rem; border-radius: var(--radius-pill); font-weight: 600; cursor: pointer; border: none; font-size: 1rem; }
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--text-main); color: var(--bg-body); transform: translateY(-2px); }
.btn-outline { background: transparent; border: 1px solid var(--text-main); color: var(--text-main); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn-nav { background: var(--accent); color: #000 !important; padding: 0.5rem 1.5rem; border-radius: var(--radius-pill); font-weight: 600; }

/* --- SEZIONI INTERNE --- */
.content-panel { padding: 2.5rem; border-radius: var(--radius-std); }
.section-header { font-size: 2rem; margin-bottom: 2rem; border-left: 4px solid var(--accent); padding-left: 1rem; }
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 3rem; }

.about-stats { display: flex; flex-direction: column; gap: 1.5rem; } 
.stat-box { 
    background: rgba(255,255,255,0.03);
    padding: 1.5rem; 
    border-radius: 16px; 
    text-align: center; 
    border: 1px solid var(--glass-border); 
    transition: 0.3s; 
}
.stat-box:hover { border-color: var(--accent); transform: translateY(-5px); background: rgba(255,255,255,0.05); }
.stat-box i { font-size: 2rem; color: var(--accent); margin-bottom: 0.5rem; }

/* --- SKILLS --- */
.skills-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; }
.skill-item { margin-bottom: 1.5rem; }
.skill-info { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-weight: 600; font-size: 0.9rem; }
.progress-bg { width: 100%; height: 8px; background: rgba(128,128,128,0.2); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 10px; width: 0%; transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1); box-shadow: 0 0 10px var(--accent-glow); }
.learning-box { margin-top: 2rem; padding: 1.5rem; border: 2px dashed var(--text-muted); border-radius: 16px; }
.tags{display: flex;flex-wrap: wrap;gap: 10px; padding-top: 12px;}
.tag-pill { padding: 0.4rem 1rem; background: rgba(128,128,128,0.1); border-radius: 20px; font-size: 0.9rem; }

/* --- PROJECTS --- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.project-card { border-radius: var(--radius-std); overflow: hidden; transition: 0.3s; display: flex; flex-direction: column; background: rgba(255,255,255,0.03); }
.project-card:hover { transform: translateY(-8px); border-color: var(--accent); box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5); }
.project-img {aspect-ratio: 16/9; height: auto; background-size: cover; background-position: center; background-color: #222; }
.project-img img{display: block; width: 100%; max-height: 100%; object-fit: cover;}
.p-img-1 { background-image: linear-gradient(45deg, #111, #333); }
.p-img-2 { background-image: linear-gradient(45deg, #222, #444); }
.project-info { padding: 1.5rem; }
.stack-mini { 
    display: flex; gap: 6px;
    font-size: 0.75rem; color: var(--accent); text-transform: uppercase; margin-bottom: 0.5rem; font-weight: 700;
    > span{ padding: 5px 10px; background-color: rgba(128,128,128,0.1); border-radius: var(--radius-pill); }
}
.link-arrow { color: var(--accent); font-weight: 600; margin-top: 1rem; display: inline-block; }

/* --- PAGE DETTAGLIO --- */
.project-header { text-align: center; padding: 3rem; border-radius: var(--radius-std); margin-bottom: 2rem; position: relative; }
.back-link { position: absolute; top: 2rem; left: 2rem; font-size: 0.9rem; opacity: 0.7; }
.project-date { color: var(--accent); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; }
.project-layout { display: grid; grid-template-columns: 300px 1fr; gap: 2rem; align-items: start; }
.sidebar-info { padding: 2rem; border-radius: var(--radius-std); position: sticky; top: 120px;}
.main-desc { padding: 3rem; border-radius: var(--radius-std); }
.tech-tag { display: flex; align-items: center; gap: 10px; font-weight: 500; margin-bottom: 0.8rem; }
.tech-tag i { width: 20px; color: var(--accent); }
.divider { height: 1px; background: rgba(128,128,128,0.2); margin: 1.5rem 0; }
.content-block { margin-bottom: 2.5rem; }
.custom-list { margin-left: 1.5rem; color: var(--text-muted); margin-top: 1rem; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin-top: 2rem; }
.gallery-item { height: 200px; border-radius: 12px; background-size: cover; opacity: 0.8; }

/* --- CONTACT (FIXED MOBILE) --- */
.contact-panel { padding: 3rem; border-radius: var(--radius-std); width: 100%; max-width: 700px; text-align: center; }
.contact-actions { display: flex; flex-direction: column; gap: 1rem; margin-top: 2rem; align-items: center; }

.contact-btn {
    display: flex; align-items: center; gap: 1.5rem;
    padding: 1rem 1.5rem; width: 100%; max-width: 450px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    transition: all 0.3s ease; text-decoration: none; color: var(--text-main);
}
.contact-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--accent); transform: translateY(-3px); }

.icon-circle {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    display: flex; justify-content: center; align-items: center;
    font-size: 1.2rem; color: var(--accent);
    /* FIX ESSENZIALE PER MOBILE: Impedisce all'icona di schiacciarsi */
    flex-shrink: 0; 
}
[data-theme="light"] .icon-circle { background: rgba(255,255,255,0.5); }

.text-group { display: flex; flex-direction: column; text-align: left; overflow: hidden; }
.label { font-size: 0.8rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 1px; }
.value { font-size: 1.1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- FOOTER --- */
.floating-footer {
    width: fit-content; margin: 0 auto 30px; padding: 1rem 1.5rem; text-align: center;
    border-radius: var(--radius-pill); color: var(--text-muted); font-size: 0.9rem; position: relative; z-index: 10;
}

/* --- RESPONSIVE MOBILE MENU FIX --- */
@media (max-width: 900px) {
    .project-layout { grid-template-columns: 1fr; }
    .sidebar-info { position: static; margin-bottom: 2rem; }
}

@media (max-width: 768px) {
    h1 { font-size: 2.2rem; }
    .about-grid, .skills-grid { flex-direction: column; grid-template-columns: 1fr; }
    .floating-nav { width: 90%; padding: 0 1.5rem; justify-content: space-between; }
    
    .hamburger { display: block; }
    .hamburger.active .bar:nth-child(2) { opacity: 0; }
    .hamburger.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .hamburger.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    /* MENU MOBILE FULLSCREEN CORRETTO */
    .menu {
        position: fixed;
        inset: 0; /* Top/Left/Right/Bottom 0 */
        width: 100vw; 
        height: 100vh;
        
        flex-direction: column;
        justify-content: center; 
        align-items: center;
        text-align: center;
        
        background: rgba(5, 5, 5, 0.98);
        backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
        
        /* Nascondi di default */
        opacity: 0;
        visibility: hidden;
        transform: translateX(100%);
        transition: all 0.4s ease-in-out;
        z-index: 999; /* Sotto all'hamburger (1002) */
        
        padding: 0; margin: 0; gap: 2.5rem;
    }
    
    [data-theme="light"] .menu { background: rgba(240, 240, 240, 0.98); }

    /* Stato attivo */
    .menu.active {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
    }
    
    .menu a { font-size: 1.5rem; font-weight: 600; display: block; }

    /* FIX BOTTONI CONTATTI SU MOBILE */
    .contact-btn {
        padding: 0.8rem 1rem;
        gap: 1rem;
    }
    .value { font-size: 0.95rem; } /* Font leggermente più piccolo */
}