/* diagram.css — clickable SVG diagrams (pairs with diagram.js). Natural size, wrapper scrolls. */
.dg-card{border:1px solid var(--line);border-radius:14px;background:var(--card-bg);box-shadow:var(--card-shadow);margin:0 0 22px}
.dg-head{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;padding:14px 18px 8px;border-bottom:1px dashed var(--line)}
.dg-title{font-size:16px;font-weight:800}
.dg-talk{font-size:13px;color:var(--muted);margin-top:4px;line-height:1.55;max-width:110ch}
.dg-hint{flex:0 1 270px;font-size:10.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--faint)}
.dg-wrap{overflow:auto;padding:18px 18px 12px;max-height:none;position:relative}
.dg-wrap{cursor:grab;user-select:none;-webkit-user-select:none}
.dg-node{cursor:pointer}
.dg-wrap.dragging,.dg-wrap.dragging *{cursor:grabbing!important}
/* wide diagram: the shared scroll-hint component (scroll-hint.js/.css) marks overflow: a pill in a row above the
   scroller plus edge shadows (pointer-events:none, so drag-to-pan is never blocked). Its row sits inside the card. */
.dg-card .sh-bar{margin:6px 14px 0}
.dg-card .sh-frame{border-radius:0}
.dg-wrap:focus-visible{outline:2px solid var(--teal);outline-offset:-2px}
.dg-node:focus-visible rect{stroke:var(--teal);stroke-width:3}
/* text alternative: the same diagram as an ordered list; every item opens the same drawer as its box */
.dg-alt{border-top:1px dashed var(--line);padding:8px 18px 12px;font-size:13px;line-height:1.55;color:var(--muted)}
.dg-alt summary{cursor:pointer;font-size:10.5px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:var(--cyan);padding:4px 0;min-height:24px}
.dg-alt summary:focus-visible{outline:2px solid var(--teal);outline-offset:2px;border-radius:4px}
.dg-alt ol{margin:6px 0 4px;padding-left:22px}
.dg-alt ol ol{margin:4px 0 8px}
.dg-alt li{margin:3px 0}
.dg-alt li>b{color:var(--fg)}
.dg-li{font:inherit;font-weight:700;color:var(--teal);background:none;border:0;padding:0;margin:0;cursor:pointer;text-align:left;
  text-decoration:underline dotted;text-underline-offset:3px}
.dg-li b{font-weight:700}
.dg-li:hover,.dg-li:focus-visible{color:var(--cyan);outline:none;text-decoration-style:solid}
.dg-alt-who{margin:6px 0}
/* build-time fallback (no JavaScript, or diagrams.json failed): title, talk and the ordered boxes, readable as text */
.dg-static{border:1px solid var(--line);border-radius:14px;background:var(--card-bg);padding:14px 18px;font-size:13.5px;line-height:1.6}
.dg-static .dg-static-t{margin:0 0 4px;font-weight:800}
.dg-static p{margin:0 0 8px;color:var(--muted)}
.dg-static ol{margin:6px 0 0;padding-left:22px}
.dg-static ol ol{margin:2px 0 6px}
.dg-empty{font-size:13px;color:var(--muted);border:1px dashed var(--line);border-radius:10px;padding:10px 14px}
/* phones: header stacks so the title gets the full width; the hint shrinks to one short line */
@media (max-width:640px){
  .dg-head{flex-direction:column;gap:6px;padding:12px 14px 8px}
  .dg-hint{flex:none}
  .dg-wrap{padding:14px 14px 10px}
  .dg-abbr,.dg-readme,.dg-alt{padding-left:14px;padding-right:14px}
  .dg-li{min-height:24px}
}

.dg-svg{display:block}
.dg-lane{fill:var(--elevated);stroke:var(--line);stroke-width:1}
.dg-lane-t{font-size:11.5px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;fill:var(--cyan)}
.dg-node rect{fill:var(--card-bg);stroke:var(--line-strong);stroke-width:1.4;filter:drop-shadow(0 2px 5px rgba(16,75,60,.14));cursor:pointer;transition:stroke .12s}
.dg-node:hover rect,.dg-node:focus rect{stroke:var(--teal);stroke-width:2.2}
.dg-node:focus{outline:none}
.dg-node.has-term rect{stroke:var(--sky)}
.dg-t{font-size:15px;font-weight:700;fill:var(--fg);pointer-events:none}
.dg-sub{font-size:12.5px;fill:var(--muted);pointer-events:none}
.dg-q{font-size:11px;font-weight:900;fill:var(--sky);pointer-events:none}
.dg-edge{fill:none;stroke:var(--muted);stroke-width:1.8}
.dg-arrowhead{fill:var(--muted)}
.dg-edge-t{font-size:11.5px;fill:var(--muted);font-weight:700;paint-order:stroke;stroke:var(--card-bg);stroke-width:5px;stroke-linejoin:round}
.dg-life{stroke:var(--line-strong);stroke-width:1;stroke-dasharray:4 4}
.dg-actor rect{fill:var(--elevated)}
.dg-msg .dg-hit{fill:transparent;cursor:pointer}
.dg-msg:hover .dg-msg-t,.dg-msg:focus .dg-msg-t{fill:var(--teal)}
.dg-msg-t{font-size:12.5px;font-weight:600;fill:var(--fg);pointer-events:none}
.dg-res .dg-edge{stroke-dasharray:6 4}
.dg-async .dg-edge{stroke-dasharray:2 4}
.dg-notebox{fill:var(--amber);opacity:.18;stroke:var(--amber)}
.dg-legend{display:flex;gap:16px;flex-wrap:wrap;font-size:11.5px;color:var(--muted);padding:0 18px 12px}
.dg-legend b{display:inline-block;width:26px;border-top:2px solid var(--muted);vertical-align:middle;margin-right:5px}
.dg-legend b.res{border-top-style:dashed}.dg-legend b.async{border-top-style:dotted}
/* swimlane — horizontal role lanes, the pool seen from above */
.dg-swim-lane{fill:var(--card-bg)}
.dg-swim-lane.alt{fill:var(--elevated)}
.dg-swim-head{fill:var(--teal);opacity:.10}
.dg-swim-t{font-size:13.5px;font-weight:800;fill:var(--fg)}
.dg-swim-col{stroke:var(--line-strong);stroke-width:1;stroke-dasharray:3 5}
.dg-swim-frame{fill:none;stroke:var(--line-strong);stroke-width:1.2}
.dg-handoff{stroke:var(--teal);stroke-width:2.2}
.dg-readme{font-size:12.5px;color:var(--muted);padding:8px 18px 10px;border-top:1px dashed var(--line);line-height:1.6}
.dg-readme b{color:var(--cyan);font-size:10.5px;letter-spacing:.12em;text-transform:uppercase;margin-right:8px}
.dg-readme i.ho{display:inline-block;width:22px;border-top:2.2px solid var(--teal);vertical-align:middle;margin:0 2px}
/* abbreviation key — every short-form in the diagram, expanded, no click needed */
.dg-abbr{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;padding:10px 18px 14px;border-top:1px dashed var(--line)}
.dg-abbr-h{font-size:10.5px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:var(--cyan);margin-right:4px}
.dg-abbr-i{font:inherit;font-size:12.5px;line-height:1.4;color:var(--muted);background:var(--elevated);border:1px solid var(--line);border-radius:8px;padding:3px 9px}
.dg-abbr-i b{color:var(--fg);font-weight:800}
button.dg-abbr-i{cursor:pointer}
button.dg-abbr-i:hover,button.dg-abbr-i:focus-visible{border-color:var(--teal);color:var(--fg);outline:none}
.dg-abbr-i.has-term{border-color:var(--sky)}
.dg-abbr-i.missing{border-color:#c0392b;color:#c0392b}
/* diagram index tiles */
.dg-index{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:18px}
.dg-index button{border:1px solid var(--line);background:var(--elevated);color:var(--fg);border-radius:999px;padding:7px 14px;font-size:12.5px;font-weight:600;cursor:pointer}
.dg-index button[aria-pressed="true"]{background:var(--teal);color:var(--tab-fg);border-color:var(--teal)}
/* node card in the drawer */
.nd-kind{font-size:10px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:var(--cyan)}
.nd-say{border-left:3px solid var(--teal);padding:8px 12px;background:var(--elevated);border-radius:0 8px 8px 0;font-size:13px;line-height:1.6}
/* tones — one accent per zone or phase (hub kind; optional on flow lanes/nodes). Theme vars, so both themes work. */
.tone-purple{--tone:var(--purple)}.tone-indigo{--tone:var(--indigo)}.tone-teal{--tone:var(--teal)}.tone-green{--tone:var(--green)}
.tone-amber{--tone:var(--amber)}.tone-pink{--tone:var(--pink)}.tone-sky{--tone:var(--sky)}.tone-cyan{--tone:var(--cyan)}
.dg-lane[class*="tone-"]{fill:var(--tone);fill-opacity:.07;stroke:var(--tone);stroke-opacity:.35}
.dg-lane-t[class*="tone-"]{fill:var(--tone)}
.dg-node.dg-toned rect{stroke:var(--tone)}
.dg-hn-bar{fill:var(--tone);stroke:none!important;filter:none!important}
/* hub kind — the connected-platform picture */
.dg-hubsvg{width:100%;min-width:900px;height:auto}
.dg-hz{fill:var(--tone);fill-opacity:.075;stroke:var(--tone);stroke-opacity:.45;stroke-width:1.3;stroke-dasharray:6 5}
.dg-hz-t{font-size:12px;font-weight:900;letter-spacing:.13em;text-transform:uppercase;fill:var(--tone)}
.dg-hn .dg-hn-bg{fill:var(--surface);stroke:var(--tone);stroke-width:1.6;filter:drop-shadow(0 3px 7px rgba(16,40,60,.14))}
.dg-hn .dg-hn-tint{fill:var(--tone);fill-opacity:.06;stroke:none;pointer-events:none}
.dg-hn:hover .dg-hn-bg,.dg-hn:focus .dg-hn-bg{stroke-width:2.6}
.dg-he{fill:none;stroke:var(--tone);stroke-width:2;stroke-opacity:.75}
.dg-ah{fill:var(--tone)}
.dg-he-t{font-size:12px;font-weight:800;fill:var(--tone);paint-order:stroke;stroke:var(--surface);stroke-width:6px;stroke-linejoin:round;letter-spacing:.02em}
.dg-hubg-a{stop-color:var(--teal)}.dg-hubg-b{stop-color:var(--indigo)}.dg-hubg-c{stop-color:var(--purple)}
.dg-hub-glow{fill:none;stroke:var(--purple);stroke-opacity:.28;stroke-width:6}
.dg-hub-core{cursor:pointer}
.dg-hub-core:hover .dg-hub-glow,.dg-hub-core:focus .dg-hub-glow{stroke-opacity:.55}
.dg-hub-t{font-size:22px;font-weight:900;fill:#fff;letter-spacing:-.01em;pointer-events:none}
.dg-hub-sub{font-size:13.5px;fill:#fff;fill-opacity:.88;pointer-events:none}
.dg-hub-q{font-size:13px;font-weight:900;fill:#fff;pointer-events:none}
.dg-chip .dg-hn-bg{stroke-opacity:.9}
[data-theme="zen-cosmic"] .dg-hubg-a{stop-color:#0f766e}[data-theme="zen-cosmic"] .dg-hubg-b{stop-color:#4338ca}[data-theme="zen-cosmic"] .dg-hubg-c{stop-color:#7e22ce}
.dg-pill{fill:var(--tone);fill-opacity:.13;stroke:var(--tone);stroke-opacity:.6;stroke-width:1;filter:none!important}
.dg-pill-t{font-size:11.5px;font-weight:700;fill:var(--tone);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;pointer-events:none}
.dg-hub-legend{font-size:11px;font-weight:700;fill:var(--muted)}
.dg-hub-foot{font-size:15px;font-weight:800;fill:#fff;fill-opacity:.92;letter-spacing:.01em;pointer-events:none}
/* tree kind — a repository as a folder tree */
.dg-tree-line{fill:none;stroke:var(--line-strong);stroke-width:1.6}
.dg-tree-p{font-size:14px;font-weight:800;fill:var(--fg);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;pointer-events:none}
.dg-trow .dg-hn-bg{filter:none}
.dg-treesvg{min-width:880px}
