/* NEXUS website · Direction C "Swiss precision, field notebook"
   Near-monochrome, one signal colour, hairline rules, mono data labels.
   BiVO4 yellow is used only inside scientific illustrations. */

/* ---------- Tokens ---------- */
:root {
  --paper: #faf9f6;
  --paper-2: #f2f0ea;
  --paper-3: #e8e5dd;
  --ink: #15171c;
  --ink-2: #353b40;
  --muted: #5e6266;
  --rule: #dddad2;
  --signal: #d52b1e;          /* signal red = the logo's Swiss red, 4.9:1 on white */
  --signal-soft: #fbe9e7;
  --bivo4: #f0bf2c;           /* illustration only, never for text */
  --glass: #dfe5e8;

  --font-sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-tex: "STIX Two Text", "Latin Modern Roman", "CMU Serif", "Computer Modern Serif", Georgia, serif;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: 1.375rem;
  --step-3: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem);
  --step-4: clamp(2.1rem, 1.4rem + 3vw, 3.4rem);
  --step-5: clamp(2.5rem, 1.5rem + 4.4vw, 4.6rem);

  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1320px;
  --header-h: 64px;
  --radius: 2px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* surfaces and states (light) */
  --header-bg: rgba(250, 249, 246, .94);
  --hatch: rgba(0, 0, 0, .045);
  --label-bg: rgba(255, 255, 255, .88);
  --flag-outline: rgba(0, 0, 0, .25);
  --on-signal: #ffffff;
  --on-ink-muted: #d6d6d6;
  --on-ink-accent: #ff9c92;
  --water: #eef2f3;
  --metal: #9aa0a3;
  /* map (light) */
  --sea: #f6f7f7;
  --land: #e2e2dc;
  --land-border: #ffffff;
  --grat: #e2e4e4;
  --grat-strong: #b9bdbd;
  --hl-hover: #444444;
  --sea-label: #a3a8a8;
  /* inverse panels: footer, code, pop-ups (light) */
  --inverse-bg: #111111;
  --inverse-fg: #e9e9e9;
  --inverse-muted: #a8a8a8;
  --inverse-rule: #3a3a3a;
  --inverse-accent: #ff9c92;
  --inverse-strong: #ffffff;
  /* the three labs (light): Switzerland red, Malaysia blue, Philippines DLSU green (as on dlsu.edu.ph) */
  --ch: #d52b1e; --ch-ink: #c0261c; --ch-tint: #fbe9e7; --on-ch: #ffffff;
  --my: #1d4f9c; --my-ink: #1d4f9c; --my-tint: #e7edf7; --on-my: #ffffff;
  --ph: #006936; --ph-ink: #006936; --ph-tint: #e3f1e8; --on-ph: #ffffff;
  --live: #1f9d55;            /* status dot in the clock badge */
  --sun: #dea000;             /* 'sunlight' in the home headline; display sizes only */
  --logo-dot: #4a4d53;       /* rising dots in the NEXUS logo (brand/nexus-logo) */
  --plate: #ffffff;          /* behind official partner logos, in both themes */
}

/* Dark theme: follows the system setting unless the viewer chose light; explicit dark wins too */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111315;
    --paper-2: #171a1c;
    --paper-3: #20252a;
    --ink: #ecebe6;
    --ink-2: #c7c6c0;
    --muted: #969a9c;
    --rule: #2c3236;
    --signal: #ff5b4d;
    --signal-soft: #3a1714;
    --glass: #3a4650;
    --header-bg: rgba(17, 19, 21, .92);
    --hatch: rgba(255, 255, 255, .05);
    --label-bg: rgba(17, 19, 21, .86);
    --flag-outline: rgba(255, 255, 255, .3);
    --on-signal: #ffffff;
    --on-ink-muted: #444444;
    --on-ink-accent: #b3261e;
    --water: #182429;
    --metal: #6d757a;
    --sea: #0d1214;
    --land: #262b2e;
    --land-border: #0d1214;
    --grat: #1b2226;
    --grat-strong: #3b464b;
    --hl-hover: #c9c8c2;
    --sea-label: #5d6a70;
    --inverse-bg: #08090a;
    --inverse-fg: #d9d9d4;
    --inverse-muted: #8f9396;
    --inverse-rule: #24292c;
    --inverse-accent: #ff8a7d;
    --inverse-strong: #ffffff;
    --ch: #ff6355; --ch-ink: #ff7a6e; --ch-tint: #3a1714; --on-ch: #14181c;
    --logo-dot: #8a8d93;
    --my: #6f9deb; --my-ink: #8db3f2; --my-tint: #14213a; --on-my: #0e1114;
    --ph: #3dbb78; --ph-ink: #5fcf93; --ph-tint: #0f2a1d; --on-ph: #0c1a12;
    --live: #3dbb78;
    --sun: #f2c14a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #111315;
  --paper-2: #171a1c;
  --paper-3: #20252a;
  --ink: #ecebe6;
  --ink-2: #c7c6c0;
  --muted: #969a9c;
  --rule: #2c3236;
  --signal: #ff5b4d;
  --signal-soft: #3a1714;
  --glass: #3a4650;
  --header-bg: rgba(17, 19, 21, .92);
  --hatch: rgba(255, 255, 255, .05);
  --label-bg: rgba(17, 19, 21, .86);
  --flag-outline: rgba(255, 255, 255, .3);
  --on-signal: #ffffff;
  --on-ink-muted: #444444;
  --on-ink-accent: #b3261e;
  --water: #182429;
  --metal: #6d757a;
  --sea: #0d1214;
  --land: #262b2e;
  --land-border: #0d1214;
  --grat: #1b2226;
  --grat-strong: #3b464b;
  --hl-hover: #c9c8c2;
  --sea-label: #5d6a70;
  --inverse-bg: #08090a;
  --inverse-fg: #d9d9d4;
  --inverse-muted: #8f9396;
  --inverse-rule: #24292c;
  --inverse-accent: #ff8a7d;
  --inverse-strong: #ffffff;
  --ch: #ff6355; --ch-ink: #ff7a6e; --ch-tint: #3a1714; --on-ch: #14181c;
  --logo-dot: #8a8d93;
  --my: #6f9deb; --my-ink: #8db3f2; --my-tint: #14213a; --on-my: #0e1114;
  --ph: #3dbb78; --ph-ink: #5fcf93; --ph-tint: #0f2a1d; --on-ph: #0c1a12;
  --live: #3dbb78;
  --sun: #f2c14a;
  color-scheme: dark;
}


/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: var(--step-5); line-height: 1.04; letter-spacing: -0.03em; }
h2 { font-size: var(--step-4); line-height: 1.08; letter-spacing: -0.025em; }
h3 { font-size: var(--step-2); line-height: 1.25; }
h4 { font-size: var(--step-1); line-height: 1.3; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; }
sub, sup { line-height: 0; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--inverse-bg); color: var(--inverse-strong); padding: 10px 14px; text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--inverse-strong); }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.mono { font-family: var(--font-mono); }
.eyebrow {
  font-family: var(--font-mono); font-size: var(--step--1); letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 14px;
}
.eyebrow b { color: var(--ink); font-weight: 500; }
.lead { font-size: var(--step-1); color: var(--ink-2); max-width: 60ch; }
.muted { color: var(--muted); }
.signal { color: var(--signal); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex-shrink: 1; min-width: 0; }
.brand:hover { color: var(--ink); }
.brand img { height: 32px; width: auto; }
.nav { margin-left: auto; }
.nav ul { list-style: none; padding: 0; display: flex; gap: 2px; }
.nav a {
  display: block; padding: 8px 10px; font-size: .94rem; text-decoration: none; color: var(--ink-2); white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--rule); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--signal); }
.clock-badge {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .05em; white-space: nowrap;
  border: 1px solid var(--ink); padding: 5px 8px; color: var(--ink);
}
.clock-badge .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--live); margin-right: 6px; vertical-align: 1px; animation: blink 2.4s infinite; }
@keyframes blink { 0%, 60% { opacity: 1; } 80% { opacity: .2; } 100% { opacity: 1; } }
.menu-toggle {
  display: none; margin-left: auto; background: none; border: 1px solid var(--ink);
  padding: 8px 12px; font-family: var(--font-mono); font-size: .78rem; letter-spacing: .06em; cursor: pointer;
}

@media (max-width: 1180px) {
  .clock-badge { display: none; }
}
@media (max-width: 560px) {
  .brand { gap: 10px; }
  .brand img { height: 28px; }
  .menu-toggle { padding: 8px 10px; flex-shrink: 0; }
}
@media (max-width: 980px) {
  .menu-toggle { display: inline-flex; align-items: center; gap: 8px; }
  .nav {
    position: absolute; top: 100%; left: 0; right: 0;
    height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h));
    background: var(--paper);
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
    overflow-y: auto; border-top: 1px solid var(--rule);
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav ul { flex-direction: column; padding: 8px var(--gutter) 40px; gap: 0; }
  .nav a { font-size: 1.5rem; padding: 14px 0; border-bottom: 1px solid var(--rule); font-weight: 500; }
  .nav a[aria-current="page"] { border-bottom-color: var(--rule); color: var(--signal); }
  body.nav-open { overflow: hidden; }
}

/* ---------- Sections ---------- */
.section { padding-block: clamp(56px, 8vw, 112px); }
.section--alt { background: var(--paper-2); }
.section--ink { background: var(--inverse-bg); color: var(--inverse-strong); }
.section--ink .eyebrow, .section--ink .muted { color: var(--inverse-muted); }
.section--ink a:hover { color: var(--inverse-accent); }
.section-head {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: 24px;
  border-top: 1px solid currentColor; padding-top: 18px; margin-bottom: clamp(32px, 4vw, 56px);
}
.section-head .index { font-family: var(--font-mono); font-size: var(--step--1); letter-spacing: .06em; text-transform: uppercase; }
.section-head h2 { max-width: 22ch; }
.section-head p { margin-top: 16px; max-width: 62ch; color: var(--ink-2); font-size: var(--step-1); }
.section--ink .section-head p { color: var(--inverse-fg); }
@media (max-width: 720px) {
  .section-head { grid-template-columns: 1fr; gap: 10px; }
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 3vw, 48px); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 2.4vw, 32px); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Page hero (inner pages) ---------- */
.page-hero { padding-block: clamp(48px, 7vw, 96px) clamp(32px, 4vw, 56px); border-bottom: 1px solid var(--rule); }
.page-hero h1 { font-size: var(--step-4); max-width: 18ch; }
.page-hero .lead { margin-top: 20px; }
.crumbs { font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 22px; }
.crumbs a { text-decoration: none; }

/* ---------- Buttons and chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
  padding: 12px 18px; font-size: .95rem; font-weight: 500; text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn .arrow { font-family: var(--font-mono); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font-mono); font-size: .76rem; letter-spacing: .05em; text-transform: uppercase;
  background: transparent; border: 1px solid var(--rule); padding: 7px 11px; cursor: pointer; color: var(--ink-2);
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.tag {
  display: inline-block; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid currentColor; padding: 2px 7px; line-height: 1.5;
}
.tag--signal { color: var(--signal); }

/* ---------- Placeholders (photos and logos still to be supplied) ---------- */
.ph {
  position: relative; background-color: var(--paper-3);
  background-image: repeating-linear-gradient(135deg, transparent 0 10px, var(--hatch) 10px 11px);
  display: flex; align-items: flex-end; min-height: 120px; overflow: hidden;
}
.ph[data-ratio="4:3"] { aspect-ratio: 4 / 3; }
.ph[data-ratio="3:2"] { aspect-ratio: 3 / 2; }
.ph[data-ratio="1:1"] { aspect-ratio: 1 / 1; }
.ph[data-ratio="16:9"] { aspect-ratio: 16 / 9; }
.ph-label {
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-2); background: var(--label-bg); padding: 6px 8px; margin: 10px; max-width: calc(100% - 20px);
}
.logo-slot {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 72px;
  border: 1px dashed var(--muted); padding: 10px 14px;
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.section--ink .logo-slot, .site-footer .logo-slot { border-color: var(--inverse-muted); color: var(--inverse-muted); }

/* ---------- Reveal on scroll ---------- */
.reveal { transform: translateY(12px); transition: transform .8s var(--ease); }
.reveal.is-in { transform: none; }
.no-js .reveal { transform: none; }

/* ---------- Home hero ---------- */
.hero { padding-block: clamp(36px, 6vw, 80px) clamp(40px, 6vw, 88px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: clamp(28px, 4vw, 64px); align-items: start; }
.hero h1 { max-width: 13ch; }
.hero h1 em { font-style: normal; color: var(--ph); }
.hero h1 .sun { color: var(--sun); }
.hero .lead { margin-top: 24px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 28px; font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted); letter-spacing: .03em; }
.hero-meta span::before { content: "■ "; color: var(--signal); font-size: .7em; vertical-align: 1px; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: 1fr; } .hero h1 { max-width: 16ch; } }

/* Figure panel (field-notebook figure) */
.fig { border: 1px solid var(--ink); background: var(--paper); }
.fig-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  border-bottom: 1px solid var(--ink); padding: 10px 14px;
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .05em; text-transform: uppercase;
}
.fig-body { padding: 14px; }
.fig-caption { border-top: 1px solid var(--rule); padding: 10px 14px; font-size: .84rem; color: var(--muted); line-height: 1.45; }
.fig-caption b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); font-size: .74rem; letter-spacing: .05em; }

.switch {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer; background: none; border: 1px solid var(--ink);
  padding: 5px 10px 5px 6px; font-family: var(--font-mono); font-size: .74rem; letter-spacing: .05em; text-transform: uppercase;
}
.switch .track { width: 34px; height: 18px; border: 1px solid var(--ink); position: relative; background: var(--paper); transition: background .2s; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; background: var(--ink); transition: transform .25s var(--ease), background .2s; }
.switch[aria-pressed="true"] .track { background: var(--bivo4); }
.switch[aria-pressed="true"] .knob { transform: translateX(16px); }

.plot { width: 100%; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.plot .axis { stroke: var(--ink); stroke-width: 1; }
.plot .grid { stroke: var(--rule); stroke-width: 1; }
.plot .tick { font-family: var(--font-mono); font-size: 14px; fill: var(--muted); }
.plot .axis-label { font-family: var(--font-mono); font-size: 13px; fill: var(--ink); letter-spacing: .03em; }
.plot .dark-curve { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.plot .light-curve { fill: none; stroke: var(--ink); stroke-width: 2.25; transition: opacity .3s; }
.plot .target { fill: none; stroke: var(--signal); stroke-width: 1.5; }
.plot .target-label { font-family: var(--font-mono); font-size: 14px; fill: var(--signal); letter-spacing: .02em; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; }
.plot .cursor-line { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; }
.plot .cursor-dot { fill: var(--signal); stroke: var(--paper); stroke-width: 2; }
.plot .sun-glow { fill: var(--bivo4); opacity: 0; transition: opacity .4s; }
.plot.is-light .sun-glow { opacity: .14; }
.plot .electrode-glass { fill: var(--glass); stroke: var(--ink); stroke-width: 1; }
.plot .electrode-film { fill: var(--bivo4); stroke: var(--ink); stroke-width: 1; }
.plot .bubble { fill: none; stroke: var(--ink); stroke-width: 1; }

.readout { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--rule); }
.readout div { padding: 10px 14px; border-right: 1px solid var(--rule); }
.readout div:last-child { border-right: 0; }
.readout dt { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.readout dd { margin: 2px 0 0; font-family: var(--font-mono); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.range-wrap { padding: 4px 14px 14px; }
.range-wrap label { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 4px; }
input[type="range"] { width: 100%; accent-color: var(--signal); }

/* ---------- Sunlight strip ---------- */
.sunstrip { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.sunstrip-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.sunstrip-head h2 { font-size: var(--step-2); letter-spacing: -0.01em; }
.sunstrip-head .mono { font-size: var(--step--1); color: var(--muted); }
.suns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sun-card { padding: 18px 20px 20px 0; border-right: 1px solid var(--rule); }
.sun-card + .sun-card { padding-left: 20px; }
.sun-card:last-child { border-right: 0; }
.sun-card .place .flag-mini { display: inline-block; vertical-align: -1px; margin-right: 4px; }
.sun-card .place { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sun-card .time { font-family: var(--font-mono); font-size: clamp(1.6rem, 1rem + 2vw, 2.4rem); font-variant-numeric: tabular-nums; line-height: 1.1; margin: 6px 0 4px; }
.sun-card .state { font-size: .92rem; display: flex; align-items: center; gap: 8px; }
.sun-card .state i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--ink); display: inline-block; }
.sun-card[data-state="day"] .state i { background: var(--bivo4); }
.sun-card[data-state="twilight"] .state i { background: linear-gradient(90deg, var(--bivo4) 50%, var(--paper) 50%); }
.sun-card .inst { font-size: .86rem; color: var(--muted); margin-top: 2px; }
.daybar { position: relative; height: 10px; margin-top: 14px; background: var(--paper-3); border: 1px solid var(--ink); overflow: hidden; }
.daybar .day { position: absolute; top: 0; bottom: 0; background: var(--bivo4); }
.daybar .now { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--signal); }
.daybar-scale { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: .62rem; color: var(--muted); margin-top: 4px; }
@media (max-width: 720px) {
  .suns { grid-template-columns: 1fr; }
  .sun-card, .sun-card + .sun-card { padding: 16px 0; border-right: 0; border-bottom: 1px solid var(--rule); }
  .sun-card:last-child { border-bottom: 0; }
}

/* ---------- Highlight cards ---------- */
.hcard { border-top: 1px solid var(--ink); padding-top: 18px; }
.hcard .num { font-family: var(--font-mono); font-size: var(--step--1); color: var(--signal); letter-spacing: .06em; }
.hcard h3 { margin: 10px 0 10px; }
.hcard p { color: var(--ink-2); margin: 0; }
.hcard svg { width: 56px; height: 40px; margin-top: 18px; }
.hcard svg * { fill: none; stroke: var(--ink); stroke-width: 1.4; }

/* ---------- Explainer ---------- */
.explainer { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
@media (max-width: 960px) { .explainer { grid-template-columns: 1fr; } }
.ex-svg { width: 100%; height: auto; }
.ex-svg text { font-family: var(--font-mono); font-size: 14px; fill: var(--ink); letter-spacing: .02em; }
.ex-svg .tank { fill: var(--water); stroke: var(--ink); stroke-width: 1.2; }
.ex-svg .water-line { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 4; }
.ex-svg .glass { fill: var(--glass); stroke: var(--ink); }
.ex-svg .film { fill: var(--bivo4); stroke: var(--ink); }
.ex-svg .cathode { fill: var(--metal); stroke: var(--ink); }
.ex-svg .wire { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.ex-svg .ray { stroke: var(--bivo4); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 8 10; }
.ex-svg .sun { fill: var(--bivo4); stroke: var(--ink); }
.ex-svg .electron { fill: var(--ink); }
.ex-svg .hole { fill: var(--paper); stroke: var(--signal); stroke-width: 1.5; }
.ex-svg .o2 { fill: none; stroke: var(--signal); stroke-width: 1.2; }
.ex-svg .h2 { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.ex-svg .lbl-signal { fill: var(--signal); }
.ex-svg .part { transition: opacity .45s var(--ease); }
.ex-svg[data-step] .part { opacity: .16; }
.ex-svg[data-step="1"] .s1, .ex-svg[data-step="2"] .s2, .ex-svg[data-step="3"] .s3, .ex-svg[data-step="4"] .s4 { opacity: 1; }
.ex-svg .always { opacity: 1 !important; }
.ex-svg .ray { animation: rayflow 1.1s linear infinite; }
@keyframes rayflow { to { stroke-dashoffset: -18; } }
.ex-svg .rise { animation: rise 2.6s linear infinite; }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-120px); opacity: 0; } }

.ex-steps { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--ink); }
.ex-steps button {
  width: 100%; background: var(--paper); border: 0; border-right: 1px solid var(--ink); padding: 10px 8px; cursor: pointer;
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; text-align: left;
}
.ex-steps li:last-child button { border-right: 0; }
.ex-steps button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.ex-steps button .n { display: block; font-size: 1.1rem; }
.ex-panel h3 { font-size: var(--step-3); margin-bottom: 12px; }
.ex-panel .eq { font-family: var(--font-mono); background: var(--paper-2); border-left: 3px solid var(--signal); padding: 10px 14px; margin: 16px 0; font-size: .95rem; overflow-x: auto; white-space: nowrap; }
.ex-panel .where { border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 18px; font-size: .92rem; color: var(--ink-2); }
.ex-panel .where b { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; display: block; color: var(--muted); font-weight: 400; margin-bottom: 4px; }
.ex-controls { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.no-js .ex-step-text[hidden] { display: block; }
.no-js .ex-controls, .no-js .ex-steps { display: none; }
.ex-progress { height: 2px; background: var(--rule); margin-top: 18px; overflow: hidden; }
.ex-progress span { display: block; height: 100%; width: 0; background: var(--signal); }

/* ---------- Network map ---------- */
.network { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.network > *, .network-detail > * { min-width: 0; }
.node-tabs .chip span { overflow-wrap: anywhere; }
.network-detail { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(20px, 3vw, 48px); align-items: start; }
@media (max-width: 860px) { .network-detail { grid-template-columns: 1fr; } }
.map-scroll { padding: 0; overflow: hidden; }
.map-svg { width: 100%; height: auto; display: block; }
.map-svg .sea { fill: var(--sea); }
.map-svg .grat polyline { fill: none; stroke: var(--grat); stroke-width: .8; }
.map-svg .grat .equator { stroke: var(--grat-strong); stroke-dasharray: 2 5; }
.map-svg .land path { fill: var(--land); stroke: var(--land-border); stroke-width: .7; stroke-linejoin: round; }
.map-svg .land-hl { fill: var(--ink); stroke: var(--land-border); stroke-width: .6; cursor: pointer; transition: fill .25s; }
.map-svg .land-hl:hover { filter: brightness(1.08); }
.map-svg .land-hl.is-active { filter: saturate(1.15); }
.map-svg .sea-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: .28em; fill: var(--sea-label); }
.map-svg .route { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: 6 6; animation: route 2.4s linear infinite; }
@keyframes route { to { stroke-dashoffset: -24; } }
.map-svg .dist { font-family: var(--font-mono); font-size: 15px; fill: var(--ink); paint-order: stroke; stroke: var(--sea); stroke-width: 5px; stroke-linejoin: round; }
.map-svg .node { cursor: pointer; }
.map-svg .node:focus { outline: none; }
.map-svg .stem { stroke: var(--ink); stroke-width: 1.3; }
.map-svg .ring { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; }
.map-svg .core { fill: var(--ink); }
.map-svg .pulse { fill: none; stroke: var(--signal); stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.map-svg .node.is-active .pulse { animation: pulse 2s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(4); opacity: 0; } }
.map-svg .node.is-active .core { fill: var(--signal); }
.map-svg .node.is-active .ring { stroke: var(--signal); }
.map-svg .flag-shadow { fill: rgba(0, 0, 0, .16); }
.map-svg .flag-frame { fill: none; stroke: var(--ink); stroke-width: 1; }
.map-svg .node.is-active .flag-frame { stroke: var(--signal); stroke-width: 3; }
.map-svg .node:hover .flag-frame, .map-svg .node:focus-visible .flag-frame { stroke-width: 2.5; }
.map-svg .city { font-family: var(--font-mono); font-size: 14px; font-weight: 500; letter-spacing: .08em; fill: var(--ink); paint-order: stroke; stroke: var(--sea); stroke-width: 5px; stroke-linejoin: round; }
.map-svg .inst { font-family: var(--font-sans); font-size: 14px; fill: var(--ink-2); paint-order: stroke; stroke: var(--sea); stroke-width: 5px; stroke-linejoin: round; }
.map-svg .node.is-active .city { fill: var(--signal); }
.map-svg .inset { cursor: pointer; }
.map-svg .inset-box { fill: var(--paper); stroke: var(--ink); stroke-width: 1.2; }
.map-svg .inset-title { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; fill: var(--muted); }
.map-svg .inset-city { font-family: var(--font-sans); font-size: 13px; fill: var(--ink); }
.map-svg .leader { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; }
.map-svg .lens { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 3 3; }
.map-svg .credit { font-family: var(--font-mono); font-size: 10px; fill: var(--sea-label); letter-spacing: .05em; }
.node-panel { border-top: 1px solid var(--ink); padding-top: 16px; }
.node-panel .role { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--signal); display: flex; align-items: center; gap: 10px; }
.node-panel h3 { margin: 6px 0 10px; }
.node-panel dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 14px 0 0; font-size: .92rem; }
.node-panel dt { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.node-panel dd { margin: 0; }
.node-tabs { display: flex; flex-direction: column; gap: 8px; }
.node-tabs .chip { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; }
.flag-mini { flex-shrink: 0; outline: 1px solid var(--flag-outline); outline-offset: 0; }
@media (max-width: 860px) { .node-tabs { flex-direction: row; flex-wrap: wrap; } }
@media (max-width: 720px) {
  .map-scroll { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .map-svg { width: 760px; max-width: none; }
}
@media (min-width: 721px) { .map-hint { display: none; } }

/* ---------- Work plan timeline ---------- */
.tl { border: 1px solid var(--ink); }
.tl-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--ink); font-family: var(--font-mono); font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; }
.tl-track { position: relative; padding: 46px 14px 14px; }
.tl-months { position: relative; height: 18px; display: grid; grid-template-columns: repeat(24, 1fr); font-family: var(--font-mono); font-size: .6rem; color: var(--muted); }
.tl-months span { border-left: 1px solid var(--rule); padding-left: 2px; }
.tl-bars { position: relative; display: grid; grid-template-columns: repeat(24, 1fr); gap: 0; margin-top: 6px; }
.tl-bar {
  appearance: none; border: 1px solid var(--ink); background: var(--paper); text-align: left; cursor: pointer;
  padding: 12px 10px; min-height: 64px; font-family: var(--font-mono); font-size: .74rem; letter-spacing: .04em; text-transform: uppercase;
  transition: background .15s, color .15s; margin-right: -1px;
}
.tl-bar small { display: block; text-transform: none; letter-spacing: 0; font-family: var(--font-sans); font-size: .84rem; margin-top: 4px; color: var(--ink-2); }
.tl-bar:hover { background: var(--paper-2); }
.tl-bar[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.tl-bar[aria-pressed="true"] small { color: var(--on-ink-muted); }
.tl-ms { position: relative; height: 44px; margin-top: 10px; }
.tl-ms button {
  position: absolute; top: 0; transform: translateX(-50%); background: none; border: 0; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: .66rem; color: var(--ink);
}
.tl-ms button::before { content: ""; width: 12px; height: 12px; background: var(--paper); border: 1.5px solid var(--ink); transform: rotate(45deg); }
.tl-ms button[aria-pressed="true"]::before, .tl-ms button:hover::before { background: var(--signal); border-color: var(--signal); }
.tl-today { position: absolute; top: 34px; bottom: 6px; width: 0; border-left: 2px solid var(--signal); pointer-events: none; }
.tl-today span { position: absolute; top: -26px; left: -1px; transform: translateX(-50%); white-space: nowrap; background: var(--signal); color: var(--on-signal); font-family: var(--font-mono); font-size: .64rem; letter-spacing: .05em; padding: 3px 6px; text-transform: uppercase; }
.tl-detail { border-top: 1px solid var(--ink); padding: 16px 14px 18px; min-height: 120px; }
.tl-detail .when { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; color: var(--signal); }
.tl-detail h3 { margin: 6px 0 8px; font-size: var(--step-2); }
.tl-detail p { margin: 0; color: var(--ink-2); max-width: 70ch; }
@media (max-width: 720px) {
  .tl-months span:nth-child(even) { color: transparent; }
  .tl-bar { padding: 10px 6px; font-size: .68rem; min-height: 56px; }
  .tl-bar small { display: none; }
  .tl-ms button span.lbl { display: none; }
}

/* ---------- Cards: news, people, institutions, facilities ---------- */
.news-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--ink); }
.news-item { border-bottom: 1px solid var(--rule); padding: 20px 0; display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 20px; }
.news-item time { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); letter-spacing: .04em; padding-top: 4px; }
.news-item h3 { font-size: var(--step-2); margin: 8px 0 8px; }
.news-item p { margin: 0; color: var(--ink-2); }
.news-item .more { margin-top: 10px; }
.news-item .body { margin-top: 12px; color: var(--ink-2); }
.news-item .body[hidden] { display: none; }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; font-family: var(--font-mono); font-size: .76rem; letter-spacing: .05em; text-transform: uppercase; text-decoration: underline; text-underline-offset: 3px; }
.linklike:hover { color: var(--signal); }
@media (max-width: 640px) { .news-item { grid-template-columns: 1fr; gap: 4px; } }

.inst-card { border-top: 1px solid var(--ink); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.inst-card .role { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--signal); }
.inst-card .place { font-family: var(--font-mono); font-size: .76rem; color: var(--muted); }
.team-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(20px, 2.5vw, 40px); }
@media (max-width: 640px) { .team-grid { grid-template-columns: 1fr; } }
.person { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; border-top: 1px solid var(--rule); padding: 18px 0; }
.person .ph { min-height: 0; }
.person h4 { margin-bottom: 2px; }
.person .title { font-size: .92rem; color: var(--ink-2); }
.person .org { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.person details { margin-top: 10px; font-size: .95rem; }
.person summary { cursor: pointer; font-family: var(--font-mono); font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; list-style: none; }
.person summary::-webkit-details-marker { display: none; }
.person summary::before { content: "+ "; color: var(--signal); }
.person details[open] summary::before { content: "− "; }
.person details p { margin: 8px 0 0; color: var(--ink-2); }
@media (max-width: 480px) { .person { grid-template-columns: 84px minmax(0, 1fr); gap: 14px; } }

.fac-tools { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.fac-tools .group { display: flex; flex-direction: column; gap: 8px; }
.fac-tools .group > span { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.search { border: 1px solid var(--ink); padding: 10px 12px; font: inherit; font-size: .95rem; width: min(320px, 100%); background: var(--paper); }
.fac-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0; border-top: 1px solid var(--ink); border-left: 1px solid var(--rule); }
.fac {
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 18px 18px 20px;
  display: flex; flex-direction: column; gap: 8px; min-height: 190px; background: var(--paper);
}
.fac .code { font-family: var(--font-mono); font-size: 1.2rem; letter-spacing: .02em; }
.fac .meta { display: flex; justify-content: space-between; gap: 8px; font-family: var(--font-mono); font-size: .66rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.fac h3 { font-size: 1.05rem; }
.fac p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.fac-count { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); margin: 0 0 10px; }
.empty { border: 1px dashed var(--rule); padding: 28px; text-align: center; color: var(--muted); }

/* ---------- Story (horizontal timeline) ---------- */
.story-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.story-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 340px); gap: 20px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 18px; overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.story-card { scroll-snap-align: start; border-top: 2px solid var(--ink); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.story-card[data-project="NEXUS"] { border-top-color: var(--signal); }
.story-card .when { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; }
.story-card h3 { font-size: 1.15rem; }
.story-card p { margin: 0; font-size: .95rem; color: var(--ink-2); }
.story-progress { height: 2px; background: var(--rule); }
.story-progress span { display: block; height: 100%; width: 0; background: var(--ink); }
.thread {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--ink);
}
.thread > div { padding: 18px; border-right: 1px solid var(--ink); }
.thread > div:last-child { border-right: 0; background: var(--inverse-bg); color: var(--inverse-strong); }
.thread .k { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.thread > div:last-child .k { color: var(--inverse-muted); }
.thread .v { font-size: var(--step-2); font-weight: 600; margin: 6px 0; }
@media (max-width: 720px) { .thread { grid-template-columns: 1fr; } .thread > div { border-right: 0; border-bottom: 1px solid var(--ink); } }

/* ---------- Targets and counters ---------- */
.big-figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.big-figures > div { padding: 22px 22px 22px 0; border-right: 1px solid var(--rule); }
.big-figures > div + div { padding-left: 22px; }
.big-figures > div:last-child { border-right: 0; }
.big-figures .fig-n { font-family: var(--font-mono); font-size: clamp(2.2rem, 1.4rem + 3vw, 3.6rem); line-height: 1; letter-spacing: -0.02em; }
.big-figures .fig-n small { font-size: .38em; letter-spacing: 0; }
.big-figures p { margin: 10px 0 0; color: var(--ink-2); }
@media (max-width: 640px) { .big-figures { grid-template-columns: 1fr; } .big-figures > div, .big-figures > div + div { padding: 20px 0; border-right: 0; border-bottom: 1px solid var(--rule); } }

.meter { margin-top: 12px; }
.meter .bar { height: 8px; border: 1px solid var(--ink); background: var(--paper); position: relative; }
.meter .bar span { position: absolute; inset: 0 auto 0 0; background: var(--ink); width: 0; transition: width 1s var(--ease); }
.meter .lbl { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: .72rem; color: var(--muted); margin-top: 4px; }

.pillars { counter-reset: p; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.pillars li { list-style: none; padding: 18px 18px 18px 0; border-right: 1px solid var(--rule); }
.pillars li + li { padding-left: 18px; }
.pillars li:last-child { border-right: 0; }
.pillars li::before { counter-increment: p; content: counter(p); font-family: var(--font-mono); color: var(--signal); font-size: .8rem; display: block; margin-bottom: 8px; }
.pillars { padding: 0; margin: 0; }
@media (max-width: 960px) { .pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pillars li:nth-child(2) { border-right: 0; } .pillars li:nth-child(3) { padding-left: 0; } }
@media (max-width: 560px) { .pillars { grid-template-columns: 1fr; } .pillars li, .pillars li + li { padding: 16px 0; border-right: 0; border-bottom: 1px solid var(--rule); } }

.pub { border-top: 1px solid var(--rule); padding: 22px 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px 32px; }
.pub.has-ga { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.pub > .abs, .pub > .tex-src { grid-column: 1 / -1; }
.pub .venue { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); margin-top: 6px; }
.pub h3 { font-size: 1.1rem; margin: 6px 0; text-wrap: balance; }
.pub .authors { font-size: .92rem; color: var(--ink-2); }
.pub-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pub-actions a.chip { text-decoration: none; }
.pub-ga { margin: 0; }
.pub-ga img { width: 100%; height: auto; border: 1px solid var(--rule); background: #fff; }
.pub-ga figcaption { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.abs { font-family: var(--font-tex); background: var(--paper); border: 1px solid var(--rule); border-top: 2px solid var(--ink); padding: clamp(18px, 3vw, 34px) clamp(18px, 5vw, 64px); }
.abs h4 { font-family: var(--font-tex); font-variant: small-caps; text-align: center; font-weight: 700; font-size: 1.05rem; letter-spacing: .05em; margin: 0 0 12px; }
.abs p { text-align: justify; hyphens: auto; -webkit-hyphens: auto; font-size: 1.06rem; line-height: 1.55; max-width: 70ch; margin: 0 auto; color: var(--ink); }
.abs .abs-note { font-size: .9rem; color: var(--muted); text-align: left; margin-top: 12px; font-style: italic; }
.eqs { border-top: 1px solid var(--rule); margin: 20px auto 0; padding-top: 14px; max-width: 70ch; }
.eq-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin-bottom: 8px; }
.eq-label { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.eq-tex { overflow-x: auto; overflow-y: hidden; padding: 4px 0; font-size: 1.05rem; }
.eq-note { font-size: .9rem !important; color: var(--ink-2) !important; text-align: left !important; }
.tex-src pre { margin: 0; background: var(--inverse-bg); color: var(--inverse-fg); padding: 16px 18px; font-family: var(--font-mono); font-size: .8rem; line-height: 1.55; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 760px) { .pub.has-ga { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Contact ---------- */
.contact-card { border-top: 1px solid var(--ink); padding-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.contact-card .role { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--signal); }
.contact-card address { font-style: normal; color: var(--ink-2); font-size: .94rem; margin-top: 6px; }
.email-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.email-row a { font-family: var(--font-mono); font-size: .9rem; word-break: break-all; }
.copy { background: none; border: 1px solid var(--rule); padding: 4px 8px; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; }
.copy:hover { border-color: var(--ink); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--inverse-bg); color: var(--inverse-strong); padding: 10px 16px; font-family: var(--font-mono); font-size: .8rem; z-index: 90;
  transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Glossary popover ---------- */
.term { border-bottom: 1px dotted currentColor; cursor: help; }
.term:hover, .term:focus-visible { color: var(--signal); }
.pop {
  position: absolute; z-index: 80; max-width: 320px; background: var(--inverse-bg); color: var(--inverse-strong); padding: 12px 14px 14px;
  font-size: .9rem; line-height: 1.45; box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.pop[hidden] { display: none; }
.pop .k { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--inverse-accent); display: block; margin-bottom: 4px; }

/* ---------- Acknowledgment ---------- */
.ack { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 24px; align-items: center; border: 1px solid var(--ink); padding: clamp(18px, 3vw, 28px); }
.ack p { margin: 0; font-size: var(--step-1); }
.ack .eyebrow { margin-bottom: 8px; }
.ack--text { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 720px) { .ack { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--inverse-bg); color: var(--inverse-fg); padding-block: 56px 32px; margin-top: 0; }
.footer-logo { display: inline-block; margin-bottom: 36px; }
.footer-logo img { display: block; height: 64px; width: auto; max-width: 100%; }
@media (max-width: 560px) { .footer-logo img { height: 52px; } }
.site-footer a { color: var(--inverse-strong); }
.site-footer a:hover { color: var(--inverse-accent); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; }
.footer-ack { font-size: 1rem; color: var(--inverse-fg); max-width: 52ch; }
.footer-logos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--inverse-rule); margin-top: 40px; padding-top: 18px; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em; color: var(--inverse-muted); }
.footer-nav { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 18px; }
.footer-nav a { text-decoration: none; font-size: .94rem; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr; } .footer-logos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { transform: none; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .menu-toggle, .ex-controls, .story-controls, .toast { display: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .site-footer { background: none; color: var(--ink); }
}

/* ---------- Larger figure labels on phones ---------- */
@media (max-width: 560px) {
  .plot .tick { font-size: 20px; }
  .plot .axis-label { font-size: 17px; }
  .plot .target-label { font-size: 19px; }
  .ex-svg text { font-size: 19px; }
  .fig-head { font-size: .68rem; }
}

/* ---------- MathJax: keep inline math inline (base rule makes svg block) ---------- */
mjx-container[jax="SVG"]:not([display="true"]) { display: inline-block !important; margin: 0 .05em; }
mjx-container[jax="SVG"] > svg { display: inline !important; max-width: none; }
mjx-container[jax="SVG"][display="true"] { margin: .4em 0 !important; }


/* ---------- Project at a glance ---------- */
.glance { padding-bottom: clamp(28px, 4vw, 48px); }
.glance-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--rule); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); margin: 0; }
.glance-grid > div { background: var(--paper); padding: 14px 16px 16px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.glance-grid > div:first-child { padding-left: 0; }
.glance-grid dt { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.glance-grid dd { margin: 0; font-family: var(--font-mono); font-size: clamp(1.6rem, 1.1rem + 1.4vw, 2.2rem); line-height: 1.15; font-variant-numeric: tabular-nums; }
.glance-grid dd small { font-size: .45em; letter-spacing: .02em; }
.glance-grid dd.txt { font-family: var(--font-sans); font-size: 1.02rem; font-weight: 600; line-height: 1.3; padding-top: 6px; }
.glance-grid span { font-size: .82rem; color: var(--muted); line-height: 1.35; }
@media (max-width: 1080px) { .glance-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .glance-grid > div:nth-child(4) { padding-left: 0; } }
@media (max-width: 560px) { .glance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .glance-grid > div { padding-left: 0 !important; padding-right: 10px; } }

/* ---------- Opportunities ---------- */
.opp-list { border-bottom: 1px solid var(--ink); }
.opp { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: 12px 32px; border-top: 1px solid var(--ink); padding: clamp(22px, 3vw, 36px) 0; }
.opp-when { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--signal); padding-top: 6px; }
.opp h2 { font-size: var(--step-3); margin-bottom: 10px; max-width: 26ch; }
.opp p { color: var(--ink-2); max-width: 64ch; margin: 0; }
.opp .btn-row { margin-top: 18px; }
@media (max-width: 720px) { .opp { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Explainer on phones: steps above the diagram, pinned while reading ---------- */
@media (max-width: 960px) {
  .explainer { display: flex; flex-direction: column; gap: 14px; }
  .explainer .ex-panel { display: contents; }
  .explainer .ex-steps { order: -1; margin: 0; position: sticky; top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); z-index: 5; background: var(--paper); }
  .explainer .fig { order: 0; }
  .explainer .ex-step-text { order: 1; }
  .explainer .ex-controls { order: 2; margin-top: 0; }
  .explainer .ex-progress { order: 3; margin-top: 0; }
}

/* ---------- Work plan as a vertical list on phones ---------- */
.tl-vlist { display: none; list-style: none; margin: 0; padding: 0; }
.tl-vlist > li { border-top: 1px solid var(--rule); padding: 14px; }
.tl-vlist > li:first-child { border-top: 0; }
.tl-vlist .when { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.tl-vlist li.is-now .when { color: var(--signal); }
.tl-vlist h3 { font-size: 1.1rem; margin: 4px 0 6px; }
.tl-vlist p { margin: 0; font-size: .95rem; color: var(--ink-2); }
.tl-vlist .vbar { height: 6px; border: 1px solid var(--ink); margin: 10px 0 8px; position: relative; }
.tl-vlist .vbar span { position: absolute; inset: 0 auto 0 0; background: var(--signal); }
.tl-vlist .ms { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.tl-vlist .ms li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; font-size: .9rem; align-items: start; }
.tl-vlist .ms li::before { content: ""; width: 9px; height: 9px; border: 1.5px solid var(--ink); transform: rotate(45deg); margin-top: 6px; }
.tl-vlist .ms b { font-family: var(--font-mono); font-weight: 500; font-size: .78rem; }
@media (max-width: 560px) {
  .tl .tl-track, .tl .tl-detail { display: none; }
  .tl .tl-vlist { display: block; }
}


/* ---------- Journeys ---------- */
.mode-switch { display: flex; gap: 8px; margin-bottom: 14px; }
.map-svg .route-offmap, .map-svg .offmap-label { display: none; }
.map-svg.show-offmap .route-offmap, .map-svg.show-offmap .offmap-label { display: inline; }
.map-svg.mode-journeys .route { opacity: .28; }
.map-svg .route.is-journey { opacity: 1; stroke: var(--signal); stroke-width: 2.6; animation: none; stroke-dasharray: none; }
.map-svg .route.is-journey.is-planned { stroke-dasharray: 7 6; animation: route 1.6s linear infinite; }
.map-svg .traveler { fill: var(--signal); stroke: var(--paper); stroke-width: 2.5; pointer-events: none; }
.journey-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.journey-list button { width: 100%; text-align: left; display: grid; grid-template-columns: 7.2em minmax(0, 1fr); gap: 10px; align-items: baseline; background: var(--paper); border: 1px solid var(--rule); padding: 9px 12px; cursor: pointer; }
.journey-list button:hover { border-color: var(--ink); }
.journey-list button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.journey-list .d { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .03em; }
.journey-list .t { font-size: .92rem; }
.journey-list .planned { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; color: var(--signal); margin-left: 6px; }
.journey-list button[aria-pressed="true"] .planned { color: var(--on-ink-accent); }
.journey-panel { border-top: 1px solid var(--ink); padding-top: 16px; }
.journey-panel .role { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--signal); }
.journey-panel h3 { margin: 6px 0 10px; }
.journey-panel dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 14px 0 0; font-size: .92rem; }
.journey-panel dt { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.journey-panel dd { margin: 0; }
.journey-panel .btn-row { margin-top: 18px; }

.ex-svg .meter-box { fill: var(--paper); stroke: var(--ink); }

/* ---------- Photos ---------- */
.photo { margin: 0; }
.photo img { width: 100%; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--paper-3); }
.photo.portrait img { aspect-ratio: 1 / 1; }
.photo figcaption { font-size: .84rem; color: var(--ink-2); margin-top: 8px; line-height: 1.4; }
.photo figcaption::before { content: ""; display: inline-block; width: 14px; height: 2px; background: var(--signal); vertical-align: middle; margin-right: 8px; }
.photo .credit { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .04em; color: var(--muted); margin-left: 4px; }
.person .photo figcaption { display: none; }


/* ---------- Three-country palette: one colour per lab, used the same way everywhere ---------- */
.lab-ch { --lab: var(--ch); --lab-ink: var(--ch-ink); --lab-tint: var(--ch-tint); --on-lab: var(--on-ch); }
.lab-my { --lab: var(--my); --lab-ink: var(--my-ink); --lab-tint: var(--my-tint); --on-lab: var(--on-my); }
.lab-ph { --lab: var(--ph); --lab-ink: var(--ph-ink); --lab-tint: var(--ph-tint); --on-lab: var(--on-ph); }
.lab-text { color: var(--lab-ink); font-weight: 600; }
.lab-dot { display: inline-block; width: .62em; height: .62em; border-radius: 50%; background: var(--lab); margin-right: .35em; vertical-align: .06em; }

/* NEXUS logo files (site/logo, from brand/nexus-logo): light and reverse versions swap with the theme */
.logo-on-light { display: block; }
.logo-on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-on-light { display: none; }
  :root:not([data-theme="light"]) .logo-on-dark { display: block; }
}
:root[data-theme="dark"] .logo-on-light { display: none; }
:root[data-theme="dark"] .logo-on-dark { display: block; }
.logo-story { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 64px); align-items: center; }
.logo-plate { margin: 0; padding: clamp(16px, 3vw, 40px) 0; }
.logo-plate img { width: 100%; max-width: 560px; height: auto; }
.logo-story p { margin: 0 0 16px; font-size: var(--step-1); max-width: 46ch; }
.logo-key { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.logo-key li { display: flex; align-items: baseline; gap: 4px; }
.logo-key .lab-dot { flex-shrink: 0; }
@media (max-width: 760px) { .logo-story { grid-template-columns: 1fr; } }

/* map */
.map-svg .land-hl[data-node="0"] { fill: var(--ch); }
.map-svg .land-hl[data-node="1"] { fill: var(--my); }
.map-svg .land-hl[data-node="2"] { fill: var(--ph); }
.map-svg .node[data-node="0"] { --lab: var(--ch); --lab-ink: var(--ch-ink); }
.map-svg .node[data-node="1"] { --lab: var(--my); --lab-ink: var(--my-ink); }
.map-svg .node[data-node="2"] { --lab: var(--ph); --lab-ink: var(--ph-ink); }
.map-svg .node .core, .map-svg .node.is-active .core { fill: var(--lab); }
.map-svg .node .ring, .map-svg .node.is-active .ring { stroke: var(--lab); stroke-width: 2; }
.map-svg .node .city, .map-svg .node.is-active .city { fill: var(--lab-ink); }
.map-svg .node .pulse { stroke: var(--lab); }
.map-svg .node.is-active .flag-frame { stroke: var(--lab); }

/* partner chips and panels */
.chip.lab-ch, .chip.lab-my, .chip.lab-ph { border-left: 4px solid var(--lab); }
.chip.lab-ch[aria-pressed="true"], .chip.lab-my[aria-pressed="true"], .chip.lab-ph[aria-pressed="true"] { background: var(--lab); border-color: var(--lab); color: var(--on-lab); }
.node-panel.lab-ch, .node-panel.lab-my, .node-panel.lab-ph { border-top: 3px solid var(--lab); }
.node-panel[class*="lab-"] .role { color: var(--lab-ink); }

/* journeys: coloured by where the traveller started */
.journey-list li[class*="lab-"] button { border-left: 4px solid var(--lab); }
.journey-list li[class*="lab-"] .d { color: var(--lab-ink); }
.journey-list li[class*="lab-"] button[aria-pressed="true"] { background: var(--lab); border-color: var(--lab); color: var(--on-lab); }
.journey-list li[class*="lab-"] button[aria-pressed="true"] .d, .journey-list li[class*="lab-"] button[aria-pressed="true"] .planned { color: var(--on-lab); }
.journey-panel[class*="lab-"] { border-top: 3px solid var(--lab); }
.journey-panel[class*="lab-"] .role { color: var(--lab-ink); }
.map-svg .traveler { fill: var(--lab, var(--signal)); }

/* sunlight strip */
.sun-card[class*="lab-"] { box-shadow: inset 0 3px 0 var(--lab); padding-top: 20px; }
.sun-card[class*="lab-"] .place { color: var(--lab-ink); }
.sun-card[class*="lab-"] .daybar .day { background: var(--lab); }
.sun-card[class*="lab-"][data-state="day"] .state i { background: var(--lab); border-color: var(--lab); }

/* hero partner list and glance strip */
.hero-meta span[class*="lab-"]::before { color: var(--lab); }
.glance-grid .lab-row { display: flex; gap: 6px; margin-top: 4px; }

/* partner, team and contact cards */
.inst-card[class*="lab-"] { border-top: 3px solid var(--lab); }
.inst-card[class*="lab-"] .role { color: var(--lab-ink); }
.inst-card[class*="lab-"] .logo-slot { border-color: var(--lab); }
.person[class*="lab-"] .org { color: var(--lab-ink); }
.person[class*="lab-"] .org::before { content: ""; display: inline-block; width: 10px; height: 10px; background: var(--lab); margin-right: 8px; vertical-align: -1px; }
.person[class*="lab-"] .ph { box-shadow: inset 0 -4px 0 var(--lab); }
.contact-card[class*="lab-"] { border-top: 3px solid var(--lab); }
.contact-card[class*="lab-"] .role { color: var(--lab-ink); }
.footer-logos .logo-slot[class*="lab-"] { border-top: 3px solid var(--lab); }
.partner-logo { display: flex; align-items: center; justify-content: center; height: 84px; box-sizing: border-box; padding: 10px 14px; background: var(--plate); border: 1px solid var(--rule); }
.partner-logo img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; }
.partner-logo img.seal { max-height: 100%; }
.partner-logo:has(img.banner) { padding: 0; }
.partner-logo img.banner { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; object-position: left center; }
.site-footer .partner-logo { border: 0; }
.footer-logos .partner-logo[class*="lab-"] { border-top: 3px solid var(--lab); }

/* facilities */
.fac[class*="lab-"] { box-shadow: inset 0 3px 0 var(--lab); }
.fac[class*="lab-"] .meta span:first-child { color: var(--lab-ink); font-weight: 500; }
.fac[class*="lab-"] .code { color: var(--lab-ink); }

/* explainer partner mentions */
.ex-panel .where .lab-text { font-weight: 600; }
