:root {
  --font-sans: "Avenir Next", "SF Pro Text", "Segoe UI", "Helvetica Neue", Helvetica, Arial, "PingFang SC",
    "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  --font-ui: "Avenir Next", "SF Pro Text", "Segoe UI", "Helvetica Neue", Helvetica, Arial, "PingFang SC",
    "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  --font-serif: "Baskerville", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Noto Serif SC",
    "Source Han Serif SC", serif;
  --radius-s: 10px;
  --radius-l: 14px;
  --bg: #ffffff;
  --text: #1f2328;
  --muted: #5f6b7a;
  --line: #d5ddd8;
  --card-line: #d7e0db;
  --header-line: #dde6e0;
  --footer-line: #e3ebe6;
  --accent: #6f977f;
  --accent-strong: #4f7560;
  --accent-soft: #f4f8f5;
  --header-bg: rgba(252, 254, 253, 0.92);
  --card-bg: #fbfcfb;
  --title-muted: #4f5b67;
  --secondary-text: #334155;
  --author-text: #506070;
  --button-bg: #f7fbf8;
  --button-border: #c8d8cf;
  --button-text: #334155;
  --button-hover-bg: #eef5f0;
  --button-hover-border: #a7c0b2;
  --bio-link: #657d70;
  --bio-link-hover: #556f61;
  --footer-text: #7b8680;
  --separator: #a6b4ad;
  --shadow: rgba(73, 108, 88, 0.12);
}

html {
  color-scheme: light dark;
  scroll-behavior: smooth;
}

@font-face {
  font-family: "HYRunLiW Name";
  src: url("fonts/HYRunLiW-name.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412;
    --text: #e6ece9;
    --muted: #a1b1aa;
    --line: #33403a;
    --card-line: #3a4741;
    --header-line: #29342f;
    --footer-line: #29342f;
    --accent: #9fc7ac;
    --accent-strong: #c4e4ce;
    --accent-soft: #17201c;
    --header-bg: rgba(15, 20, 18, 0.96);
    --card-bg: #151d1a;
    --title-muted: #93a39c;
    --secondary-text: #c5d2cd;
    --author-text: #afbbb5;
    --button-bg: #17201c;
    --button-border: #33453d;
    --button-text: #d6e0db;
    --button-hover-bg: #1e2a24;
    --button-hover-border: #476255;
    --bio-link: #94afa0;
    --bio-link-hover: #aec4b7;
    --footer-text: #a7b4ae;
    --separator: #5c6c65;
    --shadow: rgba(0, 0, 0, 0.34);
  }

  html {
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-kerning: normal;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
  transition: color 0.18s ease;
}

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

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

.container {
  width: min(980px, 94vw);
  margin: 0 auto;
}

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
}

.nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 13px;
  font-family: var(--font-ui);
}

.nav a {
  position: relative;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 0;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(0.72);
  transform-origin: center;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--accent-strong);
}

.nav a:hover::after,
.nav a:focus-visible::after {
  opacity: 0.9;
  transform: scaleX(1);
}

.page-shell {
  padding: 24px 0 52px;
}

.section {
  margin-top: 28px;
  scroll-margin-top: 88px;
}

.profile h1 {
  margin: 0 0 8px;
  font-size: 35px;
  line-height: 1.14;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-family: var(--font-serif);
}

.subpage-hero h1 {
  margin: 0 0 10px;
  font-size: 38px;
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-family: var(--font-serif);
}

.name-zh {
  font-size: 0.7em;
  font-weight: 400;
  color: var(--title-muted);
  margin-left: 0.24em;
  letter-spacing: 0.04em;
  font-family: "HYRunLiW Name", "汉仪润隶 W", "汉仪润隶W", "HanYi RunLi W", "HYRunLiW", var(--font-serif);
}

.subtitle,
.profile-meta,
.section-note,
.subpage-intro,
.footer-note {
  color: var(--muted);
}

.section-kicker {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  font-family: var(--font-ui);
}

.subtitle {
  margin: 0 0 6px;
  font-size: 15px;
  font-family: var(--font-ui);
}

.links {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.65;
  font-family: var(--font-ui);
}

.links a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.18em;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

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

.sep {
  position: relative;
  color: transparent;
  display: inline-block;
  width: 10px;
  margin: 0 4px;
}

.sep::before {
  content: "·";
  position: absolute;
  inset: 0;
  color: var(--separator);
  text-align: center;
}

.profile-meta {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--card-line);
  border-radius: var(--radius-s);
  background: var(--accent-soft);
}

h2 {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
  font-family: var(--font-ui);
}

#news h2,
#publications h2 {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

p,
li {
  font-size: 15px;
  line-height: 1.78;
}

.subtitle strong,
#biography strong,
.plain-list strong,
.subpage-intro strong {
  color: inherit;
  font-weight: 500;
}

#biography {
  max-width: 61.8%;
}

#biography.section {
  margin-top: 22px;
}

#news {
  max-width: 70ch;
}

.subpage-hero {
  max-width: 68ch;
}

.subpage-intro {
  margin: 0;
  max-width: 60ch;
  font-size: 14px;
  line-height: 1.8;
}

.gallery-section {
  margin-top: 20px;
}

#biography p {
  margin: 0 0 10px;
  font-size: 15.5px;
  line-height: 1.82;
  color: var(--secondary-text);
}

#biography p:last-child {
  margin-bottom: 0;
}

.section-note {
  margin: 2px 0 8px;
  font-size: 14px;
}

.plain-list {
  margin: 0;
  padding-left: 22px;
}

.news-date {
  color: var(--text);
  font-weight: 600;
}

#biography a {
  color: var(--bio-link);
  font-weight: 700;
}

#biography a:hover {
  color: var(--bio-link-hover);
}

.pub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 10px;
}

.pub-card {
  background: transparent;
  border: 1px solid var(--card-line);
  border-radius: var(--radius-l);
  padding: 14px;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.gallery-card {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-l);
  padding: 10px;
  transition: none;
}

.pub-card {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
  align-items: center;
}

.pub-card:hover {
  background: transparent;
  border-color: var(--line);
  transform: none;
}

.pub-media {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  justify-self: center;
  overflow: hidden;
  border-radius: var(--radius-s);
  background: var(--accent-soft);
  padding: 7px;
  max-width: 100%;
}

.pub-media picture {
  display: block;
  max-width: 100%;
}

.pub-media img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 232px;
  object-fit: contain;
}

.pub-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-s);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  font-family: var(--font-ui);
}

.pub-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.44;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.pub-title a {
  color: var(--text);
}

.pub-title a:hover {
  color: var(--text);
}

.pub-authors {
  margin: 9px 0 0;
  color: var(--author-text);
  font-size: 14px;
  line-height: 1.65;
}

.author-me {
  color: var(--text);
  font-weight: 600;
}

.pub-links {
  margin: 12px 0 0;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.pub-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
  font-weight: 600;
  font-family: var(--font-ui);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.18em;
}

.pub-btn::before {
  content: "";
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  background-color: currentColor;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.pub-btn.icon-project::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M9.5 2h4v4h-1.5V4.56l-5.72 5.72-1.06-1.06L10.94 3.5H9.5V2ZM3 3.5h4v1.5H4.5v6h6V9h1.5v3.5H3v-9Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M9.5 2h4v4h-1.5V4.56l-5.72 5.72-1.06-1.06L10.94 3.5H9.5V2ZM3 3.5h4v1.5H4.5v6h6V9h1.5v3.5H3v-9Z'/%3E%3C/svg%3E");
}

.pub-btn.icon-code::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M6.03 3.22 1.97 7.28a1 1 0 0 0 0 1.44l4.06 4.06 1.06-1.06L3.56 8l3.53-3.72-1.06-1.06Zm3.94 0-1.06 1.06L12.44 8l-3.53 3.72 1.06 1.06 4.06-4.06a1 1 0 0 0 0-1.44L9.97 3.22Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M6.03 3.22 1.97 7.28a1 1 0 0 0 0 1.44l4.06 4.06 1.06-1.06L3.56 8l3.53-3.72-1.06-1.06Zm3.94 0-1.06 1.06L12.44 8l-3.53 3.72 1.06 1.06 4.06-4.06a1 1 0 0 0 0-1.44L9.97 3.22Z'/%3E%3C/svg%3E");
}

.pub-btn.icon-paper::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M4 1.5h5.25L13 5.25V14.5H4v-13Zm1.5 1.5V13h6V6H8.5V3H5.5Zm4.5.56V5.5h1.94L10 3.56Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M4 1.5h5.25L13 5.25V14.5H4v-13Zm1.5 1.5V13h6V6H8.5V3H5.5Zm4.5.56V5.5h1.94L10 3.56Z'/%3E%3C/svg%3E");
}

.pub-btn:hover {
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

.back-link {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

.back-link:hover {
  color: var(--accent-strong);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.gallery-card {
  display: block;
}

.gallery-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-s);
  background: var(--accent-soft);
}

.gallery-card h3 {
  margin: 10px 0 0;
  font-size: 16px;
  line-height: 1.4;
  color: var(--accent-strong);
  text-align: center;
}

.visitor-map:not([hidden]) {
  display: flex;
  justify-content: center;
}

.visitor-map__content {
  max-width: 220px;
}

.site-footer {
  border-top: 1px solid var(--footer-line);
  padding: 28px 0 24px;
}

.site-footer .container {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--footer-text);
}

.site-footer .container > * {
  display: inline-flex;
  align-items: center;
}

.site-footer .container > * + *::before {
  content: "·";
  margin-right: 10px;
  color: var(--separator);
}

.footer-note {
  letter-spacing: 0.02em;
}

@media (max-width: 960px) {
  #biography {
    max-width: 70ch;
  }
}

@media (max-width: 720px) {
  #biography {
    max-width: 100%;
  }

  .pub-card {
    grid-template-columns: 1fr;
  }

  .pub-media img {
    max-height: 248px;
  }

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

  .gallery-card img {
    aspect-ratio: 1 / 1;
  }
}

@media (max-width: 640px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: row;
    padding: 12px 0;
  }

  .nav {
    flex: 1 1 auto;
    min-width: 0;
    gap: 12px;
  }

  .profile h1 {
    font-size: 29px;
  }

  .subpage-hero h1 {
    font-size: 31px;
  }

  .pub-title {
    font-size: 16px;
  }
}

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

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
