:root {
  --paper: #f4f1ea;
  --ink: #1c1916;
  --muted: #5e584f;
  --faint: #8a8378;
  --line: #ddd6c8;
  --cinnabar: #8f3428;
  --card: #fbf9f4;
  --max: 1080px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 10% -10%, #efe6d6 0%, transparent 55%),
    var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "Noto Serif SC", serif;
  font-size: 18px;
  line-height: 1.55;
}

a { color: inherit; }

a:hover { color: var(--cinnabar); }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 48px 32px 80px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 56px;
  font-family: "Avenir Next", "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar a { text-decoration: none; }

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 64px;
  align-items: start;
}

.identity { position: sticky; top: 32px; }

.portrait {
  width: 168px;
  height: 196px;
  object-fit: cover;
  object-position: center 18%;
  display: block;
  margin: 0 0 18px;
  border: 1px solid var(--line);
}

.zh-name {
  margin: 0;
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: 15px;
  letter-spacing: 0.42em;
  color: var(--cinnabar);
  font-weight: 600;
}

.alt-name {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--cinnabar);
  font-weight: 600;
}

h1.zh {
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.05;
}

h1 {
  margin: 8px 0 12px;
  font-size: 64px;
  line-height: 0.92;
  font-weight: 560;
  letter-spacing: -0.03em;
}

.lede {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 17px;
}

.links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 14px;
}

.links a { text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; }

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

.stats {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 13px;
  color: var(--muted);
}

.stats-kicker {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--cinnabar);
}

.stats strong {
  display: block;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stats span { display: block; margin-top: 4px; }

section { margin-bottom: 48px; }

.kicker {
  margin: 0 0 14px;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cinnabar);
}

h2 {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 560;
  letter-spacing: -0.02em;
}

p { margin: 0 0 12px; }

.role {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 8px 18px;
  margin: 0 0 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.role:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }

.when {
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 13px;
  color: var(--faint);
  padding-top: 4px;
}

.role h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
}

.role p { margin: 0; color: var(--muted); font-size: 16px; }

.paper {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 8px 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
}

.paper:hover .paper-title { color: var(--cinnabar); }

.cites {
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  letter-spacing: -0.03em;
  padding-top: 2px;
}

.cites small {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.paper-title { font-size: 17px; }

.meta {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 13px;
}

.note {
  margin-top: 14px;
  color: var(--faint);
  font-size: 14px;
}

.papers-label { margin: 22px 0 0; }

footer.colophon {
  margin-top: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 13px;
}

/* CV */
body.cv {
  background: white;
  font-family: "Songti SC", "Noto Serif SC", "Iowan Old Style", serif;
  font-size: 15px;
  line-height: 1.45;
  color: #1c1916;
}

body.cv .wrap { max-width: 820px; padding-top: 36px; }

body.cv .cv-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

body.cv h1.latin {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  letter-spacing: -0.03em;
  font-size: 36px;
}

body.cv .portrait {
  width: 84px;
  height: 100px;
  margin: 0 0 8px;
}

body.cv h1 {
  font-family: "Songti SC", serif;
  font-size: 40px;
  letter-spacing: 0.08em;
  margin-bottom: 0;
}

body.cv .en {
  margin: 0 0 8px;
  font-family: "Iowan Old Style", Palatino, serif;
  font-size: 18px;
  letter-spacing: 0;
  color: #5e584f;
}

body.cv .contact {
  font-family: "PingFang SC", "Avenir Next", sans-serif;
  font-size: 13px;
  color: #3f3a34;
  margin-bottom: 18px;
}

body.cv .contact a { color: #8f3428; text-decoration: none; }

body.cv h2 {
  font-family: "PingFang SC", sans-serif;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8f3428;
  border-bottom: 1px solid #ddd6c8;
  padding-bottom: 4px;
  margin: 18px 0 8px;
}

body.cv.resume h2 {
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: none;
  color: #1c1916;
  border-bottom: 1px solid #1c1916;
  padding-bottom: 2px;
  margin: 16px 0 8px;
}

body.cv .cv-name { margin-bottom: 4px; }

body.cv .cv-name h1 {
  font-size: 28px;
  letter-spacing: 0.04em;
  line-height: 1.2;
  margin: 0;
}

body.cv .cv-name h1 span {
  font-family: "Iowan Old Style", Palatino, serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0;
}

body.cv .cv-name p,
body.cv .cv-links {
  margin: 2px 0 0;
  font-family: "PingFang SC", sans-serif;
  font-size: 12.5px;
  color: #3f3a34;
}

body.cv .cv-links a,
body.cv .cv-name a { color: inherit; text-decoration: none; }

body.cv .cv-download {
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8f3428;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

body.cv li b { font-weight: 600; }

body.cv .cv-paper {
  margin: 3px 0 3px 1.1em;
  font-size: 13.5px;
  line-height: 1.4;
}

body.cv .cv-paper a { color: inherit; }

body.cv .cv-note { margin-top: 10px; color: #6b655c; font-size: 12.5px; }

body.cv .job {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 16px;
  align-items: start;
  margin-top: 10px;
}

body.cv .job h3 {
  margin: 0;
  font-size: 15px;
}

body.cv .cv-role {
  margin: 1px 0 0;
  font-size: 13.5px;
  color: #3f3a34;
}

body.cv .dates {
  font-family: "PingFang SC", sans-serif;
  font-size: 12px;
  color: #6b655c;
  white-space: nowrap;
}

body.cv ul { margin: 4px 0 0; padding-left: 1.1em; }

body.cv li { margin: 2px 0; }

body.cv .pub {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 4px 8px;
  margin: 6px 0;
}

body.cv .pub b { font-variant-numeric: tabular-nums; font-family: "PingFang SC", sans-serif; font-size: 13px; }

body.cv .sum { margin: 0; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; gap: 28px; }
  .identity { position: static; }
  h1 { font-size: 52px; }
  .wrap { padding: 28px 20px 64px; }
  .role { grid-template-columns: 1fr; gap: 2px; }
  body.cv .job { grid-template-columns: 1fr; }
  body.cv .dates { white-space: normal; }
}

@page { size: A4; margin: 12mm 14mm; }

@media print {
  body.cv.resume { font-size: 14.5px; line-height: 1.36; }
  body.cv .cv-note { margin-top: 4px; }
  .topbar, .cv-download { display: none; }
  .layout { display: block; }
  .identity { position: static; }
  a { color: inherit; text-decoration: none; }
  body.cv { background: #fff; }
  body.cv .wrap { padding: 0; max-width: none; }
  body.cv .job { grid-template-columns: 1fr auto; }
  body.cv .dates { white-space: nowrap; }
  body.cv .job, body.cv .pub, body.cv .cv-paper, body.cv .cv-block { break-inside: avoid; }
}
