:root {
  --bg: #f2f4f8;
  --surface: #ffffff;
  --ink: #161b2b;
  --muted: #5b6478;
  --line: #dde2ec;
  --accent: #0b8a8f;
  --real: #15a34a;        /* detector box: "real" */
  --on-real: #ffffff;
  --teal: #0b8a8f;
  --teal-soft: #dff3f3;
  --shadow: 0 1px 2px rgba(22, 27, 43, .06), 0 8px 24px -12px rgba(22, 27, 43, .18);
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1320;
    --surface: #181d2d;
    --ink: #e9ecf4;
    --muted: #9aa3b8;
    --line: #2a3145;
    --accent: #3cc4c8;
    --real: #3ccf6e;
    --on-real: #0f1320;
    --teal: #3cc4c8;
    --teal-soft: #12302f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--body);
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
img { max-width: 100%; display: block; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 56px;
  align-items: center;
  padding: 88px 0 72px;
}
.hero h1 {
  font: 700 clamp(2.75rem, 7vw, 4.5rem)/1 var(--display);
  letter-spacing: -0.03em;
  margin: 0 0 20px;
}
.hero .lede {
  font-size: 1.125rem;
  color: var(--muted);
  max-width: 34em;
  margin: 0 0 14px;
}
.hero .lede a { font-weight: 500; }

.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.links a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: .9rem; font-weight: 500;
}
.links a:hover { border-color: var(--accent); text-decoration: none; }
.links i { font-size: 1.05rem; color: var(--muted); }

/* Portrait with a face-detector box around the face */
.detect { position: relative; }
.detect img {
  aspect-ratio: 1; object-fit: cover; width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}
.detect .box {
  position: absolute;
  left: 26%; right: 26%; top: 20%; bottom: 23%;
}
.box::before, .box::after, .box .c1, .box .c2 {
  content: ""; position: absolute; width: 22px; height: 22px;
  border: 3px solid var(--real);
}
.box::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.box::after  { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.box .c1 { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.box .c2 { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.box .tag {
  position: absolute; left: 0; bottom: 100%; margin-bottom: 4px;
  background: var(--real); color: var(--on-real);
  font: 600 .75rem/1 var(--body);
  padding: 5px 8px; border-radius: 3px;
  white-space: nowrap;
}

/* ---------- Sections ---------- */
section { padding: 24px 0 56px; }
h2 {
  font: 700 1.75rem/1.2 var(--display);
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}

.news {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.news li {
  display: grid; grid-template-columns: 96px 1fr; gap: 16px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}
.news li:first-child { border-top: 0; }
.news time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; padding-top: 1px; }

/* ---------- Publications ---------- */
.pubs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.pub {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.thumb {
  aspect-ratio: 16 / 8;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }

/* Text-only thumbnail for papers without a figure */
.thumb.type {
  background: var(--teal-soft);
  justify-content: flex-start; align-items: flex-end;
  padding: 22px;
}
.thumb.type span {
  font: 700 clamp(1.6rem, 3.4vw, 2.4rem)/1.05 var(--display);
  letter-spacing: -0.02em;
  color: var(--teal);
}

.pub-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.venue {
  align-self: flex-start;
  font-size: .8rem; font-weight: 600;
  color: var(--teal);
  background: var(--teal-soft);
  padding: 3px 10px; border-radius: 999px;
  margin-bottom: 12px;
}
.pub h3 {
  font: 600 1.2rem/1.3 var(--display);
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.authors { color: var(--muted); font-size: .92rem; margin: 0 0 16px; }
.authors b { color: var(--ink); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.chips a {
  font-size: .85rem; font-weight: 500;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}
.chips a:hover { border-color: var(--teal); color: var(--teal); text-decoration: none; }

footer { color: var(--muted); font-size: .85rem; padding: 0 0 48px; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 48px; padding: 72px 0 48px; }
  .hero .portrait { order: -1; max-width: 220px; }
  .pubs { grid-template-columns: 1fr; }
    }
@media (max-width: 480px) {
  .news li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- Work ---------- */
.work { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.role {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.role-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-bottom: 10px; }
.role h3 { font: 600 1.2rem/1.3 var(--display); margin: 0; }
.role time, .timeline time { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.role p { margin: 0 0 16px; max-width: 62ch; }
.stack { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.stack li {
  font-size: .8rem; font-weight: 500;
  padding: 3px 10px; border-radius: 999px;
  background: var(--teal-soft); color: var(--teal);
}
.timeline { list-style: none; margin: 0; padding: 4px 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 18px; display: flex; flex-direction: column; }
.timeline li::before {
  content: ""; position: absolute; left: -26px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--muted);
}
.timeline li:last-child { padding-bottom: 0; }
@media (max-width: 820px) { .work { grid-template-columns: 1fr; } }

/* ---------- Compact publications ---------- */
.roles { display: grid; gap: 20px; }
.pubs { grid-template-columns: repeat(3, 1fr); gap: 20px; }
.thumb { aspect-ratio: 16 / 9; }
.thumb img { padding: 8px; }
.pub-body { padding: 16px 18px 18px; }
.pub h3 { font-size: 1rem; }
.venue { margin-bottom: 10px; }
.authors { font-size: .85rem; margin-bottom: 10px; }
.summary { font-size: .88rem; margin: 0 0 14px; }
.chips a { font-size: .8rem; padding: 4px 10px; }
.more-title { font: 600 1.05rem/1.3 var(--display); margin: 36px 0 10px; }
.more { list-style: none; margin: 0; padding: 0; }
.more li { padding: 8px 0; border-top: 1px solid var(--line); font-size: .95rem; }
.more li:first-child { border-top: 0; }
.more span { color: var(--muted); font-size: .85rem; white-space: nowrap; margin-left: 6px; }
.all { margin: 16px 0 0; font-size: .95rem; font-weight: 500; }
@media (max-width: 900px) { .pubs { grid-template-columns: 1fr; } }
.role:not(.current) { border-left-color: var(--muted); box-shadow: none; }

/* Work: single column, earlier roles listed under the PhD card */
.work { grid-template-columns: 1fr; }
.earlier { list-style: none; margin: 8px 0 0; padding: 0; }
.earlier > li {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 6px 20px;
  align-items: center;
  padding: 14px 4px;
  border-top: 1px solid var(--line);
}
.earlier > li:first-child { border-top: 0; }
.earlier time { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.earlier .what { font-weight: 500; }
.earlier .stack { justify-content: flex-end; }
@media (max-width: 760px) {
  .earlier > li { grid-template-columns: 1fr; }
  .earlier .stack { justify-content: flex-start; }
}

/* Work: roles left, tools panel right */
.work { grid-template-columns: minmax(0, 1fr) 280px; }
.tools {
  position: sticky; top: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 20px 8px;
}
.tools h3 { font: 600 1.05rem/1.3 var(--display); margin: 0 0 14px; }
.tools dl { margin: 0; }
.tools dt { font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.tools dd { margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.tools dd span {
  font-size: .8rem; font-weight: 500;
  padding: 3px 10px; border-radius: 999px;
  background: var(--teal-soft); color: var(--teal);
}
.earlier > li { grid-template-columns: 110px minmax(0, 1fr); }
@media (max-width: 820px) {
  .work { grid-template-columns: 1fr; }
  .tools { position: static; }
}
.tools dt { font-size: .9rem; color: var(--ink); margin: 0 0 2px; }
.tools dd.why { display: block; font-size: .8rem; color: var(--muted); margin: 0 0 8px; }
.tools dd + dt { padding-top: 14px; border-top: 1px solid var(--line); }
.tools dd:not(.why) { margin-bottom: 14px; }
.earlier .where { color: var(--muted); font-weight: 400; margin-left: 8px; }
