:root {
  --bg: #ffffff;
  --fg: #111827;
  --muted: #6b7280;
  --accent: #4338ca;
  --accent-light: #eef2ff;
  --border: #f3f4f6;
  --max-width: 740px;
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  padding: 0 1.5rem;
}

/* ── Navigation ── */
nav.site-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

nav.site-nav .site-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}

nav.site-nav .nav-links {
  display: flex;
  gap: 1.75rem;
}

nav.site-nav .nav-links a {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

nav.site-nav .nav-links a:hover,
nav.site-nav .nav-links a.active {
  color: var(--fg);
}

nav.site-nav .nav-links a.active {
  font-weight: 500;
}

/* ── Main content ── */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

/* ── Profile header (index only) ── */
.profile-header {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}

.profile-photo img {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.profile-photo .photo-placeholder {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

.profile-info h1 {
  font-size: 1.625rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: 0.2rem;
}

.profile-info .title {
  font-size: 0.9375rem;
  color: var(--muted);
  margin-bottom: 0.125rem;
}

.profile-info .institution {
  font-size: 0.9375rem;
  color: var(--muted);
  margin-bottom: 1.125rem;
}

.profile-info .bio {
  font-size: 0.9375rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
  max-width: 520px;
}

.profile-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.profile-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.profile-links a:hover {
  border-bottom-color: var(--accent);
}

/* ── Sections ── */
section {
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}

section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

h2 {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 1rem;
}

p {
  font-size: 0.9375rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

p:last-child {
  margin-bottom: 0;
}

/* ── Tags / interest chips ── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tags span {
  font-size: 0.8125rem;
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  font-weight: 500;
}

/* ── Publications list ── */
.pub-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.pub-list li {
  font-size: 0.9375rem;
  line-height: 1.6;
}

.pub-title {
  font-weight: 500;
  display: block;
  margin-bottom: 0.2rem;
}

.pub-authors {
  color: var(--muted);
  font-size: 0.875rem;
  display: block;
}

.pub-venue {
  color: var(--muted);
  font-size: 0.875rem;
  font-style: italic;
}

.pub-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  margin-right: 0.375rem;
  font-style: normal;
}

.pub-links {
  display: inline-flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.pub-links a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid currentColor;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  transition: background 0.15s, color 0.15s;
}

.pub-links a:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Posts list ── */
.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.post-list li {
  display: flex;
  gap: 1.5rem;
  align-items: baseline;
}

.post-date {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  min-width: 6rem;
}

.post-info .post-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  display: block;
  margin-bottom: 0.2rem;
}

.post-info .post-title:hover {
  color: var(--accent);
}

.post-desc {
  font-size: 0.875rem;
  color: var(--muted);
}

/* ── Page title (for non-home pages) ── */
.page-title {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

/* ── Footer ── */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--muted);
}

footer a {
  color: var(--muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--fg);
}

/* ── More link (e.g. "View all publications →") ── */
.more-link-wrap {
  margin-top: 1.25rem;
}

.more-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  transition: opacity 0.15s;
}

.more-link:hover {
  opacity: 0.75;
}

/* ── Post page ── */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 1.625rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.post-meta {
  font-size: 0.875rem;
  color: var(--muted);
}

.post-back {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 2rem;
  transition: color 0.15s;
}

.post-back:hover {
  color: var(--fg);
}

.post-body h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--fg);
  margin-top: 2rem;
  margin-bottom: 0.625rem;
}

.post-body h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.post-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.post-body a:hover {
  border-bottom-color: var(--accent);
}

.post-body code {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 0.8125em;
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.post-body pre {
  background: var(--border);
  padding: 1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.25rem 0;
}

.post-body pre code {
  background: none;
  color: var(--fg);
  padding: 0;
  font-size: 0.875rem;
}

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--muted);
  font-style: italic;
  margin: 1.25rem 0;
}

.post-body ul,
.post-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.post-body li {
  font-size: 0.9375rem;
  line-height: 1.7;
  margin-bottom: 0.25rem;
}

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111118;
    --fg: #e4e4e7;
    --muted: #8b8d98;
    --accent: #818cf8;
    --accent-light: #1e1b4b;
    --border: #27272a;
  }

  .profile-photo img {
    filter: brightness(0.9);
  }
}

/* ── Responsive ── */
@media (max-width: 540px) {
  .profile-header {
    flex-direction: column;
    gap: 1.25rem;
  }

  .profile-photo img,
  .profile-photo .photo-placeholder {
    width: 80px;
    height: 80px;
  }

  .profile-info h1 {
    font-size: 1.375rem;
  }

  .post-list li {
    flex-direction: column;
    gap: 0.25rem;
  }

  nav.site-nav .nav-links {
    gap: 1.25rem;
  }
}
