:root {
  --paper: #F5F2E8;
  --container: #FBFAF5;
  --ink: #1A1612;
  --ink-soft: #4A433B;
  --stone: #9A938A;
  --vermillion: #B83A29;
  --seal-deep: #8C2519;
  --rule: #D8D1C0;

  --font-display: 'EB Garamond', 'Noto Serif SC', Georgia, serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-cn: 'Noto Serif SC', 'EB Garamond', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

  --text-xs: 0.78rem;
  --text-sm: 0.875rem;
  --text-base: 1.0625rem;
  --text-lg: 1.328rem;
  --text-xl: 1.66rem;
  --text-2xl: 2.075rem;
  --text-3xl: 2.594rem;
  --text-4xl: 3.243rem;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 40px;
  --space-5: 64px;
  --space-6: 96px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--paper);
  color: var(--ink);
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.08 0 0 0 0 0.05 0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: multiply;
}

body::after {
  content: '';
  position: fixed;
  top: -200px;
  right: -200px;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(184, 58, 41, 0.07) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.container {
  background-color: var(--container);
  width: 88%;
  max-width: 720px;
  margin: var(--space-3) auto;
  padding: var(--space-4) var(--space-4) var(--space-3);
  position: relative;
  z-index: 1;
  box-shadow:
    0 1px 2px rgba(26, 22, 18, 0.04),
    0 8px 32px rgba(26, 22, 18, 0.06);
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.005em;
}

h2 {
  font-size: var(--text-xl);
  margin: var(--space-4) 0 var(--space-2);
  position: relative;
  line-height: 1.2;
}

h2::after {
  content: '';
  display: block;
  width: 32px;
  height: 2px;
  background: var(--vermillion);
  margin-top: var(--space-1);
  transform-origin: left center;
  animation: rule-draw 700ms var(--ease-out) backwards;
  animation-delay: 500ms;
}

p { margin: 0 0 12px; }

a {
  color: var(--vermillion);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 280ms var(--ease-out), color 240ms;
  padding-bottom: 1px;
}

a:hover {
  color: var(--seal-deep);
  background-size: 100% 1px;
}

.container > * {
  animation: fade-up 700ms var(--ease-out) backwards;
}
.container > *:nth-child(1) { animation-delay: 0ms; }
.container > *:nth-child(2) { animation-delay: 90ms; }
.container > *:nth-child(3) { animation-delay: 180ms; }
.container > *:nth-child(4) { animation-delay: 270ms; }
.container > *:nth-child(5) { animation-delay: 360ms; }
.container > *:nth-child(6) { animation-delay: 450ms; }
.container > *:nth-child(7) { animation-delay: 540ms; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rule-draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-4);
  align-items: flex-start;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--rule);
}

.hero-info h1 {
  font-size: var(--text-3xl);
  margin: 0;
  line-height: 1.05;
  font-weight: 500;
}

.hero-info .name-cn {
  display: block;
  font-family: var(--font-cn);
  font-weight: 400;
  font-size: var(--text-lg);
  color: var(--ink-soft);
  letter-spacing: 0.05em;
  margin-top: var(--space-1);
}

.contact {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  margin: var(--space-3) 0 0;
  line-height: 1.5;
}

.contact a {
  color: var(--ink-soft);
}

.updated {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--stone);
  margin-top: var(--space-2);
}

.hero-photo {
  margin-top: -8px;
}

.hero-photo img {
  display: block;
  width: 140px;
  height: 170px;
  object-fit: cover;
  filter: grayscale(0.2) contrast(1.02);
  box-shadow:
    0 2px 4px rgba(26, 22, 18, 0.08),
    0 16px 40px rgba(26, 22, 18, 0.12);
}

.intro p,
.section-prose p {
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--ink-soft);
}

.intro p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 4.2em;
  float: left;
  line-height: 0.86;
  padding: 4px 12px 0 0;
  color: var(--ink);
}

.scholar-link {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-top: var(--space-1);
}

.experience-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.experience-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-3);
  align-items: baseline;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--rule);
}

.experience-row:last-child { border-bottom: none; }

.role {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}

.dates {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--stone);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin: 0;
}

.paper {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-3);
  align-items: center;
}

.paper-thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.paper-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  box-shadow: 0 4px 16px rgba(26, 22, 18, 0.12);
}

.paper-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 var(--space-1);
  line-height: 1.25;
  letter-spacing: -0.005em;
}

.paper-authors {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  margin: 0 0 4px;
}

.paper-authors b {
  color: var(--ink);
  font-weight: 600;
}

.paper-venue {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--stone);
  margin: 0 0 var(--space-2);
}

.paper-links {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

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

.hobbies p { color: var(--ink-soft); }

.hobbies-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: var(--space-3);
}

.hobby-card {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--ink);
  background-image: none;
  padding: 0;
}

.hobby-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.35) contrast(1.05) brightness(0.95);
  transition: transform 800ms var(--ease-out), filter 600ms;
}

.hobby-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, 0.75) 100%);
  z-index: 1;
  transition: opacity 400ms;
}

.hobby-card:hover img {
  transform: scale(1.06);
  filter: grayscale(0) contrast(1.05) brightness(1);
}

.hobby-card-label {
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  color: #FBFAF5;
  z-index: 2;
}

.hobby-card-label .en {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 500;
  display: block;
  line-height: 1;
}

.hobby-card-label .cn {
  font-family: var(--font-cn);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.4em;
  opacity: 0.88;
  margin-top: 6px;
  display: block;
}

.site-foot {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-2);
  border-top: 1px solid var(--rule);
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--stone);
}

.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 2.5px solid var(--vermillion);
  color: var(--vermillion);
  font-family: var(--font-cn);
  font-weight: 700;
  font-size: 20px;
  background: var(--container);
  transform: rotate(-3deg);
  user-select: none;
  flex-shrink: 0;
}

.paper-head {
  text-align: center;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--rule);
}

.paper-head .back-link {
  display: block;
  text-align: left;
  margin-bottom: var(--space-3);
}

.paper-venue-line {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--stone);
  margin: 0 0 var(--space-3);
}

.paper-page-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0 0 var(--space-4);
  color: var(--ink);
}

.paper-authors-block {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.author {
  text-align: center;
  min-width: 130px;
}

.author-name {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 500;
  margin: 0;
  color: var(--ink);
}

.author-name a { color: var(--ink); }
.author-name a:hover { color: var(--vermillion); }

.author-affil {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--stone);
  margin: 2px 0 0;
}

.paper-resources {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  margin: var(--space-2) 0 0;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.paper-resources a { color: var(--vermillion); }

.paper-section {
  margin-bottom: var(--space-3);
}

.paper-section h2 {
  text-align: center;
}

.paper-section h2::after {
  margin: var(--space-1) auto 0;
  transform-origin: center;
}

.paper-section p {
  font-size: var(--text-base);
  line-height: 1.78;
  color: var(--ink-soft);
}

.paper-figure {
  margin: 0 0 var(--space-3);
}

.paper-figure img,
.paper-figure video {
  width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 4px 20px rgba(26, 22, 18, 0.12);
}

.paper-figure figcaption {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--ink-soft);
  text-align: center;
  margin-top: var(--space-2);
  line-height: 1.6;
}

.subpage-head {
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--rule);
}

.back-link {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-3);
  color: var(--vermillion);
}

.subpage-head h1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 500;
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.005em;
}

.subpage-head .subtitle-cn {
  display: block;
  font-family: var(--font-cn);
  font-weight: 400;
  font-size: var(--text-lg);
  color: var(--ink-soft);
  letter-spacing: 0.25em;
  margin-top: var(--space-1);
}

.hero-media {
  margin: var(--space-2) 0 var(--space-2);
}

.hero-media video,
.hero-media img {
  width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 4px 24px rgba(26, 22, 18, 0.12);
}

.media-caption {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--stone);
  text-align: center;
  margin: var(--space-1) 0 var(--space-3);
}

.prose p {
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.prose p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 4em;
  float: left;
  line-height: 0.86;
  padding: 4px 12px 0 0;
  color: var(--ink);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.gallery.cols-3 { grid-template-columns: repeat(3, 1fr); }
.gallery.cols-4 { grid-template-columns: repeat(4, 1fr); }

.gallery .cell {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  margin: 0;
  padding: 0;
  background: none;
  background-image: none;
}

.gallery.tall .cell { aspect-ratio: 3 / 4; }
.gallery.wide .cell { aspect-ratio: 16 / 9; }
.gallery.square .cell { aspect-ratio: 1 / 1; }

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  box-shadow: 0 2px 12px rgba(26, 22, 18, 0.08);
  transition: transform 600ms var(--ease-out);
}

.gallery .cell:hover img {
  transform: scale(1.03);
}

@media (max-width: 640px) {
  .container {
    width: 92%;
    padding: var(--space-4) var(--space-3);
  }
  .hero {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  .hero-photo { order: -1; }
  .hero-photo img { width: 110px; height: 130px; }
  .hero-info h1 { font-size: var(--text-2xl); }
  .paper { grid-template-columns: 1fr; gap: var(--space-2); }
  .paper-thumb img { max-width: 280px; }
  .hobbies-grid { grid-template-columns: 1fr; }
  .hobby-card { aspect-ratio: 16 / 9; }
  .subpage-head h1 { font-size: var(--text-2xl); }
  .gallery,
  .gallery.cols-3,
  .gallery.cols-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

@media (max-width: 420px) {
  .gallery,
  .gallery.cols-3,
  .gallery.cols-4 {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .container > *,
  h2::after { animation: none !important; }
  a, .hobby-card img { transition: none !important; }
}
