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

:root {
  --bg:      #0d1117;
  --surface: #161b22;
  --surface2: #1c2128;
  --text:    #e6edf3;
  --muted:   #8b949e;
  --accent:  #58a6ff;
  --border:  #21262d;
  --warm:    #e3b341;
  --mono: 'JetBrains Mono', 'Fira Mono', 'Courier New', monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --radius: 8px;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  min-height: 100vh;
}

/* ── NAV ── */
nav {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-name {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.nav-links { display: flex; gap: 1.75rem; list-style: none; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  transition: color 0.15s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); }

/* ── LAYOUT ── */
.page-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

/* ── SECTION ── */
.section { margin-bottom: 2.5rem; }
.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.section-header h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
}
.section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── PROFILE HEADER ── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-bottom: 1.75rem;
}
.profile-avatar {
  width: 150px; height: 150px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 1.8rem;
  color: var(--accent);
  object-fit: cover;
  flex-shrink: 0;
}
img.profile-avatar { background: none; }
.profile-name {
  font-size: 1.7rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.profile-role {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
  line-height: 1.4;
}
.profile-role strong { color: var(--accent); font-weight: 500; }
.profile-links { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 0.1rem; }
.profile-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  transition: all 0.15s;
}
.profile-links a:hover { color: var(--text); background: var(--surface2); }
.profile-links .link-icon {
  font-size: 1rem;
  flex: 0 0 1.1rem;
  width: 1.1rem;
  text-align: center;
  overflow: hidden;
}

/* ── BIO ── */
.bio p { font-size: 0.975rem; color: #c9d1d9; margin-bottom: 1rem; }
.bio a { color: var(--accent); text-decoration: none; }
.bio a:hover { text-decoration: underline; }

/* ── RESEARCH TABLE ── */
.research-grid {
  display: grid;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border);
}
.research-row {
  background: var(--surface);
  padding: 1.2rem 1.4rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
  transition: background 0.15s;
}
.research-row.has-image { grid-template-columns: auto 1fr auto; }
.row-img {
  width: 110px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.row-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.research-row:hover { background: var(--surface2); }
.row-num {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
  opacity: 0.7;
}
.row-title {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  line-height: 1.35;
}
.row-title a { color: var(--text); text-decoration: none; }
.row-title a:hover { color: var(--accent); }
.row-venue {
  font-size: 0.78rem;
  color: var(--muted);
}
.row-venue em { color: var(--accent); font-style: normal; opacity: 0.85; }
.row-desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.55;
  margin-top: 0.5rem;
}
.row-meta { text-align: right; }
.row-year {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.row-award {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: var(--warm);
}
.row-links {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.5rem;
  align-items: flex-end;
}
.row-links a {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.row-links a:hover { color: var(--accent); }

/* ── FEATURED RESEARCH (about page) ── */
.featured-row {
  background: var(--surface);
  padding: 1.2rem 1.4rem;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.25rem;
  align-items: start;
  transition: background 0.15s;
}
.featured-row:hover { background: var(--surface2); }
.featured-row .row-img {
  width: 300px;
  height: 190px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface2);
}
.featured-row .row-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.featured-row .row-venue { margin-bottom: 0.5rem; }
.featured-row .row-desc { font-size: 0.82rem; color: var(--muted); line-height: 1.55; margin-bottom: 0.6rem; }
.featured-row .row-links { flex-direction: row; gap: 0.75rem; }

/* ── BOOK GRID ── */
.book-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 1.5rem;
}
.book-item {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}
.book-item em { color: var(--text); font-style: italic; }
.book-item small { display: block; font-size: 0.75rem; }

/* ── BLOG LIST ── */
.post-list { list-style: none; }
.post-item {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.post-item:first-child { border-top: 1px solid var(--border); }
.post-title {
  font-size: 0.95rem;
  font-weight: 500;
}
.post-title a { color: var(--text); text-decoration: none; }
.post-title a:hover { color: var(--accent); }
.post-date {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── PROSE (blog posts) ── */
.prose { font-size: 0.975rem; color: #c9d1d9; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); }
.prose h1, .prose h2, .prose h3 {
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
  margin: 2rem 0 0.75rem;
}
.prose h1 { font-size: 1.5rem; margin-top: 0; }
.prose h2 { font-size: 1.1rem; }
.prose h3 { font-size: 0.95rem; }
.prose p { margin-bottom: 1rem; }
.prose a { color: var(--accent); text-decoration: none; }
.prose a:hover { text-decoration: underline; }
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.prose li { margin-bottom: 0.3rem; }
.prose blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  color: var(--muted);
  margin: 1rem 0;
}
.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent);
}
.prose pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}
.prose pre code { background: none; padding: 0; }
.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.post-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.post-header h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.5rem; }
.post-header .post-date { display: block; margin-top: 0.25rem; }
.research-page-meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 0.35rem; }
.research-page-meta .post-date { margin-top: 0; }
.research-page-venue { font-size: 0.85rem; color: var(--accent); opacity: 0.85; }
.research-page-links { margin-top: 0.75rem; }
.research-page-links a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.82rem; color: var(--muted); text-decoration: none;
  padding: 0.3rem 0.7rem; border: 1px solid var(--border);
  border-radius: 5px; transition: all 0.15s;
}
.research-page-links a:hover { color: var(--text); border-color: var(--accent); }
.research-page-citation p { font-size: 0.85rem; color: var(--muted); font-style: italic; }

/* ── FOOTER ── */
footer {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

/* ── RESPONSIVE ── */
@media (max-width: 540px) {
  .profile-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .profile-avatar { width: 80px; height: 80px; }
  .book-grid { grid-template-columns: 1fr; }
  .post-item { flex-direction: column; gap: 0.2rem; }
  .featured-row { grid-template-columns: 1fr; }
  .featured-row .row-img { width: 100%; height: 180px; }
}
