/* Neutral surfaces; the painting palette is reserved for small accents. */
:root {
  color-scheme: light;
  --paper: #f6f7f6;
  --panel: #ffffff;
  --profile-surface: #f2f6ef;
  --credentials-surface: #f3f1eb;
  --subtle: #f0f2f1;
  --ink: #444c46;
  --muted: #626e65;
  --line: #dfe4e1;
  --sage: #e0eadf;
  --mint: #e2efea;
  --blue: #e5edf3;
  --lavender: #e9ecef;
  --olive: #e7eadf;
  --link: #456459;
  --screen: #e4ebe5;
  --screen-ink: #435d50;
  --screen-line: #9eafa2;
  --screen-active: #cddbd1;
  --screen-hover: #d7e2d9;
  --screen-glint: #ffffffb3;
  --screen-scan: #29443b05;
  --cursor: #3c6552;
  --graph-line: #536f5e09;
  --note-surface: #e5e8f1;
  --note-border: #aeb8cb;
  --note-highlight: #f3e6b8;
  --note-edge: #c7aa60;
  --nav-height: 54px;
  --shadow: #2029230b;
  --card-shadow: 0 12px 38px #20292314, 0 3px 12px #20292309;
}
* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 24px);
  overscroll-behavior-y: none;
}
body {
  margin: 0;
  padding-top: var(--nav-height);
  isolation: isolate;
  color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(var(--graph-line) 1px, transparent 1px), linear-gradient(90deg, var(--graph-line) 1px, transparent 1px);
  background-size: 24px 24px;
  font: 16px/1.6 "Hanken Grotesk", Arial, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; color: inherit; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:where(button, a, input, select):focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 4px;
}
img { max-width: 100%; height: auto; }
::selection { background: var(--sage); color: var(--ink); }
[hidden] { display: none !important; }
h1, h2, h3 {
  font-family: "Bricolage Grotesque", "Hanken Grotesk", sans-serif;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -.025em;
}
/* Reference typewriter accents only; body and terminal keep their reading faces. */
.section:not(.compact) h2, .page-heading h1,
.page-heading > p:not(.eyebrow), .gallery-heading h2, .credential-column h2 {
  font-family: "Special Elite", "Courier New", monospace;
  font-weight: 400;
  letter-spacing: 0;
}
p { margin: 0 0 14px; }
.mono, .nav, .chrome, .eyebrow, .resource-links, .timeline time {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
}
.skip {
  position: fixed;
  top: -90px;
  left: 16px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--panel);
}
.skip:focus { top: 8px; }

/* The fixed screen stays flush during overscroll; reserve its rows in body. */
.nav {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1100px, 100%);
  min-height: var(--nav-height);
  margin: 0 auto;
  padding: 7px 20px;
  color: var(--screen-ink);
  background: repeating-linear-gradient(0deg, var(--screen-scan) 0 1px, transparent 1px 3px), var(--screen);
  border: 1px solid var(--screen-line);
  border-top: 0;
  border-radius: 0 0 5px 5px;
  box-shadow: inset 0 1px var(--screen-glint), inset 0 -2px #0000000a, 0 3px 10px var(--shadow);
}
.brand { color: inherit; font-weight: 500; text-decoration: none; white-space: nowrap; }
.nav-links { display: flex; align-items: center; gap: 3px; }
.nav a:not(.brand), .nav button {
  display: block;
  padding: 8px 9px;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
}
.nav a[aria-current="page"] { background: var(--screen-active); box-shadow: inset 0 -1px var(--cursor); font-weight: 500; }
.nav a:not(.brand):hover, .nav button:hover { background: var(--screen-hover); }
.nav :focus-visible { outline-color: var(--screen-ink); outline-offset: 1px; }
.brand::after { content: ""; display: inline-block; width: .6em; height: 1em; margin-left: 7px; background: var(--cursor); vertical-align: -.15em; }
@keyframes terminal-cursor { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  body:not(.motion-off) .brand::after { animation: terminal-cursor 1.2s step-end infinite; }
}

.shell { max-width: 1100px; margin: 0 auto; padding: 32px 20px 26px; }
.topline { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); margin-bottom: 20px; }
.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; align-items: start; }
.content { min-width: 0; }
.profile { position: sticky; top: calc(var(--nav-height) + 24px); text-align: center; }
.window { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--card-shadow); }
.profile .window { background: var(--profile-surface); }
.credentials.window { background: var(--credentials-surface); }
.chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 20px 0;
  color: var(--muted);
  font-size: 13px;
}
.chrome span { flex: 1; }
.profile .chrome { text-align: left; padding-inline: 16px; }
.profile-body { padding: 14px 16px 0; }
.portrait { position: relative; width: 180px; max-width: 100%; aspect-ratio: 1; margin: 0 auto 8px; }
.portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mask-size: 100% 100%;
  -webkit-mask-size: 100% 100%;
}
.portrait .pixel { image-rendering: pixelated; visibility: hidden; }
.profile h1 { font-size: 24px; font-weight: 600; margin: 4px 0 0; }
.profile .chinese { margin: 4px 0; color: var(--muted); font-size: 14px; letter-spacing: .16em; }
.discipline { margin: 10px 0; font-size: 14px; line-height: 1.5; }
.email { font-size: 13px; overflow-wrap: anywhere; }
.contacts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-inline: auto; padding: 12px 0 8px; }
.contacts a {
  width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  color: var(--link);
  background: var(--subtle);
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: background-color .2s, border-color .2s;
  text-decoration: none;
}
.contacts a:hover { border-color: var(--link); background: var(--sage); }
.contacts svg { display: block; width: 17px; height: 17px; fill: currentColor; flex-shrink: 0; }

.hero { padding: 0 0 2px; }
.eyebrow { color: var(--muted); margin: 0 0 14px; font-size: 13px; letter-spacing: .04em; }
.hero .eyebrow { color: var(--link); }
.hero h1 { font-size: 24px; margin: 0 0 16px; }
.hero h1 em { color: var(--link); }
.lead { font-size: 17px; line-height: 1.6; max-width: 720px; }
.intro p { margin: 0 0 13px; }
.intro p:last-child { margin-bottom: 0; }
.section { margin: 20px 0; }
.section-body { padding: 14px 20px 20px; }
.section-body > :last-child { margin-bottom: 0; }
.section h2 { font-size: 22px; margin: 0 0 14px; }
.section-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 18px; }
.section-head p { margin: 0; color: var(--muted); }
.section-head a { white-space: nowrap; }
.research-lines { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tag { padding: 3px 8px; border-radius: 3px; background: var(--mint); font-size: 13px; }

/* Credentials remain complete, but visually secondary to research and papers. */
.credentials { margin: 20px 0; }
.credentials-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding: 14px 20px 20px; }
.credential-column { min-width: 0; overflow-wrap: anywhere; }
.credential-column h2 { font-size: 19px; margin: 0 0 14px; }
.credential + .credential { margin-top: 13px; }
.credential time { display: block; color: var(--muted); font-size: 13px; }
.credential h3 { font-family: "Hanken Grotesk", sans-serif; font-size: 14px; font-weight: 600; line-height: 1.4; letter-spacing: 0; margin: 4px 0; }
.credential p { font-size: 13px; line-height: 1.5; margin: 0; }
.credential h3 a { text-decoration: none; }
.credential h3 a:hover { text-decoration: underline; }

.pub { display: grid; grid-template-columns: 156px minmax(0, 1fr); gap: 18px; padding: 20px 0; border-top: 1px solid var(--line); }
.pub > div { min-width: 0; }
.pub-image { align-self: start; display: block; padding: 4px; background: #fff; border-radius: 4px; box-shadow: 0 2px 12px var(--shadow); transition: box-shadow .2s, transform .2s; }
.pub-image img { display: block; width: 100%; aspect-ratio: 1.5; object-fit: contain; background: #fff; }
.pub h3 { font-size: 20px; line-height: 1.35; margin: 4px 0 8px; }
.pub h3 a { color: var(--ink); text-decoration: none; }
.pub h3 a:hover { text-decoration: underline; }
.pub p { margin: 6px 0; line-height: 1.5; }
.authors, .venue { font-size: 13px; }
.venue, .paper-year { color: var(--muted); }
.paper-notes { display: flex; flex-wrap: wrap; align-items: start; gap: 6px; margin: 8px 0; }
.paper-note {
  display: inline-block;
  max-width: 100%;
  padding: 3px 8px 4px;
  color: var(--ink);
  background: var(--note-surface);
  border: 1px solid var(--note-border);
  border-radius: 1px 1px 3px 3px;
  box-shadow: inset 0 2px #00000008, 0 2px 3px var(--shadow);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.paper-note.highlight { background: var(--note-highlight); border-color: var(--note-edge); border-inline-start: 2px solid var(--note-edge); font-weight: 600; }
.description { font-size: 15px; }
.resource-links { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 8px; font-size: 13px; }
.resource-links a { display: inline-flex; align-items: center; min-height: 28px; }

.page-heading { padding: 0 0 24px; }
.page-heading h1 { font-size: 24px; margin: 0 0 12px; }
.page-heading p { max-width: 680px; margin-bottom: 0; }
.page-heading .eyebrow { margin-bottom: 10px; }
.index-layout { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 28px; align-items: start; }
.index-layout > .window { min-width: 0; }
.index-aside { position: sticky; top: calc(var(--nav-height) + 24px); }
.index-aside p { margin: 0 0 10px; color: var(--muted); }
.index-aside a { display: block; padding: 7px 0; }
.viewer-bottom button, .viewer-top button { min-height: 42px; background: var(--subtle); border: 1px solid var(--line); border-radius: 4px; padding: 8px 12px; }
.viewer-bottom button:hover, .viewer-top button:hover { background: var(--mint); }
.year-heading { font-size: 21px; margin: 24px 0 16px; }
/* Root scroll padding supplies the full anchor offset, without doubling it. */
.year-section { scroll-margin-top: 0; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 128px), 1fr)); gap: 16px 14px; }
.art { margin: 0; min-width: 0; }
.art button { display: block; width: 100%; border: 0; border-radius: 5px; background: var(--panel); padding: 7px; box-shadow: var(--card-shadow); transition: box-shadow .2s, transform .2s; }
.art img { display: block; width: 100%; height: 120px; object-fit: contain; background: var(--panel); }
.art figcaption { font-family: "IBM Plex Mono", monospace; font-size: 13px; overflow-wrap: anywhere; margin: 9px 0 4px; }
.gallery-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.gallery-heading h2 { font-size: 22px; margin: 0 0 12px; }
.gallery-help { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.footer { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.footer p { margin: 0; }
/* One original pixel sprout, confined to the footer rather than repeated on cards. */
.footer::before {
  content: "";
  flex: 0 0 12px;
  width: 12px;
  height: 14px;
  margin-top: 3px;
  background:
    linear-gradient(var(--link) 0 0) 5px 6px / 2px 8px no-repeat,
    linear-gradient(var(--link) 0 0) 1px 2px / 4px 4px no-repeat,
    linear-gradient(var(--link) 0 0) 7px 0 / 4px 4px no-repeat,
    linear-gradient(var(--link) 0 0) 3px 4px / 2px 2px no-repeat,
    linear-gradient(var(--link) 0 0) 7px 4px / 2px 2px no-repeat;
}
.footer p:first-of-type { flex: 1; }

.stars { position: fixed; inset: 0; z-index: -1; pointer-events: none; display: none; }
.star { position: absolute; width: 2px; height: 2px; background: #adb7b1; box-shadow: 0 0 4px #d6e5df30; }
.star:nth-child(3n) { background: #afbac2; }
.star:nth-child(5n) { background: #d0d6d2; }
dialog { width: min(960px, 94vw); max-height: 94vh; max-height: 94dvh; padding: 16px 20px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 12px 64px #0002; }
dialog::backdrop { background: #171c1acc; }
.viewer-top, .viewer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; }
.viewer-top p { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.viewer-image { display: block; max-height: 66vh; max-height: 66dvh; max-width: 100%; width: auto; margin: 14px auto; object-fit: contain; }
.viewer-bottom a { margin-left: auto; }
.close-viewer { white-space: nowrap; flex-shrink: 0; }

/* Jungle teal, forest and amber accents; main night surfaces stay charcoal. */
body[data-theme="dark"] {
  color-scheme: dark;
  --paper: #202322;
  --panel: #292d2b;
  --profile-surface: #2a312c;
  --credentials-surface: #302f2b;
  --subtle: #2d3230;
  --ink: #c5cec7;
  --muted: #a6b2aa;
  --line: #49514c;
  --sage: #3a4940;
  --mint: #35473f;
  --blue: #38454e;
  --lavender: #3b4146;
  --olive: #42463a;
  --link: #abc5b7;
  --screen: #202e29;
  --screen-ink: #b6cdbf;
  --screen-line: #536d5f;
  --screen-active: #3a5146;
  --screen-hover: #30483e;
  --screen-glint: #aecab526;
  --screen-scan: #d5e8dc05;
  --cursor: #d8ba76;
  --graph-line: transparent;
  --note-surface: #3b4051;
  --note-border: #77849e;
  --note-highlight: #51452d;
  --note-edge: #d8ba76;
  --shadow: #00000018;
  --card-shadow: 0 8px 28px #00000018, 0 0 28px #b8d7c205;
}
body[data-theme="dark"] .stars { display: block; }

/* The runner worker owns overrides in runner.css; retain its original baseline. */
.walkway{height:98px;margin-top:10px;border-top:1px dashed var(--line);background:linear-gradient(transparent 84%,var(--sage) 84%);overflow:hidden;position:relative}.walker{height:90px;width:auto;position:absolute;bottom:4px;left:20px;image-rendering:pixelated;animation:walk 14s ease-in-out infinite alternate}@keyframes walk{from{left:10px}to{left:calc(100% - 80px)}}

.motion-off *, .motion-off *::before, .motion-off *::after { animation: none !important; transition: none !important; }
html:has(.motion-off) { scroll-behavior: auto; }
@keyframes window-enter { from { transform: translateY(5px); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: no-preference) {
  body:not(.motion-off) .section-enter-active { animation: window-enter .35s ease-out both; }
}
@media (hover: hover) {
  .pub-image:hover, .art button:hover { transform: translateY(-2px); box-shadow: 0 5px 20px var(--shadow); }
}
@media (max-width: 960px) {
  .nav { gap: 10px; padding-inline: 16px; }
  .nav a:not(.brand), .nav button { padding-inline: 7px; }
  .layout { gap: 22px; }
  .pub { grid-template-columns: 130px minmax(0, 1fr); gap: 15px; }
}
@media (max-width: 760px) {
  :root { --nav-height: 100px; }
  .nav { flex-direction: column; align-items: stretch; justify-content: center; gap: 4px; padding: 10px 14px 6px; border-radius: 0; }
  .brand { align-self: flex-start; min-height: 32px; display: inline-flex; align-items: center; }
  .nav-links { flex-wrap: wrap; }
  .nav a:not(.brand), .nav button { min-height: 44px; flex: 1; padding: 8px; text-align: center; }
  .shell { padding: 24px 16px; }
  .layout { display: flex; flex-direction: column; gap: 24px; }
  .content { width: 100%; }
  .profile { position: relative; top: auto; width: 100%; max-width: 360px; margin: 0 auto; }
  .profile-body { padding: 12px 18px 18px; }
  .portrait { width: 148px; }
  .contacts a { width: 44px; min-height: 44px; }
  .credentials-grid { grid-template-columns: 1fr; gap: 22px; padding: 12px 18px 18px; }
  .resource-links a { min-height: 36px; }
  .walkway{height:75px}.walker{height:72px}
  .section { margin: 20px 0; }
  .section-body { padding: 12px 18px 18px; }
  .chrome { padding-inline: 18px; }
  .section-head { flex-wrap: wrap; gap: 6px 12px; }
  .index-layout { display: block; }
  .index-aside { position: static; display: flex; flex-wrap: wrap; gap: 0 20px; margin-bottom: 18px; }
  .index-aside p { width: 100%; margin-bottom: 4px; }
  .index-aside a { padding-block: 10px; }
  .footer { flex-wrap: wrap; gap: 8px; }
  .footer p:first-of-type { flex: 1 0 calc(100% - 20px); }
  .footer p:last-of-type { margin-inline-start: 20px; }
  .viewer-bottom { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  :root { --nav-height: 144px; }
  .nav-links { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
  .nav a:not(.brand), .nav button { grid-column: span 2; padding-inline: 3px; font-size: 12px; }
  .nav button { grid-column: span 3; }
  .pub { grid-template-columns: 1fr; gap: 12px; }
  .pub-image { max-width: 280px; width: 100%; }
  .pub-image img { aspect-ratio: 1.9; }
  .pub h3 { font-size: 20px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(min(100%, 104px), 1fr)); gap: 14px 12px; }
  .art img { height: 104px; }
  .gallery-heading { flex-wrap: wrap; gap: 0 12px; }
  dialog { padding: 12px; }
  .viewer-top { align-items: start; gap: 8px; }
  .viewer-image { max-height: 58vh; max-height: 58dvh; }
  .viewer-bottom a { margin-left: 0; min-height: 36px; display: inline-flex; align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
