/* ylbai.me — quiet editorial serif · 2026 redesign */

:root {
  --paper: #fcfbf7;
  --ink: #211d17;
  --ink-soft: #4d483f;
  --ink-mute: #7d766a;
  --hairline: #ddd7cb;
  --accent: #7b2d26;
  --accent-dark: #571e19;
  --underline: #c9a49d;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: Charter, 'Bitstream Charter', 'Palatino Linotype', Palatino,
    Cambria, Georgia, 'Songti SC', SimSun, serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  overflow-wrap: break-word;
  font-variant-numeric: oldstyle-nums;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }

.page {
  max-width: 54rem;
  margin: 0 auto;
  padding: 4.75rem 1.5rem 3rem;
}

::selection { background: #eeded8; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--underline);
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover { color: var(--accent-dark); text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -999rem;
  top: auto;
}
.skip-link:focus-visible {
  left: 1rem;
  top: 1rem;
  background: var(--paper);
  padding: 0.3rem 0.7rem;
  z-index: 10;
}

/* ---------- masthead ---------- */

.masthead { display: flow-root; }
.masthead h1 {
  font-size: clamp(2.6rem, 5vw + 1.25rem, 3.4rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.012em;
}
.name-cn {
  font-family: 'Songti SC', 'STSong', SimSun, serif;
  font-size: 0.55em;
  color: var(--ink-mute);
  margin-left: 0.3em;
  white-space: nowrap;
}
.standfirst {
  margin-top: 1.2rem;
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 44em;
}
.contact {
  margin-top: 1.3rem;
  font-size: 0.9375rem;
  color: var(--ink-mute);
}
.contact .email { color: var(--ink-soft); }

.portrait {
  float: right;
  width: 172px;
  height: 172px;
  border-radius: 4px;
  margin: 0.5rem 0 1.25rem 2.25rem;
}

.toc {
  margin-top: 2.4rem;
  font-size: 0.9375rem;
  color: var(--ink-mute);
}
.toc a {
  color: var(--ink-soft);
  text-decoration: none;
}
.toc a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.backlink {
  display: inline-block;
  margin-bottom: 2.2rem;
  font-size: 0.9375rem;
  color: var(--ink-mute);
  text-decoration: none;
}
.backlink:hover { color: var(--accent); }

/* ---------- sections ---------- */

main section { margin-top: 4.5rem; }

h2 {
  font-size: 1.4375rem;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 1.4rem;
}
h2::before {
  content: "";
  display: block;
  width: 3rem;
  border-top: 1px solid var(--hairline);
  margin-bottom: 1.5rem;
}

.prose { max-width: 80ch; }
.prose + .prose { margin-top: 1rem; }

.section-intro {
  color: var(--ink-soft);
  margin-bottom: 1.4rem;
}

/* ---------- timeline (experience, education) ---------- */

.timeline { list-style: none; }
.timeline li {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  column-gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.timeline .period {
  color: var(--ink-mute);
  font-size: 0.9375rem;
  padding-top: 0.15em;
}
.timeline h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.45;
}
.org-detail {
  font-weight: 400;
  font-size: 0.9375rem;
  color: var(--ink-mute);
}
.org-detail::before { content: "\00b7\2002"; }
.entry p {
  color: var(--ink-soft);
  font-size: 1rem;
  margin-top: 0.2rem;
}

/* ---------- plain lists (honors, activities) ---------- */

.honors, .plain-list { list-style: none; }
.honors li, .plain-list li {
  padding-left: 1.4rem;
  margin-bottom: 0.55rem;
}
.honors li::before, .plain-list li::before {
  content: "\2013";
  color: var(--ink-mute);
  display: inline-block;
  width: 1.4rem;
  margin-left: -1.4rem;
}
.honors strong, .plain-list strong { font-weight: 600; }

/* ---------- publications ---------- */

.pub-subhead {
  font-size: 1.125rem;
  font-weight: 400;
  font-style: italic;
  margin: 2.4rem 0 1.2rem;
}
.pub-year { margin-top: 1.9rem; }
.pub-year .year {
  font-size: 1rem;
  font-weight: 400;
  color: var(--ink-mute);
  margin-bottom: 0.9rem;
}

.pub-list { list-style: none; }
.pub-list li { margin-bottom: 1.2rem; }
.pub-title {
  font-weight: 600;
  line-height: 1.5;
}
.pub-meta {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-top: 0.1rem;
}
.pub-meta strong {
  font-weight: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: #c2bbae;
}
.venue { font-style: italic; }
.award { font-style: italic; color: var(--ink-mute); }
.pub-note-inline { color: var(--ink-mute); }
.star {
  color: var(--ink-mute);
  font-size: 0.8em;
  vertical-align: super;
  line-height: 0;
}

.pub-links { white-space: normal; }
.pub-links a {
  margin-left: 0.55em;
  text-decoration: none;
}
.pub-links a::before { content: "["; }
.pub-links a::after { content: "]"; }
.pub-links a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.pub-note {
  margin-top: 2.2rem;
  font-size: 0.9375rem;
  color: var(--ink-mute);
}

/* ---------- projects ---------- */

.project { margin-bottom: 1.6rem; }
.project h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.45;
}
.project p {
  color: var(--ink-soft);
  font-size: 1rem;
  margin-top: 0.2rem;
}

/* ---------- activities ---------- */

#activities h3 {
  font-size: 1.125rem;
  font-weight: 400;
  font-style: italic;
  margin: 1.8rem 0 0.8rem;
}
#activities h3:first-of-type { margin-top: 0; }

/* ---------- figures (dataset page) ---------- */

.figure { margin: 0 0 2.4rem; }
.figure a { display: block; text-decoration: none; }
.figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: #fff;
}
.figure figcaption {
  margin-top: 0.6rem;
  font-size: 0.9375rem;
  color: var(--ink-mute);
}

.downloads { list-style: none; counter-reset: dl; }
.downloads > li {
  counter-increment: dl;
  margin-bottom: 1.6rem;
}
.downloads h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.45;
}
.downloads h3::before {
  content: counter(dl) ".\2002";
  color: var(--ink-mute);
  font-weight: 400;
}
.downloads p {
  color: var(--ink-soft);
  font-size: 1rem;
  margin-top: 0.35rem;
}

/* ---------- footer ---------- */

.colophon {
  margin-top: 5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.875rem;
  color: var(--ink-mute);
}

/* ---------- small screens ---------- */

@media (max-width: 40em) {
  .page { padding: 3rem 1.25rem 2.5rem; }
  main section { margin-top: 3.5rem; }
  .portrait {
    float: none;
    display: block;
    width: 128px;
    height: 128px;
    margin: 0 0 1.5rem;
  }
  .timeline li {
    grid-template-columns: 1fr;
    row-gap: 0.1rem;
  }
  .timeline .period { padding-top: 0; }
}

/* ---------- print ---------- */

@media print {
  body { background: #fff; color: #000; font-size: 10.5pt; line-height: 1.5; }
  .page { max-width: 100%; padding: 0; }
  .skip-link, .toc, .backlink { display: none; }
  a { color: #000; text-decoration: none; }
  main section { margin-top: 1.6rem; }
  h2 { break-after: avoid; }
  h2::before { border-top-color: #999; }
  .portrait { width: 96px; height: 96px; }
  .timeline li, .pub-list li, .honors li, .plain-list li, .project {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .colophon { border-top-color: #999; }
}
