/* ===========================================================
   Card-style academic homepage
   Colours live in the variables below; change them to re-theme.
   Background photo: --bg-image / --bg-opacity below.
   =========================================================== */

/* Hyphens (-, ‐, ‑) are drawn with Times New Roman; Crimson Pro's hyphen is slanted. */
@font-face {
  font-family: "Hyphen TNR";
  src: local("Times New Roman"), local("TimesNewRomanPSMT"), local("Times-Roman"), local("Times");
  unicode-range: U+002D, U+2010-2011;
}

:root {
  --page-bg: #f4f7fa;
  --bg-image: url(../img/bg/rain-umbrella.jpg);
  --bg-opacity: 0.12;
  --card: rgba(255, 255, 255, 0.72);
  --card-border: rgba(15, 35, 70, 0.08);
  --shadow: 0 1px 2px rgba(15, 35, 70, 0.04), 0 6px 20px rgba(15, 35, 70, 0.05);
  --text: #111111;
  --muted: #3c4350;
  --faint: #555d6b;
  --accent: #1565c0;          /* theme colour: links, dates, own name */
  --accent-hover: #0d47a1;
  --accent-soft: rgba(21, 101, 192, 0.10);
  --venue: #c62828;           /* venue badge on papers */
  --hot: var(--accent);
  --line: #e2e7ef;
  --nav-bg: rgba(255, 255, 255, 0.82);
  --radius: 12px;
  --maxw: 1080px;
  --font: "Hyphen TNR", "Crimson Pro", Georgia, "Times New Roman", "PingFang SC", "Microsoft YaHei", serif;
  --serif-italic: "Hyphen TNR", "Crimson Pro", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #11161f;
    --bg-opacity: 0.08;
    --card: rgba(28, 35, 48, 0.78);
    --card-border: rgba(255, 255, 255, 0.07);
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    --text: #e4e8ef;
    --muted: #c0c7d2;
    --faint: #a3abb8;
    --accent: #5aa9ff;
    --accent-hover: #9ccaff;
    --accent-soft: rgba(90, 169, 255, 0.14);
    --venue: #ff7a7a;
    --line: #2b3444;
    --nav-bg: rgba(17, 22, 31, 0.85);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--bg-image) center / cover no-repeat;
  opacity: var(--bg-opacity);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
b, strong { font-weight: 600; }
img { max-width: 100%; }

/* ---------------- Nav ---------------- */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--card-border);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 20px;
  height: 56px; display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { font-weight: 600; color: var(--text); font-size: 17px; }
.nav-brand span { color: var(--muted); font-weight: 400; }
.nav-brand:hover { text-decoration: none; }
.nav-links { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.nav-links a {
  display: block; padding: 6px 10px; border-radius: 8px;
  color: var(--muted); font-size: 17px; font-weight: 500;
}
.nav-links a:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.nav-links a.active { color: var(--accent); background: var(--accent-soft); }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 19px; cursor: pointer; }

/* ---------------- Layout ---------------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px 40px; }
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.section { margin-top: 44px; }
.section-title { font-size: 29px; font-weight: 500; margin: 0 0 14px; letter-spacing: -0.01em; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-more { font-size: 18px; font-weight: 500; }
.section-note { color: var(--faint); font-size: 18px; margin: -6px 0 12px; }

/* ---------------- Hero ---------------- */
.hero { display: flex; gap: 36px; padding: 18px 0 4px; align-items: flex-start; }
.hero-main { flex: 1; min-width: 0; }
.hero-name { font-size: 39px; font-weight: 500; margin: 0 0 14px; letter-spacing: -0.02em; line-height: 1.15; }
.hero-name-zh { font-size: 23px; color: var(--text); font-weight: 400; white-space: nowrap; }
.hero-name-zh-glyphs svg { height: 1.05em; width: auto; vertical-align: -0.16em; margin-left: 6px; }
.hero-roles { display: flex; gap: 0; margin-bottom: 16px; }
.hero-role { padding-right: 22px; margin-right: 22px; border-right: 1px solid var(--line); }
.hero-role:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.hero-role-label { font-size: 16px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.hero-role-org { font-weight: 600; font-size: 18px; }
.hero-role-org a { color: var(--text); }
.hero-bio p { margin: 0 0 10px; }
.hero-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 14px 0 4px; }
.hero-links a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text); font-size: 18px; font-weight: 500;
}
.hero-links a:hover { color: var(--accent); text-decoration: none; }
.ico {
  display: inline-grid; place-items: center;
  width: 19px; height: 19px; border-radius: 4px;
  font-size: 12px; color: #fff;
}
.ico-email   { background: #0075a9; }
.ico-scholar { background: #386cdb; }
.ico-github  { background: #654493; }
.ico-x       { background: #233c51; }
.ico-linkedin{ background: #0a66c2; }
.ico-wechat  { background: #11834c; }
.ico-cv      { background: #1565c0; }
.ico-rednote { background: #ff2442; }
.ico-rednote { font: 700 6.5px/1 "PingFang SC", "Microsoft YaHei", sans-serif; letter-spacing: -0.3px; width: 22px; }
.hero-photo { flex: 0 0 180px; margin-top: 9px; }   /* 9px = gap above the cap height of "Yanlin Li", so the photo lines up with the letters */
.hero-photo img {
  width: 180px; aspect-ratio: 3 / 4; object-fit: cover;
  border-radius: 10px; display: block; box-shadow: var(--shadow);
}
.hero-more { margin-top: 12px; }
.hero-more summary {
  cursor: pointer; list-style: none; display: inline-block;
  font-size: 16px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.hero-more summary::-webkit-details-marker { display: none; }
.hero-more summary::before { content: "›"; display: inline-block; margin-right: 8px; transition: transform .2s; font-size: 17px; }
.hero-more[open] summary::before { transform: rotate(90deg); }
.hero-more-body { margin-top: 12px; padding: 14px 16px; border-left: 3px solid var(--accent-soft); }
.hero-more-body img { display: block; width: 100%; max-width: 560px; margin: 8px auto 12px; border-radius: 8px; }
.hero-more-body ul { padding-left: 20px; margin: 0; }
.hero-more-body li { margin-bottom: 6px; }

/* ---------------- News ---------------- */
.news-card { padding: 6px 6px 6px 0; }
.news-list { list-style: none; margin: 0; padding: 8px 20px; max-height: 300px; overflow-y: auto; }
.news-list li { display: flex; gap: 16px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.news-list li:last-child { border-bottom: 0; }
.news-date { flex: 0 0 76px; color: var(--hot); font-weight: 500; font-size: 18px; font-variant-numeric: tabular-nums; }
.news-text { flex: 1; }

/* ---------------- Experience (education on top, positions below) ---------------- */
.journey {
  display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  grid-auto-flow: row dense;
  column-gap: 18px; row-gap: 14px; padding: 24px 22px 22px;
}
.journey-edu { text-align: center; display: flex; flex-direction: column; align-items: center; }
.journey-logo-box { height: 64px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.journey-logo { height: 64px; width: auto; max-width: 160px; object-fit: contain; }
.journey-logo.is-wide { height: 44px; }   /* horizontal NUS logo: 96x44, above the 80px web minimum */
.journey-school { font-weight: 600; }
.journey-school a, .journey-org a { color: var(--text); }
.journey-detail { color: var(--muted); }
.journey-period { color: var(--hot); font-variant-numeric: tabular-nums; }
.journey-axis {
  grid-column: 1 / -1; display: grid; grid-template-columns: inherit; column-gap: inherit;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  position: relative; height: 18px; align-items: center; justify-items: center;
}
.journey-axis::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; transform: translateY(-50%);
  background: linear-gradient(90deg, var(--line), var(--accent) 60%, var(--accent));
  opacity: .55;
}
.journey-dot { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--faint); position: relative; }
.journey-dot.is-current { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.journey-pos {
  grid-row: auto; padding: 12px 16px 14px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.6); border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
}
.journey-pos-head { display: flex; align-items: center; gap: 12px; }
.journey-pos-logo { height: 40px; width: 40px; object-fit: contain; flex: none; }
.journey-pos-logo.is-wide { width: auto; max-width: 220px; }
.journey-org { font-weight: 600; }
.journey-desc { color: var(--muted); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
@media (prefers-color-scheme: dark) {
  .journey-pos { background: rgba(255, 255, 255, 0.03); }
  .journey-dot { background: var(--page-bg); }
}

/* ---------------- Publications ---------------- */
.pub-list { padding: 6px 18px; }
.pub { display: flex; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.pub:last-child { border-bottom: 0; }
.pub-thumb { flex: 0 0 220px; }
.pub-thumb img { width: 220px; height: 128px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; display: block; }
.pub-body { flex: 1; min-width: 0; }
.pub-title { margin: 0 0 3px; font-size: 19px; font-weight: 600; line-height: 1.4; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }
.pub-star { color: #e6a700; margin-right: 4px; }
.pub-authors { font-size: 18px; color: var(--muted); }
.pub-authors.is-clamped { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pub-authors-wrap { position: relative; padding-right: 32px; }
.authors-toggle {
  position: absolute; right: 0; bottom: 5px;   /* centred on the last visible author line */
  display: inline-grid; place-items: center; width: 26px; height: 18px; margin: 0;
  padding: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--card);
  color: var(--accent); cursor: pointer; font-size: 11px; line-height: 1;
}
.authors-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }
.authors-toggle i { transition: transform .2s; }
.authors-toggle.is-open i { transform: rotate(180deg); }
.pub-authors strong { color: var(--hot); font-weight: 600; }
.pub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; font-size: 18px; }
.pub-venue { color: var(--venue); font-weight: 700; }
.pub-award { color: var(--hot); font-weight: 700; }
.pub-highlights { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; margin-top: 6px; font-size: 18px; }
.pub-featured { display: inline-flex; align-items: center; gap: 5px; color: var(--hot); font-weight: 700; }
.pub-featured i { font-size: 14px; }
.pub-featured:hover { text-decoration: underline; }
.pub-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 9px; border: 1px solid var(--text); border-radius: 4px;
  color: var(--text); font-size: 16px; line-height: 1.5;
  background: rgba(255, 255, 255, 0.55);
}
.pub-btn i { font-size: 13px; }
.pub-btn .fa-file-pdf { color: #d32f2f; }
.pub-btn:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
/* GitHub star count inside the Code button (filled in by site.js) */
.pub-stars {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 4px; padding-left: 8px; border-left: 1px solid currentColor;
  font-variant-numeric: tabular-nums;
}
.pub-stars[hidden] { display: none; }
.pub-stars .fa-star { color: #e3a008; font-size: 12px; }
@media (prefers-color-scheme: dark) { .pub-btn { background: transparent; } }
.pub-topic { margin-left: auto; font-family: var(--serif-italic); font-style: italic; color: var(--accent); font-size: 18px; }

/* Pub page */
.pubpage-head { margin-top: 10px; }
.pub-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; }
.pub-toolbar .section-note { margin: 0; }
.pub-filter { display: inline-flex; background: var(--card); border: 1px solid var(--card-border); border-radius: 999px; padding: 3px; }
.pub-filter button { border: 0; background: none; padding: 5px 14px; border-radius: 999px; font: inherit; font-size: 16px; color: var(--muted); cursor: pointer; }
.pub-filter button.is-active { background: var(--accent); color: #fff; }
.pub-group { margin-top: 26px; }
.group-title { font-size: 21px; font-weight: 500; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.pub-group.is-empty { display: none; }
body.only-first .pub:not(.is-first) { display: none; }

/* ---------------- Awards ---------------- */
.award-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.award-card { padding: 14px 16px; display: flex; gap: 14px; align-items: center; }
.award-logo { flex: 0 0 96px; height: 64px; display: grid; place-items: center; }
.award-logo img { max-width: 96px; max-height: 48px; object-fit: contain; }
.award-logo img[src*="sdu.svg"] { max-height: 64px; }   /* round emblem looks small at 48px next to wordmarks */
.award-text { display: flex; flex-direction: column; min-width: 0; }
.award-title { font-weight: 600; font-size: 18px; }
.award-org { font-size: 18px; color: var(--muted); }
.award-date { font-size: 18px; color: var(--hot); margin-top: 4px; }

/* ---------------- Services / Talks ---------------- */
.svc-card, .talk-card { padding: 6px 20px; }
.svc-row { display: flex; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.svc-row:last-child, .talk-row:last-child { border-bottom: 0; }
.svc-role { flex: 0 0 110px; font-weight: 600; color: var(--hot); }
.svc-items { margin: 0; padding-left: 18px; flex: 1; }
.svc-items li { margin-bottom: 2px; }
.talk-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.talk-title { font-weight: 600; }
.talk-venue { font-size: 18px; color: var(--muted); }
.talk-date { color: var(--hot); font-size: 18px; white-space: nowrap; }

/* QR pop-up */
.qr-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(10, 15, 25, 0.45); }
.qr-modal[hidden] { display: none; }
.qr-box { position: relative; background: #fff; color: #111; border-radius: 12px; padding: 18px 18px 14px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.qr-box img { display: block; width: 240px; max-width: 70vw; height: auto; border-radius: 6px; }
.qr-title { font-weight: 600; margin-bottom: 10px; }
.qr-close { position: absolute; top: 6px; right: 10px; border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: #555; }

.visitor-map { max-width: 420px; margin: 40px auto 0; }
.site-footer { text-align: center; color: var(--faint); font-size: 18px; margin-top: 30px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    flex-direction: column; padding: 8px 16px 12px;
    background: var(--nav-bg); border-bottom: 1px solid var(--card-border);
  }
  .nav-links.is-open { display: flex; }
  .hero { flex-direction: column-reverse; padding: 22px; }
  .hero-photo { flex: none; align-self: center; margin-top: 0; }
  .hero-photo img { width: 160px; }
  .hero-name { font-size: 33px; }
  .journey { grid-template-columns: 1fr; }
  .journey > * { grid-column: 1 !important; grid-row: auto !important; }
  .journey-axis { display: none; }
}
@media (max-width: 600px) {
  .pub { flex-direction: column; gap: 10px; }
  .pub-thumb { flex: none; }
  .pub-thumb img { width: 100%; height: auto; max-height: 200px; }
  .pub-topic { margin-left: 0; }
  .hero-roles { flex-direction: column; gap: 8px; }
  .hero-role { border-right: 0; padding-right: 0; margin-right: 0; }
  .svc-row { flex-direction: column; gap: 4px; }
  .pub-toolbar { flex-direction: column; align-items: flex-start; }
}
.news-emoji { margin-right: 6px; }
.talk-title a { color: var(--text); }
.talk-title a:hover { color: var(--accent); }
.talk-role {
  display: inline-block; margin-right: 8px; padding: 0 8px; border-radius: 4px;
  font-size: 15px; font-weight: 600; line-height: 1.6; vertical-align: 1px;
  color: #fff; background: var(--accent);
}
.talk-role-host { background: var(--venue); }

/* Dark mode: white plate behind logos so dark-coloured emblems (SDU, NUS, CTIC, ...) stay readable */
@media (prefers-color-scheme: dark) {
  .journey-logo, .journey-pos-logo, .award-logo img {
    background: #fff; padding: 6px; border-radius: 8px; box-sizing: content-box;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  }
  .journey-logo { height: 52px; }
  .journey-logo.is-wide { height: 38px; }
  .journey-pos-logo { height: 32px; width: 32px; }
  .journey-pos-logo.is-wide { width: auto; }
  .award-logo img { max-width: 84px; max-height: 40px; }
  .award-logo img[src*="sdu.svg"] { max-height: 52px; }
}
