/* Diagram redesigns for v20, second pass (Vitoria, November 6, 2026). After her references: a
   quiet gray panel, white hairline boxes, right-angled connectors with labels on the lines, small
   pulses of light travelling along them, and the whole path lighting up on hover. */
:root {
  --ink: #2b2b2b;
  --muted: #6f6f6f;
  --faint: #a6a6a6;
  --panel: #f6f6f5;
  --box: #d9d9d9;
  --line: #9c9c9c;
  --blue: #3d9be9;
  --green: #74b53f;
  --amber: #e3a32b;
  --red: #e0584e;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body { margin: 0; background: #fff; color: #37352f; font: 13.4px/1.7 var(--sans); }
.lab { width: min(536px, calc(100vw - 40px)); margin: 0 auto; padding: 72px 0 140px; }
.lab-intro h1 { margin: 0 0 12px; font: 600 28px/1.15 var(--sans); letter-spacing: -.01em; color: #172033; }
.lab-intro p { margin: 0; color: var(--muted); }
.lab-section { margin-top: 96px; }
.lab-section h2 { margin: 0 0 8px; font: 600 19px/1.25 var(--sans); color: #172033; }
.lab-section > p { margin: 0 0 26px; }
.lab-notes { margin: 22px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.dg { --w: 536px; width: var(--w); max-width: calc(100vw - 32px); margin-left: calc((100% - min(var(--w), 100vw - 32px)) / 2); font-family: var(--sans); }
.dg-label { margin: 0 0 12px; font: 500 12px/1.4 var(--sans); color: var(--faint); }
.dg-panel { padding: 18px; border-radius: 12px; background: var(--panel); }
.dg-panel svg { display: block; width: 100%; height: auto; overflow: visible; }
.dg-caption { margin: 12px 2px 0; min-height: 1.5em; font-size: 12.5px; line-height: 1.45; color: var(--muted); transition: color .3s; }
.dg-toggle { display: inline-flex; gap: 2px; margin: 0 0 12px; padding: 2px; border-radius: 16px; background: var(--panel); }
.dg-toggle button { padding: 4px 12px 5px; border: 0; border-radius: 14px; background: none; font: 500 12px/1.3 var(--sans); color: var(--muted); cursor: pointer; transition: background-color .2s, color .2s, box-shadow .2s; }
.dg-toggle button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 0 0 .5px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .08); }
.dg-sources { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 2px 0; font-size: 11px; }
.dg-sources a { color: var(--faint); text-underline-offset: 3px; }
:is(button, a):focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Drawing */
.dg-region { fill: none; stroke: #b9b9b9; stroke-width: 1; stroke-dasharray: 3 3; }
.dg-region-label { fill: var(--muted); font-size: 11px; }
.dg-node rect { fill: #fff; stroke: var(--box); stroke-width: 1; transition: stroke .35s, filter .35s; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .04)); }
.dg-node text { fill: var(--ink); font-size: 12.5px; font-weight: 500; text-anchor: middle; dominant-baseline: central; transition: fill .3s; }
.dg-node .dg-sub { fill: var(--muted); font-size: 10.5px; font-weight: 400; }
.dg-node { cursor: default; }
.dg-node.is-lit rect { stroke: var(--blue); filter: drop-shadow(0 0 4px rgba(61, 155, 233, .35)); }
.dg-node.is-lit.is-green rect { stroke: var(--green); filter: drop-shadow(0 0 4px rgba(116, 181, 63, .35)); }
.dg-node.is-lit.is-red rect { stroke: var(--red); filter: drop-shadow(0 0 4px rgba(224, 88, 78, .3)); }
.dg-node.is-lit.is-amber rect { stroke: var(--amber); filter: drop-shadow(0 0 4px rgba(227, 163, 43, .3)); }
.dg-node.is-off { opacity: .4; }
.dg-edge path { fill: none; stroke: var(--line); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; transition: stroke .3s, opacity .3s; }
.dg-edge.is-dashed path { stroke-dasharray: 3 3; }
.dg-edge.is-off { opacity: .3; }
.dg-edge-label { fill: var(--muted); font-size: 11px; transition: fill .3s; }
.dg-edge-label.is-blue { fill: var(--blue); }
.dg-edge-label.is-green { fill: var(--green); }
.dg-edge-label.is-red { fill: var(--red); }
.dg-edge-label.is-amber { fill: #c78a14; }
.dg-pulse { fill: none; stroke-width: 2.4; stroke-linecap: round; pointer-events: none; }
/* Hover: the path through a box lights up; the rest stays quiet. */
.has-focus .dg-edge:not(.is-focus) path, .has-focus .dg-edge-label:not(.is-focus) { opacity: .35; }
.has-focus .dg-node:not(.is-focus) { opacity: .45; }
.has-focus .dg-edge.is-focus path { stroke: var(--blue); stroke-width: 1.4; }
.has-focus .dg-node.is-focus rect { stroke: var(--blue); }
.has-focus .dg-edge-label.is-focus { fill: var(--blue); }
@media (prefers-reduced-motion: reduce) { .dg * { transition: none !important; } }

/* The link the agent wrote, wrong then right. */
.dg-link { opacity: .3; transition: opacity .35s; }
.dg-link:is(.is-on, .is-bad, .is-good) { opacity: 1; }
.dg-link rect { fill: #fff; stroke: var(--box); stroke-width: 1; transition: stroke .35s; }
.dg-link.is-on rect { stroke: var(--blue); }
.dg-link.is-bad rect { stroke: var(--red); }
.dg-link.is-good rect { stroke: var(--green); }
.dg-link text { dominant-baseline: central; }
.dg-link-pass { fill: var(--muted); font-size: 11px; }
.dg-link-code { fill: var(--ink); font: 12px ui-monospace, "SF Mono", Menlo, monospace; }
.dg-link-status { fill: var(--muted); font-size: 11.5px; }
.dg-link.is-bad .dg-link-status { fill: var(--red); }
.dg-link.is-good .dg-link-status { fill: #4f8f22; }
/* One diagram per page inside an article frame. */
html.dg-embed body { margin: 0; padding: 1px 2px 2px; background: transparent; }
html.dg-embed .dg { width: 100%; max-width: none; margin: 0; }
html.dg-embed .dg-sources { margin-top: 8px; }

/* Second set: MCP, OpenClaw, recursive calls, DSPy and GEPA. */
.dg-edge.is-ghost path { stroke: none; }
.dg-doc { fill: #fff; stroke: #cfcfcf; stroke-width: .8; transition: fill .3s, stroke .3s; }
.dg-doc.is-hit { fill: #e6f1fc; stroke: var(--blue); stroke-width: 1.2; }
.dg-meter { fill: #e6e6e6; }
.dg-meter-fill { fill: var(--blue); transition: width .5s; }
.dg-col-label { fill: var(--muted); font-size: 10.5px; }
.dg-row { opacity: .25; transition: opacity .4s; }
.dg-row.is-on { opacity: 1; }
.dg-row-v { fill: var(--ink); font: 600 12px ui-monospace, "SF Mono", Menlo, monospace; }
.dg-row-text { fill: var(--muted); font: 11px ui-monospace, "SF Mono", Menlo, monospace; }
.dg-row-score { fill: var(--ink); font-size: 12px; font-weight: 500; }
.dg-dot { fill: #fff; stroke: #cfcfcf; stroke-width: 1; transition: fill .3s, stroke .3s; }
.dg-dot.is-pass { fill: var(--green); stroke: var(--green); }
.dg-dot.is-fail { fill: #fff; stroke: var(--red); stroke-width: 1.6; }
.dg-panel svg.is-small .dg-row-text { font-size: 9.5px; }
