/* ============================================================
   Yarneon — Stylesheet
   Base + layout + agent-OS component library.
   RULE: sections are separated by whitespace, surface elevation
   and background tone. There are NO borders/dividers between
   sections anywhere in this file. Node, panel and console edges
   live INSIDE components only.
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { background: var(--bg-base); color: var(--text-secondary); }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { padding: 0; list-style: none; }

/* ---------- Type ---------- */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 600;
  text-wrap: balance;
  letter-spacing: -0.004em;
}
h1 { font-size: var(--fs-h1); line-height: 1.16; letter-spacing: -0.008em; }
h2 { font-size: var(--fs-h2); line-height: 1.2; }
h3 { font-family: var(--font-sans); font-size: var(--fs-h3); line-height: 1.25; letter-spacing: -0.012em; }
h4 { font-family: var(--font-sans); font-size: var(--fs-h4); line-height: 1.3; }
p { max-width: 68ch; }
.eyebrow, .chip, .node__label, .log, .trace, code, pre, .mono, .metric, .ts, .kbd {
  font-family: var(--font-mono);
}
.metric, .ts, .num, .price__amount, td.num { font-variant-numeric: tabular-nums; }
.eyebrow {
  display: inline-block;
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}
.lead { font-size: var(--fs-lead); color: var(--text-secondary); max-width: 62ch; }
.display { font-size: var(--fs-display); line-height: 1.06; letter-spacing: -0.02em; }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-small); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
strong { color: var(--text-primary); font-weight: 600; }

/* ---------- A11y helpers ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 200;
  background: var(--accent); color: var(--text-on-accent);
  padding: var(--space-3) var(--space-5); border-radius: var(--radius-md);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--space-4); color: var(--text-on-accent); }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm);
}

/* ---------- Layout ---------- */
.container {
  width: 100%; max-width: var(--container-xl);
  margin-inline: auto; padding-inline: var(--gutter);
}
.container--wide { max-width: var(--container-2xl); }
.container--md { max-width: var(--container-md); }
.section { padding-block: var(--section-y); border: 0; position: relative; }
.section + .section { border-top: 0; }
.section--lg { padding-block: var(--section-y-lg); }
/* The alt and deep variants keep their names but paint nothing: the page
   carries the one colour, so the fixed lattice behind it is never covered. */
.section--alt,
.section--deep { background: transparent; }
.section__head { max-width: 68ch; margin-bottom: var(--space-10); }
.section__head--split {
  max-width: none; display: grid; gap: var(--space-4) clamp(32px, 5vw, 88px);
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: end;
}
.section__head--split .lead { margin-top: 0; max-width: 56ch; }
.section__head--split > div:first-child { position: relative; padding-top: var(--space-5); }
.section__head--split > div:first-child::before {
  content: ""; position: absolute; top: 0; left: 0; width: 40px; height: 1px;
  background: var(--accent);
}
.section__head--center { margin-inline: auto; text-align: center; }
.section__head--center p { margin-inline: auto; }

.grid { display: grid; gap: var(--grid-gap); grid-template-columns: repeat(var(--grid-cols), 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.split  { grid-template-columns: 1fr 1fr; align-items: center; }
.split--wide { grid-template-columns: 1.05fr 1fr; }
.workspace { display: grid; gap: var(--panel-gap); grid-template-columns: 1fr 340px; align-items: start; }
.span-8 { grid-column: span 8; } .span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; } .span-12 { grid-column: span 12; }
.stack > * + * { margin-top: var(--stack); }
.panels { display: grid; gap: var(--panel-gap); }
.flow > * + * { margin-top: var(--space-4); }

/* ---------- Surfaces ---------- */
.panel {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--panel-pad);
}
.panel--flat { background: var(--surface-1); }
.panel--raised { background: var(--surface-2); }
.panel--pad-0 { padding: 0; overflow: hidden; }
.panel__title { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.console {
  background: var(--canvas);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.console__bar {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  font-family: var(--font-mono); font-size: var(--fs-micro);
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted);
}
.console__dots { display: flex; gap: 6px; }
.console__dots i { width: 9px; height: 9px; border-radius: var(--radius-pill); background: var(--surface-3); }
.console__body { padding: var(--space-4); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-weight: 600; font-size: var(--fs-body); line-height: 1;
  padding: var(--space-3) var(--space-5);
  min-height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.btn-primary { background: var(--accent); color: var(--text-on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--text-on-accent); }
.btn-primary:active { background: var(--accent-press); }
.btn-secondary { background: var(--surface-2); color: var(--text-primary); border-color: var(--border-default); }
.btn-secondary:hover { background: var(--surface-3); color: var(--text-primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border-default); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }
.btn--sm { min-height: 36px; padding: var(--space-2) var(--space-4); font-size: var(--fs-small); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-8); }

/* ---------- Status chip (color + dot/glyph + label) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--fs-micro); font-weight: 600; line-height: 1;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 5px var(--space-2) 5px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: var(--radius-pill); background: currentColor; flex: none; }
.chip .glyph { font-size: var(--fs-micro); line-height: 1; }
.chip--queued  { color: var(--st-queued);  background: var(--st-queued-soft); }
.chip--running { color: var(--st-running); background: var(--st-running-soft); }
.chip--waiting { color: var(--st-waiting); background: var(--st-waiting-soft); }
.chip--approve { color: var(--st-approve); background: var(--st-approve-soft); }
.chip--success { color: var(--st-success); background: var(--st-success-soft); }
.chip--failed  { color: var(--st-failed);  background: var(--st-failed-soft); }
.chip--blocked { color: var(--st-blocked); background: var(--st-blocked-soft); }
.chip--neutral { color: var(--text-muted); background: var(--surface-2); }
.chip--accent  { color: var(--accent); background: var(--accent-soft); }
.chip--running .dot { animation: pulse var(--pulse) ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(0.55); } }

/* ---------- Navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-base);
  transition: background var(--dur-base) var(--ease-out);
}
.nav.is-scrolled { border-bottom: 1px solid var(--border-subtle); }
.nav__inner {
  display: flex; align-items: center; gap: var(--space-6);
  min-height: 64px;
}
.brand {
  display: inline-flex; align-items: center; gap: var(--space-3);
  color: var(--text-primary); text-decoration: none; font-weight: 700;
  letter-spacing: -0.02em; font-size: 1.0625rem; flex: none;
}
.brand svg { flex: none; }
.nav__links { display: flex; align-items: center; gap: var(--space-1); margin-left: auto; }
.nav__link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: var(--space-2) var(--space-3);
  color: var(--text-secondary); text-decoration: none;
  font-size: var(--fs-small); font-weight: 500;
  border-radius: var(--radius-md); background: none; border: 0; cursor: pointer;
}
.nav__link:hover { color: var(--text-primary); background: var(--surface-2); }
.nav__link[aria-current="page"] { color: var(--text-primary); }
.nav__link[aria-current="page"]::after {
  content: ""; width: 4px; height: 4px; border-radius: var(--radius-pill); background: var(--accent);
}
.nav__actions { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.kbd {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: var(--fs-micro); color: var(--text-muted);
  background: var(--surface-3); padding: 2px 6px; border-radius: var(--radius-sm);
}
.nav__cmd { display: inline-flex; align-items: center; gap: var(--space-3); min-height: 36px;
  padding: var(--space-2) var(--space-3); font-size: var(--fs-small); }
.nav__toggle { display: none; }

/* Mega menu */
.menu { position: relative; }
.menu__panel {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(-6px);
  width: min(720px, 86vw);
  background: var(--surface-1); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); padding: var(--panel-pad);
  display: grid; gap: var(--space-2) var(--space-6); grid-template-columns: 1fr 1fr;
  visibility: hidden; pointer-events: none;
  transition: transform var(--dur-base) var(--ease-out), visibility var(--dur-base);
}
.menu.is-open .menu__panel { visibility: visible; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.menu__item {
  display: block; padding: var(--space-3); border-radius: var(--radius-md);
  text-decoration: none; color: var(--text-secondary);
}
.menu__item:hover { background: var(--surface-2); color: var(--text-secondary); }
.menu__item b { display: block; color: var(--text-primary); font-size: var(--fs-body); }
.menu__item span { font-size: var(--fs-small); color: var(--text-muted); }
.menu__group { grid-column: 1 / -1; }

/* Mobile nav */
.mobile-nav {
  position: fixed; inset: 0; z-index: 150;
  background: var(--bg-base);
  padding: var(--space-6) var(--gutter) var(--space-16);
  overflow-y: auto;
  display: none;
}
.mobile-nav.is-open { display: block; }
.mobile-nav__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-8); min-height: 44px; }
.mobile-nav a {
  display: block; padding: var(--space-3) 0; min-height: 44px;
  color: var(--text-secondary); text-decoration: none; font-size: var(--fs-body-lg);
}
.mobile-nav a:hover { color: var(--text-primary); }
.mobile-nav .eyebrow { margin-top: var(--space-6); }

@media (max-width: 1100px) {
  .nav__links { display: none; }
  .nav__toggle { display: inline-flex; margin-left: auto; }
  .nav__cmd .kbd { display: none; }
}

/* ---------- Breadcrumbs ---------- */
.crumbs { padding-top: var(--space-6); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
  font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--text-muted);
  letter-spacing: 0.04em; text-transform: uppercase; }
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--text-primary); }
.crumbs li + li::before { content: "/"; margin-right: var(--space-2); color: var(--text-faint); }
.crumbs [aria-current="page"] { color: var(--text-secondary); }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(40px, 4.5vw, 72px) clamp(56px, 6vw, 96px); position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -40% 0 auto 0; height: 90%;
  background: var(--grad-canvas); pointer-events: none; z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero__grid { display: grid; gap: clamp(32px, 4vw, 64px); grid-template-columns: 1.04fr 0.96fr; align-items: center; }
.hero--workspace .hero__grid { align-items: stretch; }
.hero__console { display: grid; gap: var(--panel-gap); align-content: start; }
.hero__console .inspector { position: static; }
.hero__stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4) var(--space-6); margin-top: var(--space-10);
  padding-top: var(--space-6); position: relative;
}
.hero__stats::before {
  content: ""; position: absolute; top: 0; left: 0; width: 56px; height: 2px;
  background: var(--accent); border-radius: var(--radius-pill);
}
.hero__stats dt { font-family: var(--font-mono); font-size: var(--fs-micro);
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.hero__stats dd { margin-top: var(--space-2); font-family: var(--font-mono);
  font-size: var(--fs-body); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.hero__stats dd b { color: var(--text-primary); font-weight: 600; }
.hero__grid--wide { grid-template-columns: 1fr; }
.hero h1 { font-size: var(--fs-display); line-height: 1.06; }
.hero .lead { margin-top: var(--space-5); }
.hero__meta { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-8);
  font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--text-muted);
  letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- Agent graph (inline SVG) ---------- */
.graph {
  background: var(--canvas);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.graph__bar {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-1);
}
.graph__run { font-family: var(--font-mono); font-size: var(--fs-mono);
  color: var(--text-primary); font-weight: 600; letter-spacing: 0.02em; }
.graph__meta { font-family: var(--font-mono); font-size: var(--fs-micro);
  color: var(--text-muted); margin-right: auto; }
.graph__canvas { padding: var(--space-5) var(--space-4); overflow-x: auto; }
.graph--lr .graph__canvas svg { width: 100%; min-width: 720px; height: auto; }
.graph--tb .graph__canvas svg { width: 100%; max-width: 460px; margin-inline: auto;
  display: block; height: auto; }
.graph__edge { stroke: var(--edge-muted); stroke-width: 1.5; fill: none;
  transition: stroke var(--dur-base) var(--ease-out); }
.graph__edge--dashed { stroke-dasharray: 6 6; }
.graph__edge--critical { stroke: var(--edge); }
.graph__edge--recovery { stroke-dasharray: 5 5; }
.graph__edge--active { stroke: var(--edge-active); stroke-width: 1.5; }
.graph__edge--recovery.graph__edge--active { stroke: var(--st-failed); }
.graph__node rect { fill: var(--node-bg); stroke: var(--node-border); stroke-width: 1;
  transition: fill var(--dur-base) var(--ease-out), stroke var(--dur-base) var(--ease-out); }
.graph__node text { font-family: var(--font-mono); font-size: 13px; fill: var(--text-muted); }
.graph__node .gn-title { fill: var(--text-primary); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.graph__node .gn-bar { fill: var(--border-default); }
.graph__node.is-active .gn-bar { fill: var(--accent); }
.graph__node.is-failed .gn-bar { fill: var(--st-failed); }
.graph__node.is-active rect { stroke: var(--node-active); stroke-width: 1.5; }
.graph__node.is-active .gn-title { fill: var(--text-primary); }
.graph__node.is-failed rect { stroke: var(--st-failed); stroke-width: 1.5; }
.graph__node:focus-visible rect { stroke: var(--ring); stroke-width: 1.5; }
.graph__node { cursor: pointer; }
.graph__node:hover rect { fill: var(--surface-2); }
.gn-dot--queued  { fill: var(--st-queued); }
.gn-dot--running { fill: var(--st-running); }
.gn-dot--waiting { fill: var(--st-waiting); }
.gn-dot--approve { fill: var(--st-approve); }
.gn-dot--success { fill: var(--st-success); }
.gn-dot--failed  { fill: var(--st-failed); }
.graph__legend { display: flex; flex-wrap: wrap; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); background: var(--surface-1); }

/* Text equivalent tables (always present next to a visual) */
.equiv { margin-top: var(--space-4); }
.equiv > summary {
  cursor: pointer; font-family: var(--font-mono); font-size: var(--fs-micro);
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted);
  padding: var(--space-2) 0; min-height: 36px; display: flex; align-items: center;
}
.equiv > summary:hover { color: var(--text-primary); }
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; font-size: var(--fs-small);
  font-family: var(--font-mono);
}
table.data caption { text-align: left; color: var(--text-muted); font-size: var(--fs-micro);
  letter-spacing: 0.06em; text-transform: uppercase; padding-bottom: var(--space-3); }
table.data th, table.data td { text-align: left; padding: var(--space-2) var(--space-3); vertical-align: top; }
table.data thead th { color: var(--text-muted); font-weight: 600; font-size: var(--fs-micro);
  letter-spacing: 0.06em; text-transform: uppercase; }
table.data tbody tr { background: var(--surface-1); }
table.data tbody tr:nth-child(even) { background: var(--surface-2); }
table.data td:first-child { color: var(--text-primary); }

/* ---------- Run timeline (<ol>) ---------- */
.run { position: relative; }
.run__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
  margin-bottom: var(--space-5); }
.run__id { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-primary); }
.run__goal { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-muted); }
.steps { position: relative; padding-left: var(--space-8); }
.steps::before {
  content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px; width: 2px;
  background: var(--border-default); border-radius: var(--radius-pill);
}
.step { position: relative; padding-bottom: var(--step-gap); }
.step:last-child { padding-bottom: 0; }
.step::before {
  content: ""; position: absolute; left: calc(-1 * var(--space-8) + 5px); top: 6px;
  width: 14px; height: 14px; border-radius: var(--radius-pill);
  background: var(--surface-3);}
.step[data-status="success"]::before { background: var(--st-success); }
.step[data-status="running"]::before { background: var(--st-running); }
.step[data-status="failed"]::before  { background: var(--st-failed); }
.step[data-status="approve"]::before { background: var(--st-approve); }
.step[data-status="waiting"]::before { background: var(--st-waiting); }
.step[data-status="queued"]::before  { background: var(--st-queued); }
.step__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); min-height: 36px; }
.step__idx { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--text-faint); }
.step__name { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-primary); font-weight: 500; }
.step__dur { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--text-muted);
  margin-left: auto; font-variant-numeric: tabular-nums; }
.step__detail { font-size: var(--fs-small); color: var(--text-muted); margin-top: var(--space-1); max-width: 72ch; }
.step details > summary { cursor: pointer; font-family: var(--font-mono); font-size: var(--fs-micro);
  color: var(--text-muted); min-height: 36px; display: flex; align-items: center; }
.step details > summary:hover { color: var(--text-primary); }
.step details pre { margin-top: var(--space-2); }

/* ---------- Tool-call stream (console log) ---------- */
.stream { max-height: 340px; overflow-y: auto; padding: var(--space-4); }
.stream__line {
  display: grid; grid-template-columns: 68px 16px 1fr auto; gap: var(--space-3);
  align-items: baseline;
  font-family: var(--font-mono); font-size: var(--fs-mono); line-height: 1.55;
  padding-block: var(--log-line-y);
}
.stream__ts { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.stream__dir { color: var(--text-muted); }
.stream__dir--in { color: var(--accent); }
.stream__msg { color: var(--text-secondary); overflow-wrap: anywhere; }
.stream__msg b { color: var(--text-primary); font-weight: 500; }
.stream__line--err .stream__msg { color: var(--st-failed); }
.stream__line--ok .stream__msg b { color: var(--text-primary); }
.stream__controls { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }

/* ---------- Reasoning trace ---------- */
/* The trace is the artefact an auditor reads, so every step stays visible:
   no accordions, no hidden reasoning. The rail carries the eye down the run. */
.trace-list { display: grid; gap: 0; }
.trace-step { display: grid; grid-template-columns: 28px 1fr; gap: var(--space-4); }
.trace-step__rail { position: relative; display: flex; justify-content: center; }
.trace-step__rail::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--border-subtle);
}
.trace-step:first-child .trace-step__rail::before { top: 10px; }
.trace-step:last-child .trace-step__rail::before { bottom: calc(100% - 12px); }
.trace-step__dot {
  position: relative; margin-top: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface-3);}
.trace-step[data-kind="action"] .trace-step__dot { background: var(--accent); }
.trace-step[data-kind="decision"] .trace-step__dot { background: var(--st-approve); }
.trace-step[data-kind="handoff"] .trace-step__dot { background: var(--st-blocked); }
.trace-step[data-kind="outcome"] .trace-step__dot { background: var(--st-success); }
.trace-step__body { padding-bottom: var(--space-6); }
.trace-step__meta {
  display: flex; align-items: baseline; gap: var(--space-3);
  font-family: var(--font-mono); font-size: var(--fs-micro);
  letter-spacing: var(--ls-label); text-transform: uppercase;
}
.trace-step__kind { color: var(--text-primary); }
.trace-step[data-kind="action"] .trace-step__kind { color: var(--accent); }
.trace-step[data-kind="decision"] .trace-step__kind { color: var(--st-approve); }
.trace-step[data-kind="handoff"] .trace-step__kind { color: var(--st-blocked); }
.trace-step[data-kind="outcome"] .trace-step__kind { color: var(--st-success); }
.trace-step__n { color: var(--text-muted); }
.trace-step__text {
  margin-top: var(--space-2); color: var(--text-secondary);
  max-width: 62ch; line-height: var(--lh-relaxed);
}

/* ---------- Inspector ---------- */
.inspector { position: sticky; top: 84px; }
.inspector dl { display: grid; grid-template-columns: auto 1fr; gap: var(--space-2) var(--space-4);
  font-family: var(--font-mono); font-size: var(--fs-small); margin-top: var(--space-4); }
.inspector dt { color: var(--text-muted); }
.inspector dd { color: var(--text-primary); margin: 0; overflow-wrap: anywhere; }

/* ---------- Command palette ---------- */
.palette-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: var(--scrim); display: none; padding: clamp(48px, 12vh, 140px) var(--space-4) var(--space-4);
}
.palette-backdrop.is-open { display: block; }
.palette {
  width: min(640px, 100%); margin-inline: auto;
  background: var(--surface-1); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); overflow: hidden;
}
.palette__input {
  width: 100%; background: transparent; border: 0; padding: var(--space-5);
  font-family: var(--font-mono); font-size: var(--fs-body-lg); color: var(--text-primary);
}
.palette__input:focus { outline: none; }
.palette__list { max-height: 46vh; overflow-y: auto; padding: var(--space-2); }
.palette__group { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--text-muted);
  letter-spacing: 0.08em; text-transform: uppercase; padding: var(--space-3) var(--space-3) var(--space-2); }
.palette__opt {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3); border-radius: var(--radius-md); cursor: pointer;
  min-height: 44px; font-size: var(--fs-body); color: var(--text-secondary);
}
.palette__opt[aria-selected="true"] { background: var(--surface-3); color: var(--text-primary); }
.palette__opt .mono { color: var(--text-muted); font-size: var(--fs-micro); margin-left: auto; }
.palette__foot { display: flex; gap: var(--space-4); padding: var(--space-3) var(--space-5);
  background: var(--surface-2); font-size: var(--fs-micro); color: var(--text-muted); }
.palette__empty { padding: var(--space-6); color: var(--text-muted); font-size: var(--fs-small); }

/* ---------- Cards / features ---------- */
.card {
  background: var(--surface-1); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: var(--panel-pad);
  transition: transform var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.card { position: relative; }
.card:hover { transform: translateY(-3px); background: var(--surface-2); border-color: var(--border-strong); }
.card--link:focus-visible { border-color: var(--accent); }
/* Cards sit in dense grids, so their headings step down a level from a
   section heading — the section title stays the loudest thing on screen. */
.card h3 { margin-bottom: var(--space-3); font-size: var(--fs-h4); line-height: var(--lh-snug); letter-spacing: var(--ls-tight); }
.grid[style*="--grid-cols:4"] .card h3 { font-size: var(--fs-body-lg); }
.card p { color: var(--text-secondary); font-size: var(--fs-small); }
.card__icon {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; margin-bottom: var(--space-4);
  font-family: var(--font-mono); font-size: var(--fs-small); font-weight: 600;
}
.card--link { text-decoration: none; display: block; color: inherit; }
.card__meta { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }

/* Bento */
.bento { display: grid; gap: var(--panel-gap); grid-template-columns: repeat(6, 1fr); }
.bento > * { grid-column: span 2; }
.bento .b-4 { grid-column: span 4; }
.bento .b-6 { grid-column: span 6; }
.bento .b-3 { grid-column: span 3; }

/* ---------- Metrics ---------- */
.metrics { display: grid; gap: var(--panel-gap); grid-template-columns: repeat(4, 1fr); }
.metric-card { position: relative; background: var(--surface-1); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: var(--panel-pad); }
.metric { display: block; font-family: var(--font-mono); font-weight: 600;
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.25rem); line-height: 1;
  color: var(--text-primary); letter-spacing: -0.01em; }
.metric-card p { margin-top: var(--space-3); font-size: var(--fs-small); color: var(--text-muted); }

/* ---------- Logos ---------- */
.logos { display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: clamp(24px, 4vw, 56px); }
.logo-mark { display: inline-flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-mono); font-size: var(--fs-small); letter-spacing: 0.04em;
  color: var(--text-muted); text-transform: uppercase; }
.logo-mark svg { color: var(--text-faint); }

/* ---------- Testimonials ---------- */
.quote { background: var(--surface-1); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: var(--panel-pad); }
.quote blockquote { color: var(--text-primary); font-size: var(--fs-body-lg); line-height: 1.55; }
.quote figcaption { margin-top: var(--space-5); font-size: var(--fs-small); color: var(--text-muted); }
.quote cite { font-style: normal; color: var(--text-primary); font-weight: 600; display: block; }
.quote__result { margin-top: var(--space-4); display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ---------- Pricing ---------- */
.price-grid { display: grid; gap: var(--panel-gap); grid-template-columns: repeat(3, 1fr); align-items: start; }
.price { background: var(--surface-1); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); padding: var(--panel-pad); }
.price--featured { background: var(--surface-2); border-color: var(--accent); }
.price__amount { display: block; font-size: clamp(2.25rem, 1.8rem + 2vw, 3.25rem);
  font-weight: 700; line-height: 1; letter-spacing: -0.02em; color: var(--text-primary);
  margin-block: var(--space-4) var(--space-2); }
.price__unit { font-size: var(--fs-small); color: var(--text-muted); font-family: var(--font-mono); }
.price ul { margin-top: var(--space-6); display: grid; gap: var(--space-3); }
.price li { display: flex; gap: var(--space-3); font-size: var(--fs-small); color: var(--text-secondary); }
.price li::before { content: "✓"; color: var(--st-success); flex: none; font-size: var(--fs-small); }
.price .btn { width: 100%; margin-top: var(--space-6); }

/* Toggle */
.toggle { display: inline-flex; gap: var(--space-1); padding: var(--space-1);
  background: var(--surface-2); border-radius: var(--radius-pill); border: 1px solid var(--border-default); }
.toggle button { background: transparent; border: 0; cursor: pointer; min-height: 36px;
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill);
  font-size: var(--fs-small); font-weight: 600; color: var(--text-muted); }
.toggle button[aria-pressed="true"] { background: var(--surface-3); color: var(--text-primary); }

/* ---------- FAQ / accordion ---------- */
.faq { display: grid; gap: var(--space-2); max-width: var(--container-md); }
.faq__item { background: var(--surface-1); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); overflow: hidden; }
.faq__q { width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); text-align: left; background: transparent; border: 0; cursor: pointer;
  padding: var(--space-4) var(--space-5); min-height: 56px;
  color: var(--text-primary); font-weight: 600; font-size: var(--fs-body); }
.faq__q:hover { background: var(--surface-2); }
.faq__q .sign { color: var(--text-muted); font-family: var(--font-mono); flex: none; }
.faq__q[aria-expanded="true"] .sign { color: var(--accent); }
.faq__a { padding: 0 var(--space-5) var(--space-5); font-size: var(--fs-small); color: var(--text-secondary); }
.faq__a[hidden] { display: none; }

/* ---------- Code / terminal ---------- */
pre {
  background: var(--canvas); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); padding: var(--space-4);
  overflow-x: auto; font-family: var(--font-mono); font-size: var(--fs-small);
  line-height: 1.6; color: var(--text-secondary);
}
pre code { font: inherit; color: inherit; }
code { font-family: var(--font-mono); font-size: 0.925em; color: var(--text-primary); }
.tok-key { color: var(--accent); }
.tok-str { color: var(--st-success); }
.tok-com { color: var(--text-faint); }
.tok-num { color: var(--st-approve); }
.copy-btn { margin-left: auto; }

/* ---------- Lists ---------- */
.checklist { display: grid; gap: var(--space-3); }
.checklist li { display: flex; gap: var(--space-3); font-size: var(--fs-small); color: var(--text-secondary); }
.checklist li::before { content: "▸"; color: var(--accent); flex: none; }
.deflist { display: grid; gap: var(--space-4); }
.deflist div { display: grid; gap: var(--space-1); }
.deflist dt { color: var(--text-primary); font-weight: 600; font-size: var(--fs-body); }
.deflist dd { margin: 0; font-size: var(--fs-small); color: var(--text-muted); }

/* ---------- Footer ---------- */
.footer { background: var(--bg-900); padding-block: var(--section-y) var(--space-10); }
.footer__grid { display: grid; gap: var(--space-10); grid-template-columns: 1.4fr repeat(4, 1fr); }
.footer h2, .footer h3 { font-size: var(--fs-micro); font-family: var(--font-mono);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted);
  margin-bottom: var(--space-4); font-weight: 600; }
.footer a { color: var(--text-secondary); text-decoration: none; font-size: var(--fs-small);
  display: inline-block; padding-block: 6px; }
.footer a:hover { color: var(--text-primary); }
.footer__bottom { margin-top: var(--space-16); display: flex; flex-wrap: wrap;
  gap: var(--space-4); align-items: center; font-size: var(--fs-small); color: var(--text-muted); }
.footer__bottom .chip { margin-right: auto; }

/* ---------- Forms ---------- */
.form { display: grid; gap: var(--space-5); align-content: start; }
.field { display: grid; gap: var(--space-2); }
.field label { font-size: var(--fs-small); color: var(--text-primary); font-weight: 500; }
.field input, .field select, .field textarea {
  background: var(--surface-2); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
  color: var(--text-primary); min-height: 44px; width: 100%;
}
.field textarea { min-height: 130px; resize: vertical; }
.field .hint { font-size: var(--fs-micro); color: var(--text-muted); }

/* ---------- Motion ---------- */
html.js [data-reveal] { opacity: 0; transform: translateY(14px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
html.js [data-reveal].in { opacity: 1; transform: none; }
.edge-anim { transition: stroke-dashoffset var(--dur-run) var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html.js [data-reveal] { opacity: 1; transform: none; }
  .chip--running .dot { animation: none; }
}


/* ============================================================
   Enhancement layer — control-room depth, texture and rhythm.
   All values reference tokens; nothing is hard-coded here.
   ============================================================ */

/* One opaque canvas under every section. No texture, no lattice, no seams. */
.site-header, main, .site-footer { position: relative; z-index: 1; }
.hero::after, .section--deep::after { content: none; }
.section--deep { position: relative; }
.section--deep > .container { position: relative; z-index: 1; }

/* No vignette and no divider: a tonal section is simply the page, and it
   paints nothing so the fixed lattice behind it stays continuous. */
.section--alt { background: transparent; }

/* Eyebrows read as instrument labels. */
.eyebrow { display: inline-flex; align-items: center; gap: var(--space-2); }
.section__head .eyebrow::before {
  content: ""; width: 5px; height: 5px; border-radius: var(--radius-pill);
  background: var(--accent); flex: none;
}

/* Metric band: instrument readout. */
.metric-card::before {
  content: ""; position: absolute; inset: -1px -1px auto -1px; height: 2px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--accent);
}
.metric { letter-spacing: -0.03em; }

/* Link cards behave like real affordances. */
.card--link { transition: transform var(--dur-base) var(--ease-out),
  background var(--dur-base) var(--ease-out); }
.card--link:hover { transform: translateY(-3px); }
.card--link h3::after { content: " →"; color: var(--accent); }

/* Agent card monogram: reads as an agent badge, not a placeholder square. */
.card__icon { }

/* Inline build annotations ([PLACEHOLDER] / [ASPIRATIONAL]) are deliberate,
   so they are styled as annotations rather than looking like broken copy. */
.anno {
  display: inline-block; font-family: var(--font-mono); font-size: var(--fs-micro);
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-muted); background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 1px var(--space-2);
}

/* Split blocks: keep long copy columns from stranding whitespace. */
.split, .split--wide { align-items: start; }
.split > *, .split--wide > * { min-width: 0; }

/* Prose columns stay comfortable regardless of container width. */
.stack > p { max-width: 68ch; }

/* Tables: quiet zebra banding aids scanning in dense control-room data. */
table.data tbody tr:nth-child(even) { background: var(--surface-2); }
table.data tbody tr:hover { background: var(--accent-soft); }

/* Run timeline: the active path should be traceable at a glance. */
.step:hover .step__name { color: var(--text-primary); }

/* Buttons gain a little more presence without shouting. */
.btn-primary { }
.btn-primary:hover { }

/* Footer gets a calm top edge from tone, never a rule. */
.footer { background: var(--bg-900); }

/* Full-page captures, printing and no-JS all need the content visible. */
@media print {
  html.js [data-reveal] { opacity: 1 !important; transform: none !important; }
  .nav, .mobile-nav, .palette-backdrop { display: none !important; }
}


/* Fact strip: fills the graph column with real run facts rather than air. */
.factstrip {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--panel-gap); margin-top: var(--panel-gap);
}
.factstrip li {
  background: var(--surface-1); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5);
  display: grid; gap: var(--space-1);
}
.factstrip span { font-family: var(--font-mono); font-size: var(--fs-micro);
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.factstrip b { font-family: var(--font-mono); font-size: var(--fs-h3);
  color: var(--text-primary); line-height: 1; font-variant-numeric: tabular-nums; }
.factstrip em { font-style: normal; font-size: var(--fs-small); color: var(--text-secondary); }


/* Stream playback: dimmed, never hidden. */
.stream__line { transition: color var(--dur-base) var(--ease-out); }
.stream__line.is-pending { color: var(--text-faint); }
.stream__line.is-pending .chip { color: var(--text-faint); background: var(--surface-2); }

/* A long trace shouldn't strand its companion panel at the top of a void:
   the aside travels with the reader instead. */
@media (min-width: 901px) {
  .split--sticky > :last-child { position: sticky; top: calc(var(--nav-h, 64px) + var(--space-8)); }
}

/* Grid and flex children default to min-width:auto, which lets a wide SVG or a
   long token push a whole section past the viewport. Every track is allowed to
   shrink so the graph scrolls inside its own panel instead of the page. */
.grid > *, .split > *, .split--wide > *, .workspace > *, .workspace > * > * { min-width: 0; }
.graph, .graph__canvas, .panel, .card { min-width: 0; max-width: 100%; }
.graph__legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); }

/* A chip is a label, not a sentence. Anything longer degrades to a caption so
   it wraps instead of forcing its container wide. */
.card__note { display: block; color: var(--text-muted); font-size: var(--fs-small); }
.chip { max-width: 100%; }
.chip__label { overflow-wrap: anywhere; }
.graph__bar { flex-wrap: wrap; gap: var(--space-2) var(--space-3); }

/* The graph scrolls sideways on narrow screens, so say so and fade the edge
   rather than letting a node be silently cut off. */
.graph__canvas { scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.graph__hint { display: none; }
@media (max-width: 900px) {
  .graph__hint {
    display: block; padding: 0 var(--space-4) var(--space-3);
    font-family: var(--font-mono); font-size: var(--fs-micro);
    letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--text-muted);
  }
  
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .section__head--split { grid-template-columns: 1fr; align-items: start; }
  .section__head--split .lead { max-width: 68ch; }
}
@media (max-width: 1024px) {
  .workspace { grid-template-columns: 1fr; }
  .hero--workspace .hero__grid { align-items: start; }
  .graph--tb .graph__canvas svg { max-width: 420px; }
  .inspector { position: static; }
  .span-8, .span-4, .span-6 { grid-column: span 12; }
  .footer__grid { grid-template-columns: repeat(3, 1fr); }
  .hero__grid { grid-template-columns: 1fr; }
  .bento > * { grid-column: span 3; }
  .bento .b-4, .bento .b-6 { grid-column: span 6; }
}
@media (max-width: 900px) {
  .cols-3, .cols-4, .metrics { grid-template-columns: repeat(2, 1fr); }
  .price-grid { grid-template-columns: 1fr; }
  .menu__panel { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .split, .split--wide, .cols-2 { grid-template-columns: 1fr; }
  .factstrip { grid-template-columns: 1fr; }
  .hero__stats { grid-template-columns: 1fr; gap: var(--space-3); }
  .graph__meta { display: none; }
  .footer__grid { grid-template-columns: repeat(2, 1fr); }
  .stream__line { grid-template-columns: 58px 14px 1fr; }
  .stream__line > .chip { grid-column: 3; justify-self: start; }
}
@media (max-width: 560px) {
  /* Keep the bar to brand + menu so nothing can push the page wider than the
     viewport on a 360px phone. */
  .nav__cmd, .nav__actions .btn-primary { display: none; }
  .nav__inner { gap: var(--space-3); }
}
@media (max-width: 480px) {
  .cols-3, .cols-4, .metrics, .bento { grid-template-columns: 1fr; }
  .bento > *, .bento .b-4, .bento .b-6 { grid-column: span 1; }
  .btn-row .btn { width: 100%; }
}

@supports (content-visibility: auto) {
  .section--defer { content-visibility: auto; contain-intrinsic-size: auto 640px; }
}

/* Brand lockup from /logo */
.brand__logo { display: block; height: 28px; width: auto; max-width: none; }
