:root {
  --primary: #f1f5f9;
  --secondary: #94a3b8;
  --accent: #8b5cf6;
  --hover: #7c3aed;
  --background: #0f0f15;
  --card: #1a1a2e;
  --border: #2d3748;
  --nav-h: 64px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--background);
  color: var(--primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; padding-top: var(--nav-h); }

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--hover); }

h1, h2, h3 { line-height: 1.25; margin: 0; }

img { max-width: 100%; display: block; }

.container { max-width: 1152px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 896px; }
.center { text-align: center; }
.muted { color: var(--secondary); }
.small { font-size: .875rem; }
.accent { color: var(--accent); }
.icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--accent); }
.icon-lg { width: 24px; height: 24px; color: #fff; }
.ext { font-size: .75rem; opacity: .7; }

@media (min-width: 640px) { .container { padding: 0 24px; } }
@media (min-width: 1024px) { .container { padding: 0 32px; } }

/* ---------- Navbar ---------- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; min-height: var(--nav-h); flex-wrap: wrap; }
.brand { color: var(--primary); font-weight: 600; font-size: 1.05rem; }
.brand:hover { color: var(--primary); }

.nav-links { display: flex; gap: 32px; }
.nav-links a {
  color: var(--primary); font-weight: 500; font-size: .875rem;
  position: relative; padding: 4px 0;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 0;
  background: var(--accent); transition: width .2s;
}
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { width: 100%; }

.menu-btn {
  display: none; background: none; border: 0; cursor: pointer;
  width: 32px; height: 32px; padding: 4px; flex-direction: column; justify-content: center; gap: 6px;
}
.menu-btn span { display: block; height: 2px; width: 24px; background: var(--primary); transition: transform .3s, opacity .3s; }
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 767px) {
  .menu-btn { display: flex; }
  .nav-links {
    display: none; flex-basis: 100%; flex-direction: column; gap: 4px;
    border-top: 1px solid var(--border); padding: 12px 0 16px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 8px 16px; border-radius: 8px; }
  .nav-links a::after { display: none; }
  .nav-links a:hover, .nav-links a[aria-current="page"] { background: rgba(139, 92, 246, .12); }
}

/* ---------- Buttons ---------- */
.cta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 32px; }
.btn { display: inline-block; padding: 12px 24px; border-radius: 8px; font-weight: 500; transition: background .2s, color .2s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--hover); color: #fff; }
.btn-outline { border: 2px solid var(--border); color: var(--primary); }
.btn-outline:hover { background: var(--card); color: var(--primary); }

/* ---------- Hero ---------- */
.hero { min-height: calc(100vh - var(--nav-h)); display: flex; align-items: center; padding: 64px 0; }
.hero-inner { display: flex; flex-direction: column; align-items: center; gap: 48px; }
@media (min-width: 1024px) { .hero-inner { flex-direction: row; align-items: flex-start; } }

.profile-card {
  flex-shrink: 0; width: 100%; max-width: 320px;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px; text-align: center;
}
.avatar {
  width: 192px; height: 192px; margin: 0 auto 24px;
  border-radius: 16px; overflow: hidden; border: 4px solid var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 1.25rem; font-weight: 700; margin-bottom: 4px; }
.profile-card > p { margin: 0 0 12px; }
.profile-meta { list-style: none; padding: 0; margin: 16px 0; font-size: .875rem; }
.profile-meta li { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 8px 0; overflow-wrap: anywhere; }
.profile-meta a { color: var(--primary); }
.profile-meta a:hover { color: var(--accent); }
.profile-links { display: flex; justify-content: center; gap: 16px; padding-top: 16px; border-top: 1px solid var(--border); font-size: .875rem; }

.intro { flex: 1; max-width: 768px; font-size: 1.125rem; }
.intro p { margin: 0 0 16px; text-align: justify; }
@media (max-width: 1023px) { .intro .cta { justify-content: center; } }

/* ---------- Inner pages ---------- */
.page { padding: 48px 0 80px; }
.back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 24px; }
.back .icon { color: currentColor; }
.page-head { text-align: center; margin-bottom: 48px; }
.page-head h1 { font-size: 1.875rem; font-weight: 700; margin-bottom: 12px; }
.page-head p { font-size: 1.125rem; margin: 0; }

/* Publications */
.pub { padding-bottom: 32px; margin-bottom: 32px; border-bottom: 1px solid var(--border); }
.pub:last-child { border-bottom: 0; }
.pub-year { font-size: 1.125rem; font-weight: 600; color: var(--accent); }
.pub-authors { margin: 8px 0; }
.pub-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 8px; }
.pub p.muted { margin: 0 0 12px; }

/* Projects */
.grid { display: grid; gap: 32px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; transition: border-color .2s; }
.card:hover { border-color: var(--accent); }

.project { overflow: hidden; display: flex; flex-direction: column; }
.project-img { height: 192px; background: var(--border); overflow: hidden; }
.project-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.project:hover .project-img img { transform: scale(1.05); }
.project-body { padding: 24px; flex: 1; }
.project-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.project h3 { font-size: 1.25rem; font-weight: 400; margin-bottom: 12px; }
.project p { margin: 4px 0; color: #d1d5db; }
.badge { padding: 2px 10px; border-radius: 999px; font-size: .75rem; color: #fff; background: #22c55e; }
.badge.completed { background: #3b82f6; }
.badge.upcoming { background: #eab308; }

/* Contact */
.contact-list { display: flex; flex-direction: column; gap: 32px; max-width: 672px; margin: 0 auto; }
.contact-item { display: flex; align-items: flex-start; gap: 24px; padding: 24px; }
.contact-icon { width: 48px; height: 48px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.contact-item h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 8px; }
.contact-item p { margin: 0; }
.contact-item .muted { margin-top: 8px; }
.big { font-size: 1.125rem; color: var(--primary); overflow-wrap: anywhere; }
a.big:hover { color: var(--hover); }
h2.center { font-size: 1.5rem; font-weight: 600; margin: 48px 0 24px; }
.social { display: flex; justify-content: center; gap: 24px; }
.social a {
  width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; color: var(--primary);
  transition: background .2s, color .2s;
}
.social a:hover { background: var(--accent); color: #fff; }
.social svg { width: 28px; height: 28px; }

/* 404 */
.notfound { min-height: calc(100vh - var(--nav-h) - 80px); display: flex; align-items: center; }
.big404 { font-size: 8rem; font-weight: 700; opacity: .2; margin: 0; line-height: 1; }
.notfound h1 { font-size: 2.25rem; margin: 16px 0; }
.center-row { justify-content: center; }

/* ---------- Footer ---------- */
.footer { background: var(--card); border-top: 1px solid var(--border); text-align: center; padding: 24px 16px; }
.footer p { margin: 0; color: var(--secondary); font-size: .875rem; }
