/* --- VARIABLES & RESET --- */
/* --- VARIABLES & RESET --- */
:root {
    --bg-dark: #0b0c10;
    --bg-card: #1f2833;
    --text-main: #eaeaea;
    --text-muted: #c5c6c7;
    --accent: #66fcf1;
    --accent-dim: #45a29e;
    --accent-glow: rgba(102, 252, 241, 0.5);
    --border: rgba(255, 255, 255, 0.1);
    
    /* NUOVI FONT - Caricati da Google Fonts */
    --font-main: 'IBM Plex Sans', sans-serif;   /* Per testi e titoli */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main); /* Applica IBM Plex Sans ovunque */
    font-size: 18px;
    line-height: 1.7;
    overflow-x: hidden;
    font-weight: 300; /* Stile leggero e moderno */
}

h1, h2, h3, h4, .btn, .nav-links, .tagline {
    font-family: var(--font-main);
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
img { max-width: 100%; display: block; }

/* --- AMBIENT BACKGROUND --- */
.ambient-light {
    position: fixed;
    top: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(102, 252, 241, 0.08) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}

/* --- NAVBAR --- */
#navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: 0.4s ease;
}

#navbar.scrolled {
    background: rgba(11, 12, 16, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 5%;
}

.logo { font-size: 1.3rem; letter-spacing: 0.5px; }
.logo strong { font-weight: bold; color: #fff; }

.nav-links { list-style: none; display: flex; gap: 2.5rem; align-items: center; }
.nav-links a { font-size: 1rem; color: var(--text-muted); opacity: 0.8; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); opacity: 1; text-shadow: 0 0 10px var(--accent-glow); }

.btn-connect {
    border: 1px solid var(--accent-dim);
    padding: 0.5rem 1.5rem;
    color: var(--accent) !important;
    transition: 0.3s;
}
.btn-connect:hover { 
    background: var(--accent-glow); 
    box-shadow: 0 0 15px var(--accent-glow);
    color: #000 !important; 
}
.menu-toggle { display: none; font-size: 1.5rem; cursor: pointer; color: var(--text-main); }

/* --- HERO SECTION --- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 0 10%;
    position: relative;
    overflow: hidden;
}

.hero-content { max-width: 650px; z-index: 2; position: relative; }

.tagline {
    color: var(--accent);
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 1rem;
    display: block;
    text-shadow: 0 0 10px rgba(102, 252, 241, 0.3);
}

h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    font-weight: bold;
}

.gradient-text {
    background: linear-gradient(90deg, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p { font-size: 1.3rem; color: var(--text-muted); margin-bottom: 2.5rem; max-width: 90%; font-weight: 300; }

.hero-btns { display: flex; gap: 1.5rem; }

.btn {
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.btn.primary { 
    background: var(--accent); 
    color: #0b0c10; 
    box-shadow: 0 0 20px var(--accent-glow);
}
.btn.primary:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 0 30px var(--accent-glow); 
    background: #fff;
}

.btn.secondary { 
    background: transparent; 
    border: 1px solid var(--text-main); 
    color: var(--text-main); 
}
.btn.secondary:hover { 
    background: rgba(255,255,255,0.1); 
    border-color: #fff; 
}

/* --- HERO VISUAL: KINEMATIC SYSTEMS (BIG VERSION) --- */
.hero-visual {
    position: absolute;
    right: 5%; 
    top: 60%;
    transform: translateY(-50%);
    width: 600px;
    height: 600px;
    z-index: 1;
    perspective: 1000px;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.scene-3d {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateY(-30deg) rotateX(-20deg); 
}

.ref-system {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    transform-style: preserve-3d;
    display: flex;
    justify-content: center;
    align-items: center;
}

.global { transform: translate3d(-50px, 50px, 0); }
.local { animation: kinematics-motion 10s ease-in-out infinite; }

.axis {
    position: absolute;
    transform-origin: 0 0;
    border-radius: 4px;
    box-shadow: 0 0 20px currentColor;
}

.global .axis { width: 350px; height: 2px; opacity: 0.3; }
.local .axis { width: 220px; height: 5px; opacity: 1; z-index: 10; }

.x-axis { background-color: #ff2a2a; color: #ff2a2a; transform: rotateY(0deg); }
.y-axis { background-color: #00ff88; color: #00ff88; transform: rotateZ(-90deg); }
.z-axis { background-color: #2a8aff; color: #2a8aff; transform: rotateY(90deg); }

.axis::after {
    content: '';
    position: absolute;
    right: -10px;
    top: -4px;
    width: 0; height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 12px solid currentColor;
}
.global .axis::after { display: none; }

.label {
    position: absolute;
    right: -30px; top: -15px;
    font-size: 20px; font-weight: bold;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
    opacity: 0.8;
}

.connection-line {
    position: absolute;
    top: 0; left: 0;
    width: 0; height: 2px;
    background: transparent;
    border-bottom: 2px dashed rgba(255,255,255,0.2);
    transform-origin: 0 0;
}

@keyframes kinematics-motion {
    0% { transform: translate3d(0, 0, 0) rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    25% { transform: translate3d(150px, -80px, 50px) rotateX(20deg) rotateY(10deg) rotateZ(35deg); }
    50% { transform: translate3d(50px, 40px, 150px) rotateX(-15deg) rotateY(45deg) rotateZ(10deg); }
    75% { transform: translate3d(-80px, 80px, 20px) rotateX(10deg) rotateY(-30deg) rotateZ(-15deg); }
    100% { transform: translate3d(0, 0, 0) rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
}

/* --- PROJECTS GRID --- */
.container { padding: 6rem 10%; background: #0f1115; }
.section-header { margin-bottom: 4rem; text-align: left; border-left: 4px solid var(--accent); padding-left: 1.5rem; }
.section-header h2 { font-size: 2.5rem; margin-bottom: 0.5rem; color: #fff; }

.grid-projects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: 0.4s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}
.card:hover { transform: translateY(-10px); border-color: var(--accent); box-shadow: 0 10px 40px rgba(0,0,0,0.5); }

.card-image {
    height: 220px;
    background-size: cover;
    background-position: center;
    position: relative;
    border-bottom: 1px solid var(--border);
}
.card-image .overlay {
    position: absolute; inset: 0;
    background: rgba(102, 252, 241, 0.1);
    opacity: 0; transition: 0.3s;
}
.card:hover .card-image .overlay { opacity: 1; }

.card-content { padding: 2rem; flex-grow: 1; display: flex; flex-direction: column; }
.card h3 { font-size: 1.5rem; margin-bottom: 0.5rem; color: #fff; }
.card .subtitle { font-size: 0.9rem; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 1rem; font-weight: bold; }
.card .desc { font-size: 1rem; color: var(--text-muted); margin-bottom: 2rem; flex-grow: 1; }

.link-arrow { 
    margin-top: auto; font-size: 1rem; font-weight: bold; 
    color: #fff; display: flex; align-items: center; gap: 0.5rem; 
    border-top: 1px solid var(--border); padding-top: 1rem;
}
.link-arrow i { color: var(--accent); transition: 0.3s; }
.link-arrow:hover i { transform: translateX(5px); }

/* --- ABOUT PAGE STYLES --- */
.page-header {
    padding: 150px 10% 80px;
    background: radial-gradient(circle at top right, rgba(102, 252, 241, 0.1), transparent 50%);
}
.page-header h1 { font-size: 3.5rem; color: #fff; margin-bottom: 1rem; }
.page-header p { font-size: 1.5rem; color: var(--accent); max-width: 800px; }

.about-container { padding-top: 0; }
.bio-section {
    display: flex; gap: 4rem; align-items: center; margin-bottom: 6rem;
}
.bio-text { flex: 2; }
.bio-text h2 { color: #fff; margin-bottom: 1.5rem; }
.bio-text p { margin-bottom: 1.5rem; }
.bio-image { flex: 1; }
.bio-image img { border-radius: 4px; border: 1px solid var(--accent-dim); box-shadow: 10px 10px 0 var(--bg-card); }
.highlight-text { font-size: 1.4rem; color: var(--text-main); border-left: 3px solid var(--accent); padding-left: 1.5rem; font-style: italic; }

.highlights-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem;
}
.highlight-card {
    background: var(--bg-card); padding: 2.5rem; border: 1px solid var(--border); border-top: 3px solid var(--accent);
}
.icon-box { font-size: 2rem; color: var(--accent); margin-bottom: 1.5rem; }
.highlight-card h3 { font-size: 1.3rem; margin-bottom: 1rem; color: #fff; }

/* --- FOOTER --- */
#footer {
    text-align: center; padding: 5rem 2rem; border-top: 1px solid var(--border); background: #050505;
}
.social-links { margin-bottom: 2rem; }
.social-links a { font-size: 1.8rem; margin: 0 1.5rem; color: var(--text-muted); transition: 0.3s; }
.social-links a:hover { color: var(--accent); transform: scale(1.1); }
.copyright { font-size: 0.9rem; color: rgba(255,255,255,0.3); letter-spacing: 1px; }

/* --- ANIMATIONS --- */
.fade-in-up { opacity: 0; transform: translateY(30px); animation: fadeInUp 0.8s forwards 0.2s; }
@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }
.scroll-reveal { opacity: 0; transform: translateY(40px); transition: 0.8s ease; }
.scroll-reveal.visible { opacity: 1; transform: translateY(0); }

/* --- RESPONSIVE --- */

@media (max-width: 1200px) {
    .hero-visual { transform: translateY(-50%) scale(0.8); right: -50px; }
}

@media (max-width: 980px) {
    .hero-visual { opacity: 0.2; transform: translateY(-50%) scale(0.6); }
    .bio-section { flex-direction: column-reverse; }
}

@media (max-width: 768px) {
    /* 1. SISTEMAZIONE TITOLO */
    h1 { font-size: 2.5rem; }
    
    /* 2. LAYOUT HERO */
    .hero { 
        padding: 100px 5% 40px; /* Meno padding sopra */
        display: flex;
        flex-direction: column;
        justify-content: flex-start; /* Allinea in alto */
    }

    /* 3. ANIMAZIONE (Spostata in basso) */
    .hero-visual {
        position: relative;
        width: 100%;
        height: 300px;
        right: auto;
        top: auto;
        transform: scale(0.8);
        opacity: 0.6;
        margin-top: 30vh; 
        margin-bottom: 0vh;
    }
    
    /* Correzione angolazione per mobile */
    .scene-3d { transform: rotateX(-10deg) rotateY(-20deg); }

    /* 4. MENU MOBILE (Stile a tendina "Glass") */
    .menu-toggle { 
        display: block; 
        z-index: 1001; /* Sopra a tutto */
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 70%; /* Larghezza del menu laterale */
        background: rgba(11, 12, 16, 0.98); /* Sfondo quasi opaco */
        backdrop-filter: blur(15px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        border-left: 1px solid var(--border);
        
        /* Animazione ingresso */
        transform: translateX(100%); /* Nascosto a destra */
        transition: transform 0.4s ease-in-out;
        z-index: 1000;
        display: flex; /* Importante: sovrascrive il display:none precedente */
    }

    /* Classe aggiunta dal JS quando clicchi */
    .nav-links.mobile-active {
        transform: translateX(0); /* Porta il menu dentro lo schermo */
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    }
    
    .nav-links a {
        font-size: 1.2rem; /* Testo più grande su mobile */
    }
}