:root {
  --original-paper: #f8f9fb;
  --original-accent: #214cba;
  --paper: var(--original-paper);
  --ink: #161b23;
  --muted: #515b67;
  --rule: #c6cdd4;
  --accent: var(--original-accent);
  --accent-wash: #e6ecf9;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --serif: "STIX Two Text", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --gutter: clamp(1.25rem, 4.5vw, 5.5rem);
  --media-radius: .88rem;

  font-family: var(--sans);
  font-size: 100%;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, a { color: inherit; -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
a, .plain-title { text-underline-offset: .22em; text-decoration-thickness: 1px; -webkit-text-decoration-skip: none; text-decoration-skip-ink: none; }
button:focus-visible, a:focus-visible, video:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
:target:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#publications:focus { outline: none; }
button[hidden] { display: none; }
h1, h2, h3, p { margin: 0; }
img, video { display: block; }
main img, main video, .detail img, .detail video, .thumb, .portrait-link, .detail-media { border-radius: var(--media-radius); }
::selection { color: var(--paper); background: var(--accent); }
.skip-link { position: absolute; top: .5rem; left: .5rem; z-index: 10; transform: translateY(-180%); padding: .7rem 1rem; color: var(--paper); background: var(--ink); }
.skip-link:focus { transform: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.page, .footer-inner { width: min(100%, 102rem); margin-inline: auto; padding-inline: var(--gutter); }
#site-footer { border-top: 1px solid var(--rule); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem 1.5rem; padding-block: 1rem; }
.layout-switch, .author-links, .section-heading { display: flex; align-items: center; }
.layout-switch { flex-wrap: wrap; gap: .12rem; max-width: 100%; padding: .17rem; border: 1px solid var(--rule); border-radius: 1rem; font-size: .875rem; }
.layout-switch a { text-decoration: none; color: var(--muted); border-radius: 2rem; padding: .34rem .8rem; line-height: 1.05; }
.layout-switch a[aria-current] { color: var(--paper); background: var(--ink); }
.layout-switch a:hover:not([aria-current]) { color: var(--ink); background: var(--accent-wash); }
.author-links a:hover, .text-link:hover { color: var(--accent); }
.chinese { font-family: "Songti SC", "Noto Serif CJK SC", "PingFang SC", serif; font-weight: 500; white-space: nowrap; }
.section-heading { justify-content: space-between; gap: 1rem; }
.section-heading h2 { font-weight: 540; font-size: 1.5rem; line-height: 1.1; letter-spacing: -.045em; }
.author-links { gap: 1.2rem; }
.author-links a, .text-link { font-size: .9rem; color: var(--accent); text-decoration: underline; }
.detail-label { font-family: var(--mono); font-size: .78rem; letter-spacing: .02em; }
.project-field { color: var(--muted); }
.project-card, .screen-choice { display: flex; min-width: 0; text-align: left; }
article:is(.project-card, .screen-choice) { position: relative; isolation: isolate; }
.card-preview { position: absolute; inset: 0; z-index: 1; }
a.project-title { position: relative; z-index: 2; text-decoration: none; }
a.project-title:is(:hover, :focus-visible) { text-decoration: underline; }
.thumb { position: relative; display: block; background: var(--accent-wash); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 240ms ease; }
.thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; }
.thumb video.playing { opacity: 1; }
.card-copy, .project-title, .project-field { display: block; }
.card-copy { min-width: 0; }
.project-title { font-weight: 540; letter-spacing: -.024em; line-height: 1.14; text-wrap: pretty; }
.project-field { font-size: .8125rem; line-height: 1.35; }
.first-screen { min-height: 100svh; display: flex; flex-direction: column; }
.front-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: auto; padding-block: clamp(1rem, 2.7vh, 2rem); }
.lower-nav { display: flex; gap: 1.15rem; font-size: .9rem; color: var(--accent); }
.bio-copy a, .news-list a { color: var(--accent); text-decoration-line: underline; text-decoration-color: color-mix(in srgb, currentColor 62%, transparent); }
.bio-copy a { white-space: nowrap; }
.bio-copy .school-link { white-space: normal; hyphens: none; }
.bio-copy p + p { margin-top: .6em; }
.bio-copy a:hover, .news-list a:hover, .screen .bio-copy a { text-decoration-color: currentColor; }
.projects-section { padding-block: .2rem 2.25rem; border-top: 1px solid var(--ink); }
.projects-section .section-heading { padding-block: 1.15rem 1rem; }
#publications, #news, #education, #projects { scroll-margin-top: .75rem; }
.project-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.1rem; }
.project-list .project-card { flex-direction: column; }
.project-list .thumb { width: 100%; aspect-ratio: 1.9; }
.project-list .card-copy { padding-top: .55rem; }
.project-list .project-title { font-size: 1.01rem; }
.project-list .project-field { margin-top: .23rem; }
.media-button { display: block; text-align: left; }
.media-button .thumb { width: 100%; height: 100%; }
.paper-links { display: inline-flex; flex-wrap: wrap; gap: .3rem .85rem; color: var(--muted); }
.paper-links a { text-decoration: none; }
.paper-links a:is(:hover, :focus-visible) { color: var(--accent); }
.video-mark { position: absolute; right: .55rem; bottom: .5rem; display: grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 100%; color: #fff; background: #101318bc; }
.video-mark i, .film-toggle.is-paused .transport-icon { display: block; width: 0; height: 0; margin-left: .1rem; border: solid transparent; border-width: .22rem 0 .22rem .38rem; border-left-color: currentColor; }
@media (hover: hover) {
  .project-card:hover .thumb img { transform: scale(1.035); }
  .project-card:hover .project-title { color: var(--accent); }
}

/* Index */
.index-intro { display: grid; grid-template-columns: minmax(0, .93fr) minmax(0, 1.05fr) auto; align-items: center; gap: clamp(1.4rem, 3vw, 3.4rem); padding-block: clamp(1.55rem, 4vh, 3.5rem); }
.index-signature { color: var(--accent); font-size: 1.1rem; letter-spacing: .21em; margin: 0 0 .35rem .22rem; }
.index-intro h1 { font-weight: 500; font-size: clamp(4.5rem, 7.3vw, 8rem); letter-spacing: -.058em; line-height: .98; white-space: nowrap; }
.index-bio { max-width: 48ch; }
.index-bio p { font-size: clamp(1rem, 1.28vw, 1.2rem); line-height: 1.46; letter-spacing: -.015em; text-wrap: pretty; }
.portrait-link { display: block; flex: none; width: var(--portrait-size, clamp(5.5rem, 8.5vw, 7.5rem)); aspect-ratio: 1; overflow: hidden; border-radius: var(--media-radius); }
.portrait-link img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 46%; transform: scale(1.68); transform-origin: 53% 52%; border-radius: 0; }
.index-page #publications { border-top: 1.5px solid var(--ink); }
.index-page .section-heading { padding: 1.15rem 0 1.1rem; }
.index-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(1.2rem, 2.7vh, 2.25rem) clamp(.85rem, 1.5vw, 1.6rem); }
.index-grid .project-card { flex-direction: column; }
.index-grid .thumb { width: 100%; aspect-ratio: 1.46; }
.index-grid .card-copy { padding-top: .66rem; }
.index-grid .project-title { font-size: clamp(1.025rem, 1.34vw, 1.32rem); }
.index-grid .project-field { margin-top: .42rem; color: var(--accent); }
[data-project="tensegrity"] .thumb img, [data-select="tensegrity"] .thumb img { object-position: 50% 56%; }
[data-project="soft-gripper"] .thumb img, [data-select="soft-gripper"] .thumb img { object-position: 50% 52%; }

/* Cinema */
html[data-layout="cinema"] {
  --original-paper: #171a17;
  --original-accent: #d7f37e;
  --ink: #f4f3e9;
  --muted: #b3b8ab;
  --rule: #444a40;
  --accent-wash: #30372a;
  color-scheme: dark;
}
[data-layout="cinema"] .footer-inner { max-width: none; padding-inline: clamp(1.25rem, 3.15vw, 3.5rem); }
[data-layout="cinema"] #site-footer { background: color-mix(in srgb, var(--paper) 90%, black); }
[data-layout="cinema"] .layout-switch a[aria-current] { background: var(--accent); color: #1b2112; }
.cinema-page { padding-inline: clamp(1.2rem, 2.5vw, 3.5rem); }
.cinema-layout { display: grid; grid-template-columns: minmax(0, 1.38fr) minmax(19rem, 1fr); gap: clamp(1.4rem, 2.8vw, 3.5rem); padding-block: 1.15rem 1.4rem; }
.screen { position: relative; display: flex; min-width: 0; flex-direction: column; justify-content: flex-end; isolation: isolate; color: #fff; background: #0c0e0c; overflow: hidden; border-radius: 1.3rem; }
.screen-picture, .screen-shade { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.screen-picture, .screen-shade, .screen-picture img, .screen-picture video { border-radius: inherit; }
.screen-picture img, .screen-picture video { width: 100%; height: 100%; object-fit: cover; }
.screen-picture[data-project="tensegrity"] img { object-position: 50% 45%; }
.screen-picture[data-project="trajectory"] img, .screen-picture[data-project="evolution"] img, .screen-picture[data-project="biped"] img { object-fit: contain; background: #262924; }
.screen-shade { background: linear-gradient(0deg, rgba(10,10,10,.97) 0%, rgba(10,10,10,.86) 24%, rgba(10,10,10,.4) 50%, transparent 73%); }
.screen-identity { padding: 2.5rem clamp(1.4rem, 3.5vw, 4rem) clamp(1.15rem, 3.6vh, 2.4rem); }
.screen-person { display: flex; align-items: center; gap: clamp(.85rem, 1.5vw, 1.5rem); }
.screen h1 { font-size: clamp(3.6rem, 6.15vw, 7rem); line-height: .99; font-weight: 500; letter-spacing: -.057em; }
.screen-name .chinese { display: block; margin-top: .42rem; color: var(--accent); letter-spacing: .13em; font-size: 1rem; }
.screen-identity p { max-width: 47ch; margin: .85rem 0 0 .15rem; font-size: 1rem; line-height: 1.45; text-wrap: pretty; }
.screen-controls { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0 1.25rem; margin: 0 clamp(1.4rem, 3.5vw, 4rem); border-top: 1px solid #ffffff65; }
#screen-title { font-size: 1rem; font-weight: 500; letter-spacing: -.02em; }
.transport { display: flex; align-items: center; gap: .4rem; }
.transport button { border: 1px solid #aaa; padding: .5rem .78rem; border-radius: 2rem; color: #fff; background: #14141477; font-size: .875rem; }
.transport button:hover { background: var(--accent-wash); }
.transport .film-toggle { width: 2.15rem; height: 2.15rem; padding: 0; display: grid; place-items: center; }
.transport .film-toggle[hidden] { display: none; }
.transport-icon { width: .55rem; height: .65rem; border: solid currentColor; border-width: 0 3px; }
.film-toggle.is-paused .transport-icon { border-width: .3rem 0 .3rem .46rem; }
.screen-index { display: flex; flex-direction: column; width: 100%; padding: clamp(.6rem, 2.6vh, 2.25rem) 0 0; }
.screen-index .section-heading { padding-bottom: clamp(.7rem, 1.8vh, 1.5rem); }
.screen-index h2 { font: 430 clamp(1.8rem, 2.95vw, 3.3rem)/1 var(--serif); letter-spacing: -.055em; }
.screen-list { border-top: 1px solid var(--rule); }
.screen-choice { width: 100%; align-items: center; gap: clamp(.75rem, 1.35vw, 1.5rem); border-bottom: 1px solid var(--rule); padding-block: clamp(.65rem, 1.65vh, 1.35rem); padding-right: .2rem; }
.screen-choice .thumb { flex: none; width: clamp(4.8rem, 8vw, 8.25rem); height: clamp(3.25rem, 8.5vh, 5.8rem); }
.screen-choice .video-mark, .folio-archive .video-mark { display: none; }
.screen-choice .project-title { font-weight: 510; font-size: clamp(1rem, 1.34vw, 1.36rem); letter-spacing: -.03em; }
.screen-choice .project-field { margin-top: .17rem; }
.choice-mark { margin-left: auto; flex: none; width: .65rem; }
.screen-choice:has(> [aria-pressed="true"]) { color: var(--accent); }
.screen-choice:has(> [aria-pressed="true"]) .choice-mark { width: 0; border: solid transparent; border-width: .27rem 0 .27rem .43rem; border-left-color: var(--accent); }
.screen-choice:has(> [aria-pressed="true"]) .thumb { outline: 1px solid var(--accent); outline-offset: -1px; }
.screen-choice:hover .project-title { color: var(--accent); }

/* Folio */
html[data-layout="folio"] {
  --original-paper: #f7f3e9;
  --original-accent: #994327;
  --ink: #302b24;
  --muted: #665d52;
  --rule: #c9bfb0;
  --accent-wash: #eae2d3;
}
[data-layout="folio"] .layout-switch a[aria-current] { background: var(--accent); color: #fff; }
.folio-page { max-width: 92rem; padding-bottom: 2rem; }
[data-layout="folio"] .footer-inner { max-width: 92rem; }
.folio-intro { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 3rem; padding: clamp(1.6rem, 4.05vh, 3.25rem) 0; border-bottom: 3px double var(--ink); }
.folio-identity { display: flex; gap: clamp(.8rem, 1.7vw, 1.7rem); align-items: center; }
.folio-intro h1 { font: 460 clamp(3.6rem, 6.35vw, 7rem)/.98 var(--serif); letter-spacing: -.062em; white-space: nowrap; }
.folio-name .chinese { display: block; margin: 0 0 .35rem .12rem; }
.folio-intro .chinese { font-size: 1.08rem; color: var(--accent); letter-spacing: .11em; }
.folio-bio { max-width: 47ch; }
.folio-bio p { font: 440 clamp(1.08rem, 1.48vw, 1.34rem)/1.35 var(--serif); letter-spacing: -.015em; text-wrap: pretty; }
.folio-page .section-heading { padding: .85rem 0 .75rem; }
.folio-page h2 { font: 480 1.45rem/1.14 var(--serif); letter-spacing: -.05em; }
.folio-featured { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1rem, 2.5vw, 2.75rem); }
.folio-featured .project-card { flex-direction: column; width: 100%; }
.folio-featured .thumb { width: 100%; aspect-ratio: 3.25; }
.folio-featured .card-copy { display: flex; flex-direction: column; align-items: baseline; gap: .24rem; padding-top: .58rem; width: 100%; }
.folio-featured .project-title { font: 460 clamp(1.24rem, 1.9vw, 2.15rem)/1.09 var(--serif); letter-spacing: -.043em; }
.folio-featured .project-field { order: -1; color: var(--accent); font-size: .8rem; }
.folio-archive, .folio-page .project-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(1rem, 2.5vw, 2.75rem); row-gap: 0; }
.folio-archive { margin-top: 1.1rem; border-top: 1px solid var(--rule); }
.folio-archive .project-card, .folio-page .project-list .project-card { flex-direction: row; align-items: center; gap: .85rem; padding: .65rem 0; border-bottom: 1px solid var(--rule); }
.folio-archive .thumb, .folio-page .project-list .thumb { flex: none; width: clamp(4.6rem, 7.5vw, 7.5rem); height: clamp(3.1rem, 6.4vh, 4.1rem); }
.folio-archive .card-copy, .folio-page .project-list .card-copy { display: block; padding: 0; }
.folio-archive .project-title { font: 460 clamp(1.04rem, 1.3vw, 1.32rem)/1.16 var(--serif); letter-spacing: -.025em; }
.folio-archive .project-field { margin-top: .28rem; color: var(--accent); }
.folio-page .project-list .project-title { font: 460 1.2rem/1.12 var(--serif); }

/* Minimal */
html:is([data-layout="minimal"], [data-layout="reel"]) {
  --original-paper: #f5f4ef;
  --original-accent: #353b37;
  --ink: #20211e;
  --muted: #575951;
  --rule: #cccfc4;
  --accent-wash: #ecede8;
  --media-radius: .7rem;
}
.minimal-page, :is([data-layout="minimal"], [data-layout="reel"]) .footer-inner {
  --minimal-gutter: clamp(1.25rem, 3.7vw, 3.25rem);
  max-width: 55rem; margin-left: 0; padding-inline: var(--minimal-gutter); font-family: var(--mono);
}
:is([data-layout="minimal"], [data-layout="reel"]) .layout-switch { border-color: transparent; }
:is([data-layout="minimal"], [data-layout="reel"]) .layout-switch a[aria-current] { color: var(--ink); background: var(--accent-wash); }
.plain-intro { display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: start; align-items: center; column-gap: clamp(.9rem, 1.5vw, 1.5rem); padding: clamp(1.4rem, 3.6vh, 2.5rem) 0 clamp(1rem, 2.4vh, 1.7rem); }
.plain-intro .portrait-link { grid-column: 1; grid-row: 1 / span 2; align-self: start; }
.plain-intro h1 { font: 470 clamp(1.9rem, 3vw, 2.65rem)/1.06 var(--serif); letter-spacing: -.045em; }
.plain-intro h1 span { margin-left: .35rem; font: 430 1rem var(--serif); color: var(--muted); letter-spacing: .08em; vertical-align: .18em; }
.plain-intro .bio-copy { grid-column: 2; max-width: 43rem; font-size: 1rem; line-height: 1.47; margin-top: .6rem; }
.minimal-page .section-heading { padding: .5rem 0 .6rem; }
.minimal-page .section-heading h2 { font-size: 1rem; font-weight: 600; letter-spacing: -.025em; }
.plain-list, .minimal-page .project-list { display: grid; grid-template-columns: 1fr; gap: .36rem; padding-left: 1.3rem; margin-left: .23rem; border-left: 1px solid var(--rule); }
.plain-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) clamp(5.9rem, 9vw, 7.25rem); align-items: center; gap: clamp(.8rem, 2vw, 1.65rem); padding: .42rem .65rem; border: 1px solid transparent; border-bottom-color: var(--rule); }
.plain-row::before { content: ""; position: absolute; width: .35rem; height: .35rem; border-radius: .08rem; top: 1.05rem; left: -1.54rem; background: var(--accent); }
.plain-row:focus-within { border-color: var(--accent); background: var(--accent-wash); }
@media (hover: hover) { .plain-row:hover { border-color: var(--accent); background: var(--accent-wash); } }
.plain-meta { color: var(--muted); line-height: 1.3; font-size: .8125rem; }
.plain-row h3 { font-size: 1rem; line-height: 1.25; font-weight: 600; letter-spacing: -.035em; margin-top: .18rem; }
.plain-title { text-align: left; text-decoration: none; }
.plain-title:hover { color: var(--accent); text-decoration: underline; }
.plain-row .media-button { width: 100%; aspect-ratio: 1.85; }
.minimal-page .projects-section { border-top: 0; }
.minimal-page .front-foot .author-links { gap: .9rem; }

/* Keep the source frame intact. Each treatment occupies only its left edge. */
[data-layout="reel"] .footer-inner { max-width: none; }
.reel-page { max-width: none; }
.work-reel {
  --edge-width: 10%;
  --edge-paint: linear-gradient(90deg, var(--paper), transparent);
  position: relative; display: flex; flex-direction: column; min-width: 0;
}
.reel-media { position: relative; isolation: isolate; flex: none; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; pointer-events: none; }
.reel-media::after, .reel-media::before { position: absolute; inset: 0 auto 0 0; width: var(--edge-width); pointer-events: none; }
.reel-media::after { content: ""; z-index: 2; background: var(--edge-paint); }
.work-reel[data-edge="clear"] .reel-media::after { content: none; }
.work-reel[data-edge="soft"] { --edge-width: 18%; --edge-paint: linear-gradient(90deg, var(--paper) 2%, color-mix(in srgb, var(--paper) 77%, transparent) 32%, color-mix(in srgb, var(--paper) 20%, transparent) 73%, transparent); }
.work-reel[data-edge="wide"] { --edge-width: 28%; --edge-paint: linear-gradient(90deg, var(--paper) 4%, color-mix(in srgb, var(--paper) 64%, transparent) 41%, transparent); }
.work-reel[data-edge="glass"] { --edge-width: 15%; --edge-blur: 5px; --edge-paint: linear-gradient(90deg, var(--paper), #ffffff29 30%, transparent 48%, #ffffff69 62%, transparent 70%); }
.work-reel[data-edge="frosted"] { --edge-width: 23%; --edge-blur: 15px; --edge-paint: linear-gradient(90deg, var(--paper), color-mix(in srgb, var(--paper) 47%, transparent) 32%, #ffffff15 76%, transparent); }
.work-reel:is([data-edge="glass"], [data-edge="frosted"]) .reel-media::before {
  content: ""; z-index: 1; background: #ffffff2b;
  -webkit-backdrop-filter: blur(var(--edge-blur)); backdrop-filter: blur(var(--edge-blur));
  -webkit-mask-image: linear-gradient(90deg, black 26%, transparent 98%); mask-image: linear-gradient(90deg, black 26%, transparent 98%);
}
.reel-frame { position: absolute; inset: 0; opacity: 0; background: var(--paper); transition: opacity .65s ease-in-out; }
.reel-frame.visible { opacity: 1; }
.reel-frame img, .reel-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; object-fit: contain; }
.reel-frame video { opacity: 0; }
.reel-frame video.playing { opacity: 1; }
.reel-footer { padding: .55rem clamp(1.25rem, 3vw, 2.6rem) 0 clamp(1rem, 2.1vw, 2rem); font: .875rem/1.4 var(--mono); }
.reel-caption { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; width: 100%; }
.reel-title { color: var(--ink); text-align: left; }
.reel-controls { display: flex; align-items: center; gap: 1.2rem; color: var(--muted); }
.reel-controls button, .reel-title { min-height: 2rem; }
.reel-caption button:hover { color: var(--accent); text-decoration: underline; text-underline-offset: .22em; text-decoration-skip-ink: none; }
.reel-edges { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .7rem; margin: .35rem 0 0; padding: 0; border: 0; min-width: 0; }
.reel-edges legend { float: left; padding: .35rem 0; color: var(--muted); font-size: .8125rem; }
.edge-choices { display: flex; flex-wrap: wrap; gap: .15rem; }
.edge-choice { position: relative; cursor: pointer; }
.edge-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.edge-choice span { display: block; border: 1px solid transparent; border-radius: .35rem; padding: .35rem .43rem; font: .8125rem/1.3 var(--sans); }
.edge-choice:hover span { background: var(--accent-wash); }
.edge-choice input:checked + span { background: var(--accent-wash); border-color: var(--accent); color: var(--accent); }
.edge-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (min-width: 941px) {
  .reel-page { display: grid; grid-template-columns: clamp(32rem, 53%, 54rem) minmax(0, 1fr); padding: 0; }
  .reel-page .first-screen { display: contents; }
  .reel-page :is(.plain-intro, #publications, .front-foot, .news-section, .education-section, .projects-section) { grid-column: 1; margin-inline: clamp(1.6rem, 3.7vw, 3.25rem) 1rem; }
  .reel-page .plain-intro { grid-row: 1; --portrait-size: clamp(5.75rem, 7.5vw, 7.25rem); }
  .reel-page #publications { grid-row: 2; }
  .reel-page .plain-list { row-gap: .22rem; }
  .reel-page .plain-row { padding-block: .34rem; }
  .reel-page .plain-row .media-button { max-height: 3.4rem; }
  .reel-page .front-foot { grid-row: 3; padding-block: 1rem 1.5rem; }
  .reel-page .news-section { grid-row: 4; }
  .reel-page .education-section { grid-row: 5; }
  .reel-page .projects-section { grid-row: 6; }
  .work-reel { position: sticky; top: 0; grid-area: 1 / 2 / 7 / 3; align-self: start; justify-content: center; min-height: 100svh; padding-block: 1.25rem clamp(1.5rem, 7vh, 5rem); }
}
@media (max-width: 940px) {
  .work-reel { margin-inline: calc(-1 * clamp(1.25rem, 3.7vw, 3.25rem)); margin-block: .3rem 1rem; }
  .reel-footer { padding-inline: clamp(1.25rem, 3.7vw, 3.25rem); }
}
@media (max-width: 565px) {
  .reel-edges { display: block; }
  .reel-edges legend { float: none; padding-bottom: .14rem; }
}

/* Academic */
html[data-layout="academic"] {
  --original-paper: #fff;
  --original-accent: #214f86;
  --heading-ink: #243e78;
  --ink: #202a36;
  --muted: #4d5a67;
  --rule: #d2dbe2;
  --accent-wash: #eaf0f6;
  --media-radius: .7rem;
}
.academic-page, [data-layout="academic"] .footer-inner { max-width: 74rem; }
[data-layout="academic"] .layout-switch a[aria-current] { background: var(--accent); }
.academic-spread { padding-block: clamp(1.2rem, 3.5vh, 2.5rem) 1.3rem; gap: 1rem; }
.academic-profile { display: grid; grid-template-columns: auto minmax(12.75rem, .7fr) minmax(15rem, 1.1fr); align-items: center; gap: 1.5rem; }
.academic-profile { --portrait-size: clamp(6.35rem, 9.6vw, 8.3rem); }
.academic-identity h1 { display: inline; font: 620 clamp(1.85rem, 2.7vw, 2.65rem)/1.05 var(--sans); color: var(--heading-ink); letter-spacing: -.045em; }
.academic-identity .chinese { display: inline-block; margin-left: .4rem; color: var(--muted); font-size: 1rem; letter-spacing: .12em; }
.profile-bio { max-width: 54ch; font-size: 1rem; line-height: 1.48; text-wrap: pretty; }
.academic-profile-links { margin-top: .7rem; }
.academic-profile-links .author-links { gap: .9rem; }
.academic-page .section-heading { border-bottom: 1px solid var(--rule); padding-bottom: .55rem; }
.academic-page h2 { font: 610 clamp(1.4rem, 2.05vw, 1.9rem)/1.12 var(--sans); color: var(--heading-ink); letter-spacing: -.035em; }
.citation-row { display: grid; grid-template-columns: clamp(6.2rem, 8.2vw, 7.5rem) minmax(0, 1fr); align-items: center; gap: clamp(.9rem, 1.7vw, 1.6rem); padding: clamp(.5rem, 1.2vh, .85rem) 0; border-bottom: 1px solid var(--rule); }
.citation-row .media-button { width: 100%; aspect-ratio: 1.68; }
.citation-row h3 { font: 560 clamp(1.08rem, 1.55vw, 1.4rem)/1.18 var(--serif); }
.citation-row h3 a { color: var(--accent); text-decoration: none; }
.citation-row h3 a:hover { text-decoration: underline; }
.detail-authors strong { color: var(--ink); font-weight: 650; }
.author-marker { font-size: .78em; line-height: 0; }
.venue { margin-top: .3rem; color: var(--muted); font-size: .875rem; font-style: italic; line-height: 1.3; }
.academic-page .projects-section { border-top-color: var(--rule); }
.academic-page .projects-section .section-heading { border-bottom: 0; }
.academic-page .project-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.academic-page .project-list .project-card { flex-direction: row; gap: .85rem; align-items: center; }
.academic-page .project-list .thumb { flex: none; width: 34%; aspect-ratio: 1.6; }
.academic-page .project-list .card-copy { padding: 0; }
.academic-page .project-list .project-title { font: 550 1.05rem/1.2 var(--serif); color: var(--accent); }

/* The same sample colors drive the page and its palette menu. */
[data-tone="paper"]    { --light-accent: #49483e; --light-sheet: #f7f6f0; --dark-accent: #e0dbcb; --dark-sheet: #22211e; }
[data-tone="graphite"] { --light-accent: #383838; --light-sheet: #fafafa; --dark-accent: #dedede; --dark-sheet: #1b1b1b; }
[data-tone="slate"]    { --light-accent: #3b5d75; --light-sheet: #f3f6f8; --dark-accent: #aec7db; --dark-sheet: #1b2229; }
[data-tone="sage"]     { --light-accent: #4b644f; --light-sheet: #f4f6f0; --dark-accent: #b9ccac; --dark-sheet: #1d241e; }
[data-tone="petrol"]   { --light-accent: #2e6366; --light-sheet: #f1f6f5; --dark-accent: #94c9c1; --dark-sheet: #192425; }
[data-tone="clay"]     { --light-accent: #86543f; --light-sheet: #f8f3ed; --dark-accent: #e0b499; --dark-sheet: #29211e; }
[data-tone="plum"]     { --light-accent: #755370; --light-sheet: #f7f3f6; --dark-accent: #d2b5ce; --dark-sheet: #261f26; }

html[data-tone]:not([data-tone="original"]) {
  --paper: var(--light-sheet);
  --accent: var(--light-accent);
  --ink: #242424;
  --muted: color-mix(in srgb, var(--ink) 72%, var(--paper));
  --rule: color-mix(in srgb, var(--ink) 23%, var(--paper));
  --accent-wash: color-mix(in srgb, var(--accent) 9%, var(--paper));
  --heading-ink: var(--accent);
}
html[data-layout="cinema"][data-tone]:not([data-tone="original"]) {
  --paper: var(--dark-sheet);
  --accent: var(--dark-accent);
  --ink: #f1f1f1;
}
html[data-tone]:not([data-tone="original"]) .layout-switch a[aria-current] { color: var(--paper); background: var(--accent); }
html:is([data-layout="minimal"], [data-layout="reel"])[data-tone]:not([data-tone="original"]) .layout-switch a[aria-current] { color: var(--accent); background: var(--accent-wash); }

.palette-picker { margin-left: auto; position: relative; z-index: 3; flex: none; font-family: var(--sans); }
.palette-picker summary { display: inline-flex; align-items: center; gap: .48rem; min-height: 2rem; padding: .32rem .7rem; list-style: none; border: 1px solid var(--rule); border-radius: 1.5rem; font-size: .875rem; cursor: pointer; }
.palette-picker summary::-webkit-details-marker { display: none; }
.palette-picker summary::after { content: ""; width: .32rem; height: .32rem; transform: translateY(.08rem) rotate(225deg); border: solid currentColor; border-width: 0 1px 1px 0; }
.palette-picker[open] summary::after { transform: translateY(-.08rem) rotate(45deg); }
.palette-dot { width: .66rem; height: .66rem; border-radius: 50%; background: var(--accent); }
.palette-menu { position: absolute; bottom: calc(100% + .52rem); right: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .18rem; width: min(16.5rem, calc(100vw - 2.25rem)); min-width: 0; padding: .45rem; margin: 0; border: 1px solid var(--rule); border-radius: .72rem; background: var(--paper); color: var(--ink); box-shadow: 0 .4rem 1.4rem #0002; }
.palette-picker:not([open]) .palette-menu { display: none; }
.palette-option { display: grid; grid-template-columns: 1.28rem 1fr .62rem; align-items: center; gap: .48rem; position: relative; min-height: 2.45rem; padding: .35rem .45rem; border-radius: .36rem; font-size: .87rem; cursor: pointer; }
.palette-option input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.palette-option:hover, .palette-option:has(input:checked) { background: var(--accent-wash); }
.palette-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.palette-swatch { width: 1.28rem; height: 1.28rem; border: 1px solid var(--rule); border-radius: .3rem; background: linear-gradient(90deg, var(--light-accent) 52%, var(--light-sheet) 52%); }
[data-layout="cinema"] .palette-swatch { background: linear-gradient(90deg, var(--dark-accent) 52%, var(--dark-sheet) 52%); }
.palette-swatch[data-tone="original"] { --light-accent: var(--original-accent); --light-sheet: var(--original-paper); --dark-accent: var(--original-accent); --dark-sheet: var(--original-paper); }
.palette-option input:checked ~ .palette-check { width: .34rem; height: .62rem; justify-self: end; transform: translateY(-.08rem) rotate(43deg); border: solid currentColor; border-width: 0 1.7px 1.7px 0; }

/* Recent News and Education */
.news-section, .education-section { display: grid; grid-template-columns: minmax(9.5rem, .32fr) minmax(0, 1fr); align-items: start; gap: 1rem clamp(1.3rem, 3vw, 3rem); padding-block: clamp(1.35rem, 3vw, 2.3rem); border-top: 1px solid var(--ink); }
:is(.news-section, .education-section) > .section-heading { border: 0; padding: .22rem 0 0; }
.news-list, .education-list { list-style: none; margin: 0; padding: 0; }
.news-list li { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr); align-items: baseline; gap: .9rem; padding: .45rem 0; }
.news-list li:first-child { padding-top: .22rem; }
.news-list li + li, .education-list li + li { border-top: 1px solid var(--rule); }
.news-list time, .education-years { color: var(--muted); font: .83rem/1.4 var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.news-list p { font-size: 1rem; line-height: 1.4; }
.education-list li { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr) auto; align-items: center; gap: .12rem .9rem; padding-block: .7rem; }
.education-list img { width: 2.75rem; height: 2.75rem; object-fit: contain; border-radius: .35rem; }
.education-list h3 { font: 550 1rem/1.3 var(--sans); }
.education-list h3 a { text-decoration: none; }
.education-list h3 a:is(:hover, :focus-visible) { text-decoration: underline; color: var(--accent); }
.education-list p { margin-top: .12rem; color: var(--muted); font: .9rem/1.4 var(--sans); }
.minimal-page :is(.news-section, .education-section) { display: block; border-top-color: var(--rule); }
.minimal-page :is(.news-list, .education-list) { margin-top: .65rem; }
.academic-page :is(.news-section, .education-section) { border-top-color: var(--rule); }
.cinema-page :is(.news-section, .education-section) h2 { font: 450 1.85rem/1.1 var(--serif); letter-spacing: -.04em; }

/* Project viewer */
.modal-open { overflow: hidden; }
.detail { width: min(47rem, calc(100% - 2rem)); max-height: 91svh; margin: auto; padding: 0; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); overscroll-behavior: contain; }
.detail::backdrop { background: rgba(10,14,18,.73); }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem 1.3rem; }
.detail-label { color: var(--accent); }
.detail-close { width: 2.25rem; height: 2.25rem; display: grid; place-items: center; border: 1px solid var(--rule); border-radius: 50%; }
.detail-close:hover { color: var(--accent); }
.close-icon { position: relative; width: .86rem; height: .86rem; }
.close-icon::before, .close-icon::after { content: ""; position: absolute; top: 48%; left: 0; width: 100%; height: 1.5px; background: currentColor; transform: rotate(45deg); }
.close-icon::after { transform: rotate(-45deg); }
.detail-media { margin-inline: 1.25rem; overflow: hidden; background: #1a1c1c; }
.detail-media img, .detail-media video { width: 100%; height: min(44svh, 24.75rem); object-fit: contain; }
.detail-text, .about-body { padding: clamp(1.15rem, 3vw, 2rem); }
.detail h2 { font-size: clamp(1.9rem, 4vw, 3.4rem); font-weight: 510; line-height: 1.03; letter-spacing: -.055em; }
[data-layout="folio"] .detail h2 { font-family: var(--serif); }
.detail p { max-width: 58ch; margin-top: .8rem; font-size: 1rem; line-height: 1.48; text-wrap: pretty; }
.detail-text .paper-links { margin-top: .9rem; font-size: .94rem; line-height: 1.48; }
.detail-text .detail-authors { color: var(--muted); font-size: .94rem; }
.detail-text .media-credit { margin-top: 1.05rem; font-size: .78rem; color: var(--muted); }
.detail-about { max-width: 41rem; }
.about-body { display: grid; grid-template-columns: minmax(5.5rem, .63fr) 1.5fr; align-items: start; gap: clamp(1rem, 2.7vw, 2rem); padding-top: .45rem; }
.about-portrait { width: 100%; height: auto; }
.about-name .chinese { color: var(--accent); font-size: .9rem; letter-spacing: .16em; }
.about-body h2 { margin-top: .25rem; }
.about-body .author-links { margin-top: 1rem; }

@media (max-width: 1000px) {
  .index-grid { gap: 1.25rem .9rem; }
  .folio-archive { grid-template-columns: 1fr; }
  .cinema-layout { grid-template-columns: minmax(0, 1.15fr) minmax(17.5rem, .95fr); }
  .screen h1 { font-size: clamp(3.15rem, 6.4vw, 4.4rem); }
  .screen-choice .thumb { width: 4.65rem; }
  .academic-spread { gap: 1rem; }
}
@media (min-width: 741px) and (max-width: 1100px) {
  .index-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
  .index-intro { grid-template-columns: minmax(0, .9fr) minmax(0, 1fr) auto; gap: 1rem; }
  .index-intro h1 { font-size: clamp(3.4rem, 7.6vw, 4.5rem); }
  .index-bio p { font-size: 1rem; }
  .portrait-link { --portrait-size: 5rem; }
  .folio-intro { gap: 1.4rem; }
  .folio-intro h1 { font-size: clamp(3.4rem, 7.6vw, 4.65rem); }
  .project-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .academic-page .project-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 740px) {
  :root { --media-radius: .7rem; }
  .layout-switch a { padding: .38rem .59rem; }
  .index-intro { grid-template-columns: 1fr auto; gap: .9rem 1rem; padding-block: 1.45rem 1.2rem; }
  .index-intro h1 { font-size: clamp(3.4rem, 10.5vw, 5.5rem); }
  .index-signature { font-size: .94rem; }
  .portrait-link { --portrait-size: clamp(4.75rem, 15vw, 6.5rem); }
  .index-intro .portrait-link { grid-column: 2; grid-row: 1; align-self: center; }
  .index-bio { grid-column: 1/-1; }
  .index-bio p { max-width: 30rem; }
  .index-page .section-heading { padding: .8rem 0; }
  .section-heading h2 { font-size: 1.25rem; }
  .index-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .index-grid .thumb { aspect-ratio: 1.97; }
  .index-grid .card-copy { padding-top: .4rem; }
  .index-grid .project-title { font-size: 1rem; }
  .cinema-layout { display: flex; flex-direction: column; gap: .6rem; padding: .8rem 0 .5rem; }
  .screen { min-height: clamp(20rem, 45svh, 29rem); border-radius: 1rem; }
  .screen-picture img, .screen-picture video { object-position: 50% 47%; }
  .screen-identity { padding: 1rem var(--gutter) .8rem; }
  .screen h1 { font-size: clamp(2.4rem, 9vw, 4.7rem); }
  .screen-name .chinese { margin-top: .3rem; }
  .screen-identity p { font-size: .95rem; margin-top: .5rem; }
  .screen-controls { margin-inline: var(--gutter); padding: .55rem 0 .7rem; }
  .screen-index { flex: 1; padding: .6rem .05rem 0; }
  .screen-index h2 { font-size: 1.9rem; }
  .screen-index .section-heading { padding-bottom: .6rem; }
  .screen-choice { gap: .85rem; padding-block: .58rem; }
  .screen-choice .thumb { width: clamp(4.2rem, 18vw, 6rem); height: 3.25rem; }
  .screen-choice .project-title { font-size: 1rem; }
  .folio-intro { grid-template-columns: 1fr; gap: .65rem; padding: 1.4rem 0 1rem; }
  .folio-intro h1 { font-size: clamp(3.7rem, 12vw, 5.45rem); }
  .folio-featured .thumb { aspect-ratio: 2; }
  .folio-featured .project-title { font-size: clamp(1.08rem, 3.2vw, 1.45rem); }
  .folio-archive { margin-top: .9rem; }
  .folio-archive .thumb, .folio-page .project-list .thumb { width: 3.85rem; height: 2.8rem; }
  .academic-spread { display: flex; flex-direction: column; gap: 1.2rem; padding-top: 1.4rem; }
  .academic-profile { display: grid; grid-template-columns: clamp(5rem, 17vw, 7rem) 1fr; gap: .65rem 1.05rem; width: 100%; }
  .academic-profile .portrait-link { width: 100%; }
  .academic-identity .chinese { margin-left: .45rem; margin-top: 0; font-size: .85rem; }
  .academic-identity h1 { display: inline; }
  .academic-profile-links { margin-top: .45rem; }
  .academic-bio { grid-column: 1/-1; }
  .profile-bio { margin: 0; }
  .academic-spread > section { width: 100%; }
  .citation-row { padding: .72rem 0; grid-template-columns: clamp(4.7rem, 17vw, 6.5rem) minmax(0, 1fr); }
  .citation-row .media-button { align-self: start; margin-top: .12rem; }
  .plain-intro .portrait-link { grid-row: 1; align-self: center; }
  .plain-intro .bio-copy { grid-column: 1 / -1; }
  .plain-row { grid-template-columns: minmax(0, 1fr) clamp(4.25rem, 15vw, 6.5rem); gap: .85rem; }
}
@media (max-width: 565px) {
  .layout-switch a { padding: .48rem .55rem; }
  .author-links { gap: .8rem; }
  .author-links a { font-size: .83rem; }
  .index-intro { padding-top: 1.2rem; gap: .55rem .8rem; }
  .index-grid { grid-template-columns: 1fr; gap: 0; }
  .index-grid .project-card { flex-direction: row; align-items: center; gap: .85rem; padding-block: .6rem; border-top: 1px solid var(--rule); }
  .index-grid .thumb { flex: none; width: clamp(4.8rem, 23vw, 6.7rem); aspect-ratio: 1.5; }
  .index-grid .card-copy { padding: 0; }
  .index-grid .project-field { margin-top: .25rem; }
  .project-list, .academic-page .project-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .screen-choice .project-field { line-height: 1.2; }
  .folio-featured { column-gap: .85rem; }
  .folio-archive, .folio-page .project-list { grid-template-columns: 1fr; }
  .folio-archive .project-card, .folio-page .project-list .project-card { gap: .8rem; padding: .5rem 0; }
  .folio-featured .project-field { font-size: .76rem; }
  .folio-archive .project-title { font-size: 1.04rem; }
  .plain-intro { padding: 1.3rem 0 1rem; }
  .plain-intro .bio-copy { font-size: .94rem; }
  .plain-row { padding: .58rem .2rem; }
  .plain-row h3 { font-size: 1rem; }
  .academic-page .project-list .project-card { flex-direction: column; align-items: stretch; gap: .48rem; }
  .academic-page .project-list .thumb { width: 100%; aspect-ratio: 1.95; }
  .citation-row { column-gap: .7rem; }
  .detail-media { margin-inline: .8rem; }
  .about-body { grid-template-columns: 1fr; }
  .about-portrait { width: 5rem; }
  .education-list li { grid-template-columns: 2.5rem minmax(0, 1fr); column-gap: .75rem; }
  .education-list img { grid-row: 1 / span 2; width: 2.5rem; height: 2.5rem; }
  .education-years { grid-column: 2; }
}
@media (max-width: 900px) {
  .news-section, .education-section { grid-template-columns: 1fr; gap: .65rem; }
  .news-list li { grid-template-columns: 4.75rem minmax(0, 1fr); gap: .65rem; }
}
@media (max-width: 360px) {
  :root { --gutter: 1rem; }
  .index-intro { grid-template-columns: minmax(0, 1fr) auto; }
  .index-intro h1 { font-size: 2.9rem; }
  .portrait-link { --portrait-size: 4.4rem; }
  .folio-intro { grid-template-columns: minmax(0, 1fr); }
  .folio-identity { gap: .75rem; }
  .folio-intro h1 { font-size: 3.15rem; }
  .screen-choice { gap: .65rem; }
  .screen-choice .thumb { width: 3.7rem; height: 3rem; }
  .plain-row { grid-template-columns: minmax(0,1fr) 4.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
