/* Colours: black & grey, with a matching dark theme. */
:root {
  --bg: #f1f1f0;
  --text: #1c1c1c;
  --body-2: #4a4a4a;
  --muted: #7a7a7a;
  --heading: #0a0a0a;
  --link: #1c1c1c;
  --link-hover: #000000;
  --line: #e7e7e5;
  --card: #ffffff;
  --card-hover: #f7f7f6;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px -12px rgba(0, 0, 0, .10);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .05), 0 18px 40px rgba(0, 0, 0, .10);
  --pill: #f1f1f1;
  --code-bg: #f5f5f5;
  --icon: #3a3a3a;
  --icon-hover: #000000;
  --ucl-main: #361a54;
}
:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --text: #e6e6e6;
  --body-2: #b5b5b5;
  --muted: #8a8a8a;
  --heading: #ffffff;
  --link: #e6e6e6;
  --link-hover: #ffffff;
  --line: #252525;
  --card: #141414;
  --card-hover: #1a1a1a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px -12px rgba(0, 0, 0, .7);
  --shadow-hover: 0 18px 40px rgba(0, 0, 0, .55);
  --pill: #222222;
  --code-bg: #121212;
  --icon: #c8c8c8;
  --icon-hover: #ffffff;
  --ucl-main: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --text: #e6e6e6;
    --body-2: #b5b5b5;
    --muted: #8a8a8a;
    --heading: #ffffff;
    --link: #e6e6e6;
    --link-hover: #ffffff;
    --line: #252525;
    --card: #141414;
    --card-hover: #1a1a1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px -12px rgba(0, 0, 0, .7);
    --shadow-hover: 0 18px 40px rgba(0, 0, 0, .55);
    --pill: #222222;
    --code-bg: #121212;
    --icon: #c8c8c8;
    --icon-hover: #ffffff;
    --ucl-main: #ffffff;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  transition: background-color .3s, color .3s;
  font: 16px/1.65 "Inter", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); font-weight: 600; text-decoration: none; text-underline-offset: 3px; }
a:hover, a:focus-visible { color: var(--link-hover); text-decoration: underline; }
img { max-width: 100%; display: block; }
strong { font-weight: 600; color: var(--heading); }
.muted { color: var(--muted); }
::selection { background: var(--heading); color: var(--bg); }

/* Two-column page: sticky profile on the left, content on the right */
.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 48px 32px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

/* Sidebar */
/* Panels: each content section sits on a flat white surface */
.content > section {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .025);
}
.sidebar { position: sticky; top: 48px; text-align: center; padding: 36px 0 0; }
.avatar-wrap {
  width: 184px; height: 184px; margin: 0 auto 22px; padding: 5px;
  border-radius: 50%; border: 1px solid var(--line); position: relative;
}
.avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 50%; }
.name {
  font-family: "EB Garamond", Georgia, serif; font-weight: 500;
  font-size: 40px; line-height: 1.1; letter-spacing: 0;
  margin: 0 0 10px; color: var(--heading);
}
.role { color: var(--muted); font-size: 14px; margin: 0 0 18px; line-height: 1.5; }
.affil-logos { display: flex; justify-content: center; align-items: center; gap: 20px; margin: 0 0 20px; }
.affil-logos a { display: inline-flex; transition: transform .2s; }
.affil-logos a:hover { transform: translateY(-2px); text-decoration: none; }
.affil-logos .logo-ucl svg { height: 26px; width: auto; display: block; }
.affil-logos .logo-ucl .ucl-main { fill: var(--ucl-main); }
.affil-logos .logo-ucl .ucl-accent { fill: #9a3bff; fill-opacity: 1; }
.affil-logos .logo-stl img { height: 38px; width: auto; }

.contact { margin: 0 0 26px; display: flex; justify-content: center; gap: 10px; }
.contact a {
  color: var(--icon); display: inline-flex; padding: 8px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  transition: color .2s, transform .2s, border-color .2s, background .2s;
}
.contact a:hover, .contact a:focus-visible {
  color: var(--bg); background: var(--heading); border-color: var(--heading);
  transform: translateY(-2px); text-decoration: none;
}
.contact svg { width: 18px; height: 18px; }

.toc {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding-top: 20px; border-top: 1px solid var(--line);
}
.toc a {
  font-size: 13px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); padding: 4px 0; position: relative;
  transition: color .2s;
}
.toc a::before {
  content: ""; position: absolute; left: -18px; top: 50%; width: 6px; height: 6px;
  border-radius: 50%; background: var(--heading); transform: translateY(-50%) scale(0);
  transition: transform .25s;
}
.toc a:hover { color: var(--heading); text-decoration: none; }
.toc a.active { color: var(--heading); }
.toc a.active::before { transform: translateY(-50%) scale(1); }

/* Light/dark toggle, fixed top-right */
.theme-toggle {
  position: fixed; top: 18px; right: 18px; z-index: 10;
  width: 40px; height: 40px; padding: 10px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--icon); cursor: pointer;
  box-shadow: var(--shadow); transition: transform .3s, color .2s;
}
.theme-toggle:hover { color: var(--icon-hover); transform: rotate(-20deg); }
.theme-toggle svg { width: 100%; height: 100%; display: block; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* Content */
.content { min-width: 0; }
section { margin-bottom: 28px; padding: 34px 40px 36px; scroll-margin-top: 28px; }
h2 {
  font-family: "EB Garamond", Georgia, serif; font-weight: 500;
  font-size: 32px; line-height: 1.15; letter-spacing: 0;
  margin: 0 0 20px; color: var(--heading);
  display: flex; align-items: baseline; gap: 14px;
}
h2::after { content: ""; flex: 1; height: 1px; background: var(--line); transform: translateY(-9px); }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 6px; color: var(--heading); }

.about p, #bio > p, .timeline li { font-size: 16px; line-height: 1.7; color: var(--body-2); }
.about p { margin: 0; }
#bio > p { margin: 0 0 16px; }
#bio > p:last-child { margin-bottom: 0; }

/* News timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 96px; top: 8px; bottom: 8px; width: 1px; background: var(--line);
}
.timeline li { display: grid; grid-template-columns: 96px 1fr; gap: 28px; padding: 7px 0; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: 92px; top: 15px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--card); border: 1.5px solid var(--muted); transition: background .2s, border-color .2s;
}
.timeline li:first-child::before { background: var(--heading); border-color: var(--heading); }
.timeline li:hover::before { background: var(--heading); border-color: var(--heading); }
.timeline .date {
  font-size: 12px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); padding-top: 3px; text-align: right; padding-right: 8px;
}

/* Publications: cards */
.pub-intro { margin: 0 0 4px; font-size: 14px; }
.pub {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  padding: 20px;
  margin: 0 -20px;
  border-radius: 12px;
  position: relative;
  transition: background .25s;
}
.pub + .pub::before {
  content: ""; position: absolute; top: 0; left: 20px; right: 20px; height: 1px; background: var(--line);
}
.pub:hover { background: var(--card-hover); }
.pub:hover::before, .pub:hover + .pub::before { opacity: 0; }
.pub.no-thumb { grid-template-columns: minmax(0, 1fr); }
.thumb { overflow: hidden; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.thumb img { width: 100%; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.pub:hover .thumb img { transform: scale(1.04); }
.pub-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.venue-tag {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px; background: var(--heading); color: var(--bg);
}
.year { font-size: 12px; letter-spacing: .1em; color: var(--muted); font-weight: 500; }
.papertitle {
  display: block; font-size: 17px; line-height: 1.4; font-weight: 600; color: var(--heading);
  margin-bottom: 6px;
}
.authors { font-size: 14px; color: var(--muted); }
.authors strong { color: var(--heading); }
.pub-body p { margin: 10px 0 0; color: var(--body-2); font-size: 15px; }
.pub-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.pub-links a {
  font-size: 12px; font-weight: 500; letter-spacing: .04em;
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--pill);
  color: var(--text); transition: background .2s, color .2s, border-color .2s;
}
.pub-links a:hover { background: var(--heading); color: var(--bg); border-color: var(--heading); text-decoration: none; }
.pub-body pre {
  margin: 12px 0 0; padding: 14px; font-size: 12px; line-height: 1.5;
  background: var(--code-bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto;
}

footer {
  padding: 4px 8px 0;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

/* Reveal on scroll (only when JS is running) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .thumb img { transition: none; }
}

/* Tablet: narrower sidebar */
@media (max-width: 1080px) {
  .page { grid-template-columns: 240px minmax(0, 1fr); gap: 22px; padding: 32px 20px; }
  .avatar-wrap { width: 156px; height: 156px; }
  section { padding: 28px 28px 30px; }
  .name { font-size: 36px; }
  .pub { grid-template-columns: 180px minmax(0, 1fr); gap: 20px; }
}

/* Phone: single column */
@media (max-width: 760px) {
  .page { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
  .sidebar { position: static; }
  .avatar-wrap { width: 140px; height: 140px; }
  section { padding: 24px 18px 26px; margin-bottom: 16px; }
  .toc { flex-direction: row; justify-content: center; gap: 22px; }
  .toc a::before { display: none; }
  h2 { font-size: 28px; }
  .pub { grid-template-columns: 1fr; gap: 14px; padding: 16px 12px; margin: 0 -12px; }
  .pub + .pub::before { left: 12px; right: 12px; }
  .timeline::before { left: 72px; }
  .timeline li { grid-template-columns: 72px 1fr; gap: 22px; }
  .timeline li::before { left: 68px; }
}
