:root {
  --bg: #fbfbf9;
  --surface: #ffffff;
  --text: #1b1d21;
  --muted: #5d6470;
  --border: #e4e2dc;
  --accent: #1f5fbf;
  --accent-soft: #e8eefa;

  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #1a1c20;
    --text: #eceef1;
    --muted: #a2a8b3;
    --border: #2c2f35;
    --accent: #7eaaf0;
    --accent-soft: #1d2a40;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 64px 20px 48px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 0; }
h1 { font-size: 2.3rem; letter-spacing: -0.01em; }
h2 {
  font-size: 1.45rem;
  margin: 56px 0 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
h3 { font-size: 1.12rem; }
h3 a { color: inherit; }

p { margin: 0 0 10px; }
.muted, .meta, .when { color: var(--muted); }
.meta { font-size: 0.92rem; margin-bottom: 8px; }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: start;
}

.avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 2.4rem var(--serif);
  letter-spacing: 0.02em;
}

.role { color: var(--muted); margin: 6px 0 14px; }
.role a { color: inherit; border-bottom: 1px solid var(--border); }
.role a:hover { text-decoration: none; border-color: var(--muted); }

.bio { font-size: 1.05rem; margin-bottom: 16px; }

.links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.links a { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.links svg { width: 18px; height: 18px; }

/* ---------- research ---------- */
.feature {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 24px;
}

.feature-img { display: block; background: #fff; border-bottom: 1px solid var(--border); }
.feature-img img { display: block; width: 100%; height: auto; }
.feature-body { padding: 20px 22px 18px; }
.feature-body h3 { font-size: 1.25rem; margin-bottom: 4px; }

.stats {
  list-style: none;
  padding: 0;
  margin: 16px 0 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stats li {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
}

.stats strong {
  display: block;
  font: 600 1.45rem/1.2 var(--serif);
  color: var(--accent);
}

.stats span { font-size: 0.85rem; color: var(--muted); line-height: 1.35; display: block; }

.note { font-size: 0.9rem; color: var(--muted); }

.actions { display: flex; gap: 16px; margin: 8px 0 0; font-weight: 500; font-size: 0.95rem; }
.actions a::after { content: " →"; }

.item { margin-bottom: 24px; }
.item h3 { margin-bottom: 2px; }

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

.card {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.card h3 { margin-bottom: 8px; }
.card p { font-size: 0.95rem; }
.card .actions { margin-top: auto; padding-top: 6px; }

.metric { color: var(--muted); }
.metric strong { color: var(--text); }

.tags { font-size: 0.85rem !important; color: var(--muted); }

/* ---------- education / experience ---------- */
.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 2px 16px;
}

.when { font-size: 0.92rem; white-space: nowrap; }
.label { font-weight: 600; }

/* ---------- skills ---------- */
.skills {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 8px 16px;
  margin: 0;
}

.skills dt { font-weight: 600; }
.skills dd { margin: 0; color: var(--muted); }

/* ---------- footer ---------- */
footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  main { padding: 40px 16px 40px; }
  .hero { grid-template-columns: 1fr; gap: 18px; }
  .avatar { width: 84px; height: 84px; font-size: 1.8rem; }
  h1 { font-size: 1.9rem; }
  h2 { margin-top: 44px; }
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .stats li { display: flex; align-items: baseline; gap: 10px; }
  .stats strong { display: inline; font-size: 1.25rem; }
  .skills { grid-template-columns: 1fr; gap: 2px; }
  .skills dd { margin-bottom: 10px; }
}
