  :root {
    --bg:        #fbfaf7;
    --surface:   #f3f1eb;
    --text:      #23231f;
    --muted:     #6d6c64;
    --faint:     #a3a199;
    --rule:      #e2dfd6;
    --accent:    #1f5c4c;
    --accent-2:  #9a3b1f;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg:      #16171a;
      --surface: #1e2024;
      --text:    #e6e4de;
      --muted:   #9d9b93;
      --faint:   #6a6862;
      --rule:    #2e3136;
      --accent:  #7fc9ae;
      --accent-2:#e0906d;
    }
  }
  :root[data-theme="dark"] {
    --bg:#16171a; --surface:#1e2024; --text:#e6e4de; --muted:#9d9b93;
    --faint:#6a6862; --rule:#2e3136; --accent:#7fc9ae; --accent-2:#e0906d;
  }
  :root[data-theme="light"] {
    --bg:#fbfaf7; --surface:#f3f1eb; --text:#23231f; --muted:#6d6c64;
    --faint:#a3a199; --rule:#e2dfd6; --accent:#1f5c4c; --accent-2:#9a3b1f;
  }

  html { -webkit-text-size-adjust: 100%; }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: "Charter", "Bitstream Charter", "Iowan Old Style", "Source Serif 4", Georgia, serif;
    font-size: 17px;
    line-height: 1.65;
    margin: 0;
    padding: 0 24px 96px;
    -webkit-font-smoothing: antialiased;
  }
  .wrap { max-width: 1120px; margin: 0 auto; }

  /* ---- two-column shell: sticky identity rail + scrolling content ---- */
  .layout {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    gap: 0 60px;
    align-items: start;
  }
  .rail { position: sticky; top: 28px; }
  .rail-inner {
    padding-right: 26px;
    border-right: 1px solid var(--rule);
    min-height: 60vh;
  }
  main { min-width: 0; padding-top: 4px; }
  /* prose stays readable even though the column is wide */
  main p, .interests .desc, .edu .meta { max-width: 68ch; }

  @media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; gap: 0; }
    .rail { position: static; }
    .rail-inner { padding-right: 0; border-right: none; min-height: 0; }
  }

  a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
  a:hover { border-bottom-color: var(--accent); }

  /* ---- nav: a vertical index inside the rail ---- */
  nav {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 26px 0 0;
    font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, sans-serif;
    font-size: 14px; letter-spacing: .02em;
  }
  nav a {
    color: var(--muted); border: none; position: relative;
    padding: 2px 0 2px 15px;
  }
  nav a::before {
    content: ""; position: absolute; left: 0; top: 50%;
    width: 6px; height: 1px; background: var(--rule);
    transition: width .18s ease, background .18s ease;
  }
  nav a:hover { color: var(--accent); }
  nav a:hover::before { width: 10px; background: var(--accent); }
  nav .spacer { display: none; }
  nav #theme { margin-top: 14px; }
  @media (max-width: 900px) {
    nav { flex-direction: row; flex-wrap: wrap; gap: 4px 18px; align-items: center; }
    nav a { padding-left: 0; }
    nav a::before { display: none; }
    nav .spacer { display: block; flex: 1 1 auto; }
    nav #theme { margin-top: 0; }
  }
  #theme {
    background: none; border: 1px solid var(--rule); border-radius: 999px;
    color: var(--muted); cursor: pointer; font: inherit; padding: 3px 11px;
  }
  #theme:hover { color: var(--accent); border-color: var(--accent); }

  /* ---- decorative artwork ---- */
  /* Steiner minimal trees over a Delaunay scaffold. The geometry is real:
     Kruskal MST + Fermat-point insertion, so each solid dot meets its three
     edges at 120 degrees. Bleeds a little wider than the text column. */
  .banner {
    margin: 30px 0 34px;
    padding: 0;
    color: var(--accent);
    line-height: 0;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
            mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  }
  .banner svg { width: 100%; height: auto; display: block; }
  .art-hero { max-height: 200px; }
  .banner-foot {
    margin-top: 70px;
    opacity: .62;
    transform: scaleY(-1);
  }
  .art-foot { max-height: 118px; }
  @media (prefers-reduced-motion: no-preference) {
    .banner .tree, .banner .steiner { animation: draw 1.1s ease-out both; }
    .banner .scaffold, .banner .terminals { animation: fade 1.4s ease-out both; }
    @keyframes draw { from { opacity: 0; } }
    @keyframes fade { from { opacity: 0; } }
  }

  /* ---- identity block (lives in the rail) ---- */
  h1 {
    font-size: 31px; line-height: 1.12; font-weight: 600;
    letter-spacing: -.018em; margin: 0 0 4px;
  }
  h1 .zh {
    display: block; font-size: 17px; color: var(--faint);
    font-weight: 400; margin: 5px 0 0; letter-spacing: .12em;
  }
  .tagline { color: var(--muted); margin: 12px 0 16px; font-size: 15px; line-height: 1.5; }
  .badges {
    display: flex; flex-wrap: wrap; gap: 7px;
    font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, sans-serif;
    font-size: 13px;
  }
  .badges a {
    border: 1px solid var(--rule); border-radius: 3px;
    padding: 3px 10px; color: var(--muted); background: var(--surface);
  }
  .badges a:hover { color: var(--accent); border-color: var(--accent); }

  /* ---- sections ---- */
  section { margin-top: 52px; scroll-margin-top: 24px; }
  section:first-child { margin-top: 0; }
  h2 {
    font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, sans-serif;
    font-size: 12px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase;
    color: var(--faint); margin: 0 0 20px;
    padding-bottom: 8px; border-bottom: 1px solid var(--rule);
    display: flex; align-items: center; gap: 9px;
  }
  /* small accent tick before each section title */
  h2::before {
    content: ""; flex: none;
    width: 5px; height: 5px; border-radius: 1px;
    background: var(--accent); transform: rotate(45deg);
  }
  p { margin: 0 0 14px; }
  /* ---- research interests ---- */
  .interests { list-style: none; padding: 0; margin: 18px 0 20px; display: grid; gap: 10px; }
  @media (min-width: 1000px) {
    /* align-items:start so an expanded card does not stretch its neighbour */
    .interests { grid-template-columns: 1fr 1fr; align-items: start; }
  }
  .interests > li {
    display: flex; gap: 16px; align-items: flex-start;
    padding: 15px 17px;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
    border-radius: 5px;
    transition: border-left-color .18s ease, transform .18s ease;
  }
  .interests > li:hover { border-left-color: var(--accent); transform: translateX(3px); }
  .interests > li:has(details[open]) {
    border-left-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  }
  .interests .glyph {
    flex: none; width: 42px; height: 42px; color: var(--accent);
    margin-top: 1px;
  }
  .interests details { flex: 1 1 auto; min-width: 0; }
  .interests summary {
    cursor: pointer; list-style: none; position: relative;
    padding-right: 26px;
  }
  .interests summary::-webkit-details-marker { display: none; }
  /* chevron */
  .interests summary::after {
    content: ""; position: absolute; right: 4px; top: 7px;
    width: 7px; height: 7px;
    border-right: 1.6px solid var(--faint); border-bottom: 1.6px solid var(--faint);
    transform: rotate(45deg); transition: transform .2s ease, border-color .2s ease;
  }
  .interests details[open] summary::after {
    transform: rotate(-135deg); border-color: var(--accent);
  }
  .interests summary:hover::after { border-color: var(--accent); }
  .interests h3 {
    font-size: 16px; font-weight: 600; margin: 0 0 3px; letter-spacing: -.005em;
    display: inline-block;
  }
  .interests .desc {
    display: block; font-size: 15px; color: var(--muted); line-height: 1.55;
  }
  .interests .cue {
    display: inline-block; margin-top: 7px;
    font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, sans-serif;
    font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
    color: var(--faint);
  }
  .interests details[open] .cue { color: var(--accent); }

  /* expanded paper list */
  .interests .rel {
    list-style: none; margin: 12px 0 2px; padding: 12px 0 0;
    border-top: 1px dotted var(--rule);
    display: grid; gap: 9px;
    animation: reveal .22s ease-out;
  }
  @keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }
  .interests .rel li {
    display: flex; gap: 12px; align-items: baseline;
    font-size: 14.5px; line-height: 1.45;
  }
  .interests .rel li > :first-child { flex: 1 1 auto; }
  .interests .rel span { color: var(--muted); }
  .interests .rel em {
    flex: none; max-width: 120px; font-style: normal; text-align: right;
    font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, sans-serif;
    font-size: 11.5px; line-height: 1.35; color: var(--faint);
  }
  /* award / oral emphasis inside a venue badge */
  .interests .rel em b { display: block; font-weight: 600; color: var(--accent-2); }
  @media (prefers-reduced-motion: reduce) {
    .interests > li, .interests summary::after, .interests .rel { transition: none; animation: none; }
  }

  /* ---- education ---- */
  .edu { list-style: none; padding: 0; margin: 0; }
  .edu li { display: flex; gap: 18px; margin-bottom: 22px; }
  .edu li:last-child { margin-bottom: 0; }
  .edu .when {
    flex: none; width: 88px; text-align: right; padding-top: 4px;
    font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, sans-serif;
    font-size: 12px; line-height: 1.5; color: var(--muted);
  }
  .edu .when b { display: block; color: var(--text); font-weight: 600; }
  .edu .body { border-left: 1px solid var(--rule); padding-left: 18px; }
  .edu h3 { font-size: 16.5px; font-weight: 600; margin: 0 0 2px; }
  .edu .deg { font-size: 15px; margin-bottom: 2px; }
  .edu .meta { font-size: 14.5px; color: var(--muted); }

  /* ---- publications ---- */
  .pub { display: flex; gap: 18px; margin-bottom: 26px; }
  .pub .venue {
    flex: none; width: 88px; text-align: right; padding-top: 3px;
    font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, sans-serif;
    font-size: 12px; line-height: 1.5; color: var(--muted);
  }
  .pub .venue b { display: block; color: var(--text); font-weight: 600; }
  .pub .body { border-left: 1px solid var(--rule); padding-left: 18px; }
  .pub .title { font-weight: 600; display: block; margin-bottom: 3px; }
  .pub .authors { font-size: 14.5px; color: var(--muted); }
  .pub .authors b { color: var(--text); font-weight: 600; }
  .note {
    display: inline-block; margin-top: 5px;
    font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, sans-serif;
    font-size: 12px; letter-spacing: .02em; color: var(--accent-2);
    border: 1px solid color-mix(in srgb, var(--accent-2) 35%, transparent);
    border-radius: 3px; padding: 1px 7px;
  }
  .eq { font-size: 14px; color: var(--faint); margin-bottom: 22px; }

  /* ---- awards ---- */
  .awards { list-style: none; padding: 0; margin: 0; }
  @media (min-width: 1000px) {
    .awards { display: grid; grid-template-columns: 1fr 1fr; column-gap: 38px; }
    .awards li:nth-last-child(2) { border-bottom: none; }
  }
  .awards li {
    display: flex; gap: 16px; padding: 7px 0;
    border-bottom: 1px dotted var(--rule);
  }
  .awards li:last-child { border-bottom: none; }
  .awards .yr {
    flex: none; width: 44px; color: var(--faint);
    font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, sans-serif;
    font-size: 13px; padding-top: 3px;
  }
  .awards .what { font-size: 15.5px; }
  .awards .what small { color: var(--muted); }
  .hl { color: var(--accent-2); font-weight: 600; }

  footer {
    margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--rule);
    font-size: 14px; color: var(--faint);
    display: flex; flex-wrap: wrap; gap: 6px 18px;
  }
  footer a { color: var(--muted); }

  @media (max-width: 560px) {
    body { font-size: 16px; }
    header.hero { flex-direction: column; gap: 18px; }
    h1 { font-size: 28px; }
    .art-hero { max-height: 132px; }
    .art-foot { max-height: 84px; }
    .interests > li { gap: 12px; padding: 13px 14px; }
    .interests .glyph { width: 34px; height: 34px; }
    .interests .rel li { flex-direction: column; gap: 2px; }
    .interests .rel em { text-align: left; }
    .pub, .edu li { flex-direction: column; gap: 4px; }
    .pub .venue, .edu .when { width: auto; text-align: left; }
    .pub .venue b, .edu .when b { display: inline; }
    .pub .venue b::after, .edu .when b::after { content: " ·"; }
    .pub .body, .edu .body { border-left: none; padding-left: 0; }
  }
