/* Major lab site — design system (research R2: Material look of RIMap-RISC, no framework).
   Tokens first; dark mode follows the visitor's system setting. */

:root {
  color-scheme: light dark;
  --primary: #1565c0;          /* Material blue 800: 5.4:1 on the page background */
  --primary-strong: #0d47a1;
  --on-primary: #ffffff;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --text: rgba(0, 0, 0, 0.87);
  --text-2: rgba(0, 0, 0, 0.66);
  --divider: rgba(0, 0, 0, 0.12);
  --link: #1565c0;
  --focus: #ff9800;
  --appbar: #1565c0;
  --on-appbar: #ffffff;
  /* duplex regions (RIMap-RISC Fig. 2 convention) */
  --seed: #212121;
  --supp: #2e7d32;
  --tail: #00838f;
  --other: #9e9e9e;
  --target: #c62828;
  --avatar-0: #1976d2; --avatar-1: #2e7d32; --avatar-2: #6a1b9a;
  --avatar-3: #ad1457; --avatar-4: #00838f; --avatar-5: #ef6c00;

  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s6: 48px; --s8: 64px;
  --radius: 4px;
  --elev-1: 0 2px 1px -1px rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 3px 0 rgba(0,0,0,.12);
  --elev-2: 0 3px 3px -2px rgba(0,0,0,.2), 0 3px 4px 0 rgba(0,0,0,.14), 0 1px 8px 0 rgba(0,0,0,.12);
  --elev-4: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --maxw: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #90caf9;
    --primary-strong: #bbdefb;
    --on-primary: rgba(0, 0, 0, 0.87);
    --bg: #121212;
    --surface: #1e1e1e;
    --surface-2: #262626;
    --text: #ffffff;
    --text-2: rgba(255, 255, 255, 0.72);
    --divider: rgba(255, 255, 255, 0.14);
    --link: #90caf9;
    --appbar: #272727;
    --on-appbar: #ffffff;
    --seed: #eeeeee;
    --supp: #81c784;
    --tail: #4dd0e1;
    --other: #9e9e9e;
    --target: #ef9a9a;
    --avatar-0: #1565c0; --avatar-1: #2e7d32; --avatar-2: #6a1b9a;
    --avatar-3: #ad1457; --avatar-4: #00695c; --avatar-5: #e65100;
    --elev-1: 0 1px 3px rgba(0,0,0,.6);
    --elev-2: 0 2px 6px rgba(0,0,0,.6);
    --elev-4: 0 4px 10px rgba(0,0,0,.6);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1rem/1.6 var(--font);
  overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 var(--s2); font-weight: 700; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 var(--s2); }
.muted { color: var(--text-2); }
.center { text-align: center; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: var(--s2); top: -100px; z-index: 10;
  background: var(--surface); color: var(--text); padding: var(--s1) var(--s2); }
.skip:focus { top: var(--s1); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s2); }
main { padding: var(--s4) 0 var(--s8); }
section { margin-bottom: var(--s6); }
.section-title { text-align: center; margin-bottom: var(--s3); }

/* ---------- app bar ---------- */
.appbar { background: var(--appbar); color: var(--on-appbar); box-shadow: var(--elev-4);
  position: sticky; top: 0; z-index: 5; }
.appbar .container { display: flex; align-items: center; gap: var(--s2); min-height: 64px; }
.brand { color: inherit; text-decoration: none; font-weight: 700; font-size: 1.15rem;
  display: flex; align-items: center; gap: var(--s1); margin-right: auto; }
.brand small { font-weight: 400; font-size: .85rem; }
.nav ul { list-style: none; display: flex; gap: var(--s1); margin: 0; padding: 0; }
.nav a, .lang-switch { color: inherit; text-decoration: none; padding: 6px 10px;
  border-radius: var(--radius); font-weight: 500; letter-spacing: .02em; display: inline-block; }
.nav a:hover, .lang-switch:hover { background: rgba(255,255,255,.12); }
.nav a[aria-current="page"] { background: rgba(0,0,0,.25); text-decoration: underline;
  text-underline-offset: 4px; }
.lang-switch { border: 1px solid rgba(255,255,255,.5); font-size: .9rem; }
.menu-toggle { display: none; }
.nav-details summary { list-style: none; cursor: pointer; padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.5); border-radius: var(--radius); }
.nav-details summary::-webkit-details-marker { display: none; }
.nav-details { display: contents; }
.nav-details > summary { display: none; }

@media (max-width: 800px) {
  .appbar .container { flex-wrap: wrap; }
  .nav-details { display: block; order: 3; width: 100%; }
  .nav-details > summary { display: inline-block; margin-bottom: var(--s1); }
  .nav-details:not([open]) .nav { display: none; }
  .nav ul { flex-direction: column; padding-bottom: var(--s1); }
  .brand small { display: none; }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px;
  border-radius: var(--radius); font-weight: 500; text-transform: uppercase;
  letter-spacing: .04em; font-size: .875rem; text-decoration: none; line-height: 1.75;
  border: 1px solid transparent; }
.btn-contained { background: var(--primary); color: var(--on-primary); box-shadow: var(--elev-2); }
.btn-contained:hover { background: var(--primary-strong); }
.btn-outlined { border-color: var(--primary); color: var(--primary); }
.btn-text { color: var(--primary); padding-left: 8px; padding-right: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: auto; padding-top: var(--s2); }

/* ---------- cards & grids ---------- */
.grid { display: grid; gap: var(--s3);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--elev-1);
  padding: var(--s3); display: flex; flex-direction: column; min-width: 0; }
.card h3 { margin-bottom: var(--s1); }
.card .media { margin: calc(-1 * var(--s3)) calc(-1 * var(--s3)) var(--s2);
  background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden; display: flex; justify-content: center; align-items: center;
  aspect-ratio: 16 / 9; }
.card .media img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px;
  border-radius: 12px; border: 1px solid currentColor; color: var(--text-2);
  margin-bottom: var(--s1); align-self: flex-start; }
.badge-online-lab, .badge-online-external { color: #2e7d32; }
.badge-planned { color: #a84300; }
@media (prefers-color-scheme: dark) {
  .badge-online-lab, .badge-online-external { color: #81c784; }
  .badge-planned { color: #ffb74d; }
}

/* ---------- hero ---------- */
.hero { text-align: center; padding: var(--s4) 0 var(--s2); }
.hero h1 { margin-bottom: var(--s1); }
.hero .tagline { color: var(--text-2); font-size: 1.15rem; margin-bottom: var(--s3); }
.lead { font-size: clamp(1.15rem, 2.4vw, 1.45rem); font-weight: 500; max-width: 46rem;
  margin: 0 auto var(--s1); }
.lead-source { font-size: .9rem; }
.hero-visual { margin: var(--s4) auto 0; display: flex; flex-wrap: wrap; gap: var(--s3);
  justify-content: center; align-items: center; }
.hero-figure { background: var(--surface); border-radius: var(--radius); box-shadow: var(--elev-1);
  padding: var(--s2); margin: 0; max-width: 100%; overflow-x: auto; }
.hero-figure:focus-visible { outline: 3px solid var(--focus); }
.hero-figure figcaption { font-size: .9rem; color: var(--text-2); margin-top: var(--s1);
  text-align: left; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s2); padding: 0;
  margin: var(--s1) 0 0; font-size: .85rem; color: var(--text-2); justify-content: center; }
.legend li::before { content: ""; display: inline-block; width: 12px; height: 12px;
  border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.legend .seed { --c: var(--seed); } .legend .supp { --c: var(--supp); }
.legend .tail { --c: var(--tail); } .legend .other { --c: var(--other); }
.legend .target { --c: var(--target); }

/* duplex SVG */
svg.duplex { display: block; margin: 0 auto; max-width: none; }
svg.duplex .arc { fill: none; stroke-width: 2; }
svg.duplex .arc.seed { stroke: var(--seed); }
svg.duplex .arc.supp { stroke: var(--supp); }
svg.duplex .arc.tail { stroke: var(--tail); }
svg.duplex .arc.other, svg.duplex .arc.target { stroke: var(--other); }
svg.duplex text { font: 600 13px var(--mono); text-anchor: middle; }
svg.duplex .nt.seed { fill: var(--seed); } svg.duplex .nt.supp { fill: var(--supp); }
svg.duplex .nt.tail { fill: var(--tail); } svg.duplex .nt.other { fill: var(--other); }
svg.duplex .nt.target { fill: var(--target); }
svg.duplex .strand { font: 500 12px var(--font); fill: var(--text-2); text-anchor: start; }

/* avatars */
svg.avatar { width: 72px; height: 72px; flex: none; }
svg.avatar text { font: 600 34px var(--font); fill: #fff; }
.avatar-0 circle { fill: var(--avatar-0); } .avatar-1 circle { fill: var(--avatar-1); }
.avatar-2 circle { fill: var(--avatar-2); } .avatar-3 circle { fill: var(--avatar-3); }
.avatar-4 circle { fill: var(--avatar-4); } .avatar-5 circle { fill: var(--avatar-5); }
.person { display: flex; gap: var(--s2); align-items: center; }
.person img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: none; }
.person p { margin: 0; }

/* ---------- content blocks ---------- */
.prose { max-width: 48rem; }
.prose.center-block { margin: 0 auto; }
.programme { background: var(--surface); border-radius: var(--radius); box-shadow: var(--elev-1);
  padding: var(--s3); }
.figure-credit { font-size: .8rem; color: var(--text-2); margin-top: var(--s1); }
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub-list li { padding: var(--s1) 0 var(--s2); border-bottom: 1px solid var(--divider); }
.pub-title { font-weight: 600; }
.pub-meta { color: var(--text-2); font-size: .95rem; }
.pub-links { font-size: .9rem; display: flex; flex-wrap: wrap; gap: var(--s2); }
.year-index { display: flex; flex-wrap: wrap; gap: var(--s1); list-style: none; padding: 0;
  margin: 0 0 var(--s3); }
.year-index a { display: inline-block; padding: 2px 10px; border-radius: 14px;
  border: 1px solid var(--divider); text-decoration: none; }
.year { scroll-margin-top: 80px; }
details.collapsible { background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--elev-1); padding: var(--s2) var(--s3); }
details.collapsible summary { cursor: pointer; font-weight: 600; }
.dl-list { padding-left: 1.2em; }
.archive-entry { scroll-margin-top: 80px; }
.notice { max-width: 40rem; margin: var(--s6) auto; text-align: center; }
.timeline { list-style: none; padding: 0; border-left: 2px solid var(--primary); }
.timeline li { padding: 0 0 var(--s2) var(--s3); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .5em; width: 12px;
  height: 12px; border-radius: 50%; background: var(--primary); }

/* ---------- footer ---------- */
.footer { background: var(--surface); border-top: 1px solid var(--divider); padding: var(--s4) 0;
  font-size: .95rem; }
.footer .cols { display: grid; gap: var(--s3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.footer h2 { font-size: 1rem; margin-bottom: var(--s1); }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer address { font-style: normal; }
.funders { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center;
  margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--divider); }
.funders img { height: 48px; width: auto; background: #fff; padding: 4px; border-radius: 2px; }

/* spacing utilities (no inline styles: CSP style-src 'self') */
.m-0 { margin: 0; } .mt-2 { margin-top: var(--s2); } .mt-3 { margin-top: var(--s3); }
.mt-4 { margin-top: var(--s4); } .mt-6 { margin-top: var(--s6); }
.mb-2 { margin-bottom: var(--s2); } .mb-3 { margin-bottom: var(--s3); }
.lead-left { margin-left: 0; text-align: left; }

.logos { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; margin-top: var(--s3); }
.logos img { height: 56px; width: auto; background: #fff; padding: 4px; border-radius: 2px; }
details.addresses { margin-top: var(--s2); }
details.addresses summary { cursor: pointer; }
details.addresses h3 { font-size: .95rem; margin: var(--s2) 0 var(--s1); }

/* code from legacy install instructions: scroll inside the block, never the page */
pre { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; background: var(--surface-2); padding: var(--s1) var(--s2);
  border-radius: var(--radius); }
code { overflow-wrap: anywhere; }
.grid + h3, .grid + h2 { margin-top: var(--s4); }
