/* ===== Theme tokens ===== */
:root {
  --bg:           #fbfbfd;
  --bg-elev:      #ffffff;
  --bg-soft:      #f1f3f8;
  --text:         #1c2230;
  --text-soft:    #5a6275;
  --text-faint:   #8b93a7;
  --accent:       #3257d6;
  --accent-soft:  #eaeefb;
  --border:       #e5e8f0;
  --shadow:       0 1px 2px rgba(20,28,50,.05), 0 8px 24px rgba(20,28,50,.06);
  --shadow-hover: 0 4px 10px rgba(20,28,50,.08), 0 18px 40px rgba(20,28,50,.12);
  --radius:       16px;
  --radius-sm:    10px;
  --maxw:         920px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
}
html[data-theme="dark"] {
  --bg:           #0e1118;
  --bg-elev:      #161b26;
  --bg-soft:      #1c2230;
  --text:         #e8ebf2;
  --text-soft:    #a7b0c4;
  --text-faint:   #6f7892;
  --accent:       #7d97f4;
  --accent-soft:  #1e2740;
  --border:       #262d3d;
  --shadow:       0 1px 2px rgba(0,0,0,.4), 0 10px 28px rgba(0,0,0,.45);
  --shadow-hover: 0 6px 14px rgba(0,0,0,.5), 0 22px 48px rgba(0,0,0,.55);
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .3s ease, color .3s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 200;
}
.skip-link:focus { left: 0; }

/* ===== Header / Nav ===== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav-brand { font-weight: 700; font-size: 1.05rem; color: var(--text); letter-spacing: -.01em; }
.nav-brand:hover { text-decoration: none; color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  color: var(--text-soft); font-weight: 500; font-size: .92rem;
  padding: 8px 12px; border-radius: 8px; transition: background .2s, color .2s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }

.theme-toggle, .nav-toggle {
  background: none; border: 1px solid var(--border); cursor: pointer;
  border-radius: 9px; color: var(--text-soft);
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle { width: 38px; height: 38px; margin-left: 6px; transition: color .2s, border-color .2s; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; fill: currentColor; }
.icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }

.nav-toggle { display: none; width: 40px; height: 40px; flex-direction: column; gap: 4px; padding: 0; }
.nav-toggle span { width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: .25s; }

/* ===== Work-in-progress banner ===== */
.wip-banner {
  margin-top: 18px;
  display: flex; align-items: center; gap: 10px;
  background: var(--accent-soft); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: var(--radius-sm); padding: 11px 16px;
  font-size: .9rem; font-weight: 500;
}
.wip-dot {
  flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
  animation: wip-pulse 2s infinite;
}
@keyframes wip-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ===== Hero ===== */
.hero {
  display: grid; grid-template-columns: 200px 1fr; gap: 44px; align-items: start;
  padding-top: 64px; padding-bottom: 28px;
}
.hero-photo img {
  width: 200px; height: 200px; border-radius: 24px; object-fit: cover;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.hero-text h1 {
  font-family: var(--font-serif); font-weight: 600; font-size: 2.9rem;
  margin: 0 0 6px; letter-spacing: -.02em; line-height: 1.05;
}
.hero-role { font-size: 1.12rem; font-weight: 600; color: var(--text); margin: 0 0 2px; }
.hero-affil { color: var(--text-faint); font-size: .96rem; margin: 0 0 18px; }
.hero-bio { color: var(--text-soft); font-size: 1.02rem; margin: 0 0 14px; }
.hero-bio strong { color: var(--text); font-weight: 600; }

/* ===== Social links ===== */
.social { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.social-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 15px; border-radius: 999px;
  background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--text); font-size: .9rem; font-weight: 500;
  box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s, border-color .18s, color .18s;
}
.social-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); color: var(--accent); border-color: var(--accent); text-decoration: none; }
.social-link svg { width: 17px; height: 17px; fill: currentColor; }

/* ===== Sections ===== */
.section { padding-top: 52px; }
.section-title {
  font-family: var(--font-serif); font-size: 1.7rem; font-weight: 600; letter-spacing: -.01em;
  margin: 0 0 20px; padding-bottom: 10px; position: relative;
}
.section-title::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 44px; height: 3px;
  background: var(--accent); border-radius: 3px;
}
.section-note { color: var(--text-faint); font-size: .9rem; margin: -8px 0 22px; }
.section-note .star { color: var(--accent); }

/* ===== News ===== */
.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li {
  display: grid; grid-template-columns: 70px 1fr; gap: 18px; align-items: baseline;
  padding: 12px 0; border-bottom: 1px dashed var(--border);
}
.news-list li:last-child { border-bottom: none; }
.news-date { font-weight: 700; color: var(--accent); font-size: .92rem; }
.news-body { color: var(--text-soft); }
.news-body strong { color: var(--text); }

/* ===== Publications ===== */
.pubs { display: flex; flex-direction: column; gap: 18px; }
.pub {
  display: flex; gap: 22px; align-items: flex-start;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  scroll-margin-top: 90px;
}
.pub:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.pub-thumb {
  flex: 0 0 240px; width: 240px; height: 150px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 8px;
}
.pub-thumb img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; transition: transform .35s ease; }
.pub-thumb:hover img { transform: scale(1.03); }
.pub-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.pub-venue {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  font-size: .78rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
}
.badge {
  background: var(--accent); color: #fff; padding: 1px 7px; border-radius: 999px;
  font-size: .68rem; letter-spacing: .04em;
}
.pub-title { font-size: 1.08rem; font-weight: 700; margin: 0 0 6px; line-height: 1.35; letter-spacing: -.01em; }
.pub-authors { font-size: .9rem; color: var(--text-soft); margin: 0 0 8px; }
.pub-authors strong { color: var(--text); }
.star { color: var(--accent); font-weight: 700; }
.pub-desc { font-size: .92rem; color: var(--text-faint); margin: 0 0 12px; }
.pub-links { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.pub-links a {
  font-size: .82rem; font-weight: 600; color: var(--text-soft);
  border: 1px solid var(--border); padding: 5px 13px; border-radius: 8px;
  transition: background .18s, color .18s, border-color .18s;
}
.pub-links a:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }

/* ===== More publications ===== */
.more-pubs { margin-top: 24px; }
.more-pubs summary {
  cursor: pointer; font-weight: 600; color: var(--accent); padding: 8px 0;
  list-style: none; width: max-content;
}
.more-pubs summary::-webkit-details-marker { display: none; }
.more-pubs summary::before { content: "▸ "; }
.more-pubs[open] summary::before { content: "▾ "; }
.pub-list { list-style: none; margin: 12px 0 0; padding: 0; }
.pub-list li { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.pub-list li:last-child { border-bottom: none; }
.pl-venue {
  display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 2px;
}
.pl-title { display: block; font-weight: 600; color: var(--text); }
.pl-authors { display: block; font-size: .88rem; color: var(--text-soft); }
.pl-authors strong { color: var(--text); }

/* ===== Contact ===== */
.contact-text { color: var(--text-soft); max-width: 60ch; }
.social-contact { margin-top: 16px; }

/* ===== Footer ===== */
.site-footer {
  margin-top: 72px; border-top: 1px solid var(--border);
  padding: 26px 0; background: var(--bg-elev);
}
.site-footer .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.site-footer p { margin: 0; color: var(--text-faint); font-size: .88rem; }
.to-top { font-size: .88rem; font-weight: 600; }

/* ===== Responsive ===== */
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-elev); border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px; box-shadow: var(--shadow);
    transform: translateY(-12px); opacity: 0; pointer-events: none; transition: .25s;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-links a { display: block; padding: 12px; }
  .nav-links li:last-child { display: flex; justify-content: flex-end; padding-top: 6px; }

  .hero { grid-template-columns: 1fr; gap: 22px; text-align: center; padding-top: 40px; }
  .hero-photo { margin: 0 auto; }
  .hero-bio { text-align: left; }
  .social { justify-content: center; }
  .hero-text h1 { font-size: 2.3rem; }

  .pub { flex-direction: column; }
  .pub-thumb { flex: 0 0 auto; width: 100%; height: 180px; }
  .news-list li { grid-template-columns: 56px 1fr; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
