@font-face {
  font-family: "Night Display";
  src: url("../fonts/night-display.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Research Sans";
  src: url("../fonts/research-sans-chinese-heavy.ttf") format("truetype");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

:root {
  --ink: #e1e6e5;
  --muted: #adb7b9;
  --accent: #91bec3;
  --accent-dark: #a4ccd0;
  --surface: #14191c;
  --surface-soft: #1c2428;
  --line: #3a484e;
  --signal: #91bec3;
  --signal-soft: #263b40;
  --warm-gold: #d4b77b;
  --yellow: var(--warm-gold);
  --red: #b96d69;
  --gold: #373124;
  --display-font: "Night Display", "Research Sans", sans-serif;
}

html { background: var(--surface); scrollbar-color: #607b82 var(--surface); }
/* The legacy footer script reserves an inline margin for an absolute footer. */
body { margin-bottom: 0 !important; background: var(--surface); }
::selection { color: #14191c; background: #b9d2d2; }
a:focus-visible, button:focus-visible { outline-color: var(--accent); }

.masthead { border-bottom: 1px solid var(--line); background: var(--surface); }
.masthead::after { content: ""; position: absolute; left: 0; bottom: -1px; width: var(--reading-progress, 0%); height: 2px; background: var(--accent); }
.research-nav { max-width: 1440px; min-height: 76px; gap: 30px; }
.research-nav a { color: var(--ink); }
.research-nav__brand { gap: 12px; font-family: var(--display-font); font-size: 18px; font-weight: 700; }
.research-nav__brand > i { width: 31px; height: 31px; background: #252e31; border-color: #62747a; border-radius: 0; color: var(--warm-gold); clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px); }
.research-nav__links { gap: 0; padding: 0 6px; background: #101619; clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px); }
.research-nav__links li { font-family: var(--display-font); }
.research-nav__links a { color: #d6dede; padding: 12px 15px; border-bottom: 0; font-size: 16px; font-weight: 700; line-height: 1.5; transition: background 150ms ease, color 150ms ease; }
.research-nav__links a:hover, .research-nav__links a.is-active { color: #b9d8db; background: #27363b; }
.research-nav__links a.is-active::after { left: 15px; right: 15px; bottom: 4px; width: auto; height: 1px; background: var(--accent); }

.research-hero { height: min(calc(100svh - 124px), 56.25vw, 980px); min-height: 0; background: #11191d; }
.research-hero__landscape { inset: -4px; transform: translate3d(var(--scene-x, 0px), var(--scene-y, 0px), 0) scale(1.01); }
.research-hero__landscape::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(3,6,8,.53) 0%, rgba(3,6,8,.28) 27%, rgba(3,6,8,.03) 53%, transparent 68%); }
.research-hero__landscape img { object-position: center 30%; }
.research-hero__copy { width: min(510px, 44%); margin-left: max(54px, calc((100% - 1200px) / 2)); padding-top: 100px; }
.research-home .main-heading { position: relative; width: fit-content; color: var(--warm-gold); font-size: 76px; font-weight: 800; line-height: 1.1; text-shadow: 0 2px 14px rgba(0,0,0,.2); }
.research-home .research-hero__name { margin: 16px 0 28px; color: #e2e9e8; font-family: "Night Display", sans-serif; font-size: 46px; font-weight: 700; line-height: 1.05; }
html[lang="en"] .research-home .main-heading { font-family: "Night Display", sans-serif; font-size: 80px; font-weight: 700; }
html[lang="en"] .research-home .research-hero__name { font-family: "Research Sans", sans-serif; color: #eff4f3; font-size: 38px; }
.welcome-banner { color: #e3edef; font-size: 18px; }
.welcome-banner::before { background: var(--accent); }

.hero-glitch { position: absolute; inset: 0; overflow: clip; opacity: 0; pointer-events: none; }
.hero-glitch::before, .hero-glitch::after { content: attr(data-copy); position: absolute; inset: 0; color: var(--yellow); }
.hero-glitch::before { transform: translateX(3px); text-shadow: -3px 0 var(--accent); clip-path: inset(21% 0 63%); }
.hero-glitch::after { transform: translateX(-3px); text-shadow: 3px 0 var(--red); clip-path: inset(67% 0 17%); }
.is-glitching .hero-glitch { animation: night-glitch 450ms steps(2, end) both; }
@keyframes night-glitch { 0%, 100% { opacity: 0; } 15%, 36%, 67% { opacity: .8; transform: translateX(1px); } 25%, 50%, 79% { opacity: 0; transform: translateX(-1px); } }
.scene-scan { position: absolute; z-index: 1; inset: 0; pointer-events: none; overflow: hidden; }
.scene-scan::after { content: ""; position: absolute; left: 40%; right: 0; top: -5%; height: 1px; background: var(--accent); opacity: .1; animation: night-scan 13s linear infinite; }
@keyframes night-scan { from { top: -5%; } to { top: 105%; } }
.effects-paused .scene-scan, .effects-paused .hero-glitch { display: none; }

.top-actions { gap: 12px; }
.top-actions a { position: relative; min-height: 48px; padding: 11px 20px; border-radius: 0; border-color: #839da3; color: #c9e0e2; background: #19282e; font-size: 14px; font-weight: 700; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%); }
.top-actions a::before { content: ""; position: absolute; left: 0; top: calc(50% - 2px); width: 6px; height: 4px; border: 1px solid currentColor; border-left: 0; }
.top-actions .resume-download { padding-right: 25px; border-color: var(--yellow); color: #080b0d; background: var(--yellow); }
.top-actions .resume-download::after { display: none; }
.top-actions .resume-download:hover { background: #e3c990; border-color: #e3c990; box-shadow: none; }
.top-actions .language-pill:hover { color: #080b0d; background: var(--accent); border-color: var(--accent); }
.top-actions a:focus-visible { outline: none; box-shadow: inset 0 0 0 2px #e5eded; }
.top-actions .resume-download:focus-visible { box-shadow: inset 0 0 0 2px #14191c; }
.research-nav__links a:focus-visible { outline-offset: -3px; }
.research-hero__next, .scene-effects-toggle, .scene-original-link { position: absolute; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid #839ba5; border-radius: 0; color: #bcd9dc; background: #17242a; cursor: pointer; text-decoration: none; }
.research-hero__next { bottom: 26px; left: max(54px, calc((100% - 1200px) / 2)); }
.research-hero__next:hover, .scene-effects-toggle:hover, .scene-original-link:hover { color: var(--ink); background: #2a414b; }
.scene-original-link { right: 82px; bottom: 26px; font-size: 13px; }
.scene-effects-toggle { right: 28px; bottom: 26px; font-size: 12px; }
.scene-effects-toggle:disabled { color: #93a3ac; cursor: default; }

.home-profile { background: var(--surface); border-bottom-color: var(--line); }
.home-profile .author__avatar img { border-radius: 4px; }
.home-profile .author__urls a i { color: var(--accent); }
.home-profile .author__name { color: var(--ink); }
.home-profile .author__urls a, .home-profile .author__bio { color: #b8c8d0; }
.home-profile .author__urls a:hover { color: var(--accent); }
.home-profile .social-icons .ai-orcid { color: var(--accent); }
.home-intro strong, .key-achievement { color: #e0cfab; background: linear-gradient(transparent 66%, #3b3529 66%); }
.home-section { position: relative; }
.home-section h2 { display: block; color: #e5eae8; font-family: var(--display-font); font-size: 32px; font-weight: 800; }
.home-section h2::after { display: block; margin-top: 15px; width: 58px; height: 2px; background: var(--accent); clip-path: polygon(0 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
html[lang="en"] .research-home h2 { font-size: 38px; font-weight: 700; }
.news-date { color: var(--accent); }
.full-publication-list li { border-top-color: var(--line); font-size: 15px; line-height: 1.85; }
.pub-list-title { color: #eef4f7; }
.pub-list-authors strong { color: #dbc89e; }
.pub-list-badge { color: var(--accent); border-color: #315d67; background: #0c1c23; border-radius: 0; }
.pub-list-badge--pub { color: #9aefbe; border-color: #3b7a59; background: #10281d; }
.pub-list-badge--esi { color: #ddc795; border-color: #7a6a48; background: #302b21; }
.pub-list-metric { color: #ccb78a; }
.pub-list-links a:hover { color: #080b0d; background: var(--accent); }
.text-card strong, .compact-list strong { color: #f3f7f8; }
.teaching-group--wide { border-top-color: #34434b; }
.project-grid { gap: 35px 28px; }
.project-card { background: var(--surface); border-radius: 0; box-shadow: none; }
.project-card:hover { box-shadow: none; }
.pub-media-rotator { background: #151c21; }
.project-media--pixel { background: #282938; }
.publication-row > div:last-child:not(.pub-media-rotator) { color: #c1cdd3; border-top: 1px solid var(--line); }
.publication-row > div > strong:first-child { color: var(--accent); font-size: 21px; }
.publication-row b { color: #a0bac8; }
.project-credit { color: #a5b7c1; border-top-color: #33454f; }
.project-card a { color: var(--accent); }
.project-card:hover .pub-media-rotator { outline: 2px solid var(--accent); outline-offset: -2px; }
.media-controls button { color: var(--accent); border-color: #597580; background: #080f14; border-radius: 0; }
.media-controls button:hover { color: #080b0d; background: var(--accent); }
.meme-interlude { border-color: var(--line); border-radius: 0; background: var(--surface); }

.home-section--tint { color: var(--ink); background: var(--surface-soft); }
.home-section--tint::before { content: ""; position: absolute; top: -13px; left: 0; right: 0; height: 14px; background: var(--surface-soft); clip-path: polygon(0 95%, 8% 95%, 8.5% 45%, 19% 45%, 20% 95%, 37% 95%, 37.6% 0, 39% 0, 39.6% 45%, 64% 45%, 65% 95%, 88% 95%, 88.8% 25%, 90% 25%, 90.8% 95%, 100% 95%, 100% 100%, 0 100%); }
.home-section--tint h2, .home-section--tint .text-card > strong, .home-section--tint h3 { color: var(--ink); }
.home-section--tint h2::after { background: var(--accent); }
.home-section--tint .experience-card { border-bottom-color: var(--line); }
.home-section--tint .experience-info strong { color: var(--ink); }
.home-section--tint .experience-role, .home-section--tint .experience-date { color: #b3bfc1; }
.home-section--tint .compact-list li, .home-section--tint .two-column-list li { color: #c3cdce; }
.home-section--tint .compact-list strong { color: var(--ink); }
.home-section--tint .key-achievement { color: #e0cfab; background: linear-gradient(transparent 65%, #3b3529 65%); }
.home-section--tint a:focus-visible { outline-color: var(--accent); }
.page__footer { bottom: auto; color: #a7bbc4; background: var(--surface); border-top-color: var(--line); animation: none; }
.page__footer a { color: var(--accent); }
.back-to-top { color: #d0e2e3; background: #25373d; border-color: #839fa5; border-radius: 0; }
.back-to-top:hover { color: #14191c; background: var(--accent); border-color: var(--accent); }

@media (min-width: 1800px) {
  .research-hero__copy { padding-top: 125px; }
  .research-hero__landscape img { object-fit: cover; object-position: center 30%; }
}

@media (max-width: 1200px) {
  .research-nav { gap: 24px; padding: 0 28px; }
  .research-nav__brand { font-size: 16px; }
  .research-nav__links a { padding: 12px 10px; font-size: 15px; }
  .research-home .main-heading { font-size: 72px; }
  html[lang="en"] .research-home .main-heading { font-size: 76px; }
  .research-hero__copy { padding-top: 100px; }
}

@media (max-width: 960px) {
  .research-nav { min-height: 68px; }
  .research-nav__toggle { width: 44px; height: 44px; color: #c7dfe0; background: #202d32; border-color: #677f87; border-radius: 0; }
  .research-nav__links { top: calc(100% - 1px); background: #151d21; border: 1px solid #607b83; clip-path: none; padding: 15px 28px; }
  .research-nav__links a { color: #f5f5f5; padding: 11px 9px; border-bottom: 1px solid #37414a; }
  .research-hero { min-height: 0; }
  .research-hero__copy { width: 46%; margin-left: 32px; padding-top: 48px; }
  .research-home .main-heading { font-size: 56px; }
  html[lang="en"] .research-home .main-heading { font-size: 60px; }
  .research-home .research-hero__name { font-size: 40px; }
  .top-actions a { font-size: 13px; padding: 10px 15px; }
  .research-hero__landscape img { object-position: center 30%; }
}

@media (max-width: 640px) {
  .research-nav { min-height: 64px; padding: 0 21px; }
  .research-nav__brand { gap: 9px; font-size: 15px; }
  .research-nav__brand > i { width: 27px; height: 27px; font-size: 13px; }
  .research-nav__links { gap: 0 12px; padding: 12px 21px 18px; }
  .research-nav__links a { padding: 11px 5px; font-size: 15px; }
  .research-hero { height: 710px; }
  .research-hero__landscape { top: 220px; right: 0; bottom: 0; left: 0; transform: none; }
  .research-hero__landscape img { object-fit: cover; object-position: 48% 48%; }
  .research-hero__landscape::after { display: none; }
  .research-hero__copy { width: auto; margin: 0; padding: 30px 25px 0; }
  .research-home .main-heading { font-size: 52px; }
  .research-home .research-hero__name { margin: 9px 0 17px; font-size: 36px; }
  html[lang="en"] .research-home .main-heading { font-size: 62px; }
  html[lang="en"] .research-home .research-hero__name { margin: 10px 0 17px; font-size: 27px; }
  .welcome-banner { margin-bottom: 17px; font-size: 15px; }
  .top-actions { gap: 10px; }
  .top-actions a { min-height: 44px; padding: 9px 14px; font-size: 12px; }
  .top-actions .resume-download { padding-right: 20px; }
  .research-hero__next { left: 24px; bottom: 18px; }
  .scene-original-link { right: 76px; bottom: 18px; }
  .scene-effects-toggle { right: 21px; bottom: 18px; width: 44px; height: 44px; }
  .scene-scan::after { left: 0; }
  .research-home h2 { font-size: 27px; }
  html[lang="en"] .research-home h2 { font-size: 34px; }
  .research-home h2::after { margin-top: 12px; }
  .publication-row > div > strong:first-child { font-size: 18px; }
  .full-publication-list li { font-size: 14px; }
  .research-home .home-intro p, .research-home .home-intro .lead { font-size: 16px; }
  .compact-list li, .two-column-list li, .experience-role { font-size: 14px; }
  .publication-row > div:last-child:not(.pub-media-rotator) { font-size: 14px; }
  .top-actions a { font-size: 13px; }
}

@media (max-width: 360px) {
  .research-hero { height: 660px; }
  .research-nav { padding: 0 16px; }
  .research-nav__brand { gap: 7px; font-size: 14px; }
  .research-hero__copy { padding-left: 22px; padding-right: 22px; }
  html[lang="en"] .research-home .main-heading { font-size: 46px; }
  .top-actions a { padding-left: 10px; padding-right: 10px; }
  .top-actions a { font-size: 12px; }
}

@media (min-width: 641px) and (max-height: 700px) {
  .research-hero__copy { padding-top: 38px; }
  .research-home .main-heading { font-size: 60px; }
  html[lang="en"] .research-home .main-heading { font-size: 64px; }
  .research-home .research-hero__name { margin: 10px 0 18px; font-size: 36px; }
  .welcome-banner { margin-bottom: 20px; }
}

@media (min-width: 641px) and (max-height: 500px) {
  .research-hero__copy { display: grid; grid-template-columns: minmax(0, 1fr) 220px; grid-template-areas: "title actions" "name actions" "welcome actions"; gap: 5px 30px; width: auto; margin: 0 32px; padding-top: 24px; }
  .research-home .main-heading { grid-area: title; font-size: 48px; }
  html[lang="en"] .research-home .main-heading { font-size: 54px; }
  .research-home .research-hero__name { grid-area: name; margin: 0; font-size: 32px; }
  html[lang="en"] .research-home .research-hero__name { font-size: 27px; }
  .welcome-banner { grid-area: welcome; margin: 0; font-size: 15px; }
  .top-actions { grid-area: actions; flex-direction: column; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .scene-scan, .hero-glitch { display: none; }
  .research-hero__landscape { transform: none; }
}

@media print {
  :root { --ink: #000000; --muted: #333333; --line: #bbbbbb; }
  body, .home-section--tint, .home-profile, .page__footer { color: #000000; background: #ffffff; }
  .scene-effects-toggle, .scene-scan { display: none; }
  .home-section h2, .pub-list-title, .compact-list li, .text-card strong, .experience-info strong, .pub-list-authors strong { color: #000000; }
}
