/* ---------- Theme tokens ---------- */
:root {
  --bg: #ffffff;
  --surface: #f7f7f8;
  --border: #e4e4e7;
  --text: #18181b;
  --muted: #5f5f6b;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --tag-bg: #eef2ff;
  --tag-text: #3730a3;
  --radius: 10px;
  --max: 880px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e11;
    --surface: #17171c;
    --border: #2a2a31;
    --text: #ececf1;
    --muted: #a0a0ab;
    --accent: #6d9bff;
    --accent-text: #0e0e11;
    --tag-bg: #1e2338;
    --tag-text: #b9c8ff;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e0e11;
  --surface: #17171c;
  --border: #2a2a31;
  --text: #ececf1;
  --muted: #a0a0ab;
  --accent: #6d9bff;
  --accent-text: #0e0e11;
  --tag-bg: #1e2338;
  --tag-text: #b9c8ff;
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, p { margin: 0; }

main, .nav__inner, .footer {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}

.nav__brand { font-weight: 700; color: var(--text); white-space: nowrap; }
.nav__brand:hover { text-decoration: none; }

.nav__links { display: flex; gap: 20px; margin-right: auto; }
.nav__links a { color: var(--muted); font-size: 15px; font-weight: 500; }
.nav__links a:hover { color: var(--text); text-decoration: none; }

.nav__actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ---------- Buttons & tags ---------- */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  background: var(--bg);
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--sm { padding: 6px 12px; font-size: 14px; }

.links { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 12px 0 0; list-style: none; }
.tags li {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 13px;
  font-weight: 500;
}

/* ---------- Hero ---------- */
.hero { padding: 72px 0 56px; }
.hero__photo { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; margin-bottom: 24px; }
.hero__status { color: var(--accent); font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.hero__name { font-size: clamp(36px, 7vw, 52px); line-height: 1.1; letter-spacing: -0.02em; }
.hero__headline { font-size: clamp(20px, 3.5vw, 24px); color: var(--muted); margin: 8px 0 20px; font-weight: 500; }
.hero__intro { max-width: 620px; margin-bottom: 28px; font-size: 17px; }

/* ---------- Sections ---------- */
.section { padding: 48px 0; border-top: 1px solid var(--border); }
.section__title { font-size: 26px; letter-spacing: -0.01em; margin-bottom: 28px; }
.section__title--sub { margin-top: 48px; font-size: 20px; }

/* Timeline (experience, education) */
.timeline { list-style: none; margin: 0; padding: 0 0 0 20px; border-left: 2px solid var(--border); }
.timeline__item { position: relative; padding-bottom: 32px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.entry__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; align-items: baseline; }
.entry__title { font-size: 17px; font-weight: 600; }
.entry__org { color: var(--muted); font-weight: 500; }
.entry__dates { color: var(--muted); font-size: 14px; white-space: nowrap; }
.entry__sub { margin-top: 4px; }
.entry__note { margin-top: 4px; color: var(--muted); font-size: 14px; }
.entry__bullets { margin: 8px 0 0; padding-left: 18px; }
.entry__bullets li { margin-top: 4px; }

/* Project cards */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.card__image { width: calc(100% + 40px); margin: -20px -20px 16px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; }
.card__head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.card__title { font-size: 17px; font-weight: 600; }
.card__year { color: var(--muted); font-size: 14px; }
.card__body { margin-top: 8px; color: var(--muted); font-size: 15px; flex: 1; }
.card__body p { margin: 0; }
.card__links { display: flex; gap: 16px; margin-top: 14px; font-size: 14px; font-weight: 500; }

/* Research */
.pubs { margin: 0; padding-left: 20px; }
.pubs li + li { margin-top: 16px; }
.pubs__title { font-weight: 600; }
.pubs__meta { color: var(--muted); font-size: 15px; }

/* Skills */
.skills { margin: 0; }
.skills__row { display: grid; grid-template-columns: 160px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.skills__row:last-child { border-bottom: 0; }
.skills dt { font-weight: 600; font-size: 15px; padding-top: 2px; }
.skills dd { margin: 0; }
.skills .tags { margin-top: 0; }

/* Contact & footer */
.contact p { margin-bottom: 20px; max-width: 620px; }
.footer { padding-top: 32px; padding-bottom: 40px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--border); }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .nav__links { display: none; }
  .nav__brand { margin-right: auto; }
  .grid { grid-template-columns: 1fr; }
  .skills__row { grid-template-columns: 1fr; gap: 8px; }
  .hero { padding: 48px 0 40px; }
}
