*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

:root{
  --bg:#ffffff;
  --bg-raised:#f6f8fb;
  --bg-surface:#eef2f7;
  --border:#dbe2ec;
  --text:#0f1a2b;
  --text-muted:#51607a;
  --accent:#0b5fff;
  --accent-dim:rgba(11,95,255,.1);
  --nav-bg:rgba(255,255,255,.94);
  --card-bg:#ffffff;
  --shadow:0 1px 2px rgba(15,26,43,.06);
  --shadow-hover:0 8px 24px rgba(11,95,255,.12);
  --avatar-overlay:linear-gradient(to top,rgba(255,255,255,.65),transparent);
  --mono:'JetBrains Mono',ui-monospace,monospace;
  --sans:'Inter',system-ui,-apple-system,sans-serif;
  --measure:68ch;
  --radius:10px;
  color-scheme:light;
}

html[data-theme="dark"]{
  --bg:#0e1117;
  --bg-raised:#161b22;
  --bg-surface:#1c2128;
  --border:#30363d;
  --text:#e6edf3;
  --text-muted:#9aa7b8;
  --accent:#e3a82b;
  --accent-dim:rgba(227,168,43,.16);
  --nav-bg:rgba(14,17,23,.94);
  --card-bg:#161b22;
  --shadow:0 1px 2px rgba(0,0,0,.4);
  --shadow-hover:0 8px 24px rgba(0,0,0,.5);
  --avatar-overlay:linear-gradient(to top,rgba(14,17,23,.6),transparent);
  color-scheme:dark;
}

html{scroll-behavior:smooth;font-size:clamp(15px,1.05vw,17px);-webkit-text-size-adjust:100%}

body{
  font-family:var(--sans);
  color:var(--text);
  background:var(--bg);
  line-height:1.7;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
  max-width:100vw;
}

img{max-width:100%;height:auto}

::selection{background:var(--accent);color:#fff}

a{color:var(--accent);text-decoration:none;word-break:break-word}
a:hover{text-decoration:underline}

/* ─── NAV ─── */
nav{
  position:fixed;top:0;left:0;right:0;z-index:200;
  display:flex;justify-content:space-between;align-items:center;
  padding:.9rem 1.25rem;
  background:transparent;
  border-bottom:none;
  transition:padding .3s,background .3s;
}
/* Blur layer lives on ::before so fixed-position mobile dropdown
   inside nav is still positioned to the viewport, not trapped */
nav::before{
  content:'';position:absolute;inset:0;z-index:201;
  background:var(--nav-bg);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  border-bottom:1px solid var(--border);
}
nav.shrink{padding:.55rem 1.25rem}
nav .logo{
  font-family:var(--mono);font-size:.95rem;font-weight:600;
  color:var(--text);letter-spacing:-.01em;white-space:nowrap;z-index:202;position:relative;
}
nav .logo span{color:var(--accent)}
.nav-actions{display:flex;align-items:center;gap:.5rem;z-index:202;position:relative}
.theme-btn{
  background:var(--card-bg);border:1px solid var(--border);color:var(--text);
  width:40px;height:40px;border-radius:10px;cursor:pointer;font-size:1.05rem;line-height:1;
  display:inline-flex;align-items:center;justify-content:center;transition:all .2s;
}
.theme-btn:hover{border-color:var(--accent);color:var(--accent)}
/* Desktop links live INSIDE nav: logo | links | actions */
nav .links{list-style:none;margin:0;padding:0;position:relative;z-index:202}
nav .links li{list-style:none}
@media(min-width:901px){
  nav{display:flex;align-items:center;gap:1.5rem}
  nav .logo{flex-shrink:0}
  nav .links{display:flex;gap:1.3rem;align-items:center;flex:1;justify-content:center;min-width:0}
  nav .nav-actions{flex-shrink:0;margin-left:auto}
}
nav .links a{
  font-family:var(--mono);font-size:.72rem;
  text-transform:uppercase;letter-spacing:.08em;
  color:var(--text-muted);font-weight:500;
  transition:color .2s;white-space:nowrap;
}
nav .links a:hover{color:var(--accent);text-decoration:none}
nav .links a::before{content:'// ';color:var(--border)}
nav .menu-btn{display:none;background:var(--card-bg);border:1px solid var(--border);cursor:pointer;padding:.55rem .6rem;border-radius:10px;line-height:0;min-width:40px;min-height:40px;flex-direction:column;align-items:center;justify-content:center}
nav .menu-btn span{display:block;width:20px;height:2px;background:var(--text);margin:2.5px 0;transition:all .25s;border-radius:1px}
nav .menu-btn.open span:nth-child(1){transform:translateY(7px) rotate(45deg)}
nav .menu-btn.open span:nth-child(2){opacity:0}
nav .menu-btn.open span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}
.nav-overlay{
  position:fixed;inset:0;z-index:150;background:rgba(10,15,25,.5);
  opacity:0;visibility:hidden;transition:opacity .28s,visibility .28s;
}
.nav-overlay.show{opacity:1;visibility:visible}

/* ─── HERO ─── */
.hero{
  min-height:92vh;
  display:flex;flex-direction:column;justify-content:center;
  padding:6.5rem 1.25rem 3rem;
  max-width:1100px;margin:0 auto;
  position:relative;
}
.hero::before{
  content:'';position:absolute;top:0;left:1.25rem;
  width:1px;height:90px;
  background:linear-gradient(to bottom,transparent,var(--border));
}
.hero-tag{
  font-family:var(--mono);font-size:.78rem;color:var(--accent);
  margin-bottom:1.2rem;display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;
}
.hero-tag::before{content:'';width:8px;height:8px;background:var(--accent);border-radius:50%;animation:pulse 2s infinite;flex-shrink:0}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.3}}

.hero h1{
  font-family:var(--sans);font-size:clamp(2.4rem,9vw,4.6rem);
  font-weight:300;line-height:1.05;letter-spacing:-.04em;
  margin-bottom:1rem;word-wrap:break-word;
}
.hero h1 strong{font-weight:600;color:var(--accent)}
.hero-sub{
  font-size:1.02rem;color:var(--text-muted);
  max-width:52ch;line-height:1.7;margin-bottom:2rem;
}

.hero-stats{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
  border:1px solid var(--border);border-radius:var(--radius);
  overflow:hidden;width:100%;max-width:860px;background:var(--card-bg);
}
.hero-stats .stat{
  padding:1rem 1.2rem;
  border-right:1px solid var(--border);min-width:0;
}
.hero-stats .stat:last-child{border-right:none}
.hero-stats .stat-label{
  font-family:var(--mono);font-size:.62rem;
  text-transform:uppercase;letter-spacing:.1em;
  color:var(--text-muted);margin-bottom:.3rem;
}
.hero-stats .stat-value{
  font-family:var(--mono);font-size:.9rem;font-weight:600;word-break:break-word;
}

/* ─── SECTIONS ─── */
section{
  padding:3.5rem 1.25rem;
  max-width:1100px;margin:0 auto;
  position:relative;
}
section+section::before{
  content:'';display:block;
  width:40px;height:2px;
  background:var(--border);
  margin-bottom:2.5rem;
}

.section-head{
  display:flex;align-items:center;gap:.8rem;flex-wrap:wrap;
  margin-bottom:1.8rem;
}
.section-num{
  font-family:var(--mono);font-size:.72rem;
  color:var(--accent);font-weight:600;
  padding:.3rem .7rem;
  border:1px solid var(--border);
  border-radius:999px;
  background:var(--accent-dim);
}
.section-title{
  font-family:var(--sans);font-size:1.5rem;
  font-weight:600;letter-spacing:-.02em;
}

/* ─── ABOUT ─── */
.about-grid{display:grid;grid-template-columns:250px 1fr;gap:2rem;align-items:start}
.about-avatar{
  aspect-ratio:3/4;background:var(--bg-raised);
  border:1px solid var(--border);border-radius:var(--radius);
  display:flex;align-items:center;justify-content:center;
  font-family:var(--mono);font-size:2.5rem;font-weight:600;
  color:var(--accent);position:relative;overflow:hidden;
  width:100%;max-width:260px;
}
.about-avatar img{
  width:100%;height:100%;object-fit:cover;object-position:top center;
  display:block;position:relative;z-index:1;
}
.about-avatar::after{
  content:'';position:absolute;bottom:0;left:0;right:0;height:28%;
  background:linear-gradient(to top,var(--avatar-overlay),transparent);
  z-index:2;pointer-events:none;
}
.about-avatar .initials{position:relative;z-index:1}
.about-text p{margin-bottom:1.1rem;max-width:var(--measure);color:var(--text-muted);font-size:.96rem}
.about-text p:first-child{color:var(--text);font-size:1rem}

/* ─── EDUCATION ─── */
.timeline{position:relative;padding-left:1.4rem}
.timeline::before{
  content:'';position:absolute;left:0;top:0;bottom:0;
  width:2px;background:var(--border);border-radius:2px;
}
.edu-item{
  position:relative;padding:1.2rem 0 1.2rem 1.2rem;
}
.edu-item::before{
  content:'';position:absolute;left:-1.4rem;top:1.65rem;
  width:10px;height:10px;border-radius:50%;
  border:2px solid var(--accent);background:var(--card-bg);
  transform:translateX(-4px);
}
.edu-item:first-child::before{background:var(--accent)}
.edu-item+.edu-item{border-top:1px solid var(--border)}
.edu-meta{
  font-family:var(--mono);font-size:.7rem;
  color:var(--accent);letter-spacing:.06em;font-weight:600;
  margin-bottom:.4rem;
}
.edu-body h3{font-size:1.1rem;font-weight:600;margin-bottom:.2rem;line-height:1.35}
.edu-body .institution{font-size:.88rem;color:var(--text-muted);margin-bottom:.45rem}
.edu-body p{font-size:.9rem;color:var(--text-muted);max-width:var(--measure)}

/* ─── RESEARCH ─── */
.research-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1rem}
.research-card{
  padding:1.4rem;
  background:var(--card-bg);
  border:1px solid var(--border);
  border-radius:var(--radius);
  transition:border-color .25s,transform .25s ease-out,box-shadow .25s;
  box-shadow:var(--shadow);
  min-width:0;
}
.research-card:hover{border-color:var(--accent);transform:translateY(-2px);box-shadow:var(--shadow-hover)}
.research-card .tag{
  display:inline-block;
  font-family:var(--mono);font-size:.62rem;
  text-transform:uppercase;letter-spacing:.08em;
  color:var(--accent);font-weight:600;
  padding:.2rem .55rem;
  background:var(--accent-dim);
  border-radius:999px;
  margin-bottom:.7rem;
}
.research-card h3{font-size:1rem;font-weight:600;margin-bottom:.5rem;line-height:1.4;overflow-wrap:break-word}
.research-card p{font-size:.86rem;color:var(--text-muted);line-height:1.6;overflow-wrap:break-word}
.orcid-link{margin-top:1.2rem;font-size:.86rem;color:var(--text-muted)}

/* ─── SKILLS ─── */
.skills-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:.6rem}
.skill-chip{
  font-family:var(--mono);font-size:.76rem;
  padding:.55rem .85rem;
  border:1px solid var(--border);
  border-radius:999px;
  color:var(--text-muted);background:var(--card-bg);
  transition:all .2s;
  display:flex;align-items:center;gap:.5rem;min-width:0;
}
.skill-chip::before{content:'▸';color:var(--border);font-size:.7rem;transition:color .2s;flex-shrink:0}
.skill-chip:hover{border-color:var(--accent);color:var(--text)}
.skill-chip:hover::before{color:var(--accent)}

/* ─── PUBLICATIONS ─── */
.pub-item{
  padding:1.2rem 0;
  border-bottom:1px solid var(--border);
}
.pub-item:last-child{border-bottom:none}
.pub-item .pub-type{
  font-family:var(--mono);font-size:.62rem;
  text-transform:uppercase;letter-spacing:.08em;
  color:var(--accent);margin-bottom:.35rem;font-weight:600;
}
.pub-item h3{font-size:.98rem;font-weight:600;margin-bottom:.3rem;line-height:1.45;overflow-wrap:break-word}
.pub-item h3 a{color:var(--text)}
.pub-item h3 a:hover{color:var(--accent)}
.pub-item .pub-meta{font-size:.82rem;color:var(--text-muted);overflow-wrap:break-word}

/* ─── LECTURES ─── */
.lectures-cta{
  display:flex;align-items:center;gap:1.5rem;
  padding:1.5rem;
  background:var(--bg-raised);
  border:1px solid var(--border);
  border-radius:var(--radius);
  transition:border-color .25s;
}
.lectures-cta:hover{border-color:var(--accent)}
.lectures-cta .lectures-icon{
  flex-shrink:0;width:56px;height:56px;
  display:flex;align-items:center;justify-content:center;
  font-size:1.6rem;color:var(--accent);
  background:var(--accent-dim);
  border-radius:12px;
}
.lectures-cta .lectures-text{min-width:0}
.lectures-cta .lectures-text h3{
  font-size:1.05rem;font-weight:600;margin-bottom:.35rem;
}
.lectures-cta .lectures-text p{
  font-size:.88rem;color:var(--text-muted);margin-bottom:.9rem;max-width:48ch;
}
.lectures-cta .lectures-link{
  font-family:var(--mono);font-size:.78rem;font-weight:600;
  padding:.6rem 1.2rem;
  border:1px solid var(--accent);
  border-radius:999px;
  color:var(--accent);
  transition:all .2s;
  display:inline-block;background:var(--card-bg);
}
.lectures-cta .lectures-link:hover{
  background:var(--accent);color:#fff;text-decoration:none;
}

/* ─── CONTACT ─── */
.contact-links{display:flex;gap:.65rem;flex-wrap:wrap}
.contact-link{
  font-family:var(--mono);font-size:.8rem;font-weight:500;
  padding:.65rem 1.1rem;
  border:1px solid var(--border);
  border-radius:999px;
  color:var(--text-muted);background:var(--card-bg);
  transition:all .2s;
}
.contact-link:hover{border-color:var(--accent);color:var(--accent);text-decoration:none;background:var(--accent-dim)}

/* ─── FOOTER ─── */
footer{
  padding:2rem 1.25rem calc(2rem + env(safe-area-inset-bottom));text-align:center;
  border-top:1px solid var(--border);
  font-family:var(--mono);font-size:.72rem;
  color:var(--text-muted);letter-spacing:.02em;
  margin-top:2rem;background:var(--bg-raised);
}

/* ─── RESPONSIVE ─── */
@media(max-width:900px){
  nav{padding:.7rem 1rem}
  .nav-actions{gap:.4rem}
  .theme-btn{width:44px;height:44px}
  /* Dropdown panel below the fixed nav — inside nav but fixed to viewport */
  nav .links{
    position:fixed;top:64px;left:12px;right:12px;z-index:300;
    display:flex;flex-direction:column;align-items:stretch;
    background:var(--card-bg);
    border:1px solid var(--border);border-radius:14px;
    padding:.5rem;gap:0;
    box-shadow:0 18px 50px rgba(0,0,0,.25);
    overflow-y:auto;-webkit-overflow-scrolling:touch;max-height:calc(100vh - 90px);
    opacity:0;visibility:hidden;transform:translateY(-10px);
    transition:opacity .22s ease,transform .22s ease,visibility .22s;
  }
  nav .links.open{opacity:1;visibility:visible;transform:translateY(0)}
  nav .links li{width:100%}
  nav .links a{
    display:block;width:100%;padding:.9rem .8rem;font-size:.88rem;font-weight:600;
    color:var(--text);border-radius:10px;white-space:normal;
  }
  nav .links a:hover{background:var(--accent-dim)}
  nav .links a::before{content:'// ';color:var(--accent)}
  nav .links li+li{border-top:1px solid var(--border)}
  nav .menu-btn{display:inline-flex;align-items:center;justify-content:center;flex-direction:column;z-index:202;min-width:44px;min-height:44px}
  .nav-overlay.show{opacity:1;visibility:visible}
  .hero{padding:5.5rem 1rem 2.5rem;min-height:auto}
  .hero::before{left:1rem;height:60px}
  .hero h1{font-size:clamp(2.1rem,11vw,3rem)}
  .hero-sub{font-size:.96rem;margin-bottom:1.6rem}
  section{padding:2.5rem 1rem}
  .about-grid{grid-template-columns:1fr;gap:1.4rem}
  .about-avatar{max-width:200px;aspect-ratio:3/4}
  .hero-stats{grid-template-columns:1fr 1fr;width:100%}
  .hero-stats .stat{padding:.85rem .95rem;border-right:none;border-bottom:1px solid var(--border)}
  .hero-stats .stat:nth-child(odd){border-right:1px solid var(--border)}
  .hero-stats .stat:nth-last-child(-n+2){border-bottom:none}
  .hero-stats .stat-value{font-size:.82rem}
  .research-grid{grid-template-columns:1fr}
  .skills-grid{grid-template-columns:1fr 1fr}
  .timeline{padding-left:1.2rem}
  .edu-item{padding-left:1rem}
  .edu-item::before{left:-1.2rem}
  .lectures-cta{flex-direction:column;gap:1rem;text-align:center;align-items:center}
  .lectures-cta .lectures-text p{max-width:100%}
  .contact-link{flex:1 1 auto;text-align:center;min-height:44px;display:inline-flex;align-items:center;justify-content:center}
}

@media(max-width:420px){
  html{font-size:15px}
  .hero-stats{grid-template-columns:1fr}
  .hero-stats .stat:nth-child(odd){border-right:none}
  .hero-stats .stat{border-bottom:1px solid var(--border)}
  .hero-stats .stat:last-child{border-bottom:none}
  .skills-grid{grid-template-columns:1fr}
  .research-card{padding:1.15rem}
  .lectures-cta{padding:1.15rem}
  section+section::before{margin-bottom:1.8rem}
}