/* ============================================================
   Scientific profile — light editorial
   Warm paper ground, serif display, one ink-blue accent.
   ============================================================ */

:root {
    --paper: #faf8f4;
    --paper-2: #ffffff;
    --wash: #f2efe8;
    --ink: #1c1b18;
    --ink-2: #56534c;
    --ink-3: #86827a;
    --rule: #e2ddd2;
    --rule-2: #cfc9bb;
    --accent: #1e4d8c;
    --accent-soft: #e8eef7;
    --serif: 'Newsreader', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --measure: 68ch;
}

* { box-sizing: border-box; }

html {
    overflow-x: hidden;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

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

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 28px; }

/* ---------- Masthead ---------- */
.masthead { padding: 56px 0 30px; border-bottom: 1px solid var(--rule); }

.masthead-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 36px;
    align-items: start;
}

.name {
    font-size: clamp(2.6rem, 6vw, 4.1rem);
    letter-spacing: -0.022em;
    margin-bottom: 10px;
}

.role {
    font-family: var(--serif);
    font-size: 1.25rem;
    font-style: italic;
    color: var(--accent);
    margin-bottom: 4px;
}

.affil { color: var(--ink-2); margin-bottom: 18px; }

.tagline {
    font-family: var(--serif);
    font-size: 1.15rem;
    color: var(--ink-2);
    max-width: 52ch;
    margin-bottom: 22px;
}

.contact { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: .92rem; }
.contact .label { color: var(--ink-3); margin-right: 6px; }

.portrait {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--rule-2);
    filter: saturate(.92);
}

/* ---------- Language toggle ---------- */
.utility { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }

.lang {
    display: inline-flex;
    border: 1px solid var(--rule-2);
    border-radius: 999px;
    overflow: hidden;
    background: var(--paper-2);
}

.lang button {
    font: 600 12px/1 var(--sans);
    letter-spacing: .08em;
    padding: 8px 14px;
    border: 0;
    background: transparent;
    color: var(--ink-2);
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.lang button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.lang button:not([aria-pressed="true"]):hover { background: var(--wash); color: var(--ink); }

.print-link {
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
    background: none;
    border: 0;
    cursor: pointer;
    font-family: var(--sans);
}
.print-link:hover { color: var(--accent); }

/* ---------- Section nav ---------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(250, 248, 244, .88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--rule);
}

.nav-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav-inner::-webkit-scrollbar { display: none; }

.nav a {
    flex: 0 0 auto;
    padding: 14px 12px;
    font-size: .86rem;
    color: var(--ink-2);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color .2s ease, border-color .2s ease;
}

.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Sections ---------- */
.section { padding: 64px 0; border-bottom: 1px solid var(--rule); scroll-margin-top: 62px; }
.section:last-of-type { border-bottom: 0; }

.section-grid { display: grid; grid-template-columns: 190px 1fr; gap: 40px; }

.section-label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink-3);
    padding-top: 8px;
}

.section-title { font-size: 2rem; letter-spacing: -0.015em; margin-bottom: 8px; }
.section-intro { color: var(--ink-2); max-width: var(--measure); font-family: var(--serif); font-size: 1.05rem; }

/* ---------- Research ---------- */
.research { display: grid; gap: 34px; }

.research-item { display: grid; grid-template-columns: 1fr 272px; gap: 30px; align-items: start; }
.research-item h3 { font-size: 1.4rem; margin-bottom: 8px; }
.research-item p { color: var(--ink-2); max-width: var(--measure); margin: 0; }

.figures { display: flex; flex-wrap: wrap; gap: 8px; }
.figures img {
    flex: 1 1 0;
    min-width: 0;
    height: 136px;
    border: 1px solid var(--rule);
    border-radius: 3px;
    background: var(--paper-2);
    padding: 5px;
    object-fit: contain;
    transition: transform .4s cubic-bezier(.2,.7,.2,1);
}
.figures img:hover { transform: scale(1.03); }

/* ---------- Timeline entries ---------- */
.entries { display: grid; gap: 0; }

.entry {
    display: grid;
    grid-template-columns: 132px 1fr;
    gap: 24px;
    padding: 18px 0;
    border-top: 1px solid var(--rule);
}
.entry:first-child { border-top: 0; padding-top: 0; }

.entry-period {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-3);
    padding-top: 4px;
    letter-spacing: .02em;
}

.entry-title { font-family: var(--serif); font-size: 1.18rem; font-weight: 600; }
.entry-org { color: var(--accent); font-size: .95rem; margin-bottom: 2px; }
.entry-text { color: var(--ink-2); font-size: .95rem; max-width: var(--measure); }

.subhead {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 40px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--rule);
}
.subhead:first-child { margin-top: 0; }

/* ---------- Publications ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }

.field {
    font: 400 .9rem/1 var(--sans);
    padding: 10px 14px;
    border: 1px solid var(--rule-2);
    border-radius: 4px;
    background: var(--paper-2);
    color: var(--ink);
    min-width: 0;
}
.field:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
#pub-search { flex: 1 1 260px; }

.count { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: .06em; }

.pub { display: grid; grid-template-columns: 62px 1fr; gap: 20px; padding: 16px 0; border-top: 1px solid var(--rule); }
.pub:first-of-type { border-top: 0; }
.pub-year { font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding-top: 5px; }
.pub-title { font-family: var(--serif); font-size: 1.1rem; line-height: 1.35; margin-bottom: 3px; }
.pub-meta { font-size: .9rem; color: var(--ink-2); }
.pub-venue { font-style: italic; }
.pub mark { background: #fbf0b8; color: inherit; padding: 0 1px; }

.tag {
    display: inline-block;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 3px;
    padding: 2px 7px;
    margin-left: 8px;
    vertical-align: 2px;
}

.empty { color: var(--ink-3); font-style: italic; padding: 24px 0; }

/* Audio summary attached to a publication */
.pub-audio {
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--wash);
    border: 1px solid var(--rule);
    border-radius: 5px;
    max-width: 640px;
}

.pub-audio-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    font-size: .84rem;
    color: var(--ink-2);
    margin-bottom: 9px;
}

.pub-audio-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--accent);
}

.pub-audio-credit { color: var(--ink-3); font-size: .8rem; }

.pub-audio audio { width: 100%; height: 34px; display: block; }

/* ---------- Lists (teaching, conferences) ---------- */
.bullets li {
    position: relative;
    padding: 0 0 12px 20px;
    color: var(--ink-2);
    max-width: var(--measure);
}
.bullets li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: .68em;
    width: 6px;
    height: 1px;
    background: var(--rule-2);
}

/* ---------- Cards (software, documents) ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

.card {
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 22px;
    transition: border-color .3s ease, transform .3s cubic-bezier(.2,.7,.2,1), box-shadow .3s ease;
}
.card:hover {
    border-color: var(--rule-2);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(28, 27, 24, .06);
}
.card h3 { font-size: 1.22rem; margin-bottom: 8px; }
.card p { color: var(--ink-2); font-size: .93rem; margin-bottom: 16px; }

.card-links { display: flex; flex-wrap: wrap; gap: 8px; }

.btn {
    display: inline-block;
    font: 500 .84rem/1 var(--sans);
    padding: 9px 14px;
    border-radius: 4px;
    border: 1px solid var(--rule-2);
    color: var(--ink);
    background: var(--paper);
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.btn:hover { background: var(--wash); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #17406f; color: #fff; }

/* ---------- Visualisation ---------- */
.viz {
    border: 1px solid var(--rule);
    border-radius: 6px;
    overflow: hidden;
    background: var(--paper-2);
}
.viz iframe { width: 100%; height: 520px; border: 0; display: block; }

/* ---------- Footer ---------- */
.foot {
    padding: 40px 0 60px;
    border-top: 1px solid var(--rule);
    color: var(--ink-3);
    font-size: .85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
}

/* ---------- Back to top ---------- */
#to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 40;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--rule-2);
    background: var(--paper-2);
    color: var(--ink-2);
    cursor: pointer;
    display: grid;
    place-items: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity .3s ease, transform .3s ease;
    box-shadow: 0 6px 20px rgba(28, 27, 24, .08);
}
#to-top.show { opacity: 1; pointer-events: auto; transform: none; }
#to-top:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
    .section-grid { grid-template-columns: 1fr; gap: 18px; }
    .section-label { padding-top: 0; }
    .research-item { grid-template-columns: 1fr; }
    .figures img { flex: 0 1 200px; height: 150px; }
}

@media (max-width: 620px) {
    .wrap { padding: 0 20px; }
    .masthead { padding: 34px 0 24px; }
    .masthead-grid { grid-template-columns: 1fr; gap: 22px; }
    .portrait { width: 96px; height: 96px; }
    .section { padding: 46px 0; }
    .entry, .pub { grid-template-columns: 1fr; gap: 6px; }
    .entry-period, .pub-year { padding-top: 0; }
    .viz iframe { height: 380px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
    .card, .figures img, #to-top { transition: none !important; }
}

/* ---------- Print: the page doubles as a CV ---------- */
@media print {
    :root { --paper: #fff; --paper-2: #fff; }
    .nav, .utility, #to-top, .viz, .figures, .pub-audio { display: none !important; }
    body { font-size: 10.5pt; line-height: 1.45; }
    .section { padding: 18pt 0; break-inside: avoid; border-bottom: .5pt solid #ccc; }
    .section-grid { grid-template-columns: 120pt 1fr; gap: 18pt; }
    .research-item { grid-template-columns: 1fr; }
    .card { break-inside: avoid; border: .5pt solid #ccc; }
    .pub, .entry { break-inside: avoid; }
    a { color: #000; text-decoration: none; }
    .reveal { opacity: 1 !important; transform: none !important; }
}
