:root {
  color-scheme: light;
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-soft: #fffbeb;
  --ink: #1c1917;
  --muted: #57534e;
  --muted-soft: #78716c;
  --line: #e7e5e4;
  --accent: #b45309;
  --accent-soft: #fef3c7;
  --shadow: 0 12px 30px -12px rgba(28, 25, 23, 0.25);
  --radius: 6px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

@media (min-width: 1024px) {
  html {
    font-size: 18px;
  }
}

@media (min-width: 1440px) {
  html {
    font-size: 19px;
  }
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--muted);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

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

a {
  color: #292524;
  font-weight: inherit;
  text-decoration: underline;
  text-decoration-color: #d6d3d1;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover,
a:focus-visible {
  color: var(--accent);
  text-decoration-color: currentColor;
}

a:focus-visible,
.media-swap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 20;
  border-radius: var(--radius);
  background: var(--ink);
  color: #ffffff;
  padding: 8px 12px;
  transition: top 160ms ease;
}

.skip-link:focus {
  top: 16px;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

@media (min-width: 640px) {
  .container {
    padding: 5rem 2rem 6rem;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 1000px;
  }
}

@media (min-width: 1440px) {
  .container {
    max-width: 1140px;
  }
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  align-items: start;
  margin-bottom: 4rem;
}

@media (min-width: 640px) {
  .hero {
    grid-template-columns: 1fr 200px;
    gap: 1.7rem;
    align-items: center;
  }
}

.hero-name {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: baseline;
}

.hero h1 {
  margin: 0 0 0.25rem;
  color: var(--ink);
  font-family: "Cormorant Garamond", "Hoefler Text", Georgia, serif;
  font-size: 2.5rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.2;
}

@media (min-width: 640px) {
  .hero h1 {
    font-size: 2.9rem;
  }
}

@media (min-width: 1024px) {
  .hero h1 {
    font-size: 3.5rem;
  }
}

.chinese-name {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 500;
}

.tagline {
  margin: 0 0 0.85rem;
  color: transparent;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
}

.hero-spacer {
  user-select: none;
}

.hero p {
  max-width: 60ch;
}

@media (min-width: 640px) {
  .hero p {
    max-width: none;
  }
}

.hero-copy > p:not(.tagline):not(.chinese-name) {
  margin: 0 0 1rem;
  color: #44403c;
  font-size: 1rem;
  line-height: 1.65;
}

.hero-copy p:last-of-type {
  margin-bottom: 0;
}

.hero-copy > p:not(.tagline):not(.chinese-name) a {
  color: #3c332c;
  font-weight: 500;
  text-decoration-color: #cdbfb2;
}

.hero-copy > p:not(.tagline):not(.chinese-name) a:hover,
.hero-copy > p:not(.tagline):not(.chinese-name) a:focus-visible {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.highlight {
  color: var(--accent);
  font-weight: 600;
}

.keep-together {
  white-space: nowrap;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  padding: 0 0.85rem;
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.social-icon:hover {
  border-color: #fcd34d;
  background: var(--surface-soft);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -10px rgba(180, 83, 9, 0.35);
}

.social-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.social-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.social-label {
  color: inherit;
}

.portrait {
  width: 150px;
  justify-self: center;
  border-radius: 50%;
  box-shadow: var(--shadow);
  order: -1;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (min-width: 640px) {
  .portrait {
    width: 200px;
    justify-self: end;
    order: 0;
  }
}

.portrait:hover,
.portrait:focus-visible {
  transform: scale(1.04);
}

.portrait.media-swap {
  border-radius: 50%;
  background: #f5f5f4;
}

.portrait img {
  object-fit: cover;
}

.media-swap {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f5f5f4;
  isolation: isolate;
}

.media-swap img,
.media-swap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-swap.media-contain img,
.media-swap.media-contain video {
  object-fit: contain;
}

.paper-media.media-contain img,
.paper-media.media-contain video {
  object-fit: cover;
  object-position: center;
}

.media-square {
  aspect-ratio: 1 / 1;
}

.media-wide {
  aspect-ratio: 16 / 10;
}

.paper-media.media-wide {
  aspect-ratio: 1 / 1;
}

.paper-media.media-r3 {
  aspect-ratio: 360 / 200;
}

.paper-media.media-motion {
  aspect-ratio: 5 / 2;
}

.paper-media.media-ttt3r {
  aspect-ratio: 1248 / 1080;
}

.paper-media.media-human3r {
  aspect-ratio: 1264 / 1080;
}

.paper-media.media-feat2gs {
  aspect-ratio: 1 / 1;
}

.paper-media.media-feat2gs video {
  object-fit: contain;
}

.paper-media.media-bpnpl {
  aspect-ratio: 1440 / 1080;
}

.media-video,
.media-hover {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  transition: opacity 180ms ease;
}

.media-swap.is-active .media-video,
.media-swap.is-active .media-hover {
  opacity: 1;
}

.section {
  margin-bottom: 3.5rem;
}

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

.section-header h2,
.section h2 {
  position: relative;
  display: inline-block;
  margin: 0;
  color: var(--ink);
  font-family: "Cormorant Garamond", "Hoefler Text", Georgia, serif;
  font-size: 2.25rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.2;
}

.section-header h2::after,
.section > h2::after {
  content: "";
  display: block;
  width: 36px;
  height: 2px;
  margin-top: 0.5rem;
  border-radius: 2px;
  background: var(--accent);
}

.section-lede,
.research-intro,
.compact-list li,
.project-card p,
.talk-meta,
.summary {
  color: #44403c;
}

.section-lede {
  max-width: none;
  margin: 0.75rem 0 0;
}

.research-intro {
  display: grid;
  gap: 1rem;
  max-width: none;
  margin: 0 0 1.25rem;
}

.research-intro p {
  margin: 0;
}

.note {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.paper-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.paper {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: center;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}

.paper:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.paper > :not(.paper-media):not(.paper-content),
a[href*="alphaxiv" i] {
  display: none !important;
}

@media (min-width: 640px) {
  .paper {
    grid-template-columns: 220px 1fr;
    gap: 2rem;
  }
}

@media (min-width: 1024px) {
  .paper {
    grid-template-columns: 270px 1fr;
  }
}

@media (min-width: 1440px) {
  .paper {
    grid-template-columns: 310px 1fr;
  }
}

.paper-media {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  max-width: 310px;
  justify-self: center;
}

.paper-content {
  grid-column: 1;
  min-width: 0;
}

@media (min-width: 640px) {
  .paper-media {
    width: 220px;
    max-width: 220px;
    justify-self: start;
  }

  .paper-content {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (min-width: 1024px) {
  .paper-media {
    width: 270px;
    max-width: 270px;
  }
}

@media (min-width: 1440px) {
  .paper-media {
    width: 310px;
    max-width: 310px;
  }
}

.paper h3,
.project-card h3,
.talk-item h3 {
  margin: 0 0 0.6rem;
  color: var(--ink);
  font-family: "Cormorant Garamond", "Hoefler Text", Georgia, serif;
  font-feature-settings: "lnum" 1;
  font-size: 1.28rem;
  font-weight: 600;
  font-variant-numeric: lining-nums;
  letter-spacing: 0;
  line-height: 1.25;
}

.paper h3 a,
.project-card h3 a,
.talk-item h3 a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: background-size 0.3s ease, color 0.2s ease;
}

.paper h3 a:hover,
.project-card h3 a:hover,
.talk-item h3 a:hover {
  color: var(--accent);
  background-size: 100% 1px;
}

.paper-icon {
  display: inline-block;
  height: 20px;
  width: auto;
  margin-right: 4px;
  vertical-align: -3px;
}

.authors,
.venue,
.paper-links,
.summary,
.talk-meta,
.project-card p {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.authors,
.talk-meta {
  color: var(--muted);
}

.authors a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.authors a:hover {
  color: var(--accent);
  border-bottom-color: currentColor;
}

.venue {
  color: var(--ink);
  font-weight: 500;
}

.award {
  display: inline-block;
  margin: 0.25rem 0 0.5rem;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
}

.paper-links {
  color: var(--muted);
}

.paper-links a,
.talk-links a {
  color: var(--accent);
  text-decoration-color: #fcd34d;
  white-space: nowrap;
}

.summary {
  margin: 0.55rem 0 0;
  max-width: 60ch;
  font-size: 0.94rem;
  line-height: 1.65;
}

.project-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.94fr) minmax(0, 0.94fr);
  gap: 1.1rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.95rem;
}

.project-card .media-swap {
  margin-bottom: 1rem;
  height: 220px;
  background: #ffffff;
}

.project-card .media-swap img,
.project-card .media-swap video {
  object-fit: contain;
  object-position: center;
}

.project-card ul,
.compact-list {
  margin: 0.65rem 0 0;
  padding-left: 1.15rem;
}

.project-card li,
.compact-list li {
  margin-bottom: 0.42rem;
}

.inline-tags {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.32rem;
  vertical-align: top;
  white-space: nowrap;
}

.inline-tags span {
  white-space: nowrap;
}

.compact-list ul {
  margin: 0.4rem 0 0;
  padding-left: 1.15rem;
}

.compact-list ul li {
  margin-bottom: 0.25rem;
}

.teaching-item {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
}

.teaching-item p {
  margin: 0;
  color: #44403c;
}

.course-thumb {
  display: flex;
  width: 210px;
  min-height: 96px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: #1e5f83;
  box-shadow: 0 4px 12px rgba(28, 25, 23, 0.12);
  padding: 14px 18px;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.course-thumb:hover,
.course-thumb:focus-visible {
  background: #174b68;
  transform: translateY(-1px);
}

.course-thumb-title,
.course-thumb-subtitle {
  color: #f4f8fa;
}

.course-thumb-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.course-thumb-subtitle {
  margin-top: 0.55rem;
  color: #e4eef4;
  font-size: 0.72rem;
  line-height: 1.25;
}

.talk-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.talk-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: center;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}

.talk-thumb {
  width: 100%;
  max-width: 310px;
  height: auto;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

@media (min-width: 640px) {
  .talk-item {
    grid-template-columns: 220px 1fr;
    gap: 2rem;
  }

  .talk-thumb {
    width: 220px;
    max-width: 220px;
    justify-self: start;
  }
}

@media (min-width: 1024px) {
  .talk-item {
    grid-template-columns: 270px 1fr;
  }

  .talk-thumb {
    width: 270px;
    max-width: 270px;
  }
}

@media (min-width: 1440px) {
  .talk-item {
    grid-template-columns: 310px 1fr;
  }

  .talk-thumb {
    width: 310px;
    max-width: 310px;
  }
}

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted-soft);
  font-size: 0.78rem;
}

.footer p {
  margin: 0;
}

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

@media (max-width: 820px) {
  .section-header {
    display: grid;
    gap: 1rem;
    align-items: start;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .project-card .media-swap {
    height: auto;
    aspect-ratio: 16 / 10;
  }

  .teaching-item {
    grid-template-columns: 1fr;
  }

  .course-thumb {
    max-width: 100%;
  }
}

@media (max-width: 520px) {
  .container {
    padding: 2rem 1rem 3rem;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero-name {
    gap: 0.45rem;
  }

  .portrait {
    width: 150px;
  }

  .keep-together {
    white-space: normal;
  }

  .project-card {
    padding: 0.85rem;
  }
}
