/* ---------- Base ---------- */
:root {
  /* Colors come from 中国传统色：故宫里的色彩美学, except the Ai2 pinks */
  --accent: #631216;        /* 爵头: deep, near-black red */
  --accent-hover: #8F1D22;  /* 朱樱 */
  --ink: #31322C;           /* 京元: headings, strong text */
  --text: #46433B;          /* 驖骊: body text */
  --text-2: #585248;        /* 墨黪: secondary text */
  --muted: #686A67;         /* 石涅 */
  --faint: #92897B;         /* 石莲褐 */
  --soft: #EFEFEF;          /* 缟羽: card and thumbnail backgrounds */
  --border: #EAE5E3;        /* 玉頩 */
  --scrollbar: #D3CBC5;     /* 藕丝秋半 */
  --bg: #F5F3F2;            /* 山矾: page background */
  --highlight: #FDE8F2;     /* light Ai2 pink: featured publication card */
  --badge: #F0529C;         /* Ai2 pink: Spotlight badge */
  --shadow: 49, 50, 44;     /* 京元 as RGB, for translucent shadows */
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 28px 80px;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); text-decoration: underline; }

strong { color: var(--ink); font-weight: 600; }

h1, h2, h3 { color: var(--ink); line-height: 1.2; margin: 0 0 14px; }
h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.01em; }
h2 {
  font-size: 20px;
  font-weight: 600;
  margin-top: 42px;
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}
h3 { font-size: 16px; font-weight: 600; }

p { margin: 0 0 14px; }

/* ---------- Profile header ---------- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 36px;
  margin-bottom: 12px;
}

.profile-photo {
  flex-shrink: 0;
  width: 190px;
}
.profile-photo img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  box-shadow: 0 4px 16px rgba(var(--shadow), 0.08);
}

.profile-text { flex: 1; min-width: 0; }
.profile-text h1 {
  margin-bottom: 10px;
  color: var(--accent);
  font-weight: 700;
}
.firstname { font-weight: inherit; }

.subtitle {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 14px;
}

.bio {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 12px;
}
.bio:last-of-type { margin-bottom: 0; }
.logo-word { white-space: nowrap; }
.inline-logo {
  /* Logos read as part of the text: centered on the line, one fixed gap.
     Heights below are tuned per logo from its shape and how much of its box
     is ink, so every mark looks about the same size next to the text. */
  height: 1.2em;
  width: auto;
  margin-right: 0.3em;
  vertical-align: middle;
  position: relative;
  top: -0.08em;
}
.inline-logo[src$="/shlab.png"]  { height: 0.85em; }
.inline-logo[src$="/uw.png"]     { height: 0.95em; }
.inline-logo[src$="/rpad.png"]   { height: 1.15em; }
.inline-logo[src$="/ai2.png"],
.inline-logo[src$="/ri.svg"]     { height: 1.2em; }
.inline-logo[src$="/cmu.png"],
.inline-logo[src$="/pku.png"]    { height: 1.3em; }
.inline-logo[src$="/sjtu.png"],
.inline-logo[src$="/circle.png"] { height: 1.35em; }
.read-more {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
.read-more:hover { color: var(--accent-hover); text-decoration: underline; }

.profile-links {
  font-size: 14.5px;
  line-height: 2;
  margin-top: 18px;
  color: var(--muted);
}
.profile-links a {
  color: var(--accent);
  font-weight: 500;
}

/* ---------- Announcement banner ---------- */
.announcement {
  margin: 28px 0 8px;
  padding: 12px 16px;
  background: var(--soft);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 14.5px;
  color: var(--text);
}

/* ---------- News ---------- */
.news-list {
  list-style: none;
  padding: 0 8px 0 0;
  margin: 0;
  max-height: 260px; /* fallback; main.js fits it to 5 rows */
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}
.news-list.has-more {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
}
.news-list li {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14.5px;
}
.news-list li:last-child { border-bottom: none; }
.news-date {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
  font-size: 13.5px;
  padding-top: 1px;
}
.news-body { color: var(--text); }

/* ---------- Publications ---------- */
.section-note {
  font-size: 13px;
  color: var(--faint);
  margin-top: -6px;
  margin-bottom: 18px;
}

.publication-item {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 28px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.publication-item:last-of-type { border-bottom: none; }
.publication-item.featured {
  position: relative;
  padding: 20px;
  border-bottom: none;
  border-radius: 12px;
  background: var(--highlight);
}
.spotlight-badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--badge);
  vertical-align: 1px;
}

.publication-thumb {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(var(--shadow), 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  background: var(--soft);
}
.publication-thumb:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(var(--shadow), 0.14);
}
.publication-thumb a { display: block; }
.publication-thumb img,
.publication-thumb video {
  width: 100%;
  height: auto;
  display: block;
}
/* Video thumbnails: poster image on top, video plays underneath on hover */
.publication-thumb.has-video a { position: relative; }
.publication-thumb.has-video video {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
}
.publication-thumb.has-video img {
  position: relative;
  z-index: 1;
  transition: opacity 0.2s ease;
}
.publication-thumb.has-video.playing img { opacity: 0; }

.publication-content { display: flex; flex-direction: column; gap: 6px; }
.publication-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}
.publication-title a { color: inherit; }
.publication-title a:hover { color: var(--accent); }

.publication-authors {
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.5;
}
.publication-authors strong { color: var(--ink); }

.publication-note {
  font-size: 12.5px;
  color: var(--muted);
}

.publication-venue {
  font-size: 14px;
  color: var(--text-2);
}
.publication-venue strong { color: var(--ink); }

.publication-tldr {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.55;
  padding: 10px 14px;
  background: var(--soft);
  border-radius: 6px;
  margin-top: 4px;
}
.publication-tldr strong { color: var(--ink); }

.publication-links {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
}
.publication-links a {
  color: var(--accent);
  font-weight: 500;
}
.publication-links a + a::before {
  content: " · ";
  color: var(--muted);
  margin: 0 4px;
  font-weight: 400;
}

/* ---------- Research interests ---------- */
.interest-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 8px;
}
.interest-list li {
  display: grid;
  grid-template-columns: 210px 1fr;
  align-items: baseline;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.interest-list li:last-child { border-bottom: none; }
.interest-tag {
  display: inline-block;
  color: var(--accent);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--accent);
  line-height: 1.45;
  width: fit-content;
  justify-self: start;
  line-height: 1.35;
}
.interest-desc {
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.6;
}

/* ---------- Research prose (legacy, kept for safety) ---------- */
.research-prose {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 14px;
}

/* ---------- Work / projects / education lists ---------- */
.work-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.work-list > li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.work-list > li:last-child { border-bottom: none; }

.work-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 2px;
}
.work-org {
  font-weight: 600;
  color: var(--ink);
  font-size: 15px;
}
.work-when {
  color: var(--muted);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.work-role {
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.55;
}
.work-role a { color: var(--accent); }

/* ---------- Plain lists ---------- */
.plain-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.plain-list li {
  font-size: 14.5px;
  color: var(--text);
  padding: 5px 0;
  line-height: 1.6;
}

/* ---------- Footer ---------- */
.page-footer {
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--faint);
}
.page-footer p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .container { padding: 28px 18px 60px; }

  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
  }
  .profile-photo { width: 160px; }
  .profile-text h1 { font-size: 26px; }

  .publication-item {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .publication-thumb { max-width: 100%; }

  .news-list li {
    grid-template-columns: 64px 1fr;
    gap: 12px;
  }

  .work-row { flex-direction: column; gap: 2px; }
  .work-when { font-size: 13px; }

  .interest-list li {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px 0;
  }

  h1 { font-size: 26px; }
  h2 { font-size: 18px; margin-top: 32px; }
}
