:root[data-theme="light"] {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #1e293b;
  --text-muted: #64748b;
  --connector: #d1d5db;
  --nav-bg: rgba(255, 255, 255, 0.85);
  --nav-border: #e5e7eb;
  --explorer: #2563eb;
  --explorer-bg: #eff6ff;
  --consolidator: #7c3aed;
  --consolidator-bg: #f5f3ff;
  --run-command: #4f46e5;
  --run-command-bg: #eef2ff;
  --pool: #0d9488;
  --pool-bg: #f0fdfa;
  --display: #b45309;
  --display-bg: #fffbeb;
  --findings: #be185d;
  --findings-bg: #fdf2f8;
  --provisioner: #dc2626;
  --provisioner-bg: #fef2f2;
  --node-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --node-glow: none;
}

:root[data-theme="dark"] {
  --bg: #1a1a2e;
  --surface: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.9);
  --text-muted: rgba(255, 255, 255, 0.4);
  --connector: rgba(255, 255, 255, 0.15);
  --nav-bg: rgba(26, 26, 46, 0.9);
  --nav-border: rgba(255, 255, 255, 0.08);
  --explorer: #818cf8;
  --explorer-bg: rgba(99, 102, 241, 0.15);
  --consolidator: #f472b6;
  --consolidator-bg: rgba(244, 114, 182, 0.15);
  --run-command: #a5b4fc;
  --run-command-bg: rgba(165, 180, 252, 0.15);
  --pool: #5eead4;
  --pool-bg: rgba(94, 234, 212, 0.15);
  --display: #fcd34d;
  --display-bg: rgba(252, 211, 77, 0.15);
  --findings: #fda4af;
  --findings-bg: rgba(253, 164, 175, 0.15);
  --provisioner: #f87171;
  --provisioner-bg: rgba(248, 113, 113, 0.15);
  --node-shadow: none;
  --node-glow: 0 0 12px;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-width: 900px;
}

section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 40px;
}

/* === Nav === */

#nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--nav-border);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-logo {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-link.active {
  color: var(--text);
  background: var(--surface);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

:root[data-theme="light"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }

/* === Hero === */

#hero {
  text-align: center;
  padding-top: 80px;
  padding-bottom: 40px;
}

#hero h1 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* === Section Titles === */

.section-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* === Pipeline === */

.pipeline-container {
  position: relative;
  padding: 20px 0;
}

.connectors-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.pipeline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 24px 40px;
  position: relative;
  z-index: 2;
}

.pipeline-spacer {
  visibility: hidden;
}

.pipeline-node {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--node-shadow);
}

.pipeline-node:hover {
  transform: scale(1.05);
}

.pipeline-node[data-agent="explorer"] {
  border-color: var(--explorer);
}

.pipeline-node[data-agent="explorer"]:hover {
  box-shadow: var(--node-shadow), var(--node-glow) var(--explorer);
}

.pipeline-node[data-agent="consolidator"] {
  border-color: var(--consolidator);
}

.pipeline-node[data-agent="consolidator"]:hover {
  box-shadow: var(--node-shadow), var(--node-glow) var(--consolidator);
}

.node-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-size: 16px;
  font-weight: 700;
}

.node-label {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.node-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.node-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}

/* === Legend === */

.pipeline-legend {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-solid {
  width: 24px;
  height: 2px;
  background: var(--connector);
}

.legend-dashed {
  width: 24px;
  height: 0;
  border-top: 2px dashed var(--explorer);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--explorer);
}

:root[data-theme="dark"] .legend-dot {
  box-shadow: 0 0 6px var(--explorer);
}

/* === Agent Cards === */

.agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

.agent-bar {
  height: 4px;
}

.agent-content {
  padding: 28px 32px;
}

.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.agent-header h3 {
  font-size: 20px;
  font-weight: 700;
}

.agent-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
}

.agent-role {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.agent-section {
  margin-bottom: 20px;
}

.agent-section h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.agent-section p {
  font-size: 14px;
  line-height: 1.7;
}

.agent-io {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 20px;
}

.agent-io-col h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.agent-io-col ul {
  list-style: none;
  font-size: 14px;
}

.agent-io-col li {
  padding: 4px 0;
  padding-left: 16px;
  position: relative;
}

.agent-io-col li::before {
  content: "\2022";
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.agent-io-col code {
  font-size: 13px;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: "SF Mono", "Fira Code", monospace;
}

.interactions-list {
  list-style: none;
  font-size: 14px;
}

.interactions-list li {
  padding: 6px 0;
  line-height: 1.5;
}

.interactions-list .arrow {
  color: var(--text-muted);
  margin-right: 6px;
}

.interactions-list strong {
  font-weight: 600;
}

.interactions-list code {
  font-size: 13px;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: "SF Mono", "Fira Code", monospace;
}

.interactions-list em {
  color: var(--text-muted);
  font-style: italic;
}

/* === Packages === */

.packages-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.package-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
}

.package-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  font-family: "SF Mono", "Fira Code", monospace;
}

.package-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.package-card code {
  font-size: 12px;
  background: var(--bg);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: "SF Mono", "Fira Code", monospace;
}

.package-used-by {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.used-by-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.used-by-badge {
  font-size: 11px;
  font-weight: 600;
}

/* === Inline link === */

.inline-link {
  color: var(--explorer);
  text-decoration: none;
  border-bottom: 1px dashed var(--explorer);
  transition: opacity 0.15s;
}

.inline-link:hover {
  opacity: 0.8;
}

/* === Suite Config === */

.config-example {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
}

.config-header {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.config-filename {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.config-code {
  padding: 18px 20px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  overflow-x: auto;
  margin: 0;
}

.config-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.config-field-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 22px;
}

.config-field-name {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.config-field-type {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.config-field-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.config-field-card code {
  font-size: 12px;
  background: var(--bg);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: "SF Mono", "Fira Code", monospace;
}

.config-note {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* === Suite Flow === */

.suite-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
  z-index: 2;
}

.suite-flow-node {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px 28px;
  width: 100%;
  max-width: 680px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--node-shadow);
  text-align: center;
}

.suite-flow-node:hover {
  transform: scale(1.02);
}

.suite-flow-node[data-component="cli"] {
  border-color: var(--run-command);
}

.suite-flow-node[data-component="cli"]:hover {
  box-shadow: var(--node-shadow), var(--node-glow) var(--run-command);
}

.suite-flow-node[data-component="provisioner"] {
  border-color: var(--provisioner);
}

.suite-flow-node[data-component="provisioner"]:hover {
  box-shadow: var(--node-shadow), var(--node-glow) var(--provisioner);
}

.suite-flow-node[data-component="pool"] {
  border-color: var(--pool);
  max-width: 100%;
  padding: 24px 28px 28px;
}

.suite-flow-node[data-component="pool"]:hover {
  box-shadow: var(--node-shadow), var(--node-glow) var(--pool);
}

.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  color: var(--connector);
  font-size: 18px;
}

.flow-node-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.flow-node-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.flow-node-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* === Simulator Lanes === */

.simulator-lanes {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.sim-lane {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.sim-lane-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--pool);
  margin-bottom: 8px;
  text-align: center;
}

.sim-spec {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12px;
}

.sim-spec-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.sim-spec-pipeline {
  font-size: 11px;
  color: var(--text-muted);
}

.sim-spec.running {
  border-color: var(--pool);
}

.sim-spec.freestyle {
  border-color: var(--run-command);
  background: var(--run-command-bg);
}

.sim-spec.freestyle .sim-spec-name {
  color: var(--run-command);
}

.sim-spec-mini {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.mini-agent {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.mini-explorer {
  background: var(--explorer-bg);
  color: var(--explorer);
}

.mini-consolidator {
  background: var(--consolidator-bg);
  color: var(--consolidator);
}

.mini-freestyle {
  font-size: 10px;
  color: var(--run-command);
  font-style: italic;
  padding-left: 4px;
}

/* === Suite Output Row === */

.suite-output-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
  max-width: 680px;
}

.suite-output-node {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--node-shadow);
  text-align: center;
}

.suite-output-node:hover {
  transform: scale(1.03);
}

.suite-output-node[data-component="display"] {
  border-color: var(--display);
}

.suite-output-node[data-component="display"]:hover {
  box-shadow: var(--node-shadow), var(--node-glow) var(--display);
}

.suite-output-node[data-component="findings"] {
  border-color: var(--findings);
}

.suite-output-node[data-component="findings"]:hover {
  box-shadow: var(--node-shadow), var(--node-glow) var(--findings);
}

/* === Suite Component Cards (reuse .agent-card) === */

.agent-card[data-component="cli"] .agent-bar,
.agent-card[data-component="pool"] .agent-bar,
.agent-card[data-component="display"] .agent-bar,
.agent-card[data-component="findings"] .agent-bar,
.agent-card[data-component="provisioner"] .agent-bar {
  height: 4px;
}

/* === Event Protocol === */

.event-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.event-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}

.event-type {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--pool);
}

.event-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.event-fields {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.event-field {
  font-size: 11px;
  font-family: "SF Mono", "Fira Code", monospace;
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--text-muted);
}

/* === Exit Codes === */

.exit-codes-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.exit-code-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
}

.exit-code-number {
  font-size: 22px;
  font-weight: 700;
  font-family: "SF Mono", "Fira Code", monospace;
  margin-bottom: 6px;
}

.exit-code-label {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
