/* --- VARIABILI E BASE --- */
:root {
    --bg-dark: #0a0f1d;
    --accent-blue: #3a86ff;
    --light-blue: #8ecae6;
    --glass: rgba(255, 255, 255, 0.05);
    --text-main: #e0e1dd;
}

/* --- SCROLLBAR PERSONALIZZATA (Nuova!) --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--accent-blue), var(--light-blue));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--light-blue);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth; /* Scorrimento fluido tra le sezioni */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Sfondo con sfumature dinamiche */
.background-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 30%, rgba(58, 134, 255, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, rgba(142, 202, 230, 0.1) 0%, transparent 40%);
    z-index: -1;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* --- HEADER E NAVBAR --- */
header {
    text-align: center;
    margin-bottom: 80px;
}

.nav-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.glow-text {
    font-size: 3rem;
    background: linear-gradient(to right, #fff, var(--light-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.subtitle {
    color: var(--light-blue);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.9rem;
    margin-top: 10px;
}

nav {
    margin-top: 30px;
    transition: 0.4s ease;
}

nav a {
    color: var(--text-main);
    text-decoration: none;
    margin: 0 15px;
    font-weight: 500;
    transition: 0.3s;
}

nav a:hover {
    color: var(--accent-blue);
}

.btn-cv {
    border: 1px solid var(--accent-blue);
    padding: 8px 25px;
    border-radius: 50px;
}

/* --- SEZIONI E GRID PROGETTI --- */
.section-title {
    margin-bottom: 30px;
    font-size: 1.8rem;
    color: #fff;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

/* --- SEZIONE CUORE DELL'ANIMAZIONE --- */
/* Impostiamo lo stato iniziale comune per l'animazione di scorrimento */
.card, .skill-card {
    opacity: 0; /* Invisibile */
    transform: translateY(30px); /* Abbassata di 30px */
    transition: opacity 0.6s ease, transform 0.6s ease; /* Transizione fluida */
}

/* Impostiamo lo stato finale comune quando JS aggiunge la classe .show */
.card.show, .skill-card.show {
    opacity: 1; /* Visibile */
    transform: translateY(0); /* Torna alla posizione originale */
}

/* --- STILI SPECIFICI PROGETTI (hover, tags, links) --- */
.card {
    background: var(--glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 25px;
    backdrop-filter: blur(10px);
}

.card:hover {
    transform: translateY(-5px); /* Movimento per l'hover */
    border-color: var(--accent-blue);
    transition: transform 0.3s ease, border-color 0.3s ease; /* Transizione più rapida per l'hover */
}

.tags span {
    font-size: 0.7rem;
    background: rgba(58, 134, 255, 0.2);
    color: var(--light-blue);
    padding: 4px 10px;
    border-radius: 5px;
    margin-right: 5px;
}

.git-link {
    display: inline-block;
    margin-top: 20px;
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: bold;
}

/* --- SKILLS SECTION (hover icone) --- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 20px;
    margin-bottom: 80px;
}

.skill-card {
    text-align: center;
    padding: 20px;
}

.skill-card:hover {
    border-color: var(--accent-blue);
    background: rgba(58, 134, 255, 0.1);
    transition: border-color 0.3s ease, background 0.3s ease; /* Transizione più rapida per l'hover sulla card */
}

.skill-card i {
    font-size: 2.5rem;
    color: var(--light-blue);
    margin-bottom: 10px;
    display: block;
    transition: transform 0.3s ease, color 0.3s ease; /* Transizione rapida per l'icona */
}

.skill-card:hover i {
    transform: scale(1.2) rotate(5deg); /* Animazione icona */
    color: #fff;
}

/* --- FOOTER E EMAIL --- */
footer {
    margin-top: 100px;
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    margin-top: 5px;
}

footer a:hover {
    color: #fff;
    text-shadow: 0 0 10px var(--accent-blue);
    transform: scale(1.05);
}

/* --- OTTIMIZZAZIONE PER SMARTPHONE --- */
.menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--light-blue);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .nav-container {
        justify-content: space-between;
    }

    .menu-btn { display: block; }

    .glow-text { font-size: 2rem; }

    nav {
        display: none; 
        flex-direction: column;
        position: absolute;
        top: 75px;
        left: 0;
        width: 100%;
        padding: 30px 0;
        z-index: 1000;
        background: rgba(10, 15, 29, 0.85); /* Glassmorphism intenso */
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-radius: 15px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    nav.active {
        display: flex;
        animation: slideIn 0.4s ease forwards;
    }

    nav a { margin: 15px 0; }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}