:root {
  --bg: #ffffff;
  --text: #111214;
  --muted: #5b5f67;
  --faint: #8a8e96;
  --line: #e8e9ec;
  --card: #ffffff;
  --link: #2343d1;
  --chip-bg: #eef1fc;
  --chip-text: #2b3c9e;
  --award-bg: #fcf0e1;
  --award-text: #8a4a08;
  --figure-bg: #ffffff;
  --width: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f11;
    --text: #ececee;
    --muted: #a3a6ad;
    --faint: #7c8088;
    --line: #25272b;
    --card: #15161a;
    --link: #93a8ff;
    --chip-bg: #1d2340;
    --chip-text: #b9c6ff;
    --award-bg: #38270f;
    --award-text: #f2c48a;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.top, main, .foot {
  max-width: var(--width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 28px;
  font-size: 15px;
}
.top-name { color: var(--text); font-weight: 600; }
.top-nav { display: flex; gap: 20px; }
.top-nav a { color: var(--muted); }
.top-nav a:hover { color: var(--text); text-decoration: none; }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
  align-items: start;
  padding: 72px 0 24px;
}
.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(34px, 6vw, 48px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.bio { margin: 0 0 20px; color: var(--muted); font-size: 17px; }
.bio a { color: var(--text); font-weight: 500; }
.links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; list-style: none; font-weight: 500; }
.photo {
  width: 132px;
  height: 132px;
  border-radius: 20px;
  object-fit: cover;
  margin-top: 8px;
}

/* Sections */
.section { padding-top: 56px; }
.section h2 {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

/* Paper cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--faint); transform: translateY(-2px); }
.card-img { display: block; aspect-ratio: 16 / 10; background: var(--figure-bg); border-bottom: 1px solid var(--line); }
.card-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card h3 { margin: 10px 0 6px; font-size: 17px; font-weight: 600; line-height: 1.3; }
.card h3 a { color: var(--text); }
.card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; }
.card .card-links { margin-top: auto; padding-top: 12px; display: flex; gap: 14px; font-size: 14px; font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}
.chip-award { background: var(--award-bg); color: var(--award-text); }

/* Rows: experience, publications, news */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.row:last-child { border-bottom: 1px solid var(--line); }
.row-date { color: var(--faint); font-size: 14px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.row-main { font-size: 15px; }
.row-title { font-weight: 500; line-height: 1.4; }
.row-title a { color: var(--text); }
.row-role { color: var(--muted); font-weight: 400; }
.row-role::before { content: "·"; margin: 0 8px; color: var(--faint); }
.row-sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.row-sub .me { color: var(--text); font-weight: 500; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; font-size: 14px; font-weight: 500; }
.row-meta .chip + a { margin-left: 2px; }
.row-place { color: var(--faint); font-size: 14px; }

/* Footer */
.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 64px;
  padding-bottom: 40px;
  color: var(--faint);
  font-size: 13px;
}

/* 404 */
.notfound { padding: 96px 0 24px; }
.notfound h1 { margin: 0 0 12px; font-size: 32px; font-weight: 600; letter-spacing: -0.02em; }
.notfound p { color: var(--muted); }

@media (max-width: 640px) {
  .top, main, .foot { padding: 0 16px; }
  .top { padding-top: 20px; }
  .top-nav { gap: 14px; }
  .top-nav a:nth-child(3) { display: none; }
  .hero { grid-template-columns: 1fr; gap: 20px; padding-top: 40px; }
  .photo { order: -1; width: 88px; height: 88px; border-radius: 16px; margin: 0; }
  .bio { font-size: 16px; }
  .section { padding-top: 44px; }
  .row { grid-template-columns: 1fr; gap: 2px; }
  .row-place { display: none; }
  .foot { flex-direction: column; gap: 4px; padding-top: 48px; padding-bottom: 32px; }
}
