:root{
  --bg:#ffffff;
  --text:#1a2332;
  --muted:#6b7a8d;
  --line:#e8e8e8;
  --blue:#2563eb;
  --purple:#7c3aed;
  --violet:#a855f7;
  --pink:#be185d;
  --accent:#7c3aed;
  --accent-soft:#f3e8ff;
  --serif:"Source Serif 4", "Noto Serif", Georgia, serif;
  --sans:"Source Serif 4", "Noto Serif", Georgia, serif;
  --mono:"Roboto Mono", ui-monospace, monospace;
  --maxw:1100px;
}

[data-theme="dark"]{
  --bg:#0b1020;
  --text:#eef2ff;
  --muted:#b8c0d9;
  --line:#25304a;
  --accent:#a78bfa;
  --accent-soft:#241b46;
}

*{box-sizing:border-box;}
html{scroll-behavior:smooth;}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--sans);
  font-weight:400;
  font-size:16px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}

a{color:var(--accent); text-decoration:none;}
a:hover{text-decoration:underline;}
a:focus-visible, button:focus-visible{outline:2px solid var(--accent); outline-offset:2px;}

.wrap{max-width:var(--maxw); margin:0 auto; padding:0 28px;}

/* ---------- Nav ---------- */
header.nav{
  background:var(--bg);
  border-bottom:1px solid var(--line);
  position:sticky; top:0; z-index:20;
}
.nav-inner{
  max-width:var(--maxw); margin:0 auto; padding:14px 28px;
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  position:relative;
}
.nav-name{
  font-weight:600; font-size:18px; letter-spacing:-0.02em;
  color:var(--text); white-space:nowrap;
}
.nav-name-home{
  visibility:hidden;
  pointer-events:none;
  min-width:0;
  width:0;
  overflow:hidden;
}
/* Home: keep theme button in header, aligned slightly left of the hero name */
body.page-home .theme-toggle{
  position:absolute;
  left:20px;
  top:50%;
  transform:translateY(-50%);
  margin:0;
  z-index:2;
}
.nav-links{
  display:flex; flex-wrap:wrap; gap:8px 8px; list-style:none;
  margin:0; padding:0; justify-content:flex-end;
  margin-left:auto;
}
.nav-links a{
  color:var(--muted); font-size:16px; font-weight:400;
  letter-spacing:normal;
  padding:6px 12px; border-radius:999px;
  display:inline-flex; align-items:center; gap:6px;
}
.nav-links a:hover{
  color:var(--pink);
  text-decoration:none;
}
.nav-links a.active{
  color:var(--pink);
  background:transparent;
  text-decoration:none;
  font-weight:700;
  box-shadow:none;
}
.nav-home-icon{
  display:inline-block;
  flex-shrink:0;
  vertical-align:middle;
}
.nav-home-icon .home-icon-fill{display:none;}
.nav-links a.active .nav-home-icon .home-icon-fill{display:block;}
.nav-links a.active .nav-home-icon .home-icon-outline{display:none;}
.nav-toggle{display:none; background:none; border:none; cursor:pointer; padding:4px;}
.nav-toggle span{display:block; width:20px; height:2px; background:var(--text); margin:4px 0;}

.theme-toggle{
  border:1px solid var(--line);
  background:#f3f4f6;
  color:var(--text);
  border-radius:999px;
  width:38px;
  height:38px;
  padding:0;
  margin:0;
  font:inherit;
  line-height:0;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  transition:background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.theme-toggle:hover{color:var(--text);}
.theme-toggle .theme-icon{
  width:18px;
  height:18px;
  display:block;
  flex:0 0 18px;
  pointer-events:none;
}
.theme-toggle::before,
.theme-toggle::after{
  content:none !important;
  display:none !important;
}
[data-theme="dark"] body{background:var(--bg); color:var(--text);}
[data-theme="dark"] header.nav{background:rgba(11,16,32,0.92);}
[data-theme="dark"] .nav-links,
[data-theme="dark"] .theme-toggle,
[data-theme="dark"] .contact-row a,
[data-theme="dark"] .pub-thumb,
[data-theme="dark"] .pub-links a,
[data-theme="dark"] .bg-tab,
[data-theme="dark"] .tl-card,
[data-theme="dark"] .v-bar-list .v-item img,
[data-theme="dark"] .cv-frame{
  background:#12182b;
}
[data-theme="dark"] .pub-thumb,
[data-theme="dark"] .cv-frame,
[data-theme="dark"] .tl-card,
[data-theme="dark"] .theme-toggle{border-color:var(--line);}
[data-theme="dark"] .bio p,
[data-theme="dark"] .pub-tldr,
[data-theme="dark"] .project-desc,
[data-theme="dark"] .entry p,
[data-theme="dark"] .tl-org,
[data-theme="dark"] .v-location,
[data-theme="dark"] .page-lead{color:#d6ddf2;}
[data-theme="dark"] .nav-links a{color:var(--muted);}
[data-theme="dark"] .nav-links a:hover,
[data-theme="dark"] .nav-links a.active{color:#ec4899;}
[data-theme="dark"] .contact-row a,
[data-theme="dark"] .pub-links a,
[data-theme="dark"] .theme-toggle{color:#d6ddf2;}
[data-theme="dark"] .tl-logo{background:#12182b;}
[data-theme="dark"] .profile-col > img.profile-photo,
[data-theme="dark"] .profile-col img:first-child{
  border-color:rgba(148,163,184,0.26);
  background:#12182b;
  box-shadow:0 18px 40px rgba(0,0,0,0.38);
}
[data-theme="dark"] footer{color:var(--muted);}


@media (max-width:720px){
  .nav-links{
    position:absolute; top:100%; left:0; right:0;
    flex-direction:column; gap:0;
    background:var(--bg);
    border-bottom:1px solid var(--line);
    max-height:0; overflow:hidden;
    transition:max-height 0.25s ease;
  }
  .nav-links.open{max-height:420px;}
  .nav-links a{display:block; padding:12px 24px; border-radius:0; border-top:1px solid var(--line);}
  .nav-toggle{display:block; margin-left:auto;}
  body.page-home .theme-toggle{
    position:static;
    transform:none;
  }
}

/* ---------- Home hero ---------- */
.hero{padding:40px 0 12px;}
.hero-grid{
  display:grid;
  grid-template-columns:1fr 270px;
  gap:48px;
  align-items:start;
}
h1.name{
  font-family:var(--serif); font-weight:800; font-size:36px;
  margin:0 0 16px; line-height:1.1; letter-spacing:-0.02em;
}
.bio p{margin:0 0 16px; font-size:18px; color:#4a5568; line-height:1.55;}
.bio strong{font-weight:600; color:var(--text);}

.profile-col{text-align:center;}
.profile-col > img.profile-photo,
.profile-col img:first-child{
  width:270px; height:270px; object-fit:cover;
  object-position:center 24%;
  border-radius:50%;
  border:4px solid rgba(255,255,255,0.92);
  display:block; margin:0 auto 10px;
  box-shadow:0 14px 34px rgba(26,35,50,0.16);
  background:#eef2ff;
}
.contact-row{
  display:flex; flex-wrap:nowrap; gap:2px; justify-content:center;
  margin:0;
}
.contact-row a{
  font-size:16px; font-weight:600; color:#4a5568;
  padding:8px 14px; border-radius:999px; background:#f3f4f6;
  border:1px solid #d9dee7;
}
.contact-row a:hover{color:var(--accent); text-decoration:none;}

@media (max-width:760px){
  .hero-grid{grid-template-columns:1fr; gap:24px;}
  .profile-col{order:-1;}
  .profile-col > img.profile-photo,
  .profile-col img:first-child{width:180px; height:180px;}
  h1.name{font-size:30px;}
  .bio p{font-size:16px;}
}

/* ---------- Sections ---------- */
section{padding:40px 0 12px;}
.section-head{
  margin-bottom:28px; padding-bottom:0;
  border-bottom:none;
  display:flex; align-items:baseline; justify-content:space-between; gap:12px;
}
h2.section-title{
  font-family:var(--serif); font-weight:700; font-size:28px; margin:0;
  text-transform:none; letter-spacing:normal; color:var(--text);
}
.section-link{font-size:14px; white-space:nowrap;}
.page-title{
  font-family:var(--serif); font-weight:700; font-size:32px;
  margin:36px 0 8px; line-height:1.2;
}
.page-lead{color:var(--muted); font-size:18px; margin:0 0 28px; line-height:1.55;}

/* ---------- Publication / experience tiles ---------- */
.pub-tiles{display:flex; flex-direction:column; gap:36px;}
.pub-tile{
  display:grid;
  grid-template-columns:280px 1fr;
  gap:28px;
  align-items:start;
  padding-bottom:36px;
  border-bottom:1px solid var(--line);
}
.pub-tile:last-child{border-bottom:none; padding-bottom:0;}
.pub-thumb{
  width:100%;
  aspect-ratio:16/9;
  object-fit:contain;
  object-position:center;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fafafa;
  display:block;
  padding:12px;
}
.pub-thumb.cover{object-fit:cover; padding:0;}
.pub-badge{
  display:inline-block;
  font-size:10px; font-weight:600;
  letter-spacing:0.02em;
  color:var(--purple);
  background:var(--accent-soft);
  padding:2px 8px;
  border-radius:999px;
  margin:0 0 8px;
  line-height:1.25;
}
.pub-tile h3{
  font-family:var(--serif);
  font-size:24px;
  font-weight:700;
  line-height:1.25;
  letter-spacing:-0.02em;
  margin:0 0 8px;
  color:var(--text);
}
.pub-tile h3 a{color:inherit;}
.pub-tile h3 a:hover{color:var(--accent); text-decoration:none;}
.pub-venue{
  font-family:var(--serif);
  font-size:14px;
  font-weight:500;
  color:var(--pink);
  margin:0 0 8px;
}
.pub-authors{
  font-size:14px;
  color:var(--muted);
  margin:0 0 10px;
  line-height:1.5;
}
.pub-authors .me{font-style:italic; color:var(--text); font-weight:500;}
.pub-tldr{
  font-size:14px;
  color:#4a5568;
  margin:0 0 12px;
  line-height:1.55;
}
.pub-links{display:flex; flex-wrap:wrap; gap:8px;}
.pub-links a{
  font-size:11px; font-weight:500; color:#4a5568;
  padding:4px 10px; border-radius:999px; background:#f7f7f7;
}
.pub-links a:hover{color:var(--accent); text-decoration:none;}

@media (max-width:760px){
  .pub-tile{grid-template-columns:1fr; gap:14px;}
  .pub-tile h3{font-size:20px;}
}

/* ---------- Projects ---------- */
.project-list{display:flex; flex-direction:column; gap:22px;}
.project{padding-bottom:22px; border-bottom:1px solid var(--line);}
.project:last-child{border:none; padding-bottom:0;}
.project-title{font-weight:600; font-size:15px; margin:0 0 3px;}
.project-meta{font-size:12px; color:var(--accent); margin-bottom:7px;}
.project-desc{font-size:14px; color:#4a5568; margin:0; line-height:1.55;}
.note-inline{font-size:14px; color:var(--muted); margin:10px 0 0;}

/* ---------- Background toggle + timeline ---------- */
.bg-toggle{
  display:flex; flex-wrap:wrap; gap:10px; margin:0 0 28px;
}
.bg-tab{
  font-family:var(--sans); font-size:14px; font-weight:500;
  padding:8px 16px; border-radius:999px; cursor:pointer;
  border:1px solid var(--line);
  background:#f7f7f7; color:var(--muted);
  transition:background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.bg-tab:hover{color:var(--text); border-color:#ccc;}
.bg-tab.active{
  background:transparent;
  color:var(--pink);
  border-color:transparent;
  font-weight:700;
  box-shadow:none;
}

.bg-panel{display:none;}
.bg-panel.active{display:block;}

.tl{
  width:100%;
  margin:18px 0 8px;
}
.tl-stage{
  position:relative;
}
.tl-row-top,
.tl-row-bottom{
  position:relative;
  min-height:132px;
}
.tl-axis-row{
  position:relative;
  height:52px;
  margin:16px 0;
}
.tl-years{
  position:absolute;
  inset:0;
  pointer-events:none;
}
.tl-year{
  position:absolute;
  top:0;
  transform:translateX(-50%);
  font-size:11px;
  font-weight:500;
  color:#8b95a5;
  white-space:nowrap;
}
.tl-year::after{
  content:"";
  position:absolute;
  left:50%;
  top:18px;
  width:1px;
  height:10px;
  background:rgba(148,163,184,0.45);
  transform:translateX(-50%);
}
.tl-axis-line{
  position:absolute;
  left:0;
  right:0;
  top:50%;
  height:2px;
  background:rgba(203,213,225,0.85);
  transform:translateY(-50%);
  z-index:0;
}
.tl-bars{
  position:absolute;
  inset:0;
  z-index:1;
  pointer-events:none;
}
.tl-bar{
  position:absolute;
  top:50%;
  height:8px;
  min-width:6px;
  border-radius:999px;
  transform:translateY(-50%);
}
.tl-connectors{
  position:absolute;
  left:0;
  top:0;
  width:100%;
  height:100%;
  pointer-events:none;
  z-index:0;
  display:none;
}
.tl-item{
  position:absolute;
  width:232px;
  left:0;
  transform:translateX(-50%);
  z-index:2;
}
.tl-row-top .tl-item{bottom:0;}
.tl-row-bottom .tl-item{top:0;}
.tl-item::after{
  content:"";
  position:absolute;
  left:50%;
  width:2px;
  transform:translateX(-50%);
  background:repeating-linear-gradient(
    to bottom,
    rgba(148,163,184,0.7) 0 5px,
    transparent 5px 9px
  );
}
.tl-row-top .tl-item::after{
  top:100%;
  height:42px;
}
.tl-row-bottom .tl-item::after{
  bottom:100%;
  height:42px;
}
.tl-card-head{
  display:grid;
  grid-template-columns:40px 1fr;
  gap:12px;
  align-items:start;
}
.tl-logo{
  width:40px;
  height:40px;
  border-radius:10px;
  background:#fff;
  border:2px solid var(--purple);
  object-fit:contain;
  padding:3px;
  box-shadow:0 2px 10px rgba(26,35,50,0.08);
}
.tl-card{
  background:rgba(251,249,244,0.86);
  border:1px solid rgba(255,255,255,0.8);
  border-top:3px solid var(--purple);
  border-radius:18px;
  padding:14px 14px 12px;
  box-shadow:0 4px 24px rgba(70,55,40,0.08);
  backdrop-filter:blur(8px);
  text-align:left;
}
.tl-copy{min-width:0;}
.tl-date{
  font-family:var(--serif);
  font-size:14px;
  font-weight:400;
  color:#8b95a5;
  margin:0 0 4px;
}
.tl-role{
  font-weight:600;
  font-size:15px;
  margin:0;
  color:var(--text);
  line-height:1.35;
  letter-spacing:-0.02em;
}
.tl-org{
  font-size:14px;
  color:#4a5568;
  margin:4px 0 0;
  line-height:1.35;
}
.tl-loc{
  font-size:12px;
  color:#8b95a5;
  margin:6px 0 0;
  line-height:1.35;
}
[data-theme="dark"] .tl-axis-line{
  background:rgba(255,255,255,0.10);
}
[data-theme="dark"] .tl-year{color:rgba(255,255,255,0.32);}
[data-theme="dark"] .tl-year::after{background:rgba(255,255,255,0.10);}
[data-theme="dark"] .tl-logo{background:#12182b;}
[data-theme="dark"] .tl-card{
  background:rgba(18,24,43,0.92);
  border-color:var(--line);
}

.v-timeline{display:none; flex-direction:column; gap:14px; margin-top:8px;}
.v-bar-list .v-item{
  display:grid; grid-template-columns:40px 120px 1fr; gap:12px;
  align-items:start;
  padding:14px 0 14px 0;
  border-left:none;
}
.v-bar-list .v-item::before{
  content:"";
  grid-column:1 / -1;
  display:block;
  height:2px;
  background:linear-gradient(90deg, var(--bar-color, var(--purple)), transparent);
  margin-bottom:10px;
}
.v-bar-list .v-item img{
  width:40px; height:40px; object-fit:contain;
  border-radius:10px; border:2px solid var(--bar-color, var(--purple));
  background:#fff; padding:3px;
}
.v-date{font-size:14px; color:#8b95a5;}
.v-role{font-weight:600; font-size:15px; margin:0;}
.v-location{color:var(--muted); font-size:12px; margin:4px 0 0; line-height:1.4;}

@media (max-width:900px){
  .tl{display:none;}
  .bg-panel.active .v-timeline{display:flex;}
}

/* ---------- Volunteering / blog ---------- */
.entry{padding:18px 0; border-bottom:1px solid var(--line);}
.entry:last-child{border-bottom:none;}
.entry h3{margin:0 0 4px; font-size:15px; font-weight:600;}
.entry .meta{font-size:12px; color:var(--accent); margin-bottom:6px;}
.entry p{margin:0; font-size:14px; color:#4a5568; line-height:1.55;}

.cv-frame{
  width:100%;
  height:80vh;
  border:1px solid var(--line);
  border-radius:2px;
}
.cv-actions{margin:0 0 16px; display:flex; gap:16px; flex-wrap:wrap;}

.empty-state{
  color:var(--muted); font-size:16px; padding:24px 0 40px;
}

footer{
  padding:28px 0 48px; text-align:center; color:var(--muted); font-size:13px;
  border-top:1px solid var(--line); margin-top:28px;
}
footer .footer-name{font-weight:600; color:var(--text);}
footer .footer-affil{color:var(--muted);}
