:root {
  color-scheme: light;
  --bg: #f7f1e8;
  --surface: #fffaf1;
  --ink: #2f2923;
  --muted: #766c62;
  --faint: #cfc1ae;
  --line: rgba(84, 67, 49, 0.16);
  --accent: #a65f35;
  --accent-soft: rgba(166, 95, 53, 0.1);
  --max: 1040px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 250, 241, 0.9), rgba(247, 241, 232, 0) 28rem),
    var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.58;
}

a {
  color: inherit;
  text-decoration-color: rgba(166, 95, 53, 0.4);
  text-underline-offset: 0.22em;
}

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

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

.site-header,
main,
.site-footer {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.52rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-en {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.04rem;
  font-weight: 700;
}

.brand-cn {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1.15rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.nav a {
  text-decoration: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: clamp(2rem, 7vw, 5.5rem);
  align-items: center;
  padding: 44px 0 40px;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 1.04;
}

h1 {
  margin-bottom: 0.58rem;
  font-size: clamp(1.68rem, 3.2vw, 2.12rem);
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 2.7vw, 1.92rem);
}

h3 {
  margin-bottom: 0.3rem;
  font-size: 1.03rem;
  line-height: 1.35;
}

h4 {
  margin-bottom: 0.2rem;
  font-size: 0.98rem;
  line-height: 1.35;
}

.intro {
  max-width: 670px;
  margin-bottom: 0.88rem;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.04rem, 1.75vw, 1.2rem);
  line-height: 1.38;
}

.intro-arrow {
  position: relative;
  top: -0.08em;
  display: inline-block;
  color: var(--accent);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82em;
  font-weight: 750;
}

.lead {
  max-width: 660px;
  margin-bottom: 0.66rem;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.98rem;
  line-height: 1.5;
}

.collaboration-note {
  max-width: 690px;
  margin-bottom: 0.48rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.open-note {
  max-width: 690px;
  margin-bottom: 1rem;
  color: var(--accent);
  font-size: 0.92rem;
}

.affiliation-strip,
.profile-links,
.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.affiliation-strip {
  margin-bottom: 1.05rem;
}

.affiliation,
.link-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2.18rem;
  gap: 0.46rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.56);
}

.wechat-pill {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}

.wechat-menu {
  position: relative;
}

.wechat-menu summary {
  list-style: none;
}

.wechat-menu summary::-webkit-details-marker {
  display: none;
}

.wechat-card {
  position: absolute;
  top: calc(100% + 0.55rem);
  left: 0;
  z-index: 5;
  display: none;
  min-width: 12.5rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.98);
  box-shadow: 0 18px 44px rgba(58, 45, 31, 0.12);
}

.wechat-menu[open] .wechat-card {
  display: grid;
}

.wechat-card a {
  padding: 0.42rem 0.5rem;
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.wechat-card a:hover {
  background: rgba(47, 41, 35, 0.06);
}

.qr-mark {
  display: inline-grid;
  width: 0.92rem;
  height: 0.92rem;
  flex: 0 0 0.92rem;
  border: 1px solid currentColor;
  border-radius: 3px;
  background:
    linear-gradient(currentColor, currentColor) 25% 25% / 3px 3px no-repeat,
    linear-gradient(currentColor, currentColor) 75% 25% / 3px 3px no-repeat,
    linear-gradient(currentColor, currentColor) 25% 75% / 3px 3px no-repeat,
    linear-gradient(currentColor, currentColor) 72% 72% / 2px 2px no-repeat;
  opacity: 0.7;
}

.affiliation {
  padding: 0.32rem 0.66rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.logo-mark {
  display: inline-grid;
  width: 0.88rem;
  height: 0.88rem;
  flex: 0 0 0.88rem;
  place-items: center;
  overflow: hidden;
}

.logo-mark img {
  width: auto;
  height: auto;
  max-width: 0.88rem;
  max-height: 0.88rem;
  object-fit: contain;
}

.logo-mark.logo-wide {
  width: 1.12rem;
  flex-basis: 1.12rem;
}

.logo-wide img {
  max-width: 1.12rem;
  max-height: 0.88rem;
}

.profile-links {
  gap: 0.6rem;
}

.link-pill {
  padding: 0.42rem 0.72rem;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 650;
  text-decoration: none;
}

.link-pill.primary {
  border-color: rgba(47, 41, 35, 0.2);
  background: var(--ink);
  color: var(--surface);
}

.link-pill.primary .logo-mark {
  width: 0.98rem;
  height: 0.98rem;
  flex-basis: 0.98rem;
  border-radius: 999px;
  background: var(--surface);
}

.link-pill.primary .logo-mark img {
  max-width: 0.98rem;
  max-height: 0.98rem;
}

.portrait-panel {
  justify-self: end;
  width: 250px;
}

.portrait {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 7px;
  object-fit: cover;
}

.portrait-meta {
  display: grid;
  gap: 0.1rem;
  padding-top: 0.85rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.portrait-meta p {
  margin-bottom: 0;
}

.section {
  padding: 36px 0;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(150px, 0.28fr) minmax(0, 1fr);
  gap: 1.6rem;
  align-items: start;
  margin-bottom: 1.3rem;
}

.research-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.research-item {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1.3rem 1.35rem 1.42rem 0;
  border-right: 1px solid var(--line);
}

.research-item:last-child {
  border-right: 0;
  padding-right: 0;
}

.research-item span,
.time,
.pub-year {
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
}

.research-item p,
.cv-item p,
.authors,
.venue,
.recognition-list,
.visitor-panel p {
  color: var(--muted);
}

.research-item p,
.cv-item p,
.recognition-list p,
.visitor-panel p {
  margin-bottom: 0;
}

.cv-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3rem;
}

.board-title {
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.cv-item {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0.78rem;
  padding: 0.78rem 0;
  border-bottom: 1px solid var(--line);
}

.org-logo {
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  place-items: center;
  align-self: start;
  margin-top: 0.12rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 250, 241, 0.58);
}

.org-logo img {
  width: 1.12rem;
  height: 1.12rem;
  object-fit: contain;
}

.org-logo.logo-wide img {
  width: 1.35rem;
  height: 0.92rem;
}

.time {
  margin-bottom: 0.15rem;
  font-size: 0.9rem;
}

.cv-item p:not(.time) {
  font-size: 0.92rem;
}

.split-section {
  display: grid;
  grid-template-columns: 0.28fr minmax(0, 1fr);
  gap: 1.6rem;
  align-items: start;
}

.compact-heading {
  display: block;
  margin-bottom: 0;
}

.publication-list {
  border-top: 1px solid var(--line);
}

.publication {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.publication h3 {
  margin-bottom: 0.35rem;
}

.pub-year,
.authors,
.venue {
  margin-bottom: 0;
}

.pub-year {
  font-size: 1.02rem;
}

.authors,
.venue {
  font-size: 0.91rem;
}

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

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

.open-source-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
}

.open-source-item h3 {
  margin-bottom: 0.2rem;
}

.open-source-item p {
  margin-bottom: 0;
  color: var(--muted);
}

.open-source-item > span {
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  white-space: nowrap;
}

.recognition-item {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.86rem 0;
  border-bottom: 1px solid var(--line);
}

.recognition-item span {
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
}

.recognition-item p {
  color: var(--muted);
}

.recognition-item ul {
  display: grid;
  gap: 0.34rem;
  margin: 0;
  padding: 0;
  color: var(--muted);
  list-style: none;
}

.recognition-item li {
  position: relative;
  padding-left: 1rem;
}

.recognition-item li::before {
  position: absolute;
  left: 0;
  color: var(--accent);
  content: "·";
}

.visitor-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 1.2rem;
  align-items: center;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--line);
}

.flagcounter-map {
  display: block;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.58);
}

.flagcounter-map img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.visitor-copy {
  display: grid;
  gap: 0.65rem;
}

.visitor-panel p {
  font-size: 0.92rem;
}

.visitor-link {
  width: fit-content;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 22px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin-bottom: 0;
}

.footer-links {
  gap: 0.85rem;
}

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

  .nav {
    justify-content: flex-start;
  }

  .hero,
  .section-heading,
  .split-section,
  .visitor-panel {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 38px 0 40px;
  }

  .portrait-panel {
    justify-self: start;
    width: min(100%, 260px);
  }

  .research-list,
  .cv-board {
    grid-template-columns: 1fr;
  }

  .research-item,
  .research-item:last-child {
    padding-right: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .research-item:last-child {
    border-bottom: 0;
  }

  .compact-heading {
    margin-bottom: 1.1rem;
  }
}

@media (max-width: 560px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 28px, var(--max));
  }

  .hero {
    gap: 1.45rem;
  }

  .intro {
    font-size: 1rem;
    line-height: 1.45;
  }

  .section {
    padding: 34px 0;
  }

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

  .open-source-item,
  .recognition-item {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
