/* ===== Tokens ===== */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efede8;
  --text: #111318;
  --muted: #5d6270;
  --line: #e2dfd8;
  --accent: #2e4fd6;
  --accent-soft: #e6ebff;
  --accent-ink: #ffffff;
  --gold: #b07d1e;
  --shadow: 0 1px 2px rgba(17, 19, 24, .04), 0 8px 30px rgba(17, 19, 24, .06);
  --radius: 18px;
  --max: 1160px;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0c0f; --surface: #131519; --surface-2: #1a1d23; --text: #eceef3; --muted: #9aa1b0;
    --line: #262a32; --accent: #8ea4ff; --accent-soft: #1b2340; --accent-ink: #0b0c0f; --gold: #e3b459;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 40px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0c0f; --surface: #131519; --surface-2: #1a1d23; --text: #eceef3; --muted: #9aa1b0;
  --line: #262a32; --accent: #8ea4ff; --accent-soft: #1b2340; --accent-ink: #0b0c0f; --gold: #e3b459;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 40px rgba(0,0,0,.35); color-scheme: dark;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans);
  font-size: 16.5px; line-height: 1.65; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }
.serif { font-family: var(--serif); font-weight: 400; }
em.serif, .serif em { font-style: italic; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid transparent; transition: border-color .3s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -.01em; }
.mono {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-family: var(--serif);
  font-size: 19px; background: var(--text); color: var(--bg); font-style: italic;
}
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: 14.5px; padding: 8px 12px; border-radius: 999px; transition: color .2s, background .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--surface-2); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .menu-btn { display: grid; }
  .nav-links {
    position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; padding: 12px 16px 20px;
    background: var(--bg); border-bottom: 1px solid var(--line); display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; font-size: 16px; padding: 12px; }
}

/* ===== Buttons & chips ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 999px; font-weight: 500;
  font-size: 15px; text-decoration: none; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  transition: transform .2s, box-shadow .2s, background .2s; cursor: pointer;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 4px 11px;
  border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22a06b; box-shadow: 0 0 0 4px color-mix(in srgb, #22a06b 22%, transparent); }

/* ===== Hero ===== */
.hero { padding: 88px 0 56px; position: relative; }
.hero::before {
  content: ""; position: absolute; inset: -120px 0 auto; height: 620px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 300px at 85% 20%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(500px 260px at 10% 0%, color-mix(in srgb, var(--gold) 12%, transparent), transparent 70%);
}
.hero-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 56px; align-items: end; }
.eyebrow { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.hero h1 {
  font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 7.2vw, 92px); line-height: .98;
  letter-spacing: -.02em; margin: 0 0 26px;
}
.hero h1 em { color: var(--accent); }
.lede { font-size: clamp(17px, 1.6vw, 19.5px); color: var(--muted); max-width: 640px; margin: 0 0 34px; }
.lede strong { color: var(--text); font-weight: 500; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
.id-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 26px; box-shadow: var(--shadow);
}
.id-card .portrait {
  aspect-ratio: 4 / 3.4; border-radius: 16px; margin-bottom: 20px; overflow: hidden; position: relative;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2));
  display: grid; place-items: center;
}
.id-card .portrait span { font-family: var(--serif); font-style: italic; font-size: 96px; color: var(--accent); opacity: .85; }
.id-card .portrait img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.id-card h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.id-card .post { color: var(--muted); font-size: 14.5px; margin: 2px 0 16px; }
.id-card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.id-card dt { color: var(--muted); }
.id-card dd { margin: 0; text-align: right; font-weight: 500; }
@media (max-width: 900px) {
  .hero { padding: 48px 0 32px; }
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
}

/* ===== Stats ===== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 64px; }
.stat { padding: 28px 24px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(38px, 4.6vw, 54px); line-height: 1; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 14px; display: block; margin-top: 8px; }
@media (max-width: 700px) {
  .stats { grid-template-columns: 1fr 1fr; margin-top: 40px; }
  .stat { padding: 20px 14px; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

/* ===== Sections ===== */
section { padding: 104px 0; }
@media (max-width: 700px) { section { padding: 72px 0; } }
.sec-head { display: grid; grid-template-columns: 1fr 1.3fr; gap: 40px; margin-bottom: 52px; align-items: end; }
.sec-head .kicker { font-size: 13px; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); font-weight: 600; margin-bottom: 14px; display: block; }
.sec-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 4.6vw, 58px); line-height: 1.02; letter-spacing: -.02em; margin: 0; }
.sec-head p { color: var(--muted); margin: 0; font-size: 17px; }
@media (max-width: 900px) { .sec-head { grid-template-columns: 1fr; gap: 16px; margin-bottom: 36px; } }
.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ===== Paths (audience switch) ===== */
.paths { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.path {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; background: var(--bg); text-decoration: none;
  display: flex; flex-direction: column; gap: 12px; transition: transform .25s, box-shadow .25s, border-color .25s;
}
.path:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.path h3 { font-family: var(--serif); font-weight: 400; font-size: 32px; margin: 0; line-height: 1.1; }
.path p { margin: 0; color: var(--muted); }
.path ul { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.path .go { margin-top: auto; padding-top: 12px; font-weight: 500; color: var(--accent); display: inline-flex; gap: 6px; align-items: center; }
.path .go svg { width: 16px; height: 16px; transition: transform .2s; }
.path:hover .go svg { transform: translateX(4px); }
@media (max-width: 800px) { .paths { grid-template-columns: 1fr; } .path { padding: 24px; } }

/* ===== About ===== */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 64px; }
.about-grid .prose p { font-size: 18px; margin: 0 0 20px; }
.about-grid .prose p:first-child::first-letter { font-family: var(--serif); float: left; font-size: 74px; line-height: .8; padding: 8px 10px 0 0; color: var(--accent); }
.aside-list { display: grid; gap: 14px; align-content: start; align-self: start; position: sticky; top: 96px; }
.aside-item { border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; background: var(--surface); }
.aside-item small { color: var(--muted); display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.aside-item b { font-weight: 600; }
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; gap: 36px; } .aside-list { position: static; } }

/* ===== Expertise ===== */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 960px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-3 { grid-template-columns: 1fr; } }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; background: var(--bg);
  transition: transform .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 20px; }
.card .ico svg { width: 22px; height: 22px; }
.card h3 { margin: 0 0 8px; font-size: 18.5px; font-weight: 600; letter-spacing: -.01em; }
.card p { margin: 0 0 16px; color: var(--muted); font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== Work ===== */
.work-list { display: grid; gap: 28px; }
.work {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: 24px;
  overflow: hidden; background: var(--surface);
}
.work:nth-child(even) .media { order: 2; }
.work .media { position: relative; min-height: 340px; background: var(--surface-2); overflow: hidden; }
.work .media img, .work .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph { position: absolute; inset: 0; display: grid; place-items: center; }
.ph svg.pattern { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--accent); opacity: .5; }
.ph .ph-label { position: relative; font-size: 13px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); padding: 6px 12px; border-radius: 999px; }
.diagram { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; }
.diagram svg { width: 100%; height: 100%; max-height: 360px; }
.trio { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; padding: 14px; }
.trio figure { margin: 0; position: relative; border-radius: 12px; overflow: hidden; background: var(--surface); }
.trio img, .trio video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.trio figcaption {
  position: absolute; left: 8px; bottom: 8px; font-size: 11.5px; font-weight: 500; padding: 3px 9px; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(6px);
}
@media (max-width: 900px) { .work .media:has(.trio) { min-height: 260px; } .work .media:has(.diagram) { min-height: 260px; } }
.work .body { padding: 40px; display: flex; flex-direction: column; gap: 14px; }
.work .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.work h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 3vw, 38px); line-height: 1.08; margin: 4px 0 0; letter-spacing: -.01em; }
.work p { margin: 0; color: var(--muted); }
.kv { display: grid; gap: 10px; margin: 6px 0 0; padding: 0; list-style: none; }
.kv li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; font-size: 15px; }
.kv li b { font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding-top: 2px; }
@media (max-width: 900px) {
  .work { grid-template-columns: 1fr; }
  .work:nth-child(even) .media { order: 0; }
  .work .media { min-height: 220px; }
  .work .body { padding: 26px 22px; }
  .kv li { grid-template-columns: 1fr; gap: 2px; }
}

/* ===== Timeline ===== */
.timeline { position: relative; display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 200px 1fr; gap: 40px; padding: 34px 0; border-top: 1px solid var(--line); }
.tl-item:last-child { border-bottom: 1px solid var(--line); }
.tl-when { color: var(--muted); font-size: 14.5px; font-variant-numeric: tabular-nums; }
.tl-when .chip { margin-top: 10px; }
.tl-body h3 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.tl-body .org { color: var(--accent); font-weight: 500; margin: 2px 0 12px; }
.tl-body ul { margin: 0; padding-left: 18px; color: var(--muted); }
.tl-body li { margin-bottom: 6px; }
.tl-body li::marker { color: var(--accent); }
@media (max-width: 760px) { .tl-item { grid-template-columns: 1fr; gap: 8px; padding: 26px 0; } }

.edu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 56px; }
.edu div { border: 1px solid var(--line); border-radius: 14px; padding: 20px; background: var(--surface); }
.edu b { display: block; font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.1; }
.edu span { display: block; font-size: 14.5px; margin-top: 6px; }
.edu small { color: var(--muted); font-size: 13.5px; }
@media (max-width: 900px) { .edu { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .edu { grid-template-columns: 1fr; } }

/* ===== Teaching ===== */
.teach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.units { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.units li { padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.units li:first-child { border-top: 1px solid var(--line); }
.quote { font-family: var(--serif); font-size: clamp(26px, 2.8vw, 34px); line-height: 1.2; margin: 0 0 24px; }
@media (max-width: 860px) { .teach-grid { grid-template-columns: 1fr; gap: 32px; } }

/* ===== Publications ===== */
.pub-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; align-items: center; }
.filter {
  font: inherit; font-size: 14px; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer; transition: all .2s;
}
.filter[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.pub-links { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 700px) { .pub-links { margin-left: 0; width: 100%; } }
.pubs { list-style: none; margin: 0; padding: 0; counter-reset: pub; }
.pub {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 20px; padding: 24px 0; border-top: 1px solid var(--line);
  align-items: start; counter-increment: pub;
}
.pub:last-child { border-bottom: 1px solid var(--line); }
.pub .yr { font-family: var(--serif); font-size: 26px; line-height: 1; color: var(--muted); }
.pub h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; line-height: 1.4; letter-spacing: -.005em; }
.pub .authors { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.pub .authors b { color: var(--text); font-weight: 600; }
.pub .venue { font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pub .venue i { color: var(--text); }
.doi {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; text-decoration: none;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; transition: all .2s;
}
.doi:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.doi svg { width: 14px; height: 14px; }
.pub.hide { display: none; }
@media (max-width: 700px) {
  .pub { grid-template-columns: 1fr; gap: 8px; }
  .pub .yr { font-size: 20px; }
}
.more { margin-top: 40px; display: grid; gap: 12px; }
details { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
summary { cursor: pointer; padding: 18px 22px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 22px; font-weight: 300; color: var(--muted); transition: transform .2s; }
details[open] summary::after { transform: rotate(45deg); }
details ul { margin: 0; padding: 0 22px 20px 40px; color: var(--muted); font-size: 15px; }
details li { margin-bottom: 8px; }

/* ===== Skills ===== */
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 48px; }
.skill-row { display: grid; grid-template-columns: 170px 1fr; gap: 20px; padding: 18px 0; border-top: 1px solid var(--line); }
.skill-row h4 { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding-top: 4px; }
@media (max-width: 900px) { .skills { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .skill-row { grid-template-columns: 1fr; gap: 10px; } }

/* ===== Contact ===== */
.contact {
  border-radius: 28px; padding: 72px 56px; background: var(--text); color: var(--bg); position: relative; overflow: hidden;
}
.contact::after {
  content: ""; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%); opacity: .6;
}
.contact h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 6vw, 76px); line-height: 1; margin: 0 0 18px; letter-spacing: -.02em; position: relative; }
.contact p { max-width: 560px; opacity: .75; margin: 0 0 32px; font-size: 18px; position: relative; }
.contact .cta { position: relative; }
.contact .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.contact .btn-primary { background: var(--bg); color: var(--text); border-color: var(--bg); }
@media (max-width: 700px) { .contact { padding: 44px 24px; border-radius: 22px; } }

footer { padding: 40px 0 56px; color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* Links still waiting for a real URL stay hidden until data-todo is removed */
[data-todo] { display: none !important; }

/* ===== Motion ===== */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition: none !important; }
}
@media print {
  .site-header, .contact, .pub-tools { display: none; }
  .reveal { opacity: 1; transform: none; }
}
.more-note { margin: 0 22px 12px 22px; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
details li small { color: var(--muted); font-size: 12.5px; margin-left: 6px; white-space: nowrap; }
