/* ---------- Fonts (self-hosted, no third-party requests) ---------- */
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("../fonts/source-serif-4-latin-opsz-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("../fonts/source-serif-4-latin-ext-opsz-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url("../fonts/instrument-sans-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url("../fonts/instrument-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: italic;
  font-display: swap;
  font-weight: 400 700;
  src: url("../fonts/instrument-sans-latin-wght-italic.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: italic;
  font-display: swap;
  font-weight: 400 700;
  src: url("../fonts/instrument-sans-latin-ext-wght-italic.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --surface: #f4f6fa;
  --text: #1c2129;
  --muted: #5a6371;
  --rule: #e1e5ec;
  --accent: #2b4796;        /* ICTP navy (#2e3b6f), lifted for link contrast */
  --accent-strong: #1f3370;
  --accent-soft: #e8edf8;

  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --measure: 42rem;
  --wide: 52rem;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 2.25rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181d;
    --surface: #1d2129;
    --text: #e4e7ec;
    --muted: #9ba4b1;
    --rule: #2b313b;
    --accent: #93aeef;
    --accent-strong: #b7c9f5;
    --accent-soft: #1f2840;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15181d;
  --surface: #1d2129;
  --text: #e4e7ec;
  --muted: #9ba4b1;
  --rule: #2b313b;
  --accent: #93aeef;
  --accent-strong: #b7c9f5;
  --accent-soft: #1f2840;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
a:hover { color: var(--accent-strong); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
p { margin: 0 0 1em; }
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 560;
  line-height: 1.2;
  letter-spacing: -0.005em;
  font-optical-sizing: auto;
  margin: 0;
}
h2 { font-size: var(--step-2); margin-bottom: 0.9rem; }
h3 { font-size: var(--step-1); }
ul { margin: 0; padding: 0; list-style: none; }

.wrap { width: 100%; max-width: var(--measure); margin-inline: auto; padding-inline: 1.25rem; }
.skip-link { position: absolute; left: -999px; top: 0.5rem; background: var(--bg); padding: 0.4rem 0.8rem; z-index: 10; }
.skip-link:focus { left: 0.5rem; }

/* ---------- Header ---------- */
.site-header { padding-top: 2.25rem; }
.site-header .wrap { max-width: var(--wide); }
.header-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem 2rem; }
.site-name {
  font-family: var(--serif);
  font-size: var(--step-3);
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.015em;
}
.site-name:hover { color: var(--text); }
.site-tagline { margin: 0.45rem 0 0; color: var(--muted); font-size: var(--step-0); }
.site-nav { display: flex; align-items: center; gap: 0.25rem; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0.15rem 1.1rem; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 0.97rem; padding-block: 0.2rem; }
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.theme-toggle {
  margin-left: 0.9rem;
  width: 2rem; height: 2rem;
  display: inline-grid; place-items: center;
  border: 1px solid var(--rule); border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--muted); }
.theme-toggle svg { width: 1rem; height: 1rem; }

/* The signature: a phase transition as the header rule */
.curve-wrap { margin-top: 1.1rem; }
.phase-curve { display: block; width: 100%; height: 44px; overflow: visible; }
.phase-curve path { stroke: var(--accent); stroke-width: 1.5px; stroke-linejoin: round; }

main.wrap { max-width: var(--wide); padding-top: 2.75rem; padding-bottom: 4rem; }
/* One left edge for header, content and footer; prose keeps a readable measure */
main p, main .news, main .pubs, main .plain, main dl, main blockquote, main .notes, main .events, main .people, main .alumni { max-width: var(--measure); }
main .intro p { max-width: none; }
.page-title { font-size: var(--step-3); margin-bottom: 0.6rem; }
.page-intro { color: var(--muted); max-width: 38rem; margin-bottom: 2.25rem; }
.page-intro:has(+ .page-intro) { margin-bottom: 0.6rem; }
.block { margin-top: 3rem; }
.block:first-child { margin-top: 0; }

/* ---------- Home ---------- */
.intro { display: grid; grid-template-columns: 11.5rem 1fr; gap: 2rem; align-items: start; }
.portrait { width: 100%; aspect-ratio: 8 / 9; object-fit: cover; border-radius: 6px; }
.intro-text p:last-of-type { margin-bottom: 1.2rem; }
.link-row { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; font-size: 0.97rem; }
.link-row .email { color: var(--muted); }

.grant {
  margin-top: 2.5rem; padding: 1rem 1.25rem;
  background: var(--surface); border-radius: 6px;
}
main .grant p { margin: 0; max-width: none; font-size: 0.97rem; }

.news li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; padding-block: 0.55rem; border-top: 1px solid var(--rule); }
.news li:last-child { border-bottom: 1px solid var(--rule); }
.news-date { color: var(--muted); font-size: var(--step--1); font-variant-numeric: tabular-nums; padding-top: 0.15rem; }
.more { margin-top: 1rem; }

/* ---------- Publications ---------- */
.pub { padding-block: 0.85rem; border-top: 1px solid var(--rule); }
.pubs .pub:last-child { border-bottom: 1px solid var(--rule); }
.pub p { margin: 0; }
.pub-title { font-family: var(--serif); font-size: 1.12rem; font-weight: 520; line-height: 1.35; }
.pub-title a { color: var(--text); text-decoration: none; }
.pub-title a:hover { color: var(--accent); text-decoration: underline; text-decoration-color: currentColor; }
.pub-authors { color: var(--muted); font-size: 0.95rem; margin-top: 0.25rem !important; }
.pub-authors .member { color: var(--text); font-weight: 560; }
.pub-meta { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; font-size: var(--step--1); margin-top: 0.3rem !important; }
.pub-venue { color: var(--muted); font-style: italic; }
.year-block { margin-top: 2rem; }
.section-intro { color: var(--muted); }
.year-block:first-of-type { margin-top: 0; }
.year { font-size: var(--step-1); color: var(--muted); font-variant-numeric: lining-nums; margin-bottom: 0.4rem; }
.pubs.compact .pub { padding-block: 0.5rem; }
.pubs.compact .pub-title { font-size: 1.02rem; }
.theme .pubs { margin-top: 1.25rem; }

/* ---------- Research ---------- */
.theme { margin-top: 3.25rem; }
.theme:first-of-type { margin-top: 0; }
.theme > p { max-width: 40rem; }
.plain li { padding-block: 0.3rem; }

/* ---------- Group ---------- */
.group-photo { margin: 0 0 2.5rem; }
.group-photo img { border-radius: 6px; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.people { display: grid; gap: 1.6rem; }
.person { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1.25rem; align-items: start; }
.avatar { width: 5.5rem; height: 5.5rem; border-radius: 50%; object-fit: cover; }
.avatar-initials {
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--serif); font-size: 1.6rem; font-weight: 500;
}
.person-name { font-size: var(--step-1); }
.person-role { color: var(--muted); font-size: var(--step--1); margin: 0.1rem 0 0.4rem; }
.person-summary { margin: 0.35rem 0 0.4rem; }
.person-bio { font-size: 0.95rem; color: var(--muted); }
.person-bio summary { cursor: pointer; color: var(--accent); width: fit-content; font-size: var(--step--1); }
.person-bio p { margin: 0.4rem 0 0; }
.person-links { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; font-size: var(--step--1); margin: 0.4rem 0 0; }

.alumni { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.alumni th { text-align: left; font-weight: 600; color: var(--muted); font-size: var(--step--1); padding: 0 0.75rem 0.45rem 0; border-bottom: 1px solid var(--rule); }
.alumni td { padding: 0.5rem 0.75rem 0.5rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.alumni td:first-child { font-weight: 560; }
.join dl { display: grid; grid-template-columns: 8.5rem 1fr; gap: 0.6rem 1.25rem; margin: 0; }
.join dt { font-family: var(--serif); font-weight: 560; font-size: 1.08rem; }
.join dd { margin: 0; }

/* ---------- Teaching & events ---------- */
.notes { display: grid; gap: 0; }
.note { padding-block: 1.1rem; border-top: 1px solid var(--rule); }
.note:last-child { border-bottom: 1px solid var(--rule); }
.note-kind { color: var(--text); font-weight: 560; }
.note-title { font-size: var(--step-1); margin: 0 0 0.35rem; }
.note-title a { color: var(--text); text-decoration: none; }
.note-title a:hover { color: var(--accent); }
.note-context { margin: 0; color: var(--muted); }
.events li { padding-block: 0.75rem; border-top: 1px solid var(--rule); }
.events li:last-child { border-bottom: 1px solid var(--rule); }
.event-name { margin: 0; font-family: var(--serif); font-size: 1.1rem; font-weight: 520; }
.event-name a { color: var(--text); text-decoration: none; }
.event-name a:hover { color: var(--accent); }
.event-meta { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- Highlights ---------- */
.crumb { font-size: var(--step--1); margin-bottom: 0.4rem; }
.crumb a { color: var(--muted); }
.highlight-paper { margin: 1rem 0 2rem; }
.prose { max-width: var(--measure); }
.prose h2 { margin: 2.25rem 0 0.75rem; }
.prose ul { list-style: disc; padding-left: 1.25rem; margin: 0 0 1em; }
.prose li { margin-bottom: 0.35rem; }
.prose img, .figure img { margin: 1.75rem 0; border-radius: 4px; background: #fff; }
.figure { margin: 1.75rem 0; max-width: var(--measure); }
.figure img { margin: 0 0 0.6rem; }
figcaption { color: var(--muted); font-size: var(--step--1); }

/* ---------- Gallery ---------- */
.gallery { columns: 3 15rem; column-gap: 0.75rem; }
.gallery figure { break-inside: avoid; margin: 0 0 0.75rem; }
.gallery img { width: 100%; border-radius: 4px; }
.gallery figcaption { margin-top: 0.3rem; }

/* ---------- About ---------- */
.albums li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding-block: 0.5rem; border-top: 1px solid var(--rule); }
.albums li:last-child { border-bottom: 1px solid var(--rule); }
.album-month { color: var(--muted); font-size: var(--step--1); padding-top: 0.15rem; }
@media (max-width: 40rem) { .albums li { grid-template-columns: 1fr; gap: 0.1rem; } }
main h2 { margin-top: 2.75rem; }
main section h2, main .block h2, main .theme h2 { margin-top: 0; }
.wide-img { border-radius: 6px; margin: 1.75rem 0; }
.block .wide-img { width: 100%; max-width: 100%; margin-top: 1rem; }
blockquote { margin: 1.5rem 0; padding: 0 0 0 1.25rem; border-left: 2px solid var(--rule); }
blockquote p { font-family: var(--serif); font-size: 1.15rem; line-height: 1.5; margin: 0 0 0.4rem; }
blockquote p:last-child { font-family: var(--sans); font-size: var(--step--1); color: var(--muted); }
cite { font-style: normal; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding-block: 2.25rem 3rem; font-size: var(--step--1); color: var(--muted); }
.site-footer .wrap { max-width: var(--wide); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; }
.funding img { width: 252px; margin-bottom: 0.75rem; background: #fff; padding: 6px; border-radius: 4px; }
.site-footer p { margin: 0 0 0.6rem; }
.updated { margin-top: 1rem !important; }

/* ---------- Small screens ---------- */
@media (max-width: 40rem) {
  .site-header { padding-top: 1.5rem; }
  .header-row { flex-direction: column; align-items: flex-start; }
  .site-nav { width: 100%; justify-content: space-between; }
  .site-nav ul { gap: 0.15rem 0.8rem; }
  .site-nav a { font-size: 0.92rem; }
  .theme-toggle { margin-left: 0.5rem; }
  .intro { grid-template-columns: 1fr; }
  .portrait { width: 11rem; margin-inline: auto; }
  .news li { grid-template-columns: 1fr; gap: 0.1rem; }
  .join dl { grid-template-columns: 1fr; gap: 0.2rem; }
  .join dd { margin-bottom: 0.8rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .person { grid-template-columns: 4rem 1fr; gap: 1rem; }
  .avatar { width: 4rem; height: 4rem; }
  .avatar-initials { font-size: 1.25rem; }
  .alumni th:nth-child(2), .alumni td:nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print {
  .site-nav, .curve-wrap, .theme-toggle { display: none; }
  a { color: inherit; }
}
