/* ==========================================================================
   Mohammad Saalim Badar — portfolio
   Palette: ink black · white · electric blue (light + dark themes)
   Type: Archivo (display, expanded) · Instrument Sans (body) · JetBrains Mono (data)
   ========================================================================== */

/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */
/* Newsreader: display serif with optical sizes · Hanken Grotesk: text · Martian Mono: data & labels */
@font-face {
  font-family: "Newsreader"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url("../assets/fonts/newsreader-latin-opsz-normal.woff2") format("woff2-variations"), url("../assets/fonts/newsreader-latin-opsz-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Newsreader"; font-style: italic; font-display: swap; font-weight: 200 800;
  src: url("../assets/fonts/newsreader-latin-opsz-italic.woff2") format("woff2-variations"), url("../assets/fonts/newsreader-latin-opsz-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("../assets/fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2-variations"), url("../assets/fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Hanken Grotesk"; font-style: italic; font-display: swap; font-weight: 100 900;
  src: url("../assets/fonts/hanken-grotesk-latin-wght-italic.woff2") format("woff2-variations"), url("../assets/fonts/hanken-grotesk-latin-wght-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Martian Mono"; font-style: normal; font-display: swap; font-weight: 100 800; font-stretch: 75% 112.5%;
  src: url("../assets/fonts/martian-mono-latin-wdth-normal.woff2") format("woff2-variations"), url("../assets/fonts/martian-mono-latin-wdth-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* ---------- Tokens: light (default) ---------- */
:root {
  --bg: #F5F7FA;
  --bg-alt: #EDF1F6;
  --surface: #FFFFFF;
  --surface-2: #F0F3F8;
  --line: #DCE2EA;
  --line-2: #C3CCD9;
  --text: #0A0D12;
  --text-2: #354052;
  --muted: #5B6677;
  --accent: #1E56F0;
  --accent-text: #1B4FE0;
  --accent-soft: rgba(30, 86, 240, 0.09);
  --accent-line: rgba(30, 86, 240, 0.38);
  --btn: #1E56F0;
  --btn-hover: #1646CC;
  --on-accent: #FFFFFF;
  --dot: #BCC7D5;
  --grid-line: rgba(10, 13, 18, 0.045);
  --flow-rgb: 30, 86, 240;
  --seq-hi: #0F3AA8;
  --scrim-rgb: 245, 247, 250;
  --shadow: 0 1px 2px rgba(10, 13, 18, 0.05), 0 10px 30px rgba(10, 13, 18, 0.07);
  --shadow-lg: 0 24px 60px rgba(10, 13, 18, 0.18);

  --f-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --f-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "Martian Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --mono-w: 87.5%;

  --radius: 8px;
  --gutter: clamp(16px, 4vw, 40px);
  --nav-h: 64px;
  color-scheme: light;
}

/* ---------- Tokens: dark (system) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07090D;
    --bg-alt: #0A0D13;
    --surface: #0F141C;
    --surface-2: #141A24;
    --line: #1D2531;
    --line-2: #2B3646;
    --text: #EEF2F7;
    --text-2: #B6C0CE;
    --muted: #7F8B9C;
    --accent: #4C7DFF;
    --accent-text: #7197FF;
    --accent-soft: rgba(76, 125, 255, 0.13);
    --accent-line: rgba(76, 125, 255, 0.42);
    --btn: #2F5FEF;
    --btn-hover: #4471FF;
    --on-accent: #FFFFFF;
    --dot: #2F3B51;
    --grid-line: rgba(238, 242, 247, 0.04);
    --flow-rgb: 88, 136, 255;
    --seq-hi: #A9C2FF;
    --scrim-rgb: 7, 9, 13;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

/* ---------- Tokens: dark (explicit) + inverted bands ---------- */
:root[data-theme="dark"],
.invert {
  --bg: #07090D;
  --bg-alt: #0A0D13;
  --surface: #0F141C;
  --surface-2: #141A24;
  --line: #1D2531;
  --line-2: #2B3646;
  --text: #EEF2F7;
  --text-2: #B6C0CE;
  --muted: #7F8B9C;
  --accent: #4C7DFF;
  --accent-text: #7197FF;
  --accent-soft: rgba(76, 125, 255, 0.13);
  --accent-line: rgba(76, 125, 255, 0.42);
  --btn: #2F5FEF;
  --btn-hover: #4471FF;
  --on-accent: #FFFFFF;
  --dot: #2F3B51;
  --grid-line: rgba(238, 242, 247, 0.04);
  --flow-rgb: 88, 136, 255;
  --seq-hi: #A9C2FF;
  --scrim-rgb: 7, 9, 13;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ---------- Alternative palettes ----------
   Switch the whole site by adding data-palette to the <html> tag in index.html,
   e.g. <html lang="en" class="no-js" data-palette="teal">. Preview any of them by
   adding ?palette=teal (or blueprint, olive, signal) to the page address.
   Default (no attribute) = Ink & Electric Blue. */
/* Deep Teal */
:root[data-palette="teal"] {
  --bg: #F3F7F6;
  --bg-alt: #ECF0EF;
  --surface: #FFFFFF;
  --surface-2: #F4F4F4;
  --line: #D7DBDA;
  --line-2: #C1C7C5;
  --text: #07110F;
  --text-2: #314440;
  --muted: #566A65;
  --accent: #0B7C70;
  --accent-text: #09695F;
  --accent-soft: rgba(11, 124, 112, 0.09);
  --accent-line: rgba(11, 124, 112, 0.38);
  --btn: #0B7C70;
  --btn-hover: #0A6D63;
  --on-accent: #FFFFFF;
  --dot: #CDCFCF;
  --grid-line: rgba(7, 17, 15, 0.045);
  --flow-rgb: 11, 124, 112;
  --seq-hi: #054840;
  --scrim-rgb: 243, 247, 246;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="teal"]:not([data-theme="light"]) {
    --bg: #050C0B;
    --bg-alt: #0A1110;
    --surface: #0C1614;
    --surface-2: #151F1D;
    --line: #202827;
    --line-2: #333A39;
    --text: #EAF4F1;
    --text-2: #B2C6C0;
    --muted: #7D928C;
    --accent: #2BC4AE;
    --accent-text: #5AD8C4;
    --accent-soft: rgba(43, 196, 174, 0.13);
    --accent-line: rgba(43, 196, 174, 0.42);
    --btn: #0C7A6D;
    --btn-hover: #298A7F;
    --on-accent: #FFFFFF;
    --dot: #323C3A;
    --grid-line: rgba(234, 244, 241, 0.04);
    --flow-rgb: 43, 196, 174;
    --seq-hi: #8FE8D9;
    --scrim-rgb: 5, 12, 11;
  }
}
:root[data-palette="teal"][data-theme="dark"],
:root[data-palette="teal"] .invert {
  --bg: #050C0B;
  --bg-alt: #0A1110;
  --surface: #0C1614;
  --surface-2: #151F1D;
  --line: #202827;
  --line-2: #333A39;
  --text: #EAF4F1;
  --text-2: #B2C6C0;
  --muted: #7D928C;
  --accent: #2BC4AE;
  --accent-text: #5AD8C4;
  --accent-soft: rgba(43, 196, 174, 0.13);
  --accent-line: rgba(43, 196, 174, 0.42);
  --btn: #0C7A6D;
  --btn-hover: #298A7F;
  --on-accent: #FFFFFF;
  --dot: #323C3A;
  --grid-line: rgba(234, 244, 241, 0.04);
  --flow-rgb: 43, 196, 174;
  --seq-hi: #8FE8D9;
  --scrim-rgb: 5, 12, 11;
}
/* Blueprint & Amber */
:root[data-palette="blueprint"] {
  --bg: #F3F6FB;
  --bg-alt: #ECEFF5;
  --surface: #FFFFFF;
  --surface-2: #F4F5F6;
  --line: #D7DCE3;
  --line-2: #C2C8D1;
  --text: #0A1B33;
  --text-2: #33445E;
  --muted: #56667F;
  --accent: #B45309;
  --accent-text: #9A4507;
  --accent-soft: rgba(180, 83, 9, 0.09);
  --accent-line: rgba(180, 83, 9, 0.38);
  --btn: #B45309;
  --btn-hover: #9E4908;
  --on-accent: #FFFFFF;
  --dot: #CED1D6;
  --grid-line: rgba(10, 27, 51, 0.045);
  --flow-rgb: 180, 83, 9;
  --seq-hi: #7A3606;
  --scrim-rgb: 243, 246, 251;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="blueprint"]:not([data-theme="light"]) {
    --bg: #081629;
    --bg-alt: #0D1A2D;
    --surface: #0E2140;
    --surface-2: #172947;
    --line: #243142;
    --line-2: #374353;
    --text: #F1F5FB;
    --text-2: #BAC8DD;
    --muted: #8C9CB6;
    --accent: #F5A524;
    --accent-text: #FBBF4D;
    --accent-soft: rgba(245, 165, 36, 0.13);
    --accent-line: rgba(245, 165, 36, 0.42);
    --btn: #F5A524;
    --btn-hover: #F6B03E;
    --on-accent: #081629;
    --dot: #354560;
    --grid-line: rgba(241, 245, 251, 0.04);
    --flow-rgb: 245, 165, 36;
    --seq-hi: #FFD27A;
    --scrim-rgb: 8, 22, 41;
  }
}
:root[data-palette="blueprint"][data-theme="dark"],
:root[data-palette="blueprint"] .invert {
  --bg: #081629;
  --bg-alt: #0D1A2D;
  --surface: #0E2140;
  --surface-2: #172947;
  --line: #243142;
  --line-2: #374353;
  --text: #F1F5FB;
  --text-2: #BAC8DD;
  --muted: #8C9CB6;
  --accent: #F5A524;
  --accent-text: #FBBF4D;
  --accent-soft: rgba(245, 165, 36, 0.13);
  --accent-line: rgba(245, 165, 36, 0.42);
  --btn: #F5A524;
  --btn-hover: #F6B03E;
  --on-accent: #081629;
  --dot: #354560;
  --grid-line: rgba(241, 245, 251, 0.04);
  --flow-rgb: 245, 165, 36;
  --seq-hi: #FFD27A;
  --scrim-rgb: 8, 22, 41;
}
/* Olive & Beige */
:root[data-palette="olive"] {
  --bg: #EFE9DC;
  --bg-alt: #E8E3D6;
  --surface: #FAF7F0;
  --surface-2: #F0EDE6;
  --line: #D5D0C3;
  --line-2: #C1BDB1;
  --text: #16160F;
  --text-2: #3D3C2F;
  --muted: #5F5D48;
  --accent: #5B6B22;
  --accent-text: #4D5B1C;
  --accent-soft: rgba(91, 107, 34, 0.09);
  --accent-line: rgba(91, 107, 34, 0.38);
  --btn: #5B6B22;
  --btn-hover: #505E1E;
  --on-accent: #FFFFFF;
  --dot: #CCCAC3;
  --grid-line: rgba(22, 22, 15, 0.045);
  --flow-rgb: 91, 107, 34;
  --seq-hi: #34400F;
  --scrim-rgb: 239, 233, 220;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="olive"]:not([data-theme="light"]) {
    --bg: #11110C;
    --bg-alt: #151510;
    --surface: #1A1A13;
    --surface-2: #23221B;
    --line: #2C2B25;
    --line-2: #3D3C36;
    --text: #EFE9DC;
    --text-2: #CAC4B2;
    --muted: #9B9680;
    --accent: #A9BB5B;
    --accent-text: #BCCC74;
    --accent-soft: rgba(169, 187, 91, 0.13);
    --accent-line: rgba(169, 187, 91, 0.42);
    --btn: #5E6D24;
    --btn-hover: #717F3E;
    --on-accent: #FFFFFF;
    --dot: #3E3D35;
    --grid-line: rgba(239, 233, 220, 0.04);
    --flow-rgb: 169, 187, 91;
    --seq-hi: #D9E59A;
    --scrim-rgb: 17, 17, 12;
  }
}
:root[data-palette="olive"][data-theme="dark"],
:root[data-palette="olive"] .invert {
  --bg: #11110C;
  --bg-alt: #151510;
  --surface: #1A1A13;
  --surface-2: #23221B;
  --line: #2C2B25;
  --line-2: #3D3C36;
  --text: #EFE9DC;
  --text-2: #CAC4B2;
  --muted: #9B9680;
  --accent: #A9BB5B;
  --accent-text: #BCCC74;
  --accent-soft: rgba(169, 187, 91, 0.13);
  --accent-line: rgba(169, 187, 91, 0.42);
  --btn: #5E6D24;
  --btn-hover: #717F3E;
  --on-accent: #FFFFFF;
  --dot: #3E3D35;
  --grid-line: rgba(239, 233, 220, 0.04);
  --flow-rgb: 169, 187, 91;
  --seq-hi: #D9E59A;
  --scrim-rgb: 17, 17, 12;
}
/* Graphite & Signal Orange */
:root[data-palette="signal"] {
  --bg: #F6F6F3;
  --bg-alt: #EFEFEC;
  --surface: #FFFFFF;
  --surface-2: #F4F4F4;
  --line: #DBDBD8;
  --line-2: #C6C6C4;
  --text: #111113;
  --text-2: #3A3A3F;
  --muted: #5F5F66;
  --accent: #D2451E;
  --accent-text: #B03816;
  --accent-soft: rgba(210, 69, 30, 0.09);
  --accent-line: rgba(210, 69, 30, 0.38);
  --btn: #C13F1B;
  --btn-hover: #AA3718;
  --on-accent: #FFFFFF;
  --dot: #CFCFD0;
  --grid-line: rgba(17, 17, 19, 0.045);
  --flow-rgb: 210, 69, 30;
  --seq-hi: #8A2A0E;
  --scrim-rgb: 246, 246, 243;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="signal"]:not([data-theme="light"]) {
    --bg: #0B0B0D;
    --bg-alt: #101012;
    --surface: #151518;
    --surface-2: #1E1E21;
    --line: #272728;
    --line-2: #39393A;
    --text: #F2F2EE;
    --text-2: #BDBDB7;
    --muted: #8C8C86;
    --accent: #FF6A3D;
    --accent-text: #FF8A66;
    --accent-soft: rgba(255, 106, 61, 0.13);
    --accent-line: rgba(255, 106, 61, 0.42);
    --btn: #C8461F;
    --btn-hover: #CF5C3A;
    --on-accent: #FFFFFF;
    --dot: #3B3B3C;
    --grid-line: rgba(242, 242, 238, 0.04);
    --flow-rgb: 255, 106, 61;
    --seq-hi: #FFB59C;
    --scrim-rgb: 11, 11, 13;
  }
}
:root[data-palette="signal"][data-theme="dark"],
:root[data-palette="signal"] .invert {
  --bg: #0B0B0D;
  --bg-alt: #101012;
  --surface: #151518;
  --surface-2: #1E1E21;
  --line: #272728;
  --line-2: #39393A;
  --text: #F2F2EE;
  --text-2: #BDBDB7;
  --muted: #8C8C86;
  --accent: #FF6A3D;
  --accent-text: #FF8A66;
  --accent-soft: rgba(255, 106, 61, 0.13);
  --accent-line: rgba(255, 106, 61, 0.42);
  --btn: #C8461F;
  --btn-hover: #CF5C3A;
  --on-accent: #FFFFFF;
  --dot: #3B3B3C;
  --grid-line: rgba(242, 242, 238, 0.04);
  --flow-rgb: 255, 106, 61;
  --seq-hi: #FFB59C;
  --scrim-rgb: 11, 11, 13;
}

/* ---------- Base ---------- */
*, *::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-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.mono { font-family: var(--f-mono); font-stretch: var(--mono-w); }
.nowrap { white-space: nowrap; }
kbd {
  font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 0.72em; padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2);
}
.ico {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.ico-s { width: 14px; height: 14px; }
.ico-lg { width: 30px; height: 30px; }

.wrap { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: var(--gutter); }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--btn); color: var(--on-accent); padding: 10px 14px; border-radius: 6px;
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------- Buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 6px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; line-height: 1.2; text-decoration: none;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.btn-primary { background: var(--btn); color: var(--on-accent); }
.btn-primary:hover { background: var(--btn-hover); transform: translateY(-1px); box-shadow: 0 8px 24px var(--accent-soft), 0 0 0 4px var(--accent-soft); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-text); transform: translateY(-1px); }
.btn-small { padding: 8px 12px; font-size: 13.5px; }
.btn-block { width: 100%; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2);
  padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 500;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.chip:hover { border-color: var(--accent-line); color: var(--text); }
.chip.is-on { background: var(--text); border-color: var(--text); color: var(--bg); }

.badge {
  display: inline-block; vertical-align: middle;
  font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--accent-line);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 60;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, background-color .2s ease;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner {
  max-width: 1200px; margin-inline: auto; padding-inline: var(--gutter);
  height: var(--nav-h); display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; flex: none; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 6px;
  background: var(--text); color: var(--bg);
  font-family: var(--f-display); font-style: italic; font-weight: 600; font-size: 17px; letter-spacing: -.01em;
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; right: -3px; bottom: -3px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--bg);
}
.brand-name { display: flex; flex-direction: column; line-height: 1.15; font-weight: 700; font-size: 15px; }
.brand-sub { font-family: var(--f-mono); font-stretch: var(--mono-w); font-weight: 400; font-size: 10.5px; color: var(--muted); letter-spacing: .04em; }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav-links a {
  position: relative; color: var(--text-2); text-decoration: none; font-size: 14.5px; font-weight: 500;
  padding: 8px 11px; border-radius: 6px; transition: color .15s ease, background-color .15s ease;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--accent);
}
.nav-tools { display: flex; align-items: center; gap: 6px; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; min-width: 38px; justify-content: center;
  padding: 0 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  transition: border-color .15s ease, color .15s ease;
}
.tool-btn:hover { border-color: var(--accent-line); color: var(--text); }
.kbd-hint { display: inline-flex; gap: 3px; }
.kbd-hint kbd { font-size: 10.5px; }
/* show the icon of the theme you would switch to */
.tool-btn .ico-sun { display: none; }
.tool-btn[data-mode="dark"] .ico-sun { display: block; }
.tool-btn[data-mode="dark"] .ico-moon { display: none; }
.menu-btn { display: none; }
.menu-btn .ico-close { display: none; }
.nav.menu-open .menu-btn .ico-close { display: block; }
.nav.menu-open .menu-btn .ico-menu { display: none; }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; }
.progress span { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(48px, 8vw, 104px) 28px; isolation: isolate; }
.flow-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.hero-scrim {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(var(--scrim-rgb), .94) 0%, rgba(var(--scrim-rgb), .82) 38%, rgba(var(--scrim-rgb), .18) 64%, rgba(var(--scrim-rgb), 0) 80%),
    linear-gradient(0deg, rgba(var(--scrim-rgb), .9) 0%, rgba(var(--scrim-rgb), 0) 30%);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, .8fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text);
}
.section-head .eyebrow::before {
  content: ""; width: 22px; height: 1px; background: currentColor; opacity: .7;
}
.hero .eyebrow { color: var(--text-2); }
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.live-dot::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid var(--accent);
  animation: ping 2.2s cubic-bezier(0, 0, .2, 1) infinite;
}
@keyframes ping { 0% { transform: scale(.5); opacity: .9; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
.hero-name {
  margin-top: 18px;
  font-family: var(--f-display); font-weight: 500;
  font-size: clamp(2.7rem, 6vw, 5.3rem); line-height: 1; letter-spacing: -.025em;
}
.name-suffix { font-style: normal; font-weight: 400; font-size: .36em; letter-spacing: 0; color: var(--muted); margin-left: .12em; }
.hero-name em { font-style: italic; font-weight: 450; }
.hero-lead { margin-top: 24px; max-width: 60ch; font-size: clamp(1.05rem, 1.35vw, 1.2rem); line-height: 1.6; color: var(--text-2); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-meta {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; margin: 34px 0 0; padding-top: 18px;
  border-top: 1px solid var(--line); max-width: 640px;
}
.hero-meta dt { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.hero-meta dd { margin: 4px 0 0; font-size: 14.5px; color: var(--text-2); }

.portrait { margin: 0; justify-self: center; width: 100%; max-width: 340px; }
.portrait-frame { position: relative; aspect-ratio: 1; max-width: 100%; padding: 18px; }
.portrait-frame img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
  box-shadow: 0 0 0 1px var(--line-2), 0 0 0 10px rgba(var(--flow-rgb), .06);
}
.portrait:hover .portrait-frame img { transform: scale(1.025); }
.corner { position: absolute; width: 22px; height: 22px; border: 0 solid var(--text); pointer-events: none; }
.c-tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.c-tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.c-bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.c-br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }
.portrait figcaption { margin-top: 10px; text-align: center; font-size: 11px; letter-spacing: .06em; color: var(--muted); }

.stats {
  list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(40px, 6vw, 72px); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.stat {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; cursor: default;
  border-left: 1px solid var(--line); transition: background-color .2s ease; outline-offset: -2px;
}
.stat:first-child { border-left: 0; }
.stat:hover, .stat:focus-visible { background: var(--accent-soft); }
.stat-num { font-family: var(--f-display); font-weight: 500; font-size: clamp(2.2rem, 3.4vw, 2.9rem); line-height: 1; color: var(--text); font-variant-numeric: lining-nums; }
.stat-label { font-size: 13.5px; color: var(--muted); }
.stat-pop {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% + 8px); z-index: 5;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--line-2); border-radius: 6px;
  padding: 10px 12px; font-size: 13px; line-height: 1.5; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .18s ease, transform .18s ease;
}
.stat:hover .stat-pop, .stat:focus .stat-pop { opacity: 1; transform: none; }
.hud {
  position: absolute; right: var(--gutter); top: 14px; margin: 0; z-index: 2;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end;
  font-size: 10.5px; letter-spacing: .03em; color: var(--muted);
}
.hud-btn {
  font: inherit; font-stretch: inherit; color: var(--accent-text); background: var(--surface); cursor: pointer;
  border: 1px solid var(--accent-line); border-radius: 999px; padding: 2px 9px;
}
.hud-btn:hover { border-color: var(--accent); }
.hero { cursor: crosshair; }
.hero a, .hero button, .hero .hero-copy, .hero .stats, .hero .portrait { cursor: auto; }
.hero a, .hero button { cursor: pointer; }
.hud-k { color: var(--accent-text); text-transform: uppercase; margin-right: 6px; }

/* ---------- Sections ---------- */
.section { position: relative; padding-block: clamp(72px, 10vw, 124px); scroll-margin-top: 20px; }
.section-alt {
  background-color: var(--bg-alt);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  border-block: 1px solid var(--line);
}
.section-head { max-width: 780px; margin-bottom: 36px; }
.section-head h2, .about-story h2, .contact-copy h2 {
  margin-top: 14px;
  font-family: var(--f-display); font-weight: 500;
  font-size: clamp(2.05rem, 4vw, 3.25rem); line-height: 1.06; letter-spacing: -.022em;
}
h2 em { font-style: italic; font-weight: 450; color: var(--accent-text); }
.section-intro { margin-top: 16px; max-width: 64ch; font-size: 1.075rem; color: var(--text-2); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr); gap: clamp(36px, 6vw, 80px); align-items: start; }
.about-story { display: grid; gap: 18px; }
.about-story h2 { margin-bottom: 8px; }
.about-story p { font-size: 1.075rem; color: var(--text-2); max-width: 62ch; }
.spec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.spec-head {
  display: flex; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid var(--line);
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: var(--surface-2);
}
.spec-list { margin: 0; padding: 6px 20px; }
.spec-list div { display: grid; grid-template-columns: 104px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.spec-list div:last-child { border-bottom: 0; }
.spec-list dt { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.spec-list dd { margin: 0; font-size: 14.5px; color: var(--text); line-height: 1.5; }
.awards { list-style: none; border-top: 1px solid var(--line); padding: 8px 20px 14px; }
.awards li { display: flex; gap: 12px; padding: 10px 0; }
.awards .ico { color: var(--accent); margin-top: 2px; }
.awards strong { display: block; font-size: 14.5px; }
.awards em { display: block; font-style: normal; font-size: 13px; color: var(--muted); }

/* ---------- Journey ---------- */
.journey-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
.map-panel { align-self: stretch; }
.map-sticky { position: sticky; top: calc(var(--nav-h) + 24px); display: grid; gap: 14px; }
.map-box { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.map { display: block; width: 100%; height: auto; overflow: visible; }
.map .land { stroke: var(--dot); stroke-width: 2.3; stroke-linecap: round; fill: none; }
.map .graticule { stroke: var(--line); stroke-width: .6; fill: none; stroke-dasharray: 2 4; }
.map .arc { fill: none; stroke: var(--accent-line); stroke-width: 1.3; stroke-dasharray: 3 4; transition: stroke .3s ease, opacity .3s ease; }
.map .arc.done { stroke-dasharray: none; opacity: .75; }
.map .arc.future { opacity: .35; }
.map .arc.live { stroke: var(--accent); stroke-width: 2.2; stroke-dasharray: none; opacity: 1; }
.map .traveler { fill: var(--accent); }
.map .node { cursor: pointer; }
.map .node-hit { fill: transparent; }
.map .node-core { fill: var(--surface); stroke: var(--accent); stroke-width: 2; transition: fill .25s ease; }
.map .node-ring { fill: none; stroke: var(--accent); stroke-width: 1.2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.map .node.on .node-core { fill: var(--accent); }
.map .node.on .node-ring { animation: ring 1.8s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(2.8); opacity: 0; } }
.map .node-label { font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 12.5px; fill: var(--muted); letter-spacing: .04em; }
.map .grat-label { font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 10px; fill: var(--muted); opacity: .8; }
.map .traveler { opacity: 0; }
.map .traveler.moving { opacity: 1; }
.map .node.on .node-label { fill: var(--text); font-weight: 600; }
.map .node:focus-visible { outline: none; }
.map .node:focus-visible .node-core { stroke-width: 3.5; }
.map-tip {
  position: absolute; pointer-events: none; transform: translate(-50%, calc(-100% - 12px));
  background: var(--text); color: var(--bg); font-size: 11.5px; padding: 5px 9px; border-radius: 5px; white-space: nowrap;
}
.map-readout {
  display: grid; grid-template-columns: auto 1fr; column-gap: 16px; row-gap: 2px; align-items: baseline;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.readout-k { grid-column: 1 / -1; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.readout-year { grid-row: 2 / span 2; font-size: 1.9rem; font-weight: 600; color: var(--accent-text); line-height: 1.1; font-variant-numeric: tabular-nums; }
.readout-place { font-weight: 700; font-size: 15px; }
.readout-role { font-size: 13.5px; color: var(--text-2); }
#journey-play { justify-self: start; }
#journey-play[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-text); }

.steps { list-style: none; position: relative; }
.step { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 14px; scroll-margin-top: calc(var(--nav-h) + 40px); cursor: pointer; }
.step-rail { position: relative; display: flex; justify-content: center; }
.step-rail::before { content: ""; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.step:first-child .step-rail::before { top: 22px; }
.step:last-child .step-rail::before { bottom: auto; height: 22px; }
.step-dot {
  position: relative; margin-top: 16px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--bg-alt); border: 2px solid var(--line-2); transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.step.is-active .step-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.step-body {
  padding: 12px 16px 16px; margin-bottom: 10px; border: 1px solid transparent; border-radius: var(--radius);
  transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.step:hover .step-body { border-color: var(--line); }
.step.is-active .step-body { background: var(--surface); border-color: var(--accent-line); box-shadow: var(--shadow); }
.step-date { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.tag {
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--text-2);
}
.tag-award { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-text); }
.step h3 { margin-top: 6px; font-family: var(--f-display); font-weight: 600; font-size: 1.36rem; line-height: 1.2; letter-spacing: -.01em; }
.step-org { margin-top: 2px; font-size: 14.5px; font-weight: 500; color: var(--text-2); }
.step-note { margin-top: 8px; font-size: 14px; color: var(--muted); }
.step ul, .r-card ul { list-style: none; margin-top: 10px; display: grid; gap: 6px; }
.step li { position: relative; padding-left: 16px; font-size: 14.5px; color: var(--text-2); line-height: 1.55; }
.step li::before { content: ""; position: absolute; left: 0; top: .7em; width: 7px; height: 2px; border-radius: 1px; background: var(--accent); }
.step strong { color: var(--text); font-weight: 600; }

/* ---------- Research ---------- */
.research-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.research-grid-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.r-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 3vw, 28px); display: grid; gap: 10px; align-content: start; }
.r-k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.r-card h3 { font-family: var(--f-display); font-weight: 600; font-size: 1.5rem; line-height: 1.18; letter-spacing: -.01em; }
.r-card p:not(.r-k) { color: var(--text-2); font-size: 15px; }
.r-card-award { background: var(--text); border-color: var(--text); color: var(--bg); }
.r-card-award h3 { color: var(--bg); }
.r-card-award p:not(.r-k) { color: color-mix(in srgb, var(--bg) 78%, var(--text)); }
.r-card-award .r-k { color: var(--accent-text); }
.r-card-award .ico { color: var(--accent); }

.process { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr); gap: 16px; margin-block: 16px; }
.process-diagram, .process-info { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.process-diagram { padding: 16px 18px 10px; overflow-x: auto; }
.process-cap, .process-k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.process-svg { display: block; width: 100%; min-width: 470px; height: auto; margin-top: 6px; }
.process-svg .pipe { fill: none; stroke: var(--line-2); stroke-width: 3; }
.process-svg .flow-dash { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 9; animation: dash 1.1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -28; } }
.process-svg .arrow-fill { fill: var(--accent); }
.process-svg .stage { cursor: pointer; outline: none; }
.process-svg .stage rect, .process-svg .stage .tank { fill: var(--surface-2); stroke: var(--line-2); stroke-width: 1.5; transition: fill .2s ease, stroke .2s ease; }
.process-svg .stage .liquid { fill: var(--accent-soft); }
.process-svg .stage:hover rect, .process-svg .stage:hover .tank,
.process-svg .stage:focus-visible rect, .process-svg .stage:focus-visible .tank { stroke: var(--accent-line); }
.process-svg .stage.on rect, .process-svg .stage.on .tank { stroke: var(--accent); stroke-width: 2; fill: var(--accent-soft); }
.process-svg .st-t { font-family: var(--f-display); font-weight: 600; font-size: 17px; fill: var(--text); text-anchor: middle; }
.process-svg .st-s { font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 10.5px; fill: var(--muted); text-anchor: middle; }
.process-svg .bubble { fill: var(--accent); opacity: .8; animation: rise 3.2s ease-in infinite; transform-box: fill-box; }
.process-svg .b2 { animation-delay: .8s; } .process-svg .b3 { animation-delay: 1.6s; } .process-svg .b4 { animation-delay: 2.3s; }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .9; } 80% { opacity: .7; } 100% { transform: translateY(-62px); opacity: 0; } }
.process-info { padding: clamp(20px, 3vw, 28px); display: grid; gap: 10px; align-content: start; }
.process-info h3 { font-family: var(--f-display); font-weight: 600; font-size: 1.5rem; letter-spacing: -.01em; }
.process-info p:not(.process-k) { color: var(--text-2); font-size: 15px; }
.process-k { color: var(--accent-text); }
.process-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.process-tags li { font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 11.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2); }

/* ---------- Model lab ---------- */
.lab { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.lab-tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--surface-2); overflow-x: auto; scrollbar-width: none; }
.lab-tabs::-webkit-scrollbar { display: none; }
.lab-tab {
  flex: 1 0 auto; display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
  padding: 15px 22px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted);
  font-weight: 600; font-size: 14.5px; position: relative; transition: color .15s ease, background-color .15s ease;
}
.lab-tab .mono { font-size: 11px; color: var(--muted); font-weight: 500; }
.tab-short { display: none; }
.lab-tab:hover { color: var(--text); }
.lab-tab[aria-selected="true"] { background: var(--surface); color: var(--text); }
.lab-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--accent); }
.lab-tab[aria-selected="true"] .mono { color: var(--accent-text); }
.lab-panel { display: grid; grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); }
.lab-side { padding: clamp(20px, 3vw, 28px); border-right: 1px solid var(--line); display: grid; gap: 18px; align-content: start; }
.lab-main { padding: clamp(16px, 2.5vw, 24px) clamp(16px, 3vw, 28px); display: grid; gap: 12px; align-content: start; min-width: 0; }
.lab-q { font-family: var(--f-display); font-style: italic; font-weight: 500; font-size: 1.3rem; line-height: 1.3; }
.ctrl { display: grid; gap: 4px; }
.ctrl label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.ctrl output { color: var(--accent-text); font-weight: 600; font-size: 13px; }
.ctrl-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; margin: 0; cursor: pointer;
  --pct: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--pct), var(--line-2) var(--pct));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); transition: transform .12s ease;
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 6px var(--accent-line); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 6px var(--accent-line); }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.readouts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; margin: 0; }
.readouts div { padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.readouts dt { font-size: 12.5px; color: var(--muted); }
.readouts dd { margin: 2px 0 0; font-size: 1.05rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-2); stroke-width: 1; }
.chart .tick { font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 11px; fill: var(--muted); }
.chart .axis-label { font-family: var(--f-body); font-size: 12px; font-weight: 500; fill: var(--text-2); }
.chart .line-main { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area-main { fill: var(--accent-soft); stroke: none; }
.chart .line-ref { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 6 5; opacity: .9; }
.chart .guide { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 4; opacity: .7; }
.chart .guide-label { font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 11px; fill: var(--text-2); }
.chart .guide-label.accent, .chart .guide-label.strong { fill: var(--text); font-weight: 600; }
.chart .marker { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .bar-rain { fill: var(--line-2); }
.chart .bar-excess { fill: var(--accent); opacity: .85; }
.chart .legend { font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 10.5px; fill: var(--muted); }
.chart .legend-sw-main { stroke: var(--accent); stroke-width: 2.2; }
.chart .legend-sw-ref { stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 5 4; }
.eq {
  font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; overflow-x: auto; white-space: nowrap;
}
.lab-note { font-size: 13px; color: var(--muted); }

/* ---------- Projects ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px 22px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
  --mx: 50%; --my: 0%;
}
.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s ease;
  background: radial-gradient(320px circle at var(--mx) var(--my), var(--accent-soft), transparent 65%);
}
.card:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }
.card > * { position: relative; }
.card-top { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.card-top span:first-child { color: var(--accent-text); }
.card h3 { font-family: var(--f-display); font-weight: 600; font-size: 1.32rem; line-height: 1.2; letter-spacing: -.01em; }
.card p:not(.card-top):not(.card-metric) { font-size: 14.5px; color: var(--text-2); }
.card-metric { margin-top: auto; padding-top: 8px; font-size: 12.5px; font-weight: 500; color: var(--text); border-top: 1px dashed var(--line); }
.card-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.card-tags li { font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 11px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.card-tags a { color: var(--accent-text); text-decoration: none; }
.card-tags a:hover { text-decoration: underline; }
.flash { animation: flash 1.8s ease; }
@keyframes flash {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  20%, 60% { box-shadow: 0 0 0 3px var(--accent), 0 0 0 9px var(--accent-soft); }
}

/* ---------- Publications ---------- */
.pubs { list-style: none; border-top: 1px solid var(--line); }
.pub {
  display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 16px; padding: 22px 12px; margin-inline: -12px;
  border-bottom: 1px solid var(--line); border-radius: 6px; transition: background-color .2s ease; scroll-margin-top: calc(var(--nav-h) + 24px);
}
.pub:hover { background: var(--surface); }
.pub-year { font-size: 1.25rem; font-weight: 600; color: var(--muted); transition: color .2s ease; font-variant-numeric: tabular-nums; }
.pub:hover .pub-year { color: var(--accent-text); }
.pub h3 { font-family: var(--f-display); font-weight: 500; font-size: 1.24rem; line-height: 1.35; letter-spacing: -.005em; }
.pub h3 a { color: var(--text); text-decoration: none; background-image: linear-gradient(var(--accent), var(--accent)); background-size: 0 1.5px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .3s ease, color .2s ease; }
.pub h3 a:hover { color: var(--accent-text); background-size: 100% 1.5px; }
.pub-authors { margin-top: 6px; font-size: 14px; color: var(--text-2); }
.pub-authors .me { color: var(--text); font-weight: 700; box-shadow: inset 0 -.45em 0 var(--accent-soft); }
.more-authors { border: 0; background: none; padding: 0 2px; color: var(--accent-text); font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.pub-venue { margin-top: 2px; font-size: 14px; color: var(--muted); }
.pub-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.act {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 5px;
  font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 12px; font-weight: 500; text-decoration: none;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2);
  transition: border-color .15s ease, color .15s ease;
}
.act:hover { border-color: var(--accent); color: var(--accent-text); }
.act .ico { width: 14px; height: 14px; }
.pubs-foot { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, .7fr); gap: 32px; margin-top: 36px; align-items: start; }
.talks-k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
.talks ul { list-style: none; display: grid; gap: 10px; }
.talks li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; font-size: 15px; color: var(--text-2); }
.talks li .mono { color: var(--muted); font-size: 13px; }
.profiles { display: grid; gap: 10px; }
.profile-link {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600;
  transition: border-color .15s ease, transform .15s ease;
}
.profile-link .ico-s { margin-left: auto; color: var(--muted); }
.profile-link:hover { border-color: var(--accent); transform: translateX(3px); }

/* ---------- Toolkit ---------- */
.toolkit { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, .75fr); gap: 32px; align-items: start; }
.tool-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 32px; }
.tool-group h3 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 12px; }
.tool-group ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.tool {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2);
  padding: 7px 13px; border-radius: 999px; font-size: 14px; font-weight: 500; text-align: left;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease, transform .15s ease;
}
.tool:hover { border-color: var(--accent-line); color: var(--text); transform: translateY(-1px); }
.tool[aria-pressed="true"] { background: var(--btn); border-color: var(--btn); color: var(--on-accent); }
.used-in {
  position: sticky; top: calc(var(--nav-h) + 24px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.used-k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.used-in h3 { margin-top: 6px; font-family: var(--f-display); font-weight: 600; font-size: 1.45rem; letter-spacing: -.01em; }
.used-empty { margin-top: 8px; font-size: 14.5px; color: var(--text-2); }
.used-list { list-style: none; margin-top: 12px; display: grid; gap: 6px; }
.used-list a {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: baseline;
  padding: 9px 10px; border-radius: 6px; text-decoration: none; color: var(--text); border: 1px solid var(--line);
  transition: border-color .15s ease, background-color .15s ease;
}
.used-list a:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.used-list .u-kind { font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.used-list .u-title { font-size: 14px; font-weight: 500; line-height: 1.4; }
.used-list .u-go { color: var(--accent-text); font-size: 13px; }

/* ---------- Contact (inverted band) ---------- */
.section-contact { background: var(--bg); color: var(--text); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 72px); align-items: start; }
.contact-list { list-style: none; margin-top: 28px; border-top: 1px solid var(--line); }
.contact-list li { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.contact-list .ico { color: var(--accent); }
.contact-list a, .contact-list span { color: var(--text); text-decoration: none; font-weight: 500; overflow-wrap: anywhere; min-width: 0; }
.contact-list a:hover { color: var(--accent-text); }
.copy-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; flex: none;
  border: 1px solid var(--line-2); background: transparent; color: var(--text-2); border-radius: 5px; padding: 5px 9px;
  font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 11.5px;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.copy-btn .ico { width: 14px; height: 14px; color: currentColor; }
.copy-btn.copied { border-color: var(--accent); color: var(--accent-text); }
.social { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.social a {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: border-color .15s ease, color .15s ease;
}
.social a:hover { border-color: var(--accent); color: var(--accent-text); }
.contact-form {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: clamp(20px, 3vw, 28px);
  display: grid; gap: 16px; box-shadow: var(--shadow);
}
.form-head {
  display: flex; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--line);
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
#form-mode { color: var(--accent-text); }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: 6px;
  padding: 11px 13px; font-size: 15px; color: var(--text); transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; min-height: 120px; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .8; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .invalid, .field [aria-invalid="true"] { border-color: var(--text); border-style: dashed; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-status { font-size: 14px; color: var(--text-2); min-height: 1.4em; }
.form-status.ok { color: var(--accent-text); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--bg); color: var(--muted); padding-block: 26px calc(26px + env(safe-area-inset-bottom, 0px)); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; justify-content: space-between; font-size: 13.5px; }
.footer-hint { font-size: 12px; }
.to-top { color: var(--text-2); text-decoration: none; font-size: 12.5px; }
.to-top:hover { color: var(--accent-text); }

/* ---------- Command palette ---------- */
.palette { position: fixed; inset: 0; z-index: 120; display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 10, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.palette-box {
  position: relative; width: min(640px, 100%); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.palette-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-input-row input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 16px; color: var(--text); outline: none; }
.palette-list { list-style: none; max-height: min(52vh, 440px); overflow-y: auto; padding: 6px; }
.palette-list li { list-style: none; }
.p-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 0; background: transparent; color: var(--text); text-decoration: none; text-align: left; font-size: 14.5px; cursor: pointer;
}
.p-item .p-kind { margin-left: auto; font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); flex: none; }
.p-item .p-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-item[aria-selected="true"] { background: var(--accent-soft); }
.p-item[aria-selected="true"] .p-kind { color: var(--accent-text); }
.p-empty { padding: 18px 12px; color: var(--muted); font-size: 14px; }
.palette-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 130;
  transform: translate(-50%, 12px); opacity: 0; transition: opacity .2s ease, transform .2s ease;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }


/* ---------- Rotating "Now" line ---------- */
.rotator { display: grid; min-height: 3em; overflow: hidden; }
.rot-item { grid-area: 1 / 1; }
.rot-in { animation: rotIn .5s cubic-bezier(.2, .7, .2, 1) both; }
.rot-out { animation: rotOut .5s ease both; }
@keyframes rotIn { from { transform: translateY(100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rotOut { from { transform: none; opacity: 1; } to { transform: translateY(-100%); opacity: 0; } }

/* ---------- Digester temperature toggle ---------- */
.process-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface-2); }
.seg-btn {
  border: 0; background: transparent; color: var(--text-2); border-radius: 999px; padding: 5px 12px;
  font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 11.5px; font-weight: 500;
  transition: background-color .2s ease, color .2s ease;
}
.seg-btn.is-on { background: var(--btn); color: var(--on-accent); }
.process-temp { margin-top: 8px; font-size: 14px; color: var(--text-2); }
.process-temp a { font-weight: 600; }
.process[data-temp="cold"] .bubble { animation-duration: 8.5s; }
.process[data-temp="cold"] .b2, .process[data-temp="cold"] .b4 { display: none; }
.process[data-temp="cold"] .stage .liquid { fill: var(--surface-2); }
.process[data-temp="cold"] .flow-dash { animation-duration: 3.2s; }

/* ---------- Chart hover layer ---------- */
.lab-main { position: relative; }
.chart:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.chart .xhair-line { stroke: var(--text-2); stroke-width: 1; opacity: .55; }
.chart .xhair-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .xhair-dot.ref { fill: var(--muted); }
.chart-tip, .plume-tip, .network-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 120px;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 8px 10px; box-shadow: var(--shadow); font-size: 12.5px; line-height: 1.45;
}
.chart-tip .tip-x { font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.chart-tip .tip-row strong { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-tip .tip-key { width: 14px; height: 2px; background: var(--accent); align-self: center; flex: none; }
.chart-tip .tip-key.ref { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px); }
.chart-tip .tip-name { color: var(--muted); }

/* ---------- Groundwater plume ---------- */
.plume-wrap { position: relative; }
.plume-wrap canvas { display: block; width: 100%; aspect-ratio: 64 / 27; border-radius: 6px; cursor: crosshair; }
.plume-tip strong, .network-tip strong { display: block; color: var(--text); font-weight: 650; }
.plume-tip span, .network-tip span { display: block; color: var(--muted); }
.plume-scale { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); }
.plume-ramp { flex: 1; max-width: 260px; height: 8px; border-radius: 4px; border: 1px solid var(--line); background: linear-gradient(90deg, var(--surface), var(--seq-hi)); }
.play-btn { justify-self: start; gap: 9px; }
.play-ico { width: 0; height: 0; border-left: 9px solid currentColor; border-top: 5.5px solid transparent; border-bottom: 5.5px solid transparent; }
.play-btn[aria-pressed="true"] .play-ico { width: 9px; height: 11px; border: 0; border-left: 3px solid currentColor; border-right: 3px solid currentColor; }
.play-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-text); }

/* ---------- Co-author network ---------- */
.network { margin: 40px 0 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: clamp(18px, 3vw, 26px); box-shadow: var(--shadow); }
.network-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 28px; flex-wrap: wrap; }
.network-k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.network h3 { margin-top: 6px; font-family: var(--f-display); font-weight: 500; font-size: clamp(1.4rem, 2.4vw, 1.8rem); letter-spacing: -.01em; }
.network-sub { margin-top: 4px; font-size: 14px; color: var(--text-2); }
.network-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 11px; color: var(--muted); }
.network-legend li { display: inline-flex; align-items: center; gap: 7px; }
.lg-me { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.lg-paper { width: 11px; height: 11px; border-radius: 3px; border: 2px solid var(--accent); background: var(--surface); }
.lg-author { width: 9px; height: 9px; border-radius: 50%; background: var(--text-2); }
.network-box { position: relative; margin-top: 12px; overflow-x: auto; }
.network-svg { display: block; width: 100%; min-width: 560px; height: auto; }
.nw-edge { stroke: var(--line-2); stroke-width: 1; transition: stroke .2s ease, opacity .2s ease, stroke-width .2s ease; }
.nw-edge.me { stroke: var(--accent-line); stroke-width: 1.6; }
.nw-node { outline: none; }
.nw-hit { fill: transparent; }
.nw-dot { fill: var(--text-2); transition: fill .2s ease; }
.nw-person.multi .nw-dot { fill: var(--text); }
.nw-label { font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 11.5px; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.nw-paper { cursor: pointer; }
.nw-box { fill: var(--surface); stroke: var(--accent); stroke-width: 2; transition: fill .2s ease; }
.nw-plabel { font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 11px; fill: var(--text); font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.nw-pyear { font-family: var(--f-mono); font-stretch: var(--mono-w); font-size: 10.5px; fill: var(--muted); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.nw-me-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 3; }
.nw-me-t { font-family: var(--f-display); font-style: italic; font-weight: 600; font-size: 13px; fill: #fff; pointer-events: none; }
.network-svg.focus .nw-edge, .network-svg.focus .nw-node { opacity: .18; }
.network-svg.focus .nw-edge.hl, .network-svg.focus .nw-node.hl { opacity: 1; }
.network-svg .nw-edge.hl { stroke: var(--accent); stroke-width: 1.8; }
.nw-paper.hl .nw-box, .nw-paper:hover .nw-box, .nw-paper:focus-visible .nw-box { fill: var(--accent-soft); }
.nw-node:focus-visible .nw-dot, .nw-node:focus-visible .nw-box, .nw-node:focus-visible .nw-me-dot { stroke: var(--accent); stroke-width: 3; }
.nw-node.muted, .nw-edge.muted { opacity: .12; }
.network-tip { max-width: 320px; white-space: normal; }

/* ---------- Contact: topic picker ---------- */
.open-k { margin-top: 28px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.open-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.open-item {
  display: grid; gap: 4px; text-align: left; padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}
.open-item:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.open-item[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.open-t { font-family: var(--f-display); font-weight: 600; font-size: 1.12rem; line-height: 1.2; }
.open-d { font-size: 13.5px; color: var(--text-2); line-height: 1.45; }

/* ---------- Footer links ---------- */
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-links a { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); text-decoration: none; font-size: 13.5px; }
.footer-links a:hover { color: var(--accent-text); }
.footer-links .ico { width: 16px; height: 16px; }

/* ---------- Side gauge (wide screens) ---------- */
.gauge { display: none; }
@media (min-width: 1300px) {
  .progress { display: none; }
  .gauge {
    display: block; position: fixed; right: 22px; top: 50%; transform: translateY(-50%); z-index: 40;
    height: min(56vh, 520px); width: 14px;
  }
  .gauge-read {
    position: absolute; bottom: calc(100% + 12px); right: -4px; white-space: nowrap;
    font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text);
    writing-mode: vertical-rl; transform: rotate(180deg);
  }
  .gauge-tube { position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
  .gauge-fill { position: absolute; inset: 0; background: var(--accent); transform-origin: 50% 0; transform: scaleY(0); transition: transform .15s linear; }
  .gauge-ticks { list-style: none; position: absolute; inset: 0; }
  .gauge-ticks li { position: absolute; left: 0; transform: translateY(-50%); }
  .gauge-ticks a { display: flex; align-items: center; justify-content: flex-end; flex-direction: row-reverse; gap: 10px; text-decoration: none; padding: 4px 0; }
  .gt-dot { width: 14px; height: 14px; display: grid; place-items: center; }
  .gt-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--line-2); transition: all .2s ease; }
  .gauge-ticks li.past .gt-dot::before { border-color: var(--accent); background: var(--accent); }
  .gauge-ticks li.on .gt-dot::before { width: 10px; height: 10px; border-color: var(--accent); background: var(--bg); box-shadow: 0 0 0 4px var(--accent-soft); }
  .gt-label {
    position: absolute; right: 22px; white-space: nowrap; font-family: var(--f-mono); font-stretch: var(--mono-w);
    font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2);
    background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px;
    opacity: 0; transform: translateX(6px); pointer-events: none; transition: opacity .15s ease, transform .15s ease;
  }
  .gauge-ticks a:hover .gt-label, .gauge-ticks a:focus-visible .gt-label { opacity: 1; transform: none; }
}

/* ---------- Reveal ---------- */
.js .reveal { transition: transform .8s cubic-bezier(.2, .7, .2, 1), opacity .8s ease; }
.js .reveal.pre { transform: translateY(26px); opacity: .55; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .nav-links a { padding: 8px 8px; font-size: 14px; }
  .kbd-hint { display: none; }
}
@media (max-width: 960px) {
  .menu-btn { display: inline-flex; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px var(--gutter) 16px;
    background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    display: none;
  }
  .nav.menu-open .nav-links { display: flex; }
  .nav-links a { padding: 13px 4px; font-size: 16px; border-bottom: 1px solid var(--line); border-radius: 0; }
  .nav-links a:last-child { border-bottom: 0; }
  .nav-links a.active::after { left: auto; right: 4px; top: 50%; bottom: auto; width: 6px; height: 6px; border-radius: 50%; transform: translateY(-50%); }
  .nav-tools { margin-left: auto; }

  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .portrait { order: -1; justify-self: start; max-width: 190px; }
  .portrait-frame { padding: 12px; }
  .portrait figcaption { text-align: left; }
  .hero-scrim {
    background:
      linear-gradient(180deg, rgba(var(--scrim-rgb), 0) 0%, rgba(var(--scrim-rgb), .55) 22%, rgba(var(--scrim-rgb), .9) 42%, rgba(var(--scrim-rgb), .94) 100%);
  }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }

  .about-grid, .journey-grid, .process, .research-grid-2, .toolkit, .contact-grid, .pubs-foot { grid-template-columns: minmax(0, 1fr); }
  .map-sticky { position: static; }
  .used-in { position: static; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-panel { grid-template-columns: minmax(0, 1fr); }
  .lab-side { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .brand-sub { display: none; }
  .lab-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .lab-tab { border-bottom: 1px solid var(--line); }
  .open-list { grid-template-columns: minmax(0, 1fr); }
  .map .node-label { font-size: 24px; }
  .map .grat-label { display: none; }
  .lab-tab { padding: 13px 14px; font-size: 14px; gap: 7px; flex: 1 1 auto; justify-content: center; }
  .tab-long { display: none; }
  .tab-short { display: inline; }
  .hero { padding-top: 32px; }
  .hero-meta { grid-template-columns: minmax(0, 1fr); }
  .hud { top: 10px; }
  .hud-text { display: none; }
  .research-grid, .cards, .tool-groups { grid-template-columns: minmax(0, 1fr); }
  .pub { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .pub-year { font-size: 1rem; }
  .readouts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .spec-list div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .footer-hint { display: none; }
  .stat-pop { left: 0; right: auto; width: min(280px, 80vw); }
  .stat:nth-child(even) .stat-pop { left: auto; right: 0; }
}

/* ---------- 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; }
  .js .reveal.pre { transform: none; opacity: 1; }
}
