/* ---------- Design tokens ---------- */
:root {
  --font-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-body: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --light-bg: #faf7f2; --light-text: #17181c; --light-muted: #5e5c62; --light-rule: #e3ddd2; --light-box: #efe8db; --light-accent: #8a3b45;
  --dark-bg: #0e1013; --dark-text: #f1ede6; --dark-muted: #b7b1a7; --dark-rule: #2b2e35; --dark-box: #1a1d23; --dark-accent: #e0b4ab;
  --max: 1060px; --narrow: 820px; --gutter: clamp(20px, 4vw, 48px); --header-h: 76px;
}
body[data-theme="light"] { --bg: var(--light-bg); --text: var(--light-text); --muted: var(--light-muted); --rule: var(--light-rule); --box: var(--light-box); --accent: var(--light-accent); --header-bg: rgba(250,247,242,.86); }
body[data-theme="dark"]  { --bg: var(--dark-bg);  --text: var(--dark-text);  --muted: var(--dark-muted);  --rule: var(--dark-rule);  --box: var(--dark-box);  --accent: var(--dark-accent);  --header-bg: rgba(14,16,19,.82); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 1.1875rem; line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1 0 auto; }
img { max-width: 100%; display: block; }
figure { margin: 0; }
a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color .2s, text-decoration-color .2s; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: 1.15; margin: 0 0 .6em; }
h1 { font-size: clamp(2.4rem, 4.5vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 2.8vw, 2.35rem); }
h3 { font-size: 1.35rem; font-weight: 600; margin-top: 1.6em; }
p { margin: 0 0 1.1em; }
.muted { color: var(--muted); }
.lede { font-size: 1.3rem; color: var(--muted); max-width: 40ch; }
.container { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.container.narrow { width: min(100% - 2 * var(--gutter), var(--narrow)); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: .5em 1em; z-index: 100; }
.skip-link:focus { left: 8px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--header-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--rule); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; min-height: var(--header-h); }
.brand { font-family: var(--font-display); font-weight: 600; font-size: 1.55rem; letter-spacing: .02em; text-decoration: none; white-space: nowrap; }
.brand .at { font-weight: 400; color: var(--muted); margin: 0 .1em; }
.brand:hover { color: var(--text); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(1.1rem, 2.2vw, 2.2rem); }
.site-nav a { font-size: .98rem; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; padding: .35em 0; position: relative; color: var(--text); opacity: .82; }
.site-nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
.site-nav a:hover, .site-nav a.active { opacity: 1; color: var(--text); }
.site-nav a:hover::after, .site-nav a.active::after { transform: scaleX(1); }
.nav-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.nav-toggle span { display: block; width: 24px; height: 1.5px; background: var(--text); margin: 6px 0; transition: transform .25s, opacity .25s; }
@media (max-width: 880px) {
  .nav-toggle { display: block; }
  .site-nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 1px solid var(--rule); display: none; }
  .site-nav ul { flex-direction: column; gap: 0; padding: .5rem var(--gutter) 1rem; }
  .site-nav a { display: block; padding: .85em 0; border-bottom: 1px solid var(--rule); font-size: 1.05rem; }
  .site-nav li:last-child a { border-bottom: 0; }
  .site-nav a::after { display: none; }
  body.nav-open .site-nav { display: block; }
  body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
  body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
}

/* ---------- Page intro ---------- */
.page-intro { padding: clamp(2.25rem, 5vw, 3.75rem) 0 clamp(.75rem, 2vw, 1.25rem); }
.page-intro h1 { margin-bottom: .3em; }
.research-intro { width: min(100% - 2 * var(--gutter), var(--max)); }

/* ---------- Home ---------- */
.hero { padding: clamp(1.5rem, 3vw, 2.5rem) var(--gutter) clamp(4rem, 8vw, 6rem); display: flex; flex-direction: column; align-items: center; }
.hero-figure { width: min(100%, 1100px); position: relative; }
.hero-headline { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; text-align: center; padding: clamp(1rem, 4vw, 2.5rem); background: linear-gradient(rgba(0,0,0,0) 45%, rgba(0,0,0,.55)); border-radius: 4px; pointer-events: none; }
.hero-headline span { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.8rem, 4.6vw, 3.6rem); line-height: 1.12; color: #fff; max-width: 20ch; text-shadow: 0 2px 18px rgba(0,0,0,.55), 0 0 2px rgba(0,0,0,.6); letter-spacing: .005em; }
.hero-img, .hero .img-placeholder { width: 100%; aspect-ratio: 2.2 / 1; max-height: 52vh; object-fit: cover; object-position: center 45%; border-radius: 4px; }
@media (max-width: 640px) { .hero-img, .hero .img-placeholder { aspect-ratio: 4 / 3; max-height: none; } }
.hero-text { max-width: 88ch; width: min(100%, 1100px); text-align: center; margin: clamp(1.5rem, 3vw, 2.5rem) auto 0; font-family: var(--font-display); font-size: clamp(1.35rem, 2vw, 1.7rem); line-height: 1.5; }

/* ---------- Split sections (Research, Contact) ---------- */
.split { --media-w: 420px; width: min(100% - 2 * var(--gutter), var(--max)); display: grid; grid-template-columns: minmax(0, 1fr) var(--media-w); gap: 1.75rem; align-items: center; padding: 2.5rem 0; border-top: 1px solid var(--rule); }
.split.split-reverse { grid-template-columns: var(--media-w) minmax(0, 1fr); gap: 2.75rem; }
.split.split-reverse .split-media { order: -1; }
.page-intro + .split { border-top: 0; padding-top: .5rem; }
.split-text { align-self: start; }
.split-text h2 { margin: 0 0 .5em; font-size: clamp(1.4rem, 2vw, 1.72rem); line-height: 1.2; }
.split-text p { color: var(--muted); font-size: 1.05rem; line-height: 1.6; margin-bottom: 0; }
/* every figure sits in an identical white frame; white-background figures letterbox invisibly */
.split-media { position: relative; width: var(--media-w); aspect-ratio: 4 / 3; background: #fff; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.split-media img, .split-media .img-placeholder { position: absolute; top: 14px; left: 14px; width: calc(100% - 28px); height: calc(100% - 28px); object-fit: contain; }
.contact.split { --media-w: 440px; width: min(100% - 2 * var(--gutter), var(--max)); gap: 1.5rem; align-items: start; }
.contact .split-text { display: block; }
.contact .split-text p { color: var(--text); margin-bottom: 1.1em; }
.contact address { font-style: normal; }
.contact .split-media { aspect-ratio: 3 / 4; border: 0; background: none; }
.contact .split-media img { top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 880px) {
  .split, .split.split-reverse, .contact.split { grid-template-columns: 1fr; gap: 1.25rem; padding: 2rem 0; }
  .split-media { order: -1; width: min(100%, 420px); }
  .split-text { display: block; }
}

/* ---------- Publications ---------- */
.publications { padding-bottom: clamp(3rem, 6vw, 5rem); }
.pub-updated { font-size: 1rem; }
.pub-year { padding: 1.5rem 0 .5rem; border-top: 1px solid var(--rule); }
.pub-year h2 { font-size: 1.6rem; color: var(--muted); font-weight: 500; margin-bottom: 1rem; }
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub { padding: 1.1rem 0; }
.pub + .pub { border-top: 1px dashed var(--rule); }
.pub-authors { font-size: 1rem; color: var(--muted); line-height: 1.5; }
.pub-authors strong { color: var(--text); font-weight: 600; }
.pub-title { font-family: var(--font-display); font-size: 1.45rem; font-weight: 600; line-height: 1.25; text-decoration-color: transparent; }
.pub-title:hover { text-decoration-color: var(--accent); }
.pub-meta { font-size: 1rem; margin-top: .25rem; }
.pub-note { color: var(--muted); margin-left: .4em; }
.pub-links { font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; margin-top: .35rem; }
.pub-links a { text-decoration: none; color: var(--accent); }
.pub-links a:hover { text-decoration: underline; }
.badge { display: inline-block; vertical-align: middle; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; padding: .2em .6em; border: 1px solid var(--rule); border-radius: 999px; color: var(--muted); margin-left: .5em; }

/* ---------- People ---------- */
.people-grid { list-style: none; margin: 0 0 clamp(2.5rem, 5vw, 4rem); padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2.5rem 2rem; align-items: start; }
.person-card { display: block; text-decoration: none; color: inherit; }
.person-card:hover { color: inherit; }
.person-photo { aspect-ratio: 1 / 1; overflow: hidden; border-radius: 4px; background: var(--box); transition: transform .25s ease, box-shadow .25s ease; }
.person-card:hover .person-photo { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.10); }
.person-photo img { width: 100%; height: 100%; object-fit: cover; }
.person-photo .img-placeholder { width: 100%; height: 100%; }
.person-name { display: block; font-family: var(--font-display); font-size: 1.45rem; font-weight: 600; line-height: 1.15; margin: .9rem 0 .15rem; }
.person-card:hover .person-name { color: var(--accent); }
.person-role { display: block; color: var(--muted); font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; margin: 0; }
.join-card { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: .8rem; aspect-ratio: 1 / 1; padding: 1.4rem; border: 1.5px solid var(--text); border-radius: 4px; text-decoration: none; transition: background .25s, color .25s; }
.join-card:hover { background: var(--text); color: var(--bg); }
.join-title { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; line-height: 1.1; }
.join-text { font-size: .95rem; line-height: 1.45; }
.join-cta { font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; margin-top: auto; }

/* Bios list (anchor targets for the grid) */
.bios { padding-bottom: clamp(3rem, 6vw, 5rem); border-top: 1px solid var(--rule); padding-top: 2rem; }
.bios-heading { font-size: 1.6rem; color: var(--muted); font-weight: 500; margin-bottom: 1.5rem; }
.bio { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 1.75rem; align-items: start; padding: 1.75rem 0; border-top: 1px dashed var(--rule); scroll-margin-top: calc(var(--header-h) + 1.5rem); }
.bio:first-of-type { border-top: 0; }
.bio-photo { aspect-ratio: 1 / 1; overflow: hidden; border-radius: 4px; background: var(--box); }
.bio-photo img { width: 100%; height: 100%; object-fit: cover; }
.bio-text h3 { margin: 0 0 .15rem; font-size: 1.5rem; }
.bio-text .person-role { margin-bottom: .9rem; }
.bio-text p { font-size: 1.05rem; line-height: 1.65; margin: 0; }
.bio:target { animation: bio-flash 1.6s ease-out; }
@keyframes bio-flash { 0% { background: var(--box); } 100% { background: transparent; } }
@media (max-width: 1000px) { .people-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1.25rem; } }
@media (max-width: 700px) {
  .bio { grid-template-columns: 1fr; gap: .9rem; text-align: center; }
  .bio-photo { width: 150px; margin: 0 auto; }
  .bio-text p:not(.person-role) { text-align: left; }
}
@media (max-width: 440px) { .people-grid { grid-template-columns: 1fr; } .person-photo, .join-card { max-width: 320px; } }

/* ---------- Join ---------- */
.join-sections { padding-bottom: clamp(4rem, 8vw, 7rem); display: grid; gap: 2rem; }
.join-sections + * , .page-intro:has(+ .join-sections) .lede { max-width: none; }
.join-block { border-top: 1px solid var(--rule); padding-top: 2rem; }
.join-block h2 { font-size: 1.85rem; margin-bottom: .4em; }
.join-block p { color: var(--muted); font-size: 1.15rem; }
.join-block a { color: var(--text); }

/* ---------- Footer (always light) ---------- */
.site-footer { background: var(--light-bg); color: var(--light-text); border-top: 1px solid var(--light-rule); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 2rem; padding: 2.5rem 0; flex-wrap: wrap; }
.footer-brand { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; margin: 0 0 .3rem; }
.footer-fine { margin: 0; font-size: .95rem; color: var(--light-muted); line-height: 1.5; }
.footer-right { display: flex; align-items: center; gap: 1.25rem; }
.funding-label { margin: 0; font-size: .95rem; color: var(--light-muted); letter-spacing: .04em; }
.funders { list-style: none; margin: 0; padding: 0; display: flex; gap: .9rem; }
.logo-circle { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: #fff; border: 1px solid var(--light-rule); overflow: hidden; padding: 9px; box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: transform .2s, box-shadow .2s; }
.logo-circle:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.logo-circle img { width: 100%; height: 100%; object-fit: contain; }
.logo-circle .img-placeholder { width: 100%; height: 100%; border-radius: 50%; font-size: .55rem; padding: 0; }
.logo-circle .img-placeholder code { display: none; }
@media (max-width: 640px) { .footer-inner { flex-direction: column; align-items: flex-start; } }

/* ---------- Missing-image placeholder (shown until the file is added) ---------- */
.img-placeholder { display: grid; place-items: center; text-align: center; padding: 1rem; background: var(--box); border: 1px dashed var(--muted); border-radius: 4px; color: var(--muted); font-size: .9rem; line-height: 1.5; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } html { scroll-behavior: auto; } }
