/* ============================================================
   Jiakang Zhang Personal Site
   Design system: warm paper background, deep navy ink,
   teal accent, amber + coral for data semantics.
   ============================================================ */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #16243a;
  --ink-soft: #3d4d66;
  --muted: #67758b;
  --line: #e7e4db;
  --accent: #0e7c66;
  --accent-deep: #0a5f4f;
  --accent-soft: #e4f2ee;
  --amber: #e8a33d;
  --amber-soft: #fcf3e3;
  --coral: #d6493e;
  --coral-soft: #fbeae8;
  --navy: #16243a;
  --navy-soft: #eef1f6;

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(22, 36, 58, 0.04), 0 8px 24px rgba(22, 36, 58, 0.06);
  --shadow-lift: 0 2px 4px rgba(22, 36, 58, 0.06), 0 16px 40px rgba(22, 36, 58, 0.12);

  --container: 1080px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; }

figure { margin: 0; }

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* No-JS fallback: content stays visible, charts render complete. */
.no-js .reveal { opacity: 1; transform: none; }
.no-js .bar-fill { transform: scaleX(1); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 0.6em;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.3rem, 5.5vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; }

a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

section { padding: 88px 0; }

.section-head { max-width: 680px; margin-bottom: 48px; }
.section-head p { color: var(--ink-soft); font-size: 1.1rem; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 14px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--navy);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 200;
}
.skip-link:focus { left: 0; }

/* ---------------- Navigation ---------------- */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(251, 250, 247, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}
.nav.scrolled { border-bottom-color: var(--line); }

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}
.nav-logo:hover { text-decoration: none; }

.logo-mark {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  list-style: none;
  margin: 0; padding: 0;
}
.nav-links a {
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
}
.nav-links a:hover { color: var(--ink); text-decoration: none; }

.nav-cta {
  background: var(--navy);
  color: #fff !important;
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 600;
}
.nav-cta:hover { background: var(--accent-deep); }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 8px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--ink);
  margin: 5px 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  padding: 13px 26px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-deep); box-shadow: var(--shadow); }

.btn-ghost {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
}
.btn-ghost:hover { border-color: var(--ink-soft); }

/* ---------------- Hero ---------------- */

.hero {
  padding: 168px 0 96px;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 56px;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--accent-soft);
  border: 1px solid #c8e4dc;
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent-deep);
  margin: 0 0 18px;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.hero h1 { margin-bottom: 20px; }
.hero h1 em {
  font-style: normal;
  color: var(--accent-deep);
}

.hero-sub {
  font-size: 1.16rem;
  color: var(--ink-soft);
  max-width: 540px;
  margin-bottom: 30px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 40px; }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.stat-chip strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink);
}

.hero-visual {
  position: relative;
  display: grid;
  place-items: center;
  margin: 0;
}

.city-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 7px;
  width: min(100%, 400px);
  aspect-ratio: 1;
}
.city-grid .cell {
  border-radius: 6px;
  background: var(--accent);
  opacity: 0.12;
  transition: opacity 0.6s ease;
}
.city-grid .cell.pop { opacity: var(--o, 0.5); }

.hero-visual figcaption {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

/* ---------------- Pillars (What I do) ---------------- */

.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}

.pillar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.pillar:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.pillar-icon {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  margin-bottom: 18px;
}
.pillar h3 { margin-bottom: 8px; }
.pillar p { color: var(--ink-soft); font-size: 0.97rem; margin: 0; }

/* ---------------- Featured research ---------------- */

.feature-band {
  background: var(--navy);
  color: #f4f6f9;
  border-radius: 24px;
  padding: 56px 48px;
  margin-bottom: 26px;
}
.feature-band .eyebrow { color: #8fd4c5; }
.feature-band h2 { color: #fff; }
.feature-band p { color: #c3ccd9; max-width: 640px; }

.headline-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  margin-top: 38px;
}

.headline-stat {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 22px 20px;
}
.headline-stat .num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: #8fd4c5;
  display: block;
  margin-bottom: 4px;
}
.headline-stat .lbl { font-size: 0.88rem; color: #c3ccd9; line-height: 1.45; }

.ability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 20px;
}

.ability-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px;
  color: var(--ink);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.ability-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: var(--accent);
}

.ability-num {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-deep);
  text-transform: uppercase;
}
.ability-card h3 { margin: 10px 0 8px; }
.ability-card p { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 14px; }
.ability-card .go {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-deep);
}

.feature-cta { text-align: center; margin-top: 38px; }

/* ---------------- Project cards ---------------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 26px;
  display: flex;
  flex-direction: column;
}

.project-tag {
  align-self: flex-start;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 5px 12px;
  margin-bottom: 16px;
}

.project-card h3 { margin-bottom: 10px; }
.project-card p { color: var(--ink-soft); font-size: 0.97rem; flex: 1; }

.tool-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tool {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--navy-soft);
  border-radius: 6px;
  padding: 4px 10px;
}

/* ---------------- Timeline ---------------- */

.timeline {
  position: relative;
  max-width: 760px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
}

.timeline li {
  position: relative;
  padding: 0 0 38px 42px;
}
.timeline li:last-child { padding-bottom: 0; }

.timeline li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.tl-date {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.timeline h3 { margin: 6px 0 4px; font-size: 1.12rem; }
.tl-org { color: var(--accent-deep); font-weight: 500; font-size: 0.95rem; }
.timeline p { color: var(--ink-soft); font-size: 0.95rem; margin: 8px 0 0; }

/* ---------------- Skills ---------------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.skill-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px;
}
.skill-group h3 { font-size: 1.02rem; margin-bottom: 14px; }
.skill-group .tool-row { margin-top: 0; }

/* ---------------- Education & award ---------------- */

.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.edu-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px;
}
.edu-card h3 { font-size: 1.05rem; margin-bottom: 4px; }
.edu-card .tl-date { display: block; margin-bottom: 10px; }
.edu-card p { color: var(--ink-soft); font-size: 0.94rem; margin: 0; }

.award {
  margin-top: 26px;
  background: var(--amber-soft);
  border: 1px solid #f0dcb4;
  border-radius: var(--radius);
  padding: 30px 28px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.award-icon { font-size: 1.8rem; line-height: 1; }
.award h3 { margin-bottom: 6px; }
.award p { margin: 0; color: var(--ink-soft); }
.award blockquote {
  margin: 10px 0 0;
  font-style: italic;
  color: var(--ink);
}

/* ---------------- Contact / footer ---------------- */

.contact {
  background: var(--navy);
  color: #f4f6f9;
  border-radius: 24px;
  padding: 64px 48px;
  text-align: center;
}
.contact h2 { color: #fff; }
.contact p { color: #c3ccd9; max-width: 540px; margin: 0 auto 30px; }

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}
.contact .btn-ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}
.contact .btn-ghost:hover { border-color: #fff; }

footer {
  padding: 34px 0 44px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ============================================================
   Research page
   ============================================================ */

.research-hero {
  padding: 168px 0 72px;
  text-align: center;
}
.research-hero h1 { max-width: 820px; margin-left: auto; margin-right: auto; }
.research-hero .hero-sub { margin: 0 auto 28px; max-width: 640px; }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* Chapter scroll-nav */
.chapter-nav {
  position: sticky;
  top: 68px;
  z-index: 90;
  background: rgba(251, 250, 247, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.chapter-nav::-webkit-scrollbar { display: none; }

.chapter-nav ol {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0 auto;
  padding: 0 24px;
  max-width: var(--container);
}
.chapter-nav a {
  display: block;
  white-space: nowrap;
  padding: 13px 14px;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2.5px solid transparent;
}
.chapter-nav a:hover { color: var(--ink); text-decoration: none; }
.chapter-nav a.active { color: var(--accent-deep); border-bottom-color: var(--accent); }

.chapter { padding: 76px 0; }
.chapter + .chapter { border-top: 1px solid var(--line); }

.chapter-head { max-width: 720px; margin-bottom: 40px; }

.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 16px;
}
.skill-tag .ch-num { color: var(--ink); opacity: 0.55; }

.chapter-head p { color: var(--ink-soft); font-size: 1.08rem; }

.prose { max-width: 720px; }
.prose p { color: var(--ink-soft); }
.prose strong { color: var(--ink); }

.note {
  font-size: 0.85rem;
  color: var(--muted);
  border-left: 3px solid var(--line);
  padding-left: 14px;
  margin-top: 14px;
}

.chips-used { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }

/* Figure / chart shells */
.figure {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 28px;
  box-shadow: var(--shadow);
}
.figure h3 { font-size: 1.05rem; margin-bottom: 4px; }
.figure .fig-sub { font-size: 0.88rem; color: var(--muted); margin-bottom: 22px; }
.figure figcaption {
  margin-top: 18px;
  font-size: 0.84rem;
  color: var(--muted);
}

/* Two-question cards (chapter 1) */
.q-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.q-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 26px 24px;
}
.q-card .q-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.q-card h3 { margin: 8px 0 6px; font-size: 1.1rem; }
.q-card p { margin: 0; color: var(--ink-soft); font-size: 0.96rem; }

/* Pipeline (chapter 2) */
.pipeline {
  display: grid;
  grid-template-columns: minmax(0, 5fr) auto minmax(0, 4fr) auto minmax(0, 4fr);
  gap: 18px;
  align-items: center;
}
.pipe-stage h4 {
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.pipe-sources { display: flex; flex-wrap: wrap; gap: 7px; }
.pipe-src {
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--navy-soft);
  color: var(--ink-soft);
  border-radius: 7px;
  padding: 5px 10px;
}
.pipe-arrow {
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: 700;
}
.pipe-box {
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  text-align: center;
}
.pipe-box strong {
  font-family: var(--font-display);
  display: block;
  font-size: 1rem;
  color: var(--accent-deep);
}
.pipe-box span { font-size: 0.82rem; color: var(--ink-soft); }
.pipe-out { display: grid; gap: 10px; }
.pipe-out .pipe-box {
  background: var(--surface);
  border-color: var(--line);
  text-align: left;
  padding: 12px 14px;
}
.pipe-out .pipe-box strong { color: var(--ink); font-size: 0.92rem; }

.pipe-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-top: 26px;
}
.mini-stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: center;
}
.mini-stat .num {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.45rem;
  color: var(--accent-deep);
}
.mini-stat .lbl { font-size: 0.8rem; color: var(--muted); }

/* SVG charts */
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: var(--font-body); }

.axis-label { font-size: 12px; fill: var(--muted); }
.bar-label { font-size: 13px; font-weight: 600; fill: var(--ink); }
.bar-value { font-size: 14px; font-weight: 700; fill: var(--ink); font-family: var(--font-display); }
.bar-value.coral { fill: #b03227; }

.bar-track { fill: var(--navy-soft); }
.bar-fill {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-fill.amber { fill: var(--amber); }
.bar-fill.coral { fill: var(--coral); }
.in-view .bar-fill { transform: scaleX(1); }

/* Calculator (chapter 5) */
.calc {
  display: grid;
  gap: 20px;
}
.calc label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
}
.calc input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.calc-readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}
.calc-readout .mini-stat .num { color: var(--coral); }
.calc-readout .mini-stat:first-child .num { color: var(--ink); }

/* Loophole table (chapter 6) */
.law-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.law-card {
  border-radius: var(--radius);
  padding: 26px 24px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.law-card.regulated { border-top: 4px solid var(--accent); }
.law-card.unregulated { border-top: 4px solid var(--coral); }
.law-card h3 { font-size: 1.05rem; }
.law-card .law-sub { font-size: 0.85rem; color: var(--muted); margin-bottom: 16px; }
.law-card ul { margin: 0; padding: 0; list-style: none; }
.law-card li {
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 0.93rem;
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.law-card li .mark { font-weight: 700; }
.law-card.regulated .mark { color: var(--accent-deep); }
.law-card.unregulated .mark { color: var(--coral); }

/* Stacked share bars (chapter 6) */
.share-bar { margin-bottom: 26px; }
.share-bar .share-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 10px;
}
.share-track {
  display: flex;
  height: 38px;
  border-radius: 9px;
  overflow: hidden;
  background: var(--navy-soft);
}
.share-seg {
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 0;
  flex-basis: 0; /* flex-grow set inline per segment = proportional width, works without JS */
  padding: 0 6px;
  overflow: hidden;
  white-space: nowrap;
}
.share-seg.teal { background: var(--accent); }
.share-seg.coral { background: #c23a30; } /* darker than --coral: white text needs 4.5:1 */
.share-seg.grey { background: #64748b; }
.share-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 10px;
  font-size: 0.84rem;
  color: var(--ink-soft);
}
.share-legend .dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  margin-right: 6px;
}

/* Big-picture diagram (chapter 7) */
.converge {
  display: grid;
  gap: 16px;
}
.converge-band {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
}
.converge-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.converge-row--two { grid-template-columns: 1fr 1fr; }
.converge-cell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.converge-cell strong { display: block; color: var(--ink); font-size: 0.95rem; }
.converge-arrows {
  text-align: center;
  color: var(--accent);
  font-size: 1.3rem;
  letter-spacing: 0.4em;
}

/* Reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.in-view { opacity: 1; transform: none; }

/* CTA band between pages */
.page-cta {
  text-align: center;
  padding: 72px 0 96px;
}

/* ---------------- Responsive ---------------- */

/* Research page has a second sticky bar; anchors need more headroom. */
html:has(body.page-research) { scroll-padding-top: 130px; }

@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .city-grid { width: min(100%, 300px); }
  .feature-band, .contact { padding: 42px 28px; }
  .pipeline {
    grid-template-columns: 1fr;
  }
  .pipe-arrow { transform: rotate(90deg); justify-self: center; }
}

/* The full nav row needs ~880px; collapse to the toggle below that. */
@media (max-width: 880px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 68px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px 24px 18px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 12px 0; font-size: 1.05rem; }
  .nav-links .nav-cta { display: inline-block; margin-top: 10px; padding: 11px 22px; }

  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

}

@media (max-width: 760px) {
  section { padding: 64px 0; }
  .hero { padding: 130px 0 64px; }
  .research-hero { padding: 130px 0 56px; }

  .converge-row, .converge-row--two { grid-template-columns: 1fr; }
  .award { flex-direction: column; gap: 10px; }
}

/* Keep SVG chart text legible on small screens: let the figure scroll sideways
   instead of shrinking 13px labels into 6px ones. */
@media (max-width: 600px) {
  .figure { overflow-x: auto; }
  .figure .chart-svg { min-width: 540px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .bar-fill { transform: scaleX(1); transition: none; }
  .city-grid .cell { transition: none; }
  .btn, .pillar, .ability-card { transition: none; }
}
