:root {
  --bg: #fbfbfa;
  --fg: #111113;
  --muted: #6b6b70;
  --faint: #9a9aa0;
  --line: #e7e7e4;
  --card: #ffffff;
  --chip: #f1f1ee;
  --accent: #d6336c;          /* crimson, echoes the CV's highlight colour */
  --accent-soft: rgba(214, 51, 108, 0.08);
  --display: "Bricolage Grotesque", "Figtree", sans-serif;
  --name: "Funnel Display", "Bricolage Grotesque", sans-serif;
  --sans: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --w: 760px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d0f; --fg: #ededee; --muted: #9a9aa2; --faint: #6c6c74;
    --line: #232328; --card: #151518; --chip: #1c1c20;
    --accent: #f06595; --accent-soft: rgba(240, 101, 149, 0.1);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0d0f; --fg: #ededee; --muted: #9a9aa2; --faint: #6c6c74;
  --line: #232328; --card: #151518; --chip: #1c1c20;
  --accent: #f06595; --accent-soft: rgba(240, 101, 149, 0.1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; transition: text-decoration-color .15s, color .15s; }
a:hover { text-decoration-color: var(--accent); color: var(--accent); }
::selection { background: var(--accent); color: #fff; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner { max-width: var(--w); margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; }
.nav-name { font-weight: 600; text-decoration: none; letter-spacing: -0.01em; opacity: 0; transition: opacity .25s; }
.nav.scrolled .nav-name { opacity: 1; }
.nav nav { display: flex; align-items: center; gap: 22px; font-size: 13.5px; }
.nav nav a { text-decoration: none; color: var(--muted); }
.nav nav a:hover, .nav nav a.active { color: var(--fg); }
.theme-btn { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.theme-btn:hover { color: var(--fg); border-color: var(--faint); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

main { max-width: var(--w); margin: 0 auto; padding: 0 24px; }
section { padding: 56px 0; border-top: 1px solid var(--line); }
section.hero { border-top: 0; padding: 56px 0 64px; }

/* Hero */
.avatar { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; display: block; margin-bottom: 28px; }
h1 { font: 600 clamp(40px, 6vw, 56px)/1.05 var(--name); letter-spacing: -0.035em; margin: 0 0 12px; }
.role { margin: 0 0 28px; color: var(--muted); font-size: 15px; }
.role a { color: var(--fg); }
.lede { font-size: 20px; line-height: 1.5; letter-spacing: -0.01em; margin: 0 0 18px; max-width: 640px; }
.bio { color: var(--muted); margin: 0 0 28px; max-width: 640px; }
.bio a { color: var(--fg); }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  font-size: 13px; text-decoration: none; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--fg); background: var(--card);
  transition: border-color .15s, transform .15s, background .15s;
}
.btn:hover { border-color: var(--fg); color: var(--fg); transform: translateY(-1px); }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.primary:hover { color: var(--bg); opacity: .88; }

/* Section heads */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.section-head.sub { margin: 40px 0 16px; }
h2 { font: 600 26px/1.15 var(--display); letter-spacing: -0.025em; margin: 0; }
h3 { font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 0 14px; font-family: var(--mono); }
.meta { font-family: var(--mono); font-size: 12px; color: var(--faint); }

/* Featured */
.featured { display: flex; flex-direction: column; gap: 8px; }
.feat {
  display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start;
  padding: 16px; margin: 0 -16px; border-radius: 14px;
  transition: background .2s;
}
.feat:hover { background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.thumb {
  aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: #fff;
  border: 1px solid var(--line); display: block;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.thumb video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.feat:hover .thumb img, .feat:hover .thumb video { transform: scale(1.04); }
.tw { width: 100%; height: 100%; background: #faf7f0; color: #2b2a27; padding: 12px 13px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.tw-body p { margin: 0 0 6px; font: 10.5px/1.45 var(--mono); }
.tw-body p.i { color: var(--accent); font-weight: 500; }
.tw .cur { display: inline-block; width: 6px; height: 11px; background: currentColor; vertical-align: -1px; margin-left: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.feat h4 { font-family: var(--display); font-size: 17px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; margin: 2px 0 6px; }
.feat h4 a { text-decoration: none; }
.authors { font-size: 13.5px; color: var(--muted); margin: 0 0 6px; }
.authors b { color: var(--fg); font-weight: 500; }
.blurb { font-size: 14px; margin: 0 0 10px; }
.venue { font-family: var(--mono); font-size: 11.5px; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.plinks { display: flex; flex-wrap: wrap; gap: 4px 14px; font-family: var(--mono); font-size: 12px; margin-top: 8px; }
.plinks a { color: var(--muted); text-decoration: none; }
.plinks a:hover { color: var(--accent); }
.award { font-family: var(--mono); font-size: 11.5px; color: var(--accent); }

/* Filters */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: 12px var(--mono); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; transition: all .15s; }
.chip:hover { color: var(--fg); }
.chip.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* Publication list */
.publist { list-style: none; padding: 0; margin: 0; }
.pub { display: grid; grid-template-columns: 56px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.pub:last-child { border-bottom: 0; }
.pub.linked { cursor: pointer; }
.pub.linked:hover .t a { color: var(--accent); }
.pub .yr { font-family: var(--mono); font-size: 12px; color: var(--faint); padding-top: 3px; }
.pub .yr.dup { visibility: hidden; }
.pub .t { font-weight: 500; font-size: 14.5px; line-height: 1.4; }
.pub .t a { text-decoration: none; }
.pub .a { font-size: 13px; color: var(--muted); margin-top: 2px; }
.pub .a b { color: var(--fg); font-weight: 500; }
.pub .v { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.pub .v .plinks { margin-top: 0; }
.pub.star .t::before { content: "★ "; color: var(--accent); font-size: 12px; }
.note { font-size: 13px; color: var(--faint); margin: 24px 0 0; }

/* Rows (experience / education) */
.rows { list-style: none; padding: 0; margin: 0; }
.rows li { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.rows li:last-child { border-bottom: 0; }
.rows .org { font-weight: 500; }
.rows .org a { text-decoration: none; }
.rows .role { margin: 0; font-size: 13.5px; color: var(--muted); }
.rows .d { font-family: var(--mono); font-size: 12px; color: var(--faint); white-space: nowrap; }
.rows li.now .d { color: var(--accent); }

footer { max-width: var(--w); margin: 0 auto; padding: 40px 24px 64px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
footer p { margin: 0 0 6px; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* Mobile */
@media (max-width: 640px) {
  .nav nav a { display: none; }
  .feat { grid-template-columns: 1fr; gap: 14px; }
  .pub { grid-template-columns: 1fr; gap: 4px; }
  .pub .yr.dup { display: none; }
  .lede { font-size: 18px; }
}
