:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f5;
  --text: #1c1c1a;
  --text-muted: #5f5f5a;
  --rule: #e2e2dd;
  --accent: #7a2e2e;
  --accent-soft: #a34a4a;
  --max: 780px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Charter", "Georgia", "Songti TC", "Noto Serif TC", serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Header / nav ---------- */

header.site {
  border-bottom: 1px solid var(--rule);
  padding: 28px 0 0;
}

header.site .wrap { position: relative; }

.site-name {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0 0 2px;
}

.site-name a { color: var(--text); text-decoration: none; }
.site-name .zh { margin-right: 8px; }

.site-role {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 18px;
}

.site-role .zh { display: block; }

nav.site ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin: 0;
  padding: 0;
}

nav.site a {
  display: inline-block;
  padding-bottom: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
}

nav.site a:hover { color: var(--text); }

nav.site a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ---------- Search ---------- */

.search-wrap {
  position: absolute;
  top: 0;
  right: 0;
  width: 140px;
  margin: 0;
}

#site-search {
  width: 100%;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 5px 9px;
}

#site-search:focus {
  outline: none;
  border-color: var(--accent-soft);
}

.search-results {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  right: 0;
  width: 300px;
  max-width: 80vw;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.search-result {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}

.search-result:last-child { border-bottom: none; }

.search-result:hover { background: var(--bg-soft); }

.search-result-heading {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 3px;
}

.search-result-snippet {
  display: block;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
}

.search-empty {
  margin: 0;
  padding: 10px 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ---------- Typography ---------- */

main { padding: 44px 0 72px; }

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 28px;
  letter-spacing: 0.01em;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 44px 0 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

h2:first-of-type { margin-top: 0; }

h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 26px 0 10px;
}

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
a:hover { border-bottom-color: var(--accent-soft); }

p { margin: 0 0 16px; }

/* ---------- Home ---------- */

.intro {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
  align-items: start;
}

.intro img {
  width: 100%;
  border-radius: 3px;
  display: block;
}

.fields dt {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-top: 14px;
}

.fields dd { margin: 2px 0 0; }
.fields { margin: 0 0 24px; }

.contact {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 20px 24px;
  font-size: 0.94rem;
}

.contact dl {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 6px 16px;
  margin: 0;
}

.contact dt { color: var(--text-muted); }
.contact dd { margin: 0; }

/* ---------- Publication list ---------- */

ol.pubs, ul.plain {
  list-style: none;
  margin: 0;
  padding: 0;
}

ol.pubs > li {
  padding: 0 0 20px 34px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}

ol.pubs > li:last-child { border-bottom: none; margin-bottom: 0; }

ol.pubs {
  counter-reset: pub;
}

ol.pubs > li::before {
  counter-increment: pub;
  content: counter(pub) ".";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pub-title { font-weight: 600; display: block; }
.pub-authors { color: var(--text-muted); font-size: 0.94rem; }
.pub-venue { font-style: italic; }

.links {
  margin-top: 6px;
  font-size: 0.87rem;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.links a {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-style: normal;
}

.note {
  color: var(--text-muted);
  font-size: 0.89rem;
  margin-top: 6px;
}

ul.plain > li {
  padding-left: 20px;
  position: relative;
  margin-bottom: 12px;
}

ul.plain > li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

/* ---------- Teaching ---------- */

.course-group { margin-bottom: 34px; }

.course-group .where {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: -4px 0 12px;
}

ul.courses {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 36px;
}

ul.courses li {
  break-inside: avoid;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule);
}

.code {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  margin-right: 8px;
}

/* ---------- CV button ---------- */

.cv-card {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 26px 28px;
  text-align: center;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 11px 26px;
  border-radius: 3px;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  border: none;
  margin-top: 6px;
}

.btn:hover { background: var(--accent-soft); border-bottom-color: transparent; }

/* ---------- Footer ---------- */

footer.site {
  border-top: 1px solid var(--rule);
  padding: 22px 0 40px;
  color: var(--text-muted);
  font-size: 0.86rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 620px) {
  body { font-size: 16px; }
  .intro { grid-template-columns: 1fr; gap: 22px; }
  .intro img { max-width: 200px; }
  .contact dl { grid-template-columns: 1fr; gap: 0 0; }
  .contact dt { margin-top: 10px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
  ul.courses { columns: 1; }
  nav.site ul { gap: 18px; }

  .search-wrap {
    position: static;
    width: 100%;
    margin: 14px 0 0;
  }

  .search-results { right: 0; left: 0; width: auto; }
}

/* last touched 2026-08-24 */
