:root {
  --bg: #faf8f5;
  --bg-alt: #f2eee8;
  --text: #1d2433;
  --muted: #5b6475;
  --primary: #1f4e8c;
  --primary-dark: #163a6a;
  --accent: #d9a441;
  --line: #e4ded4;
  --card: #ffffff;
  --radius: 14px;
  --max: 1080px;
  --serif: "Fraunces", "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161f;
    --bg-alt: #181d29;
    --text: #e8eaf0;
    --muted: #a3acbd;
    --primary: #7aa7e0;
    --primary-dark: #a6c4ee;
    --accent: #e3b45a;
    --line: #272e3d;
    --card: #1a2030;
  }
}

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

html { scroll-behavior: smooth; }

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

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

a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--primary-dark); }

h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .6em; font-weight: 600; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.6rem, 3vw, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 1.5rem; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--primary); color: #fff; padding: .6rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }
.nav-links { display: flex; gap: 1.4rem; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: .95rem; padding: .3rem 0; border-bottom: 2px solid transparent; }
.nav-links a:hover { color: var(--text); }
.nav-links a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: .4rem .7rem; font: inherit; cursor: pointer;
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--bg);
    border-bottom: 1px solid var(--line); padding: .5rem 1.5rem 1rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: .6rem 0; }
}

/* Hero */
.hero { padding: 4.5rem 0 3rem; }
.hero-grid { display: grid; grid-template-columns: 280px 1fr; gap: 3rem; align-items: center; }
.portrait {
  width: 280px; height: 280px; border-radius: 50%; object-fit: cover;
  border: 6px solid var(--card); box-shadow: 0 0 0 2px var(--accent), 0 14px 40px rgba(20, 30, 50, .18);
}
.eyebrow { font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); font-weight: 600; margin-bottom: .8rem; }
.hero h1 { margin-bottom: .3em; }
.role { font-size: 1.2rem; color: var(--muted); margin-bottom: 1rem; }
.lead { font-size: 1.15rem; max-width: 40em; }

@media (max-width: 760px) {
  .hero { padding: 2.5rem 0 1rem; }
  .hero-grid { grid-template-columns: 1fr; text-align: center; gap: 1.5rem; }
  .portrait { margin: 0 auto; width: 200px; height: 200px; }
  .lead { margin-left: auto; margin-right: auto; }
  .btn-row { justify-content: center; }
}

/* Buttons */
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }
.btn {
  display: inline-block; padding: .55rem 1.1rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  text-decoration: none; font-size: .95rem; font-weight: 500;
  transition: transform .15s, border-color .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--primary); color: var(--text); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary, .btn.primary:hover { color: #12161f; } }

/* Sections */
section { padding: 3.5rem 0; }
section.alt { background: var(--bg-alt); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section-head h2 { margin: 0; }
.section-head a { font-size: .95rem; }
.page-title { padding: 3.5rem 0 1rem; }
.page-title p { color: var(--muted); max-width: 42em; font-size: 1.15rem; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(20, 30, 50, .08); }
.card .num { font-family: var(--serif); color: var(--accent); font-size: 1.6rem; font-weight: 600; }
.card p { color: var(--muted); margin: 0; font-size: 1rem; }
.card .spaced-heading { min-height: 2.4em; }
.card svg { width: 64px; height: 40px; margin-bottom: .6rem; }
@media (max-width: 860px) { .cards { grid-template-columns: 1fr; } }

/* Project spotlight */
.spotlight {
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--accent);
  border-radius: var(--radius); padding: 2rem;
}
.tag {
  display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent);
  padding: .2rem .6rem; border-radius: 999px; margin-bottom: .8rem;
}
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1.5rem 0 0; }
.fact { border-top: 2px solid var(--line); padding-top: .7rem; }
.fact strong { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
@media (max-width: 760px) { .facts { grid-template-columns: 1fr; } }

/* Credentials */
.cred { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; text-align: center; }
.cred div { padding: 1rem .5rem; }
.cred .big { font-family: var(--serif); font-size: 1.5rem; color: var(--primary); display: block; line-height: 1.2; }
.cred .small { color: var(--muted); font-size: .9rem; }
@media (max-width: 760px) { .cred { grid-template-columns: repeat(2, 1fr); } }

/* Lists: publications etc. */
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub { padding: 1.1rem 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 70px 1fr; gap: 1rem; }
.pub:last-child { border-bottom: 0; }
.pub .year { font-family: var(--serif); color: var(--accent); font-weight: 600; font-size: 1.15rem; }
.pub .title { font-weight: 600; display: block; }
.pub .meta { color: var(--muted); font-size: .96rem; }
.pub .venue { font-style: italic; }
.pub .links { margin-top: .3rem; font-size: .9rem; }
.pub .links a { margin-right: .9rem; }
.pub .recognition { color: var(--primary); font-weight: 600; }
.me { font-weight: 600; color: var(--text); }

.subhead { margin-top: 2.5rem; padding-bottom: .4rem; border-bottom: 2px solid var(--accent); display: inline-block; }
.media-content .chips { margin-bottom: .75rem; }
.media-content .subhead { margin-top: .5rem; }
.media-content .other-heading { margin-top: 2.25rem; }

/* Two-column text */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 170px 1fr; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-size: .95rem; font-variant-numeric: tabular-nums; }
.timeline .what small { display: block; color: var(--muted); }
@media (max-width: 600px) { .timeline li { grid-template-columns: 1fr; gap: 0; } }

/* Causal network figure */
.causal-figure { margin: 2rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.causal-network { display: block; width: min(100%, 900px); height: auto; margin: 0 auto; }
.causal-network--mobile { display: none; }
.causal-edge { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; }
.causal-arrow path { fill: var(--primary); }
.causal-node { fill: var(--card); stroke: var(--primary); stroke-width: 2; }
.causal-node--mediator { fill: color-mix(in srgb, var(--accent) 18%, var(--card)); stroke: var(--accent); }
.causal-label { fill: var(--text); font-family: var(--sans); font-size: 18px; font-weight: 600; text-anchor: middle; }
.causal-figure figcaption { max-width: 42em; margin: .5rem auto 0; color: var(--muted); font-size: .92rem; text-align: center; }
.causal-figure figcaption strong { color: var(--text); }
@media (max-width: 760px) {
  .causal-network--wide { display: none; }
  .causal-network--mobile { display: block; width: min(100%, 380px); }
}

/* Media chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.chips a {
  padding: .35rem .9rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); text-decoration: none; color: var(--text); font-size: .95rem;
}
.chips a:hover { border-color: var(--primary); }
.press-strip { color: var(--muted); font-family: var(--serif); font-size: 1.15rem; text-align: center; }
.press-strip span { margin: 0 .6rem; white-space: nowrap; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 2.5rem 0; color: var(--muted); font-size: .95rem; margin-top: 2rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; }
.site-footer address { font-style: normal; line-height: 1.6; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .3rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .btn { transition: none; }
}
