:root {
  --paper: #f4efe4;
  --paper-2: #ebe4d4;
  --ink: #1d1b17;
  --ink-2: #4a463e;
  --ink-3: #8a8374;
  --rule: #cfc6b2;
  --seal: #b8321f;
  --serif: "EB Garamond", Garamond, Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --zh: "Noto Serif SC", "Songti SC", SimSun, serif;
  --gutter: clamp(16px, 5vw, 64px);
  --measure: 1120px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(18px, 1.05vw + 12px, 21px);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "onum";
  overflow-x: hidden;
}
::selection { background: var(--seal); color: var(--paper); }

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--rule); transition: color .2s, text-decoration-color .2s; }
a:hover { color: var(--seal); text-decoration-color: var(--seal); }
b { font-weight: 600; }
.zh { font-family: var(--zh); font-weight: 600; font-size: .92em; letter-spacing: .02em; }
.arr { display: inline-block; font-family: var(--mono); font-size: .8em; transition: transform .25s; }
a:hover .arr { transform: translate(2px, -2px); }

/* Paper grain */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .4 0 0 0 0 .3 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Masthead */
.masthead {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.masthead.scrolled { border-bottom-color: var(--rule); }
.mark {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  background: var(--seal); color: var(--paper); text-decoration: none;
  font-size: 16px; letter-spacing: .02em; border-radius: 3px;
  box-shadow: inset 0 0 0 2px var(--seal), inset 0 0 0 3px rgba(244,239,228,.55);
  transform: rotate(-3deg); transition: transform .3s;
}
.mark:hover { color: var(--paper); transform: rotate(0); }
.index { display: flex; gap: clamp(14px, 2.4vw, 34px); }
.index a {
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none; color: var(--ink-2); position: relative; padding: 4px 0;
}
.index a i { font-style: normal; color: var(--ink-3); margin-right: 6px; }
.index a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--seal); transform: scaleX(0); transform-origin: left; transition: transform .35s; }
.index a.active, .index a:hover { color: var(--ink); }
.index a.active::after, .index a:hover::after { transform: scaleX(1); }
.index a.active i { color: var(--seal); }
.clock { font-family: var(--mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.clock time { color: var(--ink); font-variant-numeric: tabular-nums; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--seal); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

main { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); }

/* Hero */
.hero { padding: clamp(64px, 12vh, 140px) 0 clamp(56px, 9vh, 110px); border-bottom: 1px solid var(--ink); }
.eyebrow, .ch-note, .role, .s-when, .when, .w-tags, .facts dt, .stat span, .tally-head, .tally span, .tongues i, .colophon, .copy, .s-where {
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3);
}
.hero-top { margin-top: 48px; display: grid; grid-template-columns: 1fr 300px; gap: 64px; align-items: end; }
.hero-links { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 28px 0 0; }
.hero-links a { font-family: var(--mono); font-size: 13px; letter-spacing: .04em; text-decoration: none; border-bottom: 1px solid var(--ink); padding-bottom: 2px; }
.hero-links a:hover { border-color: var(--seal); }
a:hover .arr.dl { transform: translateY(2px); }
.portrait { margin: 0; position: relative; }
.portrait img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; filter: grayscale(1) contrast(1.05) sepia(.18); mix-blend-mode: multiply; border-radius: 2px; }
.portrait::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(29,27,23,.15); border-radius: 2px; pointer-events: none; }
.hero-top .lede { max-width: 40ch; }
.hero-top .lede { margin-top: 0; }
.edu { border-top: 1px solid var(--ink); padding-top: 14px; }
.edu-head { margin: 0 0 6px; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--seal); }
.edu ul { list-style: none; margin: 0; padding: 0; }
.edu li { display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.edu img { width: 76px; height: 28px; object-fit: contain; object-position: left center; }
.edu b { display: block; font-weight: 500; font-size: .95em; line-height: 1.2; }
.edu span:not(.mono-badge) { display: block; font-size: .78em; color: var(--ink-3); line-height: 1.3; margin-top: 2px; }
.edu em { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; align-self: start; padding-top: 3px; }
.mono-badge { display: grid; place-items: center; width: 40px; height: 26px; border: 1px solid var(--ink-2); border-radius: 2px; font-family: var(--mono); font-size: 10px; letter-spacing: .04em; color: var(--ink-2); }
h1 { margin: 0; font-weight: 400; line-height: .92; letter-spacing: -.025em; }
h1 .line { display: block; font-size: clamp(56px, 11vw, 148px); }
h1 .sub { font-style: italic; color: var(--ink-2); font-size: clamp(34px, 6.2vw, 84px); letter-spacing: -.015em; margin-top: .12em; padding-left: .08em; }
.lede { max-width: 34ch; font-size: clamp(22px, 1.7vw + 12px, 32px); line-height: 1.32; margin: 48px 0 0; color: var(--ink); }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 56px 0 0; border-top: 1px solid var(--rule); }
.facts div { padding: 16px 16px 0 0; }
.facts div + div { padding-left: 16px; border-left: 1px solid var(--rule); }
.facts dt { margin-bottom: 4px; }
.facts dd { margin: 0; font-size: 1em; }

/* Chapters */
.chapter { padding: clamp(72px, 11vh, 128px) 0 0; }
.ch-head { display: grid; grid-template-columns: 120px 1fr auto; align-items: baseline; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--ink); margin-bottom: 8px; }
.num { font-family: var(--mono); font-size: 13px; color: var(--seal); }
.ch-head h2 { margin: 0; font-weight: 400; font-size: clamp(40px, 5vw, 64px); line-height: 1; letter-spacing: -.02em; }
.ch-note { margin: 0; text-align: right; }

/* Now feature */
.feature { display: grid; grid-template-columns: 1fr 280px; gap: clamp(32px, 6vw, 88px); padding: 40px 0 0 136px; }
.eyebrow { margin: 0 0 10px; color: var(--seal); }
.feature h3 { margin: 0 0 20px; font-weight: 500; font-size: clamp(30px, 3vw, 42px); line-height: 1.1; letter-spacing: -.01em; }
.feature h3 a { text-decoration: none; }
.feature p { margin: 0 0 16px; max-width: 58ch; color: var(--ink-2); }
.feature p b { color: var(--ink); }
.feature-side { border-left: 1px solid var(--rule); padding-left: 28px; display: flex; flex-direction: column; gap: 26px; }
.stat b { display: block; font-weight: 400; font-size: 40px; line-height: 1; letter-spacing: -.02em; margin-bottom: 6px; }
.tally { display: grid; grid-template-columns: 136px 1fr; margin-top: 64px; padding-top: 22px; border-top: 1px solid var(--rule); }
.tally-head { margin: 4px 0 0; color: var(--seal); }
.tally ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.tally li { display: flex; flex-direction: column; gap: 8px; padding: 0 20px; }
.tally li:first-child { padding-left: 0; }
.tally li + li { border-left: 1px solid var(--rule); }
.tally b { font-weight: 400; font-size: clamp(38px, 4.4vw, 60px); line-height: 1; letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums; }

/* Logos */
.ico { width: 28px; height: 28px; border-radius: 6px; vertical-align: -3px; margin-right: 12px; box-shadow: 0 0 0 1px var(--rule); }
.ico-lg { width: 44px; height: 44px; border-radius: 50%; margin: 0 0 16px; display: block; box-shadow: none; }
.wordmark { display: block; height: 42px; width: auto; margin: 6px 0 14px; mix-blend-mode: multiply; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.entry { display: grid; grid-template-columns: 136px 1fr; gap: 0; padding: 36px 0; border-bottom: 1px solid var(--rule); position: relative; }
.entry:last-child { border-bottom: 0; }
.when { color: var(--ink); line-height: 1.5; padding-top: 10px; }
.when small { font-size: 1em; color: var(--ink-3); }
.what h3 { margin: 0 0 4px; font-weight: 500; font-size: clamp(26px, 2.3vw, 34px); line-height: 1.15; letter-spacing: -.01em; }
.where { font-style: italic; font-weight: 400; color: var(--ink-3); font-size: .72em; margin-left: 8px; }
.role { margin: 0 0 14px; line-height: 1.6; }
.what p { margin: 0 0 12px; max-width: 62ch; color: var(--ink-2); }
.what p b { color: var(--ink); }
.what ul { margin: 0 0 12px; padding: 0; list-style: none; max-width: 62ch; color: var(--ink-2); }
.what li { position: relative; padding-left: 26px; margin: 0 0 10px; }
.what li::before { content: "§"; position: absolute; left: 0; color: var(--seal); font-size: .9em; }
.thesis { font-size: clamp(21px, 1.4vw + 10px, 26px); line-height: 1.3; color: var(--ink) !important; margin: 4px 0 14px !important; }
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); margin: 22px 0 18px; border-top: 1px solid var(--rule); }
.pillars > div { padding: 18px 20px 0; }
.pillars > div:first-child { padding-left: 0; }
.pillars > div + div { border-left: 1px solid var(--rule); }
.p-stat { display: block; font-size: 44px; line-height: 1; letter-spacing: -.02em; color: var(--seal); margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.pillars h4 { margin: 0 0 8px; font-weight: 500; font-size: 21px; line-height: 1.2; }
.pillars p { font-size: .92em; line-height: 1.5; margin: 0; }
.links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 6px !important; }
.links a { font-family: var(--mono); font-size: 13px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--ink); padding-bottom: 1px; }
.links a:hover { border-color: var(--seal); }

/* Works */
.works { list-style: none; margin: 0; padding: 0; counter-reset: w; }
.work {
  display: grid; grid-template-columns: 136px 290px minmax(0, 1fr) auto; column-gap: 40px; grid-template-areas: "no name desc url" "no name tags url";
  row-gap: 6px; align-items: baseline;
  padding: 30px 0; border-bottom: 1px solid var(--rule); text-decoration: none; position: relative; isolation: isolate;
}
.work::before { content: ""; position: absolute; inset: 0 calc(var(--gutter) * -0.5); background: var(--paper-2); z-index: -1; transform: scaleY(0); transform-origin: bottom; transition: transform .45s cubic-bezier(.2,.7,.1,1); }
.work:hover::before { transform: scaleY(1); }
.work:hover { color: var(--ink); }
.w-logo { grid-area: no; align-self: center; display: flex; align-items: center; }
.w-logo img { width: 52px; height: 52px; border-radius: 12px; box-shadow: 0 0 0 1px var(--rule); background: #fff; transition: transform .45s cubic-bezier(.2,.7,.1,1); }
.w-logo.wide img { width: 124px; height: 40px; border-radius: 0; box-shadow: none; background: none; object-fit: contain; object-position: left center;  mix-blend-mode: multiply; }
.work:hover .w-logo img { transform: rotate(-4deg) scale(1.06); }
.w-name { grid-area: name; white-space: nowrap; font-size: clamp(28px, 2.8vw, 40px); line-height: 1; letter-spacing: -.02em; transition: transform .45s cubic-bezier(.2,.7,.1,1), font-style .2s; }
.work:hover .w-name { transform: translateX(10px); font-style: italic; }
.w-desc { grid-area: desc; color: var(--ink-2); font-size: .95em; line-height: 1.4; }
.w-tags { grid-area: tags; }
.w-url { grid-area: url; font-family: var(--mono); font-size: 13px; white-space: nowrap; align-self: center; text-align: right; }
.work:hover .w-url { color: var(--seal); }
.work:hover .arr { transform: translate(3px, -3px); }

/* Education */
.schools { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-left: 136px; }
.school { padding: 36px 32px 36px 0; border-bottom: 1px solid var(--rule); }
.school:nth-child(even) { padding-left: 32px; padding-right: 0; border-left: 1px solid var(--rule); }
.s-when { margin: 0 0 10px; color: var(--seal); }
.school h3 { margin: 0; font-weight: 500; font-size: clamp(24px, 2vw, 30px); line-height: 1.15; letter-spacing: -.01em; }
.s-where { margin: 6px 0 14px; }
.school p:last-child { margin: 0; color: var(--ink-2); max-width: 46ch; }
.tongues { display: grid; grid-template-columns: repeat(4, 1fr); margin: 48px 0 0 136px; border-top: 1px solid var(--ink); }
.tongues span { padding: 18px 0 0; display: flex; flex-direction: column; gap: 4px; }
.tongues b { font-weight: 400; font-size: clamp(28px, 3vw, 40px); line-height: 1.05; letter-spacing: -.01em; }
.tongues .zh { font-weight: 600; font-size: clamp(26px, 2.7vw, 36px); color: var(--seal); }

/* Education row */
.edu-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.edu-row li { padding: 36px 28px 8px; border-left: 1px solid var(--rule); display: flex; flex-direction: column; }
.edu-row li:first-child { border-left: 0; padding-left: 0; }
.edu-row li:last-child { padding-right: 0; }
.edu-logo { height: 40px; display: flex; align-items: center; margin-bottom: 28px; }
.edu-logo img { max-height: 36px; max-width: 150px; width: auto; height: auto; }
.edu-logo img.lfjm { max-height: 48px; }
.edu-logo img.flag { height: 30px; max-height: 30px; box-shadow: 0 0 0 1px var(--rule); }
.edu-when { margin: 0 0 8px; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--seal); }
.edu-row h3 { margin: 0 0 10px; font-weight: 500; font-size: clamp(22px, 1.8vw, 27px); line-height: 1.15; letter-spacing: -.01em; }
.edu-what { margin: 0 0 16px; color: var(--ink-2); font-size: .92em; line-height: 1.45; }
.edu-where { margin: auto 0 0; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

/* Contact */
.contact { padding-bottom: clamp(80px, 14vh, 160px); }
.big { margin: 48px 0 0 136px; font-size: clamp(34px, 6vw, 88px); line-height: 1; letter-spacing: -.03em; word-break: break-word; }
.big a { text-decoration: none; background-image: linear-gradient(var(--seal), var(--seal)); background-size: 0 2px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .5s cubic-bezier(.2,.7,.1,1), color .2s; padding-bottom: 4px; }
.big a:hover { background-size: 100% 2px; }
.contact-links { margin: 36px 0 0 136px; display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: center; }
.contact-links a { font-family: var(--mono); font-size: 14px; text-decoration: none; border-bottom: 1px solid var(--ink); }
.copy { appearance: none; background: none; border: 1px solid var(--ink); border-radius: 2px; padding: 8px 14px; cursor: pointer; color: var(--ink); transition: background .2s, color .2s; }
.copy:hover { background: var(--ink); color: var(--paper); }
.copy.done { background: var(--seal); border-color: var(--seal); color: var(--paper); }

.colophon { width: calc(min(var(--measure), 100%) - 2 * var(--gutter)); margin: 0 auto; padding: 22px 0 40px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--ink); }

/* Reveal */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .9s cubic-bezier(.2,.7,.1,1), transform .9s cubic-bezier(.2,.7,.1,1); }
.js .reveal.in { opacity: 1; transform: none; }
.js h1 .line { clip-path: inset(0 0 100% 0); transform: translateY(30%); transition: clip-path 1.1s cubic-bezier(.2,.7,.1,1), transform 1.1s cubic-bezier(.2,.7,.1,1); }
.js h1.in .line { clip-path: inset(-10% 0 -20% 0); transform: none; }
.js h1.in .sub { transition-delay: .12s; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal, .js h1 .line { opacity: 1; transform: none; clip-path: none; transition: none; }
  .dot { animation: none; }
}

/* Tablet */
@media (max-width: 960px) {
  .clock { display: none; }
  .ch-head { grid-template-columns: 56px 1fr; }
  .ch-note { grid-column: 2; text-align: left; }
  .feature { grid-template-columns: 1fr; padding-left: 0; }
  .tally { grid-template-columns: 1fr; gap: 18px; }
  .hero-top { grid-template-columns: 1fr 200px; gap: 32px; }
  .edu-row { grid-template-columns: 1fr 1fr; }
  .edu-row li:nth-child(3) { border-left: 0; padding-left: 0; }
  .edu-row li:nth-child(2) { padding-right: 0; }
  .feature-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 24px; flex-direction: row; flex-wrap: wrap; gap: 24px 40px; }
  .entry { grid-template-columns: 96px 1fr; }
  .pillars { grid-template-columns: 1fr; }
  .pillars > div, .pillars > div:first-child { padding: 16px 0; }
  .pillars > div + div { border-left: 0; border-top: 1px solid var(--rule); }
  .w-name { white-space: normal; }
  .work { grid-template-columns: 56px 1fr auto; grid-template-areas: "no name url" "no desc desc" "no tags tags"; }
  .schools, .tongues, .big, .contact-links { margin-left: 0; }
}

/* Phone */
@media (max-width: 640px) {
  html { scroll-padding-top: 72px; }
  .masthead { padding: 12px 16px; }
  .index { gap: 14px; }
  .index a i { display: none; }
  .index a { font-size: 11px; }
  .index a[href="#school"] { display: none; }
  .facts { grid-template-columns: 1fr 1fr; }
  .hero-top { grid-template-columns: 1fr; }
  .portrait { width: 160px; grid-row: 1; }
  .facts div:nth-child(3) { padding-left: 0; border-left: 0; }
    .ch-head { grid-template-columns: 1fr; gap: 6px; }
  .ch-note { grid-column: 1; }
  .entry { grid-template-columns: 1fr; gap: 6px; padding: 28px 0; }
  .when { padding-top: 0; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; }
  .when br { display: none; }
  .when small::before { content: " "; }
  .work { grid-template-columns: 1fr; grid-template-areas: "no" "name" "desc" "tags" "url"; row-gap: 8px; }
  .w-url { align-self: start; text-align: left; }
  .schools { grid-template-columns: 1fr; }
  .school, .school:nth-child(even) { padding: 28px 0; border-left: 0; }
  .tongues { grid-template-columns: 1fr 1fr; gap: 8px 0; }
  .edu-row { grid-template-columns: 1fr; }
  .tally ol { grid-template-columns: 1fr; }
  .tally li, .tally li + li { padding: 16px 0; border-left: 0; border-bottom: 1px solid var(--rule); }
  .tally li:first-child { padding-top: 0; }
  .tally li:last-child { border-bottom: 0; padding-bottom: 0; }
  .edu-row li, .edu-row li:nth-child(n) { border-left: 0; padding: 28px 0; border-bottom: 1px solid var(--rule); }
}

@media print {
  .grain, .masthead, .copy { display: none; }
  body { background: #fff; font-size: 11pt; }
  .js .reveal, .js h1 .line { opacity: 1; transform: none; clip-path: none; }
  .chapter { break-inside: avoid-page; }
}
