/* Configurazione Variabili */
:root {
    --bg: #ffffff;
    --text: #222222;
    --text-light: #555555;
    --accent: #000000; 
    --link: #0056b3;
    --border: #eeeeee;
    --max-width: 700px;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55;
    color: var(--text);
    background-color: var(--bg);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 60px 25px;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

ul {
    padding-left: 20px;
    margin: 15px 0;
}

li {
    margin-bottom: 12px;
    line-height: 1.4;
}

/* --- PAPERS LIST (Standard ma stilizzato) --- */
ol.papers-list {
    /* Padding ridotto: 28px bastano per due cifre senza sprecare spazio */
    padding-left: 28px; 
    margin-bottom: 20px;
}

ol.papers-list li {
    margin-bottom: 12px;
    padding-left: 4px; /* Un po' di spazio tra il numero e il testo */
}

/* Agiamo solo sull'estetica del numero nativo */
ol.papers-list li::marker {
    font-size: 0.9rem;        /* Numeri un po' più piccoli del testo */
    font-weight: 500;          /* Font leggero (Light) */
    color: var(--text-light);   /* Colore grigio anziché nero */
}

.first {
	margin-top: 0;
}

/* --- HEADER --- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 0; 
}

.profile-photo {
    width: 100px;
    height: 100px;
    padding-bottom: 0;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

header h1 {
    font-size: 2rem;
    line-height: 1.2;
    margin: 20px 0 10px 0;
    letter-spacing: -0.04em;
}

/* header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 15px 0 0 0;
    letter-spacing: -0.04em;
} */

h2 {
    font-size: 1.8rem;
    margin: 0 0 15px 0;
}

h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: 30px;
    margin-bottom: 18px;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    text-transform: uppercase; /* Torna in MAIUSCOLO */
    letter-spacing: 0.05em;
}

h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 25px;
    margin-bottom: 15px;
    color: var(--text);
    text-transform: uppercase; /* Torna in MAIUSCOLO */
    letter-spacing: 0.05em;
}

.subtitle {
    font-size: 1em;
    color: var(--text-light);
    margin: 10px 0 0 0;
    line-height: 1.2;
}

/* --- NAV --- */
nav {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-top: 18px;
    margin-bottom: 25px; 
}

nav li {
    margin-bottom: 0 !important;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 25px;
}

nav a {
    display: inline-block;
    padding: 15px 0;
    line-height: 1;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
}

nav a:hover, nav a.current {
    color: var(--link);
}

/* --- JUMP LINKS --- */
.jump-nav {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.jump-title {
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    margin-right: 3px;
}

/* --- JUMP LINKS: PULIZIA FINALE --- */
.jump-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0; /* Rimuove lo spazio vuoto tra i link HTML */
}

.jump-links a {
    text-decoration: none; /* Rimuove la sottolineatura fissa che ti dava fastidio */
	color: var(--text-light); /* Usa il grigio invece del blu */
    transition: color 0.2s ease; /* Rende il cambio di colore fluido */
}

.jump-links a:hover {
	color: var(--link); /* Diventa blu solo al passaggio del mouse */
    text-decoration: underline; /* La sottolineatura appare SOLO quando ci passi sopra */
}

.jump-links a:not(:last-child)::after {
    content: "•";
    display: inline-block;  /* Isola il pallino dal comportamento del testo del link */
    text-decoration: none !important; /* Impedisce categoricamente che il pallino venga sottolineato */
    margin: 0 12px;         /* Crea lo spazio perfetto ai lati del pallino */
    color: #ccc;
    pointer-events: none;   /* Fa sì che il pallino non sia "cliccabile" */
}


/* --- GRIGLIA FOTO UNIVERSALE --- */
.photo-grid { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 20px; 
    margin: 20px 0;
}

/* Colpisce il contenitore (sia esso <a> o <figure>) */
.photo-grid > * { 
    margin: 0 !important; 
    display: block;
}

.photo-grid img { 
    max-width: 200px; 
    height: auto;
    border: 1px solid var(--border);
    display: block;
    transition: transform 0.2s;
}

.photo-grid img:hover { transform: translateY(-3px); }

footer {
    margin: 30px 0 10px 0;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
}

/* --- COMPONENTI SPECIALI --- */

/* Link orizzontali in Home (CV, Scholar, ecc.) */
.cv-links {
    list-style: none; /* Toglie i pallini */
    padding: 0;
    margin: 20px 0;
    display: flex;    /* Li mette sulla stessa riga */
    gap: 20px;        /* Distanza tra i due link */
    font-weight: 600;
}

.cv-links li {
    margin-bottom: 0; /* Annulla il margine dei li standard */
}

.photo-grid img:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.flag-it, .flag-fr, .flag-uk {
    display: inline-block;
    width: 15px;
    height: 10px;
    vertical-align: middle;
    margin-right: 4px;
    border: 1px solid rgba(0,0,0,0.1);
    background-size: cover;
    background-repeat: no-repeat;
}

.flag-it { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Crect width='1' height='2' fill='%23009246'/%3E%3Crect x='1' width='1' height='2' fill='%23ffffff'/%3E%3Crect x='2' width='1' height='2' fill='%23ce2b37'/%3E%3C/svg%3E"); }

.flag-fr { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Crect width='1' height='2' fill='%230055A4'/%3E%3Crect x='1' width='1' height='2' fill='%23ffffff'/%3E%3Crect x='2' width='1' height='2' fill='%23EF4135'/%3E%3C/svg%3E"); }

.flag-uk { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 30'%3E%3Cpath fill='%23012169' d='M0 0h50v30H0z'/%3E%3Cpath stroke='%23fff' stroke-width='6' d='M0 0l50 30M50 0L0 30'/%3E%3Cpath stroke='%23C8102E' stroke-width='4' d='M0 0l50 30M50 0L0 30'/%3E%3Cpath stroke='%23fff' stroke-width='10' d='M25 0v30M0 15h50'/%3E%3Cpath stroke='%23C8102E' stroke-width='6' d='M25 0v30M0 15h50'/%3E%3C/svg%3E"); }

/* --- LAYOUT LIBRO & TEACHING --- */
/* Container principale */
.book-header {
    display: block; /* Rimuoviamo flex per permettere lo scorrimento */
    margin-top: 30px;
}

/* Gestione del "Clearfix" (importante per non rompere il layout dopo) */
.book-header::after {
    content: "";
    display: table;
    clear: both;
}

/* La foto che "galleggia" a sinistra */
.book-cover { 
    float: left; /* Il testo le scorrerà attorno */
    width: 170px; 
    margin-right: 25px; /* Spazio tra foto e testo */
    margin-bottom: 15px; /* Spazio sotto la foto quando il testo ci scorre sotto */
    border: 1px solid var(--border); 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
}

/* Il contenitore del testo */
.book-details {
    display: block; /* Non deve più essere flex item */
}


/* --- VARIANTE PER PAGINE CENTRATE (Eventi) --- */
.header-centered {
    text-align: center;
    margin-bottom: 40px;
}

.header-centered h1 {
    font-size: 2rem;
    line-height: 1.2;
    margin: 25px auto 15px auto;
}

.header-centered .subtitle {
    line-height: 1.5;
    margin-bottom: 30px;
}

.header-centered nav ul {
    justify-content: center; /* Centra i link della nav */
}

/* Docenti con foto a sinistra (Bicocca) */
.speaker-wrap {
    margin-top: 25px;    /* Spazio generoso dal titolo Courses */
    margin-bottom: 15px; /* Spazio tra un docente e l'altro */
    display: flow-root;  /* Trucco moderno per contenere correttamente la foto "flottante" */
}

.speaker-wrap img {
    float: left;         /* La foto va a sinistra */
    width: 120px;
    margin: 0 25px 10px 0; /* Spazio a destra (25px) e sotto la foto */
    border-radius: 4px;
    border: 1px solid var(--border);
}

.speaker-wrap p {
	margin-top: 0;       /* Allinea il primo paragrafo in alto con la foto */
    margin-bottom: 12px; /* Spazio tra i vari paragrafi di testo */
}

/* --- TABELLE: SCHEDULE E PARTECIPANTI --- */
.mytable {
    width: 100%;
    margin: 30px 0;
    overflow-x: auto; /* Scroll su mobile */
}

.schedule-table, .participants-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.schedule-table th, .participants-table th {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}

.schedule-table td, .participants-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #f0f0f0;
}

/* Colonna orari e righe di pausa */
.time-slot {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.break-row td {
    background-color: #fafafa;
    color: #888;
    font-size: 0.85rem;
}

/* Effetto zebra per i partecipanti */
.participants-table tr:nth-child(even) {
    background-color: #fafafa;
}

/* --- FOTO E GRIGLIE --- */
.hero-photo {
    text-align: center;
    margin: 30px 0;
}

.hero-photo img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.photo-grid figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-grid figcaption {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 5px;
}


/* --- OTTIMIZZAZIONI MOBILE (600px) --- */
@media (max-width: 600px) {
    .container { padding: 25px 15px !important; }

    /* 1. Header compatto per far stare il nome a sinistra */
    .profile-photo { 
        width: 75px !important; 
        height: 75px !important; 
    }
    header h1 { 
        font-size: 1.6rem !important; 
        text-align: center !important;
        margin: 15px 0 0 0 !important;
    }
    .subtitle { 
        font-size: 0.9rem !important; 
        text-align: center !important;
        white-space: normal !important;
        margin-top: 9px !important;
    }
    
    h3 {
        font-size: 1rem !important;      /* Era 1.1rem su desktop */
        margin: 25px 0 15px 0 !important;
        padding-bottom: 6px !important;
        letter-spacing: 0.03em !important;
    }
    
    h4 {
        font-size: 0.85rem !important;
        font-weight: 600 !important;
		margin: 22px 0 15px 0;
    }
    
    /* 2. Navigazione centrata */
      
    nav ul {
        flex-wrap: wrap !important;      /* Permette ai link di andare a capo */
        justify-content: center !important; /* Centra i link su ogni riga */
        gap: 5px 15px !important;        /* 5px tra le righe, 15px tra i link */
        padding: 12px 0 !important;      /* Aggiunge respiro verticale alla nav */
        height: auto !important;
/*        justify-content: space-between !important;
        height: auto !important;
        min-height: 40px !important;
        align-items: center !important; */
    }
    
    nav li {
        flex: none !important;    /* Rimuove la forzatura a occupare tutta la larghezza */
    }
    
    nav a {
    	font-size: 0.95rem !important;
	    padding: 6px 4px;
	    font-weight: 500;
    }
    

    /* 3. Jump links in linea (GO TO: segue il testo) */
    .jump-nav {
        display: block !important;
        text-align: left !important;
    }
    .jump-title, .jump-links, .jump-links a {
        display: inline !important;
        font-size: 0.9rem !important;
    }
    /* Proprietà specifica SOLO per il titolo (AGGIUNTA) */
    .jump-title {
        margin-right: 13px !important; 
    }
    .jump-links a:not(:last-child)::after {
        margin: 0 10px !important; /* Simmetria perfetta */
        display: inline-block !important;
        text-decoration: none !important;
    }
    /* Fix per tabelle su mobile */
    .mytable, .participants-table, .schedule-table {
    font-size: 0.85rem !important;
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .schedule-table {
    min-width: 450px;
    }
    
    /* 4. Griglia foto a 3 colonne su Mobile */
	.photo-grid { 
        gap: 8px !important; /* Spazio ridotto per far stare tutto */
    }

    .photo-grid > * {
        /* Forza 3 colonne: (100% - 16px di spazi totali) / 3 */
        width: calc((100% - 16px) / 3) !important;
        flex: 0 0 auto;
    }

    .photo-grid img { 
        width: 100% !important; /* La foto riempie il suo terzo di riga */
        max-width: none !important; 
    }
    
	.speaker-wrap {
        margin-top: 25px;
    }
    
    .speaker-wrap img {
        float: none;       /* Rimuove il float: la foto torna sopra il testo */
        margin: 0 auto 20px auto; /* Centra la foto e dà spazio sotto */
        display: block;
        width: 150px;
    }
    
    .schedule-table {
    min-width: 500px; 
    }
    
    .book-cover {
    	float: none !important;
    	display: block !important;
        width: 142px !important; /* Ridotta da 180px */
		margin-left: auto !important;
        margin-right: auto !important;
        margin-bottom: 10px !important;
    }

}

@media (max-width: 450px) {
    .book-cover {
        float: none;      /* Rimuove lo scorrimento */
        display: block;
        margin: 0 auto 20px auto; /* Centra la foto e aggiunge spazio sotto */
    }
}
