/* Zosen Lab — site styles. Colours and type are tokens; edit them here. */
:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --surface-2: #eef1f3;
  --text: #0f1720;
  --muted: #56616d;
  --faint: #8a949e;
  --line: #dde2e6;
  --accent: #0b6e69;
  --accent-ink: #ffffff;
  --accent-soft: #e0efee;
  --mark: #d9480f;
  --focus: #d9480f;
  --radius: 12px;
  --maxw: 1180px;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1114; --surface: #141a1e; --surface-2: #1a2126; --text: #e9edf0; --muted: #a3adb6; --faint: #6f7a84;
    --line: #263036; --accent: #52c4ba; --accent-ink: #062321; --accent-soft: #123331; --mark: #ff8a4c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1114; --surface: #141a1e; --surface-2: #1a2126; --text: #e9edf0; --muted: #a3adb6; --faint: #6f7a84;
  --line: #263036; --accent: #52c4ba; --accent-ink: #062321; --accent-soft: #123331; --mark: #ff8a4c;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.65 var(--sans); overflow-x: hidden; }
img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-weight: 650; line-height: 1.12; letter-spacing: -0.025em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); margin: 0 0 .45em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 .6em; }
h3 { font-size: 1.15rem; margin: 0 0 .35em; letter-spacing: -0.01em; }
p { margin: 0 0 1em; text-wrap: pretty; }
.mono, .eyebrow, .label { font-family: var(--mono); }
.eyebrow { font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 1rem; }
.label { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.muted { color: var(--muted); }

.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--text); text-decoration: none; font-weight: 650; letter-spacing: -0.01em; }
.brand svg { width: 28px; height: 28px; color: var(--accent); flex: none; }
.brand small { display: block; font: 500 .68rem/1.2 var(--mono); color: var(--muted); letter-spacing: .03em; white-space: nowrap; }
@media (max-width: 430px) { .brand small { display: none; } }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .15rem; }
.nav a { display: block; padding: .45rem .75rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .94rem; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.icon-btn, .nav-toggle { background: none; border: 1px solid var(--line); border-radius: 8px; height: 38px; color: var(--text); cursor: pointer; font: inherit; font-size: .9rem; }
.icon-btn { width: 38px; display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; }
.nav-toggle { display: none; padding: 0 .8rem; }
@media (max-width: 860px) {
  .nav-toggle { display: inline-block; }
  .nav { position: absolute; top: 64px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--line); display: none; }
  .nav.open { display: block; }
  .nav ul { flex-direction: column; padding: .5rem 16px 1rem; }
  .nav a { padding: .8rem .5rem; font-size: 1rem; }
}

/* Hero */
.hero { position: relative; isolation: isolate; overflow: hidden; padding: clamp(3rem, 7vw, 6rem) 0 clamp(2.5rem, 5vw, 4rem); --band: clamp(190px, 58vw, 340px); padding-bottom: calc(var(--band) + 1.5rem); }
.hero-grid > div { max-width: 640px; }

/* Hero background: a lineage tree writing its own record (generated by tools/make_lineage.py) */
.hero-bg { position: absolute; left: 0; right: 0; bottom: 0; height: var(--band); width: 100%; z-index: -1; pointer-events: none; }
.lt-tree, .lt-early, .lt-late, .lt-pulses line { fill: none; vector-effect: non-scaling-stroke; }
.lt-tree { stroke: url(#lt-fade); stroke-width: 1px; }
.lt-early { stroke: var(--accent); stroke-width: 2.5px; opacity: .6; }
.lt-late { stroke: var(--mark); stroke-width: 2.5px; opacity: .8; }
.lt-pulses line { stroke: var(--faint); stroke-width: 1.5px; stroke-dasharray: 1 6; stroke-linecap: round; opacity: .7; }
.lt-cover { transform: translateX(1200px); }
@media (prefers-reduced-motion: no-preference) {
  .lt-cover { animation: lt-grow 2.4s cubic-bezier(.22, .7, .2, 1) .35s backwards; }
  @keyframes lt-grow { from { transform: translateX(0); } }
}
.hero-note { font: .78rem/1.55 var(--mono); color: var(--muted); max-width: 46ch; margin: 2rem 0 0; }
@media (min-width: 980px) {
  .hero { padding-bottom: clamp(2.5rem, 5vw, 4rem); }
  .hero-bg {
    left: 42%; top: 0; height: auto;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%), linear-gradient(180deg, #000 78%, transparent);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(90deg, transparent, #000 22%), linear-gradient(180deg, #000 78%, transparent);
    mask-composite: intersect;
  }
}
@media print { .hero-bg { display: none; } }

.lede { font-size: clamp(1.05rem, 1.7vw, 1.22rem); color: var(--muted); max-width: 58ch; }
.btns { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.8rem; }
.btn { display: inline-flex; align-items: center; gap: .45rem; padding: .72rem 1.15rem; border-radius: 999px; font-weight: 600; font-size: .95rem; text-decoration: none; border: 1px solid var(--accent); transition: transform .15s ease, background-color .15s ease; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { color: var(--text); border-color: var(--line); background: var(--surface); }
.btn.ghost:hover { border-color: var(--accent); }

/* Recording figure */
.record { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.25rem 1rem; margin: 0; }
.record svg { width: 100%; height: auto; color: var(--text); }
.record .cell-row { stroke: var(--line); }
.record .slot { fill: var(--surface-2); }
.record .edit { fill: var(--accent); }
.record .edit.late { fill: var(--mark); }
.record .axis { fill: var(--faint); font: 10px var(--mono); }
.record figcaption { font: .78rem/1.5 var(--mono); color: var(--muted); margin-top: .75rem; }
@media (prefers-reduced-motion: no-preference) {
  .record .edit { opacity: 0; animation: write .5s ease-out forwards; animation-delay: calc(var(--i) * 18ms + 200ms); }
  @keyframes write { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
}

/* Publication tape */
.tape rect { cursor: help; }
.tape .f { fill: var(--accent); }
.tape .o { fill: var(--faint); }
.tape .p { fill: var(--mark); }
.tape-fig { margin: 0 auto; max-width: 820px; }

/* Theme-aware figures: a light and a dark SVG, one shown at a time (follows the toggle and the system) */
.fig-theme { margin: 0; }
.fig-theme .dark { display: none; }
.fig-theme img { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.fig-scroll { overflow-x: auto; border-radius: var(--radius); }
.fig-scroll img { min-width: 860px; }
.fig-theme figcaption { max-width: 72ch; margin-top: .9rem; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .fig-theme .light { display: none; }
  :root:not([data-theme="light"]) .fig-theme .dark { display: block; }
}
:root[data-theme="dark"] .fig-theme .light { display: none; }
:root[data-theme="dark"] .fig-theme .dark { display: block; }

/* Fact strip */
.facts { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.facts dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }
.facts div { padding: 1.1rem 0; }
@media (min-width: 720px) { .facts div { padding: 1.2rem 1.5rem; border-left: 1px solid var(--line); } .facts div:first-child { border-left: 0; padding-left: 0; } }
.facts dt { font: .72rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: .2rem; }
.facts dd { margin: 0; font-size: .95rem; }

/* Sections */
section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
section + section { border-top: 1px solid var(--line); }
.section-head { display: grid; gap: .5rem 2rem; margin-bottom: 2.25rem; }
@media (min-width: 860px) { .section-head { grid-template-columns: 4fr 7fr; align-items: end; } }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); max-width: 60ch; }

/* Questions list */
.questions { list-style: none; margin: 0; padding: 0; }
.questions li { display: grid; gap: .5rem 2rem; padding: 1.75rem 0; border-top: 1px solid var(--line); }
.questions li:last-child { border-bottom: 1px solid var(--line); }
@media (min-width: 860px) { .questions li { grid-template-columns: 90px 5fr 6fr; } }
.questions .n { font: 600 .85rem var(--mono); color: var(--accent); padding-top: .3rem; }
.questions h3 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); margin: 0; }
.questions h3 a { color: inherit; text-decoration: none; }
.questions h3 a:hover { color: var(--accent); }
.questions p { margin: 0 0 .6rem; color: var(--muted); }
.questions .refs { font: .8rem var(--mono); color: var(--faint); }
.questions .refs a { color: var(--muted); }

/* Arc / timeline */
.arc { list-style: none; margin: 0; padding: 0; }
.arc li { display: grid; grid-template-columns: 80px 1fr; gap: 1.25rem; padding: 0 0 1.6rem; position: relative; }
.arc li::before { content: ""; position: absolute; left: 100px; top: .6rem; bottom: -.4rem; width: 1px; background: var(--line); }
.arc li:last-child::before { display: none; }
.arc .yr { font: 600 .85rem var(--mono); color: var(--muted); padding-top: .15rem; }
.arc .body { padding-left: 1.6rem; position: relative; }
.arc .body::before { content: ""; position: absolute; left: -5px; top: .45rem; width: 11px; height: 11px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.arc li.next .body::before { background: var(--mark); border-color: var(--mark); }
.arc li.next .yr { color: var(--mark); }
.arc h3 { font-size: 1.02rem; margin: 0 0 .15rem; }
.arc p { margin: 0; color: var(--muted); font-size: .95rem; }
.arc .where { display: block; font: .74rem var(--mono); color: var(--faint); margin-top: .2rem; }

/* Numbers */
.numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.numbers div { background: var(--surface); padding: 1.3rem 1.4rem; }
.numbers b { display: block; font-size: 2rem; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.numbers span { color: var(--muted); font-size: .9rem; }

/* Layout helpers */
.split { display: grid; gap: 3rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; } .split.wide-left { grid-template-columns: 3fr 2fr; } }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0 0; padding: 0; list-style: none; }
.tag { font: 600 .72rem var(--mono); padding: .2rem .55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); text-decoration: none; letter-spacing: .02em; }
a.tag:hover { background: var(--accent); color: var(--accent-ink); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.panel p:last-child { margin-bottom: 0; }
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 1.5rem 1.75rem; }
.callout p:last-child { margin-bottom: 0; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .45rem; }

/* News */
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 96px 1fr; gap: 1rem; padding: .95rem 0; border-top: 1px solid var(--line); }
.news time { font: .8rem var(--mono); color: var(--faint); padding-top: .15rem; }
@media (max-width: 520px) { .news li { grid-template-columns: 1fr; gap: .1rem; } }

/* Methods grid */
.methods { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); }
.methods > div { background: var(--surface); padding: 1.4rem; }
.methods h3 { font-size: 1rem; }
.methods p { margin: 0; color: var(--muted); font-size: .94rem; }

.methods ul { margin: .6rem 0 0; padding-left: 1.1rem; color: var(--muted); font-size: .94rem; }
.methods li { margin-bottom: .4rem; }

/* Career-stage panels (native <details>, no script) */
.stages { display: grid; gap: .75rem; }
details.stage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
details.stage[open] { border-color: var(--accent); }
details.stage summary { cursor: pointer; list-style: none; padding: 1.1rem 3.2rem 1.1rem 1.4rem; position: relative; display: grid; gap: .15rem; border-radius: var(--radius); }
details.stage summary::-webkit-details-marker { display: none; }
details.stage summary::after { content: "+"; position: absolute; right: 1.4rem; top: 50%; transform: translateY(-50%); font: 400 1.5rem/1 var(--mono); color: var(--accent); }
details.stage[open] summary::after { content: "\2212"; }
details.stage summary:hover h3 { color: var(--accent); }
details.stage summary h3 { margin: 0; font-size: 1.1rem; }
details.stage .focus { color: var(--muted); font-size: .92rem; }
.stage-body { display: grid; gap: 1.5rem 3rem; padding: 1.25rem 1.4rem 1.5rem; border-top: 1px solid var(--line); }
@media (min-width: 860px) { .stage-body { grid-template-columns: 3fr 2fr; } }
.stage-body h4 { font: .72rem var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--accent); margin: 0 0 .5rem; }
.stage-body ul { margin: 0; padding-left: 1.1rem; }
.stage-body li { margin-bottom: .45rem; font-size: .96rem; }
.stage-body p { font-size: .96rem; color: var(--muted); margin: 0; }

/* Research detail */
.theme { display: grid; gap: 1.5rem 3.5rem; scroll-margin-top: 90px; }
@media (min-width: 900px) { .theme { grid-template-columns: 5fr 4fr; } }
.theme + .theme { margin-top: 3.5rem; padding-top: 3.5rem; border-top: 1px solid var(--line); }
.theme dl { margin: 1.25rem 0 0; display: grid; gap: 1rem; }
.theme dt { font: .72rem var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.theme dd { margin: .2rem 0 0; }
.evidence { list-style: none; margin: 0; padding: 0; }
.evidence li { padding: .8rem 0; border-top: 1px solid var(--line); font-size: .95rem; }
.evidence li:first-child { border-top: 0; padding-top: 0; }
.evidence a { color: var(--text); font-weight: 600; text-decoration: none; }
.evidence a:hover { color: var(--accent); text-decoration: underline; }
.evidence span { display: block; color: var(--faint); font: .76rem var(--mono); margin-top: .15rem; }

/* People */
.pi { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 820px) { .pi { grid-template-columns: 260px 1fr; } }
.portrait { aspect-ratio: 4 / 5; max-width: 260px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 3.4rem; font-weight: 650; letter-spacing: -0.04em; overflow: hidden; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.links { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; margin: 1.2rem 0 0; padding: 0; list-style: none; font-size: .95rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 128px 1fr; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--line); font-size: .96rem; }
.timeline li > span:first-child { font: .8rem var(--mono); color: var(--faint); padding-top: .15rem; }
.timeline small { display: block; color: var(--muted); font-size: .88rem; }
@media (max-width: 520px) { .timeline li { grid-template-columns: 1fr; gap: .1rem; } }

/* Publications */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.chip { font: 600 .8rem var(--mono); padding: .45rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.pubs { list-style: none; margin: 0; padding: 0; }
.pub { display: grid; gap: .25rem 1.5rem; padding: 1.35rem 0; border-top: 1px solid var(--line); }
@media (min-width: 820px) { .pub { grid-template-columns: 64px 1fr; } }
.pub[hidden] { display: none; }
.pub .yr { font: 600 .82rem var(--mono); color: var(--faint); padding-top: .2rem; }
.pub .title { font-weight: 600; font-size: 1.04rem; line-height: 1.4; }
.pub .title a { color: var(--text); text-decoration: none; }
.pub .title a:hover { color: var(--accent); text-decoration: underline; }
.pub .authors, .pub .venue { color: var(--muted); font-size: .92rem; }
.pub .authors strong { color: var(--text); font-weight: 650; }
.pub .role { font: .76rem var(--mono); color: var(--accent); margin-top: .35rem; }
.pub .plain { margin-top: .55rem; padding-left: .9rem; border-left: 2px solid var(--accent); font-size: .95rem; }

/* Media list */
.media { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.media li { background: var(--surface); padding: 1.2rem 1.3rem; }
.media a { color: var(--text); text-decoration: none; font-weight: 600; line-height: 1.4; display: block; }
.media a:hover { color: var(--accent); }
.media span { display: block; font: .72rem var(--mono); color: var(--faint); margin-bottom: .35rem; letter-spacing: .04em; text-transform: uppercase; }
.media small { display: block; color: var(--muted); margin-top: .3rem; font-size: .88rem; }

/* Page head */
.page-head { padding: clamp(2.75rem, 6vw, 4.75rem) 0 clamp(2rem, 4vw, 3rem); border-bottom: 1px solid var(--line); }
.page-head h1 { max-width: 22ch; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 3rem 0; color: var(--muted); font-size: .92rem; background: var(--surface); }
.site-footer .wrap { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }
.site-footer h2 { font: .72rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text); margin-bottom: .7rem; }
.site-footer address { font-style: normal; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.fineprint { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 1.25rem; font: .78rem var(--mono); color: var(--faint); margin: 0; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .btn { transition: none; } }
@media print { .site-header, .site-footer, .btns, .filters { display: none; } body { background: #fff; color: #000; } }
