/* ════════════════════════════════════════════════════════════════
   STACX — STandAloneCompleX
   Modular Infrastructure for End-to-End Agentic RL
   ════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────────────────────────── */
:root {
  /* Surfaces — lighter, airier palette */
  --bg: #fafbfc;
  --bg-alt: #f4f6f8;
  --surface: #f0f3f5;
  --border: #e8ebee;
  --border-strong: #d7dde5;

  /* Text */
  --text: #15211b;
  --text-mid: #3c4a43;
  --text-dim: #8a94a6;
  --text-faint: #b0bac6;

  /* Brand — derived from the STACX logo (green) */
  --brand: #15803d;
  --brand-deep: #0c5a2c;
  --brand-soft: #e9f7ef;
  --brand-tint: rgba(21, 128, 61, 0.07);

  /* Diagram accents — pastel versions of the saturated source colors */
  --blue: #3b82d6;
  --green: #1a9d5c;
  --purple: #7c5cd6;
  --amber: #c97a2b;
  --cyan: #2b8a9d;

  /* Pastel tint backgrounds matching each accent */
  --blue-tint: #eaf3fd;
  --green-tint: #e9f7ef;
  --purple-tint: #f1edfb;
  --amber-tint: #fdf3e7;
  --cyan-tint: #e8f6f8;

  /* Dark surfaces (code editor — stays intentionally dark) */
  --ink: #0c1712;
  --ink-soft: #122019;
  --ink-line: #1e3128;

  /* Shape */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow: 0 4px 12px rgba(16, 24, 40, 0.06), 0 12px 32px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.10);

  /* Type */
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", ui-monospace, monospace;

  --maxw: 1140px;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

::selection { background: rgba(21, 128, 61, 0.16); }

/* ── Layout helpers ─────────────────────────────────────────────── */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 900px; }

section { position: relative; }
.section { padding: 116px 0; }
.section--alt { background: var(--bg-alt); }
.section--tight { padding: 72px 0; }

.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); border: 0; }

/* keeps the page's only <h1> available to screen readers and crawlers
   while the hero shows the logo lockup instead of repeating the wordmark */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ── Section heading kit ────────────────────────────────────────── */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 16px;
}
.eyebrow::before {
  content: ""; width: 22px; height: 2px; border-radius: 2px;
  background: var(--brand); display: inline-block;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px); font-weight: 700; letter-spacing: -1.2px;
  line-height: 1.1; color: var(--text);
}
.section-lead {
  font-size: clamp(17px, 2vw, 19px); color: var(--text-dim);
  margin-top: 18px; max-width: 900px; line-height: 1.7;
}
.section-head { margin-bottom: 52px; }
.section-head.center { text-align: center; }
.section-head.center .eyebrow { justify-content: center; }
.section-head.center .section-lead { margin-left: auto; margin-right: auto; }

/* ── Engine section header card ─────────────────────────────────── */
.section-head--engine {
  display: flex; flex-direction: row; align-items: flex-start; gap: 40px;
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-sm); padding: 28px 36px; margin-bottom: 52px;
}
.engine-head__left {
  flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.engine-head__num {
  font-family: var(--font-display); font-size: 56px; font-weight: 300;
  line-height: 1; letter-spacing: -2px; opacity: 0.18; margin: 4px 0 2px;
  display: block;
}
.engine-head__right {
  flex: 1; min-width: 0; display: flex; align-items: center;
}
.section-head--engine .section-lead {
  margin-top: 0; max-width: 52ch; font-size: clamp(15px, 1.8vw, 17px);
}
.section-head--engine .section-title {
  font-size: clamp(24px, 3.2vw, 36px);
}
@media (max-width: 900px) {
  .section-head--engine {
    flex-direction: column; gap: 16px; padding: 22px 22px;
  }
  .engine-head__num { font-size: 44px; }
  .section-head--engine .section-lead { max-width: 100%; }
}

/* ════════════════════════════════════════════════════════════════
   NAVBAR
   ════════════════════════════════════════════════════════════════ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 64px;
  display: flex; align-items: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}
.nav.scrolled { border-bottom-color: var(--border); box-shadow: 0 2px 16px rgba(12, 35, 23, 0.05); }
.nav__inner { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; }

.brand { display: flex; align-items: center; gap: 10px; }
/* height-only sizing keeps both marks proportional at any viewport */
.brand__mark { height: 30px; width: auto; flex-shrink: 0; }
.brand__word { height: 22px; width: auto; flex-shrink: 0; }

.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__links a {
  font-size: 14.5px; font-weight: 500; color: var(--text-mid);
  padding: 8px 13px; border-radius: 8px; transition: color 0.2s, background 0.2s;
  position: relative;
}
.nav__links a:hover { color: var(--brand); background: var(--brand-tint); }
.nav__links a.active { color: var(--brand); }

/* icon-only GitHub entry — the hero already carries the labelled "Code" button,
   so this stays quiet and just keeps the repo reachable from the fixed nav */
.nav__gh {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
  color: var(--text-mid); transition: color 0.2s, background 0.2s;
}
.nav__gh:hover { color: var(--brand); background: var(--brand-tint); }
.nav__gh svg { width: 20px; height: 20px; fill: currentColor; }

.nav__toggle { display: none; background: none; border: 0; cursor: pointer; width: 40px; height: 40px; border-radius: 8px; color: var(--text); }
.nav__toggle svg { width: 24px; height: 24px; margin: 0 auto; }

/* ════════════════════════════════════════════════════════════════
   HERO
   ════════════════════════════════════════════════════════════════ */
.hero {
  position: relative; padding: 150px 0 90px; overflow: hidden;
  text-align: center;
}
.hero__bg {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(21,128,61,0.10), transparent 70%),
    radial-gradient(40% 40% at 85% 20%, rgba(43,138,157,0.07), transparent 70%),
    radial-gradient(40% 40% at 12% 30%, rgba(127,170,58,0.07), transparent 70%);
}
.hero__bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle at center, rgba(21,128,61,0.06) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(70% 60% at 50% 30%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(70% 60% at 50% 30%, #000 0%, transparent 75%);
}

.hero__logo {
  width: min(440px, 78vw); margin: 0 auto 30px;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(21, 90, 44, 0.28), 0 4px 10px rgba(0,0,0,0.1);
  border: 6px solid rgba(255,255,255,0.85);
}

.hero__tagline {
  font-size: clamp(18px, 2.4vw, 23px); color: var(--text-mid); font-weight: 400;
  max-width: 740px; margin: 22px auto 0; line-height: 1.5;
  text-wrap: pretty; /* avoids a single-word last line where supported */
}
.hero__tagline b { color: var(--text); font-weight: 650; }
/* mirror the README title's break: "...for End-to-End" / "Agentic Reinforcement Learning".
   Suppressed on narrow screens so the sentence reflows naturally instead of breaking twice. */
.hero__tagline br { display: none; }
@media (min-width: 640px) { .hero__tagline br { display: inline; } }

.authors { margin-top: 30px; font-size: 17px; color: var(--text-mid); line-height: 1.9; }
.authors a { color: var(--brand-deep); font-weight: 550; border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.authors a:hover { border-bottom-color: var(--brand); }
.authors .pi { color: var(--text-dim); }
.affil { margin-top: 6px; font-size: 15.5px; color: var(--text-dim); }
.affil .gt { color: var(--brand-deep); font-weight: 600; }
.authors .lead-sup { color: var(--brand-deep); font-weight: 700; margin-left: 1px; }
.author-roles { margin-top: 8px; font-size: 13px; color: var(--text-dim); letter-spacing: 0.02em; }
.author-roles .lead-key { color: var(--brand-deep); font-weight: 700; margin-right: 2px; }

/* Buttons */
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 34px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 15px; font-weight: 600; padding: 11px 22px; border-radius: 11px;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
  border: 1px solid transparent;
}
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn--dark { background: var(--ink); color: #fff; box-shadow: var(--shadow-sm); }
.btn--dark:hover { transform: translateY(-2px); box-shadow: var(--shadow); background: #1a2e24; }
.btn--brand { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(21,128,61,0.3); }
.btn--brand:hover { transform: translateY(-2px); background: var(--brand-deep); box-shadow: 0 8px 22px rgba(21,128,61,0.38); }
.btn--ghost { background: #fff; color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn--ghost:hover { transform: translateY(-2px); border-color: var(--brand); color: var(--brand-deep); box-shadow: var(--shadow); }
.btn--doc { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(59,130,214,0.28); }
.btn--doc:hover { transform: translateY(-2px); background: #2f6fc2; box-shadow: 0 8px 22px rgba(59,130,214,0.36); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 34px; }
.chip {
  font-size: 13.5px; font-weight: 550; padding: 7px 16px; border-radius: 9999px;
  background: var(--brand-tint); color: var(--brand-deep); border: 1px solid rgba(21,128,61,0.18);
  transition: transform 0.15s;
}
.chip:hover { transform: translateY(-2px); }
.chip.b { background: var(--blue-tint); color: var(--blue); border-color: rgba(59,130,214,0.2); }
.chip.p { background: var(--purple-tint); color: var(--purple); border-color: rgba(124,92,214,0.2); }
.chip.a { background: var(--amber-tint); color: var(--amber); border-color: rgba(201,122,43,0.2); }
.chip.c { background: var(--cyan-tint); color: var(--cyan); border-color: rgba(43,138,157,0.2); }

/* ════════════════════════════════════════════════════════════════
   ABSTRACT / OVERVIEW
   ════════════════════════════════════════════════════════════════ */
.abstract {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.abstract::before {
  content: ""; position: absolute; left: 0; top: 28px; bottom: 28px; width: 4px;
  border-radius: 4px; background: linear-gradient(var(--brand), #0c7d6d);
}
.abstract h3 { font-family: var(--font-display); font-size: 15px; letter-spacing: 1px; text-transform: uppercase; color: var(--brand); margin-bottom: 14px; }
.abstract p { font-size: 17.5px; color: var(--text-mid); line-height: 1.78; }
.abstract p + p { margin-top: 14px; }
.abstract b { color: var(--text); font-weight: 600; }

/* Figure card */
.figure {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 34px; box-shadow: var(--shadow-sm); margin-top: 12px;
}
.figure--pad { padding: 38px 42px; }
.figure svg { width: 100%; height: auto; }
.figure__cap {
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border-strong);
  font-size: 14.5px; color: var(--text-dim); text-align: center; line-height: 1.6;
}
.figure__cap b { color: var(--text-mid); font-weight: 600; }
.figure__cap a { color: var(--brand-deep); font-weight: 600; border-bottom: 1px solid rgba(21,128,61,0.4); transition: border-color 0.2s; }
.figure__cap a:hover { border-bottom-color: var(--brand); }

/* Loop / engine legend under framework */
.loop-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 28px; }
.loop-legend .item {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 18px 20px; box-shadow: var(--shadow-sm); transition: transform 0.18s, box-shadow 0.2s;
}
.loop-legend .item:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.loop-legend .tag {
  display: inline-block; font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.5px; padding: 3px 10px; border-radius: 6px; margin-bottom: 10px;
}
.loop-legend .item h4 { font-size: 17px; font-weight: 650; margin-bottom: 5px; }
.loop-legend .item p { font-size: 14px; color: var(--text-dim); line-height: 1.55; }
.t-blue { background: var(--blue-tint); color: var(--blue); }
.t-green { background: var(--green-tint); color: var(--green); }
.t-cyan { background: var(--cyan-tint); color: var(--cyan); }
.t-purple { background: var(--purple-tint); color: var(--purple); }
.t-amber { background: var(--amber-tint); color: var(--amber); }

/* ════════════════════════════════════════════════════════════════
   FEATURES + STATS
   ════════════════════════════════════════════════════════════════ */
.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.feature {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 28px 26px; box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.25s, border-color 0.25s;
  position: relative; overflow: hidden;
}
.feature::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent, var(--brand)); transform: scaleX(0); transform-origin: left;
  transition: transform 0.3s ease;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.feature:hover::before { transform: scaleX(1); }
.feature__icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft, var(--brand-tint)); color: var(--accent, var(--brand));
  margin-bottom: 18px;
}
.feature__icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; }
.feature h3 { font-family: var(--font-display); font-size: 20px; font-weight: 650; margin-bottom: 8px; letter-spacing: -0.3px; }
.feature p { font-size: 15px; color: var(--text-dim); line-height: 1.6; }

.fa-brand { --accent: var(--brand); --accent-soft: var(--brand-tint); }
.fa-green { --accent: var(--green); --accent-soft: var(--green-tint); }
.fa-purple { --accent: var(--purple); --accent-soft: var(--purple-tint); }
.fa-amber { --accent: var(--amber); --accent-soft: var(--amber-tint); }
.fa-cyan { --accent: var(--cyan); --accent-soft: var(--cyan-tint); }
.fa-blue { --accent: var(--blue); --accent-soft: var(--blue-tint); }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-top: 24px;
}
.stat { background: #fff; padding: 30px 18px; text-align: center; }
.stat__num { font-family: var(--font-display); font-size: clamp(30px, 4vw, 40px); font-weight: 700; letter-spacing: -1px; line-height: 1; }
.stat__num.sm { font-size: clamp(19px, 2.6vw, 24px); }
.stat__label { font-size: 13.5px; color: var(--text-dim); margin-top: 10px; font-weight: 500; }

/* ════════════════════════════════════════════════════════════════
   ENGINE SECTIONS
   ════════════════════════════════════════════════════════════════ */
.engine-badge {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; letter-spacing: 0.8px;
  padding: 5px 14px; border-radius: 9999px; margin-bottom: 10px;
  border: 1px solid transparent;
}
.engine-badge .dot { width: 7px; height: 7px; border-radius: 50%; }

/* generic two-column block */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.split.wide-left { grid-template-columns: 1.15fr 0.85fr; }
.split.wide-right { grid-template-columns: 0.85fr 1.15fr; }
.split > div { min-width: 0; }

.block-title { font-family: var(--font-display); font-size: 25px; font-weight: 650; letter-spacing: -0.5px; margin-bottom: 12px; }
.block-title .num { color: var(--text-faint); font-weight: 600; margin-right: 8px; }
.block-lead { font-size: 16px; color: var(--text-dim); line-height: 1.7; margin-bottom: 20px; }

.sub-blocks { display: flex; flex-direction: column; gap: 88px; margin-top: 56px; }

/* spec / point list */
.points { display: flex; flex-direction: column; gap: 18px; }
.points-2col { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 4px; }
.points-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: stretch; }
.points-2col { align-items: stretch; }
.points-3col .point, .points-2col .point { height: 100%; }

/* Stretch a points column to match the figure height beside it */
.split--fill { align-items: stretch; }
.split--fill > div { display: flex; flex-direction: column; }

/* Zoom path: Level 0 → Level 1 → Level 2 navigation (Rollout section) */
.zoom-path { display: flex; align-items: stretch; justify-content: center; gap: 14px; margin: 28px auto 36px; max-width: 980px; }
.zoom-step { flex: 1; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: inherit; text-decoration: none; transition: transform 0.18s, box-shadow 0.2s, border-color 0.2s; }
.zoom-step:hover { transform: translateY(-2px); border-color: rgba(26,157,92,0.35); box-shadow: var(--shadow-sm); }
.zoom-step.active { border-color: rgba(26,157,92,0.35); background: rgba(26,157,92,0.05); }
.zoom-level { display: inline-block; margin-bottom: 8px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--green); font-weight: 700; }
.zoom-step h4 { margin: 0 0 4px; font-family: var(--font-display); font-size: 16px; font-weight: 650; }
.zoom-step p { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.5; }
.zoom-arrow { display: flex; align-items: center; color: var(--text-dim); font-weight: 700; font-size: 20px; }

/* Bridge line: light one-line transition between Level 1 and Level 2 */
.bridge-line { max-width: 860px; margin: -36px auto -44px; padding: 12px 16px; border-left: 3px solid var(--green); background: var(--green-tint); border-radius: 10px; color: var(--text-dim); line-height: 1.6; }
.bridge-line b { color: var(--green); }

@media (max-width: 900px) {
  .zoom-path { flex-direction: column; max-width: 440px; }
  .zoom-arrow { transform: rotate(90deg); justify-content: center; }
}
.points-fill { flex: 1; }
.points-fill .point { flex: 1; align-items: center; }

/* Stacked block: header, full-width figure, then a row of points */
.block-stack { display: flex; flex-direction: column; }
.block-stack .figure { margin-top: 8px; }
/* first element after the figure gets the larger gap; later siblings a smaller one */
.block-stack .points-row { margin-top: 32px; }
.block-stack .points-row ~ .points,
.block-stack .points-row ~ .callout { margin-top: 16px; }
.point {
  display: flex; gap: 14px; padding: 18px 20px; border-radius: var(--radius-sm);
  background: #fff; border: 1px solid var(--border);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.point:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.point__ic {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-tint); color: var(--brand);
}
.point__ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.point h4 { font-size: 16px; font-weight: 650; margin-bottom: 2px; }
.point p { font-size: 14px; color: var(--text-dim); line-height: 1.55; }
.point code { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface); padding: 1px 6px; border-radius: 5px; color: var(--brand-deep); }

.point.v-blue .point__ic { background: var(--blue-tint); color: var(--blue); }
.point.v-green .point__ic { background: var(--green-tint); color: var(--green); }
.point.v-purple .point__ic { background: var(--purple-tint); color: var(--purple); }
.point.v-amber .point__ic { background: var(--amber-tint); color: var(--amber); }
.point.v-cyan .point__ic { background: var(--cyan-tint); color: var(--cyan); }

/* callout */
.callout {
  margin-top: 18px; padding: 20px 24px; border-radius: var(--radius-sm);
  background: var(--brand-soft); border: 1px solid rgba(21,128,61,0.2);
}
.callout h3 { font-family: var(--font-display); font-size: 14px; letter-spacing: 1px; text-transform: uppercase; color: var(--brand-deep); margin-bottom: 8px; }
.callout .lead { font-size: 18px; font-weight: 700; color: var(--brand-deep); }
.callout p { font-size: 15px; color: var(--text-mid); margin-top: 4px; line-height: 1.6; }
.callout.v-blue { background: var(--blue-tint); border-color: rgba(59,130,214,0.2); }
.callout.v-blue .lead { color: var(--blue); }
.callout.v-purple { background: var(--purple-tint); border-color: rgba(124,92,214,0.2); }
.callout.v-purple .lead { color: var(--purple); }
/* Overview: "Design principle" as its own light block (brand left-accent) above the diagram */
#overview .callout { margin: 0 auto; max-width: 760px; padding: 16px 22px; background: var(--brand-soft); border: 1px solid rgba(21,128,61,0.16); border-left: 3px solid var(--brand); border-radius: var(--radius-sm); box-shadow: none; text-align: left; }
#overview .callout h3 { margin-bottom: 6px; }
#overview .callout p { font-size: 16px; color: var(--text-mid); line-height: 1.6; margin: 0; }

/* ── Code panel (dark) ──────────────────────────────────────────── */
.code {
  background: var(--ink); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--ink-line);
}
.code__bar {
  display: flex; align-items: center; gap: 7px; padding: 11px 16px;
  background: var(--ink-soft); border-bottom: 1px solid var(--ink-line);
}
.code__bar .d { width: 11px; height: 11px; border-radius: 50%; }
.code__bar .d:nth-child(1) { background: #ff5f57; }
.code__bar .d:nth-child(2) { background: #febc2e; }
.code__bar .d:nth-child(3) { background: #28c840; }
.code__bar .name { margin-left: 10px; font-family: var(--font-mono); font-size: 12px; color: #7d9488; }
.code pre {
  margin: 0; padding: 20px 22px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7; color: #d6e3da;
}
.code .k { color: #c792ea; }   /* keyword */
.code .f { color: #82aaff; }   /* function */
.code .s { color: #9fd28a; }   /* string */
.code .c { color: #5d7568; font-style: italic; } /* comment */
.code .n { color: #f3b07a; }   /* number/const */

/* ── Recipe grid ────────────────────────────────────────────────── */
.recipes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.recipe {
  padding: 12px 14px; border-radius: var(--radius-sm); background: #fff;
  border: 1px solid var(--border); border-left: 3px solid var(--rc, var(--brand));
  box-shadow: var(--shadow-sm); transition: transform 0.15s, box-shadow 0.2s;
}
.recipe:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.recipe .rname { font-family: var(--font-mono); font-size: 13.5px; font-weight: 600; color: var(--rc, var(--brand-deep)); }
.recipe .rdesc { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.rc-blue { --rc: var(--blue); } .rc-green { --rc: var(--green); }
.rc-purple { --rc: var(--purple); } .rc-amber { --rc: var(--amber); } .rc-cyan { --rc: var(--cyan); }

/* ── "Add new algorithm" two-panel ──────────────────────────────── */
.effort-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.effort {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-sm);
}
.effort h4 { font-family: var(--font-display); font-size: 17px; margin-bottom: 16px; }
.effort.write h4 { color: var(--green); }
.effort.keep h4 { color: var(--text-dim); }
.step { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.step__n { width: 32px; height: 32px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.step__t b { font-size: 16px; font-weight: 650; display: block; }
.step__t span { font-size: 13.5px; color: var(--text-dim); }
.untouched { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-radius: 9px; margin-bottom: 8px; font-size: 14.5px; color: var(--text-dim); }
.untouched svg { width: 17px; height: 17px; stroke: var(--brand); fill: none; stroke-width: 2.4; flex-shrink: 0; }
.effort__total { margin-top: 18px; padding: 18px; text-align: center; background: var(--brand-soft); border: 1.5px solid rgba(21,128,61,0.25); border-radius: var(--radius-sm); }
.effort__total .big { font-family: var(--font-display); font-size: 34px; font-weight: 700; color: var(--brand-deep); }
.effort__total .lbl { font-size: 14px; color: var(--text-dim); }

/* ════════════════════════════════════════════════════════════════
   EXPERIMENTS
   ════════════════════════════════════════════════════════════════ */
.chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.chart {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px 12px; box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.25s;
}
.chart:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.chart__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.chart__title { font-family: var(--font-display); font-size: 16px; font-weight: 650; }
.chart__title .muted { font-size: 12px; font-weight: 400; color: var(--text-faint); margin-left: 6px; }
.chart__delta { font-family: var(--font-mono); font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-deep); }
.chart svg { width: 100%; height: auto; }

.exp-meta {
  display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center;
  font-size: 14px; color: var(--text-dim); margin-top: 8px;
}
.exp-meta .pill { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface); border: 1px solid var(--border); padding: 4px 11px; border-radius: 7px; color: var(--text-mid); }

/* results table */
.table-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
table.results { width: 100%; border-collapse: collapse; font-size: 15px; }
table.results th, table.results td { padding: 13px 16px; text-align: center; }
table.results thead th { background: var(--surface); font-family: var(--font-display); font-weight: 600; font-size: 13.5px; color: var(--text-mid); border-bottom: 2px solid var(--border-strong); }
table.results thead th a { color: inherit; border-bottom: 1px solid var(--border-strong); transition: color 0.2s, border-color 0.2s; white-space: nowrap; }
table.results thead th a:hover { color: var(--brand-deep); border-bottom-color: var(--brand); }
table.results tbody td { border-bottom: 1px solid var(--border); }
table.results tbody tr:last-child td { border-bottom: 0; }
table.results td:first-child, table.results th:first-child { text-align: left; font-weight: 550; }
table.results tbody tr.is-stacx { background: var(--brand-tint); }
table.results tbody tr.is-stacx td:first-child { color: var(--brand-deep); font-weight: 700; }
table.results .win { color: var(--brand-deep); font-weight: 700; }
table.results tbody td a { color: var(--brand-deep); font-weight: 600; border-bottom: 1px solid rgba(21,128,61,0.4); transition: border-color 0.2s; }
table.results tbody td a:hover { border-bottom-color: var(--brand); }
table.results tr.newblk td { border-top: 2px solid var(--border-strong); }
table.results tr.grp td { background: var(--surface); font-family: var(--font-display); font-weight: 600; font-size: 11.5px; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-dim); text-align: left; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-bottom: 18px; font-size: 13.5px; color: var(--text-mid); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-legend a { color: inherit; border-bottom: 1px solid var(--border-strong); transition: color 0.2s, border-color 0.2s; }
.chart-legend a:hover { color: var(--brand-deep); border-bottom-color: var(--brand); }

/* comparison bars (MLE / SWE) */
.cmp { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 26px 28px; }
.cmp h4 { font-family: var(--font-display); font-size: 18px; margin-bottom: 4px; }
.cmp .sub { font-size: 13.5px; color: var(--text-dim); margin-bottom: 20px; }
.bar-row { margin-bottom: 16px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-row .bl { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.bar-row .bl .name { font-size: 14px; font-weight: 600; }
.bar-row .bl .val { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.bar-row .bl .val small { font-size: 11px; font-weight: 400; color: var(--text-faint); }
.bar-track { height: 22px; background: var(--surface); border-radius: 7px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 7px; width: var(--w, 0); transition: width 1s cubic-bezier(0.2,0.8,0.2,1); }
.js .bar-fill { width: 0; }
.js .bar-fill.in { width: var(--w, 0); }
.bf-blue { background: linear-gradient(90deg, var(--blue), #5aa0e8); }
.bf-cyan { background: linear-gradient(90deg, var(--cyan), #47b3c8); }
.bf-purple { background: linear-gradient(90deg, var(--purple), #a588e8); }
.bf-brand { background: linear-gradient(90deg, var(--brand), #2faa5e); }

.legend-inline { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.legend-inline i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.exp-note {
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: 28px; padding: 18px 22px; border-radius: var(--radius-sm);
  background: var(--amber-tint); border: 1px dashed rgba(201,122,43,0.3);
}
.exp-note svg { width: 22px; height: 22px; stroke: var(--amber); fill: none; stroke-width: 2; flex-shrink: 0; margin-top: 2px; }
.exp-note p { font-size: 14.5px; color: var(--text-mid); line-height: 1.6; }
.exp-note b { color: var(--amber); }

/* ════════════════════════════════════════════════════════════════
   TAKEAWAYS
   ════════════════════════════════════════════════════════════════ */
.takeaways { display: flex; flex-direction: column; gap: 14px; max-width: 920px; margin: 0 auto; }
.takeaway {
  display: flex; gap: 20px; align-items: center; padding: 22px 26px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: transform 0.2s, box-shadow 0.25s;
}
.takeaway:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.takeaway__n {
  flex-shrink: 0; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 20px; color: #fff;
}
.takeaway h4 { font-size: 18px; font-weight: 650; margin-bottom: 2px; }
.takeaway p { font-size: 15px; color: var(--text-dim); line-height: 1.55; }

/* Motivation: two-takeaway strip (RL infra high-level goals) */
.motivation-takeaways { display: flex; gap: 18px; max-width: 920px; margin: 28px auto 0; }
.motivation-takeaways .takeaway { flex: 1; flex-direction: column; align-items: flex-start; gap: 0; padding: 20px 24px; }
.motivation-takeaways .takeaway:hover { transform: translateY(-3px); }
.motivation-takeaways .tag {
  display: inline-block; font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.5px; padding: 3px 10px; border-radius: 6px; margin-bottom: 10px;
}
.motivation-takeaways .takeaway p { margin: 0; }
@media (max-width: 720px) { .motivation-takeaways { flex-direction: column; } }

/* ════════════════════════════════════════════════════════════════
   CITATION
   ════════════════════════════════════════════════════════════════ */
.cite-card { position: relative; }
.cite-card pre {
  background: var(--ink); color: #cfe0d6; border-radius: var(--radius);
  padding: 26px 28px; overflow-x: auto; font-family: var(--font-mono); font-size: 13.5px; line-height: 1.7;
  border: 1px solid var(--ink-line); box-shadow: var(--shadow);
}
.cite-card .copy {
  position: absolute; top: 14px; right: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: #cfe0d6;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; transition: background 0.2s;
}
.cite-card .copy:hover { background: rgba(255,255,255,0.16); }
.cite-card .copy svg { width: 14px; height: 14px; fill: currentColor; }

/* ════════════════════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════════════════════ */
.footer { background: var(--ink); color: #b9ccc1; padding: 56px 0 32px; }
.footer__top { display: flex; flex-wrap: wrap; gap: 32px; justify-content: space-between; align-items: flex-start; }
.footer__brand { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: #fff; letter-spacing: -0.5px; }
.footer__brand span { color: #6fae84; }
.footer p { font-size: 14.5px; line-height: 1.7; max-width: 420px; margin-top: 10px; color: #9fb6aa; }
.footer__links { display: flex; gap: 26px; flex-wrap: wrap; }
.footer__col h5 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: #6fae84; margin-bottom: 12px; font-weight: 600; }
.footer__col a { display: block; font-size: 14.5px; color: #b9ccc1; padding: 4px 0; transition: color 0.2s; }
.footer__col a:hover { color: #fff; }
.footer__bottom { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--ink-line); display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; font-size: 13.5px; color: #7d9488; }

/* ════════════════════════════════════════════════════════════════
   SCROLL REVEAL
   ════════════════════════════════════════════════════════════════ */
/* Progressive enhancement: content is visible by default; only the JS-enabled
   document hides it for the scroll-reveal animation. Guards against IO/JS failure. */
.reveal { transition: opacity 0.7s cubic-bezier(0.22,1,0.36,1), transform 0.7s cubic-bezier(0.22,1,0.36,1); }
.js .reveal { opacity: 0; transform: translateY(26px); }
.js .reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: 0.08s; }
.reveal.d2 { transition-delay: 0.16s; }
.reveal.d3 { transition-delay: 0.24s; }
.reveal.d4 { transition-delay: 0.32s; }

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .split, .split.wide-left, .split.wide-right { grid-template-columns: 1fr; gap: 28px; }
  .feature-grid, .effort-grid, .chart-grid, .recipes, .points-2col, .points-3col { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .loop-legend { grid-template-columns: 1fr; }
  .nav__links { display: none; }
  .nav__links.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: 64px; left: 0; right: 0;
    background: rgba(255,255,255,0.97); backdrop-filter: blur(16px);
    padding: 12px; gap: 2px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .nav__links.open a { padding: 12px 16px; }
  .nav__toggle { display: grid; place-items: center; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .section { padding: 64px 0; }
  .abstract { padding: 28px 22px; }
  .figure { padding: 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .hero { padding: 120px 0 70px; }
  .btn-row { gap: 9px; }
  .btn { padding: 10px 16px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  .reveal, .js .reveal { opacity: 1 !important; transform: none !important; }
  .bar-fill, .js .bar-fill { width: var(--w, 0) !important; }
}

/* ── Experiments: Script / Results tabs + animated curves ───────── */
.exp-tabs { margin-top: 26px; }
.exp-tabs__bar { display: flex; justify-content: center; gap: 10px; margin-bottom: 24px; }
.exp-tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 24px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: #fff;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text-mid);
  cursor: pointer; transition: all 0.2s ease; box-shadow: var(--shadow-sm);
}
.exp-tab svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.exp-tab:hover { color: var(--brand-deep); border-color: var(--brand); transform: translateY(-1px); }
.exp-tab.is-active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(21,128,61,0.28); }
.exp-pane { display: none; }
.exp-pane.is-active { display: block; animation: expFade 0.35s ease; }
@keyframes expFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.exp-code { max-width: 880px; margin: 0 auto; }
.exp-code pre { font-size: 13.5px; }
