:root {
  --text: #2c2c2c;
  --muted: #6b6b6b;
  --border: #ddd;
  --soft: #f7f7f7;
  --card: #ffffff;
  --primary: #3d5a80;
  --primary-soft: #eef2f7;
  --max-width: 980px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Times New Roman", Times, Georgia, serif;
  color: var(--text);
  background: #fafafa;
  line-height: 1.7;
}

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

.container {
  width: min(var(--max-width), calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(250, 250, 250, 0.95);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  width: min(var(--max-width), calc(100% - 32px));
  margin: 0 auto;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--primary);
}

.hero {
  padding: 64px 0 28px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, 0.8fr);
  gap: 32px;
  align-items: start;
}

.hero-side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 14px;
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--soft);
  color: var(--muted);
  font-size: 0.9rem;
}

h1,
h2,
h3 {
  letter-spacing: -0.01em;
  font-weight: 700;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  line-height: 1.1;
  margin: 0 0 14px;
}

.hero p,
.section-intro,
.bio,
.card p,
.entry p,
.entry li {
  color: var(--muted);
}

.lead {
  font-size: 1.05rem;
  max-width: 62ch;
}

.button-row,
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.button:hover,
.button:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
}

.button.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.button.primary:hover,
.button.primary:focus-visible {
  background: #2e4a6b;
  border-color: #2e4a6b;
  color: #fff;
}

.hero-card,
.card,
.project-card,
.entry {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.hero-card {
  padding: 20px;
  background: #fff;
}

.profile-card {
  padding: 16px;
  text-align: center;
}

.profile-card img {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--soft);
}

.profile-caption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-card h3,
.card h3,
.project-card h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.section {
  padding: 24px 0;
}

.section + .section {
  border-top: 1px solid var(--border);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.section h2 {
  font-size: 1.7rem;
  margin: 0;
  color: var(--text);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.card {
  padding: 20px;
}

.card ul,
.entry ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.card li,
.entry li {
  margin-bottom: 4px;
}

#experiences {
  scroll-margin-top: 76px;
}

.experience-group-title {
  margin: 20px 0 10px;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 400;
}

.experience-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.experience {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 20px 24px;
}

.experience + .experience {
  border-top: 1px solid var(--border);
}

.experience-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
}

.experience-logo img {
  display: block;
  width: 116px;
  max-height: 88px;
  object-fit: contain;
}

.experience-logo-stack {
  flex-direction: column;
  gap: 14px;
}

.experience-logo-stack .experience-logo-ant-group {
  width: 100px;
  max-width: 90%;
  height: auto;
  /* The official 256px asset has transparent padding after its 178px mark. */
  aspect-ratio: 178 / 80;
  object-fit: cover;
  object-position: left;
}

.experience-logo .experience-logo-seal {
  width: 84px;
  height: 84px;
}

.experience-logo .experience-logo-tsinghua {
  width: 116px;
  height: 116px;
  max-height: none;
  object-fit: cover;
}

.experience-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0 16px;
}

.experience-heading h4 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.5;
}

.experience p {
  margin: 0;
}

.experience-date {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.experience-role {
  color: var(--primary);
  font-size: 0.95rem;
}

.experience .experience-description {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.projects {
  display: grid;
  gap: 16px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.entry {
  padding: 20px;
}

.entry + .entry {
  margin-top: 0;
}

.entry-figure {
  margin: 10px 0;
}

.entry-figure img {
  width: 100%;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.entry-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.entry-title h3 {
  margin: 0;
  font-size: 1.05rem;
}

.entry-meta {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.small-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
}

.small-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.small-links a:hover,
.small-links a:focus-visible {
  text-decoration: underline;
}

footer {
  padding: 28px 0 48px;
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 860px) {
  .hero-grid,
  .grid-2,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .profile-card img {
    max-width: 200px;
  }
}

@media (max-width: 860px) {
  .topbar-inner,
  .section-header,
  .entry-title {
    align-items: flex-start;
  }

  .hero {
    padding-top: 40px;
  }
}

@media (max-width: 560px) {
  #experiences {
    scroll-margin-top: 110px;
  }

  .experience {
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    padding: 18px 14px;
  }

  .experience-logo {
    min-height: 76px;
  }

  .experience-logo img {
    width: 76px;
    max-height: 76px;
  }

  .experience-logo-stack {
    gap: 10px;
  }

  .experience-logo .experience-logo-seal {
    width: 64px;
    height: 64px;
  }

  .experience-logo .experience-logo-tsinghua {
    width: 76px;
    height: 76px;
  }

  .experience-heading {
    flex-direction: column;
  }

  .topbar-inner {
    padding: 8px 0;
    flex-direction: column;
    align-items: flex-start;
  }

  .nav {
    gap: 12px;
  }

  h1 {
    font-size: 2rem;
  }

  .button,
  .button.primary {
    width: 100%;
  }

  .button-row,
  .links {
    flex-direction: column;
  }
}

/* Personal homepage: persistent profile and independently packed projects. */
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/source-serif-4-latin.woff2") format("woff2");
}

.homepage {
  --primary: #2f6663;
  --primary-soft: #edf4f3;
  --primary-hover: #234d4a;
  --body-text: #454545;
  --max-width: 1280px;
  font-family: "Source Serif 4", Georgia, serif;
}

.homepage h1,
.homepage h2,
.homepage h3,
.homepage h4 {
  font-weight: 600;
}

.homepage .card p,
.homepage .card li,
.homepage .entry p,
.homepage .entry li,
.homepage .experience-description {
  color: var(--body-text);
}

/* Keep prose and list endings visually balanced at every viewport width. */
.homepage .home-content p,
.homepage .home-content li {
  text-wrap: balance;
}

.homepage .button:not(.primary) {
  color: var(--primary);
}

.homepage .button.primary:hover,
.homepage .button.primary:focus-visible {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.homepage .topbar {
  background: #fafafa;
}

.home-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  align-items: start;
  gap: 40px;
  padding: 40px 0;
}

.profile-sidebar {
  position: sticky;
  top: 88px;
  max-height: calc(100dvh - 112px);
  overflow-y: auto;
  text-align: center;
}

.profile-photo-frame {
  position: relative;
  width: 190px;
  height: 190px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.profile-photo {
  /* Frame the full body: a 3100 px square at (1050, 1430) in the 4672 x 5209 source. */
  position: absolute;
  display: block;
  width: 150.71%;
  max-width: none;
  height: auto;
  left: -33.87%;
  top: -46.13%;
}

.profile-sidebar h1 {
  margin: 18px 0 10px;
  font-size: 1.9rem;
  line-height: 1.15;
}

.profile-affiliation,
.profile-summary {
  color: var(--muted);
  line-height: 1.6;
}

.profile-affiliation {
  margin: 0;
  font-size: 1rem;
}

.profile-summary {
  margin: 14px 0 0;
  font-size: 0.9rem;
}

.profile-sidebar .button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.profile-sidebar .button {
  padding: 7px 8px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.home-content {
  min-width: 0;
}

.home-content > .section:first-child {
  padding-top: 0;
}

.homepage .section,
.homepage .entry[id],
.homepage #about,
.homepage #experiences {
  scroll-margin-top: 80px;
}

.homepage .grid-2 {
  align-items: start;
}

.homepage #misc .grid-2 {
  grid-template-columns: 1fr;
}

.homepage .project-grid {
  --project-columns: 2;
  --project-gap: 16px;
  grid-template-columns: repeat(var(--project-columns), minmax(0, 1fr));
  align-items: start;
  gap: var(--project-gap);
}

.homepage .project-grid[data-masonry-ready] {
  position: relative;
  display: block;
}

.homepage .project-grid[data-masonry-ready] > .entry {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--project-width);
  transform: translate(var(--project-x), var(--project-y));
}

.homepage .entry > p:last-child {
  margin-bottom: 0;
}

@media (max-width: 960px) {
  .home-layout {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 28px;
  }

  .profile-sidebar {
    position: static;
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 28px;
    align-items: center;
    max-height: none;
    overflow: visible;
    text-align: left;
  }

  .profile-photo-frame {
    width: 160px;
    height: 160px;
  }

  .profile-sidebar h1 {
    margin-top: 0;
  }

  .profile-sidebar .button-row {
    max-width: 320px;
  }
}

@media (max-width: 680px) {
  .homepage .project-grid {
    --project-columns: 1;
  }
}

@media (max-width: 560px) {
  .profile-sidebar {
    display: block;
    text-align: center;
  }

  .profile-photo-frame {
    width: 130px;
    height: 130px;
  }

  .profile-sidebar h1 {
    margin-top: 16px;
  }

  .profile-sidebar .button-row {
    margin-inline: auto;
  }

  .homepage .section,
  .homepage .entry[id],
  .homepage #about,
  .homepage #experiences {
    scroll-margin-top: 110px;
  }
}

/* FORGE project page */
.forge-page {
  --forge-ink: #14202b;
  --forge-blue: #214f72;
  --forge-blue-dark: #163b57;
  --forge-sand: #f1eee8;
  --forge-line: #d9dde0;
  background: #f8f8f6;
  color: var(--forge-ink);
  line-height: 1.55;
}

.forge-page .topbar {
  background: rgba(248, 248, 246, 0.94);
  backdrop-filter: blur(10px);
}

.forge-page .topbar-inner,
.forge-shell {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.forge-page .nav a {
  color: #4c5963;
}

.forge-page .nav a:hover,
.forge-page .nav a:focus-visible {
  color: var(--forge-blue);
}

.forge-hero {
  padding: 82px 0 48px;
  background:
    radial-gradient(circle at 85% 12%, rgba(33, 79, 114, 0.10), transparent 32%),
    linear-gradient(180deg, #f8f8f6 0%, #eef1f2 100%);
  border-bottom: 1px solid var(--forge-line);
}

.forge-hero-copy {
  text-align: center;
  max-width: 930px;
}

.status-pill,
.result-tag,
.section-kicker {
  font-family: Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-pill {
  display: inline-block;
  padding: 5px 10px;
  color: var(--forge-blue);
  background: #e8eef2;
  border: 1px solid #cad7df;
  border-radius: 999px;
}

.forge-hero h1 {
  margin: 18px 0 4px;
  font-size: clamp(4rem, 10vw, 7.6rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
  color: var(--forge-ink);
}

.forge-title {
  max-width: 850px;
  margin: 20px auto 0;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1.18;
  font-weight: 700;
}

.forge-lead {
  max-width: 780px;
  margin: 22px auto 0;
  color: #53616b;
  font-size: 1.08rem;
}

.forge-actions {
  justify-content: center;
  margin-top: 28px;
}

.forge-page .button {
  min-width: 112px;
  border-color: #bfc8ce;
  border-radius: 999px;
  font-family: Arial, Helvetica, sans-serif;
}

.forge-page .button.primary {
  background: var(--forge-blue);
  border-color: var(--forge-blue);
}

.forge-page .button.disabled {
  color: #7d858a;
  background: #ececea;
  cursor: default;
}

.forge-teaser-wrap {
  margin-top: 52px;
  padding: 18px 18px 14px;
  background: #fff;
  border: 1px solid var(--forge-line);
  box-shadow: 0 18px 48px rgba(35, 48, 58, 0.10);
}

.forge-teaser-wrap img,
.figure-panel img,
.result-card img {
  display: block;
  width: 100%;
}

.figure-note {
  margin: 10px 0 0;
  color: #68737a;
  text-align: center;
  font-size: 0.9rem;
}

.forge-section {
  padding: 76px 0;
  scroll-margin-top: 62px;
}

.forge-section.alt {
  background: var(--forge-sand);
  border-block: 1px solid #e0ddd7;
}

.forge-section h2 {
  max-width: 850px;
  margin: 8px 0 30px;
  font-size: clamp(2rem, 4.5vw, 3.35rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.forge-section h3 {
  color: var(--forge-ink);
}

.section-kicker,
.result-tag {
  color: var(--forge-blue);
  margin: 0;
}

.narrow-copy {
  max-width: 900px;
}

.abstract-copy {
  color: #43515b;
  font-size: 1.12rem;
  line-height: 1.72;
}

.contribution-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 40px;
  border-block: 1px solid var(--forge-line);
}

.contribution-strip div {
  padding: 22px 12px;
  text-align: center;
}

.contribution-strip div + div {
  border-left: 1px solid var(--forge-line);
}

.contribution-strip strong {
  display: block;
  color: var(--forge-blue-dark);
  font-size: 1.9rem;
  line-height: 1;
}

.contribution-strip span {
  display: block;
  margin-top: 8px;
  color: #68737a;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.figure-panel,
.result-card,
.method-card {
  background: #fff;
  border: 1px solid var(--forge-line);
}

.wide-figure {
  padding: 18px;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.method-card {
  padding: 24px;
}

.method-index {
  color: #97a5ae;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
}

.method-card h3 {
  margin: 34px 0 10px;
  font-size: 1.3rem;
}

.method-card p,
.result-card p,
.figure-copy p {
  color: #5a666e;
}

.actor-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.6fr);
  gap: 26px;
  align-items: center;
  margin-top: 16px;
  padding: 28px;
}

.figure-copy h3 {
  margin: 8px 0 10px;
  font-size: 1.65rem;
  line-height: 1.15;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.result-card {
  padding: 24px;
}

.result-wide {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.5fr);
  gap: 28px;
  align-items: center;
}

.result-card h3 {
  margin: 9px 0 10px;
  font-size: 1.45rem;
  line-height: 1.18;
}

.dp-card {
  background: var(--forge-blue-dark);
  color: #fff;
  border-color: var(--forge-blue-dark);
}

.dp-card h3,
.dp-card .result-tag {
  color: #fff;
}

.dp-card .dp-intro,
.dp-card .scope-note {
  color: #d9e1e6;
}

.payload-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 24px 0;
}

.payload-grid div {
  padding: 14px 6px;
  border-top: 1px solid rgba(255,255,255,0.35);
  text-align: center;
}

.payload-grid strong,
.payload-grid span {
  display: block;
}

.payload-grid strong {
  font-size: 1.55rem;
}

.payload-grid span {
  margin-top: 4px;
  color: #cad7df;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
}

.scope-note {
  font-size: 0.9rem;
}

.bottle-panel {
  margin-top: 18px;
  padding: 18px;
}

.video-section {
  color: #fff;
  background: var(--forge-ink);
}

.video-grid {
  display: grid;
  grid-template-columns: minmax(230px, 0.72fr) minmax(0, 1.28fr);
  align-items: center;
  gap: 42px;
}

.video-section h2 {
  margin-bottom: 14px;
  color: #fff;
}

.video-section p:not(.section-kicker) {
  color: #c5cdd2;
}

.video-link {
  margin-top: 18px;
  border-color: #70808a !important;
  color: #fff;
}

.video-link:hover {
  border-color: #fff !important;
  background: #fff !important;
  color: var(--forge-ink) !important;
}

.video-embed {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid #55656f;
  border-radius: 10px;
  background: #111a20;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.24);
}

.video-embed iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.bibtex {
  overflow-x: auto;
  margin: 0;
  padding: 22px;
  border: 1px solid #d7d3cc;
  background: #fff;
  color: #37444d;
  font: 0.9rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.forge-footer a {
  color: var(--forge-blue);
}

.forge-footer p {
  margin: 4px 0;
}

@media (max-width: 820px) {
  .method-grid,
  .results-grid,
  .actor-panel,
  .result-wide {
    grid-template-columns: 1fr;
  }

  .result-wide {
    grid-column: auto;
  }

  .contribution-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .contribution-strip div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--forge-line);
  }

  .contribution-strip div:nth-child(4) {
    border-top: 1px solid var(--forge-line);
  }
}

@media (max-width: 560px) {
  .forge-page .topbar-inner,
  .forge-shell {
    width: min(100% - 24px, 1120px);
  }

  .forge-hero {
    padding-top: 54px;
  }

  .forge-hero h1 {
    font-size: 3.8rem;
  }

  .forge-title {
    font-size: 1.5rem;
  }

  .forge-section {
    padding: 54px 0;
  }

  .forge-section h2 {
    font-size: 2.1rem;
  }

  .abstract-copy {
    font-size: 1rem;
  }

  .contribution-strip,
  .payload-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .contribution-strip div:nth-child(3),
  .contribution-strip div:nth-child(4) {
    border-top: 1px solid var(--forge-line);
  }

  .video-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}
