/* =========================================================
   style.css — foglio di stile condiviso da index.html,
   research.html e cv.html
   ========================================================= */

/* ---------- Colori e tema ---------- */
:root {
    --primary-color: #1a365d;
    --accent-color: #2b6cb0;
    --text-color: #2d3748;
    --text-muted: #4a5568;
    --bg-color: #f7fafc;
    --card-bg: #ffffff;
    --nav-bg: #ffffff;
    --border-color: #e2e8f0;
    --border-color-light: #edf2f7;
    --hover-bg: #edf2f7;
    --border-radius: 12px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --date-color: #64748b;      /* date nelle voci */
    --on-accent: #ffffff;       /* testo/icone sopra il colore d'accento */
    --btn-hover-bg: #1e40af;    /* pulsante al passaggio del mouse */
}

[data-theme="dark"] {
    --primary-color: #90cdf4;
    --accent-color: #63b3ed;
    --text-color: #f7fafc;
    --text-muted: #a0aec0;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --nav-bg: #1e293b;
    --border-color: #334155;
    --border-color-light: #334155;
    --hover-bg: #334155;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.5);
    --date-color: #94a3b8;      /* contrasto 5,7:1 sulle card scure */
    --on-accent: #0f172a;       /* contrasto 7,8:1 sull'azzurro */
    --btn-hover-bg: #90cdf4;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ---------- Navbar ---------- */
.navbar {
    display: flex;
    align-items: center;
    background-color: var(--nav-bg);
    padding: 15px 30px;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.navbar-logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.navbar a:not(.navbar-logo) {
    color: var(--primary-color);
    text-decoration: none;
    padding: 8px 16px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
}

/* Pagina corrente: class="active" sul link del menu */
.navbar a.active {
    color: var(--accent-color);
    font-weight: 700;
}

.navbar a:not(.navbar-logo):hover {
    background-color: var(--hover-bg);
    color: var(--accent-color);
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
    transition: transform 0.2s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* ---------- Layout e card ---------- */
.container {
    max-width: 950px;
    margin: 40px auto;
    padding: 0 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Paragrafo introduttivo sotto il titolo (pagina Research) */
.page-header p {
    width: 100%;
    margin: 0;
}

/* Nota sotto il titolo (pagina CV) */
.page-note {
    font-size: 0.95rem;
    font-style: italic;
    margin: -10px 0 30px 0;
}

.btn-primary {
    background-color: var(--accent-color);
    color: var(--on-accent);
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    border: 1px solid transparent;
}

.btn-primary:hover {
    background-color: var(--btn-hover-bg);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 40px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

h2.section-title {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color-light);
}

/* Sottosezioni (Professional Service and Research Management) */
h3.subsection-title {
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 30px 0 15px 0;
}

h2.section-title + h3.subsection-title {
    margin-top: 0;
}

p {
    margin-bottom: 1.2em;
    color: var(--text-muted);
}

/* Testo giustificato su tutte le pagine; la sillabazione automatica
   (lingua inglese, lang="en") evita spazi troppo larghi, anche su mobile */
p,
ul.cv-list li,
ul.pub-list li,
ul.topic-list li {
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
}

/* ---------- Home ---------- */
.profile-name {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin: 0 0 5px 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.profile-title {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 0 0 25px 0;
    font-weight: 400;
}

.about-grid {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.profile-img {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

ul.topic-list {
    color: var(--text-muted);
    padding-left: 20px;
    margin-bottom: 0;
}

ul.topic-list li {
    margin-bottom: 10px;
    padding-left: 5px;
}

.social-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background-color: var(--card-bg);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.2s ease;
}

.social-icon:hover {
    background-color: var(--accent-color);
    color: var(--on-accent);
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.social-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ---------- Voci a elenco (CV, progetti, contributi) ---------- */
ul.cv-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

ul.cv-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 25px;
    color: var(--text-muted);
    line-height: 1.6;
}

ul.cv-list li:last-child {
    margin-bottom: 0;
}

ul.cv-list li::before {
    content: "•";
    color: var(--accent-color);
    font-size: 1.5rem;
    position: absolute;
    left: 0;
    top: -5px;
}

ul.cv-list li strong {
    color: var(--text-color);
    font-size: 1.05rem;
}

.date-text {
    color: var(--date-color);
    font-size: 0.95rem;
    display: block;
    margin-top: 4px;
}

/* Campi e descrizioni delle voci, come nel CV in PDF */
.entry-detail {
    display: block;
    margin-top: 6px;
}

/* Titoli dei temi in Research Contributions */
.contrib-label {
    color: var(--primary-color);
    font-weight: 600;
}

/* ---------- Pubblicazioni ---------- */
.pub-note {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: -20px;
    margin-bottom: 30px;
    font-style: italic;
}

ul.pub-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

ul.pub-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 22px;
    color: var(--text-muted);
    line-height: 1.6;
    overflow-wrap: break-word;
}

ul.pub-list li::before {
    content: "•";
    color: var(--accent-color);
    font-size: 1.5rem;
    position: absolute;
    left: 0;
    top: -5px;
}

ul.pub-list li strong {
    color: var(--text-color);
}

ul.pub-list sup, .page-header sup {
    line-height: 0;
}

/* Etichette delle pubblicazioni ([J1], [C1], ...), le stesse del CV */
ul.pub-list.labeled li {
    padding-left: 56px;
}

ul.pub-list.labeled li::before {
    content: none;
}

/* Voce raggiunta da un'etichetta: evidenziata per un attimo, poi l'evidenziatura svanisce.
   La classe "flash" viene aggiunta dallo script in fondo a research.html */
ul.pub-list li.flash {
    border-radius: 6px;
    animation: target-highlight 2.5s ease-out forwards;
}

@keyframes target-highlight {
    0%, 40% { background-color: var(--hover-bg); }
    100%    { background-color: transparent; }
}

.pub-label {
    position: absolute;
    left: 0;
    top: 0;
    color: var(--accent-color);
    font-weight: 600;
}

.inline-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-left: 4px;
}

/* ---------- Link ---------- */
a.text-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

a.text-link:hover {
    text-decoration: underline;
}

/* ---------- Footer ---------- */
footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 20px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 15px;
    }
    .navbar-logo {
        margin-bottom: 15px;
    }
    .nav-right {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .btn-primary {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    .card {
        padding: 25px;
    }
    .about-grid {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .profile-name {
        font-size: 2rem;
    }
    ul.cv-list li {
        overflow-wrap: break-word;
    }
    ul.pub-list.labeled li {
        padding-left: 48px;
    }
}
