:root {
  color-scheme: light;
  --bg: #fbfbfa;
  --text: #27272a;
  --muted: #52525b;
  --subtle: #71717a;
  --heading: #09090b;
  --line: #e4e4e7;
  --line-soft: #eeeeef;
  --hover: #f4f4f5;
  --link: #0369a1;
  --header-bg: rgb(251 251 250 / 0.95);
}

:root.dark {
  color-scheme: dark;
  --bg: #2b2b2b;
  --text: #d4d4d8;
  --muted: #d4d4d8;
  --subtle: #a1a1aa;
  --heading: #f4f4f5;
  --line: rgb(63 63 70 / 0.65);
  --line-soft: rgb(63 63 70 / 0.55);
  --hover: rgb(63 63 70 / 0.3);
  --link: #7dd3fc;
  --header-bg: rgb(43 43 43 / 0.95);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.header-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.nav a,
.language-button {
  border-radius: 3px;
  padding: 0.25rem 0.625rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.nav a:hover,
.language-button:hover {
  background: var(--hover);
  color: var(--heading);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.25rem;
}

button {
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.icon-button {
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 150ms ease;
}

.icon-button:hover {
  color: var(--heading);
}

.icon-button svg,
.language-button svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 150ms ease;
}

.icon-button:hover .moon-icon {
  transform: rotate(-12deg) scale(1.1);
}

.icon-button:hover .sun-icon {
  transform: rotate(12deg) scale(1.1);
}

.language-button:hover svg {
  transform: translateY(-0.125rem) scale(1.1);
}

.sun-icon,
.dark .moon-icon {
  display: none;
}

.dark .sun-icon {
  display: block;
}

.language-button {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.page {
  max-width: 64rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
  display: grid;
  gap: 2.25rem;
}

.profile {
  align-self: start;
}

.portrait {
  width: 8rem;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 50% 18%;
  border: 1px solid var(--line);
  border-radius: 5px;
  display: block;
}

.profile h1 {
  margin: 1.25rem 0 0;
  color: var(--heading);
  font-size: 1.5rem;
  line-height: 1.2;
}

.cn-name {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 1.125rem;
  font-weight: 500;
}

.email {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5rem;
}

.email strong {
  color: var(--heading);
  font-weight: 600;
}

.profile-links {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-links a {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.profile-links svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.profile-links .github-mark {
  fill: currentColor;
  stroke: none;
}

section {
  scroll-margin-top: 5rem;
  border-top: 1px solid var(--line);
  padding: 1.75rem 0;
}

h2 {
  margin: 0 0 1rem;
  color: var(--heading);
  font-size: 1.25rem;
  line-height: 1.75rem;
}

p {
  margin: 0;
}

section > p {
  max-width: 48rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 2rem;
}

.education-list {
  display: grid;
  gap: 0.625rem;
}

.education-row {
  display: grid;
  gap: 0.125rem;
}

.education-row p {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5rem;
}

.education-row strong {
  color: var(--heading);
  font-weight: 600;
}

.education-row time {
  color: var(--subtle);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5rem;
}

.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-list {
  display: grid;
  gap: 1.25rem;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.75rem;
}

.paper-title {
  color: var(--heading);
  font-weight: 600;
}

.project-list .links {
  margin-top: 0.25rem;
}

.links a {
  margin-right: 0.5rem;
}

.publication-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.75rem;
}

.publication-list li + li {
  margin-top: 0.75rem;
}

.publication-list strong {
  color: var(--heading);
  font-weight: 700;
}

.publication-list em {
  color: var(--muted);
  font-style: italic;
}

.publication-list a {
  margin-left: 0.25rem;
}

.note {
  color: var(--subtle);
}

hr {
  margin: 1.75rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0;
  color: var(--subtle);
  font-size: 0.875rem;
}

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

@media (min-width: 640px) {
  .header-inner,
  .page {
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .portrait {
    width: 10rem;
  }
}

@media (min-width: 768px) {
  .page {
    grid-template-columns: 13.125rem minmax(0, 1fr);
    padding-top: 3.5rem;
    padding-bottom: 3.5rem;
  }

  .profile {
    position: sticky;
    top: 5rem;
  }

  .education-row {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 1.5rem;
  }

  .education-row time {
    text-align: right;
  }
}

@media (max-width: 520px) {
  .header-inner {
    align-items: flex-start;
  }

  .header-actions {
    padding-top: 0.125rem;
  }

  .nav a,
  .language-button {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }
}
