:root{
  --text: #111;
  --muted: #444;
  --faint: #666;
  --line: #e7e7e7;
  --bg: #fff;
  --soft: #fafafa;
  --accent: #0b5fff;
  --accent2: #0a3fb8;
  --maxw: 980px;
  --radius: 10px;
}
/* Dark theme */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --text: #e8e8e8; --muted: #a0a0a0; --faint: #8a8a8a;
    --line: #2a2a2a; --bg: #111; --soft: #1c1c1c;
    --accent: #5b9bff; --accent2: #89b8ff;
  }
}
html[data-theme="dark"] {
  --text: #e8e8e8; --muted: #a0a0a0; --faint: #8a8a8a;
  --line: #2a2a2a; --bg: #111; --soft: #1c1c1c;
  --accent: #5b9bff; --accent2: #89b8ff;
}
*{ box-sizing: border-box; margin:0; padding:0; }
html{ scroll-behavior: smooth; }
body{
  font-family: "Roboto", system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  transition: background 0.2s, color 0.2s;
}
a{ color: var(--accent); text-decoration: none; }
a:hover{ color: var(--accent2); text-decoration: underline; }

/* Accessibility helpers */
.skip-link{
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  z-index: 1100;
  transition: top 0.15s;
}
.skip-link:focus{
  top: 12px;
  text-decoration: none;
  color: #fff;
}
:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Navbar */
.navbar{
  position: sticky;
  top: 0;
  z-index: 999;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  transition: background 0.2s, border-color 0.2s;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .navbar { background: rgba(17,17,17,0.92); }
}
html[data-theme="dark"] .navbar { background: rgba(17,17,17,0.92); }
.navbar-inner{
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  gap: 12px;
}
.nav-left a{
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.2px;
  text-decoration: none;
}
.nav-right-group{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-right{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}
.nav-right a{
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 8px;
}
.nav-right a:hover{
  background: var(--soft);
  color: var(--text);
  text-decoration: none;
}
.nav-right a.active{
  color: var(--text);
  background: var(--soft);
  font-weight: 600;
}
.theme-btn, .nav-toggle{
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.theme-btn:hover, .nav-toggle:hover{ background: var(--soft); color: var(--text); }
.nav-toggle{ display: none; }

/* Layout */
.container{
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 14px 40px;
}
.section{
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 68px;
}
.section:last-child{ border-bottom: none; }
.section-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
h1{
  font-size: 30px;
  line-height: 1.15;
  margin-bottom: 6px;
}
h2{
  font-size: 22px;
  margin-bottom: 12px;
}
p{ margin: 10px 0; color: var(--muted); }
.small{ color: var(--faint); font-size: 14px; }
.subtitle{ color: var(--faint); font-size: 14px; margin: -8px 0 14px; }

/* Hero */
.hero{
  display: grid;
  grid-template-columns: 30% 1fr;
  gap: 28px;
  align-items: center;
}
.pfp{
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  object-fit: cover;
  object-position: center top;
  border: 1px solid var(--line);
  background: var(--soft);
}
.hero-meta{
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hero-meta p{
  margin: 0;
  color: var(--muted);
  text-align: justify;
}
.role{
  font-weight: 500;
  color: var(--muted);
}
.role .sep{
  color: var(--faint);
  margin: 0 6px;
}
.buttons{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.btn:hover{
  background: var(--soft);
  text-decoration: none;
  border-color: var(--faint);
}
.btn:active{ transform: translateY(1px); }
.btn.btn-accent{
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.btn-accent:hover{
  background: var(--accent2);
  border-color: var(--accent2);
}

/* Lists */
ul{ margin: 10px 0 0 18px; }
li{ margin: 6px 0; color: var(--muted); }

/* Publications table-ish layout */
.pubs{
  display: grid;
  gap: 14px;
}
.pub{
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pub:hover{
  border-color: var(--faint);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.pub img{
  width: 170px;
  height: 110px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 4px;
}
.pub-title{
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 4px;
}
.pub-authors{
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
}
.pub-venue{
  font-size: 14px;
  color: var(--faint);
  margin-bottom: 8px;
}
.linkbar{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
  font-size: 14px;
}
.pill{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}
.pill:hover{ text-decoration: none; background: var(--line); }

.view-all{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-weight: 600;
  font-size: 14px;
}
.view-all i{ transition: transform 0.15s; }
.view-all:hover i{ transform: translateX(3px); }

/* Projects */
.projects-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.project-card{
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.project-icon{
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 15px;
}
.project-title{
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.project-desc{
  font-size: 13.5px;
  color: var(--faint);
  margin: 0;
}
.tag{
  display: inline-flex;
  width: fit-content;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.project-card .tag{
  margin-top: auto;
}
.project-meta{
  font-size: 12.5px;
  color: var(--faint);
  font-weight: 600;
}

.aside-note{
  margin-top: 14px;
  overflow: hidden;
  border-left: 3px solid var(--accent);
  background: var(--soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.aside-photo{
  display: block;
  width: 100%;
  height: auto;
}
.aside-note p{
  margin: 0;
  padding: 14px 16px;
  font-size: 14.5px;
  color: var(--muted);
}

/* Generic info/placeholder box (used by CV page) */
.info-box{
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 22px;
  text-align: center;
}
.info-box p{ margin: 8px auto; max-width: 480px; }

.cv-embed{
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cv-embed embed{ display: block; border: 0; }
@media (max-width: 640px){
  .cv-embed{ display: none; }
}

/* Footer */
footer{
  padding-top: 24px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

.bib-box {
  display: none;
  margin-top: 0.6rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  font-size: 0.85rem;
  max-width: 100%;
}

.bib-box pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre;
}

.email-reveal{
  display: inline-block;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--soft);
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0.2px;
}
.email-reveal[hidden]{
  display: none;
}

/* Responsive */
@media (max-width: 820px){
  .hero{ grid-template-columns: 1fr; }
  .pfp{ width: 160px; height: 160px; border-radius: 12px; }
  .pub{ grid-template-columns: 1fr; }
  .pub img{ width: 100%; height: 180px; }
}

@media (max-width: 700px){
  .nav-toggle{ display: inline-flex; }
  .nav-right{
    display: none;
    width: 100%;
    order: 3;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    margin-top: 10px;
  }
  .nav-right.open{ display: flex; }
  .nav-right a{ padding: 10px 8px; }
}
