/* Mobile-first: base styles target phones; min-width queries at the bottom add
   tablet (640px), small-desktop (900px) and wide (1120px) layouts. */

:root {
  --ink: #0b2a6f;
  --ink-2: #1d3d85;
  --paper: #ffffff;
  --paper-2: #f4f5f8;
  --card: #ffffff;
  --text: #111827;
  --muted: #5b6475;
  --line: #e4e6ec;
  --accent: #8f6416;      /* gold for small text: 5.2:1 on white */
  --gold: #c49a3c;        /* brighter gold for lines, dots and outlines */
  --gold-light: #e6c47a;  /* gold on the navy sections */
  --accent-soft: #f6eedd;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(11, 42, 111, .06), 0 8px 24px rgba(11, 42, 111, .06);
  --serif: "Plus Jakarta Sans", system-ui, sans-serif;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --max: 1160px;
  --gutter: 16px;
  --section-y: 56px;
  --header-h: 60px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.menu-open { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--ink-2); text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--serif); color: var(--ink); line-height: 1.2; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.02em; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 20px -12px rgba(11, 42, 111, .18); }
.nav { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; padding: 8px 0; }
.brand span { color: var(--accent); }

/* Phone/tablet menu: full-width panel under the header */
.nav-toggle {
  display: grid; place-items: center; width: 44px; height: 44px; margin-right: -10px;
  background: none; border: 0; border-radius: 10px; cursor: pointer; color: var(--ink);
}
.nav-toggle svg { width: 24px; height: 24px; }
.nav-toggle .i-close { display: none; }
.nav-toggle[aria-expanded="true"] .i-open { display: none; }
.nav-toggle[aria-expanded="true"] .i-close { display: block; }
/* The header's backdrop-filter makes it the containing block for this fixed panel,
   so the panel's height is set explicitly rather than with bottom: 0 */
.nav-links {
  position: fixed; top: var(--header-h); left: 0; right: 0;
  height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h));
  display: flex; flex-direction: column; gap: 2px;
  list-style: none; margin: 0; padding: 12px var(--gutter) 32px;
  background: var(--paper); overflow-y: auto;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity .25s var(--ease), transform .25s var(--ease), visibility 0s linear .25s;
}
.nav-links.open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.nav-links a {
  display: block; padding: 14px 12px; border-radius: 10px; border-bottom: 1px solid var(--line);
  font-size: 1.05rem; font-weight: 600; color: var(--ink); text-decoration: none;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); background: var(--paper-2); }

/* ---------- Hero ---------- */
.hero { padding: 28px 0 48px; position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 40px; align-items: center; }
.eyebrow {
  display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px; line-height: 1.5;
}
.hero h1 { font-size: clamp(2.15rem, 9vw, 4rem); letter-spacing: -.035em; font-weight: 800; line-height: 1.08; margin-bottom: .45em; }
.hero .lede { font-size: 1.05rem; color: #374151; max-width: 38em; }
/* Google Scholar metrics in the hero */
.hero-metrics { display: grid; grid-template-columns: repeat(3, auto) 1fr; align-items: end; gap: 4px 0; margin-top: 20px; }
.hero-metrics > div { padding: 0 18px; border-left: 1px solid var(--line); }
.hero-metrics > div:first-child { padding-left: 0; border-left: 0; }
.hero-metrics strong { display: block; font-size: 1.6rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; line-height: 1.1; }
.hero-metrics span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.hero-metrics p { grid-column: 1 / -1; margin: 6px 0 0; font-size: .72rem; color: var(--muted); }

/* Current positions, listed under the intro */
.hero-roles { margin-top: 18px; padding-left: 14px; border-left: 2px solid var(--gold, var(--accent)); }
.hero-roles-label { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.hero-roles ul { list-style: none; margin: 0; padding: 0; }
.hero-roles li { font-size: .92rem; line-height: 1.45; color: #374151; padding: 3px 0; }
.hero-roles strong { color: var(--ink); font-weight: 700; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.btn {
  flex: 1 1 140px; justify-content: center;
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; white-space: nowrap;
  padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: .95rem; text-decoration: none;
  border: 1.5px solid var(--ink); transition: transform .15s, background .15s, color .15s;
}
.btn svg { width: 18px; height: 18px; flex: none; transition: transform .3s var(--ease); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); color: #fff; }
.btn-ghost { color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: #fff; }
.btn-icon { flex: none; padding-inline: 0; width: 48px; justify-content: center; }

.portrait-card { position: relative; justify-self: center; width: min(260px, 74%); order: -1; margin-right: 14px; }
.portrait-card .frame {
  border-radius: 22px; overflow: hidden; aspect-ratio: 4 / 5;
  background: linear-gradient(160deg, #c9d3dc, #9fb0bf);
  box-shadow: 0 24px 48px -20px rgba(11, 42, 111, .35);
}
.portrait-card .frame img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.portrait-card::after {
  content: ""; position: absolute; inset: 14px -14px -14px 14px; border: 1.5px solid var(--gold);
  border-radius: 22px; z-index: -1;
}

/* ---------- Stats ---------- */
.stats { background: var(--ink); color: #fff; padding: 28px 0; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px 12px; text-align: center; }
.stat .num { font-family: var(--serif); font-size: clamp(1.7rem, 7vw, 2.5rem); font-weight: 700; color: var(--gold-light); line-height: 1.1; }
.stat .num-text { font-size: clamp(1.35rem, 5.5vw, 1.9rem); line-height: 1.45; letter-spacing: -.01em; }
.stat .lbl { font-size: .78rem; color: #c7d2ea; margin-top: 6px; line-height: 1.35; }

/* ---------- Sections ---------- */
section.block { padding: var(--section-y) 0; }
section.block.alt { background: var(--paper-2); }
.section-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
.section-head h2 { font-size: clamp(1.65rem, 6.5vw, 2.6rem); margin: 0; }
.section-head .kicker { display: block; font-family: var(--sans); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.section-head p { color: var(--muted); max-width: 34em; margin: 0; }

.two-col, .grid-2, .grid-3, .roles-grid, .inst-grid, .award-grid, .gov-grid, .contact-grid { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
.two-col { gap: 36px; }
.hero-grid > *, .two-col > *, .grid-2 > *, .grid-3 > *, .roles-grid > *, .inst-grid > *, .award-grid > * { min-width: 0; }
.roles-grid { gap: 36px; }
.prose p { font-size: 1.02rem; }
/* Education, under the About text */
.edu { margin-top: 28px; padding-left: 14px; border-left: 2px solid var(--ink); }
.edu h3 { margin-bottom: 10px; }
.edu-list { list-style: none; margin: 0; padding: 0; }
.edu-list li { display: grid; grid-template-columns: 5.5em 1fr auto; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .92rem; line-height: 1.4; }
.edu-list li:last-child { border-bottom: 0; }
.edu-list .deg { font-weight: 700; color: var(--ink); }
.edu-list .yr { font-weight: 700; color: var(--accent); font-size: .82rem; }
.edu-note { margin: 10px 0 0; font-size: .85rem; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.dark { background: var(--ink); color: #dbe4f5; border-color: var(--ink); }
.card.dark h3 { color: #fff; }

.fact-list { list-style: none; padding: 0; margin: 0; }
.fact-list li { padding: 9px 0; font-size: .95rem; line-height: 1.45; border-bottom: 1px solid rgba(255,255,255,.12); display: flex; gap: 12px; }
.fact-list li:last-child { border-bottom: 0; }
.fact-list .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--gold-light); margin-top: 7px; }

/* Institution cards */
.inst { position: relative; overflow: hidden; }
.inst .tag { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.inst .role { color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
.inst ul { margin: 0; padding-left: 18px; }
.inst li { margin-bottom: 6px; }

/* Timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 22px; }
.tl-item::before {
  content: ""; position: absolute; left: -26px; top: 5px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--gold);
}
.tl-item.now::before { background: var(--gold); }
.tl-date { font-size: .75rem; font-weight: 700; letter-spacing: .04em; color: var(--accent); text-transform: uppercase; }
.tl-title { font-family: var(--serif); font-size: 1.05rem; color: var(--ink); font-weight: 600; line-height: 1.35; }
.tl-org { color: var(--muted); font-size: .92rem; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: .85rem; color: var(--ink); line-height: 1.4; transition: background .25s var(--ease), border-color .25s var(--ease); }

.gov-grid { gap: 12px; }
.gov { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.gov .t { font-weight: 600; color: var(--ink); }
.gov .o { color: var(--muted); font-size: .9rem; }
.gov .d { font-size: .78rem; color: var(--accent); font-weight: 700; margin-top: 6px; }

/* Research */
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.metric .n { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.metric .l { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.teach-figures { margin-bottom: 24px; }

/* Tabs scroll sideways on phones instead of wrapping onto several lines */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 40px calc(-1 * var(--gutter)) 24px;
  padding: 0 var(--gutter); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; scroll-snap-align: start; white-space: nowrap;
  background: none; border: 0; border-bottom: 2.5px solid transparent; padding: 12px 14px; min-height: 48px; margin-bottom: -1px;
  font: 600 .92rem var(--sans); color: var(--muted); cursor: pointer;
  transition: color .2s var(--ease), border-color .3s var(--ease);
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); }
.tab:hover { color: var(--ink); }
.panel[hidden] { display: none; }

.pubs { list-style: none; counter-reset: pub; padding: 0; margin: 0; }
.pubs li { counter-increment: pub; position: relative; padding: 16px 0 16px 38px; border-bottom: 1px solid var(--line); }
.pubs li::before {
  content: counter(pub, decimal-leading-zero); position: absolute; left: 0; top: 16px;
  font-family: var(--serif); font-size: 1rem; color: var(--accent); font-weight: 700;
}
.pubs .title { font-weight: 600; color: var(--ink); }
.pubs .venue { font-style: italic; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.b { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: #7a5a12; }
.b.q { background: #eceff5; color: var(--ink-2); }
.b.y { background: var(--paper-2); color: var(--muted); }

/* Tables: stacked rows on phones, real tables from 640px */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
tbody, tr, td { display: block; }
tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
tr:last-child { border-bottom: 0; }
td { padding: 0; }
td.yr { font-weight: 700; color: var(--accent); font-size: .78rem; letter-spacing: .04em; }
td.nm { font-weight: 600; color: var(--ink); }
td:not(.yr):not(.nm) { color: var(--muted); font-size: .92rem; }

.award { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: start; }
.award .yr { font-family: var(--serif); font-size: 1.25rem; color: var(--accent); font-weight: 700; }
.award .aw { font-weight: 600; color: var(--ink); line-height: 1.4; margin-bottom: 4px; }
.award .pp { color: var(--muted); font-size: .9rem; }
.award.ach { grid-template-columns: 76px 1fr; }
.award.ach .yr { font-size: 1.05rem; line-height: 1.3; }

details.more { margin-top: 18px; }
details.more summary {
  cursor: pointer; font-weight: 600; color: var(--ink-2); list-style: none; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+"; font-size: 1.2rem; color: var(--accent); width: 1em; }
details.more[open] summary::before { content: "−"; }

.simple-list { padding-left: 18px; margin: 0; }
.simple-list li { margin-bottom: 10px; }
.simple-list .yr { color: var(--accent); font-weight: 600; }

.feature-photo { margin: 0 0 32px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 4 / 3; background: #dfe3e6; }
.feature-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }

/* Contact */
.contact { background: var(--ink); color: #dbe4f5; }
.contact h2 { color: #fff; }
.contact .section-head p { color: #b8c6e3; }
.contact-grid { gap: 12px; }
.contact-item { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); padding: 18px 20px; }
.contact-item .k { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-light); font-weight: 700; margin-bottom: 6px; }
.contact-item a { color: #fff; text-decoration-color: rgba(230,196,122,.6); display: inline-block; padding: 4px 0; word-break: break-word; }
.contact-item a:hover { color: var(--gold-light); }

/* Blue accent lines: navy timeline rails and the positions block */
.timeline::before { background: var(--ink); opacity: .85; }
.hero-roles { border-left-color: var(--ink); }
/* A slim full-width navy band where one light section meets the next (navy bands need none) */
section.block:not(.contact) + section.block:not(.contact) { position: relative; }
section.block:not(.contact) + section.block:not(.contact)::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 10px; background: var(--ink);
}

footer { background: #071c4d; color: #8fa0c4; font-size: .85rem; padding: 22px 0 calc(22px + env(safe-area-inset-bottom)); }
footer .wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
footer a { color: #c7d2ea; padding: 8px 0; }

/* ---------- Journey ribbon ---------- */
/* A sideways row the visitor swipes, scrolls with a trackpad, or steps through with the arrows.
   script.js adds .is-live to highlight the milestone in view; without JS every year is shown in gold. */
.journey { --j-start: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter))); --m-w: min(78vw, 320px);
  position: relative; background: var(--ink); color: #dbe4f5; padding: var(--section-y) 0 40px; }
.journey-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.journey-head .kicker { display: block; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-light); font-weight: 700; margin-bottom: 8px; }
.journey-head h2 { color: #fff; font-size: clamp(1.65rem, 6.5vw, 2.6rem); margin: 0; }
.journey-nav { display: flex; gap: 8px; flex: none; }
.journey-nav button {
  /* touch-action stops iOS treating quick double taps as a zoom gesture */
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; touch-action: manipulation;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.22); color: #fff;
  transition: background .2s var(--ease), border-color .2s var(--ease), opacity .2s var(--ease);
}
.journey-nav button svg { width: 20px; height: 20px; }
.journey-nav button:disabled { opacity: .3; cursor: default; }
.journey-hint { display: block; margin-top: 10px; font-size: .8rem; color: #8fa0c4; }

.journey-viewport {
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline-start: var(--j-start);
  scrollbar-width: none; padding: 36px 0 8px; outline-offset: -3px;
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.journey-viewport.at-end { -webkit-mask-image: none; mask-image: none; }
.journey-viewport::-webkit-scrollbar { display: none; }
/* The end padding lets every milestone, including the last, scroll to the left edge */
.journey-track { list-style: none; margin: 0; display: flex; width: max-content;
  padding: 0 max(var(--gutter), calc(100vw - var(--j-start) - var(--m-w))) 0 var(--j-start); }
.milestone { position: relative; scroll-snap-align: start; flex: none; width: var(--m-w); padding: 0 28px 0 0; }
/* Rail with a dot per milestone */
.milestone::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: rgba(255,255,255,.14); }
.milestone::after {
  content: ""; position: absolute; left: 0; top: -6px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink); border: 3px solid var(--gold-light);
  transition: background .4s var(--ease), border-color .4s var(--ease), transform .4s var(--ease);
}
.m-year {
  display: block; margin: 26px 0 10px; font-family: var(--serif); font-weight: 800; line-height: .9; letter-spacing: -.04em;
  font-size: clamp(3.4rem, 15vw, 5.6rem); color: var(--gold-light); -webkit-text-stroke: 1.5px var(--gold-light);
  transition: color .5s var(--ease), -webkit-text-stroke-color .5s var(--ease);
}
.m-body { transition: opacity .5s var(--ease); }
.m-body h3 { color: #fff; font-size: 1.1rem; margin-bottom: 6px; }
.m-body p { color: #b8c6e3; font-size: .92rem; margin: 0; line-height: 1.5; }

/* Highlight: the milestone in view is solid gold, the rest outlined and dimmed */
.journey.is-live .milestone::after { border-color: rgba(230, 196, 122, .45); }
.journey.is-live .m-year { color: transparent; -webkit-text-stroke-color: rgba(230, 196, 122, .5); }
.journey.is-live .m-body { opacity: .55; }
.journey.is-live .milestone.active::after { background: var(--gold-light); border-color: var(--gold-light); transform: scale(1.15); }
.journey.is-live .milestone.active .m-year { color: var(--gold-light); -webkit-text-stroke-color: var(--gold-light); }
.journey.is-live .milestone.active .m-body { opacity: 1; }

.journey-progress { margin-top: 28px; }
.journey-progress::before { content: ""; display: block; height: 3px; border-radius: 3px; background: rgba(255,255,255,.12); }
.journey-progress .bar { display: block; height: 3px; margin-top: -3px; border-radius: 3px; background: var(--gold-light); transform-origin: left; transform: scaleX(0); transition: transform .15s linear; }

@media (hover: hover) {
  .journey-nav button:not(:disabled):hover { background: var(--gold-light); border-color: var(--gold-light); color: var(--ink); }
}
@media (min-width: 640px) {
  .journey { --m-w: 340px; }
  .milestone { padding-right: 40px; }
  .m-body h3 { font-size: 1.2rem; }
  .m-body p { font-size: .95rem; }
  .journey-hint { display: none; }
}

/* ---------- Publications page ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pubs-hero { padding: 28px 0 32px; background: var(--paper-2); }
.pubs-hero .eyebrow { display: block; }
.back-link { display: inline-block; font-size: .88rem; font-weight: 600; text-decoration: none; margin-bottom: 18px; padding: 6px 0; }
.pubs-hero h1 { font-size: clamp(2.2rem, 9vw, 3.6rem); letter-spacing: -.035em; font-weight: 800; margin-bottom: .25em; }
.pubs-hero .lede { color: var(--muted); max-width: 40em; margin-bottom: 24px; }
.pubs-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; }
.pubs-metrics div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.pubs-metrics dt { font-size: .72rem; color: var(--muted); font-weight: 600; line-height: 1.3; }
.pubs-metrics dd { margin: 4px 0 0; font-size: 1.45rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; line-height: 1.1; }

/* Toolbar sticks under the header only on wide screens, where it fits on one row */
.pubs-toolbar {
  position: relative; z-index: 40;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); padding: 12px 0;
  transition: box-shadow .3s var(--ease);
}
.pubs-toolbar.stuck { box-shadow: 0 8px 20px -14px rgba(11, 42, 111, .25); }
.pubs-toolbar .wrap { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.search { grid-column: 1 / -1; position: relative; display: block; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; min-height: 46px; padding: 10px 14px 10px 42px; border: 1px solid var(--line); border-radius: 999px;
  font: 500 16px var(--sans); color: var(--text); background: var(--card);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px var(--accent-soft); }
.filters {
  grid-column: 1 / -1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter);
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none; min-height: 38px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  font: 600 .85rem var(--sans); color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.sort { grid-column: 1 / -1; justify-self: end; display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.sort select {
  min-height: 38px; padding: 6px 30px 6px 12px; border: 1px solid var(--line); border-radius: 999px; background-color: var(--card);
  font: 600 .85rem var(--sans); color: var(--ink); cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6475' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
}

.pubs-body { padding: 20px 0 64px; }
.pubs-count { color: var(--muted); font-size: .88rem; margin: 0 0 8px; }
.pub-group { padding-top: 12px; }
.pub-year {
  display: flex; align-items: baseline; gap: 10px; font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em;
  padding: 18px 0 6px; margin: 0; border-bottom: 2px solid var(--ink);
}
.pub-year span { font-size: .78rem; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub { padding: 16px 0; border-bottom: 1px solid var(--line); }
.pub[hidden] { display: none; }
.pub-title { display: block; font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.45; margin-bottom: 4px; }
.pub-title:hover { color: var(--accent); text-decoration: underline; }
.pub-authors { font-size: .9rem; color: var(--muted); }
.pub-authors strong { color: var(--text); font-weight: 700; }
.pub-venue { font-size: .9rem; font-style: italic; color: var(--muted); }
.pub .badges { margin-top: 8px; }
.b.c { background: #eceff5; color: var(--ink-2); }
.pub-flat .pub:first-child { border-top: 2px solid var(--ink); }
.pubs-empty { padding: 40px 0; text-align: center; color: var(--muted); }
.pubs-source { margin-top: 32px; font-size: .82rem; color: var(--muted); }

.pubs-cta { margin-top: 22px; }

/* Per-paper actions: PDF, DOI, Abstract, Cite, Request a copy */
.pub-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pub-actions:empty { display: none; }
.act {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2); cursor: pointer;
  font: 600 .8rem var(--sans); text-decoration: none; white-space: nowrap;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.act svg { width: 15px; height: 15px; flex: none; }
.act[aria-expanded="true"] { background: var(--paper-2); border-color: var(--ink-2); color: var(--ink); }
.act-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
a.pub-title[href]:hover { text-decoration: underline; }
span.pub-title { cursor: text; }
.pub-panel { margin-top: 12px; padding: 14px 16px; border-radius: 12px; background: var(--paper-2); border: 1px solid var(--line); font-size: .9rem; animation: fade .35s var(--ease); }
.pub-panel[hidden] { display: none; }
.pub-abstract p { margin: 0 0 .7em; color: #374151; }
.pub-abstract p:last-child { margin-bottom: 0; }
.cite-block + .cite-block { margin-top: 14px; }
.cite-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.copy { min-height: 30px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font: 600 .78rem var(--sans); color: var(--ink-2); cursor: pointer; text-transform: none; letter-spacing: 0; }
.pub-cite p { margin: 0; line-height: 1.55; overflow-wrap: anywhere; }
.pub-cite pre { margin: 0; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; font-size: .76rem; line-height: 1.5; overflow-x: auto; white-space: pre; }
@media (hover: hover) {
  .act:not(.act-primary):hover { border-color: var(--gold, var(--accent)); color: var(--ink); }
  .act-primary:hover { background: var(--ink-2); color: #fff; }
  .copy:hover { border-color: var(--ink-2); }
}

@media (min-width: 640px) {
  .pubs-hero { padding: 40px 0 44px; }
  .pubs-metrics { grid-template-columns: repeat(5, 1fr); gap: 14px; }
  .pubs-metrics dd { font-size: 1.8rem; }
  .pubs-toolbar .wrap { grid-template-columns: minmax(220px, 1fr) auto auto; }
  .search, .filters, .sort { grid-column: auto; }
  .filters { margin: 0; padding: 2px 0; -webkit-mask-image: none; mask-image: none; flex-wrap: wrap; overflow: visible; }
  .pub { padding: 18px 0; }
}
@media (min-width: 1020px) {
  .pubs-toolbar { position: sticky; top: var(--header-h); }
}
@media (min-width: 640px) and (max-width: 1019px) {
  .pubs-toolbar .wrap { grid-template-columns: 1fr auto; }
  .search { grid-column: 1 / -1; }
  .filters, .sort { grid-column: auto; }
}

/* ---------- Motion ---------- */
/* Scroll reveal (delay set per element by script.js for staggering) */
.reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity .8s var(--ease), transform .8s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

/* Hero entrance on page load */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes settle { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.hero-grid > div:first-child > * { animation: rise .9s var(--ease) both; }
.hero-grid > div:first-child > :nth-child(1) { animation-delay: .05s; }
.hero-grid > div:first-child > :nth-child(2) { animation-delay: .15s; }
.hero-grid > div:first-child > :nth-child(3) { animation-delay: .25s; }
.hero-grid > div:first-child > :nth-child(4) { animation-delay: .35s; }
.hero-grid > div:first-child > :nth-child(5) { animation-delay: .45s; }
.hero-grid > div:first-child > :nth-child(6) { animation-delay: .55s; }
.portrait-card .frame { animation: settle 1.2s var(--ease) .1s both; }
.portrait-card::after { animation: rise 1.2s var(--ease) .35s both; }

.card:not(.reveal), .gov:not(.reveal), .metric, .contact-item:not(.reveal),
.reveal.done { transition: opacity .3s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease); }

/* Speaking photo: slow settle when revealed */
.feature-photo img { transform: scale(1.06); transition: transform 1.6s var(--ease); }
.feature-photo.in img { transform: none; }

/* Tab panels and expanders fade in */
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel:not([hidden]) { animation: fade .5s var(--ease); }
details.more[open] > :not(summary) { animation: fade .45s var(--ease); }

/* Hover effects only on devices that can hover, so taps don't leave cards "stuck" lifted */
@media (hover: hover) {
  .card:hover, .gov:hover, .metric:hover, .contact-item:hover {
    transform: translateY(-3px); box-shadow: 0 2px 4px rgba(11, 42, 111, .05), 0 16px 32px -8px rgba(11, 42, 111, .14);
  }
  .gov:hover, .metric:hover { border-color: #c7d2ea; }
  .chip:hover { background: var(--accent-soft); border-color: transparent; }
  .btn-primary:hover { transform: translateY(-1px); }
  .btn:hover svg { transform: translateX(2px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .feature-photo img { transform: none; }
}

/* ---------- Tablet: 640px+ ---------- */
@media (min-width: 640px) {
  :root { --gutter: 24px; --section-y: 72px; --header-h: 64px; }
  body { font-size: 16.5px; }
  h3 { font-size: 1.2rem; }

  .hero { padding: 48px 0 64px; }
  .eyebrow { font-size: .78rem; letter-spacing: .14em; margin-bottom: 18px; }
  .hero .lede { font-size: 1.15rem; }
  .cta { gap: 12px; margin-top: 28px; }
  .btn { flex: 0 0 auto; }
  .portrait-card { width: min(300px, 60%); }

  .stats { padding: 36px 0; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 28px 16px; }
  .stat .lbl { font-size: .82rem; }

  .section-head { flex-direction: row; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 24px; margin-bottom: 40px; }
  .card { padding: 26px; }
  .grid-3, .gov-grid, .contact-grid, .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .gov-grid { gap: 18px; }
  .contact-grid { gap: 20px; }
  .contact-item { padding: 22px; }
  .metric-grid { gap: 14px; }
  .teach-figures { grid-template-columns: repeat(4, 1fr); margin-bottom: 32px; }
  .metric .n { font-size: 1.9rem; }
  .chip { padding: 8px 16px; font-size: .9rem; }

  .tabs { margin: 48px 0 28px; padding: 0; flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .tab { padding: 12px 16px; font-size: .95rem; }
  .pubs li { padding: 18px 0 18px 52px; }
  .pubs li::before { top: 18px; font-size: 1.1rem; }
  .badges { display: inline-flex; margin: 0 0 0 4px; vertical-align: middle; }

  /* Restore real tables */
  .table-wrap { overflow-x: auto; }
  thead { position: static; width: auto; height: auto; overflow: visible; clip: auto; display: table-header-group; }
  tbody { display: table-row-group; }
  tr { display: table-row; padding: 0; border: 0; }
  td, th { display: table-cell; text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
  tr:last-child td { border-bottom: 0; }
  th { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; background: var(--paper-2); }
  td.yr { white-space: nowrap; font-size: inherit; letter-spacing: 0; font-weight: 600; }
  td.nm { min-width: 9em; }
  td:not(.yr):not(.nm) { color: inherit; font-size: inherit; }

  .award { grid-template-columns: 64px 1fr; gap: 14px; }
  .award .yr { font-size: 1.4rem; }


  .feature-photo { aspect-ratio: 16 / 9; margin-bottom: 48px; }
  footer { padding: 26px 0; }
}

/* ---------- Small desktop: 900px+ ---------- */
@media (min-width: 900px) {
  :root { --section-y: 88px; }
  .hero { padding: 72px 0 56px; }
  .hero-grid { grid-template-columns: 1.35fr 1fr; gap: 56px; }
  .portrait-card { order: 0; width: min(360px, 100%); margin-right: 18px; }
  .portrait-card .frame { border-radius: 24px; box-shadow: 0 30px 60px -20px rgba(11, 42, 111, .35); }
  .portrait-card::after { inset: 18px -18px -18px 18px; border-radius: 24px; }

  .two-col { grid-template-columns: 1.4fr 1fr; gap: 48px; }
  .grid-2, .inst-grid, .award-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .award-grid { gap: 18px; }
  .grid-3, .gov-grid { grid-template-columns: repeat(3, 1fr); }
  .roles-grid { grid-template-columns: repeat(3, 1fr); gap: 32px; }
  .contact-grid { grid-template-columns: repeat(4, 1fr); }
  .grid-3 { gap: 24px; }
  .feature-photo { aspect-ratio: 21 / 9; }
}

/* ---------- Wide: 1120px+ (inline nav, six stats across) ---------- */
/* ---------- Inline menu: 900px+ ---------- */
@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .nav-links {
    position: static; height: auto; flex-direction: row; gap: 2px; padding: 0; background: none; overflow: visible;
    opacity: 1; visibility: visible; transform: none; transition: none;
  }
  .nav-links a { padding: 8px 7px; border-radius: 8px; border-bottom: 0; font-size: .86rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
}
@media (min-width: 1000px) {
  .nav-links a { padding: 8px 10px; font-size: .88rem; }
}

/* ---------- Wide: 1120px+ (six stats across, roomier menu) ---------- */
@media (min-width: 1120px) {
  .nav-links { gap: 4px; }
  .nav-links a { padding: 8px 12px; font-size: .9rem; }
  .stats-grid { grid-template-columns: repeat(6, 1fr); gap: 16px; }
}

/* ---------- Gallery ---------- */
.gallery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.g-item { margin: 0; }
.g-link { display: block; overflow: hidden; border-radius: 10px; aspect-ratio: 4 / 3; background: var(--paper-2); }
.g-link img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
/* Captions (optional) appear only in the full-screen viewer */
.g-item figcaption { display: none; }
.gallery-more { margin: 28px auto 0; display: flex; flex: none; width: fit-content; }
@media (hover: hover) { .g-link:hover img { transform: scale(1.04); } }
@media (min-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
@media (min-width: 1000px) { .gallery-grid { grid-template-columns: repeat(4, 1fr); gap: 18px 16px; } }

/* Full-screen photo viewer */
.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(6, 18, 48, .96); color: #dbe4f5; }
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgba(6, 18, 48, .96); }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 64px 16px 24px; touch-action: pan-y; }
.lightbox img { max-width: min(100%, 1400px); max-height: calc(100dvh - 160px); object-fit: contain; border-radius: 6px; user-select: none; -webkit-user-drag: none; }
.lightbox figcaption { max-width: 60ch; text-align: center; font-size: .92rem; line-height: 1.45; }
.lightbox figcaption .count { display: block; margin-top: 4px; font-size: .78rem; color: #8fa0c4; }
.lb-btn { position: absolute; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.22); color: #fff; touch-action: manipulation; }
.lb-btn svg { width: 22px; height: 22px; }
.lb-close { top: 12px; right: 12px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
@media (hover: hover) { .lb-btn:hover { background: var(--gold-light); border-color: var(--gold-light); color: var(--ink); } }
@media (max-width: 639px) { .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; } }
