/* ==========================================================
   Stéphane Salgado — personal academic website
   ========================================================== */

:root {
    --ink: #1c2230;
    --ink-soft: #4a5263;
    --muted: #6b7280;
    --accent: #b0161f;          /* TSM red */
    --accent-dark: #8c1119;
    --accent-soft: #fbeceb;
    --bg: #ffffff;
    --bg-alt: #f6f4f1;
    --line: #e4e1dc;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(28, 34, 48, 0.08);
    --max: 1120px;
    --serif: "Playfair Display", Georgia, serif;
    --sans: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); }

h1, h2, h3 {
    font-family: var(--serif);
    line-height: 1.2;
    margin: 0 0 0.6em;
    color: var(--ink);
}
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; margin: 1.4em 0 0.4em; }
p { margin: 0 0 1em; }

.skip-link {
    position: absolute; left: -999px; top: 0;
    background: var(--ink); color: #fff; padding: 8px 14px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 780px; }

/* ---------- Header / navigation ---------- */

.header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.nav-container {
    max-width: var(--max); margin: 0 auto; padding: 0 24px;
    display: flex; align-items: center; gap: 24px; height: 68px;
}
.nav-brand {
    font-family: var(--serif); font-weight: 700; font-size: 1.25rem;
    color: var(--ink); text-decoration: none; margin-right: auto;
}
.nav-menu { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.nav-menu > li { position: relative; }
.nav-link {
    display: block; padding: 8px 12px; border-radius: 8px;
    color: var(--ink-soft); text-decoration: none; font-size: 0.95rem; font-weight: 500;
}
.nav-link:hover, .nav-link[aria-current="page"], .nav-link.active { color: var(--accent); background: var(--accent-soft); }

.submenu {
    list-style: none; margin: 0; padding: 8px;
    position: absolute; top: 100%; left: 0; min-width: 220px;
    background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
    opacity: 0; visibility: hidden; transform: translateY(6px); transition: all .15s ease;
}
.has-submenu:hover .submenu, .has-submenu:focus-within .submenu { opacity: 1; visibility: visible; transform: none; }
.submenu a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--ink-soft); text-decoration: none; font-size: 0.93rem; }
.submenu a:hover { background: var(--bg-alt); color: var(--accent); }

.language-links { display: flex; gap: 6px; align-items: center; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.language-links a { color: var(--muted); text-decoration: none; }
.language-links a[aria-current="page"] { color: var(--accent); }

.nav-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.hamburger, .hamburger::before, .hamburger::after {
    display: block; width: 22px; height: 2px; background: var(--ink); position: relative; transition: .2s;
}
.hamburger::before, .hamburger::after { content: ""; position: absolute; left: 0; }
.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }

@media (max-width: 900px) {
    .nav-toggle { display: block; order: 3; }
    .language-links { order: 2; }
    .nav-menu {
        display: none; position: absolute; top: 68px; left: 0; right: 0;
        flex-direction: column; background: #fff; padding: 12px 24px 20px;
        border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    }
    .nav-menu.open { display: flex; }
    .submenu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding: 0 0 0 16px; }
}

/* ---------- Buttons & links ---------- */

.btn {
    display: inline-block; padding: 12px 22px; border-radius: 999px;
    font-weight: 600; font-size: 0.95rem; text-decoration: none; transition: .15s;
    border: 2px solid var(--accent);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-secondary { background: transparent; color: var(--accent); }
.btn-secondary:hover { background: var(--accent-soft); }
.text-link { font-weight: 600; text-decoration: none; color: var(--accent); }
.text-link:hover { text-decoration: underline; }

/* ---------- Hero ---------- */

.hero { padding: 72px 0 64px; }
.hero-content { display: grid; grid-template-columns: 300px 1fr; gap: 56px; align-items: center; }
.profile-image {
    width: 300px; height: 300px; object-fit: cover; border-radius: 50%;
    box-shadow: var(--shadow); border: 6px solid #fff; outline: 1px solid var(--line);
}
.eyebrow {
    text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700;
    color: var(--accent); margin-bottom: .8em;
}
.hero-subtitle { font-size: 1.15rem; color: var(--ink-soft); }
.hero-institution { color: var(--muted); font-size: .95rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 20px; }
.social-links { display: flex; flex-wrap: wrap; gap: 20px; }

@media (max-width: 800px) {
    .hero { padding: 40px 0; }
    .hero-content { grid-template-columns: 1fr; gap: 28px; text-align: center; }
    .profile-image { width: 200px; height: 200px; margin: 0 auto; }
    .hero-actions, .social-links { justify-content: center; }
}

.page-hero { padding: 64px 0 40px; background: var(--bg-alt); border-bottom: 1px solid var(--line); }
.page-hero p.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 760px; }

/* ---------- Sections ---------- */

.section { padding: 72px 0; }
.section-alt { background: var(--bg-alt); }
.section-heading { max-width: 720px; margin-bottom: 36px; }
.two-column-section { display: grid; grid-template-columns: 1.2fr 1fr; gap: 56px; align-items: start; }
@media (max-width: 800px) { .two-column-section { grid-template-columns: 1fr; gap: 28px; } .section { padding: 52px 0; } }

.academic-facts {
    display: grid; gap: 4px 0; background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); padding: 28px;
}
.academic-facts strong { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-top: 12px; }
.academic-facts strong:first-child { margin-top: 0; }
.academic-facts span { color: var(--ink-soft); }

/* ---------- Cards ---------- */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 24px; }
.card-grid.two { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; display: flex; flex-direction: column; transition: .2s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card img { width: 100%; height: 190px; object-fit: cover; }
.card-body { padding: 22px 24px 24px; display: flex; flex-direction: column; flex: 1; }
.card-body p { color: var(--ink-soft); font-size: .95rem; }
.card-body .text-link { margin-top: auto; }
.card-kicker { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--accent); margin-bottom: .5em; }

/* ---------- Timeline ---------- */

.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 28px 28px; }
.timeline li::before {
    content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--accent);
}
.timeline .when { font-size: .85rem; font-weight: 700; color: var(--accent); }
.timeline h3 { margin: 2px 0 2px; font-size: 1.15rem; }
.timeline .role { color: var(--muted); font-size: .95rem; margin-bottom: .4em; }
.timeline p { color: var(--ink-soft); font-size: .95rem; }

/* ---------- Tags / logos ---------- */

.tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.tags li { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; font-size: .9rem; color: var(--ink-soft); }

.logo-strip { display: flex; flex-wrap: wrap; gap: 28px 40px; align-items: center; justify-content: center; }
.logo-strip img { height: 56px; width: auto; max-width: 170px; object-fit: contain; filter: grayscale(100%); opacity: .75; transition: .2s; }
.logo-strip img:hover { filter: none; opacity: 1; }

/* ---------- Publications ---------- */

.pub-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.pub {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px;
    display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
}
.pub-title { font-weight: 600; margin-bottom: 4px; }
.pub-ref { color: var(--ink-soft); font-size: .93rem; margin: 0; }
.pub-journal { font-style: italic; }
@media (max-width: 640px) { .pub { grid-template-columns: 1fr; } }
.note { font-size: .88rem; color: var(--muted); }

/* ---------- Articles ---------- */

.article-meta { color: var(--muted); font-size: .92rem; margin-bottom: 28px; }
.article-figure { margin: 0 0 36px; }
.article-figure img { border-radius: var(--radius); max-height: 460px; width: 100%; object-fit: cover; }
.article h2 { font-size: 1.5rem; margin-top: 1.6em; }
.pull-quote {
    margin: 32px 0; padding: 4px 0 4px 24px; border-left: 4px solid var(--accent);
    font-family: var(--serif); font-size: 1.3rem; line-height: 1.45; color: var(--ink);
}
.source-box { margin-top: 40px; padding: 22px 26px; background: var(--bg-alt); border-radius: var(--radius); font-size: .95rem; }

/* ---------- Accordions (scales, FAQ) ---------- */

details.acc {
    background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px;
}
details.acc summary {
    cursor: pointer; padding: 14px 20px; font-weight: 600; list-style: none;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after { content: "+"; font-size: 1.3rem; color: var(--accent); font-weight: 400; }
details.acc[open] summary::after { content: "–"; }
details.acc .acc-body { padding: 0 20px 18px; color: var(--ink-soft); font-size: .95rem; }
details.acc .acc-body p { margin-bottom: .7em; }
details.acc .acc-body em { color: var(--muted); }

.scale-group { margin-bottom: 44px; }
.scale-group h2 { font-size: 1.5rem; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 40px; padding: 0; list-style: none; }
.toc a { display: block; padding: 6px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink-soft); font-size: .9rem; }
.toc a:hover { border-color: var(--accent); color: var(--accent); }
.search-box {
    width: 100%; max-width: 420px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px;
    font: inherit; margin-bottom: 20px;
}

/* ---------- Steps (thesis supervision) ---------- */

.steps { counter-reset: step; display: grid; gap: 18px; }
.step { position: relative; padding: 24px 26px 20px 84px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.step::before {
    counter-increment: step; content: counter(step);
    position: absolute; left: 24px; top: 22px; width: 40px; height: 40px; border-radius: 50%;
    background: var(--accent); color: #fff; font-weight: 700; display: grid; place-items: center;
}
.step h3 { margin-bottom: .3em; }
.step > p { color: var(--ink-soft); }
.step details summary { cursor: pointer; font-weight: 600; color: var(--accent); font-size: .92rem; }
.step details p { margin-top: .8em; font-size: .95rem; color: var(--ink-soft); }

.expect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 800px) { .expect-grid { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */

.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.contact-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.contact-card h3 { font-size: 1.05rem; font-family: var(--sans); font-weight: 700; }
.contact-card p { color: var(--ink-soft); font-size: .95rem; }

/* ---------- Footer ---------- */

.footer { background: var(--ink); color: #c9cdd6; padding: 40px 0; font-size: .9rem; }
.footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.footer a { color: #fff; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }

/* ---------- Blog ---------- */

.card img.contain { object-fit: contain; background: var(--bg-alt); }
.card-date { font-size: .85rem !important; color: var(--muted) !important; margin-bottom: .6em; }
.card-date a { color: var(--accent); font-weight: 600; text-decoration: none; }
.card-placeholder {
    height: 190px; display: grid; place-items: center; padding: 24px; text-align: center;
    background: linear-gradient(135deg, var(--accent) 0%, #5a0b10 100%);
}
.card-placeholder span { color: #fff; font-family: var(--serif); font-size: 1.3rem; line-height: 1.3; }
.pub-actions { display: flex; flex-direction: column; gap: 8px; }
.pub-actions .btn { text-align: center; padding: 9px 18px; font-size: .88rem; }
@media (max-width: 640px) { .pub-actions { flex-direction: row; flex-wrap: wrap; } }
.badge { display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: 999px; background: #e6f4ea; color: #1e6b34; font-size: .72rem; font-weight: 700; vertical-align: middle; }
