/* Lemma: a typeset-paper portfolio for a computer scientist.
   Colour tokens: keep one link-blue and one highlighter; everything else is ink on white. */
:root {
  --paper: #ffffff;
  --ink: #14161b;
  --mute: #545a66;
  --faint: #8a909c;
  --rule: #d8dbe2;
  --rule-strong: #14161b;
  --blue: #1b3db4;
  --blue-deep: #122b85;
  --blue-wash: #edf1fc;
  --mark: #ffe37a;
  --mark-soft: #fff6cf;
  --serif: "STIX Two Text", "STIX Two", Cambria, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --wrap: 1220px;
  --gut: clamp(16px, 4vw, 44px);
  --measure: 66ch;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.55;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--blue-deep); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.12; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: 0.82em; font-variant-numeric: normal; }
em, i { font-style: italic; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gut); }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: #fff; padding: 10px 14px; }
.skip:focus { top: 12px; color: #fff; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sc { font-variant-caps: all-small-caps; letter-spacing: 0.06em; }
.var { font-style: italic; }
.tab { font-variant-numeric: lining-nums tabular-nums; }

/* ---------- header ---------- */
.site-head { border-bottom: 1px solid var(--rule); }
.head-in { display: flex; align-items: center; gap: 20px; min-height: 76px; }
.wordmark { display: flex; flex-direction: column; color: var(--ink); text-decoration: none; line-height: 1.1; margin-right: auto; padding: 6px 0; }
.wordmark:hover { color: var(--ink); }
.wordmark b { font-size: 1.32rem; font-weight: 600; letter-spacing: -0.01em; }
.wordmark span { font-size: 0.86rem; color: var(--mute); font-style: italic; }
.wordmark b::after { content: "\220E"; color: var(--blue); font-size: 0.7em; margin-left: 6px; vertical-align: 0.12em; transition: transform .3s; display: inline-block; }
.wordmark:hover b::after { transform: rotate(90deg); }
.nav summary { display: none; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.nav a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--ink); text-decoration: none; font-size: 1.02rem; position: relative; }
.nav a::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 8px; height: 1px; background: var(--blue); transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--blue); }
.btn, .cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; background: var(--blue); color: #fff; border: 1px solid var(--blue); border-radius: 2px; text-decoration: none; font-family: var(--serif); font-size: 1.02rem; font-weight: 600; cursor: pointer; transition: background .2s, transform .2s; }
.btn:hover, .cta:hover { background: var(--blue-deep); color: #fff; text-decoration: none; }
.btn:active, .cta:active { transform: translateY(1px); }
.btn:focus-visible, .cta:focus-visible { outline-color: var(--ink); }
.cta[aria-current="page"] { background: var(--ink); border-color: var(--ink); }
.btn-line { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-line:hover { background: var(--ink); color: #fff; }
.arrow { transition: transform .2s; display: inline-block; }
.btn:hover .arrow, .text-link:hover .arrow { transform: translateX(3px); }
.text-link { font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }

/* ---------- hero ---------- */
.hero { position: relative; padding-block: clamp(36px, 6vw, 80px) clamp(40px, 6vw, 72px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 4vw, 64px); align-items: start; }
.stamp { position: absolute; left: 4px; top: 50%; transform: translateY(-50%) rotate(-90deg); transform-origin: left center; translate: 0 0; font-family: var(--mono); font-size: 0.78rem; color: var(--faint); white-space: nowrap; letter-spacing: 0.02em; display: none; }
.kicker { font-size: 1rem; color: var(--mute); margin: 0 0 18px; font-style: italic; }
.hero h1 { font-size: clamp(2.35rem, 4.6vw, 3.9rem); line-height: 1.04; letter-spacing: -0.02em; margin-bottom: 22px; }
.hero h1 em { color: var(--blue); }
.authors { margin: 0 0 6px; font-size: 1.12rem; }
.authors sup { font-size: 0.62em; color: var(--blue); margin-left: 1px; }
.affils { font-size: 0.92rem; color: var(--mute); margin: 0 0 22px; line-height: 1.45; }
.affils sup { color: var(--blue); }
.abstract { border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule); padding: 16px 0 6px; margin-bottom: 22px; font-size: 1.04rem; hyphens: auto; text-align: justify; }
.abstract b { font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 0 0 16px; }
.keywords { font-size: 0.92rem; color: var(--mute); margin: 0; }
.keywords i { color: var(--ink); }

/* ---------- figure card ---------- */
.fig { margin: 0; }
.fig-frame { border: 1px solid var(--rule); background: #fff; position: relative; }
.fig-frame::before { content: ""; position: absolute; inset: 6px; border: 1px dashed transparent; pointer-events: none; }
.fig-svg { width: 100%; }
.fig-caption { font-size: 0.98rem; line-height: 1.45; margin-top: 12px; color: var(--ink); }
.fig-caption b, .cap b { font-weight: 600; }
.fig-caption .now { color: var(--mute); }
.fig-tools { display: flex; align-items: center; gap: 6px; padding: 8px; border-top: 1px solid var(--rule); background: #fafbfd; flex-wrap: wrap; }
.fig-tools[hidden] { display: none; }
.ibtn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 1px solid var(--rule); background: #fff; color: var(--ink); border-radius: 2px; cursor: pointer; transition: border-color .15s, background .15s, transform .1s; padding: 0; }
.ibtn:hover { border-color: var(--ink); }
.ibtn:active { transform: scale(.94); }
.ibtn svg { width: 18px; height: 18px; }
.ibtn.play { background: var(--blue); border-color: var(--blue); color: #fff; }
.ibtn.play:hover { background: var(--blue-deep); }
.ibtn.play .i-pause { display: none; }
.ibtn.play[aria-pressed="true"] .i-pause { display: block; }
.ibtn.play[aria-pressed="true"] .i-play { display: none; }
.scrub { flex: 1 1 60px; min-width: 60px; height: 44px; accent-color: var(--blue); margin: 0 6px; cursor: pointer; }
.stepno { font-family: var(--mono); font-size: 0.8rem; color: var(--mute); min-width: 7.5ch; white-space: nowrap; text-align: right; padding-right: 6px; font-variant-numeric: tabular-nums; }

/* graph */
.g-edge { stroke: #c3c8d3; stroke-width: 2; fill: none; transition: stroke .35s, stroke-width .35s; }
.g-edge.is-tent { stroke: var(--blue); stroke-width: 2; stroke-dasharray: 2 5; stroke-linecap: round; }
.g-edge.is-tree { stroke: var(--blue); stroke-width: 4; stroke-dasharray: none; }
.g-edge.is-relax { stroke: var(--ink); stroke-width: 4; stroke-dasharray: 9 6; animation: march .7s linear infinite; }
.g-edge.is-relax.is-fail { stroke: var(--faint); stroke-width: 3; }
@keyframes march { to { stroke-dashoffset: -30; } }
.g-w rect { fill: #fff; }
.g-w text { font-family: var(--mono); font-size: 13px; fill: var(--mute); text-anchor: middle; dominant-baseline: central; }
.g-w.is-on text { fill: var(--ink); font-weight: 700; }
.g-node circle { fill: #fff; stroke: var(--ink); stroke-width: 1.6; transition: fill .35s, stroke .35s, stroke-width .35s; }
.g-node .lbl { font-family: var(--serif); font-style: italic; font-size: 21px; fill: var(--ink); text-anchor: middle; dominant-baseline: central; transition: fill .35s; }
.g-node.is-frontier circle { stroke: var(--blue); stroke-width: 3; }
.g-node.is-settled circle { fill: var(--blue); stroke: var(--blue); }
.g-node.is-settled .lbl { fill: #fff; }
.g-node.is-current circle { fill: var(--mark); stroke: var(--ink); stroke-width: 3; }
.g-node.is-current .lbl { fill: var(--ink); }
.g-halo { fill: none; stroke: var(--mark); stroke-width: 10; opacity: 0; transition: opacity .3s; }
.g-node.is-current .g-halo { opacity: .55; }
.g-dist { font-family: var(--mono); font-size: 13px; fill: var(--mute); text-anchor: middle; dominant-baseline: central; transform-box: fill-box; transform-origin: center; }
.g-dist.is-changed { fill: var(--blue); font-weight: 700; animation: pop .5s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }
.g-legend text { font-family: var(--serif); font-size: 13px; fill: var(--mute); dominant-baseline: central; }

/* algorithm box + state */
.fig-under { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; align-items: start; }
.algo { border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 0; margin: 0; }
.algo-cap { border-bottom: 1px solid var(--ink); padding: 6px 2px; font-size: 0.95rem; }
.algo-cap b { font-weight: 600; }
.algo-cap .fn { font-variant-caps: all-small-caps; letter-spacing: 0.05em; }
.algo ol { list-style: none; counter-reset: ln; margin: 0; padding: 6px 0; font-size: 0.93rem; line-height: 1.5; }
.algo li { counter-increment: ln; position: relative; padding: 1px 6px 1px 34px; transition: background .25s; }
.algo li::before { content: counter(ln); position: absolute; left: 4px; width: 20px; text-align: right; font-family: var(--mono); font-size: 0.72rem; color: var(--faint); top: 4px; }
.algo li.is-on { background: var(--mark); }
.algo li.is-on::before { color: var(--ink); }
.algo .i1 { padding-left: 54px; } .algo .i2 { padding-left: 74px; } .algo .i3 { padding-left: 94px; }
.kw { font-weight: 600; }
.fn { font-variant-caps: all-small-caps; letter-spacing: 0.05em; }
.state { font-size: 0.93rem; }
.state-h { font-size: 0.95rem; border-bottom: 1px solid var(--rule); padding: 6px 0; margin: 0 0 8px; font-weight: 400; }
.dtable { border-collapse: collapse; width: 100%; font-variant-numeric: lining-nums tabular-nums; }
.dtable th, .dtable td { border: 1px solid var(--rule); text-align: center; padding: 4px 2px; min-width: 2.2em; transition: background .25s; }
.dtable th { font-style: italic; font-weight: 400; background: #fafbfd; }
.dtable td { font-family: var(--mono); font-size: 0.8rem; }
.dtable td.is-on { background: var(--mark); font-weight: 700; }
.dtable td.is-done { color: var(--blue); }
.queue { font-family: var(--mono); font-size: 0.8rem; margin: 10px 0 0; color: var(--ink); overflow-wrap: anywhere; }
.queue span { color: var(--mute); }
.legend { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.86rem; color: var(--mute); }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 50%; border: 1.6px solid var(--ink); display: inline-block; }
.sw-cur { background: var(--mark); } .sw-set { background: var(--blue); border-color: var(--blue); } .sw-q { border: 3px solid var(--blue); }
.sw-tree { width: 18px; height: 4px; border: 0; border-radius: 0; background: var(--blue); }

/* ---------- sections ---------- */
.sec { padding-block: clamp(52px, 7vw, 96px); border-top: 1px solid var(--rule); }
.sec-head { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 16px clamp(24px, 4vw, 64px); align-items: end; margin-bottom: clamp(28px, 4vw, 48px); }
.sec-head h2, .h2 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); }
.secno { color: var(--blue); margin-right: 0.5em; font-variant-numeric: lining-nums; }
.sec-head p { margin: 0; color: var(--mute); max-width: 58ch; }
.h2 + p { margin-top: 18px; }
h2 .anchor, h3 .anchor { color: var(--faint); text-decoration: none; margin-left: 8px; opacity: 0; transition: opacity .2s; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }

/* theorems */
.thms { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.thm { grid-column: span 6; border-left: 3px solid var(--ink); padding: 4px 0 4px 20px; }
.thm:nth-child(1) { grid-column: 1 / span 7; }
.thm:nth-child(2) { grid-column: 8 / span 5; border-left-color: var(--blue); }
.thm:nth-child(3) { grid-column: 3 / span 8; margin-top: 8px; }
.thm p { margin: 0 0 10px; }
.thm .stmt { font-style: italic; font-size: 1.08rem; }
.thm .stmt b { font-style: normal; font-weight: 600; }
.thm .stmt .up { font-style: normal; }
.thm .src { font-size: 0.92rem; color: var(--mute); }
.math { font-style: italic; white-space: nowrap; }
.math .up { font-style: normal; }
details.proof { margin-top: 6px; }
details.proof summary { cursor: pointer; font-style: italic; color: var(--blue); min-height: 44px; display: inline-flex; align-items: center; list-style: none; }
details.proof summary::-webkit-details-marker { display: none; }
details.proof summary::after { content: "+"; font-style: normal; margin-left: 8px; font-family: var(--mono); transition: transform .25s; display: inline-block; }
details.proof[open] summary::after { transform: rotate(45deg); }
details.proof .pf { font-size: 0.98rem; color: var(--ink); }
details.proof .pf::after { content: "\220E"; float: right; margin-left: 10px; }
details.proof[open] .pf { animation: drop .3s ease; }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* references */
.refs { list-style: none; margin: 0; padding: 0; counter-reset: ref; }
.ref { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) auto; gap: 4px 20px; padding: 18px 0; border-top: 1px solid var(--rule); scroll-margin-top: 24px; transition: background .5s; }
.ref:last-child { border-bottom: 1px solid var(--rule); }
.ref-num { font-variant-numeric: lining-nums tabular-nums; color: var(--blue); font-weight: 600; }
.ref-body { min-width: 0; }
.ref-title { font-size: 1.16rem; font-weight: 600; line-height: 1.25; margin: 0 0 4px; }
.ref-title a { color: var(--ink); text-decoration: none; }
.ref-title a:hover { color: var(--blue); text-decoration: underline; }
.ref-auth { margin: 0; font-size: 0.98rem; }
.ref-auth .me { font-weight: 600; text-decoration: underline; text-decoration-color: var(--mark); text-decoration-thickness: 0.35em; text-underline-offset: -0.12em; text-decoration-skip-ink: none; }
.ref-venue { margin: 0; font-style: italic; color: var(--mute); font-size: 0.98rem; }
.ref-year { font-variant-numeric: lining-nums tabular-nums; color: var(--mute); text-align: right; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.tag { font-size: 0.8rem; border: 1px solid var(--rule); padding: 1px 8px; border-radius: 99px; color: var(--mute); }
.tag.award { background: var(--mark); border-color: var(--mark); color: var(--ink); }
.tag.pre { border-style: dashed; color: var(--ink); }
.ref-links { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin-top: 8px; }
.ref-links a, .copy { font-family: var(--mono); font-size: 0.8rem; display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border: 1px solid transparent; text-decoration: none; border-radius: 2px; }
.ref-links a:first-child { padding-left: 0; }
.ref-links a:hover { text-decoration: underline; }
.copy { background: #fff; border-color: var(--rule); color: var(--ink); cursor: pointer; gap: 6px; transition: border-color .15s, background .2s; }
.copy:hover { border-color: var(--ink); }
.copy[hidden] { display: none; }
.copy .ok { display: none; }
.copy.is-copied { background: var(--mark); border-color: var(--mark); }
.copy.is-copied .ok { display: inline; }
.copy.is-copied .go { display: none; }
details.bib { grid-column: 2 / -1; margin-top: -10px; }
.dotplot { width: 100%; max-width: 480px; }
details.bib summary { font-family: var(--mono); font-size: 0.8rem; color: var(--blue); cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; }
pre.bibtex { margin: 0 0 6px; padding: 14px 16px; background: #f6f7fa; border-left: 3px solid var(--blue); overflow-x: auto; font-size: 0.78rem; line-height: 1.55; white-space: pre; max-width: 100%; }
.ref:target, .ref.is-flash { background: linear-gradient(90deg, var(--mark-soft), transparent 70%); }
.ref.is-hidden { display: none; }

/* filters */
.filters { display: grid; gap: 14px; margin-bottom: 26px; padding: 18px 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.filters[hidden] { display: none; }
.frow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.frow .fl { font-style: italic; color: var(--mute); min-width: 4.5rem; }
.chip { min-height: 44px; padding: 0 14px; border: 1px solid var(--rule); background: #fff; color: var(--ink); font-family: var(--serif); font-size: 0.98rem; border-radius: 99px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: background .2s, border-color .2s, color .2s; }
.chip:hover { border-color: var(--ink); }
.chip small { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-pressed="true"] small { color: #c9ccd4; }
.fcount { margin: 0; font-size: 0.95rem; color: var(--mute); }
.fcount b { color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.empty { padding: 24px 0; font-style: italic; color: var(--mute); }
.empty[hidden] { display: none; }
.ref.is-in { animation: rise .35s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dotplot .dot { fill: var(--blue); stroke: var(--blue); stroke-width: 1.5; transition: fill .3s, opacity .3s; }
.dotplot .dot.is-off { fill: #fff; stroke: var(--rule); }
.dotplot .dot.award { fill: var(--mark); stroke: var(--ink); }
.dotplot .dot.award.is-off { fill: #fff; stroke: var(--rule); }
.dotplot text { font-family: var(--serif); font-size: 13px; fill: var(--mute); }
.dotplot .yr { font-variant-numeric: lining-nums; text-anchor: middle; }
.dotplot .ax { stroke: var(--rule); }

/* software listing */
.soft { display: grid; gap: clamp(40px, 6vw, 80px); }
.proj { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(22px, 4vw, 56px); align-items: center; }
.proj:nth-child(even) { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.proj:nth-child(even) .proj-fig { order: 2; }
.proj-fig { margin: 0; }
.photo { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border: 1px solid var(--rule); background: #f6f7fa; }
.photo.portrait { aspect-ratio: 4 / 5; }
.cap { font-size: 0.94rem; color: var(--ink); margin-top: 10px; line-height: 1.45; }
.cap .m { color: var(--mute); }
.proj h3 { font-size: clamp(1.45rem, 2.4vw, 1.9rem); margin-bottom: 6px; }
.proj h3 code { font-size: 0.8em; font-weight: 400; color: var(--blue); }
.proj .what { font-style: italic; color: var(--mute); margin-bottom: 14px; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 0; margin: 0 0 16px; list-style: none; font-size: 0.94rem; color: var(--mute); }
.facts b { color: var(--ink); font-weight: 600; font-variant-numeric: lining-nums tabular-nums; }
.listing { margin: 0 0 14px; }
.listing figcaption { font-size: 0.88rem; border-bottom: 1px solid var(--ink); padding-bottom: 4px; margin-bottom: 0; }
.listing pre { margin: 0; padding: 12px 14px; background: #f6f7fa; overflow-x: auto; font-size: 0.8rem; line-height: 1.6; border-bottom: 1px solid var(--rule); }
.listing .c { color: var(--faint); }
.listing .k { color: var(--blue); }

/* two-column prose with sidenotes */
.paper { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 0 48px; }
.cols { columns: 2 22rem; column-gap: 40px; column-rule: 1px solid var(--rule); hyphens: auto; text-align: justify; }
.cols p { break-inside: avoid-column; }
.cols p:first-child::first-letter { float: left; font-size: 3.6em; line-height: 0.82; padding: 6px 8px 0 0; font-weight: 600; color: var(--blue); }
.side { font-size: 0.9rem; color: var(--mute); line-height: 1.45; border-top: 1px solid var(--rule); padding-top: 12px; }
.side p { margin-bottom: 14px; }
.side sup, .cols sup { color: var(--blue); font-weight: 600; }
.portrait-fig { margin: 0 0 18px; }

/* news */
.news { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0; border-top: 2px solid var(--ink); }
.news li { padding: 18px 20px 20px 0; border-bottom: 1px solid var(--rule); position: relative; }
.news li + li { padding-left: 20px; border-left: 1px solid var(--rule); }
.news time { font-variant-numeric: lining-nums tabular-nums; font-size: 0.92rem; color: var(--mute); display: block; margin-bottom: 6px; }
.news .soon { display: inline-block; font-size: 0.78rem; background: var(--mark); color: var(--ink); padding: 0 6px; margin-left: 6px; border-radius: 2px; }
.news h3 { font-size: 1.12rem; margin-bottom: 4px; line-height: 1.25; text-wrap: pretty; }
.news p { margin: 0; font-size: 0.98rem; color: var(--mute); }

/* closing */
.closing { padding-block: clamp(56px, 8vw, 110px); border-top: 1px solid var(--rule); }
.closing-in { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 64px); align-items: end; }
.closing h2 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.06; margin-bottom: 16px; }
.closing p { color: var(--mute); max-width: 52ch; }
.closing .qed { font-size: 1.1rem; color: var(--ink); }
.lemma-box { border: 1px solid var(--ink); padding: 18px 20px; background: #fff; box-shadow: 6px 6px 0 var(--blue-wash); }
.lemma-box p { color: var(--ink); margin-bottom: 12px; }
.lemma-box p:last-child { margin-bottom: 0; }

/* sub-page head */
.page-head { padding-block: clamp(40px, 6vw, 80px) clamp(28px, 4vw, 48px); }
.page-head-in { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 20px clamp(24px, 4vw, 64px); align-items: end; }
.page-head h1 { font-size: clamp(2.3rem, 5vw, 4.2rem); line-height: 1.04; letter-spacing: -0.02em; }
.page-head .lede { font-size: 1.14rem; color: var(--mute); margin: 0; }
.page-head .kicker { margin-bottom: 14px; }
.toc { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 0 18px; }
.toc a { display: inline-flex; min-height: 44px; align-items: center; }

/* tables */
.tbl-wrap { overflow-x: auto; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.tbl { width: 100%; border-collapse: collapse; font-size: 1rem; }
.tbl caption { text-align: left; caption-side: top; font-size: 0.95rem; padding: 0 0 8px; }
.tbl th, .tbl td { text-align: left; padding: 11px 14px 11px 0; vertical-align: top; }
.tbl thead th { font-weight: 600; border-bottom: 1px solid var(--ink); font-size: 0.95rem; }
.tbl tbody tr + tr td, .tbl tbody tr + tr th { border-top: 1px solid var(--rule); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.tbl tbody th { font-weight: 400; font-family: var(--mono); font-size: 0.82rem; color: var(--blue); white-space: nowrap; }
.tbl .now td, .tbl .now th { background: var(--mark-soft); }
.tbl-cap { font-size: 0.95rem; margin: 0 0 10px; }

/* talks */
.talks { list-style: none; margin: 0; padding: 0; }
.past-h { margin: clamp(36px, 5vw, 56px) 0 10px; font-style: italic; color: var(--mute); }
.talk { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) auto; gap: 4px 24px; padding: 18px 0; border-top: 1px solid var(--rule); align-items: baseline; }
.talk:last-child { border-bottom: 1px solid var(--rule); }
.talk time { font-variant-numeric: lining-nums tabular-nums; color: var(--mute); }
.talk.up time { color: var(--ink); font-weight: 600; }
.talk h3 { font-size: 1.14rem; line-height: 1.25; margin-bottom: 2px; }
.talk p { margin: 0; color: var(--mute); font-size: 0.98rem; }
.talk .kind { font-style: italic; }
.talk a.more { font-family: var(--mono); font-size: 0.8rem; min-height: 44px; display: inline-flex; align-items: center; }
.badge { display: inline-block; font-size: 0.78rem; background: var(--mark); padding: 0 6px; border-radius: 2px; margin-left: 4px; font-weight: 400; vertical-align: 0.15em; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.people { list-style: none; padding: 0; margin: 0; }
.people li { padding: 12px 0; border-top: 1px solid var(--rule); }
.people li:last-child { border-bottom: 1px solid var(--rule); }
.people b { font-weight: 600; }
.people span { display: block; color: var(--mute); font-size: 0.96rem; }
.callout { border-left: 3px solid var(--blue); background: var(--blue-wash); padding: 16px 20px; margin-top: 22px; }
.callout p:last-child { margin: 0; }

/* cv */
.cv-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.cv-tools [hidden] { display: none; }
.cv-sec { max-width: 1040px; }
.cv-sec { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 0 32px; padding-block: 28px; border-top: 1px solid var(--rule); }
.cv-sec:first-child { border-top: 2px solid var(--ink); }
.cv-sec h2 { font-size: 1.3rem; padding-top: 2px; }
.cv-list { list-style: none; margin: 0; padding: 0; }
.cv-list li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0 18px; padding: 6px 0 10px; }
.cv-list .when { font-variant-numeric: lining-nums tabular-nums; color: var(--mute); }
.cv-list b { font-weight: 600; }
.cv-list .sub { display: block; color: var(--mute); font-size: 0.97rem; }
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 24px; margin: 0; }
.skills dt { font-weight: 600; }
.skills dd { margin: 0; color: var(--mute); font-size: 0.98rem; }

/* contact */
.contact-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.slot { border: 1px solid var(--ink); padding: clamp(18px, 3vw, 28px); background: #fff; box-shadow: 6px 6px 0 var(--blue-wash); }
.slot h2 { font-size: 1.5rem; margin-bottom: 10px; }
.slot .btn { margin-top: 4px; }
.addr { font-style: normal; line-height: 1.6; }
.dl { margin: 0; display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 10px 16px; }
.dl dt { font-style: italic; color: var(--mute); }
.dl dd { margin: 0; }
.dl a { display: inline-block; padding: 11px 0; margin: -11px 0; }
.checklist { list-style: none; padding: 0; margin: 0; counter-reset: c; }
.checklist li { counter-increment: c; padding: 10px 0 10px 40px; position: relative; border-top: 1px solid var(--rule); }
.checklist li::before { content: "(" counter(c, lower-roman) ")"; position: absolute; left: 0; color: var(--blue); font-style: italic; }
/* form styles for the plugin markup */
.form { display: grid; gap: 14px; }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form label { display: block; font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.form input, .form select, .form textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--faint); border-radius: 2px; background: #fff; color: var(--ink); font-family: var(--serif); font-size: 1rem; }
.form textarea { min-height: 140px; resize: vertical; }
.form input:focus-visible, .form select:focus-visible, .form textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.form .hint { font-size: 0.86rem; color: var(--mute); font-weight: 400; }
.form button { justify-self: start; }

/* prose pages */
.prose { max-width: var(--measure); padding-block: clamp(40px, 6vw, 80px); }
.prose h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin-bottom: 22px; }
.prose h2 { font-size: 1.4rem; margin: 30px 0 10px; }

/* 404 */
.nf { padding-block: clamp(48px, 8vw, 120px); display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 64px); align-items: center; }
.nf h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 1.02; margin-bottom: 18px; }
.nf .big { font-size: clamp(5rem, 14vw, 10rem); line-height: .9; font-weight: 600; color: var(--blue); font-variant-numeric: lining-nums; margin: 0 0 10px; letter-spacing: -0.04em; }
.proofbox { border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 14px 0; }
.proofbox p { margin-bottom: 10px; }
.proofbox p:last-child::after { content: "\220E"; float: right; }

/* ---------- footer ---------- */
.site-foot { border-top: 2px solid var(--ink); padding-block: 40px 28px; margin-top: 0; font-size: 1rem; }
.foot-grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 3fr) minmax(0, 3fr); gap: 28px clamp(24px, 4vw, 56px); }
.foot-name { font-size: 1.5rem; font-weight: 600; margin: 0 0 4px; }
.foot-role { font-style: italic; color: var(--mute); margin-bottom: 18px; }
.site-foot address { font-style: normal; line-height: 1.6; }
.site-foot h2 { font-size: 0.95rem; font-weight: 400; font-style: italic; color: var(--mute); margin-bottom: 6px; }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li a, .site-foot .fl a { display: inline-flex; align-items: center; min-height: 40px; }
.foot-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 0.9rem; color: var(--mute); }
.foot-base .pg { font-variant-numeric: lining-nums; }

/* ---------- responsive ---------- */
@media (min-width: 1300px) {
  .stamp { display: block; left: max(6px, calc((100vw - var(--wrap)) / 2 - 26px)); }
}
@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-title { max-width: 720px; }
  .paper { grid-template-columns: minmax(0, 1fr); }
  .side { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 28px; margin-top: 24px; }
}
@media (max-width: 860px) {
  .head-in { gap: 10px; min-height: 64px; position: relative; }
  .nav summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 2px; cursor: pointer; list-style: none; font-size: 1rem; }
  .nav summary::-webkit-details-marker { display: none; }
  .nav summary::after { content: ""; width: 12px; height: 8px; border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transition: transform .2s; }
  .nav[open] summary { border-color: var(--ink); }
  .nav[open] summary::after { transform: scaleY(0.4); }
  .nav nav { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: #fff; border-bottom: 2px solid var(--ink); padding: 0 var(--gut); box-shadow: 0 18px 30px -24px rgba(20, 22, 27, .45); }
  .nav ul { flex-direction: column; gap: 0; padding: 4px 0 10px; }
  .nav li + li { border-top: 1px solid var(--rule); }
  .nav a { padding: 0 2px; min-height: 50px; font-size: 1.15rem; }
  .nav a::after { left: 2px; right: auto; width: 2rem; bottom: 10px; }
  .head-in > .cta { padding: 0 14px; font-size: 0.96rem; }
  .sec-head, .page-head-in, .closing-in, .contact-grid, .split, .nf { grid-template-columns: minmax(0, 1fr); }
  .thm, .thm:nth-child(1), .thm:nth-child(2), .thm:nth-child(3) { grid-column: 1 / -1; margin-top: 0; }
  .proj, .proj:nth-child(even) { grid-template-columns: minmax(0, 1fr); }
  .proj:nth-child(even) .proj-fig { order: 0; }
  .foot-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .foot-grid > :first-child { grid-column: 1 / -1; }
  .cv-sec { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .news li + li { padding-left: 0; border-left: 0; }
  .news li { padding-right: 0; }
}
@media (max-width: 640px) {
  body { font-size: 1.0625rem; }
  .g-w text { font-size: 18px; }
  .g-dist { font-size: 19px; }
  .g-node .lbl { font-size: 25px; }
  .fig-under { grid-template-columns: minmax(0, 1fr); }
  .ref { grid-template-columns: 2.6rem minmax(0, 1fr); }
  .ref-year { grid-column: 2; grid-row: 1; text-align: left; font-size: 0.92rem; order: -1; }
  .ref-year { display: none; }
  .talk { grid-template-columns: minmax(0, 1fr); }
  .talk a.more { justify-self: start; }
  .cv-list li { grid-template-columns: minmax(0, 1fr); }
  .form .row2 { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dl dd + dt { margin-top: 10px; }
  .abstract { text-align: left; }
  .cols { text-align: left; }
  .frow .fl { width: 100%; }
  .wordmark span { display: none; }
  .foot-grid { grid-template-columns: minmax(0, 1fr); }
  .tbl th, .tbl td { padding-right: 10px; }
  .hide-sm { display: none; }
}
@media (max-width: 370px) {
  .head-in > .cta { display: none; }
  .wordmark b { font-size: 1.15rem; }
  .scrub { flex-basis: 100%; order: 9; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .g-edge.is-relax { animation: none; }
}

@media print {
  .site-head, .site-foot .foot-grid > :not(:first-child), .skip, .cv-tools, .closing, .no-print { display: none !important; }
  body { font-size: 10.5pt; line-height: 1.4; }
  a { color: var(--ink); text-decoration: none; }
  .page-head { padding: 0 0 10pt; }
  .page-head h1 { font-size: 22pt; }
  .page-head-in { grid-template-columns: 1fr; }
  .cv-sec { padding-block: 8pt; break-inside: avoid; grid-template-columns: 9rem 1fr; }
  .cv-list li { padding: 2pt 0 4pt; }
  .site-foot { border: 0; padding: 0; }
  .foot-base { display: none; }
  .wrap { max-width: none; padding: 0; }
}
