@font-face { font-family: "Site Serif"; src: url("../fonts/source-serif-4-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Site Sans"; src: url("../fonts/source-sans-3-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Site Sans"; src: url("../fonts/source-sans-3-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --accent: #1a2a4a;
  --accent-soft: #33456b;
  --accent2: #a2662c;
  --accent2-soft: #c0894a;
  /* Single source of truth for every hover state: any link, nav item, button,
     or icon shifts to this color on hover/focus. Defined once as var(--accent2)
     so the dark-mode override of --accent2 flows through automatically. */
  --hover: var(--accent2);
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #5f5e5a;
  --line: #e6e3dc;
  --max: 1080px;
  --measure: 42rem; /* reading width for prose sections; font-independent so headings + body align */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Site Sans", system-ui, sans-serif; font-size: 17px; line-height: 1.65;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: "Site Serif", Georgia, serif; color: var(--accent); line-height: 1.25; }
h1 { font-size: 2rem; margin: 0.2rem 0; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

/* Section headers: small ochre accent rule beneath each h2 */
main section h2::after {
  content: ""; display: block; width: 2.5rem; height: 3px;
  margin-top: 0.5rem; background: var(--accent2);
}
a { color: var(--accent-soft); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--hover); }
a:focus-visible, .button:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* Research / authors / awards links: no underline at rest, underline + ochre
   tint (--hover) revealed on hover/focus. About links keep the default
   underline at rest; only their color shifts to ochre on hover. */
.research-list a, .pub-authors a, #awards-list a {
  text-decoration: none;
}
#about-body a:hover, #about-body a:focus-visible,
.research-list a:hover, .research-list a:focus-visible,
.pub-authors a:hover, .pub-authors a:focus-visible,
#awards-list a:hover, #awards-list a:focus-visible {
  text-decoration: underline;
  color: var(--hover);
}
.muted { color: var(--muted); }

/* Sticky nav */
#site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(251, 250, 247, 0.92); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
#site-nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; max-width: var(--max); margin: 0 auto; padding: 0.75rem 1rem;
}
.nav-name { font-family: "Site Serif", serif; font-weight: 600; font-size: 1.1rem; color: var(--accent); text-decoration: none; }
.nav-name:hover { color: var(--hover); }
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-links { display: flex; flex-wrap: wrap; gap: 1rem; list-style: none; margin: 0; padding: 0; }

/* Theme toggle: borderless icon button that inherits nav-link colors */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; width: 2rem; height: 2rem; padding: 0;
  background: none; border: none; border-radius: 6px;
  color: var(--muted); cursor: pointer; transition: color 0.15s ease, background-color 0.15s ease;
}
.theme-toggle:hover { color: var(--hover); background: var(--line); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.theme-toggle svg { display: block; }
.nav-links a { color: var(--muted); font-size: 0.95rem; text-decoration: none; letter-spacing: 0.02em; }
.nav-links a:hover { color: var(--hover); }
.nav-links a.active { color: var(--accent); border-bottom: 2px solid var(--accent2); }

main { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }
section { padding: 3rem 0; scroll-margin-top: 4rem; }
#hero { border-top: none; text-align: center; padding-top: 2.5rem; padding-bottom: 1.5rem; }
/* News sits directly under the hero (no band boundary between them), so trim the
   hero's bottom padding and News's top padding to tighten the gap between them. */
#news { padding-top: 0.5rem; }

/* Alternating full-bleed bands: cream (page --bg) ↔ white (--surface). The
   band is painted by a viewport-wide pseudo-element behind the content, so the
   centered max-width column is untouched. body has overflow-x:hidden so the
   100vw width can't trigger a horizontal scrollbar. */
main section.section-alt { position: relative; }
main section.section-alt::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  left: 50%; transform: translateX(-50%);
  width: 100vw; background: var(--surface); z-index: -1;
}

/* Scroll reveal: gated behind .js-reveal (set by main.js before it starts
   observing) so no-JS users always see full-opacity, untransformed sections. */
.js-reveal main section { opacity: 0; transform: translateY(10px); transition: opacity 0.35s ease, transform 0.35s ease; }
.js-reveal main section.revealed { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js-reveal main section { opacity: 1; transform: none; transition: none; }
}

/* Top row: hero + education side by side, stacking on narrow screens */
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: center; }
.hero-col { display: flex; flex-direction: column; align-items: center; }
.edu-col { text-align: left; }
.edu-col #education-heading { margin-top: 0; }

/* CV button + links, in a single centered column (two rows) below both columns */
.hero-footer { display: flex; flex-direction: column; align-items: center; margin-top: 1.5rem; }

@media (min-width: 720px) {
  .hero-grid.has-education { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .hero-grid.has-education .hero-col { align-items: flex-start; text-align: left; }
  /* Nudge Education down so it reads as vertically centered against the
     taller hero column (photo + name + title + tagline). */
  .hero-grid.has-education .edu-col { margin-top: 3rem; }
  .hero-grid.has-education #hero-tagline { margin-left: 0; }
  h1 { font-size: 2.1rem; }
  /* .hero-col prefix outranks the base #hero-photo rule, which sits later in
     the source with equal specificity and would otherwise win. */
  .hero-col #hero-photo { width: 176px; height: 176px; }
}

#hero-photo {
  width: 150px; height: 150px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--surface); margin-bottom: 1rem;
  box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--line), 0 6px 20px rgba(0, 0, 0, 0.08);
  background: var(--line);
}
#hero-title { font-size: 1.1rem; color: var(--muted); margin: 0.2rem 0; letter-spacing: 0.03em; }
#hero-tagline {
  font-family: "Site Serif", Georgia, serif; font-style: italic;
  font-size: 1.25rem; color: var(--accent-soft);
  max-width: 40ch; margin: 0.6rem auto 1.2rem;
}
.hero-actions { margin: 1rem 0; }
.button {
  display: inline-block; background: var(--accent); color: #fff;
  padding: 0.55rem 1.1rem; border-radius: 6px; font-weight: 600;
  text-decoration: none;
}
.button:hover { background: var(--hover); color: #fff; }
.icon-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 1rem; list-style: none; padding: 0; margin: 1rem 0 0; }
.icon-link { display: inline-flex; align-items: center; gap: 0.4rem; }
.icon-link svg { flex: none; }
/* Ochre tint on hover/focus; icons use currentColor, so label + icon shift together */
.icon-link:hover, .icon-link:focus-visible { color: var(--hover); }

#education-list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.edu-item { position: relative; padding: 0 0 1.1rem 1.15rem; }
.edu-item:last-child { padding-bottom: 0; }
/* Bead straddling the 2px rail; --bg ring lifts it off the line (adapts per theme). */
.edu-item::before {
  content: ""; position: absolute; left: -7px; top: 0.35rem;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent2-soft); box-shadow: 0 0 0 3px var(--bg);
}
.edu-year { display: block; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.edu-degree { color: var(--text); }
.edu-inst { color: var(--muted); font-size: 0.9rem; }
.research-pillars { list-style: none; margin: 0 0 1.35rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.55rem; }
.pillar {
  border: 1px solid var(--accent2-soft); color: var(--accent);
  border-radius: 999px; padding: 0.4rem 0.9rem;
  font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.25;
}
.research-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.research-list li { position: relative; padding-left: 1.1rem; }
.research-list li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent2-soft);
}

/* Reading measure: cap prose width for comfortable line length */
#research h2, #research .research-pillars, #research .research-list, #research .research-note { max-width: var(--measure); margin-inline: auto; }
#research .research-note { margin-top: 1.5rem; color: var(--muted); font-size: 0.95rem; font-style: italic; }
#research .research-note:empty { display: none; }

/* About: two prose columns across the full content width (matching
   Publications). Single column on narrow screens; the reading measure no
   longer applies since each column is naturally narrow. */
#about-body { display: grid; grid-template-columns: 1fr; gap: 1.5rem 2.5rem; }
#about-body p { margin: 0; }
@media (min-width: 720px) {
  #about-body { grid-template-columns: 1fr 1fr; }
}

/* Publications */
/* Count + Google Scholar link at the top of the section. The separator dot only
   appears when the count is present, so an empty count leaves just the link. */
.pub-summary { color: var(--muted); margin: 0 0 1.5rem; }
.pub-count { color: var(--text); }
.pub-count:not(:empty)::after { content: "·"; margin: 0 0.55rem; color: var(--muted); }
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub-item { margin-bottom: 1.5rem; padding-left: 2.2rem; }
.pub-num { display: inline-block; width: 2.2rem; margin-left: -2.2rem; color: var(--muted); font-weight: 600; }
.pub-title { font-weight: 600; }
.pub-authors { color: var(--text); font-size: 0.95rem; }
.pub-venue { color: var(--muted); font-style: italic; font-size: 0.9rem; }
.pub-venue-sep { font-style: normal; margin: 0 0.55rem; }
.pub-pubyear { font-style: normal; }
.pub-doi {
  display: inline-block; margin-top: 0.4rem;
  padding: 0.1rem 0.5rem; border: 1px solid var(--accent2); border-radius: 999px;
  color: var(--accent2); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em;
  text-decoration: none; transition: background-color 0.15s ease, color 0.15s ease;
}
.pub-doi:hover, .pub-doi:focus-visible { background: var(--hover); color: var(--surface); }

#contact-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 1rem; }
#site-footer { max-width: var(--max); margin: 0 auto; padding: 2rem 1rem; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); }

@media (max-width: 600px) {
  body { font-size: 16px; }
  #site-nav { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .nav-links { gap: 0.75rem; }
  h1 { font-size: 1.6rem; }
}

/* ------------------------------------------------------------------ */
/* Dark mode: applied via [data-theme="dark"] on <html>, which the inline
   script in index.html sets before first paint (from the saved choice, else
   the OS preference). js/main.js flips it on toggle and follows the OS while
   no explicit choice is saved. */
:root[data-theme="dark"] {
  --accent: #b7c6e8;
  --accent-soft: #cdd8ef;
  --accent2: #d3a45f;
  --accent2-soft: #e2bb80;
  --bg: #141821;
  --surface: #1c212c;
  --text: #e9e7e2;
  --muted: #a7abb5;
  --line: #2b313d;
}

/* CV button: --accent is now light, so white text needs a fixed dark-navy
   bg instead of following the token (rest darker, hover lighter, mirroring
   the light-mode relationship). */
:root[data-theme="dark"] .button { background: #2a3a5c; color: #fff; }
/* Rest state above outranks the base .button:hover, so hover needs its own
   dark-mode rule; it routes through --hover like every other hover state. */
:root[data-theme="dark"] .button:hover { background: var(--hover); color: #fff; }

/* Sticky header: hard-coded light rgba, needs a translucent-dark match for --bg */
:root[data-theme="dark"] #site-header { background: rgba(20, 24, 33, 0.92); }

/* News strip: compact, quiet, sits just under the hero */
/* News: a compact timeline echoing the Education rail (newest on top). Each row
   keeps its date beside the text so the strip stays tight and scannable, with
   the latest item accented — solid haloed bead, ochre date, lightly weighted
   text — to pull the eye to the most recent win. Items rise in a slight stagger
   on reveal to convey forward motion. */
.news-list { list-style: none; margin: 0; padding: 0; max-width: var(--measure); border-left: 2px solid var(--line); }
.news-item { position: relative; display: flex; gap: 0.85rem; align-items: baseline; padding: 0 0 0.75rem 1.2rem; }
.news-item:last-child { padding-bottom: 0; }
/* Bead straddling the 2px rail; --bg ring lifts it off the line (adapts per theme). */
.news-item::before {
  content: ""; position: absolute; left: -6px; top: 0.5rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent2-soft); box-shadow: 0 0 0 3px var(--bg);
}
/* Latest item: solid, larger bead ringed by a soft ochre halo. */
.news-item:first-child::before {
  width: 12px; height: 12px; left: -7px;
  background: var(--accent2); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent2-soft);
}
.news-date { flex: none; min-width: 4.4rem; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.news-item:first-child .news-date { color: var(--accent2); font-weight: 600; }
.news-text { color: var(--text); }
.news-item:first-child .news-text { font-weight: 500; }
/* Stack the date above the text on very narrow screens so the row never crams. */
@media (max-width: 540px) {
  .news-item { flex-direction: column; gap: 0.1rem; }
}

/* Staggered rise of the timeline items when the News section reveals. Gated
   behind .js-reveal like the section-level reveal, so no-JS users see them
   fully. Delays cover the current five items; extras simply appear undelayed. */
.js-reveal #news .news-item { opacity: 0; transform: translateY(8px); transition: opacity 0.4s ease, transform 0.4s ease; }
.js-reveal #news.revealed .news-item { opacity: 1; transform: none; }
.js-reveal #news.revealed .news-item:nth-child(1) { transition-delay: 0.05s; }
.js-reveal #news.revealed .news-item:nth-child(2) { transition-delay: 0.13s; }
.js-reveal #news.revealed .news-item:nth-child(3) { transition-delay: 0.21s; }
.js-reveal #news.revealed .news-item:nth-child(4) { transition-delay: 0.29s; }
.js-reveal #news.revealed .news-item:nth-child(5) { transition-delay: 0.37s; }
@media (prefers-reduced-motion: reduce) {
  .js-reveal #news .news-item { opacity: 1; transform: none; transition: none; }
}

/* Research vision: thrust cards above the interests list */
#research-vision { max-width: var(--measure); margin-inline: auto; margin-bottom: 1.75rem; display: flex; flex-direction: column; gap: 1.1rem; }
.vision-item { border-left: 3px solid var(--accent2-soft); padding-left: 0.9rem; }
.vision-heading { margin: 0 0 0.25rem; font-size: 1.05rem; }
.vision-body { margin: 0; color: var(--text); }

/* Software cards */
.software-list { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 720px) { .software-list { grid-template-columns: 1fr 1fr; } }
.software-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.software-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.software-name { margin: 0; font-size: 1.1rem; }
.software-role { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent2); }
.software-desc { margin: 0; color: var(--text); }
.software-stats { color: var(--muted); font-size: 0.9rem; }
.software-links { display: flex; gap: 0.75rem; }
.software-link { font-size: 0.9rem; text-decoration: underline; color: var(--accent-soft); }
.software-link:hover, .software-link:focus-visible { color: var(--hover); }

/* Selected publications: numbered, so keep the base hanging-number gutter. */
.pub-role {
  display: inline-block; margin-left: 0.5rem; vertical-align: middle;
  padding: 0.05rem 0.45rem; border-radius: 999px;
  background: var(--accent2-soft); color: var(--surface);
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
  /* Balance the trailing letter-spacing so the text sits centered in the pill. */
  text-indent: 0.05em;
}

/* Selected talks */
.talks-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.talk-item { display: grid; grid-template-columns: 3.5rem 1fr; column-gap: 0.75rem; align-items: baseline; }
.talk-year { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.talk-title { font-weight: 600; color: var(--text); text-decoration: none; }
a.talk-title:hover, a.talk-title:focus-visible { color: var(--hover); text-decoration: underline; }
.talk-invited {
  justify-self: start; padding: 0.02rem 0.4rem; border: 1px solid var(--accent2); border-radius: 999px;
  color: var(--accent2); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em;
  /* Balance the trailing letter-spacing so the text sits centered in the pill. */
  text-indent: 0.05em;
}
.talk-venue { grid-column: 2; color: var(--muted); font-style: italic; font-size: 0.9rem; }

/* Mentoring block under Teaching */
#mentoring { max-width: var(--measure); margin-top: 1.25rem; }
#mentoring p { margin: 0; }
