
:root {
  /* paper, ink, and one red pen */
  --paper: #ffffff;
  --paper-deep: #f4f4f4;
  --ink: #1c1b19;
  --ink-soft: #4a4740;
  --muted: #7a756b;
  --rule: #e3e3e3;
  --pen: #c8432b;
  --pen-soft: rgba(200, 67, 43, 0.12);
  --contour: #b9b1a1;

  --serif: Georgia, "Noto Serif", "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --code: "SFMono-Regular", Menlo, Consolas, monospace;

  --text-sm: 0.8125rem;
  --text-base: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --text-lede: clamp(1.375rem, 1.15rem + 0.9vw, 1.75rem);
  --text-name: clamp(2.5rem, 1.8rem + 3vw, 4rem);

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --label-col: 9.5rem;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--text-base)/1.6 var(--serif);
  text-rendering: optimizeLegibility;
}
::selection { background: var(--pen-soft); }

a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 0.2em; text-decoration-thickness: 1px; transition: text-decoration-color 160ms, color 160ms; }
a:hover { text-decoration-color: var(--pen); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--pen); outline-offset: 3px; border-radius: 2px; }

.skip-link { position: absolute; left: -999px; top: 0.5rem; background: var(--ink); color: var(--paper); padding: 0.4rem 0.8rem; font: var(--text-sm) var(--serif); }
.skip-link:focus { left: 0.5rem; z-index: 10; }

.page { width: min(1120px, 100% - 2 * var(--gutter)); margin-inline: auto; }

/* masthead */
.masthead { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid transparent; transition: border-color 200ms; }
.masthead.scrolled { border-bottom-color: var(--rule); }
.masthead-inner { display: flex; justify-content: flex-end; align-items: center; height: 3.5rem; font: 400 var(--text-sm) var(--serif); }
.masthead-nav { display: flex; gap: clamp(0.9rem, 2.5vw, 2rem); align-items: center; }
.masthead-nav a { text-decoration: none; color: var(--ink-soft); }
.masthead-nav a:hover { color: var(--ink); }

/* intro */
.intro { display: grid; grid-template-columns: 20rem minmax(0, 1fr); gap: clamp(1.5rem, 3vw, 2.5rem); align-items: end; padding-block: clamp(1.75rem, 4vw, 3rem) clamp(1.75rem, 3.5vw, 2.5rem); }
.meta { font: 400 var(--text-sm)/1.4 var(--serif); color: var(--muted); letter-spacing: 0.02em; margin: 0 0 1.25rem; }
h1 { font-size: var(--text-name); font-weight: 400; line-height: 0.95; letter-spacing: -0.01em; margin: 0 0 1.1rem; }
.body { color: var(--ink-soft); max-width: 62ch; margin: 0 0 1.1rem; }
.links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; font: 400 var(--text-sm) var(--serif); }

/* sections */
.section { display: grid; grid-template-columns: var(--label-col) minmax(0, 1fr); gap: 2rem; padding-block: clamp(1.5rem, 3vw, 2.25rem); border-top: 1px solid var(--rule); }
.label { font: 400 clamp(1.5rem, 1.25rem + 0.8vw, 1.875rem)/1.2 var(--serif); letter-spacing: -0.012em; margin: 0; position: sticky; top: 5rem; align-self: start; }

/* publications */
.pub { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 1.5rem; padding: 0.8rem 0; border-bottom: 1px solid var(--rule); position: relative; }
.pub::before { content: ""; position: absolute; left: -1rem; top: 1.45rem; width: 0.45rem; height: 1px; background: var(--pen); transform: scaleX(0); transform-origin: left; transition: transform 220ms var(--ease); }
.pub:hover::before, .pub:focus-within::before { transform: scaleX(1); }
.pub-venue { font: 700 var(--text-sm)/1.5 var(--serif); margin: 0.25rem 0 0; }
.pub-venue > p { margin: 0; }
.pub-venue span { display: block; font-weight: 400; color: var(--muted); }
.pub h4 { font-size: 1.125rem; font-weight: 700; line-height: 1.35; margin: 0 0 0.3rem; }
.pub h4 a { text-decoration: none; }
.pub h4 a:hover { text-decoration: underline; text-decoration-color: var(--pen); }
.authors { margin: 0; color: var(--ink-soft); font-size: 0.98rem; }
.authors b { font-weight: 700; color: var(--ink); box-shadow: inset 0 -0.38em 0 var(--pen-soft); }
.pub-links { margin: 0.4rem 0 0; font: 400 var(--text-sm) var(--serif); display: flex; gap: 1rem; }
.pub-links a { color: var(--muted); }
.pub-links a:hover { color: var(--ink); }




@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr; align-items: start; }
  .portrait { max-width: 16rem; }
}
@media (max-width: 680px) {
  .section { grid-template-columns: 1fr; gap: 1.25rem; }
  .label { position: static; }
  .pub { grid-template-columns: 1fr; gap: 0.25rem; }
  .pub::before { display: none; }
  .pub-venue span { display: inline; margin-left: 0.5em; }
  .masthead-nav a:not(:last-of-type) { display: none; }
}
.sentinel { position: absolute; top: 0; height: 1px; width: 1px; }
.pair { white-space: nowrap; }
.pair:has(.tool-plain) { white-space: normal; }

/* research threads */
.threads { display: grid; gap: 0; }
.thread { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; padding: 0 0 1.5rem; }
.thread + .thread { padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.thread h3 { font-size: 1.2rem; font-weight: 700; line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.012em; }
.thread > div > p { margin: 0 0 0.5rem; color: var(--ink-soft); max-width: 62ch; font-size: 1.0625rem; }

/* publications */
.year { font: 400 var(--text-sm) var(--serif); letter-spacing: 0.04em; color: var(--muted); margin: 1.4rem 0 0; padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule); }
.pub-list > .year:first-child { margin-top: 0; }
.pub-full { font-style: italic; color: var(--muted); font-size: 0.95rem; margin: 0.15rem 0 0; }
.pub-links { align-items: baseline; flex-wrap: wrap; }
.pub-links button { font: inherit; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 0.2em; }
.pub-links button:hover { color: var(--ink); text-decoration-color: var(--pen); }
.pub-links button[aria-expanded="true"] { color: var(--pen); }
.bibtex { margin: 0.75rem 0 0.25rem; padding: 0.9rem 1rem; background: var(--paper-deep); font: 400 0.78rem/1.55 var(--code); overflow-x: auto; white-space: pre; }

@media (max-width: 900px) {
}
@media (max-width: 680px) {
  .thread { grid-template-columns: 1fr; gap: 0.25rem; }
  }

/* portrait */
.portrait { position: relative; margin: 0; justify-self: start; order: -1; width: 100%; aspect-ratio: 2010 / 2289; background: var(--paper-deep); }
.portrait::after { content: ""; position: absolute; inset: 0.75rem -0.75rem -0.75rem 0.75rem; border: 1px solid var(--rule); z-index: -1; }
.portrait img { display: block; width: 100%; height: 100%; object-fit: cover; filter: saturate(0.9) contrast(1.02); }
.portrait-empty { display: none; position: absolute; inset: 0; place-content: center; text-align: center; font: 400 var(--text-sm)/1.6 var(--serif); color: var(--muted); border: 1px dashed var(--contour); }
.portrait.is-empty img { display: none; }
.portrait.is-empty .portrait-empty { display: grid; }
.intro { align-items: center; }

/* ranks */
.ranks { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.35rem 0 0 !important; }
.rank { font: 400 0.6875rem/1 var(--serif); letter-spacing: 0.02em; padding: 0.22rem 0.35rem; border: 1px solid currentColor; white-space: nowrap; }
.pub-venue .ranks .rank { color: var(--ink); font-weight: 400; border-color: var(--ink); }


/* intro bio directions */
.body em { font-style: italic; color: var(--ink); }

.pub-note { font: 400 var(--text-sm) var(--serif); color: var(--muted); margin: 0 0 1.75rem; }

/* news */
.news { list-style: none; margin: 0; padding: 0; max-width: none; font-size: 1rem; }
.news li { padding: 0.2rem 0; line-height: 1.5; }
.news li:first-child time { color: var(--pen); }
.news time { font: 700 var(--text-sm) var(--serif); color: var(--ink); margin-right: 0.35rem; white-space: nowrap; }

/* links between pages */
.more { margin: 1rem 0 0; font: 400 var(--text-sm) var(--serif); }
.more a { text-decoration: none; border-bottom: 1px solid var(--ink); padding-bottom: 0.15rem; transition: color 160ms, border-color 160ms; }
.more a:hover { color: var(--pen); border-color: var(--pen); }
.masthead-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--pen); text-underline-offset: 0.45em; }

/* publications page */
.pubs-page { padding-block: clamp(1.75rem, 4vw, 3rem) clamp(2rem, 4vw, 3rem); }
.pubs-page-head { margin-bottom: clamp(1.25rem, 3vw, 2rem); max-width: 46rem; }
.pubs-page-head .meta a { text-decoration: none; }
.pubs-page-head h1 { margin-bottom: 1.25rem; }
.pubs-page-head .body { margin: 0; }

@media (max-width: 680px) {
  .masthead-nav a:not(:last-of-type) { display: inline; }
}

/* thread paper lists */
.thread-papers { list-style: none; margin: 1.5rem 0 0; padding: 0; max-width: 62ch; border-top: 1px solid var(--rule); }
.thread-papers li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--rule); font-size: 0.98rem; line-height: 1.45; }
.tp-tag { font: 700 0.75rem/1.9 var(--serif); color: var(--ink); white-space: nowrap; }
.is-preprint .tp-tag { color: var(--muted); font-weight: 400; }
.thread-papers a { text-decoration: none; font-weight: 700; }
.tp-summary { margin: 0.2rem 0 0; color: var(--ink-soft); font-size: 0.95rem; }
.thread-papers a:hover { text-decoration: underline; text-decoration-color: var(--pen); }
@media (max-width: 680px) { .thread-papers li { grid-template-columns: 1fr; gap: 0; } }

/* name affiliation */
h1 .at { font: 400 0.32em/1 var(--serif); letter-spacing: 0; color: var(--pen); margin-left: 0.35em; vertical-align: 0.15em; }

/* summaries, output parts */
.pub-summary { margin: 0.1rem 0 0.45rem; color: var(--ink-soft); max-width: 68ch; font-size: 1rem; line-height: 1.5; }
.output-part + .output-part { margin-top: clamp(2rem, 4vw, 3rem); }
.part-h { display: flex; align-items: baseline; gap: 0.6rem; font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem); font-weight: 400; letter-spacing: -0.015em; margin: 0 0 1.25rem; }
.part-h .count { font: 400 var(--text-sm) var(--serif); color: var(--muted); }
.papers-h { font: 400 var(--text-sm) var(--serif); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 1rem 0 0.35rem; }
.papers-h + .thread-papers { margin-top: 0; }

/* full-width section (label above content) */
.section-wide { grid-template-columns: 1fr; gap: 0.75rem; }
.section-wide .label { position: static; }
.section-wide .thread > div > p, .section-wide .thread-papers { max-width: none; }
.section-wide .thread { grid-template-columns: minmax(0, 1fr); }
.section-wide .pub-summary { max-width: none; }

/* collapsible sections */
.fold > summary { display: flex; align-items: center; gap: 0.9rem; cursor: pointer; list-style: none; width: fit-content; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary .label { position: static; }
.fold-icon { position: relative; width: 1.6rem; height: 1.6rem; border: 1px solid var(--rule); border-radius: 50%; flex: none; transition: border-color 160ms, background 160ms; }
.fold-icon::before, .fold-icon::after { content: ""; position: absolute; left: 50%; top: 50%; width: 0.6rem; height: 1px; background: var(--ink); transform: translate(-50%, -50%); transition: transform 220ms var(--ease); }
.fold-icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.fold[open] .fold-icon::after { transform: translate(-50%, -50%) rotate(0deg); }
.fold > summary:hover .fold-icon { border-color: var(--ink); }
.fold > summary:hover .label { color: var(--pen); }
.fold > summary:focus-visible { outline: 2px solid var(--pen); outline-offset: 4px; }
.fold-body > :first-child { margin-top: 0.75rem; }
