:root{
  --bg:#edf0f0; --card:#ffffff; --ink:#182420; --ink-soft:#586761; --line:#e4e9e7; --line-soft:#eef2f0;
  --accent:#0e9f6e; --accent-soft:#e3f6ee; --accent-ink:#0a5c40; --chip-bg:#f2f6f4;
  --shadow:0 1px 2px rgba(15,30,25,.05),0 8px 26px rgba(15,30,25,.07);
  --sans:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif;
  --mono:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
}
/* Light is the default for everyone, regardless of the OS setting: the palette
   above paints before any script runs, so there is no flash. Dark is opt-in via
   the toggle, which sets data-theme and remembers the choice. */
:root[data-theme="light"]{--bg:#edf0f0;--card:#ffffff;--ink:#182420;--ink-soft:#586761;--line:#e4e9e7;--line-soft:#eef2f0;
  --accent:#0e9f6e;--accent-soft:#e3f6ee;--accent-ink:#0a5c40;--chip-bg:#f2f6f4;
  --shadow:0 1px 2px rgba(15,30,25,.05),0 8px 26px rgba(15,30,25,.07);}
:root[data-theme="dark"]{--bg:#0d1512;--card:#131d19;--ink:#e7efeb;--ink-soft:#93a49c;--line:#233029;--line-soft:#1a2621;
  --accent:#2fbd86;--accent-soft:#132a20;--accent-ink:#6fdcaa;--chip-bg:#182420;
  --shadow:0 1px 2px rgba(0,0,0,.3),0 10px 30px rgba(0,0,0,.35);}

*{box-sizing:border-box;}
html{scroll-behavior:smooth;}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--sans);line-height:1.6;-webkit-font-smoothing:antialiased;}
a{color:var(--accent-ink);text-decoration:none;font-weight:500;}
a:hover{text-decoration:underline;}
em{font-style:normal;font-weight:650;color:var(--accent-ink);}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px;}

/* Three columns on every page type: identity sidebar, card, right rail. The card
   is 670px throughout -- 1248 less 44 of padding, less the 308 sidebar, the 190
   rail and two 18px gaps -- so nothing shifts as you move between pages. The rail
   is paid for by the wrap being wider, never by narrowing the card. */
.wrap{max-width:1248px;margin:0 auto;padding:30px 22px 70px;display:grid;grid-template-columns:308px minmax(0,1fr) 190px;gap:18px;align-items:start;}

/* Sidebar */
.side{position:sticky;top:30px;background:var(--card);border:1px solid var(--line);border-radius:22px;box-shadow:var(--shadow);padding:28px 26px;text-align:center;}
.side img{width:118px;height:118px;border-radius:50%;object-fit:cover;border:3px solid var(--accent-soft);}
h1{font-size:22px;font-weight:750;letter-spacing:-.02em;margin:16px 0 8px;color:var(--ink);}
.roles{margin:0;color:var(--ink-soft);font-size:13.5px;line-height:1.55;}
.roles b{color:var(--ink);font-weight:600;white-space:nowrap;}
.roles a{color:var(--ink);font-weight:600;}
.loc{font-size:12px;color:var(--ink-soft);margin-top:9px;display:flex;align-items:center;justify-content:center;gap:5px;}
/* Chips sized to their text and centred on the card's axis. The outline is what
   makes an inactive entry read as pressable -- without it a muted word next to
   the filled current-page pill looks like disabled text rather than a link. */
.side nav{margin-top:20px;display:flex;flex-wrap:wrap;justify-content:center;gap:7px;}
.side nav a{font-size:13.5px;font-weight:500;color:var(--ink-soft);padding:7px 16px;border:1px solid var(--line);border-radius:999px;}
.side nav a:hover{background:var(--accent-soft);border-color:var(--accent-soft);color:var(--accent-ink);text-decoration:none;}
.side nav a[aria-current="page"]{background:var(--accent-soft);border-color:var(--accent-soft);color:var(--accent-ink);font-weight:600;}
.toolbar{margin-top:18px;display:flex;gap:8px;}
.cta{flex:1;background:var(--accent);color:#fff;font-weight:600;font-size:13.5px;padding:11px;border-radius:12px;}
.cta:hover{text-decoration:none;filter:brightness(1.05);}
.social{margin-top:16px;display:flex;justify-content:center;gap:9px;}
.social a,.social .toggle{width:34px;height:34px;padding:0;border:1px solid var(--line);background:none;border-radius:10px;display:flex;align-items:center;justify-content:center;color:var(--ink-soft);cursor:pointer;}
.social a:hover,.social .toggle:hover{border-color:var(--accent);color:var(--accent);}
.social svg{width:17px;height:17px;fill:currentColor;}
/* Both glyphs are in the markup; CSS picks the one for the active theme so the
   button is right on first paint. Light is the default, hence the moon. */
.toggle .icon-sun{display:none;}
:root[data-theme="dark"] .toggle .icon-moon{display:none;}
:root[data-theme="dark"] .toggle .icon-sun{display:block;}

/* Main */
main{display:flex;flex-direction:column;gap:16px;min-width:0;}
.card{background:var(--card);border:1px solid var(--line);border-radius:22px;box-shadow:var(--shadow);padding:28px 30px;scroll-margin-top:24px;}
h2{font-size:11.5px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--accent);margin:0 0 16px;display:flex;align-items:center;justify-content:space-between;}
h2 .more{font-size:11px;letter-spacing:.02em;text-transform:none;font-weight:600;}
p{margin:0 0 12px;}p:last-child{margin-bottom:0;}
.lede{font-size:17px;line-height:1.55;}
.tagline{font-size:12.5px;color:var(--accent-ink);font-weight:600;margin:10px 0 0;letter-spacing:.01em;}

/* Impact stats */
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:20px;}
.stat{background:var(--bg);border:1px solid var(--line-soft);border-radius:14px;padding:14px 12px;text-align:center;}
.stat .num{font-size:26px;font-weight:800;letter-spacing:-.03em;color:var(--ink);line-height:1;font-variant-numeric:tabular-nums;}
.stat .lbl{font-size:11px;color:var(--ink-soft);margin-top:6px;line-height:1.35;}
.stat .num span{color:var(--accent);}

/* Competencies */
.comp{padding:13px 0;border-bottom:1px solid var(--line);}
.comp:last-child{border-bottom:none;padding-bottom:0;}
.comp:first-child{padding-top:0;}
.comp b{display:block;font-size:14.5px;margin-bottom:3px;color:var(--ink);}
.comp span{color:var(--ink-soft);font-size:14px;}

/* Experience / entries */
.entry{padding:16px 0;border-bottom:1px solid var(--line);}
.entry:last-child{border-bottom:none;padding-bottom:0;}
.entry:first-of-type{padding-top:0;}
.erow{display:flex;justify-content:space-between;gap:14px;align-items:baseline;}
.erow h3{margin:0;font-size:16px;font-weight:650;color:var(--ink);flex:1;min-width:0;}
.erow .m{font-family:var(--mono);font-size:11px;color:var(--ink-soft);background:var(--bg);padding:3px 9px;border-radius:7px;white-space:nowrap;}
.org{color:var(--accent-ink);font-size:13px;font-weight:600;margin:3px 0 9px;}
.entry ul{margin:0;padding-left:18px;}
.entry li{margin-bottom:6px;font-size:14px;color:var(--ink-soft);}
.entry li:last-child{margin-bottom:0;}
.entry li b{color:var(--ink);font-weight:650;}
.sub{font-size:10.5px;font-weight:700;letter-spacing:.13em;text-transform:uppercase;color:var(--accent);margin:22px 0 10px;}
.sub:first-child{margin-top:0;}
.oneline{font-size:13.5px;color:var(--ink-soft);margin-top:4px;}

/* Publications */
.pub-list{list-style:none;padding:0;margin:0;}
.pub-item{padding:15px 0;border-bottom:1px solid var(--line);}
.pub-item:last-child{border-bottom:none;padding-bottom:0;}
.pub-item:first-child{padding-top:0;}
.pub-title{display:block;font-size:15px;font-weight:650;color:var(--ink);line-height:1.4;}
.pub-title:hover{color:var(--accent-ink);}
.pub-authors{font-size:13px;color:var(--ink-soft);margin-top:3px;}
.pub-venue{font-size:12.5px;color:var(--accent-ink);margin-top:2px;}
.pub-venue strong{font-weight:650;}
.pub-actions{margin-top:8px;display:flex;gap:8px;flex-wrap:wrap;}
.pub-actions a,.pub-actions button{font-family:var(--mono);font-size:11px;font-weight:600;color:var(--ink-soft);border:1px solid var(--line);border-radius:7px;padding:3px 9px;background:none;line-height:inherit;}
.pub-actions button{cursor:pointer;}
.pub-actions a:hover,.pub-actions button:hover{border-color:var(--accent);color:var(--accent);text-decoration:none;}
.bib-container{margin-top:10px;}
.bib-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;}
.bib-label{font-family:var(--mono);font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-soft);}
.bib-copy{font-family:var(--mono);font-size:11px;background:var(--accent);color:#fff;border:none;border-radius:6px;padding:3px 10px;cursor:pointer;}
.bib-code{font-family:var(--mono);font-size:11.5px;background:var(--bg);border:1px solid var(--line);border-radius:10px;padding:12px;overflow-x:auto;white-space:pre;margin:0;color:var(--ink);}

/* Patents / Open source grids */
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
.mini{background:var(--bg);border:1px solid var(--line-soft);border-radius:14px;padding:15px 16px;}
.mini h3{margin:0 0 5px;font-size:14px;font-weight:650;line-height:1.35;color:var(--ink);}
.mini h3 a{color:var(--ink);}
.mini h3 a:hover{color:var(--accent-ink);}
.mini .m{font-family:var(--mono);font-size:10px;color:var(--accent-ink);}
.mini p{font-size:12px;color:var(--ink-soft);margin:6px 0 0;}
.mini .stat-tag{display:inline-block;margin-top:8px;font-family:var(--mono);font-size:10px;font-weight:600;color:var(--accent-ink);background:var(--accent-soft);padding:2px 8px;border-radius:6px;}

/* Recognition */
.awards{list-style:none;padding:0;margin:0;}
.awards li{display:flex;gap:14px;align-items:baseline;padding:11px 0;border-bottom:1px solid var(--line);font-size:14px;}
.awards li:last-child{border-bottom:none;padding-bottom:0;}
.awards li:first-child{padding-top:0;}
.awards .badge{font-family:var(--mono);font-size:10.5px;font-weight:700;color:var(--accent-ink);background:var(--accent-soft);padding:3px 9px;border-radius:6px;min-width:52px;text-align:center;flex:none;}
.awards .txt b{color:var(--ink);font-weight:650;}
.awards .txt span{color:var(--ink-soft);}

footer{text-align:center;color:var(--ink-soft);font-size:12px;padding:24px 0 0;}

/* ============================================
   RIGHT RAIL (contents / sections / tags)
   ============================================ */
.rail{position:sticky;top:30px;font-size:12.5px;}
.rail-label{font-family:var(--mono);font-size:9.5px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--accent);margin-bottom:9px;}
.rail ul{list-style:none;margin:0;padding:0;border-left:1px solid var(--line);}
.rail li{margin:0;}
.rail ul ul{border-left:none;padding-left:12px;}
.rail a{display:flex;justify-content:space-between;align-items:baseline;gap:8px;color:var(--ink-soft);padding:4px 0 4px 12px;margin-left:-1px;border-left:1px solid transparent;line-height:1.4;font-weight:500;}
.rail a:hover{color:var(--accent-ink);border-left-color:var(--accent);text-decoration:none;}
.rail a[aria-current="page"],
.rail a.is-active{color:var(--accent-ink);border-left-color:var(--accent);font-weight:600;}
.rail a.is-active .n{opacity:.9;}
.rail a .n{font-family:var(--mono);font-size:10px;opacity:.55;flex:none;}
.rail summary{display:none;}

/* Below 1248 the rail cannot sit beside the card without narrowing it, so it
   folds into a collapsed panel above the content and the wrap returns to the
   two-column geometry the card was sized against. */
@media (max-width:1248px){
  .wrap{max-width:1040px;grid-template-columns:308px minmax(0,1fr);}
  .side{grid-column:1;grid-row:1 / span 2;}
  .rail{grid-column:2;grid-row:1;position:static;background:var(--card);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow);padding:14px 18px;margin-bottom:16px;}
  main{grid-column:2;grid-row:2;}
  .rail-label{display:none;}
  .rail summary{display:list-item;cursor:pointer;font-family:var(--mono);font-size:9.5px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--accent);}
  .rail details[open] ul{margin-top:10px;}
}

@media (max-width:820px){
  .wrap{grid-template-columns:1fr;}
  .side{position:static;grid-column:1;grid-row:1;}
  .rail{grid-column:1;grid-row:2;}
  main{grid-column:1;grid-row:3;}
  .stats{grid-template-columns:repeat(2,1fr);}
  .grid2{grid-template-columns:1fr;}

  /* Once the card is full width it is a banner, not a column, and the stacked
     portrait layout pushes the content off the first screen. Set the photo
     beside the identity text instead. The children are placed individually
     because h1/roles/loc are siblings with no wrapper to grid onto. */
  .side{display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:18px;text-align:left;}
  .side img{width:76px;height:76px;grid-column:1;grid-row:1 / span 3;align-self:center;}
  .side h1{grid-column:2;grid-row:1;margin:0;font-size:20px;}
  .roles{grid-column:2;grid-row:2;margin-top:5px;}
  .loc{grid-column:2;grid-row:3;justify-content:flex-start;}
  .side nav{grid-column:1 / -1;grid-row:4;justify-content:flex-start;margin-top:18px;}
  .toolbar{grid-column:1 / -1;grid-row:5;}
  .social{grid-column:1 / -1;grid-row:6;justify-content:flex-start;}
}
@media (max-width:480px){
  .card{padding:22px 20px;}
}
