:root {
  --ink: #15212b;
  --muted: #5b6671;
  --line: #d9e2df;
  --paper: #ffffff;
  --soft: #f5f8f7;
  --green: #0f7667;
  --green-dark: #075d53;
  --blue: #205375;
  --amber: #a85f09;
  --shadow: 0 18px 48px rgba(21, 33, 43, 0.12);
  --radius: 8px;
  --max: 1160px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

html[data-lang="en"] [data-lang="zh"],
html[data-lang="zh"] [data-lang="en"],
html[data-lang="en"] [data-page-lang="zh"],
html[data-lang="zh"] [data-page-lang="en"] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

body[data-lang="zh"] {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--green-dark);
}

code {
  padding: 0.08rem 0.32rem;
  background: #eef4f2;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(15, 118, 103, 0.28);
  outline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.55rem 0.8rem;
  color: #fff;
  background: var(--ink);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.header-inner {
  width: min(var(--max), calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand span:last-child {
  color: var(--green);
  font-weight: 700;
}

.main-nav {
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  gap: 0.15rem;
}

.main-nav a {
  min-width: 72px;
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--green-dark);
  background: #e7f3f0;
}

.language-switch {
  flex: 0 0 auto;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  background: #edf2f0;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.language-switch button {
  min-width: 48px;
  padding: 0.4rem 0.55rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
}

.language-switch button[aria-pressed="true"] {
  color: #fff;
  background: var(--green);
}

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

.section-band {
  width: 100%;
  max-width: none;
  padding-left: max(16px, calc((100% - var(--max)) / 2));
  padding-right: max(16px, calc((100% - var(--max)) / 2));
  background: var(--soft);
  border-block: 1px solid var(--line);
}

.hero {
  padding-top: 48px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.65fr);
  align-items: start;
  gap: clamp(2rem, 5vw, 4.5rem);
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html[data-lang="zh"] .eyebrow {
  letter-spacing: 0.04em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0.85rem;
  font-size: clamp(2.35rem, 5.2vw, 4.15rem);
  line-height: 1.05;
  font-weight: 820;
  letter-spacing: 0;
}

.hero-name-primary {
  display: inline-block;
}

.hero-name-local {
  display: inline-block;
  margin-left: 0.25em;
  color: var(--green-dark);
  font-size: 0.72em;
  font-weight: 760;
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(1.85rem, 3vw, 2.55rem);
  line-height: 1.12;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0.6rem;
  font-size: 1.1rem;
  line-height: 1.28;
}

.hero-role {
  max-width: 700px;
  color: var(--blue);
  font-size: clamp(1.05rem, 1.55vw, 1.35rem);
  font-weight: 720;
  line-height: 1.38;
}

.hero-role strong {
  font-weight: inherit;
}

.hero-summary {
  max-width: 700px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.68;
}

.hero-actions,
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.hero-actions a,
.footer-links a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.85rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 750;
  text-decoration: none;
}

.hero-actions a:first-child {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.profile-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 1.1rem;
}

.profile-panel img {
  width: min(100%, 308px);
  aspect-ratio: 308 / 450;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.profile-panel div {
  max-width: 308px;
  padding-left: 1rem;
  border-left: 4px solid var(--green);
}

.profile-panel p {
  margin-bottom: 0.25rem;
  color: var(--muted);
}

.profile-panel .profile-name {
  color: var(--ink);
  font-weight: 850;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 2rem;
}

.section-heading.wide {
  max-width: 920px;
}

.section-heading p {
  color: var(--muted);
}

.markdown-section > .section-heading > p:not(.eyebrow) {
  font-size: 1.04rem;
}

.timeline,
.research-grid,
.people-grid,
.opportunity-grid,
.course-columns,
.card-grid {
  display: grid;
  gap: 1rem;
}

.timeline {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.research-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.people-grid,
.opportunity-grid,
.course-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.people-grid,
.course-columns {
  grid-template-columns: 1fr;
  max-width: 920px;
}

.timeline article,
.research-card,
.list-card {
  padding: 1.15rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.timeline article {
  min-height: 150px;
}

.timeline h3 {
  color: var(--amber);
  font-size: 0.92rem;
}

.research-card {
  display: flex;
  min-height: 220px;
  flex-direction: column;
}

.research-card h3 {
  color: var(--blue);
}

.research-card p:last-child,
.list-card p:last-child {
  margin-bottom: 0;
}

.research-card a {
  margin-top: auto;
  padding-top: 1rem;
  font-weight: 750;
}

.list-card h3 {
  color: var(--green-dark);
}

.people-grid .list-card,
.course-columns .list-card {
  padding: 1.25rem 1.35rem;
}

.publication-list {
  display: grid;
  gap: 0.8rem;
}

.publication-list article {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.publication-list time {
  color: var(--green-dark);
  font-weight: 850;
}

.publication-list p {
  margin-bottom: 0;
}

.pub-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin-right: 0.55rem;
  margin-bottom: 0.25rem;
  padding: 0.14rem 0.5rem;
  color: var(--topic-color, var(--green-dark));
  background: var(--topic-bg, #e7f3f0);
  border: 1px solid var(--topic-border, #c8e2dc);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.topic-distributed {
  --topic-color: #075d53;
  --topic-bg: #e7f3f0;
  --topic-border: #b7d9d2;
}

.topic-pinns {
  --topic-color: #1d4f91;
  --topic-bg: #e7f0fb;
  --topic-border: #bfd4ef;
}

.topic-primal-dual {
  --topic-color: #7a3e0b;
  --topic-bg: #fbefe2;
  --topic-border: #e8c79f;
}

.topic-sparse {
  --topic-color: #6b3f8f;
  --topic-bg: #f1e9f8;
  --topic-border: #d5bfeb;
}

.topic-ai-math {
  --topic-color: #8a2f4f;
  --topic-bg: #f9e8ef;
  --topic-border: #e4b9ca;
}

.logo-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(80px, 1fr));
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
}

.logo-strip img {
  width: 100%;
  max-height: 70px;
  object-fit: contain;
  padding: 0.8rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  filter: saturate(0.95);
}

ul {
  margin: 0;
  padding-left: 1.2rem;
}

li + li {
  margin-top: 0.55rem;
}

.loading {
  min-height: 50vh;
  display: grid;
  align-content: center;
}

.loading.error h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin-bottom: 0.25rem;
}

.site-footer > div:first-child p:first-child {
  color: var(--ink);
  font-weight: 850;
}

.updated {
  grid-column: 1 / -1;
  font-size: 0.92rem;
}

@media (max-width: 980px) {
  .header-inner {
    flex-wrap: wrap;
    min-height: auto;
    padding: 0.7rem 0;
  }

  .brand {
    flex: 1 1 auto;
  }

  .main-nav {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 0.1rem;
  }

  .hero-grid,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .profile-panel {
    grid-template-columns: 180px minmax(0, 1fr);
    align-items: center;
  }

  .profile-panel img {
    width: 180px;
  }

  .timeline,
  .research-grid,
  .opportunity-grid,
  .logo-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .people-grid,
  .course-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 124px;
  }

  .section {
    width: min(100% - 24px, var(--max));
    padding: 56px 0;
  }

  .section-band {
    width: 100%;
    padding-left: 12px;
    padding-right: 12px;
  }

  .main-nav a {
    min-width: auto;
    white-space: nowrap;
  }

  h1 {
    font-size: clamp(2.1rem, 10vw, 3.05rem);
    line-height: 1.08;
  }

  .hero-name-local {
    display: block;
    margin-left: 0;
    margin-top: 0.12rem;
    font-size: 0.68em;
  }

  h2 {
    font-size: clamp(1.8rem, 9vw, 2.35rem);
  }

  .hero-role {
    font-size: 1.08rem;
  }

  .profile-panel,
  .timeline,
  .research-grid,
  .people-grid,
  .opportunity-grid,
  .course-columns,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .profile-panel img {
    width: min(100%, 308px);
  }

  .profile-panel div {
    padding-left: 0.8rem;
  }

  .publication-list article {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
