:root {
  --ink: #1a2332;
  --ink-soft: #5a6573;
  --paper: #f3f6f8;
  --paper-2: #ffffff;
  --line: rgba(26, 52, 77, 0.14);
  --green: #1a5276;
  --green-deep: #12344d;
  --cream: #f7fafc;
  --clay: #b23a48;
  --shadow: 0 16px 40px rgba(18, 52, 77, 0.12);
  --serif: "Fraunces", "Iowan Old Style", Palatino, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  --cjk: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --masthead: 64px;
  --sidebar: 250px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: var(--green); }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 3px; }

.skip {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 50;
  background: var(--green-deep);
  color: var(--cream);
  padding: .55rem .8rem;
  text-decoration: none;
}
.skip:focus { top: .6rem; }

.masthead {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  height: var(--masthead);
  background: var(--paper-2);
  color: var(--ink);
  border-bottom: 3px solid var(--green);
  box-shadow: 0 1px 0 rgba(18, 52, 77, 0.04);
}
.masthead__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0 1.25rem;
}
.masthead__title {
  color: var(--green-deep);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  white-space: nowrap;
  min-width: 0;
}
.masthead__title span {
  font-family: var(--cjk);
  font-weight: 500;
  margin-left: .35rem;
  opacity: .8;
}
.masthead__links {
  display: flex;
  flex-wrap: nowrap;
  gap: .15rem .85rem;
  margin-left: auto;
}
.masthead__links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .92rem;
}
.masthead__links a:hover,
.masthead__links a.active { color: var(--green); }
.nav-toggle {
  display: none;
  margin-left: auto;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--green-deep);
  border-radius: 999px;
  padding: .4rem .8rem;
  cursor: pointer;
}

.page { padding-top: var(--masthead); }

.sidebar {
  padding: 1.4rem 1.7rem 2rem;
}
.author__avatar {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 18%;
  border: 3px solid var(--green);
  background: var(--paper-2);
}
.author__name {
  margin: .75rem 0 0;
  font-size: 1.05rem;
  font-weight: 600;
}
.author__han {
  margin: .15rem 0 0;
  font-family: var(--cjk);
  color: var(--ink-soft);
  letter-spacing: .12em;
}
.author__bio {
  margin: .45rem 0 .9rem;
  color: var(--ink-soft);
  font-size: .92rem;
}
.author__urls {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: .92rem;
}
.author__urls li { margin: .28rem 0; }
.author__urls a { text-decoration: none; }
.author__urls a:hover { text-decoration: underline; }
.follow { display: none; }

main {
  padding: 1.6rem 1.4rem 3rem;
  max-width: 860px;
}
main > p { margin: 0 0 .9rem; }
#about h2 { margin-top: 0; }
main h2 {
  margin: 2rem 0 .8rem;
  padding-bottom: .28rem;
  border-bottom: 1px solid var(--green);
  color: var(--green-deep);
  font-size: 1.45rem;
  font-weight: 600;
}
.news-box {
  max-height: 250px;
  overflow: auto;
  padding: .7rem .9rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--clay);
}
.about-box { max-height: none; overflow: visible; }
.about-box p { margin: 0 0 .75rem; }
.about-box p:last-child { margin-bottom: 0; }
.news-box ul,
.citations,
.plain,
main ol {
  margin: .2rem 0 0;
  padding-left: 1.15rem;
}
.news-box li,
.citations li,
.plain li,
main ol li { margin: 0 0 .75rem; }
.venue { color: var(--clay); font-weight: 600; }
main footer {
  margin-top: 2.4rem;
  padding-top: .8rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: .9rem;
}
section { scroll-margin-top: calc(var(--masthead) + .6rem); }

@media (min-width: 1024px) {
  .sidebar {
    position: fixed;
    top: var(--masthead);
    left: 0;
    width: var(--sidebar);
    height: calc(100vh - var(--masthead));
    overflow: auto;
    border-right: 1px solid var(--line);
    background: var(--paper);
  }
  main { margin-left: var(--sidebar); padding: 1.15rem 2.4rem 4rem; }
}

@media (max-width: 1023px) {
  .nav-toggle { display: inline-flex; }
  .masthead__links {
    display: none;
    position: absolute;
    top: var(--masthead);
    left: 0;
    right: 0;
    margin: 0;
    padding: .35rem .6rem .55rem;
    background: var(--paper-2);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    flex-direction: column;
    gap: 0;
  }
  .masthead__links a { padding: .7rem .6rem; font-size: 1rem; }
  .masthead__links.open { display: flex; }
  .author {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: .7rem .8rem;
    align-items: center;
  }
  .author__name { margin-top: 0; overflow-wrap: anywhere; }
  .author__avatar { width: 72px; height: 72px; }
  .author__bio { margin: .15rem 0 0; }
  .author__urls-wrapper { position: relative; }
  .follow {
    display: inline-flex;
    border: 1px solid var(--green);
    background: var(--green);
    color: var(--cream);
    border-radius: 4px;
    padding: .4rem .7rem;
    cursor: pointer;
  }
  .author__urls {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + .45rem);
    z-index: 20;
    width: max-content;
    max-width: min(16rem, calc(100vw - 2rem));
    padding: .7rem .85rem;
    background: var(--paper-2);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .author__urls.open { display: block; }
  .author__desktop { display: none; }
  .sidebar { padding: .75rem 1rem .15rem; }
  main { padding: .15rem 1rem 2.6rem; }
  main h2 { font-size: 1.3rem; margin-top: 1.6rem; }
  #about h2 { margin-top: 0; margin-bottom: .45rem; }
}

@media (max-width: 380px) {
  .masthead__title span { display: none; }
  .follow { padding: .4rem .55rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* CV pages */
.cv-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  max-width: 820px;
  margin: 0 auto;
  padding: 1.1rem 1.2rem 0;
}
.cv-top a {
  color: var(--green);
  text-decoration: none;
  font-weight: 500;
}
.cv-top a[aria-current="page"] {
  color: var(--ink);
  border-bottom: 2px solid var(--clay);
}
.cv-switch { display: flex; gap: 0.9rem; }
.cv-sheet {
  max-width: 820px;
  margin: 1rem auto 3rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 2.4rem 2.5rem 2.8rem;
  box-shadow: var(--shadow);
}
.cv-sheet h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 560;
  font-size: 2rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.cv-sheet .zh-name {
  font-family: var(--cjk);
  font-weight: 500;
  letter-spacing: 0.08em;
}
.cv-head { text-align: center; }
.cv-head p { margin: 0.45rem 0 0; }
.cv-line { color: var(--ink-soft); font-size: 0.95rem; }
.cv-line a { color: var(--green); }
.cv-sheet section { padding-top: 1.35rem; }
.cv-sheet h2 {
  margin: 0 0 0.7rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.2rem;
}
.cv-entry { margin: 0 0 0.85rem; }
.cv-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}
.cv-row p { margin: 0; }
.cv-row .place { text-align: right; color: var(--ink-soft); font-style: italic; }
.cv-entry ul,
.cv-sheet ol { margin: 0.25rem 0 0; padding-left: 1.15rem; color: var(--ink-soft); }
.cv-entry li,
.cv-sheet ol li { margin: 0.15rem 0; }
.cv-sheet section > p,
.cv-sheet li,
.cv-sheet li p {
  text-align: justify;
  text-justify: inter-ideograph;
  hyphens: auto;
}
.cv-sheet ol li { margin-bottom: 0.7rem; }
.cv-sheet ol li p { margin: 0.15rem 0 0; }
.cv-muted { color: var(--ink-soft); font-style: italic; }
.cv-langs { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
body.cv-zh { font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif; }
body.cv-zh h1,
body.cv-zh h2,
body.cv-zh h3 { font-family: "Noto Serif SC", "Songti SC", serif; }

@media (max-width: 700px) {
  .cv-sheet { padding: 1.4rem 1.1rem 2rem; margin: 0.8rem 0.7rem 2rem; }
  .cv-row { flex-direction: column; gap: 0; }
  .cv-row .place { text-align: left; }
  .cv-top { padding-left: 0.9rem; padding-right: 0.9rem; }
}

@media print {
  body { background: white; }
  .cv-top { display: none; }
  .cv-sheet { box-shadow: none; border: 0; margin: 0; max-width: none; padding: 0; }
}
