:root {
    --primary: #1a2a3a;      /* Deep Navy */
    --accent: #a08c5b;       /* Bronze/Gold */
    --text: #333333;
    --text-light: #666666;
    --bg-light: #f4f7f6;
    --white: #ffffff;
    --shadow: 0 10px 30px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: 'Inter', sans-serif; 
    line-height: 1.6; 
    color: var(--text);
    background-color: var(--white);
    overflow-x: hidden; /* Evita scroll orizzontale indesiderato su mobile */
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }

/* === NAVIGATION === */
nav { 
    background: rgba(255, 255, 255, 0.95); 
    backdrop-filter: blur(10px);
    padding: 15px 0; 
    position: sticky; 
    top: 0; 
    z-index: 1000;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.nav-flex { display: flex; justify-content: space-between; align-items: center; }
.nav-avatar {
    width: 35px;        /* Dimensione fissa piccola (circa il 5% di uno schermo mobile) */
    height: 35px;       /* Mantiene l'immagine quadrata */
    border-radius: 50%; /* La mantiene tonda */
    object-fit: cover;  /* Assicura che l'immagine non venga deformata */
    border: 2px solid var(--accent);
    flex-shrink: 0;     /* Impedisce all'icona di schiacciarsi */
}

.brand {
    /* Assicurati che il contenitore allinei tutto correttamente */
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.8rem;
    color: var(--primary);
}

.nav-links { display: flex; list-style: none; gap: 30px; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; color: var(--text); transition: color 0.3s; }
.nav-links a:hover { color: var(--accent); }

.nav-links .cta-button {
    background: var(--primary);
    color: var(--white);
    padding: 8px 20px;
    border-radius: 5px;
}
.nav-links .cta-button:hover { background: var(--accent); color: var(--white); }

/* Mobile Menu Button */
.mobile-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--primary); }

/* === HERO SECTION === */
.hero { padding: 120px 0 80px; background: var(--bg-light); }
.hero-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 40px; align-items: center; }

h1 { font-size: 3.5rem; color: var(--primary); line-height: 1.1; margin-bottom: 15px; letter-spacing: -1px; }
.tagline { font-size: 1.25rem; color: var(--accent); font-weight: 600; margin-bottom: 20px; }
.hero-desc { font-size: 1.1rem; color: var(--text-light); margin-bottom: 30px; max-width: 500px; }

.hero-btns { display: flex; gap: 15px; flex-wrap: wrap; }
.btn { padding: 12px 28px; border-radius: 6px; font-weight: 600; display: inline-flex; align-items: center; gap: 10px; transition: all 0.3s; }
.btn.primary { background: var(--primary); color: var(--white); box-shadow: 0 4px 15px rgba(26, 42, 58, 0.2); }
.btn.primary:hover { transform: translateY(-2px); background: var(--accent); }
.btn.secondary { border: 2px solid var(--primary); color: var(--primary); }
.btn.secondary:hover { background: var(--primary); color: var(--white); }

.hero-img-box { position: relative; }
.profile-photo { 
    width: 100%; max-width: 350px; border-radius: 20px; 
    box-shadow: 20px 20px 0 var(--accent); 
    margin: 0 auto; /* Centra su mobile */
}

/* === SEZIONI GENERALI === */
.section { padding: 80px 0; }
.bg-light { background: var(--bg-light); }
.section-title { 
    text-align: center; margin-bottom: 60px; font-size: 2.2rem; 
    color: var(--primary); position: relative; 
}
.section-title::after {
    content: ''; display: block; width: 60px; height: 4px; 
    background: var(--accent); margin: 15px auto 0; border-radius: 2px;
}

/* === PROJECT CARD (Featured) === */
.project-card {
    background: var(--white); border-radius: 15px; overflow: hidden;
    box-shadow: var(--shadow); display: grid; grid-template-columns: 1.2fr 1fr;
    border: 1px solid rgba(0,0,0,0.05); transition: transform 0.3s;
}
.project-card:hover { transform: translateY(-5px); }
.project-image { height: 100%; min-height: 300px; background: #eee; }
.project-image img { width: 100%; height: 100%; object-fit: cover; }
.project-content { padding: 40px; display: flex; flex-direction: column; justify-content: center; }
.project-label { 
    text-transform: uppercase; font-size: 0.8rem; letter-spacing: 1px; 
    color: var(--accent); font-weight: 700; margin-bottom: 10px; 
}
.project-content h3 { font-size: 1.8rem; margin-bottom: 15px; color: var(--primary); }
.project-content p { color: var(--text-light); margin-bottom: 25px; }

.tech-stack { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.tech-stack span { 
    background: var(--bg-light); padding: 5px 12px; border-radius: 4px; 
    font-size: 0.85rem; font-weight: 600; color: var(--primary); border: 1px solid #ddd;
}

/* === TIMELINE === */
.timeline { max-width: 800px; margin: 0 auto; position: relative; }
/* Linea verticale continua */
.timeline::before {
    content: ''; position: absolute; left: 185px; top: 0; bottom: 0;
    width: 2px; background: #e0e0e0;
}

.timeline-item { display: grid; grid-template-columns: 160px 1fr; gap: 50px; margin-bottom: 50px; position: relative; }
.time { 
    text-align: right; font-weight: 700; color: var(--accent); font-size: 0.95rem; padding-top: 5px; 
}
/* Pallino sulla timeline */
.time::after {
    content: ''; position: absolute; left: 180px; top: 8px;
    width: 12px; height: 12px; background: var(--white);
    border: 3px solid var(--accent); border-radius: 50%; z-index: 2;
}

.content h3 { color: var(--primary); font-size: 1.3rem; margin-bottom: 5px; }
.content h4 { color: #555; font-style: normal; font-weight: 500; margin-bottom: 15px; font-size: 1.1rem; }
.content p { color: var(--text-light); font-size: 0.95rem; }

/* === EDUCATION & SKILLS === */
.education-grid, .skills-wrapper { 
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; 
}

.edu-card, .skill-category {
    background: var(--white); padding: 30px; border-radius: 10px;
    box-shadow: var(--shadow); border: 1px solid rgba(0,0,0,0.03);
}
.edu-card i { font-size: 2rem; color: var(--accent); margin-bottom: 15px; }
.edu-card h3 { font-size: 1.2rem; margin-bottom: 10px; color: var(--primary); }
.institute { color: var(--text-light); margin-bottom: 5px; }
.year { font-weight: 600; color: var(--accent); font-size: 0.9rem; }

.skill-category h3 { 
    border-bottom: 2px solid var(--bg-light); padding-bottom: 15px; 
    margin-bottom: 20px; color: var(--primary); display: flex; align-items: center; gap: 10px; 
}
.skill-list { list-style: none; }
.skill-list li { 
    padding: 8px 0; border-bottom: 1px solid #f0f0f0; 
    color: var(--text); font-size: 0.95rem; display: flex; align-items: center;
}
.skill-list li::before {
    content: '•'; color: var(--accent); font-weight: bold; 
    margin-right: 10px; font-size: 1.2rem;
}

/* === FOOTER === */
footer { padding: 80px 0 40px; background: var(--primary); color: var(--white); }
footer h2 { margin-bottom: 15px; color: var(--white); }
footer p { opacity: 0.8; margin-bottom: 40px; }

.contact-cards { 
    display: flex; justify-content: center; flex-wrap: wrap; gap: 20px; margin-bottom: 60px; 
}
.contact-item {
    background: rgba(255,255,255,0.05); padding: 20px 30px; border-radius: 8px;
    display: flex; align-items: center; gap: 15px; transition: 0.3s;
    border: 1px solid rgba(255,255,255,0.1);
}
.contact-item:hover { background: rgba(255,255,255,0.1); transform: translateY(-3px); }
.contact-item i { font-size: 1.5rem; color: var(--accent); }

.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 30px; font-size: 0.8rem; opacity: 0.5; }


/* =========================================
   RESPONSIVE & MOBILE STYLES
   ========================================= */
@media (max-width: 992px) {
    .hero-grid { grid-template-columns: 1fr; text-align: center; }
    .hero-text { margin-bottom: 40px; }
    .hero-btns { justify-content: center; }
    .project-card { grid-template-columns: 1fr; }
    .project-image { min-height: 250px; }
    .timeline::before { left: 20px; }
    .timeline-item { grid-template-columns: 1fr; padding-left: 50px; gap: 10px; }
    .time { text-align: left; margin-bottom: 5px; }
    .time::after { left: 15px; top: 5px; }
}

@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    .mobile-toggle { display: block; z-index: 1001; }
    
    .nav-links {
        position: fixed; top: 0; right: 0;
        height: 100vh; width: 70%; max-width: 300px;
        background: var(--white); box-shadow: -5px 0 20px rgba(0,0,0,0.1);
        flex-direction: column; align-items: flex-start;
        padding: 80px 30px; transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
    }
    
    .nav-links.active { transform: translateX(0); }
    
    .profile-photo { max-width: 280px; box-shadow: 15px 15px 0 var(--accent); }
    .section { padding: 50px 0; }
    
    .contact-item { width: 100%; justify-content: center; }
}
/* === COOKIE BANNER === */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--primary);
    color: var(--white);
    padding: 20px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
    z-index: 2000;
    transform: translateY(0);
    transition: transform 0.4s ease-in-out;
    border-top: 3px solid var(--accent);
}

.cookie-banner.hidden {
    transform: translateY(100%); /* Nasconde il banner spostandolo giù */
}

.cookie-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.cookie-btns {
    display: flex;
    gap: 10px;
}

.btn.small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* === MODALE LEGALE === */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); /* Sfondo scuro */
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--white);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid rgba(0,0,0,0.1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text);
    z-index: 10;
}

.modal-header {
    padding: 25px;
    border-bottom: 1px solid #eee;
    background: var(--bg-light);
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary);
}

.modal-body {
    padding: 30px;
    overflow-y: auto; /* Permette lo scroll se il testo è lungo */
    line-height: 1.7;
}

.legal-section { margin-bottom: 30px; }
.legal-section h3 { font-size: 1.1rem; color: var(--primary); margin-bottom: 10px; border-bottom: 2px solid var(--accent); display: inline-block; }
.legal-section ul { margin-left: 20px; margin-top: 10px; font-size: 0.95rem; }

/* Box specifico per il disclaimer medico */
.warning-box {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    padding: 20px;
    border-radius: 8px;
    color: #856404;
}
.warning-box h3 { color: #856404; border-color: #856404; }

.modal-footer {
    padding: 15px;
    text-align: center;
    border-top: 1px solid #eee;
    font-size: 0.8rem;
    color: var(--text-light);
}

.footer-legal a {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    text-decoration: underline;
    transition: color 0.3s;
}
.footer-legal a:hover { color: var(--accent); }

/* Mobile adjustments */
@media (max-width: 768px) {
    .cookie-content { flex-direction: column; text-align: center; }
    .cookie-btns { width: 100%; justify-content: center; }
    .modal-body { padding: 20px; }
}