@font-face {
    font-family: "Space Grotesk";
    src: url("assets/fonts/space-grotesk-latin.woff2") format("woff2");
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Ma Shan Zheng";
    src: url("assets/fonts/ma-shan-zheng-name.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+6842, U+97EC;
}
:root {
    color-scheme: light dark;
    --paper: #fcfcfe;
    --card: #fff;
    --ink: #202131;
    --text: #43495c;
    --muted: #62697c;
    --line: #dfe1eb;
    --accent: #3a51ca;
    --tint: #eef1ff;
    --lavender: #ece8ff;
    --mint: #ddf5eb;
    --apricot: #fff0d9;
    --purple-ink: #55428b;
    --mint-ink: #17694e;
    --apricot-ink: #7d4c11;
    --sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
    :root {
        --paper: #151622;
        --card: #1d1e2c;
        --ink: #f3f2fa;
        --text: #d1d1df;
        --muted: #b2b4c9;
        --line: #37394d;
        --accent: #a5b6ff;
        --tint: #282d4a;
        --lavender: #322b4d;
        --mint: #1d3b35;
        --apricot: #423324;
        --purple-ink: #d9ceff;
        --mint-ink: #a6ead1;
        --apricot-ink: #f9d09c;
    }
}
* { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.56 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, figure, ul { margin: 0; }
h1, h2, h3, h4 { line-height: 1.16; text-wrap: balance; }
a { color: inherit; text-underline-offset: .2em; }
a:hover { color: var(--accent); }
:where(a, button, summary, video):focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.frame { width: min(1056px, calc(100% - 80px)); margin-inline: auto; }
.skip { position: absolute; z-index: 10; top: -5em; left: 1em; padding: 8px 16px; background: var(--card); }
.skip:focus { top: 8px; }
.masthead, .signature, nav, .profile-links, .section-head, .resources, .colophon {
    display: flex;
    align-items: center;
}
.masthead { justify-content: space-between; min-height: 65px; border-bottom: 1px solid var(--line); }
.signature, nav a, .profile-links a, .resources a, .text-link, .colophon a { text-decoration: none; }
.signature { gap: 12px; font-size: 17px; font-weight: 700; letter-spacing: -.045em; }
.spark { position: relative; display: inline-grid; place-items: center; width: 27px; height: 27px; color: var(--accent); }
.spark::before, .spark::after, .spark i, .spark i::after {
    content: ""; position: absolute; width: 6px; height: 27px; background: currentColor; border-radius: 4px;
}
.spark::after { transform: rotate(45deg); }
.spark i { transform: rotate(90deg); }
.spark i::after { transform: rotate(45deg); }
nav { gap: clamp(18px, 3.2vw, 38px); }
nav a { padding: 8px 0; color: var(--text); font-size: 14px; font-weight: 500; }
nav a:hover, .profile-links a:hover, .text-link:hover, .colophon a:hover { text-decoration: underline; }

.profile { display: grid; grid-template-columns: 208px minmax(0,1fr); align-items: center; gap: clamp(35px, 6vw, 83px); padding: 49px 0 47px; }
.portrait { position: relative; isolation: isolate; width: min(86%, 178px); justify-self: center; transform: rotate(-3deg); }
.portrait::before, .portrait::after { content: ""; position: absolute; z-index: -1; }
.portrait::before { inset: 5px -7px -3px 3px; border-radius: 17px; background: #c6c4ff; transform: rotate(8deg); }
.portrait::after { width: 57px; height: 38px; left: -18px; bottom: -13px; transform: rotate(8deg); background: radial-gradient(circle, var(--accent) 1.3px, transparent 1.7px) 0 0 / 8px 8px; }
.portrait img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 29%; border: 5px solid var(--card); border-radius: 16px; box-shadow: 0 3px 13px #23214a1a; }
.profile h1 { display: flex; align-items: baseline; gap: .27em; font-size: clamp(43px, 5.15vw, 68px); letter-spacing: -.067em; font-weight: 700; line-height: 1.03; }
.profile h1 :lang(zh-Hans) {
    font: 400 .69em/1 "Ma Shan Zheng", "Kaiti SC", KaiTi, serif;
    color: var(--ink);
    color: color-mix(in srgb, var(--ink) 76%, var(--accent));
    letter-spacing: .065em;
    white-space: nowrap;
}
.position { margin-top: 8px; font-size: 17px; font-weight: 500; }
.position span { color: var(--muted); }
.position a { text-decoration: none; }
.intro { max-width: 660px; margin-top: 13px; color: var(--text); font-size: 15.5px; line-height: 1.6; }
.intro a { text-decoration-color: var(--line); }
.interests { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin-top: 13px; list-style: none; }
.interests li, .kind { font-size: 11px; font-weight: 600; line-height: 1.35; border-radius: 20px; padding: 4px 10px; }
.interests li:nth-child(1) { color: var(--accent); background: var(--tint); }
.interests li:nth-child(2) { color: var(--purple-ink); background: var(--lavender); }
.interests li:nth-child(3) { color: var(--mint-ink); background: var(--mint); }
.profile-links { flex-wrap: wrap; gap: 9px 20px; margin-top: 16px; }
.profile-links a, .text-link { font-size: 14px; font-weight: 600; color: var(--accent); }
.profile-links .email { font-weight: 500; color: var(--text); }
.profile-links .email:hover { color: var(--accent); }

.projects { padding-block: 25px clamp(42px, 5vw, 65px); border-top: 1px solid var(--line); }
.section-head { justify-content: space-between; gap: 14px; margin-bottom: 20px; }
h2 { font-weight: 650; font-size: clamp(27px, 3.2vw, 38px); letter-spacing: -.055em; }
.autoplay { display: inline-flex; align-items: center; gap: 7px; padding: 7px 0 7px 7px; border: 0; background: transparent; font-size: 12px; font-weight: 500; cursor: pointer; color: var(--text); }
.switch-track { box-sizing: content-box; width: 24px; height: 13px; padding: 2px; background: var(--muted); border-radius: 99px; }
.switch-track::after { content: ""; display: block; width: 13px; height: 13px; border-radius: 50%; background: #fff; }
.autoplay[aria-checked="true"] .switch-track { background: #4b5eda; }
.autoplay[aria-checked="true"] .switch-track::after { transform: translateX(11px); }
.project-grid, .bench-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.project { --tone: var(--lavender); --tone-ink: var(--purple-ink); display: flex; flex-direction: column; min-width: 0; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 17px; }
.project.sage { --tone: var(--mint); --tone-ink: var(--mint-ink); }
.project.cowork { --tone: var(--tint); --tone-ink: var(--accent); }
.project.a5 { --tone: var(--apricot); --tone-ink: var(--apricot-ink); }
.project-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 5px 9px; margin-bottom: 14px; }
.project h3 { font-size: clamp(22px, 2.35vw, 30px); font-weight: 650; letter-spacing: -.055em; }
.kind { white-space: nowrap; padding: 4px 9px; color: var(--tone-ink); background: var(--tone); font-size: 10px; }
.demo video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 9px; background: #141728; }
.demo figcaption { margin: 13px 0 3px; font-size: 16px; font-weight: 650; line-height: 1.4; letter-spacing: -.025em; }
.project-summary { color: var(--text); font-size: 14px; line-height: 1.55; margin-bottom: 13px; }
.resources { gap: 4px 15px; flex-wrap: wrap; margin-top: auto; }
.resources a { display: inline-flex; align-items: center; gap: 3px; padding-block: 3px; font-size: 13px; color: var(--accent); font-weight: 600; }
.resources a span { font-size: .88em; }
.resources a:hover { text-decoration: underline; }

.bench-band { background: var(--tint); padding-block: clamp(35px, 4.8vw, 57px); }
.kicker, .venue, .contact-grid h3 { color: var(--muted); font-size: 11px; font-weight: 650; line-height: 1.45; letter-spacing: .045em; }
.bench-band > .frame > .kicker { display: flex; gap: 8px; align-items: center; color: var(--accent); }
.focus-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 4px -2px 0 -1px var(--card); }
.bench-heading { margin: 7px 0 22px; }
.bench-heading p { max-width: 640px; margin-top: 8px; color: var(--text); }
.bench-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.bench-grid article { display: flex; flex-direction: column; align-items: flex-start; padding: 19px 21px; border-radius: 13px; background: var(--card); border: 1px solid var(--line); }
.bench-grid .kicker { color: var(--accent); }
.bench-grid article:nth-child(2) .kicker { color: var(--mint-ink); }
#explorationbench .kicker { color: var(--purple-ink); }
.bench-grid .kicker span { margin-inline: 3px; }
.bench-grid h3 { margin: 6px 0 8px; font-size: 24px; letter-spacing: -.045em; }
.bench-grid article > p:not(.kicker) { margin-bottom: 10px; color: var(--text); font-size: 14px; }
.publications { padding-block: clamp(40px, 5vw, 65px); }
.paper-group { border-top: 1px solid var(--line); }
.paper-group:last-child { border-bottom: 1px solid var(--line); }
.paper-group summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; padding: 16px 0; }
.paper-group summary::-webkit-details-marker { display: none; }
.paper-group summary h3 { font-size: clamp(17px, 2vw, 20px); line-height: 1.3; font-weight: 600; letter-spacing: -.03em; }
.paper-count { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.paper-group summary::after { content: "+" / ""; color: var(--accent); font-size: 22px; line-height: 1; width: 1em; text-align: center; }
.paper-group[open] summary::after { content: "−" / ""; }
.paper-group summary:hover h3 { color: var(--accent); }
.papers { padding: 0; list-style: none; }
.papers li { display: grid; grid-template-columns: 104px 1fr; gap: 15px; padding: 16px 0; border-top: 1px solid var(--line); }
.venue { padding-top: 4px; }
.papers h4 { font-size: 16px; font-weight: 600; line-height: 1.4; letter-spacing: -.015em; }
.papers h4 a { text-decoration: none; }
.papers p { max-width: 84ch; margin: 5px 0 6px; color: var(--text); font-size: 14px; }
.paper-links { display: flex; flex-wrap: wrap; gap: 12px; }
.paper-links a { color: var(--accent); font-size: 13px; text-decoration-color: var(--line); }
footer { padding-block: 34px 18px; border-top: 1px solid var(--line); }
.contact-grid { display: grid; grid-template-columns: .85fr 1.1fr 1.1fr; gap: 20px; }
.contact-grid h3 { margin-bottom: 6px; }
address, .background { font-size: 14px; font-style: normal; }
.background, .visitor-map, .colophon { color: var(--muted); }
.background { margin-top: 23px; }
.visitor-map { max-width: 600px; margin-top: 16px; font-size: 13px; }
.visitor-map summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.visitor-map p { margin: 5px 0 8px; }
.visitor-map a { color: var(--accent); }
.visitor-map img { display: block; width: 100%; height: auto; margin-bottom: 6px; border-radius: 6px; }
.colophon { justify-content: space-between; margin-top: 21px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; }

@media (min-width: 621px) and (max-width: 900px) {
    .bench-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #explorationbench { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
    .frame { width: calc(100% - 44px); }
    .profile { grid-template-columns: 140px minmax(0,1fr); gap: 28px; padding-block: 34px; }
    .portrait { width: 93%; }
    .project-grid { gap: 13px; }
    .project { padding: 14px; }
    .project-head { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 620px) {
    .frame { width: calc(100% - 32px); }
    .masthead { min-height: 56px; gap: 8px; }
    .signature { gap: 7px; font-size: 15px; }
    .spark { transform: scale(.76); width: 23px; }
    nav { gap: clamp(10px, 3vw, 16px); }
    nav a { font-size: 12px; }
    .profile { grid-template-columns: 79px 1fr; align-items: center; column-gap: 19px; row-gap: 0; }
    .portrait { grid-row: 1 / 3; width: 74px; }
    .portrait img { border-width: 3px; border-radius: 9px; }
    .portrait::before { inset: 3px -2px -2px 2px; border-radius: 9px; }
    .portrait::after { width: 30px; height: 20px; left: -9px; bottom: -5px; background-size: 6px 6px; }
    .profile-copy { display: contents; }
    .profile h1 { align-self: end; font-size: clamp(36px, 8.3vw, 47px); }
    .position { align-self: start; font-size: 14px; margin-top: 5px; }
    .intro, .interests, .profile-links { grid-column: 1 / -1; }
    .intro { margin-top: 19px; font-size: 15px; }
    .interests, .profile-links { margin-top: 11px; }
    .projects { padding-top: 19px; }
    .project-grid, .bench-grid, .contact-grid { grid-template-columns: 1fr; }
    .project { padding: 16px; }
    .project-head { align-items: center; flex-direction: row; }
    .section-head { flex-wrap: wrap; gap: 6px 12px; margin-bottom: 15px; }
    .autoplay { font-size: 11px; gap: 5px; }
    .papers li { grid-template-columns: 1fr; gap: 4px; }
    .paper-count { font-size: 11px; }
}
@media (max-width: 355px) {
    .signature > span:last-child { display: none; }
    .profile { grid-template-columns: 64px 1fr; column-gap: 13px; }
    .portrait { width: 60px; }
    .profile h1 { font-size: 32px; white-space: nowrap; }
    .project-head { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: no-preference) {
    .switch-track::after { transition: transform .16s ease-out; }
}
