:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #202124;
  --muted: #27282b;
  --line: #e5e5e5;
  --accent: #111111;
  --accent-text: #ffffff;
  --timeline-accent: #5145a8;
  --timeline-highlight: #187a46;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.08);
  --max: 1080px;
  --page-pad: clamp(18px, 4vw, 64px);
  --anchor-offset: 136px;
  --font-sans: Arial, Helvetica, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111111;
  --surface: #191919;
  --text: #f1f1ed;
  --muted: #aaaaa2;
  --line: #33332f;
  --accent: #f1f1ed;
  --accent-text: #111111;
  --timeline-accent: #b8a9ff;
  --timeline-highlight: #74dfa5;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.55;
}

body::after {
  display: block;
  height: 42vh;
  content: "";
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--muted);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - var(--page-pad) * 2), var(--max));
  margin: 0 auto;
  padding: 24px 0;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
}

.brand {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 0.94rem;
}

.nav a {
  transition: color 160ms ease;
}

.theme-toggle,
.language-toggle {
  display: inline-grid;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.theme-toggle {
  width: 34px;
  border-radius: 50%;
}

.language-toggle {
  min-width: 48px;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 0.82rem;
}

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

main > .section:not(.hero) {
  border-top: 1px solid var(--line);
}

.hero {
  display: flex;
  min-height: calc(92vh - 88px);
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: clamp(56px, 8vh, 104px);
  text-align: center;
}

.avatar {
  display: grid;
  width: clamp(230px, 24vw, 330px);
  height: clamp(230px, 24vw, 330px);
  margin-bottom: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 47% 39%;
}

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

h1,
h2 {
  font-family: var(--font-sans);
  line-height: 1.18;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(3.25rem, 5vw, 4.45rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  transform: translateY(-14px);
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -0.03em;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.18rem;
}

.tagline {
  margin-bottom: 44px;
  color: #000000;
  font-size: clamp(1.85rem, 3vw, 2.55rem);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -0.025em;
  transform: translateY(6px);
}

:root[data-theme="dark"] .tagline {
  color: #ffffff;
}

.intro {
  max-width: 660px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 1.04rem;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.social-links a,
.button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 0.94rem;
  transition: border-color 160ms ease, transform 160ms ease;
}

.social-links a:hover,
.button:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
}

.split {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1.6fr);
  gap: 60px;
  border-top: 1px solid var(--line);
}

.prose {
  max-width: 900px;
  color: var(--muted);
  font-size: 1.04rem;
}

.page-title {
  margin-bottom: 24px;
  color: var(--text);
  font-size: clamp(1.85rem, 4vw, 2.65rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.18;
  scroll-margin-top: var(--anchor-offset);
}

.project-list {
  display: grid;
  gap: 18px;
  max-width: 900px;
  margin-left: auto;
}

.project-item {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  column-gap: 30px;
  align-items: start;
}

.project-item time {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
  text-align: right;
}

.project-item a,
.project-item h3 {
  color: var(--text);
  font-size: clamp(1.18rem, 2vw, 1.42rem);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0;
}

.project-item a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 8px;
}

.project-item p {
  max-width: 920px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.58;
}

.detail-list {
  display: grid;
  gap: 28px;
  max-width: 980px;
}

.detail-item {
  border-left: 2px solid var(--line);
  padding-left: 20px;
}

.detail-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}

.detail-heading h3 {
  margin-bottom: 8px;
  color: var(--text);
  font-size: clamp(1.08rem, 2vw, 1.28rem);
  line-height: 1.35;
}

.detail-heading time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
}

.detail-item p {
  max-width: 900px;
  margin: 0;
  color: var(--muted);
}

#experience .detail-heading h3,
#experience .detail-heading time,
#experience .experience-list,
#experience .experience-date,
#experience .experience-company {
  font-size: 1.04rem;
  font-weight: 400;
}

.subsection-title {
  margin: 39px 0 16px;
  font-size: 1.45rem;
}

.publication-list + .publication-subsection {
  margin-top: 39px;
  padding-top: 0;
}

.two-column-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px;
  max-width: 980px;
}

.two-column-list h3 {
  margin-bottom: 12px;
}

.two-column-list ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
}

.two-column-list li {
  padding-left: 0.2rem;
}

.talk-list {
  display: grid;
  max-width: 980px;
  border-top: 1px solid var(--line);
}

.talk-item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 28px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.talk-item time {
  color: #17497b;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.talk-item h3 {
  margin: 0;
  font-size: clamp(1rem, 1.7vw, 1.14rem);
  font-weight: 500;
  line-height: 1.4;
}

.talk-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

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

.repo-card {
  display: flex;
  min-height: 170px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  background: var(--surface);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.repo-card:hover {
  border-color: color-mix(in srgb, var(--text) 35%, var(--line));
  color: var(--text);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.repo-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.repo-heading h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1rem, 1.7vw, 1.16rem);
  font-weight: 800;
}

.repo-heading h3 span {
  font-weight: 500;
}

.repo-type {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.repo-card > p {
  margin: 17px 0 20px;
  color: var(--muted);
  font-size: 0.94rem;
}

.repo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: auto;
  color: var(--muted);
  font-size: 0.88rem;
}

.repo-meta span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.language-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.language-dot.cuda {
  background: #3a75c4;
}

.language-dot.cpp {
  background: #f34b7d;
}

:root[data-theme="dark"] .talk-item time {
  color: #86b7e8;
}

.interest-list {
  max-width: 900px;
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text);
  font-size: clamp(1.1rem, 2vw, 1.32rem);
  font-weight: 400;
  line-height: 1.75;
  list-style-type: square;
}

.interest-list li {
  padding-left: 0.25rem;
}

.list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.list-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.list-item span {
  font-weight: 600;
}

.list-item time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.92rem;
}

.publication-list {
  display: grid;
  gap: 22px;
  max-width: 980px;
  color: var(--text);
}

.publication-item {
  position: relative;
  padding-left: 18px;
}

.publication-item::before {
  position: absolute;
  top: 0.82em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text);
  content: "";
}

.publication-item p {
  margin: 0;
}

.publication-authors,
.publication-venue,
.publication-links {
  font-size: clamp(0.98rem, 1.55vw, 1.08rem);
  font-weight: 700;
  line-height: 1.45;
}

.publication-tag {
  color: #6d28d9;
  font-weight: 800;
}

.me {
  text-decoration: none;
}

.coauthors {
  font-weight: 400;
  text-decoration: none;
}

.publication-title {
  margin-top: 2px;
  font-size: clamp(1rem, 1.7vw, 1.12rem);
  font-style: normal;
  font-weight: 400;
  line-height: 1.32;
}

.publication-venue {
  margin-top: 2px;
  font-weight: 500;
}

.publication-links {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
  font-weight: 800;
}

.publication-meta {
  color: #6d28d9;
}

.publication-links a {
  color: var(--text);
  font-weight: 400;
}

.publication-links a:hover {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

:root[data-theme="dark"] .publication-tag {
  color: #c4b5fd;
}

:root[data-theme="dark"] .publication-meta {
  color: #c4b5fd;
}


.experience-list {
  display: grid;
  gap: 10px;
  max-width: 980px;
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text);
  font-size: clamp(1.08rem, 1.9vw, 1.32rem);
  font-weight: 700;
  line-height: 1.45;
  list-style-type: square;
}

.experience-list li {
  padding-left: 0.25rem;
}

.lang-content.lang-zh {
  display: none;
}

:root[data-lang="zh"] .lang-content.lang-en {
  display: none;
}

:root[data-lang="zh"] .lang-content.lang-zh {
  display: inline;
}

.experience-date {
  color: #465a62;
  font-weight: 800;
  white-space: nowrap;
}

.experience-company {
  color: #465a62;
  font-weight: 800;
}

:root[data-theme="dark"] .experience-date,
:root[data-theme="dark"] .experience-company {
  color: var(--text);
}

.contact p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
}

.timeline {
  position: relative;
  display: grid;
  gap: 10px;
  max-width: 980px;
  margin: 8px auto 0;
  padding: 12px 0;
}

.timeline::before {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 50%;
  width: 3px;
  transform: translateX(-50%);
  background: var(--text);
  content: "";
}

.timeline-item {
  position: relative;
  width: calc(50% - 42px);
  min-height: 116px;
  padding: 16px 0;
  text-align: right;
}

.timeline-item:nth-child(even) {
  margin-left: calc(50% + 42px);
  text-align: left;
}

.timeline-node {
  position: absolute;
  top: 30px;
  right: -49px;
  width: 15px;
  height: 15px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--text);
  z-index: 1;
}

.timeline-item:nth-child(even) .timeline-node {
  right: auto;
  left: -49px;
}

.timeline-card {
  position: relative;
  min-height: 96px;
  padding: 4px 0 4px 54px;
}

.timeline-item:nth-child(odd) .timeline-card {
  padding: 4px 54px 4px 0;
}

.timeline-badge {
  position: absolute;
  top: 3px;
  left: 0;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 4px;
  overflow: hidden;
}

.timeline-badge img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.timeline-item:nth-child(odd) .timeline-badge {
  right: 0;
  left: auto;
}

.timeline-period,
.timeline-card h3,
.timeline-card p {
  margin: 0;
}

.timeline-period {
  color: var(--timeline-accent);
  font-size: 0.98rem;
  font-weight: 700;
}

.timeline-card h3 {
  display: grid;
  row-gap: 6px;
  margin-top: 6px;
  color: var(--text);
  font-size: clamp(1rem, 1.8vw, 1.26rem);
  font-weight: 700;
  line-height: 1.3;
}

.timeline-org {
  display: block;
  color: var(--timeline-accent);
}

.timeline-card p:not(.timeline-period) {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.95rem;
}

.timeline-card p.timeline-highlight {
  margin-top: 8px;
  color: var(--timeline-highlight);
  font-size: 1.08rem;
  font-weight: 800;
}

.email-line a {
  color: var(--text);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

#email {
  scroll-margin-top: var(--anchor-offset);
}

.button {
  display: inline-flex;
  background: var(--accent);
  color: var(--accent-text);
}

.button:hover {
  color: var(--accent-text);
}

.site-footer {
  width: min(calc(100% - var(--page-pad) * 2), var(--max));
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 28px 0 42px;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.visitor-map {
  display: grid;
  width: 100%;
  min-height: 360px;
  place-items: center;
  overflow: hidden;
}

.visitor-map iframe,
.visitor-map canvas,
.visitor-map img,
.visitor-map > div {
  max-width: 100%;
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .nav {
    width: 100%;
    flex-wrap: wrap;
    gap: 14px;
  }

  .section {
    padding: 30px 0;
  }

  .hero {
    min-height: auto;
    padding-top: 52px;
  }

  .avatar {
    width: clamp(200px, 60vw, 270px);
    height: clamp(200px, 60vw, 270px);
    margin-bottom: 30px;
  }

  .split {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .page-title {
    margin-bottom: 20px;
  }

  .project-list {
    gap: 26px;
    margin-left: 0;
  }

  .project-item {
    grid-template-columns: 1fr;
    row-gap: 6px;
  }

  .project-item time {
    font-size: 1.18rem;
    text-align: left;
  }

  .project-item a {
    font-size: clamp(1.12rem, 5vw, 1.35rem);
    line-height: 1.45;
  }

  .detail-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .two-column-list {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .talk-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }

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

  .visitor-map {
    min-height: 300px;
  }

  .list-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .timeline {
    gap: 0;
    margin-left: 10px;
    padding-left: 32px;
  }

  .timeline::before {
    left: 0;
    transform: none;
  }

  .timeline-item,
  .timeline-item:nth-child(even) {
    width: 100%;
    min-height: auto;
    margin-left: 0;
    padding: 12px 0 18px;
    text-align: left;
  }

  .timeline-node,
  .timeline-item:nth-child(even) .timeline-node {
    top: 24px;
    right: auto;
    left: -40px;
  }

  .timeline-card,
  .timeline-item:nth-child(odd) .timeline-card {
    min-height: 0;
    padding: 4px 0 4px 52px;
  }

  .timeline-badge,
  .timeline-item:nth-child(odd) .timeline-badge {
    right: auto;
    left: 0;
  }
}
