/* Hallmark · checked: 2026-10-23 · genre: editorial (inferred: a personal academic page)
 * floor: 0 FAIL by a manual walk of gates.md (sloplint not run: Node is not installed)
 * fixed: 10 floor (7a, 19, 20, 24a, 34, 48, 50, 54, 63, 67) and 3 reflex (7b, 26b, 64)
 * structural: 4 printed, not rebuilt (9, 58, 59, 78)
 * built: the project · redesign: polish · v2.0.0 */
/* Hallmark · waive 1 · the display is a system serif stack (Iowan Old Style, Palatino, Georgia) · the site ships no web fonts so it loads quickly in mainland China without a font CDN */
/* Hallmark · waive 39b · resource chips are 32px tall inside publication rows and paper cards · compact inline links in dense bibliography rows, and touch screens get a 44px hit area */
/* Hallmark · kept "CV — Coming soon" · the owner asked for this exact wording for the CV slot, so 19 reads it as a note */
/* Hallmark · dismissed 24a · margin: -1px in .visually-hidden · an accessibility clipping utility, not layout spacing */

/* ==========================================================================
   Personal academic website: stylesheet
   --------------------------------------------------------------------------
   1. Design tokens: typography, spacing, colors   ← most visual changes here
   2. Base elements
   3. Layout: top bar, page sheet, profile, content column
   4. Components: sections, news, projects, publications, visitor map, footer
   5. Responsive layout (tablet ≥ 40em, desktop ≥ 64em)
   6. Motion and print
   ========================================================================== */


/* 1. Design tokens --------------------------------------------------------- */

:root {
  /* Typography: system fonts only, so nothing is downloaded from a font CDN.
     Chinese fallbacks are listed in case CJK text is added later. */
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    "URW Palladio L", "Noto Serif", Georgia, "Songti SC", "Noto Serif CJK SC", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  --text-body: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
  --text-2xs: 0.6875rem;
  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-md: 1.0625rem;
  --text-lg: clamp(1.1875rem, 1.1rem + 0.4vw, 1.375rem);
  --text-xl: clamp(1.375rem, 1.25rem + 0.55vw, 1.625rem);
  --text-2xl: clamp(1.75rem, 1.55rem + 0.9vw, 2.125rem);
  --leading-body: 1.65;
  --leading-snug: 1.4;
  --leading-tight: 1.2;

  /* Spacing */
  --space-0-5: 0.125rem;
  --space-1: 0.25rem;
  --space-1-5: 0.375rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --section-gap: clamp(3.5rem, 2.5rem + 3vw, 5rem);
  --sheet-gap: clamp(2.5rem, 0.5rem + 3.5vw, 5rem);      /* sidebar to content (desktop) */
  --sheet-pad: clamp(2rem, 0.5rem + 3vw, 4.5rem);        /* sheet side padding (desktop) */
  --gutter: 1rem;              /* page side padding on phones */
  --measure: 68ch;             /* maximum line length for prose */
  --page-max: 76rem;           /* desktop sheet width */
  --sidebar-width: 16.5rem;
  --content-max: 46rem;        /* single-column width on tablets */
  --topbar-height: 3.5rem;
  --tap: 2.75rem;              /* minimum touch target (44px) */

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Motion: one easing and a few durations, shared by every transition. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);   /* quick start, long gentle settle */
  --motion-fast: 0.18s;        /* hover and focus colour changes */
  --motion-card: 0.3s;         /* paper card border on hover */
  --motion-reveal: 0.5s;       /* content fading in on scroll */
  --reveal-rise: 10px;         /* how far revealed content rises */

  /* Colors: light theme */
  --bg-canvas: #f1f0ec;        /* outside the page sheet (desktop) */
  --bg: #fcfcfa;               /* page background */
  --surface: #f4f4f0;          /* figures, panels, inset controls */
  --surface-2: #e9e9e3;
  --seg-active: #fefefc;       /* selected option in the theme control */
  --text: #1d2430;
  --text-muted: #4e5866;
  --text-faint: #646c79;
  --border: #e3e1da;
  --border-strong: #cfccc2;
  --accent: #2d5b8a;           /* muted blue */
  --accent-hover: #1f4670;
  --accent-soft: #e8eef5;
  --accent-soft-border: #c9d7e7;
  --on-accent: #fcfcfa;
  --link-underline: rgb(45 91 138 / 0.35);
  --focus: #2d6bb0;
  --map-line: #d3d1c9;
  --map-dot: #c4c2b9;
  /* Boundary-condition colours in the research figures. The same values
     serve both themes and must match tools/make_figures.py. */
  --bc-dirichlet: #5a8fd0;
  --bc-neumann: #e0913f;
  --bc-robin: #3fae96;
  --bc-corner: #9aa6b6;
  --shadow-sheet: 0 1px 2px rgb(20 30 45 / 0.04), 0 18px 40px -24px rgb(20 30 45 / 0.18);
  --shadow-pop: 0 12px 32px -12px rgb(20 30 45 / 0.25);
  --shadow-control: 0 0 0 1px var(--border), 0 1px 2px rgb(20 30 45 / 0.08);
  --shadow-badge: 0 1px 2px rgb(20 30 45 / 0.06);

  color-scheme: light;
}

/* Colors: dark theme. The same values appear twice: once for "System" when
   the OS prefers dark, once for an explicit "Dark" choice. Keep them in sync.
   Both are limited to screens so that printing always uses the light palette. */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-canvas: #0b0f15;
    --bg: #11161d;
    --surface: #171d26;
    --surface-2: #1e2531;
    --seg-active: #2a3442;
    --text: #e3e6eb;
    --text-muted: #aab2be;
    --text-faint: #868f9c;
    --border: #252d38;
    --border-strong: #354050;
    --accent: #8eb4dc;
    --accent-hover: #b3cdea;
    --accent-soft: #1a2636;
    --accent-soft-border: #2c3e55;
    --on-accent: #0b0f15;
    --link-underline: rgb(142 180 220 / 0.4);
    --focus: #9cc2ea;
    --map-line: #2a3340;
    --map-dot: #36414f;
    --shadow-sheet: 0 1px 2px rgb(0 0 0 / 0.4), 0 18px 40px -20px rgb(0 0 0 / 0.65);
    --shadow-pop: 0 12px 32px -12px rgb(0 0 0 / 0.7);
    --shadow-control: 0 0 0 1px var(--border), 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-badge: 0 1px 2px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}

@media screen {
  :root[data-theme="dark"] {
    --bg-canvas: #0b0f15;
    --bg: #11161d;
    --surface: #171d26;
    --surface-2: #1e2531;
    --seg-active: #2a3442;
    --text: #e3e6eb;
    --text-muted: #aab2be;
    --text-faint: #868f9c;
    --border: #252d38;
    --border-strong: #354050;
    --accent: #8eb4dc;
    --accent-hover: #b3cdea;
    --accent-soft: #1a2636;
    --accent-soft-border: #2c3e55;
    --on-accent: #0b0f15;
    --link-underline: rgb(142 180 220 / 0.4);
    --focus: #9cc2ea;
    --map-line: #2a3340;
    --map-dot: #36414f;
    --shadow-sheet: 0 1px 2px rgb(0 0 0 / 0.4), 0 18px 40px -20px rgb(0 0 0 / 0.65);
    --shadow-pop: 0 12px 32px -12px rgb(0 0 0 / 0.7);
    --shadow-control: 0 0 0 1px var(--border), 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-badge: 0 1px 2px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}


/* 2. Base elements --------------------------------------------------------- */

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

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
  overflow-x: clip;
}

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

img {
  height: auto;
}

h1,
h2,
h3 {
  min-width: 0;
  margin: 0;
  overflow-wrap: break-word;
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--text);
  text-wrap: balance;
}

p {
  margin: 0 0 var(--space-4);
  text-wrap: pretty;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

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

main:focus {
  outline: none;
}

::selection {
  background: var(--accent-soft-border);
  color: var(--text);
}

button {
  font: inherit;
  color: inherit;
}

pre,
code {
  font-family: var(--font-mono);
}

.icon {
  width: 1.125em;
  height: 1.125em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Set for one frame by main.js while the theme changes. */
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: none !important;
}

/* The hidden attribute always wins over component display rules. */
[hidden] {
  display: none !important;
}

/* Controls that only work with JavaScript are hidden without it. */
html:not(.js) .js-only {
  display: none !important;
}

.muted {
  color: var(--text-faint);
}

.nowrap {
  white-space: nowrap;
}

/* Placeholder phrases inside otherwise final-looking text. */
.ph {
  color: var(--text-muted);
  font-style: italic;
}

.skip-link {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Small label for a list or a control group, in the body face. */
.label {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-faint);
}


/* 3. Layout ---------------------------------------------------------------- */

/* Top bar (phones and tablets) */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  min-height: var(--topbar-height);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.topbar__name {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* The profile below already shows the name; avoid repeating it at the top. */
html.js .topbar:not(.is-past-profile) .topbar__name {
  opacity: 0;
  visibility: hidden;
}

.menu-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  margin-right: calc(-1 * var(--space-2));
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
}

.menu-button:hover {
  background: var(--surface);
}

.menu-button .icon--close,
.menu-button[aria-expanded="true"] .icon--menu {
  display: none;
}

.menu-button[aria-expanded="true"] .icon--close {
  display: block;
}

.menu-panel {
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding: 0 var(--gutter) var(--space-3);
}

html.js .menu-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: none;
  padding-top: var(--space-2);
  padding-bottom: var(--space-5);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  /* Short screens (a phone held sideways): the menu fits below the top bar
     and scrolls inside itself instead of running past the viewport. */
  max-height: calc(100vh - var(--topbar-height));
  max-height: calc(100dvh - var(--topbar-height));
  overflow-y: auto;
  overscroll-behavior: contain;
}

html.js .menu-panel.is-open {
  display: block;
  animation: reveal 0.18s ease-out;
}

/* Without JavaScript the menu is a simple wrapped row of links. */
html:not(.js) .menu-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-4);
}

.menu-nav a {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  min-height: var(--tap);
  padding: var(--space-2) 0;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

html.js .menu-nav a {
  align-items: center;
}

.menu-nav a[aria-current] {
  color: var(--accent);
}

.menu-panel .theme-switch {
  max-width: 24rem;
  margin-top: var(--space-5);
}

/* Profile (top section on phones; sidebar on desktop) */
.profile {
  padding: var(--space-5) var(--gutter) var(--space-6);
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.portrait {
  width: 6.5rem;
  aspect-ratio: 1;
  margin: 0 auto var(--space-4);
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--border-strong);
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile__name {
  font-size: var(--text-2xl);
  letter-spacing: -0.005em;
}

.profile__role {
  margin: var(--space-2) 0 0;
  color: var(--text);
}

.profile__affil {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

.profile__email {
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.profile__office {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.profile__block {
  margin-top: var(--space-5);
}

.interests {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.interests li {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--accent-soft-border);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.5;
}

.interests li.is-placeholder {
  border-style: dashed;
  border-color: var(--border-strong);
  background: transparent;
  color: var(--text-faint);
}

.profile-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  max-width: 18rem;
  margin: var(--space-5) auto 0;
}

.plink {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.25rem;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: var(--text-sm);
  text-decoration: none;
}

a.plink:hover {
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Shared "not available yet" look for links, chips, and buttons. */
:is(.plink, .chip, .btn).is-inactive {
  border-style: dashed;
  background: transparent;
  color: var(--text-faint);
  cursor: not-allowed;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-5);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}

.btn--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.btn--primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: var(--on-accent);
}

.profile .btn--block {
  display: flex;
  width: 100%;
  max-width: 18rem;
  margin: var(--space-2) auto 0;
  min-height: 2.25rem;
}

.sidenav {
  display: none;
}

.theme-switch {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.theme-switch--sidebar {
  display: none;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-0-5);
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.segmented label {
  position: relative;
  display: block;
}

.segmented input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented label > span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1-5);
  min-height: var(--tap);
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  pointer-events: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.segmented label:hover > span {
  color: var(--text);
}

.segmented input:checked + span {
  background: var(--seg-active);
  color: var(--text);
  box-shadow: var(--shadow-control);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

/* Content column */
.content {
  padding-inline: var(--gutter);
}


/* 4. Components ------------------------------------------------------------ */

.section {
  scroll-margin-top: calc(var(--topbar-height) + var(--space-4));
}

.section:first-child {
  padding-top: var(--space-7);
}

.section + .section {
  margin-top: var(--section-gap);
}

.section__title {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  font-size: var(--text-xl);
}

.section__title::after {
  content: "";
  flex: 1;
  align-self: center;
  height: 1px;
  margin-left: var(--space-2);
  background: var(--border);
}

.section__note {
  max-width: var(--measure);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.lead {
  max-width: 36em;
  margin-bottom: var(--space-5);
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  color: var(--text);
}

.prose p {
  max-width: var(--measure);
}

.subhead {
  margin: var(--space-6) 0 var(--space-3);
  font-size: var(--text-md);
}

/* Education timeline */
.timeline li {
  display: grid;
  gap: var(--space-1) var(--space-5);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}

.timeline li:last-child {
  border-bottom: 1px solid var(--border);
}

/* A list right under a section heading (News, Service and Teaching) follows
   the heading's rule directly, so skip its top border. */
.section__title + .timeline > li:first-child {
  padding-top: 0;
  border-top: 0;
}

/* Folded lists (News, Publications): items hidden until the toggle is pressed. */
.is-collapsed > .is-older {
  display: none;
}

.timeline--news.is-collapsed {
  border-bottom: 1px solid var(--border);
}

.fold-more {
  margin-top: var(--space-3);
}

.timeline__when {
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

.timeline__what {
  margin: 0;
}

.timeline__note {
  margin: 0;
  color: var(--text-faint);
  font-size: var(--text-sm);
}

/* Education: each degree's university logo in a narrow column to the left of
   its text, centred on the degree's line so the rows keep their height. The
   logos are sized against the column width (--edu-mark), each to a share
   that makes the three look about equally heavy. */
.timeline--education {
  --edu-mark: 2rem;
  --edu-mark-height: 1.875rem;
}

.edu {
  display: grid;
  grid-template-columns: var(--edu-mark) minmax(0, 1fr);
  column-gap: var(--space-3);
  align-items: start;
}

.edu__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--edu-mark-height);
  margin-top: calc((var(--text-body) * var(--leading-body) - var(--edu-mark-height)) / 2);
}

.edu__logo {
  display: block;
  height: auto;
}

.edu__logo--purdue { width: calc(var(--edu-mark) * 0.85); }
.edu__logo--uw { width: calc(var(--edu-mark) * 0.78); }
.edu__logo--scu { width: calc(var(--edu-mark) * 0.85); }

/* Logos with a version for dark backgrounds swap with the theme. */
.edu__logo--on-dark {
  display: none;
}

@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .edu__logo--on-light {
    display: none;
  }

  :root:not([data-theme="light"]) .edu__logo--on-dark {
    display: block;
  }
}

@media screen {
  :root[data-theme="dark"] .edu__logo--on-light {
    display: none;
  }

  :root[data-theme="dark"] .edu__logo--on-dark {
    display: block;
  }
}

/* Resource links shown as small chips */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  min-height: 2rem;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

a.chip:hover,
button.chip:hover {
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

button.chip {
  cursor: pointer;
}

a.chip:active,
button.chip:active,
a.plink:active,
a.btn:active,
.menu-button:active,
.segmented label:active > span {
  background: var(--surface-2);
}

.chip--toggle::after {
  content: "+";
  content: "+" / "";
  display: inline-block;
  width: 0.6em;
  text-align: center;
  transition: transform 0.2s ease;
}

.chip--toggle[aria-expanded="true"] {
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
}

.chip--toggle[aria-expanded="true"]::after {
  content: "−";
  content: "−" / "";
}

.chip--small {
  min-height: 1.75rem;
  padding: 0 var(--space-2);
}

/* Selected research: each research direction (a project) has a title and
   a summary, a panel showing one paper's animation at a time, and its papers
   as cards; choosing a card shows that paper's animation in the panel. */
.project {
  padding: var(--space-5) 0;
  border-top: 1px solid var(--border);
}

.project:first-of-type {
  border-top: 0;
  padding-top: var(--space-2);
}

/* Research titles (this one, the paper names in the panel and on the cards,
   and the publication titles) wrap normally, filling each line to the edge
   of the space they have, rather than the headings' balanced lines. */
.project__title {
  font-size: var(--text-lg);
  line-height: 1.3;
  text-wrap: wrap;
}

.project__summary {
  max-width: var(--measure);
  margin: var(--space-3) 0 0;
  color: var(--text-muted);
}

/* The panel: the chosen paper's name, its animation and legend, and a
   sentence on what the animations show. With JavaScript, only the frame
   marked .is-current shows; without it, every frame shows, one under the
   other. */
.maps {
  position: relative;
  display: grid;
  gap: var(--space-3);
  margin: var(--space-5) 0 0;
  padding: var(--space-3) var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* The arrows, the position ("1 / 2") and Pause: a row of their own at the
   top of the panel on narrow screens, beside the paper's name on wider
   ones. */
.maps__controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.maps__count {
  min-width: 3rem;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text-muted);
}

.maps__pause {
  margin-left: auto;
}

/* A round chip holding just an icon. Two classes, so it keeps its shape on
   touch screens, where chips get more padding. */
.chip.chip--icon {
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
}

/* Pressed means paused. */
.chip[aria-pressed="true"] {
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
}

.maps__frame {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.js .maps__frame:not(.is-current) {
  display: none;
}

.maps__name {
  display: flex;
  align-items: center;
  min-height: 2rem;
  margin: 0;
  text-wrap: wrap;
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: var(--leading-snug);
  color: var(--text);
}

.maps__media {
  aspect-ratio: 16 / 10;
}

/* Sideways swipes across an animation go to main.js, which steps to the
   previous or next one; up and down still scroll the page. */
.js .maps__media {
  touch-action: pan-y;
}

.maps__media picture {
  display: block;
  height: 100%;
}

/* "contain" keeps the whole figure in view. */
.maps__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Legend under each animation: the map it draws and the colour keys. */
.maps__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-muted);
}

.maps__formula {
  margin-right: var(--space-1);
  color: var(--text);
}

.maps__caption {
  max-width: var(--measure);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-muted);
}

/* The papers, one card each: name, venue, a note on what the paper adds,
   and its links, kept at the bottom so that cards side by side line up. */
.papers {
  min-width: 0;
  margin: var(--space-5) 0 0;
  padding: 0;
  border: 0;
}

.papers__legend {
  margin-bottom: var(--space-3);
  padding: 0;
  font-size: var(--text-sm);
  color: var(--text-faint);
}

.papers__list {
  display: grid;
  gap: var(--space-4);
}

.paper {
  position: relative;
  display: flex;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.paper__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding: var(--space-4);
}

.paper__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: var(--leading-snug);
  color: var(--text);
  text-wrap: wrap;
}

.paper__venue {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  color: var(--text-faint);
}

.paper__note {
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Links sit above the card-wide label below, so they stay clickable. */
.paper .links {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: var(--space-4);
}

/* A card with an animation is a radio button: its label covers the whole
   card, and the dot in the top corner shows which paper the panel shows. */
.paper__pick {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  cursor: pointer;
}

.paper__pick + .paper__body .paper__title {
  padding-right: var(--space-6);
}

.paper__dot {
  position: absolute;
  top: calc(var(--space-4) + 0.125rem);
  right: var(--space-4);
  width: 1.125rem;
  height: 1.125rem;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg);
}

.paper__input:checked + .paper__pick .paper__dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--bg);
}

.js .paper:has(.paper__input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.paper__input:focus-visible + .paper__pick {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.key::before {
  content: "";
  display: inline-block;
  width: 0.9rem;
  height: 3px;
  margin-right: var(--space-1-5);
  border-radius: 2px;
  background: var(--key-color);
  vertical-align: middle;
}

.key--dirichlet { --key-color: var(--bc-dirichlet); }
.key--neumann { --key-color: var(--bc-neumann); }
.key--robin { --key-color: var(--bc-robin); }

.key--corner::before {
  width: 0.55rem;
  height: 0.55rem;
  border: 1.5px solid var(--bc-corner);
  border-radius: 50%;
  background: none;
}

/* Publications */
.pub {
  padding: var(--space-5) 0;
  border-top: 1px solid var(--border);
}

.pub:first-child {
  border-top: 0;
  padding-top: var(--space-2);
}

.pub__body {
  min-width: 0;
}

/* Paper titles wrap normally, filling each line to the column edge; the
   heading default (balance, or pretty) shortens lines unevenly by browser. */
.pub__title {
  font-size: var(--text-md);
  line-height: 1.35;
  text-wrap: wrap;
}

.pub__authors,
.pub__venue {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--text-muted);
}

.pub__authors .me {
  color: var(--text);
  font-weight: 600;
}

.pub__venue em {
  color: var(--text);
}

/* Expandable panels (abstract, BibTeX) */
.panel {
  margin-top: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-muted);
}

.panel p:last-child {
  margin-bottom: 0;
}

html.js .panel[data-collapsible]:not(.is-open) {
  display: none;
}

html.js .panel.is-open {
  animation: reveal 0.18s ease-out;
}

/* When GSAP has loaded, main.js slides panels open and shut instead. */
html.has-gsap .panel.is-open {
  animation: none;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.panel__label {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
}

.panel__head .panel__label {
  margin: 0;
}

.panel pre {
  margin: 0;
  overflow-x: auto;
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--text);
}

/* Visitor map */
.visitors {
  display: grid;
  gap: var(--space-4);
  align-items: start;
  margin-top: var(--section-gap);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

/* A minor heading: the body face, a step smaller, sentence case. */
.minor-title {
  margin: 0 0 var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
}

/* Visitor summary beside the map, filled in by main.js; a dash until there
   is data. Each figure sits above its label. */
.visitors__text {
  max-width: 24rem;
}

/* "Last 12 months | All time", shown by main.js when there are all-time
   figures. */
.visitor-period {
  min-width: 0;
  max-width: 18rem;
  margin: var(--space-3) 0 0;
  padding: 0;
  border: 0;
}

.visitor-period .segmented {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.visitor-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin: var(--space-3) 0 0;
}

.visitor-stats div {
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-1);
}

.visitor-stats dt {
  color: var(--text-faint);
  font-size: var(--text-xs);
}

.visitor-stats dd {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  line-height: 1.1;
  font-variant-numeric: lining-nums tabular-nums;
}

.visitor-recent {
  margin: var(--space-3) 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.visitor-footnote {
  margin: var(--space-4) 0 0;
  color: var(--text-faint);
  font-size: var(--text-xs);
}

.visitor-footnote + .visitor-footnote {
  margin-top: var(--space-2);
}

.visitor-map {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.visitor-map__svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* Land: a dot per grid point, drawn as round caps on zero-length segments
   (tools/make_visitor_map.py). */
.visitor-map__land {
  fill: none;
  stroke: var(--map-dot);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.visitor-map__lines {
  fill: none;
  stroke: var(--map-line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

/* A city: an accent dot, sized by visits, on a soft halo. */
.visitor-map__city {
  fill: var(--accent);
}

/* With motion, dots wait hidden until the map comes into view (main.js). */
.visitor-map.is-waiting .visitor-map__city {
  opacity: 0;
}

/* Only the dot answers the pointer, so a halo never covers a neighbour. */
.visitor-map__halo {
  opacity: 0.2;
  pointer-events: none;
}

.visitor-map__empty {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  box-shadow: var(--shadow-badge);
}

/* Footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-5);
  margin-top: var(--space-6);
  padding: var(--space-5) 0 var(--space-6);
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: var(--text-xs);
}

.site-footer__address {
  flex-basis: 100%;
  font-style: normal;
  line-height: 1.6;
}

.site-footer p {
  margin: 0;
}

.to-top {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--tap);
  color: var(--text-muted);
  text-decoration: none;
}

.to-top:hover {
  color: var(--accent);
}


/* 5. Responsive layout ----------------------------------------------------- */

/* Coarse pointers (touch screens): controls grow a little, and an invisible
   extension brings each interactive target to at least 44px tall. */
@media (pointer: coarse) {
  .chip {
    min-height: 2.25rem;
    padding-inline: var(--space-4);
  }

  .chip.chip--icon {
    width: 2.25rem;
    padding: 0;
  }

  .plink,
  .profile .btn--block {
    min-height: 2.5rem;
  }

  .links {
    row-gap: var(--space-3);
  }

  :is(a.chip, button.chip, a.plink, a.btn) {
    position: relative;
  }

  :is(a.chip, button.chip, a.plink, a.btn)::before {
    content: "";
    position: absolute;
    inset: -0.25rem -0.125rem;
  }
}

/* Tablet and up */
@media (min-width: 40em) {
  :root {
    --gutter: 2rem;
  }

  .profile {
    padding-block: var(--space-7);
    text-align: left;
  }

  .profile__card {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr);
    gap: var(--space-6);
    align-items: start;
    max-width: var(--content-max);
    margin-inline: auto;
  }

  .portrait {
    width: 100%;
    margin: 0;
  }

  .interests {
    justify-content: flex-start;
  }

  .profile-links {
    grid-template-columns: repeat(4, auto);
    justify-content: start;
    max-width: none;
    margin-inline: 0;
  }

  .profile .btn--block {
    display: inline-flex;
    width: auto;
    margin-inline: 0;
  }

  .content {
    max-width: calc(var(--content-max) + 2 * var(--gutter));
    margin-inline: auto;
  }

  .timeline li {
    grid-template-columns: 10rem minmax(0, 1fr);
  }

  .timeline--education {
    --edu-mark: 2.5rem;
    --edu-mark-height: 2.25rem;
  }

  /* An entry without a date or label keeps its text in line with the others. */
  .timeline li > :only-child {
    grid-column: 2;
  }

  .visitors {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  }
}

/* Paper cards two to a row, filling left to right, then top to bottom. */
@media (min-width: 45em) {
  .maps {
    padding: var(--space-4) var(--space-4) var(--space-5);
  }

  .maps > .maps__controls {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
  }

  .js .maps__name {
    padding-right: 13rem;
  }

  .papers__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Desktop: page sheet with a sticky profile sidebar */
@media (min-width: 64em) {
  body {
    background-color: var(--bg-canvas);
  }

  .topbar {
    display: none;
  }

  .page {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    column-gap: var(--sheet-gap);
    width: min(100% - 3rem, var(--page-max));
    margin: var(--space-6) auto;
    padding: var(--space-7) var(--sheet-pad) 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg);
    box-shadow: var(--shadow-sheet);
  }

  /* Sticky sidebar. When it is taller than the window, main.js sets
     --profile-top below zero so the sidebar scrolls with the page until its
     bottom is in view, then stays: nothing is cut off or scrolls separately. */
  .profile {
    position: sticky;
    top: var(--profile-top, var(--space-5));
    align-self: start;
    padding: 0 0 var(--space-3);
    border: 0;
    text-align: center;
  }

  .profile__card {
    display: block;
  }

  .portrait {
    width: 8rem;
    margin: 0 auto var(--space-4);
  }

  .profile__block {
    margin-top: var(--space-4);
  }

  .interests {
    justify-content: center;
  }

  .profile-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-1-5);
    margin: var(--space-3) auto 0;
  }

  .plink,
  .profile .btn--block {
    min-height: 2rem;
  }

  .profile .btn--block {
    margin-top: var(--space-1-5);
  }

  .profile .btn--block {
    display: flex;
    width: 100%;
  }

  .sidenav {
    display: block;
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
    text-align: left;
  }

  .sidenav a {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    padding: 0.1875rem var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9375rem;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .sidenav a:hover {
    background: var(--surface);
    color: var(--text);
  }

  .sidenav a[aria-current] {
    background: var(--accent-soft);
    color: var(--text);
  }

  .sidenav a[aria-current]::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 2px;
    border-radius: 2px;
    background: var(--accent);
  }

  /* Sidebar theme control: one row, label left, icon-only options right. */
  .theme-switch--sidebar {
    display: block;
    margin-top: var(--space-3);
    padding: var(--space-3) 0 0 var(--space-3);
    border-top: 1px solid var(--border);
    text-align: left;
  }

  .theme-switch--sidebar legend {
    float: left;
    margin: 0;
    line-height: 2.25rem;
  }

  .theme-switch--sidebar .segmented {
    width: max-content;
    margin-left: auto;
  }

  .theme-switch--sidebar .segmented label > span {
    min-height: 1.75rem;
    padding: 0 var(--space-2);
  }

  .theme-switch--sidebar .seg-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .content {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .section {
    scroll-margin-top: var(--space-6);
  }

  .section:first-child {
    padding-top: var(--space-2);
  }

  .site-footer {
    padding-bottom: var(--space-5);
  }
}



/* Short desktop windows: smaller portrait keeps the sidebar in view */
@media (min-width: 64em) and (max-height: 50em) {
  .portrait {
    width: 6rem;
  }

  .profile__name {
    font-size: var(--text-xl);
  }

  .profile__block {
    margin-top: var(--space-3);
  }

  .sidenav,
  .theme-switch--sidebar {
    margin-top: var(--space-2);
  }

  .sidenav {
    padding-top: var(--space-2);
  }
}

/* Large desktop: a little more room for the sidebar */
@media (min-width: 90em) {
  :root {
    --sidebar-width: 17.5rem;
  }
}


/* 6. Motion and print ------------------------------------------------------ */

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Hover and focus changes ease instead of snapping. Elements with their own
   transition (navigation links, the theme control) keep it. */
a,
.chip,
.plink,
.btn,
.menu-button,
.to-top {
  transition:
    color var(--motion-fast) ease,
    background-color var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    text-decoration-color var(--motion-fast) ease;
}

@media (prefers-reduced-motion: no-preference) {
  /* Reveal on scroll. main.js marks content below the first screen with
     [data-reveal]; the first time it comes into view it gets .is-revealed
     (with a short delay when several things arrive together), fades in and
     rises a little, and then both marks are removed. */
  [data-reveal] {
    opacity: 0;
    transform: translateY(var(--reveal-rise));
  }

  [data-reveal].is-revealed {
    opacity: 1;
    transform: none;
    transition:
      opacity var(--motion-reveal) var(--ease-out),
      transform var(--motion-reveal) var(--ease-out);
  }

  /* A section heading's rule draws in from the left as the heading arrives,
     leading the eye into the section. */
  .section__title[data-reveal]::after {
    transform: scaleX(0);
    transform-origin: left center;
  }

  .section__title[data-reveal].is-revealed::after {
    transform: none;
    transition: transform calc(var(--motion-reveal) * 1.2) var(--ease-out) 0.05s;
  }
}

/* Paper cards, on screens with a mouse: a card that can be chosen firms up
   its border and dot while the pointer is over it. Nothing moves. */
@media (hover: hover) {
  .paper,
  .paper__dot {
    transition: border-color var(--motion-card) var(--ease-out);
  }

  .paper:has(.paper__pick:hover):not(:has(.paper__input:checked)) {
    border-color: var(--border-strong);
  }

  .paper__pick:hover .paper__dot {
    border-color: var(--accent);
  }
}

/* Smooth scrolling for in-page links. main.js adds .smooth-scroll once the
   page has loaded, so opening a link to a section, or reloading, lands at once
   instead of gliding there from the top. */
@media (prefers-reduced-motion: no-preference) {
  html.smooth-scroll {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* The animations are already still, so there is nothing to pause. */
  .maps__pause {
    display: none !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Users who ask for more contrast get firmer text and borders. */
@media (prefers-contrast: more) {
  /* Doubled selector so it also outranks the dark-theme rules above. */
  :root:root {
    --text-faint: var(--text-muted);
    --border: var(--border-strong);
    --link-underline: currentColor;
  }
}

/* Windows high-contrast mode: keep selected states visible. */
@media (forced-colors: active) {
  .segmented input:checked + span,
  .sidenav a[aria-current],
  .chip--toggle[aria-expanded="true"],
  .chip[aria-pressed="true"],
  .js .paper:has(.paper__input:checked) {
    outline: 2px solid CanvasText;
    outline-offset: -2px;
  }

  .interests li,
  .visitor-map__empty {
    border-color: CanvasText;
  }

  .key::before {
    forced-color-adjust: none;
  }

  .paper__input:checked + .paper__pick .paper__dot {
    background: Highlight;
  }

  /* Keep land and cities apart instead of forcing both to one colour. */
  .visitor-map__svg {
    forced-color-adjust: none;
  }

  .visitor-map__land,
  .visitor-map__lines {
    stroke: GrayText;
  }

  .visitor-map__city {
    fill: Highlight;
  }
}

@media print {
  .topbar,
  .sidenav,
  .theme-switch,
  .maps__controls,
  .papers__legend,
  .paper__pick,
  .visitors,
  .to-top,
  .skip-link {
    display: none !important;
  }

  body {
    background: var(--bg);
    color: var(--text);
  }

  /* Every animation prints, one under the other. */
  .maps__frame {
    display: grid !important;
  }

  .page {
    display: block;
    border: 0;
    box-shadow: none;
  }

  .profile {
    position: static;
  }

  /* Content waiting to be revealed on scroll prints anyway. */
  [data-reveal],
  [data-reveal]::after {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Show link targets on paper. */
  main a[href^="http"]::after {
    content: " <" attr(href) ">";
    font-size: 0.85em;
    color: var(--text-muted);
  }
}
