:root {
  --bg: #ffffff;
  --sidebar: #f7f8fa;
  --surface: #ffffff;
  --subtle: #f6f7f9;
  --text: #1f2328;
  --muted: #5d636b;
  --faint: #8a9099;
  --line: #e6e8eb;
  --accent: #1a5fb4;
  --accent-soft: #eaf1fb;
  --media-dark: #0c0d0f;
  --card-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .07);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidebar-w: 284px;
  --content-w: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --sidebar: #16191c;
    --surface: #181b1f;
    --subtle: #181b1f;
    --text: #e6e6e3;
    --muted: #9ba1a8;
    --faint: #737a82;
    --line: #262a2f;
    --accent: #8ab8f0;
    --accent-soft: #1d2836;
    --card-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, p { margin: 0; }
img { display: block; max-width: 100%; }

.skip-link { position: absolute; left: -999px; top: 8px; padding: 8px 12px; background: var(--surface); z-index: 20; }
.skip-link:focus { left: 8px; }

/* ---------- Layout ---------- */
.layout { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--sidebar); border-right: 1px solid var(--line);
  overflow-y: auto;
}
.sidebar-inner { display: flex; flex-direction: column; min-height: 100%; padding: 48px 28px 28px; }
.content { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
/* The text column is centred in the whole window (not just next to the sidebar),
   as long as there is room for that; otherwise it starts right after the sidebar. */
.main, .site-footer {
  width: 100%; max-width: var(--content-w);
  margin-left: max(0px, calc((100vw - var(--content-w)) / 2 - var(--sidebar-w)));
}
.main { flex: 1; padding: 56px 64px 32px; }

/* ---------- Sidebar ---------- */
.identity { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; color: var(--text); }
.identity:hover { text-decoration: none; }
.avatar {
  width: 148px; height: 148px; border-radius: 50%;
  object-fit: cover; object-position: 50% 30%;
  border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line);
}
.identity-text { display: flex; flex-direction: column; gap: 2px; }
.name { font-size: 20px; font-weight: 700; letter-spacing: -.015em; line-height: 1.25; }
.role { color: var(--muted); font-size: 14.5px; }
.affiliations { display: flex; flex-direction: column; margin-top: 8px; font-size: 13.5px; line-height: 1.6; }
.affiliations a { white-space: nowrap; }

.site-nav { display: flex; flex-direction: column; gap: 2px; margin: 32px -10px 0; }
.site-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--muted); font-size: 14.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.site-nav a:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); text-decoration: none; }
.site-nav a[aria-current] { background: var(--accent-soft); color: var(--accent); }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-fill { width: 18px; height: 18px; flex: none; fill: currentColor; }
.icon-emoji { font-size: 17px; line-height: 1; width: 18px; text-align: center; }

.profiles { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.profiles a {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 36px; height: 36px; border-radius: 8px;
  color: var(--muted); transition: background .15s, color .15s;
}
.profiles a:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--accent); text-decoration: none; }
.sidebar-profiles { margin: auto -8px 0; padding-top: 32px; }

/* ---------- Footer ---------- */
.site-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 64px 28px; color: var(--faint); font-size: 13.5px;
}
.footer-profiles { display: none; }

/* ---------- Page elements ---------- */
.page-title { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-bottom: 32px; }
.page-note { color: var(--muted); font-size: 14.5px; margin-bottom: 32px; }
.page-title + .page-note { margin-top: -22px; }

.bio { font-size: 16.5px; line-height: 1.7; }
.bio p + p { margin-top: 12px; }
.bio strong { font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 0; padding: 0; list-style: none; }
.tags li {
  padding: 3px 9px; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 500;
}

.section { margin-top: 52px; }
.section h2 { font-size: 21px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 16px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { margin-bottom: 0; }
.more { font-size: 14px; font-weight: 500; white-space: nowrap; }

/* Dated lists (news, awards) */
.dated { margin: 0; padding: 0; list-style: none; }
.dated li {
  display: grid; grid-template-columns: 64px 1fr; gap: 16px; align-items: baseline;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.dated li:first-child { padding-top: 2px; }
.dated li:last-child { border-bottom: 0; }
.dated-wide li { grid-template-columns: 76px 1fr; }
.date { color: var(--faint); font-size: 13.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.dated p { margin: 0; }

/* Pills */
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 500; line-height: 1.6;
}
.pill:hover { text-decoration: none; background: var(--accent); color: var(--bg); }

/* ---------- Publications ---------- */
.pub {
  display: grid; grid-template-columns: 1fr 232px; gap: 22px;
  padding: 18px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface);
  transition: box-shadow .2s, border-color .2s;
}
.pub:hover { box-shadow: var(--card-shadow); border-color: transparent; }
.pub-list { display: grid; gap: 14px; }
.pub-media {
  order: 2; align-self: start;
  aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden;
  background: var(--media-dark);
}
.pub-media.is-light { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.pub-media img { width: 100%; height: 100%; object-fit: contain; }
.pub-body { display: flex; flex-direction: column; min-width: 0; padding: 2px 0 0 4px; }
.pub h3 { font-size: 16.5px; font-weight: 600; line-height: 1.4; letter-spacing: -.005em; }
.pub h3 a { color: var(--text); }
.pub h3 a:hover { color: var(--accent); }
.authors { margin: 6px 0 14px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.authors b { color: var(--text); font-weight: 600; }
.summary { margin: -4px 0 16px; font-size: 14.5px; line-height: 1.55; }
.pub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; }
.venue { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.venue-note {
  padding: 0 7px; border-radius: 5px; line-height: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent); font-size: 12px; font-weight: 600;
}
.pub-meta .links { margin-left: auto; }

/* Highlighted publications: media on top */
.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.pub-feature { grid-template-columns: 1fr; padding: 20px 22px; }
.pub-feature .pub-body { padding: 0; }

/* ---------- Open source ---------- */
.project-list { display: grid; gap: 16px; }
.project {
  display: grid; grid-template-columns: 1fr; gap: 24px;
  padding: 22px 24px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface);
}
.project h3 { font-size: 19px; font-weight: 600; letter-spacing: -.01em; line-height: 1.35; }
.project-desc { margin: 10px 0 10px; font-size: 15px; line-height: 1.6; }
.other-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.other {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 18px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .2s;
}
.other:hover { text-decoration: none; border-color: transparent; box-shadow: var(--card-shadow); }
.other-name { font-weight: 600; font-size: 15.5px; }
.other:hover .other-name { color: var(--accent); }
.other-desc { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ---------- Smaller screens ---------- */
@media (max-width: 1100px) {
  .main { padding: 48px 40px 28px; }
  .site-footer { padding: 20px 40px 28px; }
  .pub { grid-template-columns: 1fr 200px; }
}

@media (max-width: 900px) {
  .sidebar { position: static; width: auto; height: auto; border-right: 0; border-bottom: 1px solid var(--line); background: var(--sidebar); overflow: visible; }
  .sidebar-inner { min-height: 0; padding: 18px 20px 0; }
  .identity { flex-direction: row; align-items: center; gap: 14px; }
  .avatar { width: 64px; height: 64px; border-width: 2px; }
  .name { font-size: 18px; }
  .affiliations { flex-direction: row; flex-wrap: wrap; column-gap: 14px; margin-top: 10px; font-size: 13.5px; }
  .site-nav { flex-direction: row; flex-wrap: wrap; gap: 0; margin: 12px -5px 0; justify-content: space-between; }
  .site-nav a { padding: 8px 5px 9px; border-radius: 0; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 13.5px; }
  .site-nav a .icon { display: none; }
  .site-nav a[aria-current] { background: none; border-bottom-color: var(--accent); }
  .sidebar-profiles { display: none; }
  .content { margin-left: 0; min-height: 0; }
  .main, .site-footer { max-width: none; margin-left: 0; }
  .main { max-width: none; padding: 32px 20px 24px; }
  .site-footer { max-width: none; padding: 16px 20px 24px; flex-direction: column; align-items: flex-start; }
  .footer-profiles { display: flex; margin-left: -8px; }
}

@media (max-width: 640px) {
  .page-title { font-size: 26px; margin-bottom: 26px; }
  .page-note { margin-bottom: 26px; }
  .page-title + .page-note { margin-top: -16px; }
  .bio { font-size: 16px; }
  .feature-grid, .other-grid { grid-template-columns: 1fr; }
  .project { padding: 16px; }
  .pub { grid-template-columns: 1fr; gap: 14px; padding: 12px 12px 16px; }
  .pub-media { order: 0; }
  .pub-body { padding: 0 4px; }
  .pub-meta .links { margin-left: 0; flex-basis: 100%; margin-top: 4px; }
  .dated li, .dated-wide li { grid-template-columns: 1fr; gap: 0; }
  .section-head { flex-wrap: wrap; }
}

@media (max-width: 400px) {
  .sidebar-inner { padding: 16px 16px 0; }
  .main { padding: 28px 16px 20px; }
  .site-footer { padding: 16px 16px 24px; }
  .site-nav { margin: 12px 0 0; }
  .site-nav a { padding: 8px 0 9px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pub, .site-nav a, .profiles a { transition: none; }
}

/* Photo at the top of the awards page */
.award-photo { margin: 0 0 40px; max-width: 720px; }
.award-photo img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); }
.section-first { margin-top: 0; }
