@font-face {
  font-family: "EB Garamond";
  src: url("assets/fonts/EBGaramond.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}
/* Serif typography with Kai-style Chinese glyphs. */
:root {
  --font-song: "Kaiti SC", "KaiTi", "STKaiti", "BiauKai", serif;
  --ink: #222;
  --muted: #666;
  --accent: #333;
  --line: #d9d9d9;
  --paper: #fff;
}
body { font-family: var(--font-song); font-size: 16px; line-height: 1.85; color: var(--ink); }
button, input, textarea, select, summary { font-family: inherit; }
h1, h2, h3, h4, p, a, small, b, strong, time, span, dt, dd, li { font-family: inherit; }
strong, b { font-weight: 700; }
.sidebar { background: #fafafa; color: #333; border-right: 1px solid #ddd; }
.monogram { color: #333; border-color: #999; }
.brand-name { color: #222; letter-spacing: 2px; }
.brand-en { color: #666; font-size: 12px; letter-spacing: 1px; }
.nav-label { color: #777; font-size: 15px; letter-spacing: 2px; margin: 0 12px 15px; }
.nav a { color: #444; font-size: 15px; border-radius: 0; border-left: 2px solid transparent; }
.nav a:hover { background: #f0f0f0; color: #111; }
.nav a[aria-current=page] { background: #eee; color: #111; border-left-color: #333; }
.nav small { color: #666; font-size: 12px; }
.sidebar-bottom { color: #777; font-size: 12px; letter-spacing: 0; }
.sidebar-bottom .rule { background: #aaa; }
.hero { padding-top: 42px; padding-bottom: 28px; }
.hero h1 { font-size: 36px; font-weight: 700; letter-spacing: 2px; line-height: 1.4; margin-bottom: 6px; }
.hero p { color: #555; font-size: 14px; letter-spacing: 1px; }
.section-eyebrow { color: #777; font-size: 12px; letter-spacing: 1px; line-height: 1.6; }
.intro p.section-eyebrow { color: #777; font-size: 12px; line-height: 1.6; margin-bottom: 12px; text-align: left; }
.intro h2, .other-page h2 { font-size: 25px; font-weight: 700; letter-spacing: 0; line-height: 1.5; }
.intro p { color: #333; font-size: 16px; line-height: 1.95; text-align: justify; margin-bottom: 17px; }
.intro p strong { color: #222; font-weight: 700; }
.intro a, .text-link, .contact-row a { color: #222; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.interests { gap: 0; }
.tag { color: #555; font-size: 13px; border: 0; padding: 0; line-height: 1.7; }
.tag + .tag::before { content: "·"; padding: 0 12px; color: #888; }
.identity strong { color: #222; font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.identity p { color: #555; font-size: 13px; line-height: 1.7; }
.socials a { color: #444; font-size: 13px; }
.news { padding-top: 22px; }
.section-head h2, .resume-section > h3 { font-size: 22px; font-weight: 700; letter-spacing: 0; }
.section-head small { color: #777; font-size: 11px; letter-spacing: .5px; }
.news-row { grid-template-columns: 93px 1fr; gap: 18px; border-bottom-color: #eee; }
.news-row time { color: #666; font-size: 13px; font-variant-numeric: tabular-nums; }
.news-row p { font-size: 15px; color: #444; line-height: 1.9; margin: 0; }
.other-page > .description, .placeholder-item p, .project p, .resume-entry p { color: #444; font-size: 16px; line-height: 1.9; }
.entry-heading h4, .placeholder-item h3 { font-size: 18px; font-weight: 700; }
.entry-heading span { color: #666; font-size: 13px; }
.resume-entry .role { color: #444; }
.resume-entry ul, .project ul { font-size: 15px; color: #333; line-height: 1.95; }
.resume-entry li, .project li { margin-bottom: 6px; }
.skills-list > div { font-size: 15px; }
.skills-list dt { color: #222; font-weight: 700; }
.skills-list dd { color: #444; }
.project b { color: #666; font-size: 12px; letter-spacing: .5px; }
.project-list h3 { font-size: 22px; font-weight: 700; }
.project-stack { color: #666; font-size: 13px; }
.result-line { color: #222; font-size: 15px; font-weight: 700; }
.project summary, .text-link { color: #444; font-size: 14px; }
.contact-row { font-size: 16px; }
.contact-row span { color: #666; }
.photo-slot { background: #f5f5f5; color: #777; }
.footer { color: #777; font-size: 12px; letter-spacing: 0; }
.menu-toggle, .menu-toggle[aria-expanded=true] { color: #333; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid #777; outline-offset: 4px; }
@media (max-width: 760px) {
  .hero { padding-top: 66px; padding-bottom: 24px; }
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 13px; }
  .intro h2, .other-page h2 { font-size: 23px; }
  .intro p { font-size: 16px; line-height: 1.9; }
  .intro p.section-eyebrow { font-size: 12px; }
  .news-row { grid-template-columns: 80px 1fr; gap: 12px; }
  .news-row p { font-size: 14px; }
  .news-row time { font-size: 12px; }
  .section-head small { font-size: 10px; }
  .identity p { font-size: 12px; }
  .project-list h3 { font-size: 20px; }
  .contact-row { font-size: 14px; grid-template-columns: 52px 1fr; }
  .footer { font-size: 11px; }
}

/* EB Garamond for Latin text; Kaiti for Chinese glyphs. */
:root {
  --font-song: "EB Garamond", "Kaiti SC", "KaiTi", "STKaiti", "BiauKai", serif;
}
.sidebar { background: #111; color: #fff; border-right-color: #111; padding-top: 28px; }
.monogram { color: #fff; border-color: #888; }
.brand-name, .brand-en, .nav-label, .nav a, .nav small, .sidebar-bottom { color: #fff; }
.nav a:hover { background: #222; color: #fff; }
.nav a[aria-current=page] { background: #292929; color: #fff; border-left-color: #fff; }
.sidebar-bottom .rule { background: #888; }
.menu-toggle[aria-expanded=true] { color: #fff; }

/* Sunset photograph for the top banner. */
.hero {
  min-height: 300px;
  padding-top: 56px;
  padding-bottom: 48px;
  margin-bottom: 36px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(0,0,0,.30), rgba(0,0,0,.04)), url("assets/header-landscape.jpg") center 65% / cover no-repeat;
}
.hero-copy, .hero h1, .hero p { color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.45); }
@media (max-width: 760px) {
  .hero { min-height: 260px; padding-top: 72px; padding-bottom: 40px; margin-bottom: 28px; }
  .menu-toggle { color: #fff; background: #1119; border-radius: 3px; }
}

/* Natural spacing for English profile copy. */
#profile .intro p { text-align: left; }
#profile .news-row { grid-template-columns: 100px 1fr; }
#profile .news-row time { white-space: nowrap; }
#profile .identity strong { letter-spacing: 0; }

/* Match the portrait height to the introduction, with experience below. */
#profile .profile-grid { grid-template-columns: minmax(0, 1fr) minmax(230px, 32%); align-items: stretch; gap: 40px; }
#profile .intro > p:last-child { margin-bottom: 0; }
#profile .portrait-column { display: block; position: relative; min-height: 0; padding: 0; border: 0; }
#profile .portrait.has-photo { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; }
#profile .portrait img { object-fit: cover; object-position: 50% 55%; }
@media (max-width: 760px) {
  #profile .profile-grid { grid-template-columns: 1fr; gap: 28px; }
  #profile .portrait-column { width: min(100%, 360px); margin: 0 auto; }
  #profile .portrait.has-photo { position: relative; height: auto; aspect-ratio: 3 / 4; }
}

/* CV entries share the homepage typeface and use compact logo-led rows. */
.cv-section { margin-top: 34px; padding: 28px 30px 4px; border: 1px solid #dedede; border-radius: 6px; }
.cv-section > h3 { margin: 0 0 10px; font-size: 25px; line-height: 1.4; }
.cv-entry { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 22px; padding: 26px 0; }
.cv-entry + .cv-entry { border-top: 1px solid #e4e4e4; }
.cv-logo { width: 68px; height: 68px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cv-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cv-logo-cuhk { justify-content: flex-start; }
.cv-logo-cuhk img { flex: none; width: 377px; height: 54px; max-width: none; }
.cv-entry-body { min-width: 0; }
.cv-entry-body h4 { margin: 0 0 3px; font-size: 22px; line-height: 1.35; font-weight: 700; }
.cv-entry-body p { margin: 0; line-height: 1.55; font-size: 17px; }
.cv-entry-body .cv-organization { font-size: 19px; color: #333; }
.cv-entry-body .cv-meta { color: #777; }
.cv-entry-body .cv-team { color: #555; margin-top: 7px; }
.cv-entry-body .cv-grade { margin-top: 11px; }
.cv-entry-body .cv-awards { font-size: 16px; color: #555; margin-top: 3px; }
.cv-badge { float: right; margin-left: 12px; padding: 3px 8px; background: #f1f1f1; border-radius: 3px; color: #666; font-size: 13px; font-weight: 500; line-height: 1.3; }
.cv-details { margin-top: 13px; font-size: 16px; }
.cv-details summary { cursor: pointer; color: #555; font-size: 15px; }
.cv-details ul { padding-left: 20px; margin: 12px 0; line-height: 1.7; }
.cv-details li + li { margin-top: 8px; }
.cv-skills { padding-bottom: 26px; }
.cv-skills .skills-list > div { grid-template-columns: 180px minmax(0, 1fr); gap: 18px; }
@media (max-width: 760px) {
  .cv-section { padding: 22px 18px 0; margin-top: 26px; }
  .cv-section > h3 { font-size: 23px; }
  .cv-entry { grid-template-columns: 50px minmax(0, 1fr); gap: 14px; padding: 22px 0; }
  .cv-logo { width: 50px; height: 58px; }
  .cv-logo-cuhk img { width: 279px; height: 40px; }
  .cv-entry-body h4 { font-size: 20px; }
  .cv-entry-body .cv-organization { font-size: 18px; }
  .cv-entry-body p { font-size: 16px; }
  .cv-badge { float: none; display: inline-block; vertical-align: middle; }
  .cv-skills { padding-bottom: 22px; }
  .cv-skills .skills-list > div { grid-template-columns: 1fr; gap: 2px; }
}

/* User-provided logos are displayed in full, without cropping. */
.cv-logo-hnu img, .cv-logo-huatai img { width: 100%; height: 100%; object-fit: contain; }

/* Project headings carry the company mark; supporting details stay visible. */
#projects .project-title { display: flex; align-items: center; gap: 14px; }
#projects .project-title span { min-width: 0; }
#projects .project-company-logo { flex: none; width: 48px; height: 32px; object-fit: contain; }
#projects .project-details > ul { margin-bottom: 0; }

.notes-list { margin-top: 28px; border-top: 1px solid var(--line); }
.note-entry { padding: 22px 0; border-bottom: 1px solid var(--line); }
.note-entry h3 { margin: 0; font-size: 21px; line-height: 1.5; }
.note-entry a { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; color: var(--ink); text-decoration: none; }
.note-entry a:hover { text-decoration: underline; text-underline-offset: 4px; }
.note-entry a span { font-size: 18px; font-weight: 400; }

/* Photo gallery preserves each photograph's original proportions. */
.photo-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; margin-top: 30px; }
.gallery-photo { display: block; line-height: 0; }
.gallery-photo img { display: block; width: 100%; height: auto; }
@media (max-width: 760px) {
  .photo-gallery { grid-template-columns: 1fr; gap: 22px; }
}
