/* ============ tokens ============ */
:root {
  --bg: #ffffff;
  --fg: #3d3d3d;
  --fg-strong: #1d1d1d;
  --muted: #8a8a8a;
  --accent: #0b3c63;
  --link: #1f6f9a;
  --rule: #e6e6e3;
  --tile: #f3f3f0;
  --figure-bg: #ffffff;
  /* Swap --serif for a different face to restyle the whole page.
     Friendly alternatives: "DM Sans", "Karla", "Nunito Sans", "Work Sans". */
  --serif: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --sans: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1c20;
    --fg: #c9cacd;
    --fg-strong: #ecedef;
    --muted: #8d8f95;
    --accent: #7fc2e8;
    --link: #6fb6df;
    --rule: #32343a;
    --tile: #26282e;
    --figure-bg: #f4f4f2;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1c20; --fg: #c9cacd; --fg-strong: #ecedef; --muted: #8d8f95;
  --accent: #7fc2e8; --link: #6fb6df; --rule: #32343a; --tile: #26282e; --figure-bg: #f4f4f2;
}

/* ============ base ============ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.62;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
}
p { margin: 0 0 1rem; }
em { font-style: italic; }
b, strong { color: var(--fg-strong); font-weight: 600; }
u { text-decoration-thickness: 1px; text-underline-offset: 2px; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h2 {
  font-family: var(--serif);
  color: var(--accent);
  font-size: 1.45rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.015em;
  margin: 0 0 .9rem;
}
h3 { font-family: var(--serif); color: var(--fg-strong); font-size: 1.12rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 .15rem; }
h3.sub { color: var(--accent); font-size: 1.1rem; margin: 2rem 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.note { color: var(--muted); font-size: .85rem; margin-top: -.5rem; }
.lede { color: var(--muted); margin-bottom: 1.5rem; }

/* ============ two-column shell ============ */
.wrapper { width: 960px; max-width: 100%; margin: 0 auto; padding: 0 20px; }
.profile {
  width: 232px; float: left; position: fixed;
  padding-top: 3.5rem; text-align: center;
}
.content {
  width: 650px; max-width: 100%; float: right;
  padding-top: 3.5rem; padding-bottom: 4rem;
}
.content section { margin-bottom: 2.75rem; }

/* ============ profile card ============ */
.avatar { width: 140px; height: 140px; border-radius: 50%; margin: 0 auto 1rem; object-fit: cover; }
.monogram {
  display: flex; align-items: center; justify-content: center;
  background: var(--tile); color: var(--accent);
  font-family: var(--serif); font-size: 2.5rem; font-weight: 600; letter-spacing: .01em;
}
.profile-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; letter-spacing: -0.015em; color: var(--fg-strong); margin: 0 0 .1rem; line-height: 1.25; }
.profile-role { margin: 0 0 .35rem; }
.profile-affil { font-size: .95rem; margin: 0 0 .6rem; line-height: 1.45; }
.profile-mail { font-family: var(--sans); font-size: .85rem; margin: 0 0 1rem; }
.profile-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem; font-family: var(--sans); font-size: .78rem; }
.profile-links a {
  border: 1px solid var(--rule); border-radius: 3px; padding: .12rem .42rem; color: var(--fg);
}
.profile-links a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* ============ news ============ */
.news { list-style: none; padding: 0; margin: 0; }
.news li { padding: .3rem 0; font-size: .97rem; }
.news li > b:first-child { font-family: var(--sans); font-size: .82rem; letter-spacing: .01em; color: var(--muted); font-weight: 600; margin-right: .2rem; }

/* ============ featured work ============ */
.feature { margin: 0 0 2rem; }
.feature figure {
  margin: 0 0 .9rem; background: var(--figure-bg);
  border: 1px solid var(--rule); border-radius: 4px; padding: .8rem;
}
.feature-sub { font-style: italic; color: var(--muted); margin-bottom: .5rem; }

/* ============ badges + buttons ============ */
.badge {
  font-family: var(--sans); font-size: .68rem; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; color: #fff; background: var(--accent);
  border-radius: 2px; padding: .18rem .4rem; vertical-align: middle; white-space: nowrap;
}
.links { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .5rem 0 0; }
.btn {
  font-family: var(--sans); font-size: .76rem; color: var(--fg);
  border: 1px solid var(--rule); border-radius: 3px; padding: .1rem .45rem;
}
.btn:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.oral { font-family: var(--sans); font-size: .76rem; font-style: italic; color: #c0502f; margin-left: .2rem; }
@media (prefers-color-scheme: dark) { .oral { color: #e38b6d; } }

/* ============ publications ============ */
.pubs { list-style: none; padding: 0; margin: 0; }
.pub { display: grid; grid-template-columns: 165px 1fr; gap: 1.1rem; margin-bottom: 1.6rem; align-items: start; }
.teaser { position: relative; background: var(--figure-bg); border: 1px solid var(--rule); border-radius: 4px; padding: .4rem; min-height: 86px; display: flex; align-items: center; justify-content: center; }
.teaser img { max-height: 84px; width: auto; object-fit: contain; }
.teaser .badge { position: absolute; top: -.45rem; left: -.3rem; }
.teaser-text { background: var(--tile); font-family: var(--serif); color: var(--muted); font-size: 1rem; text-align: center; line-height: 1.25; }
.pub-title { font-weight: 600; letter-spacing: -0.008em; color: var(--fg-strong); margin: 0 0 .15rem; line-height: 1.35; }
.pub-title a { color: inherit; }
.pub-title a:hover { color: var(--link); text-decoration: none; }
.pub-authors { font-size: .92rem; margin: 0 0 .1rem; }
.pub-venue { font-size: .92rem; color: var(--muted); margin: 0; }

/* ============ projects ============ */
.projects { list-style: none; padding: 0; margin: 0; }
.projects li { padding: .7rem 0; border-top: 1px solid var(--rule); }
.projects li:first-child { border-top: 0; padding-top: 0; }
.proj-title { font-weight: 600; color: var(--fg-strong); margin: 0 0 .1rem; }
.projects p:last-child { margin: 0; font-size: .95rem; color: var(--muted); }

/* ============ background ============ */
.bg-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.bg-list li { display: grid; grid-template-columns: 6.5rem 1fr; gap: .75rem; padding: .35rem 0; font-size: .97rem; }
.when { color: var(--muted); font-size: .88rem; font-family: var(--sans); padding-top: .15rem; }

.site-footer { border-top: 1px solid var(--rule); padding-top: 1rem; }
.site-footer p { margin: 0; }

/* ============ responsive ============ */
@media screen and (max-width: 960px) {
  .wrapper { width: auto; }
  .profile, .content { float: none; position: static; width: auto; }
  .profile { padding-top: 2.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
  .content { padding-top: 2rem; }
}
@media screen and (max-width: 560px) {
  body { font-size: 16px; }
  .pub { grid-template-columns: 1fr; gap: .6rem; }
  .teaser { max-width: 220px; }
  .bg-list li { grid-template-columns: 1fr; gap: 0; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }

/* ============ trajectory viewer ============ */
.tv {
  position: relative;
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(127,194,232,.10), transparent 62%),
    var(--tile);
  overflow: hidden;
  margin: 1.4rem 0 .6rem;
}
.tv:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.tv-stage { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 520px; }
.tv-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.tv-canvas:active { cursor: grabbing; }

.tv-hint {
  position: absolute; left: .75rem; top: .6rem;
  font-size: .72rem; color: var(--muted); pointer-events: none;
  letter-spacing: .01em;
}
.tv-fallback {
  padding: 2.5rem 1.2rem; text-align: center; color: var(--muted); font-size: .9rem;
  line-height: 1.7; max-width: 34rem; margin: 0 auto;
}
.tv-fallback code {
  font-size: .85em; padding: .1em .35em; border-radius: 3px;
  background: rgba(0, 0, 0, .05);
}

.tv-ui {
  border-top: 1px solid var(--rule);
  padding: .6rem .7rem .7rem;
  display: flex; flex-direction: column; gap: .5rem;
  background: var(--bg);
}
.tv-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.tv-transport { gap: .7rem; }

.tv-btn {
  font: inherit; font-size: .8rem; font-weight: 500;
  color: var(--fg-strong); background: var(--bg);
  border: 1px solid var(--rule); border-radius: 999px;
  padding: .22rem .72rem; cursor: pointer; line-height: 1.5;
  display: inline-flex; align-items: center; gap: .38rem;
}
.tv-btn:hover { border-color: var(--link); color: var(--link); }
.tv-ico-play {
  width: 0; height: 0; border-style: solid;
  border-width: 4.5px 0 4.5px 7.5px; border-color: transparent transparent transparent currentColor;
}
.tv-play.is-playing .tv-ico-play {
  width: 7px; height: 9px; border: none;
  border-left: 2.5px solid currentColor; border-right: 2.5px solid currentColor;
}
.tv-play { min-width: 5.5rem; justify-content: center; }

.tv-slider { flex: 1 1 10rem; min-width: 8rem; accent-color: var(--link); cursor: pointer; }
.tv-step {
  font-size: .74rem; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tv-toggles { font-size: .78rem; color: var(--fg); gap: .85rem; }
.tv-toggles label { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
.tv-toggles input[type="checkbox"] { accent-color: var(--link); margin: 0; }
.tv-speed {
  font: inherit; font-size: .76rem; color: var(--fg);
  background: var(--bg); border: 1px solid var(--rule); border-radius: 4px;
  padding: .1rem .25rem;
}

.tv-legend {
  list-style: none; margin: .9rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .35rem .95rem;
  font-size: .78rem; color: var(--fg);
}
.tv-legend li { display: inline-flex; align-items: center; gap: .36rem; }
.tv-legend .sw {
  width: .68rem; height: .68rem; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); flex: none;
}
.tv-legend .sw-grad {
  width: 2.6rem; height: .5rem; border-radius: 999px;
  background: linear-gradient(90deg, #d62b24, #e0e0dc, #1c61d9);
}

/* post pages */
.post-meta { color: var(--muted); font-size: .84rem; margin: -.35rem 0 1.1rem; }
.post-back { font-size: .82rem; }
.caption { font-size: .8rem; color: var(--muted); margin: .35rem 0 1.4rem; }

@media (max-width: 560px) {
  .tv-stage { aspect-ratio: 1 / 1; }
  .tv-toggles { gap: .55rem .75rem; font-size: .74rem; }
}

/* trajectory picker */
.tv-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.5rem 0 .55rem; }
.tv-tab {
  font: inherit; font-size: .78rem; font-weight: 500;
  color: var(--fg); background: var(--bg);
  border: 1px solid var(--rule); border-radius: 999px;
  padding: .2rem .72rem; cursor: pointer; line-height: 1.55;
}
.tv-tab:hover { border-color: var(--link); color: var(--link); }
.tv-tab[aria-current="true"] {
  background: var(--fg-strong); border-color: var(--fg-strong); color: var(--bg);
}
.tv-note { font-size: .82rem; color: var(--muted); margin: 0 0 .1rem; min-height: 1.3em; }
.tv-tabs + .tv-note + .tv { margin-top: .9rem; }
.btn-lead { border-color: var(--link); color: var(--link); font-weight: 500; }

/* ============ ligand evolution viewer ============
   A six-stage timeline where two of the stages are animations.  Those two
   carry a slider that lives as a thumbnail progress bar while the stage is
   closed and widens into a usable control when it opens, so the whole story
   stays on one line and the stage you are actually in gets the room. */
.evo-ui {
  border-top: 1px solid var(--rule);
  padding: .65rem .7rem .7rem;
  display: flex; flex-direction: column; gap: .55rem;
  background: var(--bg);
}
.evo-timeline {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem;
}
.evo-stage {
  /* flex: none so a tight row wraps the next chip away instead of squeezing
     this one; max-width keeps that from pushing the page wider than the
     screen, and the track inside absorbs the squeeze when it has to */
  display: flex; align-items: center; flex: none; max-width: 100%;
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--bg);
  transition: border-color .2s, background .2s;
}
.evo-stage:hover { border-color: var(--link); }
.evo-stage.is-active { border-color: var(--fg-strong); background: var(--fg-strong); }

.evo-chip {
  font: inherit; font-size: .76rem; font-weight: 500;
  color: var(--fg); background: none; border: 0; border-radius: 999px;
  padding: .24rem .62rem; cursor: pointer; line-height: 1.5;
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
}
.evo-stage.is-active .evo-chip { color: var(--bg); }
.evo-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.15rem; height: 1.15rem; border-radius: 50%; flex: none;
  font-size: .66rem; font-weight: 600;
  background: var(--tile); color: var(--fg-strong);
}
.evo-stage.is-active .evo-num { background: var(--bg); color: var(--fg-strong); }

/* the transport that grows out of an animation stage */
.evo-track {
  position: relative; display: flex; align-items: center; gap: .4rem;
  /* shrinkable, with min-width 0: when the row is tight the slider gives up
     space instead of the track clipping the frame counter off its right end */
  width: 2.7rem; flex: 0 1 auto; min-width: 0; overflow: hidden;
  padding-right: .35rem;
  transition: width .42s cubic-bezier(.4, 0, .2, 1);
}
.evo-stage.is-active .evo-track { width: min(21rem, 52vw); }
.evo-mini {
  position: absolute; left: .1rem; right: .45rem; top: 50%;
  height: 4px; margin-top: -2px; border-radius: 999px;
  background: var(--rule); transition: opacity .2s;
}
.evo-mini i {
  display: block; height: 100%; width: var(--p, 0%);
  border-radius: 999px; background: var(--link);
}
.evo-stage.is-active .evo-mini { opacity: 0; }

.evo-play, .evo-slider, .evo-step {
  opacity: 0; pointer-events: none; transition: opacity .22s .1s;
}
.evo-stage.is-active .evo-play,
.evo-stage.is-active .evo-slider,
.evo-stage.is-active .evo-step { opacity: 1; pointer-events: auto; }

.evo-play {
  flex: none; width: 1.5rem; height: 1.5rem; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--bg); color: var(--fg-strong);
}
.evo-ico {
  width: 0; height: 0; border-style: solid; margin-left: 2px;
  border-width: 4.5px 0 4.5px 7.5px;
  border-color: transparent transparent transparent currentColor;
}
.evo-stage.is-playing .evo-ico {
  width: 7px; height: 9px; border: none; margin-left: 0;
  border-left: 2.5px solid currentColor; border-right: 2.5px solid currentColor;
}
.evo-slider {
  flex: 1 1 4rem; min-width: 2rem; margin: 0;
  /* the track itself stays thin; the taller element is there to be grabbed */
  height: 1.5rem; accent-color: var(--link); cursor: pointer;
}
.evo-stage.is-active .evo-slider { accent-color: var(--bg); }
.evo-step {
  flex: none; font-size: .7rem; color: var(--muted); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.evo-stage.is-active .evo-step { color: var(--bg); opacity: .85; }

.evo-note {
  font-size: .8rem; color: var(--muted); margin: 0;
  line-height: 1.6; min-height: 2.6em;
}
.evo-controls {
  display: flex; align-items: center; flex-wrap: wrap; gap: .85rem;
  font-size: .78rem; color: var(--fg);
  border-top: 1px solid var(--rule); padding-top: .55rem;
}
.evo-controls label { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
.evo-controls input[type="checkbox"] { accent-color: var(--link); margin: 0; }
/* a control with nothing to act on, on this stage: still there, visibly inert */
.evo-controls label.is-off { color: var(--muted); cursor: default; opacity: .55; }
.evo-speed {
  font: inherit; font-size: .76rem; color: var(--fg);
  background: var(--bg); border: 1px solid var(--rule); border-radius: 4px;
  padding: .1rem .25rem;
}
.evo-btn {
  font: inherit; font-size: .78rem; font-weight: 500;
  color: var(--fg-strong); background: var(--bg);
  border: 1px solid var(--rule); border-radius: 999px;
  padding: .18rem .7rem; cursor: pointer; line-height: 1.5;
}
.evo-btn:hover { border-color: var(--link); color: var(--link); }

@media (max-width: 640px) {
  /* names would wrap the timeline onto four lines; the open stage keeps its
     label and the rest fall back to their numbers */
  .evo-stage:not(.is-active) .evo-name { display: none; }
  .evo-chip { padding: .24rem .4rem; }
  .evo-stage.is-active .evo-track { width: min(16rem, 58vw); }
  .evo-controls { gap: .55rem .75rem; font-size: .74rem; }
}

.stage-list { padding-left: 1.2rem; margin: .9rem 0 1.4rem; }
.stage-list li { margin: 0 0 .55rem; line-height: 1.72; }

/* ============ "Interactive demo" call-to-action ============
   Filled in the link colour with a play glyph, so it reads as the thing to
   click among the plain outlined Paper / Code / Weights buttons. */
.btn-demo {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--link); border-color: var(--link); color: var(--bg);
  font-weight: 600; padding: .18rem .6rem .18rem .5rem; border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-demo::before {
  content: ""; width: 0; height: 0; border-style: solid;
  border-width: .3rem 0 .3rem .48rem;
  border-color: transparent transparent transparent currentColor;
}
.btn-demo:hover {
  background: var(--accent); border-color: var(--accent); color: var(--bg);
  transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0, 0, 0, .18);
}
.btn-demo:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .btn-demo, .btn-demo:hover { transition: none; transform: none; } }

/* A new section heading straight after a viewer (or its legend) needs room,
   so the next topic doesn't read as a caption for the pane above it. */
.tv + h3, .tv-legend + h3 { margin-top: 2.6rem; }

/* ============ sidebar demo quick links ============ */
.profile-demos { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-family: var(--sans); }
.profile-demos-title { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 .5rem; }
.profile-demos ul { list-style: none; padding: 0; margin: 0; }
.profile-demos li { margin: 0 0 .35rem; font-size: .85rem; line-height: 1.35; }
.profile-demos a[aria-current="page"] { color: var(--accent); font-weight: 600; }
@media screen and (max-width: 960px) {
  .profile-demos { max-width: 320px; margin-left: auto; margin-right: auto; }
}
