/* ==========================================================================
   Leo Gioia — personal site
   Minimal / elegant, self-contained (no external CDNs).
   Colours live in :root — change --accent to restyle the whole site.
   ========================================================================== */

/* ---- Self-hosted fonts (latin subset) ---------------------------------- */
@font-face {
    font-family: "Raleway";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/raleway-400.woff2") format("woff2");
}
@font-face {
    font-family: "Raleway";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/raleway-600.woff2") format("woff2");
}
@font-face {
    font-family: "Raleway";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/raleway-700.woff2") format("woff2");
}

/* ---- Design tokens ----------------------------------------------------- */
:root {
    --ink: #1b1b1f;      /* headings */
    --body: #3c3c42;     /* paragraph text */
    --muted: #8a8a90;    /* dates, captions */
    --line: #e8e7e2;     /* hairlines */
    --bg: #ffffff;
    --bg-alt: #f6f5f2;   /* alternate section band */
    --accent: #a97d4f;   /* warm brass — a nod to the Apollo-era intro */
    --accent-dark: #8a6339;

    --sans: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

    --maxw: 820px;
    --nav-h: 60px;
}

/* ---- Reset-ish --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--sans);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
    color: var(--body);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a { color: var(--accent-dark); text-decoration: none; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { color: var(--ink); font-weight: 700; margin: 0; }

/* ---- Language switch: show only the active language -------------------- */
[data-lang] { display: none; }
html[lang="it"] [data-lang="it"],
html[lang="en"] [data-lang="en"] { display: revert; }

/* ---- Layout helpers ---------------------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

section { padding: 88px 0; scroll-margin-top: var(--nav-h); }
section.band { background: var(--bg-alt); }

/* ==========================================================================
   Top navigation (sticky)
   ========================================================================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--nav-h);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar .wrap {
    max-width: 1080px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand img { height: 26px; width: auto; }

.nav { display: flex; align-items: center; gap: 26px; }
.nav a.navlink {
    color: var(--ink);
    font-size: 13px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    position: relative;
    padding: 4px 0;
}
.nav a.navlink::after {
    content: "";
    position: absolute;
    left: 0; bottom: 0;
    width: 0; height: 2px;
    background: var(--accent);
    transition: width .25s ease;
}
.nav a.navlink:hover::after { width: 100%; }

/* language toggle */
.lang {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow: hidden;
}
.lang button {
    font-family: var(--sans);
    font-size: 12px;
    letter-spacing: 1px;
    font-weight: 600;
    padding: 5px 11px;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background .2s, color .2s;
}
.lang button.active { background: var(--ink); color: #fff; }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { padding: 116px 0 84px; text-align: center; }
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-dark);
    margin: 0 0 14px;
}
.hero h1 {
    font-size: clamp(2.6rem, 7vw, 4rem);
    letter-spacing: 6px;
    line-height: 1.05;
    margin: 0 0 34px;
}
.hero-intro { text-align: left; color: var(--body); }
.hero-intro p { margin: 0 0 16px; }
.hero-intro p:last-child { margin-bottom: 0; }
.hero-intro b { color: var(--ink); font-weight: 600; }

.hero-rule {
    width: 56px; height: 3px;
    background: var(--accent);
    border: 0; margin: 0 auto 34px;
}

/* ==========================================================================
   Section titles
   ========================================================================== */
.section-title {
    text-align: center;
    font-size: 1.9rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin: 0 0 8px;
}
.section-title + .title-rule {
    width: 44px; height: 3px;
    background: var(--accent);
    border: 0; margin: 0 auto 56px;
}

/* ==========================================================================
   Presentation (dropcap)
   ========================================================================== */
.presentation p { margin: 0; text-align: justify; }
.presentation p[data-lang]::first-letter {
    -webkit-initial-letter: 2;
    initial-letter: 2;
    font-weight: 700;
    color: var(--accent-dark);
    margin-right: .12em;
}

/* ==========================================================================
   Timeline entries (experience / education)
   ========================================================================== */
.entry {
    position: relative;
    padding: 0 0 40px 28px;
    border-left: 2px solid var(--line);
    margin-left: 4px;
}
.entry:last-child { padding-bottom: 0; }
.entry::before {
    content: "";
    position: absolute;
    left: -7px; top: 5px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent);
}
section.band .entry::before { background: var(--bg-alt); }

.entry .date {
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 600;
}
.entry .org { font-size: 1.15rem; margin: 4px 0 2px; }
.entry .role { color: var(--accent-dark); font-weight: 600; font-size: .95rem; margin: 0 0 10px; }
.entry p { margin: 0 0 12px; }
.entry p:last-child { margin-bottom: 0; }
.entry .lead { color: var(--ink); font-weight: 600; }

/* ==========================================================================
   Publications
   ========================================================================== */
.pub { padding: 0 0 30px; border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.pub:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.pub h3 { font-size: 1.1rem; line-height: 1.45; margin: 0 0 8px; }
.pub h3 a { color: var(--ink); }
.pub h3 a:hover { color: var(--accent); }
.pub .authors { color: var(--body); font-style: italic; font-size: .95rem; margin: 0 0 4px; }
.pub .venue { color: var(--muted); font-size: .9rem; margin: 0; }

/* thesis links inside education */
.thesis-title a { color: var(--ink); font-weight: 700; }
.thesis-title a:hover { color: var(--accent); }
.entry .supervisors { color: var(--muted); font-size: .9rem; font-style: italic; }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    background: var(--ink);
    color: #cfcfd4;
    text-align: center;
    padding: 64px 0 56px;
}
.footer img { height: 84px; width: auto; margin: 0 auto 18px; }
.footer a { color: #fff; }
.footer a:hover { color: var(--accent); }
.footer .site { font-weight: 700; letter-spacing: 1px; margin: 0 0 6px; }
.footer .email { margin: 0 0 22px; font-size: .95rem; }
.footer .social a { display: inline-flex; opacity: .85; transition: opacity .2s; }
.footer .social a:hover { opacity: 1; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 640px) {
    body { font-size: 16px; }
    section { padding: 64px 0; }
    .hero { padding: 84px 0 64px; }
    .nav { gap: 14px; }
    .nav a.navlink { display: none; }          /* keep bar clean on mobile */
    .presentation p { text-align: left; }
}
