/* jianxu.net: HON notation as identity.
   Layout: left-aligned 12-column page, cool paper ground, figures kept on white plates.
   Color comes from the Science Advances HON figure: teal and orange are the two histories,
   purple is the conditioned node. Everything else is ink and grey. */

@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/source-serif-4-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/source-serif-4-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/source-serif-4-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/source-sans-3-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/source-sans-3-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/source-sans-3-latin-600-normal.woff2") format("woff2"); }

:root {
  --paper: #F3F5F4;
  --ink: #1F2626;
  --muted: #59625F;
  --rule: #D5DBD8;
  --plate: #FFFFFF;
  --plate-ink: #4B5553;
  --teal: #006B65;
  --orange: #A94320;
  --purple: #5E3D8F;
  --node: #77817F;
  --tint: #E6ECEA;
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.2rem;
  --step-4: clamp(2.6rem, 6vw, 4.1rem);
  --measure: 38rem;
  --page: 70rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141A1A; --ink: #E7EBE7; --muted: #A1ACA8; --rule: #2C3634; --plate: #FFFFFF;
    --teal: #6FD3C6; --orange: #F5A27A; --purple: #C3A9F2; --node: #8F9A97; --tint: #1C2524;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141A1A; --ink: #E7EBE7; --muted: #A1ACA8; --rule: #2C3634; --plate: #FFFFFF;
  --teal: #6FD3C6; --orange: #F5A27A; --purple: #C3A9F2; --node: #8F9A97; --tint: #1C2524;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--sans);
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--tint); }

.wrap {
  max-width: var(--page); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 720px) { .wrap { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); } }

/* top bar */
.topbar { padding-block: 18px; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.mark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 var(--step--1)/1 var(--sans); letter-spacing: 0.04em; }
.mark svg { width: 26px; height: 26px; }
.topnav { display: flex; gap: 20px; flex-wrap: wrap; font-size: var(--step--1); }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--ink); }

/* type */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: var(--step-4); letter-spacing: -0.01em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }
p { margin: 0; }
.prose { max-width: var(--measure); display: grid; gap: 1em; }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); }
.hon { font-family: var(--sans); font-style: italic; white-space: nowrap; }
.hon .c { color: var(--purple); }
.hon .t { color: var(--teal); }
.hon .o { color: var(--orange); }

/* sections */
section { padding-block: clamp(48px, 8vw, 88px); border-top: 1px solid var(--rule); }
section.hero { border-top: 0; padding-block: clamp(24px, 5vw, 56px) clamp(40px, 6vw, 72px); }
.sec-head { display: flex; align-items: center; gap: 14px; margin-bottom: clamp(24px, 4vw, 40px); }
.sec-head svg { width: 34px; height: 34px; flex: none; }
.glyph { fill: none; stroke: var(--ink); stroke-width: 2.2; }
symbol .accent { stroke: var(--teal); }
symbol .ge { stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
symbol .ge.t { stroke: var(--teal); } symbol .ge.o { stroke: var(--orange); }
symbol .gn { stroke: none; } symbol .gn.t { fill: var(--teal); } symbol .gn.o { fill: var(--orange); } symbol .gn.g { fill: var(--node); }
symbol .cond { stroke: var(--purple); stroke-dasharray: 3 2.5; stroke-width: 1.5; }

/* hero */
.hero-grid { display: grid; gap: clamp(28px, 5vw, 64px); align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 7fr 5fr; } }
.hero-text { display: grid; gap: 18px; min-width: 0; }
.name-zh { font-family: var(--sans); font-weight: 400; font-size: 0.42em; color: var(--muted); letter-spacing: 0.08em; margin-left: 0.35em; vertical-align: 0.3em; }
.role { font-size: var(--step-1); line-height: 1.45; max-width: 34rem; }
.role-sub { font-family: var(--serif); font-style: italic; font-size: var(--step-1); color: var(--muted); margin-top: -6px; }
.tagline { font-family: var(--serif); font-style: italic; font-size: var(--step-2); color: var(--ink); }
.tagline em { color: var(--purple); }
.links { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: var(--step--1); }

.hon-figure { margin: 0; display: grid; gap: 12px; min-width: 0; }
.hon-figure svg { width: 100%; height: auto; max-width: 30rem; }
.hon-figure figcaption { font-size: var(--step--1); color: var(--muted); max-width: 30rem; }
.toggle { justify-self: start; font: 600 var(--step--1)/1 var(--sans); color: var(--ink); background: transparent; border: 1px solid var(--rule); border-radius: 999px; padding: 10px 16px; min-height: 40px; cursor: pointer; }
.toggle:hover { border-color: var(--purple); }

/* HON diagram */
.dg .nd { fill: var(--paper); stroke-width: 4; }
.dg .nd.t { stroke: var(--teal); } .dg .nd.o { stroke: var(--orange); } .dg .nd.g { stroke: var(--node); } .dg .nd.p { stroke: var(--purple); }
.dg .e { stroke-linecap: round; fill: none; }
.dg .e.t { stroke: var(--teal); } .dg .e.o { stroke: var(--orange); } .dg .e.g { stroke: var(--node); } .dg .e.p { stroke: var(--purple); }
.dg .box { fill: none; stroke: var(--purple); stroke-width: 1.6; stroke-dasharray: 5 4; }
.dg text { font: italic 15px var(--sans); fill: var(--ink); }
.dg text.lbl-g { font-style: normal; fill: var(--muted); }
.dg .ft { fill: var(--teal); } .dg .fo { fill: var(--orange); } .dg .fp { fill: var(--purple); }
.dg .layer { transition: opacity .45s ease; }
.dg .split-node { transition: transform .55s cubic-bezier(.4,0,.2,1), opacity .45s ease; }
.dg .first { opacity: 0; }
.dg.is-first .second { opacity: 0; }
.dg.is-first .first { opacity: 1; }
.dg.is-first .sn-top { transform: translateY(38px); opacity: 0; }
.dg.is-first .sn-bot { transform: translateY(-38px); opacity: 0; }
@media (prefers-reduced-motion: reduce) { .dg .layer, .dg .split-node { transition: none; } }

/* desk band */
.desk { margin: 0; }
.desk img { width: 100%; aspect-ratio: 16 / 6; object-fit: cover; object-position: 50% 58%; border-radius: 2px; }
.desk figcaption { margin-top: 10px; font-size: var(--step--1); color: var(--muted); }

/* current work */
.two { display: grid; gap: clamp(28px, 5vw, 64px); }
@media (min-width: 900px) { .two { grid-template-columns: 7fr 5fr; } }
.two > * { min-width: 0; }
.chain { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.chain > li { position: relative; padding: 0 0 26px 40px; }
.chain > li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 14px; height: 14px; border: 3px solid var(--node); border-radius: 50%; background: var(--paper); z-index: 1; }
.chain > li::after { content: ""; position: absolute; left: 14px; top: 26px; bottom: 2px; width: 2px; background: var(--node); }
.chain > li:last-child { padding-bottom: 0; }
.chain > li:last-child::after { display: none; }
.chain > li.now::before { border-color: var(--teal); }
.chain .place { font-weight: 600; }
.chain .when { color: var(--muted); font-size: var(--step--1); font-variant-numeric: tabular-nums; }
.chain .now-box { margin-top: 8px; display: inline-block; border: 1.5px dashed var(--purple); border-radius: 3px; padding: 6px 10px; font-size: var(--step--1); }
.chain ul { margin: 6px 0 0; padding: 0; list-style: none; font-size: var(--step--1); color: var(--muted); }
.cta { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--rule); display: grid; gap: 8px; }
.cta .links { font-size: var(--step-0); }

/* three c's */
.cs { display: grid; gap: 28px; }
@media (min-width: 820px) { .cs { grid-template-columns: repeat(3, 1fr); gap: 40px; } }
.cs h3 { font-weight: 400; font-size: var(--step-2); }
.cs h3 b { font-weight: 600; color: var(--teal); }
.cs p { margin-top: 10px; color: var(--muted); }

/* research */
.works { display: grid; gap: clamp(40px, 6vw, 72px); }
.work { display: grid; gap: 20px 40px; align-items: start; }
@media (min-width: 900px) { .work { grid-template-columns: 5fr 7fr; } .work:nth-child(even) .plate { order: 2; } }
.work > * { min-width: 0; }
.plate { margin: 0; background: var(--plate); padding: 12px; border: 1px solid var(--rule); }
.plate figcaption { color: var(--plate-ink); font-size: var(--step--1); padding-top: 10px; }
.work .body { display: grid; gap: 12px; }
.work .eyebrow { display: flex; align-items: center; gap: 8px; font-size: var(--step--1); color: var(--muted); }
.work .eyebrow svg { width: 22px; height: 22px; }
.pubs { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; font-size: var(--step--1); }
.pubs .venue { color: var(--muted); }
.status { font-size: 0.78rem; letter-spacing: 0.04em; color: var(--muted); border: 1px solid var(--rule); border-radius: 3px; padding: 1px 6px; white-space: nowrap; }
.more { font-weight: 600; }
.index { margin-top: clamp(40px, 6vw, 64px); padding-top: 24px; border-top: 1px solid var(--rule); display: grid; gap: 14px; }
.index ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px 32px; }
@media (min-width: 760px) { .index ul { grid-template-columns: 1fr 1fr; } }
.index li { font-size: var(--step--1); }

/* community */
.service { display: grid; gap: 28px; }
@media (min-width: 820px) { .service { grid-template-columns: repeat(3, 1fr); gap: 40px; } }
.service h3 { font-family: var(--sans); font-size: var(--step--1); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.service ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.service .yr { color: var(--muted); font-variant-numeric: tabular-nums; }

/* making */
.making { display: grid; gap: clamp(36px, 6vw, 64px); }
.story { display: grid; gap: 20px 40px; align-items: start; }
@media (min-width: 900px) { .story { grid-template-columns: 6fr 6fr; } }
.story > * { min-width: 0; }
.photos { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.photos figure { margin: 0; }
.photos img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: 2px; }
.photos figcaption { font-size: var(--step--1); color: var(--muted); margin-top: 6px; }
.story h3 { margin-bottom: 4px; }
.zh { font-family: var(--sans); }

/* bio */
.bio { display: grid; gap: 28px 48px; }
@media (min-width: 900px) { .bio { grid-template-columns: 4fr 8fr; } }
.bio > * { min-width: 0; }
.headshot { margin: 0; max-width: 18rem; }
.headshot img { border-radius: 2px; }
.headshot figcaption { font-size: var(--step--1); color: var(--muted); margin-top: 8px; }
.pastebox { position: relative; background: var(--tint); border-radius: 3px; padding: 18px 18px 14px; display: grid; gap: 10px; max-width: var(--measure); }
.pastebox p { font-size: var(--step-0); }
.copy { justify-self: start; font: 600 var(--step--1)/1 var(--sans); background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: 999px; padding: 9px 14px; min-height: 36px; cursor: pointer; }
.facts { display: grid; gap: 6px; font-size: var(--step--1); margin-top: 8px; }
.contact { display: grid; gap: 6px; }
.contact .addr { font-family: var(--sans); font-weight: 600; user-select: all; }

footer { border-top: 1px solid var(--rule); padding-block: 28px 40px; font-size: var(--step--1); color: var(--muted); }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; }
footer svg { width: 22px; height: 22px; vertical-align: -5px; margin-right: 6px; }

/* work page */
.crumbs { font-size: var(--step--1); color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs .arr { color: var(--node); }
.paper-head { display: grid; gap: 16px; padding-block: clamp(24px, 5vw, 48px) 8px; }
.paper-head h1 { font-size: clamp(2rem, 4.6vw, 3.2rem); max-width: 22ch; }
.authors { font-size: var(--step-1); }
.authors b { font-weight: 600; }
.venue-line { color: var(--muted); }
.paper-grid { display: grid; gap: 40px 56px; padding-block: 24px 64px; }
@media (max-width: 959px) { .rail { order: -1; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); padding-bottom: 24px; border-bottom: 1px solid var(--rule); } }
@media (min-width: 960px) { .paper-grid { grid-template-columns: minmax(0, 1fr) 18rem; } .rail { position: sticky; top: 24px; align-self: start; } }
.paper-main { display: grid; gap: 40px; min-width: 0; }
.paper-main h2 { font-size: var(--step-2); margin-bottom: 12px; }
.rail { display: grid; gap: 24px; font-size: var(--step--1); min-width: 0; }
.rail h2 { font-family: var(--sans); font-size: var(--step--1); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.res { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.res li { display: grid; gap: 2px; }
.res .kind { color: var(--muted); font-size: 0.8rem; }
.idea { font-family: var(--serif); font-size: var(--step-1); line-height: 1.55; max-width: var(--measure); }
.figs { display: grid; gap: 24px; }
@media (min-width: 700px) { .figs { grid-template-columns: 1fr 1fr; } }
.figs .plate.wide { grid-column: 1 / -1; }
.lead-fig { max-width: 34rem; }
.lead-fig.wide { max-width: none; }
.bib { position: relative; background: var(--tint); border-radius: 3px; padding: 16px; display: grid; gap: 10px; min-width: 0; }
.bib pre { margin: 0; overflow-x: auto; font: 0.82rem/1.5 ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace; color: var(--ink); }
.related { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.related .venue { color: var(--muted); }

.paper-main h2.sub { font-size: var(--step-2); margin-bottom: 16px; }
.label { font-family: var(--sans); font-size: var(--step--1); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.preview-note { background: var(--tint); font-size: var(--step--1); color: var(--muted); padding-block: 8px; }
.preview-note .wrap { display: block; }

/* lists inside prose, CV button, footer tagline */
.prose ul.tight { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; }
.prose ul.tight li::marker { color: var(--teal); }
.btn { display: inline-flex; align-items: center; gap: 10px; font: 600 var(--step-0)/1 var(--sans); color: var(--paper); background: var(--teal); border: 1px solid var(--teal); border-radius: 999px; padding: 12px 22px; min-height: 44px; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn .muted-in { font-weight: 400; font-size: var(--step--1); opacity: .8; }
.foot-tag { font-family: var(--serif); font-style: italic; }
.foot-tag em { color: var(--purple); }

/* data tables on work pages */
.table-wrap { overflow-x: auto; margin: 4px 0 8px; }
table.data { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: var(--step--1); }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.related li { line-height: 1.5; }
