Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
feat: let readers try visual styles live (#36)
tt-a1i6cd50fb00134
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a98bef4e..ad8a1889 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,7 @@ All notable changes are documented here. Format loosely follows [Keep a Changelo## [Unreleased]### Added+- **Live Visual Style Try-on.** Every generated artifact now exposes one compact `Style` control and <kbd>S</kbd> shortcut that cycles the existing Classic, Signal Flow, and Blueprint presets over the exact same authored topology. The page and canonical SVG update together, so an explicit reader choice reaches PNG/JPEG/WebP/SVG/WebM export without moving a node or relationship. The authored preset remains the reload default; no preference, URL, source JSON, schema, layout, dependency, fourth style, or dedicated mobile surface is added, and passive embeds/print remain control-free. A same-topology regression proves canonical SVG geometry is identical across all three presets.- **Ambiguous Relationship Corridor Gate.** Unrelated relationships that overlap along the same orthogonal lane for at least 8px now produce exact `composition/ambiguous-corridor` evidence instead of silently reading as a false merge or branch. `standard` keeps dense engineering diagrams renderable and records the finding as a warning; `showcase` rejects it before write and in the final artifact check. Relationships sharing a semantic endpoint, point touches, and shorter overlaps remain legal. Two canonical outer-rail routes were repaired without heuristic rerouting, all five renderers share the same detector, and Proof Lab grows to 88/88 checks with zero corridor debt.- **Artifact-to-install start loop.** The existing viewer footer now offers one restrained, viewer-only `Create yours` link carrying only the typed diagram mode and suppressing its document referrer. A focused bilingual `/start` page turns that mode into canonical install commands, one exact bounded prompt, required evidence, and a verified Proof Lab example without receiving repository content, diagram data, titles, paths, or source JSON; print and canonical exports remain clean.- **Semantic Story Carrier.** Every unambiguous forward/reverse Story Beat now reuses the same five-kind semantic token vocabulary as Relationship Preview, so calls, data movement, events, security boundaries, and lifecycle transitions remain distinguishable while the guided camera advances. Story first deduplicates path and label fragments by stable authored edge key, preventing one labeled relationship from being misclassified as `multiple`; the carrier then follows only that exact authored geometry for Story's existing finite 780ms pulse. A dedicated viewer overlay keeps it above edges and below nodes, while generation-owned cleanup rejects stale animation callbacks. It runs only in ordinary desktop artifacts and explicit `?play=1` share playback; passive embeds, Still, reduced motion, hidden/print state, and canonical/raster export remain static and clean. No schema, IR, renderer layout, dependency, authored geometry, or mobile product surface was added.diff --git a/README.md b/README.mdindex de456c0d..2682660c 100644--- a/README.md+++ b/README.md@@ -15,7 +15,7 @@Archify is an agent skill for Claude, Codex CLI, and opencode. It produces a self-contained HTML diagram that opens in any modern browser, switches between dark and light themes, supports focused exploration, and exports clean static or motion assets.- **Five diagram types** — architecture, workflow, sequence, data flow, and lifecycle-- **Three visual presets** — stable `classic`, luminous `signal-flow`, and precise `blueprint`+- **Three live visual presets** — author a default, then try `classic`, `signal-flow`, or `blueprint` on the same topology- **Explore real topology** — find nodes, inspect relationships, trace routes, compare roles, and play guided stories- **Motion is optional** — output stays static unless `meta.animation: "trace"` is explicitly enabled- **Portable exports** — copy PNG or download PNG, JPEG, WebP, dual-theme SVG, and trace-enabled WebM@@ -192,7 +192,7 @@ Omit `animation` for a truly static diagram. `classic` remains the default visua| Open the live overview radar | <kbd>M</kbd> or `MAP` || Play a guided story / change chapter | <kbd>P</kbd> / <kbd>[</kbd> <kbd>]</kbd> || Enter Presentation Stage | <kbd>F</kbd> |-| Toggle theme / open Export | <kbd>T</kbd> / <kbd>E</kbd> |+| Cycle visual style / toggle theme / open Export | <kbd>S</kbd> / <kbd>T</kbd> / <kbd>E</kbd> || Zoom or reset | <kbd>+</kbd> / <kbd>-</kbd> / <kbd>0</kbd> |Stable links can restore `#focus=<id>`, `#relation=<id>`, `#route=<source>~<target>`, `#lens=<kind>~<kind>`, and `#view=<view-id>`. Reader-driven motion is finite, respects `prefers-reduced-motion`, and never enters canonical exports.diff --git a/README_EN.md b/README_EN.mdindex de456c0d..2682660c 100644--- a/README_EN.md+++ b/README_EN.md@@ -15,7 +15,7 @@Archify is an agent skill for Claude, Codex CLI, and opencode. It produces a self-contained HTML diagram that opens in any modern browser, switches between dark and light themes, supports focused exploration, and exports clean static or motion assets.- **Five diagram types** — architecture, workflow, sequence, data flow, and lifecycle-- **Three visual presets** — stable `classic`, luminous `signal-flow`, and precise `blueprint`+- **Three live visual presets** — author a default, then try `classic`, `signal-flow`, or `blueprint` on the same topology- **Explore real topology** — find nodes, inspect relationships, trace routes, compare roles, and play guided stories- **Motion is optional** — output stays static unless `meta.animation: "trace"` is explicitly enabled- **Portable exports** — copy PNG or download PNG, JPEG, WebP, dual-theme SVG, and trace-enabled WebM@@ -192,7 +192,7 @@ Omit `animation` for a truly static diagram. `classic` remains the default visua| Open the live overview radar | <kbd>M</kbd> or `MAP` || Play a guided story / change chapter | <kbd>P</kbd> / <kbd>[</kbd> <kbd>]</kbd> || Enter Presentation Stage | <kbd>F</kbd> |-| Toggle theme / open Export | <kbd>T</kbd> / <kbd>E</kbd> |+| Cycle visual style / toggle theme / open Export | <kbd>S</kbd> / <kbd>T</kbd> / <kbd>E</kbd> || Zoom or reset | <kbd>+</kbd> / <kbd>-</kbd> / <kbd>0</kbd> |Stable links can restore `#focus=<id>`, `#relation=<id>`, `#route=<source>~<target>`, `#lens=<kind>~<kind>`, and `#view=<view-id>`. Reader-driven motion is finite, respects `prefers-reduced-motion`, and never enters canonical exports.diff --git a/README_ZH.md b/README_ZH.mdindex 977b2961..79f78891 100644--- a/README_ZH.md+++ b/README_ZH.md@@ -11,7 +11,7 @@Archify 是一个可用于 Claude、Codex CLI 和 opencode 的 Agent Skill。它生成单文件 HTML 技术图:浏览器直接打开,可切换深浅主题、聚焦探索真实拓扑,并导出清晰的静态或动态结果。- **五种图表类型** —— Architecture、Workflow、Sequence、Data Flow、Lifecycle-- **三套视觉预设** —— 稳定的 `classic`、有光感的 `signal-flow`、精确的 `blueprint`+- **三套实时视觉预设** —— 先确定作者默认风格,再在同一拓扑上试穿 `classic`、`signal-flow` 或 `blueprint`- **探索真实拓扑** —— 查找节点、检查关系、探查路径、对比角色、播放引导故事- **动态默认关闭** —— 只有显式设置 `meta.animation: "trace"` 才启用动态- **便携导出** —— 复制 PNG,下载 PNG / JPEG / WebP / 双主题 SVG / WebM@@ -188,7 +188,7 @@ node bin/archify.mjs check /tmp/workflow.html| 打开实时全局雷达 | <kbd>M</kbd> 或 `MAP` || 播放故事 / 切换章节 | <kbd>P</kbd> / <kbd>[</kbd> <kbd>]</kbd> || 进入 Presentation Stage | <kbd>F</kbd> |-| 切换主题 / 打开 Export | <kbd>T</kbd> / <kbd>E</kbd> |+| 切换视觉风格 / 主题 / 打开 Export | <kbd>S</kbd> / <kbd>T</kbd> / <kbd>E</kbd> || 缩放或复位 | <kbd>+</kbd> / <kbd>-</kbd> / <kbd>0</kbd> |稳定链接可以恢复 `#focus=<id>`、`#relation=<id>`、`#route=<source>~<target>`、`#lens=<kind>~<kind>` 和 `#view=<view-id>`。读者触发的动态有限运行、遵守 `prefers-reduced-motion`,并且不会进入标准导出。diff --git a/ROADMAP.md b/ROADMAP.mdindex 2891be9c..a123f356 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -1,8 +1,10 @@# Archify Roadmap-As of v2.11.0, the coordinate-stability work has shipped as JSON IR plus typed renderers for architecture, workflow, sequence, data-flow, and lifecycle diagrams. Workflow diagrams now also have phase/group/exception-lane structure, happy-path linting, trace animation, and route-crossing guards. The shared viewer adds deterministic semantic node IDs, optional author-controlled relationship IDs with durable `#relation=` links, a pre-click Intent Trace for exact one-hop traffic, a two-endpoint Route Probe with an inspectable Route Journey over deterministic shortest authored paths, searchable Node Finder navigation, read-only one-hop focus with a renderer-owned Semantic Passport and copyable focus link, a runtime-built Semantic Radar for desktop viewport navigation, bounded typed guided views with a visible Named Chapter Rail, pre-commit Chapter Delta Preview, Shared Anchor Handoff, and path-aware Semantic Story Beats, a reader-controlled Live/Still Motion Governor, share-ready one-shot chapters with a title/route/step/state/progress cue, a viewport-filling Presentation Stage, Semantic Camera framing, pan/zoom, three visual presets, and browser-native WebM export. A generated Proof Lab publishes 11 live scenario artifacts with their exact sources, three named reader views, 88 artifact checks, and named composition receipts; its preview grid stays static while deliberate proof links play one named chapter once. The landing-page Live Proof Stage promotes three of those generated artifacts into the first bounded motion proof, and the README motion reel carries the same proof-first story onto GitHub without claiming SVG animation support. A question-first scenario guide maps concrete user needs to those 11 bounded recipes across the five modes, with one shared source for CLI and GitHub Pages and direct proof navigation. A unified CLI (`bin/archify.mjs`) wraps guide, render, validate, check, and examples. This file records the design decisions that led there, plus the ideas that were explicitly declined. The original v2.4 / v2.5 backlog (export-scale URL param, color-blind palette, gzip+base64 share links) was considered and dropped — see [Not planned](#not-planned) for the rationale on each.+As of v2.11.0, the coordinate-stability work has shipped as JSON IR plus typed renderers for architecture, workflow, sequence, data-flow, and lifecycle diagrams. Workflow diagrams now also have phase/group/exception-lane structure, happy-path linting, trace animation, and route-crossing guards. The shared viewer adds deterministic semantic node IDs, optional author-controlled relationship IDs with durable `#relation=` links, a pre-click Intent Trace for exact one-hop traffic, a two-endpoint Route Probe with an inspectable Route Journey over deterministic shortest authored paths, searchable Node Finder navigation, read-only one-hop focus with a renderer-owned Semantic Passport and copyable focus link, a runtime-built Semantic Radar for desktop viewport navigation, bounded typed guided views with a visible Named Chapter Rail, pre-commit Chapter Delta Preview, Shared Anchor Handoff, and path-aware Semantic Story Beats, a reader-controlled Live/Still Motion Governor, share-ready one-shot chapters with a title/route/step/state/progress cue, a viewport-filling Presentation Stage, Semantic Camera framing, pan/zoom, three reader-switchable visual presets, and browser-native WebM export. A generated Proof Lab publishes 11 live scenario artifacts with their exact sources, three named reader views, 88 artifact checks, and named composition receipts; its preview grid stays static while deliberate proof links play one named chapter once. The landing-page Live Proof Stage promotes three of those generated artifacts into the first bounded motion proof, and the README motion reel carries the same proof-first story onto GitHub without claiming SVG animation support. A question-first scenario guide maps concrete user needs to those 11 bounded recipes across the five modes, with one shared source for CLI and GitHub Pages and direct proof navigation. A unified CLI (`bin/archify.mjs`) wraps guide, render, validate, check, and examples. This file records the design decisions that led there, plus the ideas that were explicitly declined. The original v2.4 / v2.5 backlog (export-scale URL param, color-blind palette, gzip+base64 share links) was considered and dropped — see [Not planned](#not-planned) for the rationale on each.-The latest renderer slice adds an Ambiguous Relationship Corridor Gate across all five modes. It identifies unrelated orthogonal relationships that share at least 8px of the same lane—the geometry that can visually invent a merge or branch—while preserving shared-endpoint fan-out/merge, point touches, and shorter overlaps. `standard` emits exact relationship/segment/coordinate warnings; `showcase` rejects the same evidence before write and in the final artifact check. Two canonical routes moved to clear outer rails, Gallery now reports 88/88 checks with zero corridor debt, and the change adds no heuristic rerouting, schema, layout algorithm, dependency, or mobile surface.+The latest visual slice adds Live Visual Style Try-on. Every ordinary generated artifact can cycle Classic, Signal Flow, and Blueprint with one compact toolbar control or <kbd>S</kbd>; the document root and canonical SVG change in lockstep, so the reader can export the deliberately selected treatment while node and relationship geometry stays byte-identical. The authored preset remains the reload default, and embed/print remain control-free. No preference storage, URL state, source mutation, schema, layout algorithm, dependency, fourth style, or dedicated mobile surface was added. A same-topology cross-preset regression turns the useful Fireworks style-matrix idea into a stability gate rather than a catalogue-expansion excuse.++The previous renderer slice added an Ambiguous Relationship Corridor Gate across all five modes. It identifies unrelated orthogonal relationships that share at least 8px of the same lane—the geometry that can visually invent a merge or branch—while preserving shared-endpoint fan-out/merge, point touches, and shorter overlaps. `standard` emits exact relationship/segment/coordinate warnings; `showcase` rejects the same evidence before write and in the final artifact check. Two canonical routes moved to clear outer rails, Gallery now reports 88/88 checks with zero corridor debt, and the change adds no heuristic rerouting, schema, layout algorithm, dependency, or mobile surface.The previous visual slice added Semantic Story Carrier to every unambiguous forward/reverse Story Beat. Story now deduplicates compiled path and label fragments by stable authored edge key, so one labeled relationship remains one relationship instead of falsely becoming `multiple`. The existing finite 780ms Story pulse reuses the same call, data, event, security, and lifecycle-state token vocabulary as exact-edge Relationship Preview, following only the real authored source-to-target geometry in a viewer overlay above edges and below nodes. Generation-owned cleanup rejects stale animation callbacks. Ordinary desktop artifacts and explicit `?play=1` shares may show it; passive embeds, Still, reduced motion, hidden/print state, and canonical/raster export remain static. This adds no new animation owner, schema, IR, renderer layout, dependency, authored geometry, or mobile product surface.diff --git a/archify.zip b/archify.zipindex 81384650..7b8281b7 100644Binary files a/archify.zip and b/archify.zip differdiff --git a/archify/SKILL.md b/archify/SKILL.mdindex f84a8b88..50ea23f2 100644--- a/archify/SKILL.md+++ b/archify/SKILL.md@@ -137,7 +137,7 @@ Press <kbd>R</kbd> or use `PATH` to open Route Probe. If one node is already focAfter Route Probe resolves, expose Route Journey over the existing ordered `activeNodeIds` and exact `activeEdges`; do not build a second graph. Render every receipt stop as a native button with one roving Tab stop and add Previous, Next, Journey/Pause/Replay, and Overview controls. The full route stays visible. Position zero owns the source and no incoming edge; position `i > 0` owns exactly `activeEdges[i - 1]`, which alone may emit one finite 780ms marker-free signal. Manual activation pauses playback, while arrows/Home/End move focus and Enter/Space selects. Playback must start only from deliberate Play activation, run one finite pass, preserve the remaining dwell when paused, and reject stale timers with a generation token. Manual pan/zoom, path focus, Diagram Guide, Motion Still, dynamic reduced motion, page hiding, and print pause it without auto-resume. Use Semantic Camera to frame previous/current/next; manual inspection remains available without motion. Escape layers as pause → Overview → clear. Keep `#route=<source>~<target>` endpoint-only and restore to Overview without autoplay. Mobile controls need 44px targets; embed, print, canonical export, schema, IR, layout, dependencies, storage, and authored SVG geometry remain unchanged.-Choose `meta.visual_preset` by audience, without changing diagram geometry: use `"signal-flow"` for a striking demo, launch graphic, or motion-forward presentation; use `"blueprint"` for deployment maps, design reviews, infrastructure handoffs, and drafting-style technical documentation; omit it (or use `"classic"`) for the stable default visual language. Every preset supports both themes. WebM export appears only for trace-enabled diagrams and records six seconds directly in a supporting browser.+Choose the authored `meta.visual_preset` with the user by audience, without changing diagram geometry: use `"signal-flow"` for a striking demo, launch graphic, or motion-forward presentation; use `"blueprint"` for deployment maps, design reviews, infrastructure handoffs, and drafting-style technical documentation; omit it (or use `"classic"`) for the stable default visual language. If the user has no preference, keep Classic rather than guessing. In the generated artifact, the reader may press <kbd>S</kbd> or use `Style` to try Classic, Flow, and Blueprint over the exact same topology; this session-only choice updates the canonical SVG and therefore deliberate exports, but never rewrites source JSON, persists a preference, changes the URL, or runs in a passive embed. Every preset supports both themes. WebM export appears only for trace-enabled diagrams and records six seconds directly in a supporting browser.### Workflowdiff --git a/archify/assets/template.html b/archify/assets/template.htmlindex 1fb00c9a..66fd0bb7 100644--- a/archify/assets/template.html+++ b/archify/assets/template.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4029,7 +4055,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4185,10 +4211,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11079,6 +11149,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11094,6 +11165,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11160,9 +11232,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11186,6 +11259,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/archify/examples/dataflow-product-analytics.html b/archify/examples/dataflow-product-analytics.htmlindex ce05929c..4d4db825 100644--- a/archify/examples/dataflow-product-analytics.html+++ b/archify/examples/dataflow-product-analytics.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -708,7 +708,9 @@}html[data-motion="still"] .route-journey-overlay,html[data-document-hidden="true"] .route-journey-overlay { display: none !important; }- html[data-motion="still"] .relationship-pulse-overlay { display: none !important; }+ html[data-motion="still"] .relationship-pulse-overlay,+ html[data-motion="still"] .story-carrier-overlay,+ html[data-document-hidden="true"] .story-carrier-overlay { display: none !important; }html[data-motion="still"] .chapter-handoff-overlay { display: none !important; }html[data-motion="still"] .chapter-handoff-anchor { animation: none !important; }html[data-motion="still"] .guided-view-chapter,@@ -2400,6 +2402,19 @@font-size: 0.75rem;}+ .footer .artifact-start-link {+ color: var(--text-faint);+ text-decoration-color: color-mix(in srgb, var(--frontend-stroke) 48%, transparent);+ text-underline-offset: 0.22em;+ transition: color 0.15s ease, text-decoration-color 0.15s ease;+ }++ .footer .artifact-start-link:hover,+ .footer .artifact-start-link:focus-visible {+ color: var(--frontend-stroke);+ text-decoration-color: currentColor;+ }+/* ==========================================================Print stylesheet — hide interactive controls, force light,drop the grid so the diagram doesn't waste ink, use landscape@@ -2472,7 +2487,8 @@.relationship-hit-overlay { display: none !important; }.relationship-pulse-overlay { display: none !important; }.route-probe-overlay, .route-journey-overlay { display: none !important; }- .story-trail-overlay { display: none !important; }+ .story-trail-overlay,+ .story-carrier-overlay { display: none !important; }.diagram-container svg[data-focus-active] [data-node-id],.diagram-container svg[data-focus-active] [data-edge-from],.diagram-container svg[data-story-beat] [data-story-step],@@ -2525,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2923,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -2953,6 +2989,28 @@.t-messagebus { fill: var(--messagebus-stroke); }.t-external { fill: var(--external-stroke); }+ /* Semantic Sigils are small authored role stamps, not icons from a brand+ pack and not viewer controls. Prefix selectors with svg so the canonical+ export's SVG-only stylesheet collector keeps them automatically. */+ svg .semantic-sigil {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ opacity: 0.76;+ pointer-events: none;+ }+ svg .semantic-sigil > * { vector-effect: non-scaling-stroke; }+ svg .semantic-sigil .sigil-fill { fill: currentColor; stroke: none; }+ svg .s-frontend { color: var(--frontend-stroke); }+ svg .s-backend { color: var(--backend-stroke); }+ svg .s-database { color: var(--database-stroke); }+ svg .s-cloud { color: var(--cloud-stroke); }+ svg .s-security { color: var(--security-stroke); }+ svg .s-messagebus { color: var(--messagebus-stroke); }+ svg .s-external { color: var(--external-stroke); }+/* Reading Depth is a viewer-only level-of-detail layer. MAP preserves theauthored structure and primary labels, READ restores relationship labelsand node context, and FULL restores tags and fine annotations. Semantic@@ -3236,6 +3294,48 @@stroke-linecap: square;filter: none;}+ .semantic-flow-token {+ color: var(--frontend-stroke);+ opacity: 0;+ pointer-events: none;+ }+ .relationship-flow-token {+ animation: archify-relationship-token-life 1.2s linear 1 both;+ }+ .story-flow-token {+ animation: archify-relationship-token-life 0.78s linear 1 both;+ }+ .semantic-flow-token-halo {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.1;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ }+ .relationship-flow-token-shape {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-ink {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.05;+ stroke-linecap: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-dot { fill: currentColor; stroke: none; }+ .semantic-flow-token[data-token-kind="data"] { color: var(--database-stroke); }+ .semantic-flow-token[data-token-kind="event"] { color: var(--messagebus-stroke); }+ .semantic-flow-token[data-token-kind="security"] { color: var(--security-stroke); }+ .semantic-flow-token[data-token-kind="state"] { color: var(--cloud-stroke); }+ svg[data-preset="signal-flow"] .semantic-flow-token {+ filter: drop-shadow(0 0 5px currentColor);+ }+ svg[data-preset="blueprint"] .semantic-flow-token { filter: none; }html[data-embed="true"] .relationship-pulse-overlay { display: none; }/* Intent Trace is a temporary, pre-click exploration layer. Related@@ -3387,6 +3487,7 @@of the active guided view. The authored edge stays underneath with itsoriginal color, dash pattern, marker, and geometry intact. */.story-trail-overlay { pointer-events: none; }+ .story-carrier-overlay { pointer-events: none; }.story-trail-flow {fill: none;stroke: var(--frontend-stroke);@@ -3472,15 +3573,13 @@/* Optional trace animation, enabled only by meta.animation = "trace".The ordinary viewer performs one ambient pass and then restores the- authored solid/security/async line language. WebM uses the same finite- timeline on an isolated export clone. */- html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"],- svg[data-motion-export="true"] [data-animate="edge"] {+ authored solid/security/async line language. WebM samples the same+ authored geometry into an explicit canvas timeline. */+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"] {animation: archify-edge-flow 2.4s linear 1;animation-delay: calc(var(--step, 0) * 160ms);}- html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"],- svg[data-motion-export="true"] [data-animate="node"] {+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"] {transform-box: fill-box;transform-origin: center;animation: archify-node-pulse 3.6s ease-in-out 1;@@ -3569,6 +3668,11 @@10%, 76% { opacity: 0.98; }100% { opacity: 0; stroke-dashoffset: -1; }}+ @keyframes archify-relationship-token-life {+ 0%, 7% { opacity: 0; }+ 13%, 82% { opacity: 1; }+ 100% { opacity: 0; }+ }@keyframes archify-story-beat-node {from { opacity: 0.48; filter: saturate(0.6); }58% { opacity: 1; filter: drop-shadow(0 0 10px var(--frontend-stroke)); }@@ -3627,7 +3731,8 @@stroke-dashoffset: 0;opacity: 0.78;}- .route-journey-overlay { display: none !important; }+ .route-journey-overlay,+ .story-carrier-overlay { display: none !important; }.semantic-lens-flow {animation: none !important;stroke-dasharray: none;@@ -3642,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3653,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -3767,38 +3878,44 @@<rect width="100%" height="100%" fill="url(#grid)" /><!-- Data Stages -->- <rect x="16" y="46" width="168" height="640" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="stage" data-composition-frame-id="0" x="16" y="46" width="168" height="640" rx="10" class="c-lane" stroke-width="1"/><text x="100" y="68" class="t-dim" font-size="9" font-weight="600" text-anchor="middle">01 / Sources</text>- <rect x="231" y="46" width="168" height="640" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="stage" data-composition-frame-id="1" x="231" y="46" width="168" height="640" rx="10" class="c-lane" stroke-width="1"/><text x="315" y="68" class="t-dim" font-size="9" font-weight="600" text-anchor="middle">02 / Ingest</text>- <rect x="446" y="46" width="168" height="640" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="stage" data-composition-frame-id="2" x="446" y="46" width="168" height="640" rx="10" class="c-lane" stroke-width="1"/><text x="530" y="68" class="t-dim" font-size="9" font-weight="600" text-anchor="middle">03 / Process</text>- <rect x="661" y="46" width="168" height="640" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="stage" data-composition-frame-id="3" x="661" y="46" width="168" height="640" rx="10" class="c-lane" stroke-width="1"/><text x="745" y="68" class="t-dim" font-size="9" font-weight="600" text-anchor="middle">04 / Store</text>- <rect x="876" y="46" width="168" height="640" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="stage" data-composition-frame-id="4" x="876" y="46" width="168" height="640" rx="10" class="c-lane" stroke-width="1"/><text x="960" y="68" class="t-dim" font-size="9" font-weight="600" text-anchor="middle">05 / Consume</text><!-- Flow paths -->- <path data-edge-from="web" data-edge-to="edge" data-edge-label="clickstream" data-edge-key="0" data-edge-id="web-clickstream" d="M 156 157 L 184 157 L 184 271 L 259 271" class="a-emphasis" data-animate="edge" style="--step:0" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="mobile" data-edge-to="edge" data-edge-label="app events" data-edge-key="1" data-edge-id="mobile-events" d="M 156 385 L 222 385 L 222 271 L 259 271" class="a-default" data-animate="edge" style="--step:1" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="edge" data-edge-to="consent" data-edge-label="identity + consent" data-edge-key="2" data-edge-id="consent-enrichment" d="M 315 242 L 315 112 L 450 112 L 450 157 L 474 157" class="a-security" data-animate="edge" style="--step:2" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="edge" data-edge-to="stream" data-edge-label="accepted events" data-edge-key="3" data-edge-id="accepted-events" d="M 371 271 L 420 271 L 420 385 L 474 385" class="a-emphasis" data-animate="edge" style="--step:3" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="consent" data-edge-to="pii" data-edge-label="identity map" data-edge-key="4" data-edge-id="identity-map" d="M 586 157 L 689 157" class="a-security" data-animate="edge" style="--step:4" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="stream" data-edge-to="warehouse" data-edge-label="normalized facts" data-edge-key="5" data-edge-id="normalized-facts" d="M 586 385 L 689 385" class="a-emphasis" data-animate="edge" style="--step:5" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="warehouse" data-edge-to="features" data-edge-label="daily aggregates" data-edge-key="6" data-edge-id="daily-aggregates" d="M 745 414 L 745 584" class="a-dashed" data-animate="edge" style="--step:6" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>- <path data-edge-from="warehouse" data-edge-to="dashboard" data-edge-label="metrics SQL" data-edge-key="7" data-edge-id="metrics-query" d="M 801 385 L 852 385 L 852 271 L 904 271" class="a-default" data-animate="edge" style="--step:7" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="features" data-edge-to="model" data-edge-label="feature vectors" data-edge-key="8" data-edge-id="feature-vectors" d="M 801 613 L 904 613" class="a-dashed" data-animate="edge" style="--step:8" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>- <path data-edge-from="pii" data-edge-to="dashboard" data-edge-label="restricted join" data-edge-key="9" data-edge-id="restricted-join" d="M 801 157 L 878 157 L 878 212 L 960 212 L 960 242" class="a-security" data-animate="edge" style="--step:9" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="web" data-edge-to="edge" data-edge-label="clickstream" data-edge-key="0" data-edge-id="web-clickstream" data-composition-points="156,157;205,157;205,271;259,271" d="M 156 157 L 205 157 L 205 271 L 259 271" class="a-emphasis" data-animate="edge" style="--step:0" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="mobile" data-edge-to="edge" data-edge-label="app events" data-edge-key="1" data-edge-id="mobile-events" data-composition-points="156,385;222,385;222,271;259,271" d="M 156 385 L 222 385 L 222 271 L 259 271" class="a-default" data-animate="edge" style="--step:1" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="edge" data-edge-to="consent" data-edge-label="identity + consent" data-edge-key="2" data-edge-id="consent-enrichment" data-composition-points="315,242;315,112;450,112;450,157;474,157" d="M 315 242 L 315 112 L 450 112 L 450 157 L 474 157" class="a-security" data-animate="edge" style="--step:2" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="edge" data-edge-to="stream" data-edge-label="accepted events" data-edge-key="3" data-edge-id="accepted-events" data-composition-points="371,271;420,271;420,385;474,385" d="M 371 271 L 420 271 L 420 385 L 474 385" class="a-emphasis" data-animate="edge" style="--step:3" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="consent" data-edge-to="pii" data-edge-label="identity map" data-edge-key="4" data-edge-id="identity-map" data-composition-points="586,157;689,157" d="M 586 157 L 689 157" class="a-security" data-animate="edge" style="--step:4" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="stream" data-edge-to="warehouse" data-edge-label="normalized facts" data-edge-key="5" data-edge-id="normalized-facts" data-composition-points="586,385;689,385" d="M 586 385 L 689 385" class="a-emphasis" data-animate="edge" style="--step:5" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="warehouse" data-edge-to="features" data-edge-label="daily aggregates" data-edge-key="6" data-edge-id="daily-aggregates" data-composition-points="745,414;745,584" d="M 745 414 L 745 584" class="a-dashed" data-animate="edge" style="--step:6" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="warehouse" data-edge-to="dashboard" data-edge-label="metrics SQL" data-edge-key="7" data-edge-id="metrics-query" data-composition-points="801,385;852,385;852,271;904,271" d="M 801 385 L 852 385 L 852 271 L 904 271" class="a-default" data-animate="edge" style="--step:7" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="features" data-edge-to="model" data-edge-label="feature vectors" data-edge-key="8" data-edge-id="feature-vectors" data-composition-points="801,613;904,613" d="M 801 613 L 904 613" class="a-dashed" data-animate="edge" style="--step:8" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="pii" data-edge-to="dashboard" data-edge-label="restricted join" data-edge-key="9" data-edge-id="restricted-join" data-composition-points="801,157;878,157;878,212;960,212;960,242" d="M 801 157 L 878 157 L 878 212 L 960 212 L 960 242" class="a-security" data-animate="edge" style="--step:9" stroke-width="1.4" marker-end="url(#arrowhead-security)"/><!-- Nodes --><g id="node-web" data-node-id="web" data-node-label="Web App" tabindex="0" role="button" aria-label="Focus Web App, browser SDK, 01 / Sources" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="browser SDK" data-node-tag="events" data-node-context="01 / Sources"><title>Web App · browser SDK · 01 / Sources · events</title><rect x="44" y="128" width="112" height="58" rx="6" class="c-mask"/><rect x="44" y="128" width="112" height="58" rx="6" class="c-frontend" data-animate="node" style="--step:0" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(50 134) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g><text data-detail-anchor x="100" y="149" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Web App</text><text data-detail="context" x="100" y="165" class="t-muted" font-size="7" text-anchor="middle">browser SDK</text><text data-detail="fine" x="100" y="175" class="t-frontend" font-size="7" text-anchor="middle">events</text>@@ -3808,6 +3925,12 @@<title>Mobile · iOS / Android · 01 / Sources · events</title><rect x="44" y="356" width="112" height="58" rx="6" class="c-mask"/><rect x="44" y="356" width="112" height="58" rx="6" class="c-frontend" data-animate="node" style="--step:1" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(50 362) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g><text data-detail-anchor x="100" y="377" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Mobile</text><text data-detail="context" x="100" y="393" class="t-muted" font-size="7" text-anchor="middle">iOS / Android</text><text data-detail="fine" x="100" y="403" class="t-frontend" font-size="7" text-anchor="middle">events</text>@@ -3817,6 +3940,9 @@<title>Edge API · collector · 02 / Ingest · TLS</title><rect x="259" y="242" width="112" height="58" rx="6" class="c-mask"/><rect x="259" y="242" width="112" height="58" rx="6" class="c-cloud" data-animate="node" style="--step:1" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(265 248) scale(0.6875)">+ <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>+ </g><text data-detail-anchor x="315" y="263" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Edge API</text><text data-detail="context" x="315" y="279" class="t-muted" font-size="7" text-anchor="middle">collector</text><text data-detail="fine" x="315" y="289" class="t-cloud" font-size="7" text-anchor="middle">TLS</text>@@ -3826,6 +3952,10 @@<title>Consent Gate · policy filter · 03 / Process · PII guard</title><rect x="474" y="128" width="112" height="58" rx="6" class="c-mask"/><rect x="474" y="128" width="112" height="58" rx="6" class="c-security" data-animate="node" style="--step:3" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(480 134) scale(0.6875)">+ <path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>+ <path d="m5.8 8 1.5 1.5 3-3"/>+ </g><text data-detail-anchor x="530" y="149" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Consent Gate</text><text data-detail="context" x="530" y="165" class="t-muted" font-size="7" text-anchor="middle">policy filter</text><text data-detail="fine" x="530" y="175" class="t-security" font-size="7" text-anchor="middle">PII guard</text>@@ -3835,6 +3965,12 @@<title>Event Stream · Kafka topic · 03 / Process · ordered</title><rect x="474" y="356" width="112" height="58" rx="6" class="c-mask"/><rect x="474" y="356" width="112" height="58" rx="6" class="c-messagebus" data-animate="node" style="--step:4" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(480 362) scale(0.6875)">+ <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>+ <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>+ <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>+ <circle cx="7" cy="11.5" r="1" class="sigil-fill"/>+ </g><text data-detail-anchor x="530" y="377" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Event Stream</text><text data-detail="context" x="530" y="393" class="t-muted" font-size="7" text-anchor="middle">Kafka topic</text><text data-detail="fine" x="530" y="403" class="t-messagebus" font-size="7" text-anchor="middle">ordered</text>@@ -3844,6 +3980,10 @@<title>PII Vault · encrypted · 04 / Store · restricted</title><rect x="689" y="128" width="112" height="58" rx="6" class="c-mask"/><rect x="689" y="128" width="112" height="58" rx="6" class="c-security" data-animate="node" style="--step:5" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(695 134) scale(0.6875)">+ <path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>+ <path d="m5.8 8 1.5 1.5 3-3"/>+ </g><text data-detail-anchor x="745" y="149" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">PII Vault</text><text data-detail="context" x="745" y="165" class="t-muted" font-size="7" text-anchor="middle">encrypted</text><text data-detail="fine" x="745" y="175" class="t-security" font-size="7" text-anchor="middle">restricted</text>@@ -3853,6 +3993,10 @@<title>Warehouse · analytics tables · 04 / Store · curated</title><rect x="689" y="356" width="112" height="58" rx="6" class="c-mask"/><rect x="689" y="356" width="112" height="58" rx="6" class="c-database" data-animate="node" style="--step:6" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(695 362) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ </g><text data-detail-anchor x="745" y="377" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Warehouse</text><text data-detail="context" x="745" y="393" class="t-muted" font-size="7" text-anchor="middle">analytics tables</text><text data-detail="fine" x="745" y="403" class="t-database" font-size="7" text-anchor="middle">curated</text>@@ -3862,6 +4006,10 @@<title>Feature Store · daily batch · 04 / Store · derived</title><rect x="689" y="584" width="112" height="58" rx="6" class="c-mask"/><rect x="689" y="584" width="112" height="58" rx="6" class="c-database" data-animate="node" style="--step:7" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(695 590) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ </g><text data-detail-anchor x="745" y="605" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Feature Store</text><text data-detail="context" x="745" y="621" class="t-muted" font-size="7" text-anchor="middle">daily batch</text><text data-detail="fine" x="745" y="631" class="t-database" font-size="7" text-anchor="middle">derived</text>@@ -3871,6 +4019,9 @@<title>Dashboards · product metrics · 05 / Consume · SQL</title><rect x="904" y="242" width="112" height="58" rx="6" class="c-mask"/><rect x="904" y="242" width="112" height="58" rx="6" class="c-backend" data-animate="node" style="--step:8" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(910 248) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g><text data-detail-anchor x="960" y="263" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Dashboards</text><text data-detail="context" x="960" y="279" class="t-muted" font-size="7" text-anchor="middle">product metrics</text><text data-detail="fine" x="960" y="289" class="t-backend" font-size="7" text-anchor="middle">SQL</text>@@ -3880,6 +4031,9 @@<title>ML Model · ranking job · 05 / Consume · features</title><rect x="904" y="584" width="112" height="58" rx="6" class="c-mask"/><rect x="904" y="584" width="112" height="58" rx="6" class="c-backend" data-animate="node" style="--step:9" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(910 590) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g><text data-detail-anchor x="960" y="605" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">ML Model</text><text data-detail="context" x="960" y="621" class="t-muted" font-size="7" text-anchor="middle">ranking job</text><text data-detail="fine" x="960" y="631" class="t-backend" font-size="7" text-anchor="middle">features</text>@@ -4003,7 +4157,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4150,15 +4304,59 @@<!-- Footer --><p class="footer">- Data-flow diagram • Built with Archify<span class="no-print"> • Hover to trace • <kbd>R</kbd> route • Click to focus • <kbd>+</kbd>/<kbd>−</kbd> zoom • <kbd>M</kbd> radar • <kbd>[</kbd>/<kbd>]</kbd> views • <kbd>P</kbd> play story • <kbd>T</kbd> theme • <kbd>E</kbd> export</span>+ Data-flow diagram • Built with Archify<span class="no-print"> • <a class="artifact-start-link" href="https://tt-a1i.github.io/archify/start.html?type=dataflow" target="_blank" rel="noopener noreferrer">Create yours ↗</a> • Hover to trace • <kbd>R</kbd> route • Click to focus • <kbd>+</kbd>/<kbd>−</kbd> zoom • <kbd>M</kbd> radar • <kbd>[</kbd>/<kbd>]</kbd> views • <kbd>P</kbd> play story • <kbd>T</kbd> theme • <kbd>E</kbd> export</span></p></div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -4274,12 +4472,8 @@scale = scale || 1;opts = opts || {};var autoTheme = opts.autoTheme === true;- var motionExport = opts.motion === true;-var svg = document.querySelector('.diagram-container svg');var clone = svg.cloneNode(true);- if (motionExport) clone.setAttribute('data-motion-export', 'true');- else clone.removeAttribute('data-motion-export');// View transforms and neighborhood focus are HTML exploration state,// never part of a downloaded full-diagram artifact.@@ -4314,7 +4508,7 @@Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-preview-role]'), function (el) {el.removeAttribute('data-chapter-preview-role');});- Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay]'), function (el) {+ Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay]'), function (el) {el.remove();});Array.prototype.forEach.call(clone.querySelectorAll('[data-intent-trace-overlay]'), function (el) {@@ -4424,7 +4618,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;// Scale width/height so the browser rasterizes the vectors at target@@ -4650,9 +4844,11 @@}// Record the live CSS animation without Puppeteer, ffmpeg, or a network- // dependency. The serialized SVG keeps Archify's animation keyframes;- // one Image instance advances its timeline while each frame is painted- // into a MediaRecorder-backed canvas.+ // dependency. SVG files loaded through Image are commonly rasterized as+ // one cached bitmap, so repeatedly drawing that Image does not reliably+ // advance its CSS animation. Keep one crisp static SVG background, then+ // render an explicit time-varying signal scene over the real authored+ // relationship geometry on every captured canvas frame.function recordWebm(options) {options = options || {};if (!canRecordMotion()) {@@ -4663,12 +4859,161 @@var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var scale = Math.min(1, 1280 / vb.width);- var data = serializeSvg(scale, { motion: true });+ var data = serializeSvg(scale);var sourceUrl = URL.createObjectURL(new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' }));+ function createMotionScene(root) {+ var rootMatrix = root.getCTM ? root.getCTM() : null;++ function pointInRoot(element, point) {+ if (!rootMatrix || !element.getCTM || !point.matrixTransform) return { x: point.x, y: point.y };+ try {+ var elementMatrix = element.getCTM();+ if (!elementMatrix) return { x: point.x, y: point.y };+ var mapped = point.matrixTransform(rootMatrix.inverse().multiply(elementMatrix));+ return { x: mapped.x, y: mapped.y };+ } catch (_) {+ return { x: point.x, y: point.y };+ }+ }++ function samplesFor(element) {+ if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];+ var length;+ try { length = element.getTotalLength(); } catch (_) { return []; }+ if (!Number.isFinite(length) || length <= 0) return [];+ var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));+ var points = [];+ for (var i = 0; i <= count; i++) {+ points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));+ }+ return points;+ }++ function authoredStep(element, fallback) {+ var raw = element.style.getPropertyValue('--step') || getComputedStyle(element).getPropertyValue('--step');+ var value = Number(raw);+ return Number.isFinite(value) ? value : fallback;+ }++ var edges = Array.prototype.slice.call(root.querySelectorAll('[data-animate="edge"]')).map(function (element, index) {+ var computed = getComputedStyle(element);+ return {+ points: samplesFor(element),+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ width: Math.max(1.5, parseFloat(computed.strokeWidth) || 1.5),+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(function (edge) { return edge.points.length > 1; });++ var nodes = Array.prototype.slice.call(root.querySelectorAll('[data-node-id][data-animate="node"]')).map(function (element, index) {+ var box;+ try { box = element.getBBox(); } catch (_) { return null; }+ var painted = element.querySelector('[class*="c-"]') || element;+ var computed = getComputedStyle(painted);+ return {+ x: box.x,+ y: box.y,+ width: box.width,+ height: box.height,+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(Boolean);++ return { edges: edges, nodes: nodes, x: vb.x, y: vb.y, width: vb.width, height: vb.height };+ }++ function pointAlong(points, progress) {+ var scaled = Math.max(0, Math.min(1, progress)) * (points.length - 1);+ var index = Math.min(points.length - 2, Math.floor(scaled));+ var mix = scaled - index;+ return {+ x: points[index].x + (points[index + 1].x - points[index].x) * mix,+ y: points[index].y + (points[index + 1].y - points[index].y) * mix+ };+ }++ function roundedRectPath(ctx, x, y, width, height, radius) {+ var r = Math.max(0, Math.min(radius, width / 2, height / 2));+ ctx.beginPath();+ ctx.moveTo(x + r, y);+ ctx.lineTo(x + width - r, y);+ ctx.quadraticCurveTo(x + width, y, x + width, y + r);+ ctx.lineTo(x + width, y + height - r);+ ctx.quadraticCurveTo(x + width, y + height, x + width - r, y + height);+ ctx.lineTo(x + r, y + height);+ ctx.quadraticCurveTo(x, y + height, x, y + height - r);+ ctx.lineTo(x, y + r);+ ctx.quadraticCurveTo(x, y, x + r, y);+ ctx.closePath();+ }++ function drawMotionFrame(ctx, backgroundImage, motionScene, elapsed) {+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.drawImage(backgroundImage, 0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.save();+ ctx.scale(ctx.canvas.width / motionScene.width, ctx.canvas.height / motionScene.height);+ ctx.translate(-motionScene.x, -motionScene.y);++ motionScene.edges.forEach(function (edge) {+ var duration = 1.75;+ var progress = (elapsed - edge.delay) / duration;+ if (progress < 0 || progress > 1) return;+ var head = Math.max(0, Math.min(1, progress));+ var tail = Math.max(0, head - 0.24);+ var opacity = Math.sin(Math.PI * Math.min(1, progress));++ ctx.save();+ ctx.strokeStyle = edge.color;+ ctx.fillStyle = edge.color;+ ctx.lineCap = 'round';+ ctx.lineJoin = 'round';+ ctx.lineWidth = Math.max(3.2, edge.width * 2.2);+ ctx.globalAlpha = 0.42 + opacity * 0.5;+ ctx.shadowColor = edge.color;+ ctx.shadowBlur = 10;+ ctx.beginPath();+ for (var i = 0; i <= 14; i++) {+ var trailPoint = pointAlong(edge.points, tail + (head - tail) * i / 14);+ if (i === 0) ctx.moveTo(trailPoint.x, trailPoint.y);+ else ctx.lineTo(trailPoint.x, trailPoint.y);+ }+ ctx.stroke();++ var point = pointAlong(edge.points, head);+ ctx.globalAlpha = 0.95;+ ctx.beginPath();+ ctx.arc(point.x, point.y, 4.8, 0, Math.PI * 2);+ ctx.fill();+ ctx.restore();+ });++ motionScene.nodes.forEach(function (node) {+ var progress = (elapsed - node.delay) / 2.6;+ if (progress < 0 || progress > 1) return;+ var pulse = Math.sin(Math.PI * progress);+ if (pulse <= 0.02) return;+ ctx.save();+ ctx.strokeStyle = node.color;+ ctx.lineWidth = 1.4 + pulse * 1.8;+ ctx.globalAlpha = pulse * 0.5;+ ctx.shadowColor = node.color;+ ctx.shadowBlur = 12 * pulse;+ var inset = 2 + pulse * 3;+ roundedRectPath(ctx, node.x - inset, node.y - inset, node.width + inset * 2, node.height + inset * 2, 8);+ ctx.stroke();+ ctx.restore();+ });++ ctx.restore();+ }++ var motionScene = createMotionScene(svg);+return new Promise(function (resolve, reject) {- var img = new Image();- img.onload = function () {+ var backgroundImage = new Image();+ backgroundImage.onload = function () {var canvas = document.createElement('canvas');canvas.width = Math.max(2, Math.round(data.width / 2) * 2);canvas.height = Math.max(2, Math.round(data.height / 2) * 2);@@ -4687,6 +5032,7 @@var chunks = [];var raf = 0;var stopped = false;+ var startedAt = performance.now();function cleanup() {if (stopped) return;stopped = true;@@ -4694,9 +5040,9 @@URL.revokeObjectURL(sourceUrl);stream.getTracks().forEach(function (track) { track.stop(); });}- function draw() {- ctx.clearRect(0, 0, canvas.width, canvas.height);- ctx.drawImage(img, 0, 0, canvas.width, canvas.height);+ function draw(now) {+ var elapsed = Math.max(0, ((Number(now) || performance.now()) - startedAt) / 1000);+ drawMotionFrame(ctx, backgroundImage, motionScene, elapsed);raf = requestAnimationFrame(draw);}recorder.ondataavailable = function (event) {@@ -4712,8 +5058,10 @@if (!blob.size) reject(new Error('MediaRecorder produced an empty WebM'));else resolve(blob);};- draw();+ drawMotionFrame(ctx, backgroundImage, motionScene, 0);recorder.start(250);+ startedAt = performance.now();+ raf = requestAnimationFrame(draw);setTimeout(function () {if (recorder.state === 'inactive') return;// Chromium normally emits the final chunk during stop(), but@@ -4726,11 +5074,11 @@}, 120);}, duration);};- img.onerror = function () {+ backgroundImage.onerror = function () {URL.revokeObjectURL(sourceUrl);- reject(new Error('Animated SVG could not be loaded for WebM export'));+ reject(new Error('SVG background could not be loaded for WebM export'));};- img.src = sourceUrl;+ backgroundImage.src = sourceUrl;});}@@ -5440,6 +5788,99 @@clone.setAttribute('pathLength', '1');return clone;}+ function relationshipTokenKind(edge) {+ var shapes = relationshipEdgeShapes(edge);+ var classEvidence = [edge.getAttribute('class') || ''].concat(shapes.map(function (shape) {+ return shape.getAttribute('class') || '';+ })).join(' ');+ var from = edge.getAttribute('data-edge-from') || '';+ var to = edge.getAttribute('data-edge-to') || '';+ var source = nodes().find(function (node) { return node.getAttribute('data-node-id') === from; });+ var target = nodes().find(function (node) { return node.getAttribute('data-node-id') === to; });+ var sourceKind = source ? source.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ var targetKind = target ? target.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ if (/\ba-security\b/.test(classEvidence) || sourceKind === 'security' || targetKind === 'security' || targetKind === 'failure') return 'security';+ if (/\ba-dashed\b/.test(classEvidence) || sourceKind === 'messagebus' || targetKind === 'messagebus') return 'event';+ if (sourceKind === 'database' || targetKind === 'database') return 'data';+ if (targetKind === 'waiting' || targetKind === 'success') return 'state';+ return 'call';+ }+ function relationshipTokenPath(shape) {+ if (!shape) return '';+ var tagName = String(shape.tagName || '').toLowerCase();+ if (tagName === 'path') return shape.getAttribute('d') || '';+ if (tagName === 'line') {+ return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') ++ ' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');+ }+ if (tagName === 'polyline' && shape.points && shape.points.numberOfItems > 1) {+ var commands = [];+ for (var i = 0; i < shape.points.numberOfItems; i += 1) {+ var point = shape.points.getItem(i);+ commands.push((i === 0 ? 'M ' : 'L ') + point.x + ' ' + point.y);+ }+ return commands.join(' ');+ }+ return '';+ }+ function relationshipTokenPart(tagName, className, attrs) {+ var part = document.createElementNS(svgNamespace, tagName);+ part.setAttribute('class', className);+ Object.keys(attrs || {}).forEach(function (name) { part.setAttribute(name, attrs[name]); });+ return part;+ }+ function relationshipTokenGeometry(shape, kind, key, options) {+ options = options || {};+ var pathData = relationshipTokenPath(shape);+ if (!pathData) return null;+ var token = document.createElementNS(svgNamespace, 'g');+ token.setAttribute('class', 'semantic-flow-token ' + (options.className || 'relationship-flow-token'));+ token.setAttribute('data-token-kind', kind);+ token.setAttribute('data-token-edge-key', key);+ token.setAttribute('aria-hidden', 'true');+ token.appendChild(relationshipTokenPart('circle', 'semantic-flow-token-halo', { cx: '0', cy: '0', r: '7' }));+ if (kind === 'data') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-5', y: '-4', width: '10', height: '8', rx: '2' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -2.8 -1.2 h 5.6 M -2.8 1.4 h 3.8' }));+ } else if (kind === 'event') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-7', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-2', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '3', y: '-3', width: '4', height: '6', rx: '1' }));+ } else if (kind === 'security') {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-shape', { d: 'M 0 -5 L 4 -3.4 V 0 c 0 3 -1.6 4.5 -4 5.5 C -2.4 4.5 -4 3 -4 0 v -3.4 Z' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'm -2 .2 1.4 1.4 L 2 -1.4' }));+ } else if (kind === 'state') {+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-shape', { cx: '0', cy: '0', r: '5' }));+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-dot', { cx: '0', cy: '0', r: '1.35' }));+ } else {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -5 -3 L -1 0 L -5 3 M 0 -3 L 4 0 L 0 3' }));+ }+ var motion = document.createElementNS(svgNamespace, 'animateMotion');+ motion.setAttribute('path', pathData);+ motion.setAttribute('dur', options.duration || '1.2s');+ motion.setAttribute('begin', '0s');+ motion.setAttribute('fill', 'freeze');+ motion.setAttribute('rotate', 'auto');+ motion.setAttribute('calcMode', 'spline');+ motion.setAttribute('keyTimes', '0;1');+ motion.setAttribute('keySplines', '.2 0 .2 1');+ token.appendChild(motion);+ return token;+ }+ function createSemanticFlowToken(edge, shape, options) {+ if (!edge || !shape) return null;+ var key = edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ return relationshipTokenGeometry(shape, relationshipTokenKind(edge), key, options);+ }+ Archify.flowTokens = {+ create: createSemanticFlowToken,+ kind: function (edge) { return relationshipTokenKind(edge); },+ path: relationshipTokenPath+ };function renderRelationshipPulse(key) {removeRelationshipPulse();if (!key || document.documentElement.getAttribute('data-embed') === 'true') return false;@@ -5454,12 +5895,23 @@overlay.setAttribute('data-relationship-pulse-overlay', '');overlay.setAttribute('data-relationship-pulse-key', key);overlay.setAttribute('aria-hidden', 'true');+ var tokenAdded = false;matchingEdges.forEach(function (edge) {var wrapper = document.createElementNS(svgNamespace, 'g');if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));- relationshipEdgeShapes(edge).forEach(function (shape) {+ var shapes = relationshipEdgeShapes(edge);+ shapes.forEach(function (shape) {wrapper.appendChild(relationshipPulseGeometry(shape));});+ if (!tokenAdded && shapes.length) {+ var tokenKind = relationshipTokenKind(edge);+ var token = relationshipTokenGeometry(shapes[0], tokenKind, key);+ if (token) {+ wrapper.appendChild(token);+ overlay.setAttribute('data-relationship-token-kind', tokenKind);+ tokenAdded = true;+ }+ }if (wrapper.childNodes.length) overlay.appendChild(wrapper);});if (!overlay.childNodes.length) return false;@@ -6381,6 +6833,7 @@var momentRestoreGeneration = 0;var storySteps = [];var storyPulseOwnerToken = 0;+ var storyPulseGeneration = 0;var autoplayPending = false;var VIEW_INTERVAL_MS = 3200;var STORY_FOLLOW_MIN_DWELL_MS = 1100;@@ -6906,6 +7359,22 @@);}+ function uniqueStoryEdges(edgeList) {+ var positions = {};+ var unique = [];+ edgeList.forEach(function (edge) {+ var key = storyEdgeKey(edge);+ if (!Object.prototype.hasOwnProperty.call(positions, key)) {+ positions[key] = unique.length;+ unique.push(edge);+ return;+ }+ var index = positions[key];+ if (!storyGeometry(unique[index]).length && storyGeometry(edge).length) unique[index] = edge;+ });+ return unique;+ }+function storyStep(view, index, edgeList, byId) {var id = view.focus[index];var node = byId[id];@@ -6920,6 +7389,8 @@else if (from === id && to === previousId) reverse.push(edge);});}+ forward = uniqueStoryEdges(forward);+ reverse = uniqueStoryEdges(reverse);var edges = forward.concat(reverse).sort(function (left, right) {return edgeList.indexOf(left) - edgeList.indexOf(right);});@@ -7090,7 +7561,8 @@function storyMotionAllowed() {if (document.hidden || reducedMotion()) return false;if (document.documentElement.getAttribute('data-motion') !== 'live') return false;- if (document.documentElement.getAttribute('data-embed') === 'true') return false;+ if (document.documentElement.getAttribute('data-embed') === 'true' &&+ document.documentElement.getAttribute('data-share-playback') !== 'true') return false;if (window.matchMedia && window.matchMedia('print').matches) return false;return !(Archify.motionGovernor && Archify.motionGovernor.isPaused());}@@ -7104,9 +7576,13 @@function clearStoryPulse(options) {options = options || {};+ storyPulseGeneration += 1;Array.prototype.forEach.call(svg.querySelectorAll('.story-trail-flow[data-story-pulse]'), function (flow) {flow.removeAttribute('data-story-pulse');});+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-carrier-overlay]'), function (overlay) {+ overlay.remove();+ });if (storyPulseOwnerToken && options.release !== false && Archify.motionGovernor) {var token = storyPulseOwnerToken;storyPulseOwnerToken = 0;@@ -7119,14 +7595,41 @@if (!step || (step.relation !== 'forward' && step.relation !== 'reverse') || step.edges.length !== 1 || !storyMotionAllowed()) return false;var flows = Array.prototype.slice.call(svg.querySelectorAll('.story-trail-flow[data-story-beat-step="' + step.index + '"]'));if (!flows.length) return false;+ var pulseGeneration = storyPulseGeneration;if (Archify.motionGovernor && Archify.motionGovernor.capable) {storyPulseOwnerToken = Archify.motionGovernor.claim('story', function () {clearStoryPulse({ release: false });});}flows.forEach(function (flow) { flow.setAttribute('data-story-pulse', 'true'); });+ if (Archify.flowTokens && typeof Archify.flowTokens.create === 'function') {+ var edge = step.edges[0];+ var shapes = storyGeometry(edge);+ var carrier = shapes.length ? Archify.flowTokens.create(edge, shapes[0], {+ className: 'story-flow-token',+ duration: '0.78s'+ }) : null;+ if (carrier) {+ var carrierOverlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ var carrierWrapper = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ carrierOverlay.setAttribute('class', 'story-carrier-overlay');+ carrierOverlay.setAttribute('data-story-carrier-overlay', '');+ carrierOverlay.setAttribute('aria-hidden', 'true');+ if (edge.hasAttribute('transform')) carrierWrapper.setAttribute('transform', edge.getAttribute('transform'));+ carrier.setAttribute('data-story-carrier-token', '');+ carrier.setAttribute('data-story-beat-step', String(step.index));+ carrierWrapper.appendChild(carrier);+ carrierOverlay.appendChild(carrierWrapper);+ var firstNode = svg.querySelector('[data-node-id]');+ while (firstNode && firstNode.parentNode !== svg) firstNode = firstNode.parentNode;+ if (firstNode) svg.insertBefore(carrierOverlay, firstNode);+ else svg.appendChild(carrierOverlay);+ }+ }void flows[0].getBoundingClientRect();- flows[0].addEventListener('animationend', function () { clearStoryPulse(); }, { once: true });+ flows[0].addEventListener('animationend', function () {+ if (pulseGeneration === storyPulseGeneration) clearStoryPulse();+ }, { once: true });return true;}@@ -10744,6 +11247,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -10759,6 +11263,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -10825,9 +11330,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -10851,6 +11357,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/archify/examples/lifecycle-agent-run.html b/archify/examples/lifecycle-agent-run.htmlindex ae14833c..0b09fa6b 100644--- a/archify/examples/lifecycle-agent-run.html+++ b/archify/examples/lifecycle-agent-run.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -708,7 +708,9 @@}html[data-motion="still"] .route-journey-overlay,html[data-document-hidden="true"] .route-journey-overlay { display: none !important; }- html[data-motion="still"] .relationship-pulse-overlay { display: none !important; }+ html[data-motion="still"] .relationship-pulse-overlay,+ html[data-motion="still"] .story-carrier-overlay,+ html[data-document-hidden="true"] .story-carrier-overlay { display: none !important; }html[data-motion="still"] .chapter-handoff-overlay { display: none !important; }html[data-motion="still"] .chapter-handoff-anchor { animation: none !important; }html[data-motion="still"] .guided-view-chapter,@@ -2400,6 +2402,19 @@font-size: 0.75rem;}+ .footer .artifact-start-link {+ color: var(--text-faint);+ text-decoration-color: color-mix(in srgb, var(--frontend-stroke) 48%, transparent);+ text-underline-offset: 0.22em;+ transition: color 0.15s ease, text-decoration-color 0.15s ease;+ }++ .footer .artifact-start-link:hover,+ .footer .artifact-start-link:focus-visible {+ color: var(--frontend-stroke);+ text-decoration-color: currentColor;+ }+/* ==========================================================Print stylesheet — hide interactive controls, force light,drop the grid so the diagram doesn't waste ink, use landscape@@ -2472,7 +2487,8 @@.relationship-hit-overlay { display: none !important; }.relationship-pulse-overlay { display: none !important; }.route-probe-overlay, .route-journey-overlay { display: none !important; }- .story-trail-overlay { display: none !important; }+ .story-trail-overlay,+ .story-carrier-overlay { display: none !important; }.diagram-container svg[data-focus-active] [data-node-id],.diagram-container svg[data-focus-active] [data-edge-from],.diagram-container svg[data-story-beat] [data-story-step],@@ -2525,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2923,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -2953,6 +2989,28 @@.t-messagebus { fill: var(--messagebus-stroke); }.t-external { fill: var(--external-stroke); }+ /* Semantic Sigils are small authored role stamps, not icons from a brand+ pack and not viewer controls. Prefix selectors with svg so the canonical+ export's SVG-only stylesheet collector keeps them automatically. */+ svg .semantic-sigil {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ opacity: 0.76;+ pointer-events: none;+ }+ svg .semantic-sigil > * { vector-effect: non-scaling-stroke; }+ svg .semantic-sigil .sigil-fill { fill: currentColor; stroke: none; }+ svg .s-frontend { color: var(--frontend-stroke); }+ svg .s-backend { color: var(--backend-stroke); }+ svg .s-database { color: var(--database-stroke); }+ svg .s-cloud { color: var(--cloud-stroke); }+ svg .s-security { color: var(--security-stroke); }+ svg .s-messagebus { color: var(--messagebus-stroke); }+ svg .s-external { color: var(--external-stroke); }+/* Reading Depth is a viewer-only level-of-detail layer. MAP preserves theauthored structure and primary labels, READ restores relationship labelsand node context, and FULL restores tags and fine annotations. Semantic@@ -3236,6 +3294,48 @@stroke-linecap: square;filter: none;}+ .semantic-flow-token {+ color: var(--frontend-stroke);+ opacity: 0;+ pointer-events: none;+ }+ .relationship-flow-token {+ animation: archify-relationship-token-life 1.2s linear 1 both;+ }+ .story-flow-token {+ animation: archify-relationship-token-life 0.78s linear 1 both;+ }+ .semantic-flow-token-halo {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.1;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ }+ .relationship-flow-token-shape {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-ink {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.05;+ stroke-linecap: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-dot { fill: currentColor; stroke: none; }+ .semantic-flow-token[data-token-kind="data"] { color: var(--database-stroke); }+ .semantic-flow-token[data-token-kind="event"] { color: var(--messagebus-stroke); }+ .semantic-flow-token[data-token-kind="security"] { color: var(--security-stroke); }+ .semantic-flow-token[data-token-kind="state"] { color: var(--cloud-stroke); }+ svg[data-preset="signal-flow"] .semantic-flow-token {+ filter: drop-shadow(0 0 5px currentColor);+ }+ svg[data-preset="blueprint"] .semantic-flow-token { filter: none; }html[data-embed="true"] .relationship-pulse-overlay { display: none; }/* Intent Trace is a temporary, pre-click exploration layer. Related@@ -3387,6 +3487,7 @@of the active guided view. The authored edge stays underneath with itsoriginal color, dash pattern, marker, and geometry intact. */.story-trail-overlay { pointer-events: none; }+ .story-carrier-overlay { pointer-events: none; }.story-trail-flow {fill: none;stroke: var(--frontend-stroke);@@ -3472,15 +3573,13 @@/* Optional trace animation, enabled only by meta.animation = "trace".The ordinary viewer performs one ambient pass and then restores the- authored solid/security/async line language. WebM uses the same finite- timeline on an isolated export clone. */- html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"],- svg[data-motion-export="true"] [data-animate="edge"] {+ authored solid/security/async line language. WebM samples the same+ authored geometry into an explicit canvas timeline. */+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"] {animation: archify-edge-flow 2.4s linear 1;animation-delay: calc(var(--step, 0) * 160ms);}- html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"],- svg[data-motion-export="true"] [data-animate="node"] {+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"] {transform-box: fill-box;transform-origin: center;animation: archify-node-pulse 3.6s ease-in-out 1;@@ -3569,6 +3668,11 @@10%, 76% { opacity: 0.98; }100% { opacity: 0; stroke-dashoffset: -1; }}+ @keyframes archify-relationship-token-life {+ 0%, 7% { opacity: 0; }+ 13%, 82% { opacity: 1; }+ 100% { opacity: 0; }+ }@keyframes archify-story-beat-node {from { opacity: 0.48; filter: saturate(0.6); }58% { opacity: 1; filter: drop-shadow(0 0 10px var(--frontend-stroke)); }@@ -3627,7 +3731,8 @@stroke-dashoffset: 0;opacity: 0.78;}- .route-journey-overlay { display: none !important; }+ .route-journey-overlay,+ .story-carrier-overlay { display: none !important; }.semantic-lens-flow {animation: none !important;stroke-dasharray: none;@@ -3642,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3653,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -3778,17 +3889,21 @@<path d="M 154 157 L 748 157" class="a-emphasis" stroke-width="2.2" marker-end="url(#arrowhead-emphasis)"/><!-- Transition paths -->- <path data-edge-from="executing" data-edge-to="approval" data-edge-key="0" data-edge-id="approval-needed" d="M 402 188 L 402 278" class="a-security" data-animate="edge" style="--step:0" stroke-width="1.1" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="reviewing" data-edge-to="blocked" data-edge-key="1" data-edge-id="review-blocked" d="M 556 188 L 556 233 L 556 233 L 556 278" class="a-default" data-animate="edge" style="--step:1" stroke-width="1.1" marker-end="url(#arrowhead)"/>- <path data-edge-from="executing" data-edge-to="failed" data-edge-key="2" data-edge-id="execution-failed" d="M 343 157 L 330 157 Q 320 157 320 167 L 320 332 Q 320 342 330 342 L 395 342 Q 402 342 402 349 L 402 356" class="a-security" data-animate="edge" style="--step:2" stroke-width="1.1" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="blocked" data-edge-to="expired" data-edge-key="3" data-edge-id="block-expired" d="M 556 336 L 556 450" class="a-security" data-animate="edge" style="--step:3" stroke-width="1.1" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="approval" data-edge-to="cancelled" data-edge-key="4" data-edge-id="approval-cancelled" d="M 402 336 L 470 336 Q 480 336 480 346 L 480 422 Q 480 432 470 432 L 411 432 Q 402 432 402 441 L 402 450" class="a-security" data-animate="edge" style="--step:4" stroke-width="1.1" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="executing" data-edge-to="approval" data-edge-key="0" data-edge-id="approval-needed" data-composition-points="402,188;402,278" d="M 402 188 L 402 278" class="a-security" data-animate="edge" style="--step:0" stroke-width="1.1" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="reviewing" data-edge-to="blocked" data-edge-key="1" data-edge-id="review-blocked" data-composition-points="556,188;556,233;556,233;556,278" d="M 556 188 L 556 233 L 556 233 L 556 278" class="a-default" data-animate="edge" style="--step:1" stroke-width="1.1" marker-end="url(#arrowhead)"/>+ <path data-edge-from="executing" data-edge-to="failed" data-edge-key="2" data-edge-id="execution-failed" data-composition-points="343,157;320,157;320,385;339,385" d="M 343 157 L 330 157 Q 320 157 320 167 L 320 375.5 Q 320 385 329.5 385 L 339 385" class="a-security" data-animate="edge" style="--step:2" stroke-width="1.1" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="blocked" data-edge-to="expired" data-edge-key="3" data-edge-id="block-expired" data-composition-points="556,336;556,450" d="M 556 336 L 556 450" class="a-security" data-animate="edge" style="--step:3" stroke-width="1.1" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="approval" data-edge-to="cancelled" data-edge-key="4" data-edge-id="approval-cancelled" data-composition-points="402,336;480,336;480,432;402,432;402,450" d="M 402 336 L 470 336 Q 480 336 480 346 L 480 422 Q 480 432 470 432 L 411 432 Q 402 432 402 441 L 402 450" class="a-security" data-animate="edge" style="--step:4" stroke-width="1.1" marker-end="url(#arrowhead-security)"/><!-- States --><g id="node-queued" data-node-id="queued" data-node-label="Queued" tabindex="0" role="button" aria-label="Focus Queued, request accepted, Lifecycle phases" aria-pressed="false" data-node-kind="start" data-node-sublabel="request accepted" data-node-tag="entry" data-node-context="Lifecycle phases"><title>Queued · request accepted · Lifecycle phases · entry</title><rect x="35" y="126" width="118" height="62" rx="7" class="c-mask"/><rect x="35" y="126" width="118" height="62" rx="7" class="c-frontend" data-animate="node" style="--step:0" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="start" class="semantic-sigil s-frontend" transform="translate(136 132) scale(0.6875)">+ <circle cx="8" cy="8" r="5"/>+ <path d="m7 5.4 3.6 2.6L7 10.6Z" class="sigil-fill"/>+ </g><text data-detail="fine" x="45" y="140" class="t-frontend" font-size="7" font-weight="700">01</text><text data-detail-anchor x="94" y="147" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Queued</text><text data-detail="context" x="94" y="163" class="t-muted" font-size="7" text-anchor="middle">request accepted</text>@@ -3799,6 +3914,9 @@<title>Planning · build task graph · Lifecycle phases · model</title><rect x="189" y="126" width="118" height="62" rx="7" class="c-mask"/><rect x="189" y="126" width="118" height="62" rx="7" class="c-backend" data-animate="node" style="--step:1" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="active" class="semantic-sigil s-backend" transform="translate(290 132) scale(0.6875)">+ <path d="M2 8h3l1.5-3.5L9 12l1.6-4H14"/>+ </g><text data-detail="fine" x="199" y="140" class="t-backend" font-size="7" font-weight="700">02</text><text data-detail-anchor x="248" y="147" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Planning</text><text data-detail="context" x="248" y="163" class="t-muted" font-size="7" text-anchor="middle">build task graph</text>@@ -3809,6 +3927,9 @@<title>Executing · tool calls · Lifecycle phases · work</title><rect x="343" y="126" width="118" height="62" rx="7" class="c-mask"/><rect x="343" y="126" width="118" height="62" rx="7" class="c-backend" data-animate="node" style="--step:0" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="active" class="semantic-sigil s-backend" transform="translate(444 132) scale(0.6875)">+ <path d="M2 8h3l1.5-3.5L9 12l1.6-4H14"/>+ </g><text data-detail="fine" x="353" y="140" class="t-backend" font-size="7" font-weight="700">03</text><text data-detail-anchor x="402" y="147" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Executing</text><text data-detail="context" x="402" y="163" class="t-muted" font-size="7" text-anchor="middle">tool calls</text>@@ -3819,6 +3940,10 @@<title>Reviewing · quality gate · Lifecycle phases · check</title><rect x="497" y="126" width="118" height="62" rx="7" class="c-mask"/><rect x="497" y="126" width="118" height="62" rx="7" class="c-security" data-animate="node" style="--step:1" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="neutral" class="semantic-sigil s-external" transform="translate(598 132) scale(0.6875)">+ <rect x="3" y="3" width="10" height="10" rx="2"/>+ <circle cx="8" cy="8" r="1.2" class="sigil-fill"/>+ </g><text data-detail="fine" x="507" y="140" class="t-security" font-size="7" font-weight="700">04</text><text data-detail-anchor x="556" y="147" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Reviewing</text><text data-detail="context" x="556" y="163" class="t-muted" font-size="7" text-anchor="middle">quality gate</text>@@ -3829,6 +3954,10 @@<title>Completed · final response · Lifecycle phases · done</title><rect x="651" y="126" width="118" height="62" rx="7" class="c-mask"/><rect x="651" y="126" width="118" height="62" rx="7" class="c-database" data-animate="node" style="--step:4" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="success" class="semantic-sigil s-database" transform="translate(752 132) scale(0.6875)">+ <circle cx="8" cy="8" r="5.3"/>+ <path d="m5.2 8 1.8 1.8 3.8-4"/>+ </g><text data-detail="fine" x="661" y="140" class="t-database" font-size="7" font-weight="700">05</text><text data-detail-anchor x="710" y="147" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Completed</text><text data-detail="context" x="710" y="163" class="t-muted" font-size="7" text-anchor="middle">final response</text>@@ -3839,6 +3968,9 @@<title>Needs Approval · human gate · Interruptions · pause</title><rect x="339" y="278" width="126" height="58" rx="7" class="c-mask"/><rect x="339" y="278" width="126" height="58" rx="7" class="c-cloud" data-animate="node" style="--step:1" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="waiting" class="semantic-sigil s-cloud" transform="translate(448 284) scale(0.6875)">+ <path d="M4 2.5h8M4 13.5h8M5 3c0 2.8 2 3.2 3 5-1 1.8-3 2.2-3 5M11 3c0 2.8-2 3.2-3 5 1 1.8 3 2.2 3 5"/>+ </g><text data-detail-anchor x="402" y="299" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Needs Approval</text><text data-detail="context" x="402" y="315" class="t-muted" font-size="7" text-anchor="middle">human gate</text><text data-detail="fine" x="402" y="325" class="t-cloud" font-size="7" text-anchor="middle">pause</text>@@ -3848,6 +3980,9 @@<title>Blocked · missing input · Interruptions · wait</title><rect x="493" y="278" width="126" height="58" rx="7" class="c-mask"/><rect x="493" y="278" width="126" height="58" rx="7" class="c-cloud" data-animate="node" style="--step:2" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="waiting" class="semantic-sigil s-cloud" transform="translate(602 284) scale(0.6875)">+ <path d="M4 2.5h8M4 13.5h8M5 3c0 2.8 2 3.2 3 5-1 1.8-3 2.2-3 5M11 3c0 2.8-2 3.2-3 5 1 1.8 3 2.2 3 5"/>+ </g><text data-detail-anchor x="556" y="299" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Blocked</text><text data-detail="context" x="556" y="315" class="t-muted" font-size="7" text-anchor="middle">missing input</text><text data-detail="fine" x="556" y="325" class="t-cloud" font-size="7" text-anchor="middle">wait</text>@@ -3857,6 +3992,10 @@<title>Failed · recoverable error · Recovery loop · retryable</title><rect x="339" y="356" width="126" height="58" rx="7" class="c-mask"/><rect x="339" y="356" width="126" height="58" rx="7" class="c-security" data-animate="node" style="--step:3" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="failure" class="semantic-sigil s-security" transform="translate(448 362) scale(0.6875)">+ <circle cx="8" cy="8" r="5.3"/>+ <path d="m5.7 5.7 4.6 4.6m0-4.6-4.6 4.6"/>+ </g><text data-detail-anchor x="402" y="377" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Failed</text><text data-detail="context" x="402" y="393" class="t-muted" font-size="7" text-anchor="middle">recoverable error</text><text data-detail="fine" x="402" y="403" class="t-security" font-size="7" text-anchor="middle">retryable</text>@@ -3866,6 +4005,10 @@<title>Cancelled · user stopped · Terminal exits · terminal</title><rect x="343" y="450" width="118" height="58" rx="7" class="c-mask"/><rect x="343" y="450" width="118" height="58" rx="7" class="c-security" data-animate="node" style="--step:5" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="failure" class="semantic-sigil s-security" transform="translate(444 456) scale(0.6875)">+ <circle cx="8" cy="8" r="5.3"/>+ <path d="m5.7 5.7 4.6 4.6m0-4.6-4.6 4.6"/>+ </g><text data-detail-anchor x="402" y="471" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Cancelled</text><text data-detail="context" x="402" y="487" class="t-muted" font-size="7" text-anchor="middle">user stopped</text><text data-detail="fine" x="402" y="497" class="t-security" font-size="7" text-anchor="middle">terminal</text>@@ -3875,6 +4018,10 @@<title>Expired · timeout · Terminal exits · terminal</title><rect x="497" y="450" width="118" height="58" rx="7" class="c-mask"/><rect x="497" y="450" width="118" height="58" rx="7" class="c-security" data-animate="node" style="--step:4" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="failure" class="semantic-sigil s-security" transform="translate(598 456) scale(0.6875)">+ <circle cx="8" cy="8" r="5.3"/>+ <path d="m5.7 5.7 4.6 4.6m0-4.6-4.6 4.6"/>+ </g><text data-detail-anchor x="556" y="471" class="t-primary" font-size="10" font-weight="600" text-anchor="middle">Expired</text><text data-detail="context" x="556" y="487" class="t-muted" font-size="7" text-anchor="middle">timeout</text><text data-detail="fine" x="556" y="497" class="t-security" font-size="7" text-anchor="middle">terminal</text>@@ -3963,7 +4110,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4110,15 +4257,59 @@<!-- Footer --><p class="footer">- Lifecycle diagram • Built with Archify<span class="no-print"> • Hover to trace • <kbd>R</kbd> route • Click to focus • <kbd>+</kbd>/<kbd>−</kbd> zoom • <kbd>M</kbd> radar • <kbd>[</kbd>/<kbd>]</kbd> views • <kbd>P</kbd> play story • <kbd>T</kbd> theme • <kbd>E</kbd> export</span>+ Lifecycle diagram • Built with Archify<span class="no-print"> • <a class="artifact-start-link" href="https://tt-a1i.github.io/archify/start.html?type=lifecycle" target="_blank" rel="noopener noreferrer">Create yours ↗</a> • Hover to trace • <kbd>R</kbd> route • Click to focus • <kbd>+</kbd>/<kbd>−</kbd> zoom • <kbd>M</kbd> radar • <kbd>[</kbd>/<kbd>]</kbd> views • <kbd>P</kbd> play story • <kbd>T</kbd> theme • <kbd>E</kbd> export</span></p></div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -4234,12 +4425,8 @@scale = scale || 1;opts = opts || {};var autoTheme = opts.autoTheme === true;- var motionExport = opts.motion === true;-var svg = document.querySelector('.diagram-container svg');var clone = svg.cloneNode(true);- if (motionExport) clone.setAttribute('data-motion-export', 'true');- else clone.removeAttribute('data-motion-export');// View transforms and neighborhood focus are HTML exploration state,// never part of a downloaded full-diagram artifact.@@ -4274,7 +4461,7 @@Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-preview-role]'), function (el) {el.removeAttribute('data-chapter-preview-role');});- Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay]'), function (el) {+ Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay]'), function (el) {el.remove();});Array.prototype.forEach.call(clone.querySelectorAll('[data-intent-trace-overlay]'), function (el) {@@ -4384,7 +4571,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;// Scale width/height so the browser rasterizes the vectors at target@@ -4610,9 +4797,11 @@}// Record the live CSS animation without Puppeteer, ffmpeg, or a network- // dependency. The serialized SVG keeps Archify's animation keyframes;- // one Image instance advances its timeline while each frame is painted- // into a MediaRecorder-backed canvas.+ // dependency. SVG files loaded through Image are commonly rasterized as+ // one cached bitmap, so repeatedly drawing that Image does not reliably+ // advance its CSS animation. Keep one crisp static SVG background, then+ // render an explicit time-varying signal scene over the real authored+ // relationship geometry on every captured canvas frame.function recordWebm(options) {options = options || {};if (!canRecordMotion()) {@@ -4623,12 +4812,161 @@var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var scale = Math.min(1, 1280 / vb.width);- var data = serializeSvg(scale, { motion: true });+ var data = serializeSvg(scale);var sourceUrl = URL.createObjectURL(new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' }));+ function createMotionScene(root) {+ var rootMatrix = root.getCTM ? root.getCTM() : null;++ function pointInRoot(element, point) {+ if (!rootMatrix || !element.getCTM || !point.matrixTransform) return { x: point.x, y: point.y };+ try {+ var elementMatrix = element.getCTM();+ if (!elementMatrix) return { x: point.x, y: point.y };+ var mapped = point.matrixTransform(rootMatrix.inverse().multiply(elementMatrix));+ return { x: mapped.x, y: mapped.y };+ } catch (_) {+ return { x: point.x, y: point.y };+ }+ }++ function samplesFor(element) {+ if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];+ var length;+ try { length = element.getTotalLength(); } catch (_) { return []; }+ if (!Number.isFinite(length) || length <= 0) return [];+ var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));+ var points = [];+ for (var i = 0; i <= count; i++) {+ points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));+ }+ return points;+ }++ function authoredStep(element, fallback) {+ var raw = element.style.getPropertyValue('--step') || getComputedStyle(element).getPropertyValue('--step');+ var value = Number(raw);+ return Number.isFinite(value) ? value : fallback;+ }++ var edges = Array.prototype.slice.call(root.querySelectorAll('[data-animate="edge"]')).map(function (element, index) {+ var computed = getComputedStyle(element);+ return {+ points: samplesFor(element),+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ width: Math.max(1.5, parseFloat(computed.strokeWidth) || 1.5),+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(function (edge) { return edge.points.length > 1; });++ var nodes = Array.prototype.slice.call(root.querySelectorAll('[data-node-id][data-animate="node"]')).map(function (element, index) {+ var box;+ try { box = element.getBBox(); } catch (_) { return null; }+ var painted = element.querySelector('[class*="c-"]') || element;+ var computed = getComputedStyle(painted);+ return {+ x: box.x,+ y: box.y,+ width: box.width,+ height: box.height,+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(Boolean);++ return { edges: edges, nodes: nodes, x: vb.x, y: vb.y, width: vb.width, height: vb.height };+ }++ function pointAlong(points, progress) {+ var scaled = Math.max(0, Math.min(1, progress)) * (points.length - 1);+ var index = Math.min(points.length - 2, Math.floor(scaled));+ var mix = scaled - index;+ return {+ x: points[index].x + (points[index + 1].x - points[index].x) * mix,+ y: points[index].y + (points[index + 1].y - points[index].y) * mix+ };+ }++ function roundedRectPath(ctx, x, y, width, height, radius) {+ var r = Math.max(0, Math.min(radius, width / 2, height / 2));+ ctx.beginPath();+ ctx.moveTo(x + r, y);+ ctx.lineTo(x + width - r, y);+ ctx.quadraticCurveTo(x + width, y, x + width, y + r);+ ctx.lineTo(x + width, y + height - r);+ ctx.quadraticCurveTo(x + width, y + height, x + width - r, y + height);+ ctx.lineTo(x + r, y + height);+ ctx.quadraticCurveTo(x, y + height, x, y + height - r);+ ctx.lineTo(x, y + r);+ ctx.quadraticCurveTo(x, y, x + r, y);+ ctx.closePath();+ }++ function drawMotionFrame(ctx, backgroundImage, motionScene, elapsed) {+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.drawImage(backgroundImage, 0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.save();+ ctx.scale(ctx.canvas.width / motionScene.width, ctx.canvas.height / motionScene.height);+ ctx.translate(-motionScene.x, -motionScene.y);++ motionScene.edges.forEach(function (edge) {+ var duration = 1.75;+ var progress = (elapsed - edge.delay) / duration;+ if (progress < 0 || progress > 1) return;+ var head = Math.max(0, Math.min(1, progress));+ var tail = Math.max(0, head - 0.24);+ var opacity = Math.sin(Math.PI * Math.min(1, progress));++ ctx.save();+ ctx.strokeStyle = edge.color;+ ctx.fillStyle = edge.color;+ ctx.lineCap = 'round';+ ctx.lineJoin = 'round';+ ctx.lineWidth = Math.max(3.2, edge.width * 2.2);+ ctx.globalAlpha = 0.42 + opacity * 0.5;+ ctx.shadowColor = edge.color;+ ctx.shadowBlur = 10;+ ctx.beginPath();+ for (var i = 0; i <= 14; i++) {+ var trailPoint = pointAlong(edge.points, tail + (head - tail) * i / 14);+ if (i === 0) ctx.moveTo(trailPoint.x, trailPoint.y);+ else ctx.lineTo(trailPoint.x, trailPoint.y);+ }+ ctx.stroke();++ var point = pointAlong(edge.points, head);+ ctx.globalAlpha = 0.95;+ ctx.beginPath();+ ctx.arc(point.x, point.y, 4.8, 0, Math.PI * 2);+ ctx.fill();+ ctx.restore();+ });++ motionScene.nodes.forEach(function (node) {+ var progress = (elapsed - node.delay) / 2.6;+ if (progress < 0 || progress > 1) return;+ var pulse = Math.sin(Math.PI * progress);+ if (pulse <= 0.02) return;+ ctx.save();+ ctx.strokeStyle = node.color;+ ctx.lineWidth = 1.4 + pulse * 1.8;+ ctx.globalAlpha = pulse * 0.5;+ ctx.shadowColor = node.color;+ ctx.shadowBlur = 12 * pulse;+ var inset = 2 + pulse * 3;+ roundedRectPath(ctx, node.x - inset, node.y - inset, node.width + inset * 2, node.height + inset * 2, 8);+ ctx.stroke();+ ctx.restore();+ });++ ctx.restore();+ }++ var motionScene = createMotionScene(svg);+return new Promise(function (resolve, reject) {- var img = new Image();- img.onload = function () {+ var backgroundImage = new Image();+ backgroundImage.onload = function () {var canvas = document.createElement('canvas');canvas.width = Math.max(2, Math.round(data.width / 2) * 2);canvas.height = Math.max(2, Math.round(data.height / 2) * 2);@@ -4647,6 +4985,7 @@var chunks = [];var raf = 0;var stopped = false;+ var startedAt = performance.now();function cleanup() {if (stopped) return;stopped = true;@@ -4654,9 +4993,9 @@URL.revokeObjectURL(sourceUrl);stream.getTracks().forEach(function (track) { track.stop(); });}- function draw() {- ctx.clearRect(0, 0, canvas.width, canvas.height);- ctx.drawImage(img, 0, 0, canvas.width, canvas.height);+ function draw(now) {+ var elapsed = Math.max(0, ((Number(now) || performance.now()) - startedAt) / 1000);+ drawMotionFrame(ctx, backgroundImage, motionScene, elapsed);raf = requestAnimationFrame(draw);}recorder.ondataavailable = function (event) {@@ -4672,8 +5011,10 @@if (!blob.size) reject(new Error('MediaRecorder produced an empty WebM'));else resolve(blob);};- draw();+ drawMotionFrame(ctx, backgroundImage, motionScene, 0);recorder.start(250);+ startedAt = performance.now();+ raf = requestAnimationFrame(draw);setTimeout(function () {if (recorder.state === 'inactive') return;// Chromium normally emits the final chunk during stop(), but@@ -4686,11 +5027,11 @@}, 120);}, duration);};- img.onerror = function () {+ backgroundImage.onerror = function () {URL.revokeObjectURL(sourceUrl);- reject(new Error('Animated SVG could not be loaded for WebM export'));+ reject(new Error('SVG background could not be loaded for WebM export'));};- img.src = sourceUrl;+ backgroundImage.src = sourceUrl;});}@@ -5400,6 +5741,99 @@clone.setAttribute('pathLength', '1');return clone;}+ function relationshipTokenKind(edge) {+ var shapes = relationshipEdgeShapes(edge);+ var classEvidence = [edge.getAttribute('class') || ''].concat(shapes.map(function (shape) {+ return shape.getAttribute('class') || '';+ })).join(' ');+ var from = edge.getAttribute('data-edge-from') || '';+ var to = edge.getAttribute('data-edge-to') || '';+ var source = nodes().find(function (node) { return node.getAttribute('data-node-id') === from; });+ var target = nodes().find(function (node) { return node.getAttribute('data-node-id') === to; });+ var sourceKind = source ? source.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ var targetKind = target ? target.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ if (/\ba-security\b/.test(classEvidence) || sourceKind === 'security' || targetKind === 'security' || targetKind === 'failure') return 'security';+ if (/\ba-dashed\b/.test(classEvidence) || sourceKind === 'messagebus' || targetKind === 'messagebus') return 'event';+ if (sourceKind === 'database' || targetKind === 'database') return 'data';+ if (targetKind === 'waiting' || targetKind === 'success') return 'state';+ return 'call';+ }+ function relationshipTokenPath(shape) {+ if (!shape) return '';+ var tagName = String(shape.tagName || '').toLowerCase();+ if (tagName === 'path') return shape.getAttribute('d') || '';+ if (tagName === 'line') {+ return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') ++ ' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');+ }+ if (tagName === 'polyline' && shape.points && shape.points.numberOfItems > 1) {+ var commands = [];+ for (var i = 0; i < shape.points.numberOfItems; i += 1) {+ var point = shape.points.getItem(i);+ commands.push((i === 0 ? 'M ' : 'L ') + point.x + ' ' + point.y);+ }+ return commands.join(' ');+ }+ return '';+ }+ function relationshipTokenPart(tagName, className, attrs) {+ var part = document.createElementNS(svgNamespace, tagName);+ part.setAttribute('class', className);+ Object.keys(attrs || {}).forEach(function (name) { part.setAttribute(name, attrs[name]); });+ return part;+ }+ function relationshipTokenGeometry(shape, kind, key, options) {+ options = options || {};+ var pathData = relationshipTokenPath(shape);+ if (!pathData) return null;+ var token = document.createElementNS(svgNamespace, 'g');+ token.setAttribute('class', 'semantic-flow-token ' + (options.className || 'relationship-flow-token'));+ token.setAttribute('data-token-kind', kind);+ token.setAttribute('data-token-edge-key', key);+ token.setAttribute('aria-hidden', 'true');+ token.appendChild(relationshipTokenPart('circle', 'semantic-flow-token-halo', { cx: '0', cy: '0', r: '7' }));+ if (kind === 'data') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-5', y: '-4', width: '10', height: '8', rx: '2' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -2.8 -1.2 h 5.6 M -2.8 1.4 h 3.8' }));+ } else if (kind === 'event') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-7', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-2', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '3', y: '-3', width: '4', height: '6', rx: '1' }));+ } else if (kind === 'security') {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-shape', { d: 'M 0 -5 L 4 -3.4 V 0 c 0 3 -1.6 4.5 -4 5.5 C -2.4 4.5 -4 3 -4 0 v -3.4 Z' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'm -2 .2 1.4 1.4 L 2 -1.4' }));+ } else if (kind === 'state') {+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-shape', { cx: '0', cy: '0', r: '5' }));+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-dot', { cx: '0', cy: '0', r: '1.35' }));+ } else {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -5 -3 L -1 0 L -5 3 M 0 -3 L 4 0 L 0 3' }));+ }+ var motion = document.createElementNS(svgNamespace, 'animateMotion');+ motion.setAttribute('path', pathData);+ motion.setAttribute('dur', options.duration || '1.2s');+ motion.setAttribute('begin', '0s');+ motion.setAttribute('fill', 'freeze');+ motion.setAttribute('rotate', 'auto');+ motion.setAttribute('calcMode', 'spline');+ motion.setAttribute('keyTimes', '0;1');+ motion.setAttribute('keySplines', '.2 0 .2 1');+ token.appendChild(motion);+ return token;+ }+ function createSemanticFlowToken(edge, shape, options) {+ if (!edge || !shape) return null;+ var key = edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ return relationshipTokenGeometry(shape, relationshipTokenKind(edge), key, options);+ }+ Archify.flowTokens = {+ create: createSemanticFlowToken,+ kind: function (edge) { return relationshipTokenKind(edge); },+ path: relationshipTokenPath+ };function renderRelationshipPulse(key) {removeRelationshipPulse();if (!key || document.documentElement.getAttribute('data-embed') === 'true') return false;@@ -5414,12 +5848,23 @@overlay.setAttribute('data-relationship-pulse-overlay', '');overlay.setAttribute('data-relationship-pulse-key', key);overlay.setAttribute('aria-hidden', 'true');+ var tokenAdded = false;matchingEdges.forEach(function (edge) {var wrapper = document.createElementNS(svgNamespace, 'g');if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));- relationshipEdgeShapes(edge).forEach(function (shape) {+ var shapes = relationshipEdgeShapes(edge);+ shapes.forEach(function (shape) {wrapper.appendChild(relationshipPulseGeometry(shape));});+ if (!tokenAdded && shapes.length) {+ var tokenKind = relationshipTokenKind(edge);+ var token = relationshipTokenGeometry(shapes[0], tokenKind, key);+ if (token) {+ wrapper.appendChild(token);+ overlay.setAttribute('data-relationship-token-kind', tokenKind);+ tokenAdded = true;+ }+ }if (wrapper.childNodes.length) overlay.appendChild(wrapper);});if (!overlay.childNodes.length) return false;@@ -6341,6 +6786,7 @@var momentRestoreGeneration = 0;var storySteps = [];var storyPulseOwnerToken = 0;+ var storyPulseGeneration = 0;var autoplayPending = false;var VIEW_INTERVAL_MS = 3200;var STORY_FOLLOW_MIN_DWELL_MS = 1100;@@ -6866,6 +7312,22 @@);}+ function uniqueStoryEdges(edgeList) {+ var positions = {};+ var unique = [];+ edgeList.forEach(function (edge) {+ var key = storyEdgeKey(edge);+ if (!Object.prototype.hasOwnProperty.call(positions, key)) {+ positions[key] = unique.length;+ unique.push(edge);+ return;+ }+ var index = positions[key];+ if (!storyGeometry(unique[index]).length && storyGeometry(edge).length) unique[index] = edge;+ });+ return unique;+ }+function storyStep(view, index, edgeList, byId) {var id = view.focus[index];var node = byId[id];@@ -6880,6 +7342,8 @@else if (from === id && to === previousId) reverse.push(edge);});}+ forward = uniqueStoryEdges(forward);+ reverse = uniqueStoryEdges(reverse);var edges = forward.concat(reverse).sort(function (left, right) {return edgeList.indexOf(left) - edgeList.indexOf(right);});@@ -7050,7 +7514,8 @@function storyMotionAllowed() {if (document.hidden || reducedMotion()) return false;if (document.documentElement.getAttribute('data-motion') !== 'live') return false;- if (document.documentElement.getAttribute('data-embed') === 'true') return false;+ if (document.documentElement.getAttribute('data-embed') === 'true' &&+ document.documentElement.getAttribute('data-share-playback') !== 'true') return false;if (window.matchMedia && window.matchMedia('print').matches) return false;return !(Archify.motionGovernor && Archify.motionGovernor.isPaused());}@@ -7064,9 +7529,13 @@function clearStoryPulse(options) {options = options || {};+ storyPulseGeneration += 1;Array.prototype.forEach.call(svg.querySelectorAll('.story-trail-flow[data-story-pulse]'), function (flow) {flow.removeAttribute('data-story-pulse');});+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-carrier-overlay]'), function (overlay) {+ overlay.remove();+ });if (storyPulseOwnerToken && options.release !== false && Archify.motionGovernor) {var token = storyPulseOwnerToken;storyPulseOwnerToken = 0;@@ -7079,14 +7548,41 @@if (!step || (step.relation !== 'forward' && step.relation !== 'reverse') || step.edges.length !== 1 || !storyMotionAllowed()) return false;var flows = Array.prototype.slice.call(svg.querySelectorAll('.story-trail-flow[data-story-beat-step="' + step.index + '"]'));if (!flows.length) return false;+ var pulseGeneration = storyPulseGeneration;if (Archify.motionGovernor && Archify.motionGovernor.capable) {storyPulseOwnerToken = Archify.motionGovernor.claim('story', function () {clearStoryPulse({ release: false });});}flows.forEach(function (flow) { flow.setAttribute('data-story-pulse', 'true'); });+ if (Archify.flowTokens && typeof Archify.flowTokens.create === 'function') {+ var edge = step.edges[0];+ var shapes = storyGeometry(edge);+ var carrier = shapes.length ? Archify.flowTokens.create(edge, shapes[0], {+ className: 'story-flow-token',+ duration: '0.78s'+ }) : null;+ if (carrier) {+ var carrierOverlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ var carrierWrapper = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ carrierOverlay.setAttribute('class', 'story-carrier-overlay');+ carrierOverlay.setAttribute('data-story-carrier-overlay', '');+ carrierOverlay.setAttribute('aria-hidden', 'true');+ if (edge.hasAttribute('transform')) carrierWrapper.setAttribute('transform', edge.getAttribute('transform'));+ carrier.setAttribute('data-story-carrier-token', '');+ carrier.setAttribute('data-story-beat-step', String(step.index));+ carrierWrapper.appendChild(carrier);+ carrierOverlay.appendChild(carrierWrapper);+ var firstNode = svg.querySelector('[data-node-id]');+ while (firstNode && firstNode.parentNode !== svg) firstNode = firstNode.parentNode;+ if (firstNode) svg.insertBefore(carrierOverlay, firstNode);+ else svg.appendChild(carrierOverlay);+ }+ }void flows[0].getBoundingClientRect();- flows[0].addEventListener('animationend', function () { clearStoryPulse(); }, { once: true });+ flows[0].addEventListener('animationend', function () {+ if (pulseGeneration === storyPulseGeneration) clearStoryPulse();+ }, { once: true });return true;}@@ -10704,6 +11200,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -10719,6 +11216,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -10785,9 +11283,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -10811,6 +11310,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/archify/examples/sequence-cache-miss-request.html b/archify/examples/sequence-cache-miss-request.htmlindex 844ea824..e47ebef4 100644--- a/archify/examples/sequence-cache-miss-request.html+++ b/archify/examples/sequence-cache-miss-request.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -708,7 +708,9 @@}html[data-motion="still"] .route-journey-overlay,html[data-document-hidden="true"] .route-journey-overlay { display: none !important; }- html[data-motion="still"] .relationship-pulse-overlay { display: none !important; }+ html[data-motion="still"] .relationship-pulse-overlay,+ html[data-motion="still"] .story-carrier-overlay,+ html[data-document-hidden="true"] .story-carrier-overlay { display: none !important; }html[data-motion="still"] .chapter-handoff-overlay { display: none !important; }html[data-motion="still"] .chapter-handoff-anchor { animation: none !important; }html[data-motion="still"] .guided-view-chapter,@@ -2400,6 +2402,19 @@font-size: 0.75rem;}+ .footer .artifact-start-link {+ color: var(--text-faint);+ text-decoration-color: color-mix(in srgb, var(--frontend-stroke) 48%, transparent);+ text-underline-offset: 0.22em;+ transition: color 0.15s ease, text-decoration-color 0.15s ease;+ }++ .footer .artifact-start-link:hover,+ .footer .artifact-start-link:focus-visible {+ color: var(--frontend-stroke);+ text-decoration-color: currentColor;+ }+/* ==========================================================Print stylesheet — hide interactive controls, force light,drop the grid so the diagram doesn't waste ink, use landscape@@ -2472,7 +2487,8 @@.relationship-hit-overlay { display: none !important; }.relationship-pulse-overlay { display: none !important; }.route-probe-overlay, .route-journey-overlay { display: none !important; }- .story-trail-overlay { display: none !important; }+ .story-trail-overlay,+ .story-carrier-overlay { display: none !important; }.diagram-container svg[data-focus-active] [data-node-id],.diagram-container svg[data-focus-active] [data-edge-from],.diagram-container svg[data-story-beat] [data-story-step],@@ -2525,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2923,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -2953,6 +2989,28 @@.t-messagebus { fill: var(--messagebus-stroke); }.t-external { fill: var(--external-stroke); }+ /* Semantic Sigils are small authored role stamps, not icons from a brand+ pack and not viewer controls. Prefix selectors with svg so the canonical+ export's SVG-only stylesheet collector keeps them automatically. */+ svg .semantic-sigil {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ opacity: 0.76;+ pointer-events: none;+ }+ svg .semantic-sigil > * { vector-effect: non-scaling-stroke; }+ svg .semantic-sigil .sigil-fill { fill: currentColor; stroke: none; }+ svg .s-frontend { color: var(--frontend-stroke); }+ svg .s-backend { color: var(--backend-stroke); }+ svg .s-database { color: var(--database-stroke); }+ svg .s-cloud { color: var(--cloud-stroke); }+ svg .s-security { color: var(--security-stroke); }+ svg .s-messagebus { color: var(--messagebus-stroke); }+ svg .s-external { color: var(--external-stroke); }+/* Reading Depth is a viewer-only level-of-detail layer. MAP preserves theauthored structure and primary labels, READ restores relationship labelsand node context, and FULL restores tags and fine annotations. Semantic@@ -3236,6 +3294,48 @@stroke-linecap: square;filter: none;}+ .semantic-flow-token {+ color: var(--frontend-stroke);+ opacity: 0;+ pointer-events: none;+ }+ .relationship-flow-token {+ animation: archify-relationship-token-life 1.2s linear 1 both;+ }+ .story-flow-token {+ animation: archify-relationship-token-life 0.78s linear 1 both;+ }+ .semantic-flow-token-halo {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.1;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ }+ .relationship-flow-token-shape {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-ink {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.05;+ stroke-linecap: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-dot { fill: currentColor; stroke: none; }+ .semantic-flow-token[data-token-kind="data"] { color: var(--database-stroke); }+ .semantic-flow-token[data-token-kind="event"] { color: var(--messagebus-stroke); }+ .semantic-flow-token[data-token-kind="security"] { color: var(--security-stroke); }+ .semantic-flow-token[data-token-kind="state"] { color: var(--cloud-stroke); }+ svg[data-preset="signal-flow"] .semantic-flow-token {+ filter: drop-shadow(0 0 5px currentColor);+ }+ svg[data-preset="blueprint"] .semantic-flow-token { filter: none; }html[data-embed="true"] .relationship-pulse-overlay { display: none; }/* Intent Trace is a temporary, pre-click exploration layer. Related@@ -3387,6 +3487,7 @@of the active guided view. The authored edge stays underneath with itsoriginal color, dash pattern, marker, and geometry intact. */.story-trail-overlay { pointer-events: none; }+ .story-carrier-overlay { pointer-events: none; }.story-trail-flow {fill: none;stroke: var(--frontend-stroke);@@ -3472,15 +3573,13 @@/* Optional trace animation, enabled only by meta.animation = "trace".The ordinary viewer performs one ambient pass and then restores the- authored solid/security/async line language. WebM uses the same finite- timeline on an isolated export clone. */- html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"],- svg[data-motion-export="true"] [data-animate="edge"] {+ authored solid/security/async line language. WebM samples the same+ authored geometry into an explicit canvas timeline. */+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"] {animation: archify-edge-flow 2.4s linear 1;animation-delay: calc(var(--step, 0) * 160ms);}- html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"],- svg[data-motion-export="true"] [data-animate="node"] {+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"] {transform-box: fill-box;transform-origin: center;animation: archify-node-pulse 3.6s ease-in-out 1;@@ -3569,6 +3668,11 @@10%, 76% { opacity: 0.98; }100% { opacity: 0; stroke-dashoffset: -1; }}+ @keyframes archify-relationship-token-life {+ 0%, 7% { opacity: 0; }+ 13%, 82% { opacity: 1; }+ 100% { opacity: 0; }+ }@keyframes archify-story-beat-node {from { opacity: 0.48; filter: saturate(0.6); }58% { opacity: 1; filter: drop-shadow(0 0 10px var(--frontend-stroke)); }@@ -3627,7 +3731,8 @@stroke-dashoffset: 0;opacity: 0.78;}- .route-journey-overlay { display: none !important; }+ .route-journey-overlay,+ .story-carrier-overlay { display: none !important; }.semantic-lens-flow {animation: none !important;stroke-dasharray: none;@@ -3642,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3653,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -3767,13 +3878,13 @@<rect width="100%" height="100%" fill="url(#grid)" /><!-- Time Segments -->- <rect x="48" y="150" width="724" height="145" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="segment" data-composition-frame-id="0" x="48" y="150" width="724" height="145" rx="10" class="c-lane" stroke-width="1"/><text x="62" y="168" class="t-dim" font-size="9" font-weight="600">Request</text>- <rect x="48" y="315" width="724" height="190" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="segment" data-composition-frame-id="1" x="48" y="315" width="724" height="190" rx="10" class="c-lane" stroke-width="1"/><text x="62" y="333" class="t-dim" font-size="9" font-weight="600">Fallback</text>- <rect x="48" y="525" width="724" height="140" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="segment" data-composition-frame-id="2" x="48" y="525" width="724" height="140" rx="10" class="c-lane" stroke-width="1"/><text x="62" y="543" class="t-dim" font-size="9" font-weight="600">Response + trace</text><!-- Lifelines -->@@ -3787,7 +3898,7 @@<!-- Messages --><g data-edge-from="user" data-edge-to="web" data-edge-label="open page" data-edge-key="0" data-edge-id="open-page">- <path d="M 69 185 L 163 185" class="a-default" data-animate="edge" style="--step:0" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-composition-edge-from="user" data-composition-edge-to="web" data-composition-edge-id="open-page" data-composition-points="69,185;163,185" d="M 69 185 L 163 185" class="a-default" data-animate="edge" style="--step:0" stroke-width="1.4" marker-end="url(#arrowhead)"/><g data-detail="context"><rect x="86.6" y="165" width="58.800000000000004" height="16" rx="3" class="c-mask"/><text x="116" y="175" class="t-backend" font-size="9" text-anchor="middle">open page</text>@@ -3795,7 +3906,7 @@</g><g data-edge-from="web" data-edge-to="api" data-edge-label="GET /dashboard" data-edge-key="1" data-edge-id="dashboard-request">- <path d="M 177 228 L 271 228" class="a-emphasis" data-animate="edge" style="--step:1" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-composition-edge-from="web" data-composition-edge-to="api" data-composition-edge-id="dashboard-request" data-composition-points="177,228;271,228" d="M 177 228 L 271 228" class="a-emphasis" data-animate="edge" style="--step:1" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/><g data-detail="context"><rect x="181.6" y="208" width="84.8" height="16" rx="3" class="c-mask"/><text x="224" y="218" class="t-backend" font-size="9" text-anchor="middle">GET /dashboard</text>@@ -3803,7 +3914,7 @@</g><g data-edge-from="api" data-edge-to="auth" data-edge-label="verify JWT" data-edge-key="2" data-edge-id="verify-jwt">- <path d="M 285 270 L 379 270" class="a-security" data-animate="edge" style="--step:2" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-composition-edge-from="api" data-composition-edge-to="auth" data-composition-edge-id="verify-jwt" data-composition-points="285,270;379,270" d="M 285 270 L 379 270" class="a-security" data-animate="edge" style="--step:2" stroke-width="1.4" marker-end="url(#arrowhead-security)"/><g data-detail="context"><rect x="300" y="250" width="64" height="16" rx="3" class="c-mask"/><text x="332" y="260" class="t-security" font-size="9" text-anchor="middle">verify JWT</text>@@ -3811,7 +3922,7 @@</g><g data-edge-from="auth" data-edge-to="api" data-edge-label="claims ok" data-edge-key="3" data-edge-id="auth-claims">- <path d="M 379 305 L 285 305" class="a-default" data-animate="edge" style="--step:3" stroke-width="1.4" stroke-dasharray="3,5" marker-end="url(#arrowhead)"/>+ <path data-composition-edge-from="auth" data-composition-edge-to="api" data-composition-edge-id="auth-claims" data-composition-points="379,305;285,305" d="M 379 305 L 285 305" class="a-default" data-animate="edge" style="--step:3" stroke-width="1.4" stroke-dasharray="3,5" marker-end="url(#arrowhead)"/><g data-detail="context"><rect x="302.6" y="285" width="58.800000000000004" height="16" rx="3" class="c-mask"/><text x="332" y="295" class="t-muted" font-size="9" text-anchor="middle">claims ok</text>@@ -3819,7 +3930,7 @@</g><g data-edge-from="api" data-edge-to="redis" data-edge-label="read cache" data-edge-key="4" data-edge-id="cache-read">- <path d="M 285 354 L 487 354" class="a-default" data-animate="edge" style="--step:4" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-composition-edge-from="api" data-composition-edge-to="redis" data-composition-edge-id="cache-read" data-composition-points="285,354;487,354" d="M 285 354 L 487 354" class="a-default" data-animate="edge" style="--step:4" stroke-width="1.4" marker-end="url(#arrowhead)"/><g data-detail="context"><rect x="354" y="334" width="64" height="16" rx="3" class="c-mask"/><text x="386" y="344" class="t-backend" font-size="9" text-anchor="middle">read cache</text>@@ -3827,7 +3938,7 @@</g><g data-edge-from="redis" data-edge-to="api" data-edge-label="miss" data-edge-key="5" data-edge-id="cache-miss">- <path d="M 487 391 L 285 391" class="a-default" data-animate="edge" style="--step:5" stroke-width="1.4" stroke-dasharray="3,5" marker-end="url(#arrowhead)"/>+ <path data-composition-edge-from="redis" data-composition-edge-to="api" data-composition-edge-id="cache-miss" data-composition-points="487,391;285,391" d="M 487 391 L 285 391" class="a-default" data-animate="edge" style="--step:5" stroke-width="1.4" stroke-dasharray="3,5" marker-end="url(#arrowhead)"/><g data-detail="context"><rect x="369" y="371" width="34" height="16" rx="3" class="c-mask"/><text x="386" y="381" class="t-muted" font-size="9" text-anchor="middle">miss</text>@@ -3835,7 +3946,7 @@</g><g data-edge-from="api" data-edge-to="db" data-edge-label="query profile + metrics" data-edge-key="6" data-edge-id="profile-query">- <path d="M 285 443 L 595 443" class="a-emphasis" data-animate="edge" style="--step:6" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-composition-edge-from="api" data-composition-edge-to="db" data-composition-edge-id="profile-query" data-composition-points="285,443;595,443" d="M 285 443 L 595 443" class="a-emphasis" data-animate="edge" style="--step:6" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/><g data-detail="context"><rect x="374.2" y="423" width="131.60000000000002" height="16" rx="3" class="c-mask"/><text x="440" y="433" class="t-backend" font-size="9" text-anchor="middle">query profile + metrics</text>@@ -3843,7 +3954,7 @@</g><g data-edge-from="db" data-edge-to="api" data-edge-label="rows" data-edge-key="7" data-edge-id="profile-rows">- <path d="M 595 489 L 285 489" class="a-default" data-animate="edge" style="--step:7" stroke-width="1.4" stroke-dasharray="3,5" marker-end="url(#arrowhead)"/>+ <path data-composition-edge-from="db" data-composition-edge-to="api" data-composition-edge-id="profile-rows" data-composition-points="595,489;285,489" d="M 595 489 L 285 489" class="a-default" data-animate="edge" style="--step:7" stroke-width="1.4" stroke-dasharray="3,5" marker-end="url(#arrowhead)"/><g data-detail="context"><rect x="423" y="469" width="34" height="16" rx="3" class="c-mask"/><text x="440" y="479" class="t-muted" font-size="9" text-anchor="middle">rows</text>@@ -3851,7 +3962,7 @@</g><g data-edge-from="api" data-edge-to="redis" data-edge-label="set cache" data-edge-key="8" data-edge-id="cache-write">- <path d="M 285 536 L 487 536" class="a-dashed" data-animate="edge" style="--step:8" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-composition-edge-from="api" data-composition-edge-to="redis" data-composition-edge-id="cache-write" data-composition-points="285,536;487,536" d="M 285 536 L 487 536" class="a-dashed" data-animate="edge" style="--step:8" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/><g data-detail="context"><rect x="356.6" y="516" width="58.800000000000004" height="16" rx="3" class="c-mask"/><text x="386" y="526" class="t-messagebus" font-size="9" text-anchor="middle">set cache</text>@@ -3859,7 +3970,7 @@</g><g data-edge-from="api" data-edge-to="trace" data-edge-label="emit trace" data-edge-key="9" data-edge-id="trace-emit">- <path d="M 285 580 L 703 580" class="a-dashed" data-animate="edge" style="--step:9" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-composition-edge-from="api" data-composition-edge-to="trace" data-composition-edge-id="trace-emit" data-composition-points="285,580;703,580" d="M 285 580 L 703 580" class="a-dashed" data-animate="edge" style="--step:9" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/><g data-detail="context"><rect x="462" y="560" width="64" height="16" rx="3" class="c-mask"/><text x="494" y="570" class="t-messagebus" font-size="9" text-anchor="middle">emit trace</text>@@ -3867,7 +3978,7 @@</g><g data-edge-from="api" data-edge-to="web" data-edge-label="200 JSON" data-edge-key="10" data-edge-id="dashboard-response">- <path d="M 271 625 L 177 625" class="a-default" data-animate="edge" style="--step:10" stroke-width="1.4" stroke-dasharray="3,5" marker-end="url(#arrowhead)"/>+ <path data-composition-edge-from="api" data-composition-edge-to="web" data-composition-edge-id="dashboard-response" data-composition-points="271,625;177,625" d="M 271 625 L 177 625" class="a-default" data-animate="edge" style="--step:10" stroke-width="1.4" stroke-dasharray="3,5" marker-end="url(#arrowhead)"/><g data-detail="context"><rect x="197.2" y="605" width="53.6" height="16" rx="3" class="c-mask"/><text x="224" y="615" class="t-muted" font-size="9" text-anchor="middle">200 JSON</text>@@ -3875,7 +3986,7 @@</g><g data-edge-from="web" data-edge-to="user" data-edge-label="render" data-edge-key="11" data-edge-id="page-render">- <path d="M 163 662 L 69 662" class="a-default" data-animate="edge" style="--step:11" stroke-width="1.4" stroke-dasharray="3,5" marker-end="url(#arrowhead)"/>+ <path data-composition-edge-from="web" data-composition-edge-to="user" data-composition-edge-id="page-render" data-composition-points="163,662;69,662" d="M 163 662 L 69 662" class="a-default" data-animate="edge" style="--step:11" stroke-width="1.4" stroke-dasharray="3,5" marker-end="url(#arrowhead)"/><g data-detail="context"><rect x="94.4" y="642" width="43.2" height="16" rx="3" class="c-mask"/><text x="116" y="652" class="t-muted" font-size="9" text-anchor="middle">render</text>@@ -3901,6 +4012,10 @@<title>User · browser session · Sequence participant</title><rect x="19" y="72" width="86" height="54" rx="6" class="c-mask"/><rect x="19" y="72" width="86" height="54" rx="6" class="c-external" data-animate="node" style="--step:0" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="external" class="semantic-sigil s-external" transform="translate(25 78) scale(0.6875)">+ <rect x="2.5" y="5" width="8.5" height="8" rx="1.5"/>+ <path d="M8 2.5h5.5V8M13.5 2.5 7.5 8.5"/>+ </g><text data-detail-anchor x="62" y="94" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">User</text><text data-detail="context" x="62" y="111" class="t-muted" font-size="7" text-anchor="middle">browser session</text></g>@@ -3909,6 +4024,12 @@<title>Web App · React UI · Sequence participant</title><rect x="127" y="72" width="86" height="54" rx="6" class="c-mask"/><rect x="127" y="72" width="86" height="54" rx="6" class="c-frontend" data-animate="node" style="--step:1" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(133 78) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g><text data-detail-anchor x="170" y="94" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Web App</text><text data-detail="context" x="170" y="111" class="t-muted" font-size="7" text-anchor="middle">React UI</text></g>@@ -3917,6 +4038,9 @@<title>API · request handler · Sequence participant</title><rect x="235" y="72" width="86" height="54" rx="6" class="c-mask"/><rect x="235" y="72" width="86" height="54" rx="6" class="c-backend" data-animate="node" style="--step:2" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(241 78) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g><text data-detail-anchor x="278" y="94" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">API</text><text data-detail="context" x="278" y="111" class="t-muted" font-size="7" text-anchor="middle">request handler</text></g>@@ -3925,6 +4049,10 @@<title>Auth · JWT verify · Sequence participant</title><rect x="343" y="72" width="86" height="54" rx="6" class="c-mask"/><rect x="343" y="72" width="86" height="54" rx="6" class="c-security" data-animate="node" style="--step:3" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(349 78) scale(0.6875)">+ <path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>+ <path d="m5.8 8 1.5 1.5 3-3"/>+ </g><text data-detail-anchor x="386" y="94" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Auth</text><text data-detail="context" x="386" y="111" class="t-muted" font-size="7" text-anchor="middle">JWT verify</text></g>@@ -3933,6 +4061,10 @@<title>Redis · cache · Sequence participant</title><rect x="451" y="72" width="86" height="54" rx="6" class="c-mask"/><rect x="451" y="72" width="86" height="54" rx="6" class="c-database" data-animate="node" style="--step:4" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(457 78) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ </g><text data-detail-anchor x="494" y="94" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Redis</text><text data-detail="context" x="494" y="111" class="t-muted" font-size="7" text-anchor="middle">cache</text></g>@@ -3941,6 +4073,10 @@<title>Postgres · source of truth · Sequence participant</title><rect x="559" y="72" width="86" height="54" rx="6" class="c-mask"/><rect x="559" y="72" width="86" height="54" rx="6" class="c-database" data-animate="node" style="--step:5" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(565 78) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ </g><text data-detail-anchor x="602" y="94" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Postgres</text><text data-detail="context" x="602" y="111" class="t-muted" font-size="7" text-anchor="middle">source of truth</text></g>@@ -3949,6 +4085,12 @@<title>Trace · async event · Sequence participant</title><rect x="667" y="72" width="86" height="54" rx="6" class="c-mask"/><rect x="667" y="72" width="86" height="54" rx="6" class="c-messagebus" data-animate="node" style="--step:6" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(673 78) scale(0.6875)">+ <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>+ <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>+ <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>+ <circle cx="7" cy="11.5" r="1" class="sigil-fill"/>+ </g><text data-detail-anchor x="710" y="94" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Trace</text><text data-detail="context" x="710" y="111" class="t-muted" font-size="7" text-anchor="middle">async event</text></g>@@ -4019,7 +4161,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4166,15 +4308,59 @@<!-- Footer --><p class="footer">- Sequence diagram • Built with Archify<span class="no-print"> • Hover to trace • <kbd>R</kbd> route • Click to focus • <kbd>+</kbd>/<kbd>−</kbd> zoom • <kbd>M</kbd> radar • <kbd>[</kbd>/<kbd>]</kbd> views • <kbd>P</kbd> play story • <kbd>T</kbd> theme • <kbd>E</kbd> export</span>+ Sequence diagram • Built with Archify<span class="no-print"> • <a class="artifact-start-link" href="https://tt-a1i.github.io/archify/start.html?type=sequence" target="_blank" rel="noopener noreferrer">Create yours ↗</a> • Hover to trace • <kbd>R</kbd> route • Click to focus • <kbd>+</kbd>/<kbd>−</kbd> zoom • <kbd>M</kbd> radar • <kbd>[</kbd>/<kbd>]</kbd> views • <kbd>P</kbd> play story • <kbd>T</kbd> theme • <kbd>E</kbd> export</span></p></div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -4290,12 +4476,8 @@scale = scale || 1;opts = opts || {};var autoTheme = opts.autoTheme === true;- var motionExport = opts.motion === true;-var svg = document.querySelector('.diagram-container svg');var clone = svg.cloneNode(true);- if (motionExport) clone.setAttribute('data-motion-export', 'true');- else clone.removeAttribute('data-motion-export');// View transforms and neighborhood focus are HTML exploration state,// never part of a downloaded full-diagram artifact.@@ -4330,7 +4512,7 @@Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-preview-role]'), function (el) {el.removeAttribute('data-chapter-preview-role');});- Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay]'), function (el) {+ Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay]'), function (el) {el.remove();});Array.prototype.forEach.call(clone.querySelectorAll('[data-intent-trace-overlay]'), function (el) {@@ -4440,7 +4622,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;// Scale width/height so the browser rasterizes the vectors at target@@ -4666,9 +4848,11 @@}// Record the live CSS animation without Puppeteer, ffmpeg, or a network- // dependency. The serialized SVG keeps Archify's animation keyframes;- // one Image instance advances its timeline while each frame is painted- // into a MediaRecorder-backed canvas.+ // dependency. SVG files loaded through Image are commonly rasterized as+ // one cached bitmap, so repeatedly drawing that Image does not reliably+ // advance its CSS animation. Keep one crisp static SVG background, then+ // render an explicit time-varying signal scene over the real authored+ // relationship geometry on every captured canvas frame.function recordWebm(options) {options = options || {};if (!canRecordMotion()) {@@ -4679,12 +4863,161 @@var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var scale = Math.min(1, 1280 / vb.width);- var data = serializeSvg(scale, { motion: true });+ var data = serializeSvg(scale);var sourceUrl = URL.createObjectURL(new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' }));+ function createMotionScene(root) {+ var rootMatrix = root.getCTM ? root.getCTM() : null;++ function pointInRoot(element, point) {+ if (!rootMatrix || !element.getCTM || !point.matrixTransform) return { x: point.x, y: point.y };+ try {+ var elementMatrix = element.getCTM();+ if (!elementMatrix) return { x: point.x, y: point.y };+ var mapped = point.matrixTransform(rootMatrix.inverse().multiply(elementMatrix));+ return { x: mapped.x, y: mapped.y };+ } catch (_) {+ return { x: point.x, y: point.y };+ }+ }++ function samplesFor(element) {+ if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];+ var length;+ try { length = element.getTotalLength(); } catch (_) { return []; }+ if (!Number.isFinite(length) || length <= 0) return [];+ var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));+ var points = [];+ for (var i = 0; i <= count; i++) {+ points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));+ }+ return points;+ }++ function authoredStep(element, fallback) {+ var raw = element.style.getPropertyValue('--step') || getComputedStyle(element).getPropertyValue('--step');+ var value = Number(raw);+ return Number.isFinite(value) ? value : fallback;+ }++ var edges = Array.prototype.slice.call(root.querySelectorAll('[data-animate="edge"]')).map(function (element, index) {+ var computed = getComputedStyle(element);+ return {+ points: samplesFor(element),+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ width: Math.max(1.5, parseFloat(computed.strokeWidth) || 1.5),+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(function (edge) { return edge.points.length > 1; });++ var nodes = Array.prototype.slice.call(root.querySelectorAll('[data-node-id][data-animate="node"]')).map(function (element, index) {+ var box;+ try { box = element.getBBox(); } catch (_) { return null; }+ var painted = element.querySelector('[class*="c-"]') || element;+ var computed = getComputedStyle(painted);+ return {+ x: box.x,+ y: box.y,+ width: box.width,+ height: box.height,+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(Boolean);++ return { edges: edges, nodes: nodes, x: vb.x, y: vb.y, width: vb.width, height: vb.height };+ }++ function pointAlong(points, progress) {+ var scaled = Math.max(0, Math.min(1, progress)) * (points.length - 1);+ var index = Math.min(points.length - 2, Math.floor(scaled));+ var mix = scaled - index;+ return {+ x: points[index].x + (points[index + 1].x - points[index].x) * mix,+ y: points[index].y + (points[index + 1].y - points[index].y) * mix+ };+ }++ function roundedRectPath(ctx, x, y, width, height, radius) {+ var r = Math.max(0, Math.min(radius, width / 2, height / 2));+ ctx.beginPath();+ ctx.moveTo(x + r, y);+ ctx.lineTo(x + width - r, y);+ ctx.quadraticCurveTo(x + width, y, x + width, y + r);+ ctx.lineTo(x + width, y + height - r);+ ctx.quadraticCurveTo(x + width, y + height, x + width - r, y + height);+ ctx.lineTo(x + r, y + height);+ ctx.quadraticCurveTo(x, y + height, x, y + height - r);+ ctx.lineTo(x, y + r);+ ctx.quadraticCurveTo(x, y, x + r, y);+ ctx.closePath();+ }++ function drawMotionFrame(ctx, backgroundImage, motionScene, elapsed) {+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.drawImage(backgroundImage, 0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.save();+ ctx.scale(ctx.canvas.width / motionScene.width, ctx.canvas.height / motionScene.height);+ ctx.translate(-motionScene.x, -motionScene.y);++ motionScene.edges.forEach(function (edge) {+ var duration = 1.75;+ var progress = (elapsed - edge.delay) / duration;+ if (progress < 0 || progress > 1) return;+ var head = Math.max(0, Math.min(1, progress));+ var tail = Math.max(0, head - 0.24);+ var opacity = Math.sin(Math.PI * Math.min(1, progress));++ ctx.save();+ ctx.strokeStyle = edge.color;+ ctx.fillStyle = edge.color;+ ctx.lineCap = 'round';+ ctx.lineJoin = 'round';+ ctx.lineWidth = Math.max(3.2, edge.width * 2.2);+ ctx.globalAlpha = 0.42 + opacity * 0.5;+ ctx.shadowColor = edge.color;+ ctx.shadowBlur = 10;+ ctx.beginPath();+ for (var i = 0; i <= 14; i++) {+ var trailPoint = pointAlong(edge.points, tail + (head - tail) * i / 14);+ if (i === 0) ctx.moveTo(trailPoint.x, trailPoint.y);+ else ctx.lineTo(trailPoint.x, trailPoint.y);+ }+ ctx.stroke();++ var point = pointAlong(edge.points, head);+ ctx.globalAlpha = 0.95;+ ctx.beginPath();+ ctx.arc(point.x, point.y, 4.8, 0, Math.PI * 2);+ ctx.fill();+ ctx.restore();+ });++ motionScene.nodes.forEach(function (node) {+ var progress = (elapsed - node.delay) / 2.6;+ if (progress < 0 || progress > 1) return;+ var pulse = Math.sin(Math.PI * progress);+ if (pulse <= 0.02) return;+ ctx.save();+ ctx.strokeStyle = node.color;+ ctx.lineWidth = 1.4 + pulse * 1.8;+ ctx.globalAlpha = pulse * 0.5;+ ctx.shadowColor = node.color;+ ctx.shadowBlur = 12 * pulse;+ var inset = 2 + pulse * 3;+ roundedRectPath(ctx, node.x - inset, node.y - inset, node.width + inset * 2, node.height + inset * 2, 8);+ ctx.stroke();+ ctx.restore();+ });++ ctx.restore();+ }++ var motionScene = createMotionScene(svg);+return new Promise(function (resolve, reject) {- var img = new Image();- img.onload = function () {+ var backgroundImage = new Image();+ backgroundImage.onload = function () {var canvas = document.createElement('canvas');canvas.width = Math.max(2, Math.round(data.width / 2) * 2);canvas.height = Math.max(2, Math.round(data.height / 2) * 2);@@ -4703,6 +5036,7 @@var chunks = [];var raf = 0;var stopped = false;+ var startedAt = performance.now();function cleanup() {if (stopped) return;stopped = true;@@ -4710,9 +5044,9 @@URL.revokeObjectURL(sourceUrl);stream.getTracks().forEach(function (track) { track.stop(); });}- function draw() {- ctx.clearRect(0, 0, canvas.width, canvas.height);- ctx.drawImage(img, 0, 0, canvas.width, canvas.height);+ function draw(now) {+ var elapsed = Math.max(0, ((Number(now) || performance.now()) - startedAt) / 1000);+ drawMotionFrame(ctx, backgroundImage, motionScene, elapsed);raf = requestAnimationFrame(draw);}recorder.ondataavailable = function (event) {@@ -4728,8 +5062,10 @@if (!blob.size) reject(new Error('MediaRecorder produced an empty WebM'));else resolve(blob);};- draw();+ drawMotionFrame(ctx, backgroundImage, motionScene, 0);recorder.start(250);+ startedAt = performance.now();+ raf = requestAnimationFrame(draw);setTimeout(function () {if (recorder.state === 'inactive') return;// Chromium normally emits the final chunk during stop(), but@@ -4742,11 +5078,11 @@}, 120);}, duration);};- img.onerror = function () {+ backgroundImage.onerror = function () {URL.revokeObjectURL(sourceUrl);- reject(new Error('Animated SVG could not be loaded for WebM export'));+ reject(new Error('SVG background could not be loaded for WebM export'));};- img.src = sourceUrl;+ backgroundImage.src = sourceUrl;});}@@ -5456,6 +5792,99 @@clone.setAttribute('pathLength', '1');return clone;}+ function relationshipTokenKind(edge) {+ var shapes = relationshipEdgeShapes(edge);+ var classEvidence = [edge.getAttribute('class') || ''].concat(shapes.map(function (shape) {+ return shape.getAttribute('class') || '';+ })).join(' ');+ var from = edge.getAttribute('data-edge-from') || '';+ var to = edge.getAttribute('data-edge-to') || '';+ var source = nodes().find(function (node) { return node.getAttribute('data-node-id') === from; });+ var target = nodes().find(function (node) { return node.getAttribute('data-node-id') === to; });+ var sourceKind = source ? source.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ var targetKind = target ? target.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ if (/\ba-security\b/.test(classEvidence) || sourceKind === 'security' || targetKind === 'security' || targetKind === 'failure') return 'security';+ if (/\ba-dashed\b/.test(classEvidence) || sourceKind === 'messagebus' || targetKind === 'messagebus') return 'event';+ if (sourceKind === 'database' || targetKind === 'database') return 'data';+ if (targetKind === 'waiting' || targetKind === 'success') return 'state';+ return 'call';+ }+ function relationshipTokenPath(shape) {+ if (!shape) return '';+ var tagName = String(shape.tagName || '').toLowerCase();+ if (tagName === 'path') return shape.getAttribute('d') || '';+ if (tagName === 'line') {+ return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') ++ ' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');+ }+ if (tagName === 'polyline' && shape.points && shape.points.numberOfItems > 1) {+ var commands = [];+ for (var i = 0; i < shape.points.numberOfItems; i += 1) {+ var point = shape.points.getItem(i);+ commands.push((i === 0 ? 'M ' : 'L ') + point.x + ' ' + point.y);+ }+ return commands.join(' ');+ }+ return '';+ }+ function relationshipTokenPart(tagName, className, attrs) {+ var part = document.createElementNS(svgNamespace, tagName);+ part.setAttribute('class', className);+ Object.keys(attrs || {}).forEach(function (name) { part.setAttribute(name, attrs[name]); });+ return part;+ }+ function relationshipTokenGeometry(shape, kind, key, options) {+ options = options || {};+ var pathData = relationshipTokenPath(shape);+ if (!pathData) return null;+ var token = document.createElementNS(svgNamespace, 'g');+ token.setAttribute('class', 'semantic-flow-token ' + (options.className || 'relationship-flow-token'));+ token.setAttribute('data-token-kind', kind);+ token.setAttribute('data-token-edge-key', key);+ token.setAttribute('aria-hidden', 'true');+ token.appendChild(relationshipTokenPart('circle', 'semantic-flow-token-halo', { cx: '0', cy: '0', r: '7' }));+ if (kind === 'data') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-5', y: '-4', width: '10', height: '8', rx: '2' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -2.8 -1.2 h 5.6 M -2.8 1.4 h 3.8' }));+ } else if (kind === 'event') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-7', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-2', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '3', y: '-3', width: '4', height: '6', rx: '1' }));+ } else if (kind === 'security') {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-shape', { d: 'M 0 -5 L 4 -3.4 V 0 c 0 3 -1.6 4.5 -4 5.5 C -2.4 4.5 -4 3 -4 0 v -3.4 Z' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'm -2 .2 1.4 1.4 L 2 -1.4' }));+ } else if (kind === 'state') {+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-shape', { cx: '0', cy: '0', r: '5' }));+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-dot', { cx: '0', cy: '0', r: '1.35' }));+ } else {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -5 -3 L -1 0 L -5 3 M 0 -3 L 4 0 L 0 3' }));+ }+ var motion = document.createElementNS(svgNamespace, 'animateMotion');+ motion.setAttribute('path', pathData);+ motion.setAttribute('dur', options.duration || '1.2s');+ motion.setAttribute('begin', '0s');+ motion.setAttribute('fill', 'freeze');+ motion.setAttribute('rotate', 'auto');+ motion.setAttribute('calcMode', 'spline');+ motion.setAttribute('keyTimes', '0;1');+ motion.setAttribute('keySplines', '.2 0 .2 1');+ token.appendChild(motion);+ return token;+ }+ function createSemanticFlowToken(edge, shape, options) {+ if (!edge || !shape) return null;+ var key = edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ return relationshipTokenGeometry(shape, relationshipTokenKind(edge), key, options);+ }+ Archify.flowTokens = {+ create: createSemanticFlowToken,+ kind: function (edge) { return relationshipTokenKind(edge); },+ path: relationshipTokenPath+ };function renderRelationshipPulse(key) {removeRelationshipPulse();if (!key || document.documentElement.getAttribute('data-embed') === 'true') return false;@@ -5470,12 +5899,23 @@overlay.setAttribute('data-relationship-pulse-overlay', '');overlay.setAttribute('data-relationship-pulse-key', key);overlay.setAttribute('aria-hidden', 'true');+ var tokenAdded = false;matchingEdges.forEach(function (edge) {var wrapper = document.createElementNS(svgNamespace, 'g');if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));- relationshipEdgeShapes(edge).forEach(function (shape) {+ var shapes = relationshipEdgeShapes(edge);+ shapes.forEach(function (shape) {wrapper.appendChild(relationshipPulseGeometry(shape));});+ if (!tokenAdded && shapes.length) {+ var tokenKind = relationshipTokenKind(edge);+ var token = relationshipTokenGeometry(shapes[0], tokenKind, key);+ if (token) {+ wrapper.appendChild(token);+ overlay.setAttribute('data-relationship-token-kind', tokenKind);+ tokenAdded = true;+ }+ }if (wrapper.childNodes.length) overlay.appendChild(wrapper);});if (!overlay.childNodes.length) return false;@@ -6397,6 +6837,7 @@var momentRestoreGeneration = 0;var storySteps = [];var storyPulseOwnerToken = 0;+ var storyPulseGeneration = 0;var autoplayPending = false;var VIEW_INTERVAL_MS = 3200;var STORY_FOLLOW_MIN_DWELL_MS = 1100;@@ -6922,6 +7363,22 @@);}+ function uniqueStoryEdges(edgeList) {+ var positions = {};+ var unique = [];+ edgeList.forEach(function (edge) {+ var key = storyEdgeKey(edge);+ if (!Object.prototype.hasOwnProperty.call(positions, key)) {+ positions[key] = unique.length;+ unique.push(edge);+ return;+ }+ var index = positions[key];+ if (!storyGeometry(unique[index]).length && storyGeometry(edge).length) unique[index] = edge;+ });+ return unique;+ }+function storyStep(view, index, edgeList, byId) {var id = view.focus[index];var node = byId[id];@@ -6936,6 +7393,8 @@else if (from === id && to === previousId) reverse.push(edge);});}+ forward = uniqueStoryEdges(forward);+ reverse = uniqueStoryEdges(reverse);var edges = forward.concat(reverse).sort(function (left, right) {return edgeList.indexOf(left) - edgeList.indexOf(right);});@@ -7106,7 +7565,8 @@function storyMotionAllowed() {if (document.hidden || reducedMotion()) return false;if (document.documentElement.getAttribute('data-motion') !== 'live') return false;- if (document.documentElement.getAttribute('data-embed') === 'true') return false;+ if (document.documentElement.getAttribute('data-embed') === 'true' &&+ document.documentElement.getAttribute('data-share-playback') !== 'true') return false;if (window.matchMedia && window.matchMedia('print').matches) return false;return !(Archify.motionGovernor && Archify.motionGovernor.isPaused());}@@ -7120,9 +7580,13 @@function clearStoryPulse(options) {options = options || {};+ storyPulseGeneration += 1;Array.prototype.forEach.call(svg.querySelectorAll('.story-trail-flow[data-story-pulse]'), function (flow) {flow.removeAttribute('data-story-pulse');});+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-carrier-overlay]'), function (overlay) {+ overlay.remove();+ });if (storyPulseOwnerToken && options.release !== false && Archify.motionGovernor) {var token = storyPulseOwnerToken;storyPulseOwnerToken = 0;@@ -7135,14 +7599,41 @@if (!step || (step.relation !== 'forward' && step.relation !== 'reverse') || step.edges.length !== 1 || !storyMotionAllowed()) return false;var flows = Array.prototype.slice.call(svg.querySelectorAll('.story-trail-flow[data-story-beat-step="' + step.index + '"]'));if (!flows.length) return false;+ var pulseGeneration = storyPulseGeneration;if (Archify.motionGovernor && Archify.motionGovernor.capable) {storyPulseOwnerToken = Archify.motionGovernor.claim('story', function () {clearStoryPulse({ release: false });});}flows.forEach(function (flow) { flow.setAttribute('data-story-pulse', 'true'); });+ if (Archify.flowTokens && typeof Archify.flowTokens.create === 'function') {+ var edge = step.edges[0];+ var shapes = storyGeometry(edge);+ var carrier = shapes.length ? Archify.flowTokens.create(edge, shapes[0], {+ className: 'story-flow-token',+ duration: '0.78s'+ }) : null;+ if (carrier) {+ var carrierOverlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ var carrierWrapper = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ carrierOverlay.setAttribute('class', 'story-carrier-overlay');+ carrierOverlay.setAttribute('data-story-carrier-overlay', '');+ carrierOverlay.setAttribute('aria-hidden', 'true');+ if (edge.hasAttribute('transform')) carrierWrapper.setAttribute('transform', edge.getAttribute('transform'));+ carrier.setAttribute('data-story-carrier-token', '');+ carrier.setAttribute('data-story-beat-step', String(step.index));+ carrierWrapper.appendChild(carrier);+ carrierOverlay.appendChild(carrierWrapper);+ var firstNode = svg.querySelector('[data-node-id]');+ while (firstNode && firstNode.parentNode !== svg) firstNode = firstNode.parentNode;+ if (firstNode) svg.insertBefore(carrierOverlay, firstNode);+ else svg.appendChild(carrierOverlay);+ }+ }void flows[0].getBoundingClientRect();- flows[0].addEventListener('animationend', function () { clearStoryPulse(); }, { once: true });+ flows[0].addEventListener('animationend', function () {+ if (pulseGeneration === storyPulseGeneration) clearStoryPulse();+ }, { once: true });return true;}@@ -10760,6 +11251,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -10775,6 +11267,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -10841,9 +11334,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -10867,6 +11361,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/archify/examples/web-app-rendered.html b/archify/examples/web-app-rendered.htmlindex 59fbb26e..b64147bc 100644--- a/archify/examples/web-app-rendered.html+++ b/archify/examples/web-app-rendered.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -708,7 +708,9 @@}html[data-motion="still"] .route-journey-overlay,html[data-document-hidden="true"] .route-journey-overlay { display: none !important; }- html[data-motion="still"] .relationship-pulse-overlay { display: none !important; }+ html[data-motion="still"] .relationship-pulse-overlay,+ html[data-motion="still"] .story-carrier-overlay,+ html[data-document-hidden="true"] .story-carrier-overlay { display: none !important; }html[data-motion="still"] .chapter-handoff-overlay { display: none !important; }html[data-motion="still"] .chapter-handoff-anchor { animation: none !important; }html[data-motion="still"] .guided-view-chapter,@@ -2400,6 +2402,19 @@font-size: 0.75rem;}+ .footer .artifact-start-link {+ color: var(--text-faint);+ text-decoration-color: color-mix(in srgb, var(--frontend-stroke) 48%, transparent);+ text-underline-offset: 0.22em;+ transition: color 0.15s ease, text-decoration-color 0.15s ease;+ }++ .footer .artifact-start-link:hover,+ .footer .artifact-start-link:focus-visible {+ color: var(--frontend-stroke);+ text-decoration-color: currentColor;+ }+/* ==========================================================Print stylesheet — hide interactive controls, force light,drop the grid so the diagram doesn't waste ink, use landscape@@ -2472,7 +2487,8 @@.relationship-hit-overlay { display: none !important; }.relationship-pulse-overlay { display: none !important; }.route-probe-overlay, .route-journey-overlay { display: none !important; }- .story-trail-overlay { display: none !important; }+ .story-trail-overlay,+ .story-carrier-overlay { display: none !important; }.diagram-container svg[data-focus-active] [data-node-id],.diagram-container svg[data-focus-active] [data-edge-from],.diagram-container svg[data-story-beat] [data-story-step],@@ -2525,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2923,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -2953,6 +2989,28 @@.t-messagebus { fill: var(--messagebus-stroke); }.t-external { fill: var(--external-stroke); }+ /* Semantic Sigils are small authored role stamps, not icons from a brand+ pack and not viewer controls. Prefix selectors with svg so the canonical+ export's SVG-only stylesheet collector keeps them automatically. */+ svg .semantic-sigil {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ opacity: 0.76;+ pointer-events: none;+ }+ svg .semantic-sigil > * { vector-effect: non-scaling-stroke; }+ svg .semantic-sigil .sigil-fill { fill: currentColor; stroke: none; }+ svg .s-frontend { color: var(--frontend-stroke); }+ svg .s-backend { color: var(--backend-stroke); }+ svg .s-database { color: var(--database-stroke); }+ svg .s-cloud { color: var(--cloud-stroke); }+ svg .s-security { color: var(--security-stroke); }+ svg .s-messagebus { color: var(--messagebus-stroke); }+ svg .s-external { color: var(--external-stroke); }+/* Reading Depth is a viewer-only level-of-detail layer. MAP preserves theauthored structure and primary labels, READ restores relationship labelsand node context, and FULL restores tags and fine annotations. Semantic@@ -3236,6 +3294,48 @@stroke-linecap: square;filter: none;}+ .semantic-flow-token {+ color: var(--frontend-stroke);+ opacity: 0;+ pointer-events: none;+ }+ .relationship-flow-token {+ animation: archify-relationship-token-life 1.2s linear 1 both;+ }+ .story-flow-token {+ animation: archify-relationship-token-life 0.78s linear 1 both;+ }+ .semantic-flow-token-halo {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.1;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ }+ .relationship-flow-token-shape {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-ink {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.05;+ stroke-linecap: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-dot { fill: currentColor; stroke: none; }+ .semantic-flow-token[data-token-kind="data"] { color: var(--database-stroke); }+ .semantic-flow-token[data-token-kind="event"] { color: var(--messagebus-stroke); }+ .semantic-flow-token[data-token-kind="security"] { color: var(--security-stroke); }+ .semantic-flow-token[data-token-kind="state"] { color: var(--cloud-stroke); }+ svg[data-preset="signal-flow"] .semantic-flow-token {+ filter: drop-shadow(0 0 5px currentColor);+ }+ svg[data-preset="blueprint"] .semantic-flow-token { filter: none; }html[data-embed="true"] .relationship-pulse-overlay { display: none; }/* Intent Trace is a temporary, pre-click exploration layer. Related@@ -3387,6 +3487,7 @@of the active guided view. The authored edge stays underneath with itsoriginal color, dash pattern, marker, and geometry intact. */.story-trail-overlay { pointer-events: none; }+ .story-carrier-overlay { pointer-events: none; }.story-trail-flow {fill: none;stroke: var(--frontend-stroke);@@ -3472,15 +3573,13 @@/* Optional trace animation, enabled only by meta.animation = "trace".The ordinary viewer performs one ambient pass and then restores the- authored solid/security/async line language. WebM uses the same finite- timeline on an isolated export clone. */- html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"],- svg[data-motion-export="true"] [data-animate="edge"] {+ authored solid/security/async line language. WebM samples the same+ authored geometry into an explicit canvas timeline. */+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"] {animation: archify-edge-flow 2.4s linear 1;animation-delay: calc(var(--step, 0) * 160ms);}- html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"],- svg[data-motion-export="true"] [data-animate="node"] {+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"] {transform-box: fill-box;transform-origin: center;animation: archify-node-pulse 3.6s ease-in-out 1;@@ -3569,6 +3668,11 @@10%, 76% { opacity: 0.98; }100% { opacity: 0; stroke-dashoffset: -1; }}+ @keyframes archify-relationship-token-life {+ 0%, 7% { opacity: 0; }+ 13%, 82% { opacity: 1; }+ 100% { opacity: 0; }+ }@keyframes archify-story-beat-node {from { opacity: 0.48; filter: saturate(0.6); }58% { opacity: 1; filter: drop-shadow(0 0 10px var(--frontend-stroke)); }@@ -3627,7 +3731,8 @@stroke-dashoffset: 0;opacity: 0.78;}- .route-journey-overlay { display: none !important; }+ .route-journey-overlay,+ .story-carrier-overlay { display: none !important; }.semantic-lens-flow {animation: none !important;stroke-dasharray: none;@@ -3642,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3653,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -3767,28 +3878,32 @@<rect width="100%" height="100%" fill="url(#grid)" /><!-- Boundaries (behind everything) -->- <rect x="220" y="120" width="820" height="400" rx="12" class="c-region" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="region" data-composition-frame-id="0" x="220" y="120" width="820" height="400" rx="12" class="c-region" stroke-width="1"/><text x="228" y="138" class="t-cloud" font-size="9" font-weight="600">AWS Region: us-west-2</text>- <rect x="430" y="270" width="400" height="110" rx="8" class="c-security-group" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="security-group" data-composition-frame-id="1" x="430" y="270" width="400" height="110" rx="8" class="c-security-group" stroke-width="1"/><text x="438" y="288" class="t-security" font-size="9" font-weight="600">sg-api :443/:8000</text><!-- Connection paths (before components for correct z-order) -->- <path data-edge-from="users" data-edge-to="cdn" data-edge-label="HTTPS" data-edge-key="0" data-edge-id="users-to-cdn" d="M 160 330 L 250 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="auth" data-edge-to="api" data-edge-label="verify JWT" data-edge-key="1" data-edge-id="jwt-verification" d="M 160 142 L 612 142 Q 620 142 620 150 L 620 262 Q 620 270 628 270 L 727 270 Q 735 270 735 278 L 735 300" class="a-security" stroke-width="1.5" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="cdn" data-edge-to="lb" data-edge-key="2" data-edge-id="cdn-to-lb" d="M 380 330 L 460 330" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>- <path data-edge-from="cdn" data-edge-to="s3" data-edge-label="static" data-edge-key="3" data-edge-id="static-assets" d="M 315 360 L 315 440" class="a-dashed" stroke-width="1.5" marker-end="url(#arrowhead-dashed)"/>- <path data-edge-from="lb" data-edge-to="api" data-edge-key="4" data-edge-id="lb-to-api" d="M 590 330 L 670 330" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>- <path data-edge-from="api" data-edge-to="cache" data-edge-label="read-through" data-edge-key="5" data-edge-id="cache-read-through" d="M 735 300 L 735 210" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>- <path data-edge-from="api" data-edge-to="db" data-edge-label="SQL" data-edge-key="6" data-edge-id="api-sql" d="M 800 330 L 880 330" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>- <path data-edge-from="api" data-edge-to="queue" data-edge-label="enqueue" data-edge-key="7" data-edge-id="enqueue-job" d="M 735 360 L 735 440" class="a-dashed" stroke-width="1.5" marker-end="url(#arrowhead-dashed)"/>- <path data-edge-from="queue" data-edge-to="worker" data-edge-key="8" data-edge-id="queue-to-worker" d="M 800 470 L 880 470" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>+ <path data-edge-from="users" data-edge-to="cdn" data-edge-label="HTTPS" data-edge-key="0" data-edge-id="users-to-cdn" data-composition-points="160,330;250,330" d="M 160 330 L 250 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="auth" data-edge-to="api" data-edge-label="verify JWT" data-edge-key="1" data-edge-id="jwt-verification" data-composition-points="160,142;620,142;620,246;735,246;735,300" d="M 160 142 L 612 142 Q 620 142 620 150 L 620 238 Q 620 246 628 246 L 727 246 Q 735 246 735 254 L 735 300" class="a-security" stroke-width="1.5" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="cdn" data-edge-to="lb" data-edge-key="2" data-edge-id="cdn-to-lb" data-composition-points="380,330;460,330" d="M 380 330 L 460 330" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>+ <path data-edge-from="cdn" data-edge-to="s3" data-edge-label="static" data-edge-key="3" data-edge-id="static-assets" data-composition-points="315,360;315,440" d="M 315 360 L 315 440" class="a-dashed" stroke-width="1.5" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="lb" data-edge-to="api" data-edge-key="4" data-edge-id="lb-to-api" data-composition-points="590,330;670,330" d="M 590 330 L 670 330" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>+ <path data-edge-from="api" data-edge-to="cache" data-edge-label="read-through" data-edge-key="5" data-edge-id="cache-read-through" data-composition-points="735,300;735,210" d="M 735 300 L 735 210" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>+ <path data-edge-from="api" data-edge-to="db" data-edge-label="SQL" data-edge-key="6" data-edge-id="api-sql" data-composition-points="800,330;880,330" d="M 800 330 L 880 330" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>+ <path data-edge-from="api" data-edge-to="queue" data-edge-label="enqueue" data-edge-key="7" data-edge-id="enqueue-job" data-composition-points="735,360;735,440" d="M 735 360 L 735 440" class="a-dashed" stroke-width="1.5" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="queue" data-edge-to="worker" data-edge-key="8" data-edge-id="queue-to-worker" data-composition-points="800,470;880,470" d="M 800 470 L 880 470" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/><!-- Components --><g id="node-users" data-node-id="users" data-node-label="Users" tabindex="0" role="button" aria-label="Focus Users, Browser / Mobile, Architecture component" aria-pressed="false" data-node-kind="external" data-node-sublabel="Browser / Mobile" data-node-context="Architecture component"><title>Users · Browser / Mobile · Architecture component</title><rect x="40" y="300" width="120" height="60" rx="6" class="c-mask"/><rect x="40" y="300" width="120" height="60" rx="6" class="c-external" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="external" class="semantic-sigil s-external" transform="translate(46 306) scale(0.6875)">+ <rect x="2.5" y="5" width="8.5" height="8" rx="1.5"/>+ <path d="M8 2.5h5.5V8M13.5 2.5 7.5 8.5"/>+ </g><text data-detail-anchor x="100" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Users</text><text data-detail="context" x="100" y="344" class="t-muted" font-size="9" text-anchor="middle">Browser / Mobile</text></g>@@ -3797,6 +3912,10 @@<title>Auth Provider · OAuth 2.0 · Architecture component · JWT + PKCE</title><rect x="40" y="110" width="120" height="64" rx="6" class="c-mask"/><rect x="40" y="110" width="120" height="64" rx="6" class="c-security" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(46 116) scale(0.6875)">+ <path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>+ <path d="m5.8 8 1.5 1.5 3-3"/>+ </g><text data-detail-anchor x="100" y="140" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Auth Provider</text><text data-detail="context" x="100" y="156" class="t-muted" font-size="9" text-anchor="middle">OAuth 2.0</text><text data-detail="fine" x="100" y="166" class="t-security" font-size="7" text-anchor="middle">JWT + PKCE</text>@@ -3806,6 +3925,9 @@<title>CloudFront · CDN · AWS Region: us-west-2</title><rect x="250" y="300" width="130" height="60" rx="6" class="c-mask"/><rect x="250" y="300" width="130" height="60" rx="6" class="c-cloud" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(256 306) scale(0.6875)">+ <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>+ </g><text data-detail-anchor x="315" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">CloudFront</text><text data-detail="context" x="315" y="344" class="t-muted" font-size="9" text-anchor="middle">CDN</text></g>@@ -3814,6 +3936,9 @@<title>Load Balancer · HTTPS :443 · AWS Region: us-west-2 › sg-api :443/:8000</title><rect x="460" y="300" width="130" height="60" rx="6" class="c-mask"/><rect x="460" y="300" width="130" height="60" rx="6" class="c-cloud" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(466 306) scale(0.6875)">+ <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>+ </g><text data-detail-anchor x="525" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Load Balancer</text><text data-detail="context" x="525" y="344" class="t-muted" font-size="9" text-anchor="middle">HTTPS :443</text></g>@@ -3822,6 +3947,9 @@<title>API Server · FastAPI :8000 · AWS Region: us-west-2 › sg-api :443/:8000</title><rect x="670" y="300" width="130" height="60" rx="6" class="c-mask"/><rect x="670" y="300" width="130" height="60" rx="6" class="c-backend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(676 306) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g><text data-detail-anchor x="735" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">API Server</text><text data-detail="context" x="735" y="344" class="t-muted" font-size="9" text-anchor="middle">FastAPI :8000</text></g>@@ -3830,6 +3958,10 @@<title>Redis · cache :6379 · AWS Region: us-west-2</title><rect x="670" y="150" width="130" height="60" rx="6" class="c-mask"/><rect x="670" y="150" width="130" height="60" rx="6" class="c-database" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(676 156) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ </g><text data-detail-anchor x="735" y="178" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Redis</text><text data-detail="context" x="735" y="194" class="t-muted" font-size="9" text-anchor="middle">cache :6379</text></g>@@ -3838,6 +3970,10 @@<title>PostgreSQL · primary :5432 · AWS Region: us-west-2</title><rect x="880" y="300" width="130" height="60" rx="6" class="c-mask"/><rect x="880" y="300" width="130" height="60" rx="6" class="c-database" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(886 306) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ </g><text data-detail-anchor x="945" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">PostgreSQL</text><text data-detail="context" x="945" y="344" class="t-muted" font-size="9" text-anchor="middle">primary :5432</text></g>@@ -3846,6 +3982,9 @@<title>S3 · static assets · AWS Region: us-west-2 · OAI protected</title><rect x="250" y="440" width="130" height="60" rx="6" class="c-mask"/><rect x="250" y="440" width="130" height="60" rx="6" class="c-cloud" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(256 446) scale(0.6875)">+ <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>+ </g><text data-detail-anchor x="315" y="468" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">S3</text><text data-detail="context" x="315" y="484" class="t-muted" font-size="9" text-anchor="middle">static assets</text><text data-detail="fine" x="315" y="492" class="t-cloud" font-size="7" text-anchor="middle">OAI protected</text>@@ -3855,6 +3994,12 @@<title>SQS · job queue · AWS Region: us-west-2</title><rect x="670" y="440" width="130" height="60" rx="6" class="c-mask"/><rect x="670" y="440" width="130" height="60" rx="6" class="c-messagebus" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(676 446) scale(0.6875)">+ <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>+ <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>+ <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>+ <circle cx="7" cy="11.5" r="1" class="sigil-fill"/>+ </g><text data-detail-anchor x="735" y="468" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">SQS</text><text data-detail="context" x="735" y="484" class="t-muted" font-size="9" text-anchor="middle">job queue</text></g>@@ -3863,6 +4008,9 @@<title>Worker · async jobs · AWS Region: us-west-2</title><rect x="880" y="440" width="130" height="60" rx="6" class="c-mask"/><rect x="880" y="440" width="130" height="60" rx="6" class="c-backend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(886 446) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g><text data-detail-anchor x="945" y="468" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Worker</text><text data-detail="context" x="945" y="484" class="t-muted" font-size="9" text-anchor="middle">async jobs</text></g>@@ -3873,8 +4021,8 @@<text x="205" y="320" class="t-backend" font-size="8" text-anchor="middle">HTTPS</text></g><g data-detail="context" data-edge-from="auth" data-edge-to="api" data-edge-label="verify JWT" data-edge-key="1" data-edge-id="jwt-verification">- <rect x="591" y="186" width="58" height="14" rx="3" class="c-mask"/>- <text x="620" y="196" class="t-security" font-size="8" text-anchor="middle">verify JWT</text>+ <rect x="591" y="174" width="58" height="14" rx="3" class="c-mask"/>+ <text x="620" y="184" class="t-security" font-size="8" text-anchor="middle">verify JWT</text></g><g data-detail="context" data-edge-from="cdn" data-edge-to="s3" data-edge-label="static" data-edge-key="3" data-edge-id="static-assets">@@ -3980,7 +4128,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4125,15 +4273,59 @@<!-- Footer --><p class="footer">- Architecture diagram • Built with Archify<span class="no-print"> • Hover to trace • <kbd>R</kbd> route • Click to focus • <kbd>+</kbd>/<kbd>−</kbd> zoom • <kbd>M</kbd> radar • <kbd>[</kbd>/<kbd>]</kbd> views • <kbd>P</kbd> play story • <kbd>T</kbd> theme • <kbd>E</kbd> export</span>+ Architecture diagram • Built with Archify<span class="no-print"> • <a class="artifact-start-link" href="https://tt-a1i.github.io/archify/start.html?type=architecture" target="_blank" rel="noopener noreferrer">Create yours ↗</a> • Hover to trace • <kbd>R</kbd> route • Click to focus • <kbd>+</kbd>/<kbd>−</kbd> zoom • <kbd>M</kbd> radar • <kbd>[</kbd>/<kbd>]</kbd> views • <kbd>P</kbd> play story • <kbd>T</kbd> theme • <kbd>E</kbd> export</span></p></div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -4249,12 +4441,8 @@scale = scale || 1;opts = opts || {};var autoTheme = opts.autoTheme === true;- var motionExport = opts.motion === true;-var svg = document.querySelector('.diagram-container svg');var clone = svg.cloneNode(true);- if (motionExport) clone.setAttribute('data-motion-export', 'true');- else clone.removeAttribute('data-motion-export');// View transforms and neighborhood focus are HTML exploration state,// never part of a downloaded full-diagram artifact.@@ -4289,7 +4477,7 @@Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-preview-role]'), function (el) {el.removeAttribute('data-chapter-preview-role');});- Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay]'), function (el) {+ Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay]'), function (el) {el.remove();});Array.prototype.forEach.call(clone.querySelectorAll('[data-intent-trace-overlay]'), function (el) {@@ -4399,7 +4587,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;// Scale width/height so the browser rasterizes the vectors at target@@ -4625,9 +4813,11 @@}// Record the live CSS animation without Puppeteer, ffmpeg, or a network- // dependency. The serialized SVG keeps Archify's animation keyframes;- // one Image instance advances its timeline while each frame is painted- // into a MediaRecorder-backed canvas.+ // dependency. SVG files loaded through Image are commonly rasterized as+ // one cached bitmap, so repeatedly drawing that Image does not reliably+ // advance its CSS animation. Keep one crisp static SVG background, then+ // render an explicit time-varying signal scene over the real authored+ // relationship geometry on every captured canvas frame.function recordWebm(options) {options = options || {};if (!canRecordMotion()) {@@ -4638,12 +4828,161 @@var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var scale = Math.min(1, 1280 / vb.width);- var data = serializeSvg(scale, { motion: true });+ var data = serializeSvg(scale);var sourceUrl = URL.createObjectURL(new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' }));+ function createMotionScene(root) {+ var rootMatrix = root.getCTM ? root.getCTM() : null;++ function pointInRoot(element, point) {+ if (!rootMatrix || !element.getCTM || !point.matrixTransform) return { x: point.x, y: point.y };+ try {+ var elementMatrix = element.getCTM();+ if (!elementMatrix) return { x: point.x, y: point.y };+ var mapped = point.matrixTransform(rootMatrix.inverse().multiply(elementMatrix));+ return { x: mapped.x, y: mapped.y };+ } catch (_) {+ return { x: point.x, y: point.y };+ }+ }++ function samplesFor(element) {+ if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];+ var length;+ try { length = element.getTotalLength(); } catch (_) { return []; }+ if (!Number.isFinite(length) || length <= 0) return [];+ var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));+ var points = [];+ for (var i = 0; i <= count; i++) {+ points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));+ }+ return points;+ }++ function authoredStep(element, fallback) {+ var raw = element.style.getPropertyValue('--step') || getComputedStyle(element).getPropertyValue('--step');+ var value = Number(raw);+ return Number.isFinite(value) ? value : fallback;+ }++ var edges = Array.prototype.slice.call(root.querySelectorAll('[data-animate="edge"]')).map(function (element, index) {+ var computed = getComputedStyle(element);+ return {+ points: samplesFor(element),+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ width: Math.max(1.5, parseFloat(computed.strokeWidth) || 1.5),+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(function (edge) { return edge.points.length > 1; });++ var nodes = Array.prototype.slice.call(root.querySelectorAll('[data-node-id][data-animate="node"]')).map(function (element, index) {+ var box;+ try { box = element.getBBox(); } catch (_) { return null; }+ var painted = element.querySelector('[class*="c-"]') || element;+ var computed = getComputedStyle(painted);+ return {+ x: box.x,+ y: box.y,+ width: box.width,+ height: box.height,+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(Boolean);++ return { edges: edges, nodes: nodes, x: vb.x, y: vb.y, width: vb.width, height: vb.height };+ }++ function pointAlong(points, progress) {+ var scaled = Math.max(0, Math.min(1, progress)) * (points.length - 1);+ var index = Math.min(points.length - 2, Math.floor(scaled));+ var mix = scaled - index;+ return {+ x: points[index].x + (points[index + 1].x - points[index].x) * mix,+ y: points[index].y + (points[index + 1].y - points[index].y) * mix+ };+ }++ function roundedRectPath(ctx, x, y, width, height, radius) {+ var r = Math.max(0, Math.min(radius, width / 2, height / 2));+ ctx.beginPath();+ ctx.moveTo(x + r, y);+ ctx.lineTo(x + width - r, y);+ ctx.quadraticCurveTo(x + width, y, x + width, y + r);+ ctx.lineTo(x + width, y + height - r);+ ctx.quadraticCurveTo(x + width, y + height, x + width - r, y + height);+ ctx.lineTo(x + r, y + height);+ ctx.quadraticCurveTo(x, y + height, x, y + height - r);+ ctx.lineTo(x, y + r);+ ctx.quadraticCurveTo(x, y, x + r, y);+ ctx.closePath();+ }++ function drawMotionFrame(ctx, backgroundImage, motionScene, elapsed) {+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.drawImage(backgroundImage, 0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.save();+ ctx.scale(ctx.canvas.width / motionScene.width, ctx.canvas.height / motionScene.height);+ ctx.translate(-motionScene.x, -motionScene.y);++ motionScene.edges.forEach(function (edge) {+ var duration = 1.75;+ var progress = (elapsed - edge.delay) / duration;+ if (progress < 0 || progress > 1) return;+ var head = Math.max(0, Math.min(1, progress));+ var tail = Math.max(0, head - 0.24);+ var opacity = Math.sin(Math.PI * Math.min(1, progress));++ ctx.save();+ ctx.strokeStyle = edge.color;+ ctx.fillStyle = edge.color;+ ctx.lineCap = 'round';+ ctx.lineJoin = 'round';+ ctx.lineWidth = Math.max(3.2, edge.width * 2.2);+ ctx.globalAlpha = 0.42 + opacity * 0.5;+ ctx.shadowColor = edge.color;+ ctx.shadowBlur = 10;+ ctx.beginPath();+ for (var i = 0; i <= 14; i++) {+ var trailPoint = pointAlong(edge.points, tail + (head - tail) * i / 14);+ if (i === 0) ctx.moveTo(trailPoint.x, trailPoint.y);+ else ctx.lineTo(trailPoint.x, trailPoint.y);+ }+ ctx.stroke();++ var point = pointAlong(edge.points, head);+ ctx.globalAlpha = 0.95;+ ctx.beginPath();+ ctx.arc(point.x, point.y, 4.8, 0, Math.PI * 2);+ ctx.fill();+ ctx.restore();+ });++ motionScene.nodes.forEach(function (node) {+ var progress = (elapsed - node.delay) / 2.6;+ if (progress < 0 || progress > 1) return;+ var pulse = Math.sin(Math.PI * progress);+ if (pulse <= 0.02) return;+ ctx.save();+ ctx.strokeStyle = node.color;+ ctx.lineWidth = 1.4 + pulse * 1.8;+ ctx.globalAlpha = pulse * 0.5;+ ctx.shadowColor = node.color;+ ctx.shadowBlur = 12 * pulse;+ var inset = 2 + pulse * 3;+ roundedRectPath(ctx, node.x - inset, node.y - inset, node.width + inset * 2, node.height + inset * 2, 8);+ ctx.stroke();+ ctx.restore();+ });++ ctx.restore();+ }++ var motionScene = createMotionScene(svg);+return new Promise(function (resolve, reject) {- var img = new Image();- img.onload = function () {+ var backgroundImage = new Image();+ backgroundImage.onload = function () {var canvas = document.createElement('canvas');canvas.width = Math.max(2, Math.round(data.width / 2) * 2);canvas.height = Math.max(2, Math.round(data.height / 2) * 2);@@ -4662,6 +5001,7 @@var chunks = [];var raf = 0;var stopped = false;+ var startedAt = performance.now();function cleanup() {if (stopped) return;stopped = true;@@ -4669,9 +5009,9 @@URL.revokeObjectURL(sourceUrl);stream.getTracks().forEach(function (track) { track.stop(); });}- function draw() {- ctx.clearRect(0, 0, canvas.width, canvas.height);- ctx.drawImage(img, 0, 0, canvas.width, canvas.height);+ function draw(now) {+ var elapsed = Math.max(0, ((Number(now) || performance.now()) - startedAt) / 1000);+ drawMotionFrame(ctx, backgroundImage, motionScene, elapsed);raf = requestAnimationFrame(draw);}recorder.ondataavailable = function (event) {@@ -4687,8 +5027,10 @@if (!blob.size) reject(new Error('MediaRecorder produced an empty WebM'));else resolve(blob);};- draw();+ drawMotionFrame(ctx, backgroundImage, motionScene, 0);recorder.start(250);+ startedAt = performance.now();+ raf = requestAnimationFrame(draw);setTimeout(function () {if (recorder.state === 'inactive') return;// Chromium normally emits the final chunk during stop(), but@@ -4701,11 +5043,11 @@}, 120);}, duration);};- img.onerror = function () {+ backgroundImage.onerror = function () {URL.revokeObjectURL(sourceUrl);- reject(new Error('Animated SVG could not be loaded for WebM export'));+ reject(new Error('SVG background could not be loaded for WebM export'));};- img.src = sourceUrl;+ backgroundImage.src = sourceUrl;});}@@ -5415,6 +5757,99 @@clone.setAttribute('pathLength', '1');return clone;}+ function relationshipTokenKind(edge) {+ var shapes = relationshipEdgeShapes(edge);+ var classEvidence = [edge.getAttribute('class') || ''].concat(shapes.map(function (shape) {+ return shape.getAttribute('class') || '';+ })).join(' ');+ var from = edge.getAttribute('data-edge-from') || '';+ var to = edge.getAttribute('data-edge-to') || '';+ var source = nodes().find(function (node) { return node.getAttribute('data-node-id') === from; });+ var target = nodes().find(function (node) { return node.getAttribute('data-node-id') === to; });+ var sourceKind = source ? source.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ var targetKind = target ? target.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ if (/\ba-security\b/.test(classEvidence) || sourceKind === 'security' || targetKind === 'security' || targetKind === 'failure') return 'security';+ if (/\ba-dashed\b/.test(classEvidence) || sourceKind === 'messagebus' || targetKind === 'messagebus') return 'event';+ if (sourceKind === 'database' || targetKind === 'database') return 'data';+ if (targetKind === 'waiting' || targetKind === 'success') return 'state';+ return 'call';+ }+ function relationshipTokenPath(shape) {+ if (!shape) return '';+ var tagName = String(shape.tagName || '').toLowerCase();+ if (tagName === 'path') return shape.getAttribute('d') || '';+ if (tagName === 'line') {+ return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') ++ ' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');+ }+ if (tagName === 'polyline' && shape.points && shape.points.numberOfItems > 1) {+ var commands = [];+ for (var i = 0; i < shape.points.numberOfItems; i += 1) {+ var point = shape.points.getItem(i);+ commands.push((i === 0 ? 'M ' : 'L ') + point.x + ' ' + point.y);+ }+ return commands.join(' ');+ }+ return '';+ }+ function relationshipTokenPart(tagName, className, attrs) {+ var part = document.createElementNS(svgNamespace, tagName);+ part.setAttribute('class', className);+ Object.keys(attrs || {}).forEach(function (name) { part.setAttribute(name, attrs[name]); });+ return part;+ }+ function relationshipTokenGeometry(shape, kind, key, options) {+ options = options || {};+ var pathData = relationshipTokenPath(shape);+ if (!pathData) return null;+ var token = document.createElementNS(svgNamespace, 'g');+ token.setAttribute('class', 'semantic-flow-token ' + (options.className || 'relationship-flow-token'));+ token.setAttribute('data-token-kind', kind);+ token.setAttribute('data-token-edge-key', key);+ token.setAttribute('aria-hidden', 'true');+ token.appendChild(relationshipTokenPart('circle', 'semantic-flow-token-halo', { cx: '0', cy: '0', r: '7' }));+ if (kind === 'data') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-5', y: '-4', width: '10', height: '8', rx: '2' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -2.8 -1.2 h 5.6 M -2.8 1.4 h 3.8' }));+ } else if (kind === 'event') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-7', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-2', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '3', y: '-3', width: '4', height: '6', rx: '1' }));+ } else if (kind === 'security') {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-shape', { d: 'M 0 -5 L 4 -3.4 V 0 c 0 3 -1.6 4.5 -4 5.5 C -2.4 4.5 -4 3 -4 0 v -3.4 Z' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'm -2 .2 1.4 1.4 L 2 -1.4' }));+ } else if (kind === 'state') {+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-shape', { cx: '0', cy: '0', r: '5' }));+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-dot', { cx: '0', cy: '0', r: '1.35' }));+ } else {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -5 -3 L -1 0 L -5 3 M 0 -3 L 4 0 L 0 3' }));+ }+ var motion = document.createElementNS(svgNamespace, 'animateMotion');+ motion.setAttribute('path', pathData);+ motion.setAttribute('dur', options.duration || '1.2s');+ motion.setAttribute('begin', '0s');+ motion.setAttribute('fill', 'freeze');+ motion.setAttribute('rotate', 'auto');+ motion.setAttribute('calcMode', 'spline');+ motion.setAttribute('keyTimes', '0;1');+ motion.setAttribute('keySplines', '.2 0 .2 1');+ token.appendChild(motion);+ return token;+ }+ function createSemanticFlowToken(edge, shape, options) {+ if (!edge || !shape) return null;+ var key = edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ return relationshipTokenGeometry(shape, relationshipTokenKind(edge), key, options);+ }+ Archify.flowTokens = {+ create: createSemanticFlowToken,+ kind: function (edge) { return relationshipTokenKind(edge); },+ path: relationshipTokenPath+ };function renderRelationshipPulse(key) {removeRelationshipPulse();if (!key || document.documentElement.getAttribute('data-embed') === 'true') return false;@@ -5429,12 +5864,23 @@overlay.setAttribute('data-relationship-pulse-overlay', '');overlay.setAttribute('data-relationship-pulse-key', key);overlay.setAttribute('aria-hidden', 'true');+ var tokenAdded = false;matchingEdges.forEach(function (edge) {var wrapper = document.createElementNS(svgNamespace, 'g');if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));- relationshipEdgeShapes(edge).forEach(function (shape) {+ var shapes = relationshipEdgeShapes(edge);+ shapes.forEach(function (shape) {wrapper.appendChild(relationshipPulseGeometry(shape));});+ if (!tokenAdded && shapes.length) {+ var tokenKind = relationshipTokenKind(edge);+ var token = relationshipTokenGeometry(shapes[0], tokenKind, key);+ if (token) {+ wrapper.appendChild(token);+ overlay.setAttribute('data-relationship-token-kind', tokenKind);+ tokenAdded = true;+ }+ }if (wrapper.childNodes.length) overlay.appendChild(wrapper);});if (!overlay.childNodes.length) return false;@@ -6356,6 +6802,7 @@var momentRestoreGeneration = 0;var storySteps = [];var storyPulseOwnerToken = 0;+ var storyPulseGeneration = 0;var autoplayPending = false;var VIEW_INTERVAL_MS = 3200;var STORY_FOLLOW_MIN_DWELL_MS = 1100;@@ -6881,6 +7328,22 @@);}+ function uniqueStoryEdges(edgeList) {+ var positions = {};+ var unique = [];+ edgeList.forEach(function (edge) {+ var key = storyEdgeKey(edge);+ if (!Object.prototype.hasOwnProperty.call(positions, key)) {+ positions[key] = unique.length;+ unique.push(edge);+ return;+ }+ var index = positions[key];+ if (!storyGeometry(unique[index]).length && storyGeometry(edge).length) unique[index] = edge;+ });+ return unique;+ }+function storyStep(view, index, edgeList, byId) {var id = view.focus[index];var node = byId[id];@@ -6895,6 +7358,8 @@else if (from === id && to === previousId) reverse.push(edge);});}+ forward = uniqueStoryEdges(forward);+ reverse = uniqueStoryEdges(reverse);var edges = forward.concat(reverse).sort(function (left, right) {return edgeList.indexOf(left) - edgeList.indexOf(right);});@@ -7065,7 +7530,8 @@function storyMotionAllowed() {if (document.hidden || reducedMotion()) return false;if (document.documentElement.getAttribute('data-motion') !== 'live') return false;- if (document.documentElement.getAttribute('data-embed') === 'true') return false;+ if (document.documentElement.getAttribute('data-embed') === 'true' &&+ document.documentElement.getAttribute('data-share-playback') !== 'true') return false;if (window.matchMedia && window.matchMedia('print').matches) return false;return !(Archify.motionGovernor && Archify.motionGovernor.isPaused());}@@ -7079,9 +7545,13 @@function clearStoryPulse(options) {options = options || {};+ storyPulseGeneration += 1;Array.prototype.forEach.call(svg.querySelectorAll('.story-trail-flow[data-story-pulse]'), function (flow) {flow.removeAttribute('data-story-pulse');});+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-carrier-overlay]'), function (overlay) {+ overlay.remove();+ });if (storyPulseOwnerToken && options.release !== false && Archify.motionGovernor) {var token = storyPulseOwnerToken;storyPulseOwnerToken = 0;@@ -7094,14 +7564,41 @@if (!step || (step.relation !== 'forward' && step.relation !== 'reverse') || step.edges.length !== 1 || !storyMotionAllowed()) return false;var flows = Array.prototype.slice.call(svg.querySelectorAll('.story-trail-flow[data-story-beat-step="' + step.index + '"]'));if (!flows.length) return false;+ var pulseGeneration = storyPulseGeneration;if (Archify.motionGovernor && Archify.motionGovernor.capable) {storyPulseOwnerToken = Archify.motionGovernor.claim('story', function () {clearStoryPulse({ release: false });});}flows.forEach(function (flow) { flow.setAttribute('data-story-pulse', 'true'); });+ if (Archify.flowTokens && typeof Archify.flowTokens.create === 'function') {+ var edge = step.edges[0];+ var shapes = storyGeometry(edge);+ var carrier = shapes.length ? Archify.flowTokens.create(edge, shapes[0], {+ className: 'story-flow-token',+ duration: '0.78s'+ }) : null;+ if (carrier) {+ var carrierOverlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ var carrierWrapper = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ carrierOverlay.setAttribute('class', 'story-carrier-overlay');+ carrierOverlay.setAttribute('data-story-carrier-overlay', '');+ carrierOverlay.setAttribute('aria-hidden', 'true');+ if (edge.hasAttribute('transform')) carrierWrapper.setAttribute('transform', edge.getAttribute('transform'));+ carrier.setAttribute('data-story-carrier-token', '');+ carrier.setAttribute('data-story-beat-step', String(step.index));+ carrierWrapper.appendChild(carrier);+ carrierOverlay.appendChild(carrierWrapper);+ var firstNode = svg.querySelector('[data-node-id]');+ while (firstNode && firstNode.parentNode !== svg) firstNode = firstNode.parentNode;+ if (firstNode) svg.insertBefore(carrierOverlay, firstNode);+ else svg.appendChild(carrierOverlay);+ }+ }void flows[0].getBoundingClientRect();- flows[0].addEventListener('animationend', function () { clearStoryPulse(); }, { once: true });+ flows[0].addEventListener('animationend', function () {+ if (pulseGeneration === storyPulseGeneration) clearStoryPulse();+ }, { once: true });return true;}@@ -10719,6 +11216,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -10734,6 +11232,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -10800,9 +11299,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -10826,6 +11326,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/archify/examples/workflow-agent-tool-call-rendered.html b/archify/examples/workflow-agent-tool-call-rendered.htmlindex e3516a9b..75895bb0 100644--- a/archify/examples/workflow-agent-tool-call-rendered.html+++ b/archify/examples/workflow-agent-tool-call-rendered.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -708,7 +708,9 @@}html[data-motion="still"] .route-journey-overlay,html[data-document-hidden="true"] .route-journey-overlay { display: none !important; }- html[data-motion="still"] .relationship-pulse-overlay { display: none !important; }+ html[data-motion="still"] .relationship-pulse-overlay,+ html[data-motion="still"] .story-carrier-overlay,+ html[data-document-hidden="true"] .story-carrier-overlay { display: none !important; }html[data-motion="still"] .chapter-handoff-overlay { display: none !important; }html[data-motion="still"] .chapter-handoff-anchor { animation: none !important; }html[data-motion="still"] .guided-view-chapter,@@ -2400,6 +2402,19 @@font-size: 0.75rem;}+ .footer .artifact-start-link {+ color: var(--text-faint);+ text-decoration-color: color-mix(in srgb, var(--frontend-stroke) 48%, transparent);+ text-underline-offset: 0.22em;+ transition: color 0.15s ease, text-decoration-color 0.15s ease;+ }++ .footer .artifact-start-link:hover,+ .footer .artifact-start-link:focus-visible {+ color: var(--frontend-stroke);+ text-decoration-color: currentColor;+ }+/* ==========================================================Print stylesheet — hide interactive controls, force light,drop the grid so the diagram doesn't waste ink, use landscape@@ -2472,7 +2487,8 @@.relationship-hit-overlay { display: none !important; }.relationship-pulse-overlay { display: none !important; }.route-probe-overlay, .route-journey-overlay { display: none !important; }- .story-trail-overlay { display: none !important; }+ .story-trail-overlay,+ .story-carrier-overlay { display: none !important; }.diagram-container svg[data-focus-active] [data-node-id],.diagram-container svg[data-focus-active] [data-edge-from],.diagram-container svg[data-story-beat] [data-story-step],@@ -2525,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2923,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -2953,6 +2989,28 @@.t-messagebus { fill: var(--messagebus-stroke); }.t-external { fill: var(--external-stroke); }+ /* Semantic Sigils are small authored role stamps, not icons from a brand+ pack and not viewer controls. Prefix selectors with svg so the canonical+ export's SVG-only stylesheet collector keeps them automatically. */+ svg .semantic-sigil {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ opacity: 0.76;+ pointer-events: none;+ }+ svg .semantic-sigil > * { vector-effect: non-scaling-stroke; }+ svg .semantic-sigil .sigil-fill { fill: currentColor; stroke: none; }+ svg .s-frontend { color: var(--frontend-stroke); }+ svg .s-backend { color: var(--backend-stroke); }+ svg .s-database { color: var(--database-stroke); }+ svg .s-cloud { color: var(--cloud-stroke); }+ svg .s-security { color: var(--security-stroke); }+ svg .s-messagebus { color: var(--messagebus-stroke); }+ svg .s-external { color: var(--external-stroke); }+/* Reading Depth is a viewer-only level-of-detail layer. MAP preserves theauthored structure and primary labels, READ restores relationship labelsand node context, and FULL restores tags and fine annotations. Semantic@@ -3236,6 +3294,48 @@stroke-linecap: square;filter: none;}+ .semantic-flow-token {+ color: var(--frontend-stroke);+ opacity: 0;+ pointer-events: none;+ }+ .relationship-flow-token {+ animation: archify-relationship-token-life 1.2s linear 1 both;+ }+ .story-flow-token {+ animation: archify-relationship-token-life 0.78s linear 1 both;+ }+ .semantic-flow-token-halo {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.1;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ }+ .relationship-flow-token-shape {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-ink {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.05;+ stroke-linecap: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-dot { fill: currentColor; stroke: none; }+ .semantic-flow-token[data-token-kind="data"] { color: var(--database-stroke); }+ .semantic-flow-token[data-token-kind="event"] { color: var(--messagebus-stroke); }+ .semantic-flow-token[data-token-kind="security"] { color: var(--security-stroke); }+ .semantic-flow-token[data-token-kind="state"] { color: var(--cloud-stroke); }+ svg[data-preset="signal-flow"] .semantic-flow-token {+ filter: drop-shadow(0 0 5px currentColor);+ }+ svg[data-preset="blueprint"] .semantic-flow-token { filter: none; }html[data-embed="true"] .relationship-pulse-overlay { display: none; }/* Intent Trace is a temporary, pre-click exploration layer. Related@@ -3387,6 +3487,7 @@of the active guided view. The authored edge stays underneath with itsoriginal color, dash pattern, marker, and geometry intact. */.story-trail-overlay { pointer-events: none; }+ .story-carrier-overlay { pointer-events: none; }.story-trail-flow {fill: none;stroke: var(--frontend-stroke);@@ -3472,15 +3573,13 @@/* Optional trace animation, enabled only by meta.animation = "trace".The ordinary viewer performs one ambient pass and then restores the- authored solid/security/async line language. WebM uses the same finite- timeline on an isolated export clone. */- html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"],- svg[data-motion-export="true"] [data-animate="edge"] {+ authored solid/security/async line language. WebM samples the same+ authored geometry into an explicit canvas timeline. */+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"] {animation: archify-edge-flow 2.4s linear 1;animation-delay: calc(var(--step, 0) * 160ms);}- html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"],- svg[data-motion-export="true"] [data-animate="node"] {+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"] {transform-box: fill-box;transform-origin: center;animation: archify-node-pulse 3.6s ease-in-out 1;@@ -3569,6 +3668,11 @@10%, 76% { opacity: 0.98; }100% { opacity: 0; stroke-dashoffset: -1; }}+ @keyframes archify-relationship-token-life {+ 0%, 7% { opacity: 0; }+ 13%, 82% { opacity: 1; }+ 100% { opacity: 0; }+ }@keyframes archify-story-beat-node {from { opacity: 0.48; filter: saturate(0.6); }58% { opacity: 1; filter: drop-shadow(0 0 10px var(--frontend-stroke)); }@@ -3627,7 +3731,8 @@stroke-dashoffset: 0;opacity: 0.78;}- .route-journey-overlay { display: none !important; }+ .route-journey-overlay,+ .story-carrier-overlay { display: none !important; }.semantic-lens-flow {animation: none !important;stroke-dasharray: none;@@ -3642,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3653,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -3767,23 +3878,23 @@<rect width="100%" height="100%" fill="url(#grid)" /><!-- Swimlanes -->- <rect x="40" y="52" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-0" x="40" y="52" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/><text x="54" y="74" class="t-dim" font-size="10" font-weight="600">01 / User Interface</text>- <rect x="40" y="176" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-1" x="40" y="176" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/><text x="54" y="198" class="t-dim" font-size="10" font-weight="600">02 / Agent Runtime</text>- <rect x="40" y="300" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-2" x="40" y="300" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/><text x="54" y="322" class="t-dim" font-size="10" font-weight="600">03 / Policy Boundary</text>- <rect x="40" y="424" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <rect x="46" y="430" width="628" height="92" rx="8" class="c-security-group" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-3" x="40" y="424" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="exception-lane" data-composition-frame-id="lane-3-exception" x="46" y="430" width="628" height="92" rx="8" class="c-security-group" stroke-width="1"/><text x="54" y="446" class="t-security" font-size="10" font-weight="600">EX / Exception Handling</text>- <rect x="40" y="548" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-4" x="40" y="548" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/><text x="54" y="570" class="t-dim" font-size="10" font-weight="600">05 / Tool Execution</text>- <rect x="40" y="672" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-5" x="40" y="672" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/><text x="54" y="694" class="t-dim" font-size="10" font-weight="600">06 / Observability</text><!-- Phase headers -->@@ -3798,31 +3909,35 @@<text x="562.5" y="39" class="t-messagebus" font-size="8" font-weight="600" text-anchor="middle">Execute + report</text><!-- Workflow groups -->- <rect x="250" y="214" width="230" height="58" rx="9" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-0" x="250" y="214" width="230" height="58" rx="9" class="c-lane" stroke-width="1"/><text x="260" y="228" class="t-backend" font-size="7" font-weight="600">Planning loop</text>- <rect x="450" y="586" width="225" height="58" rx="9" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-1" x="450" y="586" width="225" height="58" rx="9" class="c-lane" stroke-width="1"/><text x="460" y="600" class="t-messagebus" font-size="7" font-weight="600">Tool work</text>- <rect x="380" y="462" width="295" height="58" rx="9" class="c-security-group" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-2" x="380" y="462" width="295" height="58" rx="9" class="c-security-group" stroke-width="1"/><text x="390" y="476" class="t-security" font-size="7" font-weight="600">Human or policy stop</text><!-- Edge paths -->- <path data-edge-from="user" data-edge-to="chat" data-edge-key="0" data-edge-id="request-chat" d="M 134 119 L 174 119" class="a-default" data-animate="edge" style="--step:0" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="1" data-edge-id="plan-request" d="M 220 145 L 220 166 L 300 166 L 300 209" class="a-emphasis" data-animate="edge" style="--step:1" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="planner" data-edge-to="router" data-edge-key="2" data-edge-id="planner-route" d="M 346 243 L 384 243" class="a-default" data-animate="edge" style="--step:2" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="3" data-edge-id="approval-check" d="M 430 269 L 430 290 L 430 290 L 430 333" class="a-security" data-animate="edge" style="--step:3" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="approval" data-edge-to="tool" data-edge-key="4" data-edge-id="approved-tool" d="M 384 367 L 356 367 L 356 615 L 454 615" class="a-emphasis" data-animate="edge" style="--step:4" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="5" data-edge-id="approval-denied" d="M 430 401 L 430 414 L 500 414 L 500 465" class="a-security" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="blocked" data-edge-to="retry" data-edge-key="6" data-edge-id="retry-request" d="M 546 491 L 579 491" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>- <path data-edge-from="tool" data-edge-to="external" data-edge-key="7" data-edge-id="tool-external-call" d="M 546 615 L 579 615" class="a-default" data-animate="edge" style="--step:5" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="external" data-edge-to="final" data-edge-key="8" data-edge-id="external-reply" d="M 671 615 L 692 615 L 692 119 L 671 119" class="a-emphasis" data-animate="edge" style="--step:6" stroke-width="1.2" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="9" data-edge-id="record-result" d="M 625 641 L 625 797 L 500 797 L 500 765" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>- <path data-edge-from="store" data-edge-to="trace" data-edge-label="trace + memory" data-edge-key="10" data-edge-id="write-trace-memory" d="M 266 739 L 454 739" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="user" data-edge-to="chat" data-edge-key="0" data-edge-id="request-chat" data-composition-points="134,119;174,119" d="M 134 119 L 174 119" class="a-default" data-animate="edge" style="--step:0" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="1" data-edge-id="plan-request" data-composition-points="220,145;220,166;300,166;300,209" d="M 220 145 L 220 166 L 300 166 L 300 209" class="a-emphasis" data-animate="edge" style="--step:1" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="planner" data-edge-to="router" data-edge-key="2" data-edge-id="planner-route" data-composition-points="346,243;384,243" d="M 346 243 L 384 243" class="a-default" data-animate="edge" style="--step:2" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="3" data-edge-id="approval-check" data-composition-points="430,269;430,290;430,290;430,333" d="M 430 269 L 430 290 L 430 290 L 430 333" class="a-security" data-animate="edge" style="--step:3" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="approval" data-edge-to="tool" data-edge-key="4" data-edge-id="approved-tool" data-composition-points="384,367;356,367;356,615;454,615" d="M 384 367 L 356 367 L 356 615 L 454 615" class="a-emphasis" data-animate="edge" style="--step:4" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="5" data-edge-id="approval-denied" data-composition-points="430,401;430,414;500,414;500,465" d="M 430 401 L 430 414 L 500 414 L 500 465" class="a-security" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="blocked" data-edge-to="retry" data-edge-key="6" data-edge-id="retry-request" data-composition-points="546,491;579,491" d="M 546 491 L 579 491" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="tool" data-edge-to="external" data-edge-key="7" data-edge-id="tool-external-call" data-composition-points="546,615;579,615" d="M 546 615 L 579 615" class="a-default" data-animate="edge" style="--step:5" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="external" data-edge-to="final" data-edge-key="8" data-edge-id="external-reply" data-composition-points="671,615;692,615;692,119;671,119" d="M 671 615 L 692 615 L 692 119 L 671 119" class="a-emphasis" data-animate="edge" style="--step:6" stroke-width="1.2" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="9" data-edge-id="record-result" data-composition-points="625,641;625,797;500,797;500,765" d="M 625 641 L 625 797 L 500 797 L 500 765" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="store" data-edge-to="trace" data-edge-label="trace + memory" data-edge-key="10" data-edge-id="write-trace-memory" data-composition-points="266,739;454,739" d="M 266 739 L 454 739" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/><!-- Nodes --><g id="node-user" data-node-id="user" data-node-label="User" tabindex="0" role="button" aria-label="Focus User, asks for work, User Interface › Intake" aria-pressed="false" data-node-kind="external" data-node-sublabel="asks for work" data-node-context="User Interface › Intake"><title>User · asks for work · User Interface › Intake</title><rect x="42" y="93" width="92" height="52" rx="6" class="c-mask"/><rect x="42" y="93" width="92" height="52" rx="6" class="c-external" data-animate="node" style="--step:0" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="external" class="semantic-sigil s-external" transform="translate(48 99) scale(0.6875)">+ <rect x="2.5" y="5" width="8.5" height="8" rx="1.5"/>+ <path d="M8 2.5h5.5V8M13.5 2.5 7.5 8.5"/>+ </g><text data-detail-anchor x="88" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">User</text><text data-detail="context" x="88" y="131" class="t-muted" font-size="8" text-anchor="middle">asks for work</text></g>@@ -3831,6 +3946,12 @@<title>Chat Surface · thread + files · User Interface › Intake</title><rect x="174" y="93" width="92" height="52" rx="6" class="c-mask"/><rect x="174" y="93" width="92" height="52" rx="6" class="c-frontend" data-animate="node" style="--step:1" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(180 99) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g><text data-detail-anchor x="220" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Chat Surface</text><text data-detail="context" x="220" y="131" class="t-muted" font-size="8" text-anchor="middle">thread + files</text></g>@@ -3839,6 +3960,9 @@<title>Final Reply · answer + changes · User Interface › Execute + report</title><rect x="579" y="93" width="92" height="52" rx="6" class="c-mask"/><rect x="579" y="93" width="92" height="52" rx="6" class="c-backend" data-animate="node" style="--step:7" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(585 99) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g><text data-detail-anchor x="625" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Final Reply</text><text data-detail="context" x="625" y="131" class="t-muted" font-size="8" text-anchor="middle">answer + changes</text></g>@@ -3847,6 +3971,9 @@<title>Agent Planner · plan next step · Agent Runtime › Planning loop › Plan + route · context aware</title><rect x="254" y="209" width="92" height="68" rx="6" class="c-mask"/><rect x="254" y="209" width="92" height="68" rx="6" class="c-backend" data-animate="node" style="--step:2" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(260 215) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g><text data-detail-anchor x="300" y="230" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Agent Planner</text><text data-detail="context" x="300" y="247" class="t-muted" font-size="8" text-anchor="middle">plan next step</text><text data-detail="fine" x="300" y="265" class="t-backend" font-size="7" text-anchor="middle">context aware</text>@@ -3856,6 +3983,9 @@<title>Tool Router · choose capability · Agent Runtime › Planning loop › Plan + route</title><rect x="384" y="217" width="92" height="52" rx="6" class="c-mask"/><rect x="384" y="217" width="92" height="52" rx="6" class="c-backend" data-animate="node" style="--step:3" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(390 223) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g><text data-detail-anchor x="430" y="238" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Router</text><text data-detail="context" x="430" y="255" class="t-muted" font-size="8" text-anchor="middle">choose capability</text></g>@@ -3864,6 +3994,10 @@<title>Approval Gate · scope + consent · Policy Boundary › Plan + route · block risky ops</title><rect x="384" y="333" width="92" height="68" rx="6" class="c-mask"/><rect x="384" y="333" width="92" height="68" rx="6" class="c-security" data-animate="node" style="--step:4" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(390 339) scale(0.6875)">+ <path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>+ <path d="m5.8 8 1.5 1.5 3-3"/>+ </g><text data-detail-anchor x="430" y="354" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Approval Gate</text><text data-detail="context" x="430" y="371" class="t-muted" font-size="8" text-anchor="middle">scope + consent</text><text data-detail="fine" x="430" y="389" class="t-security" font-size="7" text-anchor="middle">block risky ops</text>@@ -3873,6 +4007,10 @@<title>Blocked · wait or reject · Exception Handling › Human or policy stop › Execute + report</title><rect x="454" y="465" width="92" height="52" rx="6" class="c-mask"/><rect x="454" y="465" width="92" height="52" rx="6" class="c-security" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(460 471) scale(0.6875)">+ <path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>+ <path d="m5.8 8 1.5 1.5 3-3"/>+ </g><text data-detail-anchor x="500" y="486" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Blocked</text><text data-detail="context" x="500" y="503" class="t-muted" font-size="8" text-anchor="middle">wait or reject</text></g>@@ -3881,6 +4019,12 @@<title>Retry Path · revise request · Exception Handling › Human or policy stop › Execute + report</title><rect x="579" y="465" width="92" height="52" rx="6" class="c-mask"/><rect x="579" y="465" width="92" height="52" rx="6" class="c-messagebus" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(585 471) scale(0.6875)">+ <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>+ <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>+ <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>+ <circle cx="7" cy="11.5" r="1" class="sigil-fill"/>+ </g><text data-detail-anchor x="625" y="486" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Retry Path</text><text data-detail="context" x="625" y="503" class="t-muted" font-size="8" text-anchor="middle">revise request</text></g>@@ -3889,6 +4033,12 @@<title>Tool Call · shell / browser / MCP · Tool Execution › Tool work › Execute + report · structured result</title><rect x="454" y="581" width="92" height="68" rx="6" class="c-mask"/><rect x="454" y="581" width="92" height="68" rx="6" class="c-messagebus" data-animate="node" style="--step:5" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(460 587) scale(0.6875)">+ <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>+ <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>+ <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>+ <circle cx="7" cy="11.5" r="1" class="sigil-fill"/>+ </g><text data-detail-anchor x="500" y="602" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Call</text><text data-detail="context" x="500" y="619" class="t-muted" font-size="8" text-anchor="middle">shell / browser / MCP</text><text data-detail="fine" x="500" y="637" class="t-messagebus" font-size="7" text-anchor="middle">structured result</text>@@ -3898,6 +4048,9 @@<title>External API · network service · Tool Execution › Tool work › Execute + report</title><rect x="579" y="589" width="92" height="52" rx="6" class="c-mask"/><rect x="579" y="589" width="92" height="52" rx="6" class="c-cloud" data-animate="node" style="--step:6" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(585 595) scale(0.6875)">+ <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>+ </g><text data-detail-anchor x="625" y="610" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">External API</text><text data-detail="context" x="625" y="627" class="t-muted" font-size="8" text-anchor="middle">network service</text></g>@@ -3906,6 +4059,10 @@<title>Context Store · repo + memory · Observability › Intake</title><rect x="174" y="713" width="92" height="52" rx="6" class="c-mask"/><rect x="174" y="713" width="92" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(180 719) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ </g><text data-detail-anchor x="220" y="734" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Context Store</text><text data-detail="context" x="220" y="751" class="t-muted" font-size="8" text-anchor="middle">repo + memory</text></g>@@ -3914,6 +4071,10 @@<title>Trace Log · events + output · Observability › Execute + report</title><rect x="454" y="713" width="92" height="52" rx="6" class="c-mask"/><rect x="454" y="713" width="92" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(460 719) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ </g><text data-detail-anchor x="500" y="734" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Trace Log</text><text data-detail="context" x="500" y="751" class="t-muted" font-size="8" text-anchor="middle">events + output</text></g>@@ -4026,7 +4187,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4176,15 +4337,59 @@<!-- Footer --><p class="footer">- Workflow diagram • Built with Archify<span class="no-print"> • Hover to trace • <kbd>R</kbd> route • Click to focus • <kbd>+</kbd>/<kbd>−</kbd> zoom • <kbd>M</kbd> radar • <kbd>[</kbd>/<kbd>]</kbd> views • <kbd>P</kbd> play story • <kbd>T</kbd> theme • <kbd>E</kbd> export</span>+ Workflow diagram • Built with Archify<span class="no-print"> • <a class="artifact-start-link" href="https://tt-a1i.github.io/archify/start.html?type=workflow" target="_blank" rel="noopener noreferrer">Create yours ↗</a> • Hover to trace • <kbd>R</kbd> route • Click to focus • <kbd>+</kbd>/<kbd>−</kbd> zoom • <kbd>M</kbd> radar • <kbd>[</kbd>/<kbd>]</kbd> views • <kbd>P</kbd> play story • <kbd>T</kbd> theme • <kbd>E</kbd> export</span></p></div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -4300,12 +4505,8 @@scale = scale || 1;opts = opts || {};var autoTheme = opts.autoTheme === true;- var motionExport = opts.motion === true;-var svg = document.querySelector('.diagram-container svg');var clone = svg.cloneNode(true);- if (motionExport) clone.setAttribute('data-motion-export', 'true');- else clone.removeAttribute('data-motion-export');// View transforms and neighborhood focus are HTML exploration state,// never part of a downloaded full-diagram artifact.@@ -4340,7 +4541,7 @@Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-preview-role]'), function (el) {el.removeAttribute('data-chapter-preview-role');});- Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay]'), function (el) {+ Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay]'), function (el) {el.remove();});Array.prototype.forEach.call(clone.querySelectorAll('[data-intent-trace-overlay]'), function (el) {@@ -4450,7 +4651,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;// Scale width/height so the browser rasterizes the vectors at target@@ -4676,9 +4877,11 @@}// Record the live CSS animation without Puppeteer, ffmpeg, or a network- // dependency. The serialized SVG keeps Archify's animation keyframes;- // one Image instance advances its timeline while each frame is painted- // into a MediaRecorder-backed canvas.+ // dependency. SVG files loaded through Image are commonly rasterized as+ // one cached bitmap, so repeatedly drawing that Image does not reliably+ // advance its CSS animation. Keep one crisp static SVG background, then+ // render an explicit time-varying signal scene over the real authored+ // relationship geometry on every captured canvas frame.function recordWebm(options) {options = options || {};if (!canRecordMotion()) {@@ -4689,12 +4892,161 @@var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var scale = Math.min(1, 1280 / vb.width);- var data = serializeSvg(scale, { motion: true });+ var data = serializeSvg(scale);var sourceUrl = URL.createObjectURL(new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' }));+ function createMotionScene(root) {+ var rootMatrix = root.getCTM ? root.getCTM() : null;++ function pointInRoot(element, point) {+ if (!rootMatrix || !element.getCTM || !point.matrixTransform) return { x: point.x, y: point.y };+ try {+ var elementMatrix = element.getCTM();+ if (!elementMatrix) return { x: point.x, y: point.y };+ var mapped = point.matrixTransform(rootMatrix.inverse().multiply(elementMatrix));+ return { x: mapped.x, y: mapped.y };+ } catch (_) {+ return { x: point.x, y: point.y };+ }+ }++ function samplesFor(element) {+ if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];+ var length;+ try { length = element.getTotalLength(); } catch (_) { return []; }+ if (!Number.isFinite(length) || length <= 0) return [];+ var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));+ var points = [];+ for (var i = 0; i <= count; i++) {+ points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));+ }+ return points;+ }++ function authoredStep(element, fallback) {+ var raw = element.style.getPropertyValue('--step') || getComputedStyle(element).getPropertyValue('--step');+ var value = Number(raw);+ return Number.isFinite(value) ? value : fallback;+ }++ var edges = Array.prototype.slice.call(root.querySelectorAll('[data-animate="edge"]')).map(function (element, index) {+ var computed = getComputedStyle(element);+ return {+ points: samplesFor(element),+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ width: Math.max(1.5, parseFloat(computed.strokeWidth) || 1.5),+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(function (edge) { return edge.points.length > 1; });++ var nodes = Array.prototype.slice.call(root.querySelectorAll('[data-node-id][data-animate="node"]')).map(function (element, index) {+ var box;+ try { box = element.getBBox(); } catch (_) { return null; }+ var painted = element.querySelector('[class*="c-"]') || element;+ var computed = getComputedStyle(painted);+ return {+ x: box.x,+ y: box.y,+ width: box.width,+ height: box.height,+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(Boolean);++ return { edges: edges, nodes: nodes, x: vb.x, y: vb.y, width: vb.width, height: vb.height };+ }++ function pointAlong(points, progress) {+ var scaled = Math.max(0, Math.min(1, progress)) * (points.length - 1);+ var index = Math.min(points.length - 2, Math.floor(scaled));+ var mix = scaled - index;+ return {+ x: points[index].x + (points[index + 1].x - points[index].x) * mix,+ y: points[index].y + (points[index + 1].y - points[index].y) * mix+ };+ }++ function roundedRectPath(ctx, x, y, width, height, radius) {+ var r = Math.max(0, Math.min(radius, width / 2, height / 2));+ ctx.beginPath();+ ctx.moveTo(x + r, y);+ ctx.lineTo(x + width - r, y);+ ctx.quadraticCurveTo(x + width, y, x + width, y + r);+ ctx.lineTo(x + width, y + height - r);+ ctx.quadraticCurveTo(x + width, y + height, x + width - r, y + height);+ ctx.lineTo(x + r, y + height);+ ctx.quadraticCurveTo(x, y + height, x, y + height - r);+ ctx.lineTo(x, y + r);+ ctx.quadraticCurveTo(x, y, x + r, y);+ ctx.closePath();+ }++ function drawMotionFrame(ctx, backgroundImage, motionScene, elapsed) {+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.drawImage(backgroundImage, 0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.save();+ ctx.scale(ctx.canvas.width / motionScene.width, ctx.canvas.height / motionScene.height);+ ctx.translate(-motionScene.x, -motionScene.y);++ motionScene.edges.forEach(function (edge) {+ var duration = 1.75;+ var progress = (elapsed - edge.delay) / duration;+ if (progress < 0 || progress > 1) return;+ var head = Math.max(0, Math.min(1, progress));+ var tail = Math.max(0, head - 0.24);+ var opacity = Math.sin(Math.PI * Math.min(1, progress));++ ctx.save();+ ctx.strokeStyle = edge.color;+ ctx.fillStyle = edge.color;+ ctx.lineCap = 'round';+ ctx.lineJoin = 'round';+ ctx.lineWidth = Math.max(3.2, edge.width * 2.2);+ ctx.globalAlpha = 0.42 + opacity * 0.5;+ ctx.shadowColor = edge.color;+ ctx.shadowBlur = 10;+ ctx.beginPath();+ for (var i = 0; i <= 14; i++) {+ var trailPoint = pointAlong(edge.points, tail + (head - tail) * i / 14);+ if (i === 0) ctx.moveTo(trailPoint.x, trailPoint.y);+ else ctx.lineTo(trailPoint.x, trailPoint.y);+ }+ ctx.stroke();++ var point = pointAlong(edge.points, head);+ ctx.globalAlpha = 0.95;+ ctx.beginPath();+ ctx.arc(point.x, point.y, 4.8, 0, Math.PI * 2);+ ctx.fill();+ ctx.restore();+ });++ motionScene.nodes.forEach(function (node) {+ var progress = (elapsed - node.delay) / 2.6;+ if (progress < 0 || progress > 1) return;+ var pulse = Math.sin(Math.PI * progress);+ if (pulse <= 0.02) return;+ ctx.save();+ ctx.strokeStyle = node.color;+ ctx.lineWidth = 1.4 + pulse * 1.8;+ ctx.globalAlpha = pulse * 0.5;+ ctx.shadowColor = node.color;+ ctx.shadowBlur = 12 * pulse;+ var inset = 2 + pulse * 3;+ roundedRectPath(ctx, node.x - inset, node.y - inset, node.width + inset * 2, node.height + inset * 2, 8);+ ctx.stroke();+ ctx.restore();+ });++ ctx.restore();+ }++ var motionScene = createMotionScene(svg);+return new Promise(function (resolve, reject) {- var img = new Image();- img.onload = function () {+ var backgroundImage = new Image();+ backgroundImage.onload = function () {var canvas = document.createElement('canvas');canvas.width = Math.max(2, Math.round(data.width / 2) * 2);canvas.height = Math.max(2, Math.round(data.height / 2) * 2);@@ -4713,6 +5065,7 @@var chunks = [];var raf = 0;var stopped = false;+ var startedAt = performance.now();function cleanup() {if (stopped) return;stopped = true;@@ -4720,9 +5073,9 @@URL.revokeObjectURL(sourceUrl);stream.getTracks().forEach(function (track) { track.stop(); });}- function draw() {- ctx.clearRect(0, 0, canvas.width, canvas.height);- ctx.drawImage(img, 0, 0, canvas.width, canvas.height);+ function draw(now) {+ var elapsed = Math.max(0, ((Number(now) || performance.now()) - startedAt) / 1000);+ drawMotionFrame(ctx, backgroundImage, motionScene, elapsed);raf = requestAnimationFrame(draw);}recorder.ondataavailable = function (event) {@@ -4738,8 +5091,10 @@if (!blob.size) reject(new Error('MediaRecorder produced an empty WebM'));else resolve(blob);};- draw();+ drawMotionFrame(ctx, backgroundImage, motionScene, 0);recorder.start(250);+ startedAt = performance.now();+ raf = requestAnimationFrame(draw);setTimeout(function () {if (recorder.state === 'inactive') return;// Chromium normally emits the final chunk during stop(), but@@ -4752,11 +5107,11 @@}, 120);}, duration);};- img.onerror = function () {+ backgroundImage.onerror = function () {URL.revokeObjectURL(sourceUrl);- reject(new Error('Animated SVG could not be loaded for WebM export'));+ reject(new Error('SVG background could not be loaded for WebM export'));};- img.src = sourceUrl;+ backgroundImage.src = sourceUrl;});}@@ -5466,6 +5821,99 @@clone.setAttribute('pathLength', '1');return clone;}+ function relationshipTokenKind(edge) {+ var shapes = relationshipEdgeShapes(edge);+ var classEvidence = [edge.getAttribute('class') || ''].concat(shapes.map(function (shape) {+ return shape.getAttribute('class') || '';+ })).join(' ');+ var from = edge.getAttribute('data-edge-from') || '';+ var to = edge.getAttribute('data-edge-to') || '';+ var source = nodes().find(function (node) { return node.getAttribute('data-node-id') === from; });+ var target = nodes().find(function (node) { return node.getAttribute('data-node-id') === to; });+ var sourceKind = source ? source.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ var targetKind = target ? target.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ if (/\ba-security\b/.test(classEvidence) || sourceKind === 'security' || targetKind === 'security' || targetKind === 'failure') return 'security';+ if (/\ba-dashed\b/.test(classEvidence) || sourceKind === 'messagebus' || targetKind === 'messagebus') return 'event';+ if (sourceKind === 'database' || targetKind === 'database') return 'data';+ if (targetKind === 'waiting' || targetKind === 'success') return 'state';+ return 'call';+ }+ function relationshipTokenPath(shape) {+ if (!shape) return '';+ var tagName = String(shape.tagName || '').toLowerCase();+ if (tagName === 'path') return shape.getAttribute('d') || '';+ if (tagName === 'line') {+ return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') ++ ' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');+ }+ if (tagName === 'polyline' && shape.points && shape.points.numberOfItems > 1) {+ var commands = [];+ for (var i = 0; i < shape.points.numberOfItems; i += 1) {+ var point = shape.points.getItem(i);+ commands.push((i === 0 ? 'M ' : 'L ') + point.x + ' ' + point.y);+ }+ return commands.join(' ');+ }+ return '';+ }+ function relationshipTokenPart(tagName, className, attrs) {+ var part = document.createElementNS(svgNamespace, tagName);+ part.setAttribute('class', className);+ Object.keys(attrs || {}).forEach(function (name) { part.setAttribute(name, attrs[name]); });+ return part;+ }+ function relationshipTokenGeometry(shape, kind, key, options) {+ options = options || {};+ var pathData = relationshipTokenPath(shape);+ if (!pathData) return null;+ var token = document.createElementNS(svgNamespace, 'g');+ token.setAttribute('class', 'semantic-flow-token ' + (options.className || 'relationship-flow-token'));+ token.setAttribute('data-token-kind', kind);+ token.setAttribute('data-token-edge-key', key);+ token.setAttribute('aria-hidden', 'true');+ token.appendChild(relationshipTokenPart('circle', 'semantic-flow-token-halo', { cx: '0', cy: '0', r: '7' }));+ if (kind === 'data') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-5', y: '-4', width: '10', height: '8', rx: '2' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -2.8 -1.2 h 5.6 M -2.8 1.4 h 3.8' }));+ } else if (kind === 'event') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-7', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-2', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '3', y: '-3', width: '4', height: '6', rx: '1' }));+ } else if (kind === 'security') {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-shape', { d: 'M 0 -5 L 4 -3.4 V 0 c 0 3 -1.6 4.5 -4 5.5 C -2.4 4.5 -4 3 -4 0 v -3.4 Z' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'm -2 .2 1.4 1.4 L 2 -1.4' }));+ } else if (kind === 'state') {+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-shape', { cx: '0', cy: '0', r: '5' }));+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-dot', { cx: '0', cy: '0', r: '1.35' }));+ } else {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -5 -3 L -1 0 L -5 3 M 0 -3 L 4 0 L 0 3' }));+ }+ var motion = document.createElementNS(svgNamespace, 'animateMotion');+ motion.setAttribute('path', pathData);+ motion.setAttribute('dur', options.duration || '1.2s');+ motion.setAttribute('begin', '0s');+ motion.setAttribute('fill', 'freeze');+ motion.setAttribute('rotate', 'auto');+ motion.setAttribute('calcMode', 'spline');+ motion.setAttribute('keyTimes', '0;1');+ motion.setAttribute('keySplines', '.2 0 .2 1');+ token.appendChild(motion);+ return token;+ }+ function createSemanticFlowToken(edge, shape, options) {+ if (!edge || !shape) return null;+ var key = edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ return relationshipTokenGeometry(shape, relationshipTokenKind(edge), key, options);+ }+ Archify.flowTokens = {+ create: createSemanticFlowToken,+ kind: function (edge) { return relationshipTokenKind(edge); },+ path: relationshipTokenPath+ };function renderRelationshipPulse(key) {removeRelationshipPulse();if (!key || document.documentElement.getAttribute('data-embed') === 'true') return false;@@ -5480,12 +5928,23 @@overlay.setAttribute('data-relationship-pulse-overlay', '');overlay.setAttribute('data-relationship-pulse-key', key);overlay.setAttribute('aria-hidden', 'true');+ var tokenAdded = false;matchingEdges.forEach(function (edge) {var wrapper = document.createElementNS(svgNamespace, 'g');if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));- relationshipEdgeShapes(edge).forEach(function (shape) {+ var shapes = relationshipEdgeShapes(edge);+ shapes.forEach(function (shape) {wrapper.appendChild(relationshipPulseGeometry(shape));});+ if (!tokenAdded && shapes.length) {+ var tokenKind = relationshipTokenKind(edge);+ var token = relationshipTokenGeometry(shapes[0], tokenKind, key);+ if (token) {+ wrapper.appendChild(token);+ overlay.setAttribute('data-relationship-token-kind', tokenKind);+ tokenAdded = true;+ }+ }if (wrapper.childNodes.length) overlay.appendChild(wrapper);});if (!overlay.childNodes.length) return false;@@ -6407,6 +6866,7 @@var momentRestoreGeneration = 0;var storySteps = [];var storyPulseOwnerToken = 0;+ var storyPulseGeneration = 0;var autoplayPending = false;var VIEW_INTERVAL_MS = 3200;var STORY_FOLLOW_MIN_DWELL_MS = 1100;@@ -6932,6 +7392,22 @@);}+ function uniqueStoryEdges(edgeList) {+ var positions = {};+ var unique = [];+ edgeList.forEach(function (edge) {+ var key = storyEdgeKey(edge);+ if (!Object.prototype.hasOwnProperty.call(positions, key)) {+ positions[key] = unique.length;+ unique.push(edge);+ return;+ }+ var index = positions[key];+ if (!storyGeometry(unique[index]).length && storyGeometry(edge).length) unique[index] = edge;+ });+ return unique;+ }+function storyStep(view, index, edgeList, byId) {var id = view.focus[index];var node = byId[id];@@ -6946,6 +7422,8 @@else if (from === id && to === previousId) reverse.push(edge);});}+ forward = uniqueStoryEdges(forward);+ reverse = uniqueStoryEdges(reverse);var edges = forward.concat(reverse).sort(function (left, right) {return edgeList.indexOf(left) - edgeList.indexOf(right);});@@ -7116,7 +7594,8 @@function storyMotionAllowed() {if (document.hidden || reducedMotion()) return false;if (document.documentElement.getAttribute('data-motion') !== 'live') return false;- if (document.documentElement.getAttribute('data-embed') === 'true') return false;+ if (document.documentElement.getAttribute('data-embed') === 'true' &&+ document.documentElement.getAttribute('data-share-playback') !== 'true') return false;if (window.matchMedia && window.matchMedia('print').matches) return false;return !(Archify.motionGovernor && Archify.motionGovernor.isPaused());}@@ -7130,9 +7609,13 @@function clearStoryPulse(options) {options = options || {};+ storyPulseGeneration += 1;Array.prototype.forEach.call(svg.querySelectorAll('.story-trail-flow[data-story-pulse]'), function (flow) {flow.removeAttribute('data-story-pulse');});+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-carrier-overlay]'), function (overlay) {+ overlay.remove();+ });if (storyPulseOwnerToken && options.release !== false && Archify.motionGovernor) {var token = storyPulseOwnerToken;storyPulseOwnerToken = 0;@@ -7145,14 +7628,41 @@if (!step || (step.relation !== 'forward' && step.relation !== 'reverse') || step.edges.length !== 1 || !storyMotionAllowed()) return false;var flows = Array.prototype.slice.call(svg.querySelectorAll('.story-trail-flow[data-story-beat-step="' + step.index + '"]'));if (!flows.length) return false;+ var pulseGeneration = storyPulseGeneration;if (Archify.motionGovernor && Archify.motionGovernor.capable) {storyPulseOwnerToken = Archify.motionGovernor.claim('story', function () {clearStoryPulse({ release: false });});}flows.forEach(function (flow) { flow.setAttribute('data-story-pulse', 'true'); });+ if (Archify.flowTokens && typeof Archify.flowTokens.create === 'function') {+ var edge = step.edges[0];+ var shapes = storyGeometry(edge);+ var carrier = shapes.length ? Archify.flowTokens.create(edge, shapes[0], {+ className: 'story-flow-token',+ duration: '0.78s'+ }) : null;+ if (carrier) {+ var carrierOverlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ var carrierWrapper = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ carrierOverlay.setAttribute('class', 'story-carrier-overlay');+ carrierOverlay.setAttribute('data-story-carrier-overlay', '');+ carrierOverlay.setAttribute('aria-hidden', 'true');+ if (edge.hasAttribute('transform')) carrierWrapper.setAttribute('transform', edge.getAttribute('transform'));+ carrier.setAttribute('data-story-carrier-token', '');+ carrier.setAttribute('data-story-beat-step', String(step.index));+ carrierWrapper.appendChild(carrier);+ carrierOverlay.appendChild(carrierWrapper);+ var firstNode = svg.querySelector('[data-node-id]');+ while (firstNode && firstNode.parentNode !== svg) firstNode = firstNode.parentNode;+ if (firstNode) svg.insertBefore(carrierOverlay, firstNode);+ else svg.appendChild(carrierOverlay);+ }+ }void flows[0].getBoundingClientRect();- flows[0].addEventListener('animationend', function () { clearStoryPulse(); }, { once: true });+ flows[0].addEventListener('animationend', function () {+ if (pulseGeneration === storyPulseGeneration) clearStoryPulse();+ }, { once: true });return true;}@@ -10770,6 +11280,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -10785,6 +11296,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -10851,9 +11363,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -10877,6 +11390,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/archify/test/motion-governor.test.mjs b/archify/test/motion-governor.test.mjsindex 6f506f14..e3d21630 100644--- a/archify/test/motion-governor.test.mjs+++ b/archify/test/motion-governor.test.mjs@@ -100,7 +100,7 @@ test('motion control is mobile-contained, embed-safe, and export-neutral', () =>assert.match(html, /\.toolbar #btn-motion\[hidden\] \{ display: none !important; \}/);assert.match(html, /\.toolbar button \{[\s\S]*?min-height: 2\.75rem;/);assert.match(html, /@media \(max-width: 360px\) \{[\s\S]*?\.toolbar #btn-motion \{ min-width: 4\.4rem;/);- assert.match(html, /#theme-label, #present-label \{ display: none; \}/);+ assert.match(html, /#theme-label, #preset-label, #present-label \{ display: none; \}/);assert.match(html, /html\[data-embed="true"\] \.diagram-container::before/);assert.match(html, /html\[data-share-playback="true"\] \.diagram-container::before/);assert.match(html, /Still also parks bounded[\s\S]*?viewer signals without discarding their static meaning/);diff --git a/archify/test/preset-tryon.test.mjs b/archify/test/preset-tryon.test.mjsnew file mode 100644index 00000000..ecc2868f--- /dev/null+++ b/archify/test/preset-tryon.test.mjs@@ -0,0 +1,77 @@+import { test } from 'node:test';+import assert from 'node:assert/strict';+import { execFileSync } from 'node:child_process';+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { fileURLToPath } from 'node:url';++const __dirname = path.dirname(fileURLToPath(import.meta.url));+const skillRoot = path.resolve(__dirname, '..');+const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-preset-tryon-'));++const CASES = {+ architecture: 'web-app.architecture.json',+ workflow: 'agent-tool-call.workflow.json',+ sequence: 'cache-miss-request.sequence.json',+ dataflow: 'product-analytics.dataflow.json',+ lifecycle: 'agent-run.lifecycle.json',+};++function render(mode, preset = 'classic') {+ const source = JSON.parse(fs.readFileSync(path.join(skillRoot, 'examples', CASES[mode]), 'utf8'));+ source.meta.visual_preset = preset;+ source.meta.animation = 'none';+ const input = path.join(tmp, `${mode}-${preset}.json`);+ const output = path.join(tmp, `${mode}-${preset}.html`);+ fs.writeFileSync(input, JSON.stringify(source));+ execFileSync(process.execPath, [path.join(skillRoot, `renderers/${mode}/render-${mode}.mjs`), input, output]);+ return fs.readFileSync(output, 'utf8');+}++function svgBlock(html) {+ return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';+}++function presetRuntime(html) {+ return html.match(/Archify\.preset = \(function \(\) \{[\s\S]*?\n \}\)\(\);/)?.[0] || '';+}++test('all five renderers expose one reader-controlled visual style cycle', () => {+ for (const mode of Object.keys(CASES)) {+ const html = render(mode);+ assert.match(html, /id="btn-preset"/, mode);+ assert.match(html, /id="preset-label"/, mode);+ assert.match(html, /title="Cycle visual style \(S\)"/, mode);+ assert.match(html, /Archify\.preset = \(function \(\)/, mode);+ assert.match(html, /S -> cycle visual style/, mode);+ }+});++test('style cycle synchronizes page and canonical SVG without touching geometry', () => {+ const html = render('architecture');+ const runtime = presetRuntime(html);+ assert.match(runtime, /\['classic', 'signal-flow', 'blueprint'\]/);+ assert.match(runtime, /html\.setAttribute\('data-preset', preset\)/);+ assert.match(runtime, /svg\.setAttribute\('data-preset', preset\)/);+ assert.match(runtime, /data-preset-option/);+ assert.match(runtime, /return \{ cycle: cycle, apply: apply, current: current, authored: authored \}/);+});++test('style try-on is session-only and unavailable to passive embeds', () => {+ const html = render('workflow', 'signal-flow');+ const runtime = presetRuntime(html);+ assert.match(runtime, /html\.getAttribute\('data-embed'\) === 'true'/);+ assert.doesNotMatch(runtime, /localStorage|sessionStorage|history\.|location\.|URLSearchParams/);+ assert.match(html, /html\[data-embed="true"\] \.toolbar/);+ assert.match(html, /@media print/);+});++test('same topology keeps identical canonical SVG geometry across all three styles', () => {+ const normalize = (svg) => svg.replace(/ data-preset="(?:classic|signal-flow|blueprint)"/, '');+ const variants = ['classic', 'signal-flow', 'blueprint'].map((preset) => normalize(svgBlock(render('architecture', preset))));+ assert.equal(variants[1], variants[0]);+ assert.equal(variants[2], variants[0]);+});++process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/docs/assets/archify-live-proof.gif b/docs/assets/archify-live-proof.gifindex a98d48f3..41174311 100644Binary files a/docs/assets/archify-live-proof.gif and b/docs/assets/archify-live-proof.gif differdiff --git a/docs/assets/archify-live-proof.json b/docs/assets/archify-live-proof.jsonindex 6e8707a9..8ee11989 100644--- a/docs/assets/archify-live-proof.json+++ b/docs/assets/archify-live-proof.json@@ -7,13 +7,13 @@"fps": 10,"frameCount": 54,"durationSeconds": 5.4,- "bytes": 1578140,- "sha256": "9337067319c49ec350f117bf8c54f33aa1ca5468d54833cf8a1e6a4336c33259",+ "bytes": 1647952,+ "sha256": "0dc62a4a68ca9588a45ad66c14a16ee238bebe1e74ebc441b0c03bc0ba150e1d","scenes": [{"id": "signal-flow","artifact": "docs/gallery/artifacts/agent-tool-call.workflow.html",- "artifactSha256": "a41b7bd3264eb856deccbaeb45c75a79fa0d085ca0bca9adc60c280aedd8ac80",+ "artifactSha256": "7030e966ff2ec006bf91d01cb43f7732000f1fd9dcc6a1c6ba22a0508e29db6b","view": "happy-path","eyebrow": "WORKFLOW · SIGNAL FLOW","title": "Agent Tool Call",@@ -22,7 +22,7 @@{"id": "blueprint","artifact": "docs/gallery/artifacts/production-deployment.architecture.html",- "artifactSha256": "355624a26ea10022ed6431782f405aaca21f873e548d61e6798766efd75b7f1e",+ "artifactSha256": "bdf341257335aa276fab40603a1578ac3803fa5c053a97b30b94d5b234930673","view": "request-boundary","eyebrow": "ARCHITECTURE · BLUEPRINT","title": "Production Deployment",@@ -31,7 +31,7 @@{"id": "classic","artifact": "docs/gallery/artifacts/cache-miss.sequence.html",- "artifactSha256": "61129906351bf7614b4df987c30135250cc5ac3a80937277fdd68368964e27b8",+ "artifactSha256": "44cc75f18b23e227ccc6adf18277f3601891071c73f332522f53970391d6e993","view": "cache-fallback","eyebrow": "SEQUENCE · CLASSIC","title": "Cache Miss Request",diff --git a/docs/gallery.html b/docs/gallery.htmlindex f877027a..0f62ef97 100644--- a/docs/gallery.html+++ b/docs/gallery.html@@ -324,7 +324,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">12N · 11E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="a41b7bd3264eb856deccbaeb45c75a79fa0d085ca0bca9adc60c280aedd8ac80">a41b7bd3264e</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="7030e966ff2ec006bf91d01cb43f7732000f1fd9dcc6a1c6ba22a0508e29db6b">7030e966ff2e</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/agent-tool-call.workflow.html?present=1&play=1#view=happy-path" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -352,7 +352,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">12N · 12E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="355624a26ea10022ed6431782f405aaca21f873e548d61e6798766efd75b7f1e">355624a26ea1</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="bdf341257335aa276fab40603a1578ac3803fa5c053a97b30b94d5b234930673">bdf341257335</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/production-deployment.architecture.html?present=1&play=1#view=request-boundary" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -380,7 +380,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">7N · 12E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="61129906351bf7614b4df987c30135250cc5ac3a80937277fdd68368964e27b8">61129906351b</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="44cc75f18b23e227ccc6adf18277f3601891071c73f332522f53970391d6e993">44cc75f18b23</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/cache-miss.sequence.html?present=1&play=1#view=cache-fallback" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -408,7 +408,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 10E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="cd293817b9dc6c2e0eeb922dbc53d8cadd246eaff963e660b644f8ddd1f76606">cd293817b9dc</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="7ed68a3f5367319e2ed70b05494a9da5563a2d5c3324f6854353952d1240814d">7ed68a3f5367</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/release-delivery.workflow.html?present=1&play=1#view=approval-to-production" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -436,7 +436,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">11N · 10E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="835e9d74936f7f8dd83f259af0b0d6761e1be246a4d25d97a6123a3bba477c8f">835e9d74936f</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="268db60a80c94d059a8cf4b078efc82c73e44491f65c82059123efe681b43a47">268db60a80c9</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/incident-response.workflow.html?present=1&play=1#view=mitigate-and-verify" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -464,7 +464,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 10E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="dedcec651c4584c432f84ee900c04024493c1ad8ad03ef9c49c7730e3ee9ea58">dedcec651c45</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="05a9a8480f66bc519a0797a74b7444ed44e6d9bca6d90594c2f1fe000c5d27a2">05a9a8480f66</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/product-analytics.dataflow.html?present=1&play=1#view=consent-boundary" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -492,7 +492,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">7N · 14E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="756a9b92babcf0461e695bfb8b9d1b093b457dc589e131319cbe6e6dced87a60">756a9b92babc</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="aef9e8aa67247ff4099dccc3a77667d2682ad0d817539d52596d3a50b937581a">aef9e8aa6724</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/async-job-roundtrip.sequence.html?present=1&play=1#view=work-and-retry" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -520,7 +520,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">12N · 12E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="d460f50fdb8bc8b15c5398fcc17ee36c705f56b4c4310f9f815127519d305294">d460f50fdb8b</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="41f72c50c240c6e4bacca143f36d0441d6ce875c69ebf8e254a2b7fcfc0596b4">41f72c50c240</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/event-stream.dataflow.html?present=1&play=1#view=order-transit" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -548,7 +548,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 5E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="57dbf98d59f143794517a68e9b3992797c21802570b1bc2ecf54db1b0f1a55ca">57dbf98d59f1</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="db2a78f58c8029b33ec7735d27838ff7a174690badc87b68afdbf5ef534fb87f">db2a78f58c80</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/agent-run.lifecycle.html?present=1&play=1#view=main-lifecycle" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -576,7 +576,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">11N · 6E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="54270818ccff68c210e397e4110eb2b0be89a7eac8d5829de7227d7c27edf815">54270818ccff</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="3053aafdb595dced900356b8aad708f8c840bf2545506a88e4cee0cfe647b13e">3053aafdb595</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/deployment-release.lifecycle.html?present=1&play=1#view=rollback-outcomes" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -604,7 +604,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 9E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="97778db6ffc40c103f412796ef396237ba8357d37c50cb9cac20bbccaa6c0f21">97778db6ffc4</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="f6b9effa5287cc22e0f012280ba0f3d72684ab39092f0ce34673a86dc504a359">f6b9effa5287</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/web-app.architecture.html?present=1&play=1#view=request-path" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -681,8 +681,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 12,"edgeCount": 11,- "artifactBytes": 528253,- "artifactSha256": "a41b7bd3264eb856deccbaeb45c75a79fa0d085ca0bca9adc60c280aedd8ac80",+ "artifactBytes": 531692,+ "artifactSha256": "7030e966ff2ec006bf91d01cb43f7732000f1fd9dcc6a1c6ba22a0508e29db6b","sourceBytes": 6470,"sourceSha256": "a3afc6b30044eb256aa15c6195ddfbbcd1a14880d99967ed5605bc621ffb7e5f","checks": [@@ -772,8 +772,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 12,"edgeCount": 12,- "artifactBytes": 527409,- "artifactSha256": "355624a26ea10022ed6431782f405aaca21f873e548d61e6798766efd75b7f1e",+ "artifactBytes": 530848,+ "artifactSha256": "bdf341257335aa276fab40603a1578ac3803fa5c053a97b30b94d5b234930673","sourceBytes": 5308,"sourceSha256": "c3c4ddc8fd8910d8d2bcf2ba97434017d6fa347eb4ee436d2fb519dd0f27c814","checks": [@@ -863,8 +863,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 7,"edgeCount": 12,- "artifactBytes": 521900,- "artifactSha256": "61129906351bf7614b4df987c30135250cc5ac3a80937277fdd68368964e27b8",+ "artifactBytes": 525339,+ "artifactSha256": "44cc75f18b23e227ccc6adf18277f3601891071c73f332522f53970391d6e993","sourceBytes": 4442,"sourceSha256": "30098d81006a18813bab447da698edf74604a1463770f01dc056b0af8cb314ef","checks": [@@ -954,8 +954,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 10,"edgeCount": 10,- "artifactBytes": 524519,- "artifactSha256": "cd293817b9dc6c2e0eeb922dbc53d8cadd246eaff963e660b644f8ddd1f76606",+ "artifactBytes": 527958,+ "artifactSha256": "7ed68a3f5367319e2ed70b05494a9da5563a2d5c3324f6854353952d1240814d","sourceBytes": 5256,"sourceSha256": "44aa56ac6ca807937dfe84a6404e8b07d6394a38ae2ac53248a1985337dfd671","checks": [@@ -1045,8 +1045,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 11,"edgeCount": 10,- "artifactBytes": 524377,- "artifactSha256": "835e9d74936f7f8dd83f259af0b0d6761e1be246a4d25d97a6123a3bba477c8f",+ "artifactBytes": 527816,+ "artifactSha256": "268db60a80c94d059a8cf4b078efc82c73e44491f65c82059123efe681b43a47","sourceBytes": 5471,"sourceSha256": "9beb8698b275679a2fc92d4b51288cd5b5fc2115696d06b9168f3d7fef253a72","checks": [@@ -1136,8 +1136,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 10,"edgeCount": 10,- "artifactBytes": 525910,- "artifactSha256": "dedcec651c4584c432f84ee900c04024493c1ad8ad03ef9c49c7730e3ee9ea58",+ "artifactBytes": 529349,+ "artifactSha256": "05a9a8480f66bc519a0797a74b7444ed44e6d9bca6d90594c2f1fe000c5d27a2","sourceBytes": 5719,"sourceSha256": "f71c89288f80255bdedcdc0057bcbc155d1d8b1b7476d024b35f4e27c730c974","checks": [@@ -1227,8 +1227,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 7,"edgeCount": 14,- "artifactBytes": 522685,- "artifactSha256": "756a9b92babcf0461e695bfb8b9d1b093b457dc589e131319cbe6e6dced87a60",+ "artifactBytes": 526124,+ "artifactSha256": "aef9e8aa67247ff4099dccc3a77667d2682ad0d817539d52596d3a50b937581a","sourceBytes": 4483,"sourceSha256": "1b53d7c4ce7b2d8f6f40b8f33a394abe1d37fc991272b534c1ccd0255920ab52","checks": [@@ -1318,8 +1318,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 12,"edgeCount": 12,- "artifactBytes": 529917,- "artifactSha256": "d460f50fdb8bc8b15c5398fcc17ee36c705f56b4c4310f9f815127519d305294",+ "artifactBytes": 533356,+ "artifactSha256": "41f72c50c240c6e4bacca143f36d0441d6ce875c69ebf8e254a2b7fcfc0596b4","sourceBytes": 5528,"sourceSha256": "6541e9d00ea1efc38e4afc9c1cb4bbbea6e4468781e64da43ad9787cd6d51efc","checks": [@@ -1409,8 +1409,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 10,"edgeCount": 5,- "artifactBytes": 518855,- "artifactSha256": "57dbf98d59f143794517a68e9b3992797c21802570b1bc2ecf54db1b0f1a55ca",+ "artifactBytes": 522294,+ "artifactSha256": "db2a78f58c8029b33ec7735d27838ff7a174690badc87b68afdbf5ef534fb87f","sourceBytes": 4353,"sourceSha256": "1d6b34282e014cb2730662b1993158ec67bc0ad2a40520cb441aaee1ad21e4c6","checks": [@@ -1500,8 +1500,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 11,"edgeCount": 6,- "artifactBytes": 520232,- "artifactSha256": "54270818ccff68c210e397e4110eb2b0be89a7eac8d5829de7227d7c27edf815",+ "artifactBytes": 523671,+ "artifactSha256": "3053aafdb595dced900356b8aad708f8c840bf2545506a88e4cee0cfe647b13e","sourceBytes": 4394,"sourceSha256": "aa614f0c9a82f210e301e382f362dfbd7f290bda4d5501de3c99a6cd81b4c0a4","checks": [@@ -1591,8 +1591,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>"animation": "static","nodeCount": 10,"edgeCount": 9,- "artifactBytes": 519864,- "artifactSha256": "97778db6ffc40c103f412796ef396237ba8357d37c50cb9cac20bbccaa6c0f21",+ "artifactBytes": 523303,+ "artifactSha256": "f6b9effa5287cc22e0f012280ba0f3d72684ab39092f0ce34673a86dc504a359","sourceBytes": 3863,"sourceSha256": "01567b5e49cad5139baa071533a028d22f0e80fedfb49095e0d9330aee7f87db","checks": [diff --git a/docs/gallery/artifacts/agent-run.lifecycle.html b/docs/gallery/artifacts/agent-run.lifecycle.htmlindex ae6c6be9..0b09fa6b 100644--- a/docs/gallery/artifacts/agent-run.lifecycle.html+++ b/docs/gallery/artifacts/agent-run.lifecycle.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4084,7 +4110,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4236,10 +4262,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11130,6 +11200,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11145,6 +11216,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11211,9 +11283,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11237,6 +11310,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/docs/gallery/artifacts/agent-tool-call.workflow.html b/docs/gallery/artifacts/agent-tool-call.workflow.htmlindex 5636950a..75895bb0 100644--- a/docs/gallery/artifacts/agent-tool-call.workflow.html+++ b/docs/gallery/artifacts/agent-tool-call.workflow.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4161,7 +4187,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4316,10 +4342,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11210,6 +11280,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11225,6 +11296,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11291,9 +11363,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11317,6 +11390,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/docs/gallery/artifacts/async-job-roundtrip.sequence.html b/docs/gallery/artifacts/async-job-roundtrip.sequence.htmlindex 0de84daf..b0efedf8 100644--- a/docs/gallery/artifacts/async-job-roundtrip.sequence.html+++ b/docs/gallery/artifacts/async-job-roundtrip.sequence.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4151,7 +4177,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4303,10 +4329,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11197,6 +11267,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11212,6 +11283,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11278,9 +11350,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11304,6 +11377,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/docs/gallery/artifacts/cache-miss.sequence.html b/docs/gallery/artifacts/cache-miss.sequence.htmlindex 4da7ab5f..e47ebef4 100644--- a/docs/gallery/artifacts/cache-miss.sequence.html+++ b/docs/gallery/artifacts/cache-miss.sequence.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4135,7 +4161,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4287,10 +4313,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11181,6 +11251,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11196,6 +11267,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11262,9 +11334,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11288,6 +11361,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/docs/gallery/artifacts/deployment-release.lifecycle.html b/docs/gallery/artifacts/deployment-release.lifecycle.htmlindex 046345a8..158f4a79 100644--- a/docs/gallery/artifacts/deployment-release.lifecycle.html+++ b/docs/gallery/artifacts/deployment-release.lifecycle.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4098,7 +4124,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4250,10 +4276,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11144,6 +11214,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11159,6 +11230,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11225,9 +11297,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11251,6 +11324,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/docs/gallery/artifacts/event-stream.dataflow.html b/docs/gallery/artifacts/event-stream.dataflow.htmlindex c28bc0a7..020cdc2d 100644--- a/docs/gallery/artifacts/event-stream.dataflow.html+++ b/docs/gallery/artifacts/event-stream.dataflow.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4170,7 +4196,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4322,10 +4348,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11216,6 +11286,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11231,6 +11302,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11297,9 +11369,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11323,6 +11396,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/docs/gallery/artifacts/incident-response.workflow.html b/docs/gallery/artifacts/incident-response.workflow.htmlindex b1cbf2e2..874df100 100644--- a/docs/gallery/artifacts/incident-response.workflow.html+++ b/docs/gallery/artifacts/incident-response.workflow.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4133,7 +4159,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4285,10 +4311,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11179,6 +11249,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11194,6 +11265,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11260,9 +11332,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11286,6 +11359,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/docs/gallery/artifacts/product-analytics.dataflow.html b/docs/gallery/artifacts/product-analytics.dataflow.htmlindex 9fcf73cd..4d4db825 100644--- a/docs/gallery/artifacts/product-analytics.dataflow.html+++ b/docs/gallery/artifacts/product-analytics.dataflow.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4131,7 +4157,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4283,10 +4309,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11177,6 +11247,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11192,6 +11263,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11258,9 +11330,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11284,6 +11357,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/docs/gallery/artifacts/production-deployment.architecture.html b/docs/gallery/artifacts/production-deployment.architecture.htmlindex e84c5607..1c5d9444 100644--- a/docs/gallery/artifacts/production-deployment.architecture.html+++ b/docs/gallery/artifacts/production-deployment.architecture.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4150,7 +4176,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4302,10 +4328,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11196,6 +11266,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11211,6 +11282,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11277,9 +11349,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11303,6 +11376,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/docs/gallery/artifacts/release-delivery.workflow.html b/docs/gallery/artifacts/release-delivery.workflow.htmlindex 2ea3b87c..f87dfaa0 100644--- a/docs/gallery/artifacts/release-delivery.workflow.html+++ b/docs/gallery/artifacts/release-delivery.workflow.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4133,7 +4159,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4285,10 +4311,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11179,6 +11249,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11194,6 +11265,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11260,9 +11332,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11286,6 +11359,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/docs/gallery/artifacts/web-app.architecture.html b/docs/gallery/artifacts/web-app.architecture.htmlindex 63e2d407..b64147bc 100644--- a/docs/gallery/artifacts/web-app.architecture.html+++ b/docs/gallery/artifacts/web-app.architecture.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4102,7 +4128,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4252,10 +4278,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11146,6 +11216,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11161,6 +11232,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11227,9 +11299,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11253,6 +11326,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/docs/gallery/manifest.json b/docs/gallery/manifest.jsonindex bf564874..77ea1493 100644--- a/docs/gallery/manifest.json+++ b/docs/gallery/manifest.json@@ -26,8 +26,8 @@"animation": "trace","nodeCount": 12,"edgeCount": 11,- "artifactBytes": 528253,- "artifactSha256": "a41b7bd3264eb856deccbaeb45c75a79fa0d085ca0bca9adc60c280aedd8ac80",+ "artifactBytes": 531692,+ "artifactSha256": "7030e966ff2ec006bf91d01cb43f7732000f1fd9dcc6a1c6ba22a0508e29db6b","sourceBytes": 6470,"sourceSha256": "a3afc6b30044eb256aa15c6195ddfbbcd1a14880d99967ed5605bc621ffb7e5f","checks": [@@ -117,8 +117,8 @@"animation": "trace","nodeCount": 12,"edgeCount": 12,- "artifactBytes": 527409,- "artifactSha256": "355624a26ea10022ed6431782f405aaca21f873e548d61e6798766efd75b7f1e",+ "artifactBytes": 530848,+ "artifactSha256": "bdf341257335aa276fab40603a1578ac3803fa5c053a97b30b94d5b234930673","sourceBytes": 5308,"sourceSha256": "c3c4ddc8fd8910d8d2bcf2ba97434017d6fa347eb4ee436d2fb519dd0f27c814","checks": [@@ -208,8 +208,8 @@"animation": "trace","nodeCount": 7,"edgeCount": 12,- "artifactBytes": 521900,- "artifactSha256": "61129906351bf7614b4df987c30135250cc5ac3a80937277fdd68368964e27b8",+ "artifactBytes": 525339,+ "artifactSha256": "44cc75f18b23e227ccc6adf18277f3601891071c73f332522f53970391d6e993","sourceBytes": 4442,"sourceSha256": "30098d81006a18813bab447da698edf74604a1463770f01dc056b0af8cb314ef","checks": [@@ -299,8 +299,8 @@"animation": "trace","nodeCount": 10,"edgeCount": 10,- "artifactBytes": 524519,- "artifactSha256": "cd293817b9dc6c2e0eeb922dbc53d8cadd246eaff963e660b644f8ddd1f76606",+ "artifactBytes": 527958,+ "artifactSha256": "7ed68a3f5367319e2ed70b05494a9da5563a2d5c3324f6854353952d1240814d","sourceBytes": 5256,"sourceSha256": "44aa56ac6ca807937dfe84a6404e8b07d6394a38ae2ac53248a1985337dfd671","checks": [@@ -390,8 +390,8 @@"animation": "trace","nodeCount": 11,"edgeCount": 10,- "artifactBytes": 524377,- "artifactSha256": "835e9d74936f7f8dd83f259af0b0d6761e1be246a4d25d97a6123a3bba477c8f",+ "artifactBytes": 527816,+ "artifactSha256": "268db60a80c94d059a8cf4b078efc82c73e44491f65c82059123efe681b43a47","sourceBytes": 5471,"sourceSha256": "9beb8698b275679a2fc92d4b51288cd5b5fc2115696d06b9168f3d7fef253a72","checks": [@@ -481,8 +481,8 @@"animation": "trace","nodeCount": 10,"edgeCount": 10,- "artifactBytes": 525910,- "artifactSha256": "dedcec651c4584c432f84ee900c04024493c1ad8ad03ef9c49c7730e3ee9ea58",+ "artifactBytes": 529349,+ "artifactSha256": "05a9a8480f66bc519a0797a74b7444ed44e6d9bca6d90594c2f1fe000c5d27a2","sourceBytes": 5719,"sourceSha256": "f71c89288f80255bdedcdc0057bcbc155d1d8b1b7476d024b35f4e27c730c974","checks": [@@ -572,8 +572,8 @@"animation": "trace","nodeCount": 7,"edgeCount": 14,- "artifactBytes": 522685,- "artifactSha256": "756a9b92babcf0461e695bfb8b9d1b093b457dc589e131319cbe6e6dced87a60",+ "artifactBytes": 526124,+ "artifactSha256": "aef9e8aa67247ff4099dccc3a77667d2682ad0d817539d52596d3a50b937581a","sourceBytes": 4483,"sourceSha256": "1b53d7c4ce7b2d8f6f40b8f33a394abe1d37fc991272b534c1ccd0255920ab52","checks": [@@ -663,8 +663,8 @@"animation": "trace","nodeCount": 12,"edgeCount": 12,- "artifactBytes": 529917,- "artifactSha256": "d460f50fdb8bc8b15c5398fcc17ee36c705f56b4c4310f9f815127519d305294",+ "artifactBytes": 533356,+ "artifactSha256": "41f72c50c240c6e4bacca143f36d0441d6ce875c69ebf8e254a2b7fcfc0596b4","sourceBytes": 5528,"sourceSha256": "6541e9d00ea1efc38e4afc9c1cb4bbbea6e4468781e64da43ad9787cd6d51efc","checks": [@@ -754,8 +754,8 @@"animation": "trace","nodeCount": 10,"edgeCount": 5,- "artifactBytes": 518855,- "artifactSha256": "57dbf98d59f143794517a68e9b3992797c21802570b1bc2ecf54db1b0f1a55ca",+ "artifactBytes": 522294,+ "artifactSha256": "db2a78f58c8029b33ec7735d27838ff7a174690badc87b68afdbf5ef534fb87f","sourceBytes": 4353,"sourceSha256": "1d6b34282e014cb2730662b1993158ec67bc0ad2a40520cb441aaee1ad21e4c6","checks": [@@ -845,8 +845,8 @@"animation": "trace","nodeCount": 11,"edgeCount": 6,- "artifactBytes": 520232,- "artifactSha256": "54270818ccff68c210e397e4110eb2b0be89a7eac8d5829de7227d7c27edf815",+ "artifactBytes": 523671,+ "artifactSha256": "3053aafdb595dced900356b8aad708f8c840bf2545506a88e4cee0cfe647b13e","sourceBytes": 4394,"sourceSha256": "aa614f0c9a82f210e301e382f362dfbd7f290bda4d5501de3c99a6cd81b4c0a4","checks": [@@ -936,8 +936,8 @@"animation": "static","nodeCount": 10,"edgeCount": 9,- "artifactBytes": 519864,- "artifactSha256": "97778db6ffc40c103f412796ef396237ba8357d37c50cb9cac20bbccaa6c0f21",+ "artifactBytes": 523303,+ "artifactSha256": "f6b9effa5287cc22e0f012280ba0f3d72684ab39092f0ce34673a86dc504a359","sourceBytes": 3863,"sourceSha256": "01567b5e49cad5139baa071533a028d22f0e80fedfb49095e0d9330aee7f87db","checks": [diff --git a/examples/archify-repo-grid.html b/examples/archify-repo-grid.htmlindex c440d692..473965b6 100644--- a/examples/archify-repo-grid.html+++ b/examples/archify-repo-grid.html@@ -1,9 +1,9 @@<!DOCTYPE html>-<html lang="en" data-theme="dark">+<html lang="en" data-theme="dark" data-preset="classic"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">- <meta name="generator" content="archify 2.9.0">+ <meta name="generator" content="archify 2.11.0"><title>Archify Pipeline Diagram</title><script>// Resolve the theme before first paint so light-preference users don't@@ -14,6 +14,12 @@try {var param = new URLSearchParams(window.location.search).get('theme');if (param === 'light' || param === 'dark') theme = param;+ if (new URLSearchParams(window.location.search).get('embed') === '1') {+ document.documentElement.setAttribute('data-embed', 'true');+ }+ if (new URLSearchParams(window.location.search).get('present') === '1') {+ document.documentElement.setAttribute('data-present', 'true');+ }} catch (_) {}if (!theme) {try { theme = localStorage.getItem('archify-theme'); } catch (_) {}@@ -121,6 +127,150 @@--toolbar-menu-bg: #ffffff;}+ /* ==========================================================+ SIGNAL FLOW — an opt-in, motion-forward visual preset.+ The variables also target a standalone exported SVG, whose+ root carries data-preset and data-theme directly.+ ========================================================== */+ [data-preset="signal-flow"][data-theme="dark"] {+ --bg: #030711;+ --grid: #15233a;+ --panel: rgba(6, 14, 28, 0.78);+ --panel-border: #1d3350;+ --lane-fill: rgba(9, 22, 40, 0.5);+ --lane-stroke: #2c4564;+ --text: #f5fbff;+ --text-muted: #9eb0c7;+ --text-dim: #52667f;+ --text-faint: #7890ad;+ --mask: #07101e;+ --frontend-fill: rgba(6, 182, 212, 0.14);+ --frontend-stroke: #67e8f9;+ --backend-fill: rgba(16, 185, 129, 0.14);+ --backend-stroke: #5eead4;+ --database-fill: rgba(139, 92, 246, 0.16);+ --database-stroke: #c4b5fd;+ --cloud-fill: rgba(245, 158, 11, 0.13);+ --cloud-stroke: #fcd34d;+ --security-fill: rgba(244, 63, 94, 0.13);+ --security-stroke: #fda4af;+ --messagebus-fill: rgba(249, 115, 22, 0.13);+ --messagebus-stroke: #fdba74;+ --external-fill: rgba(71, 85, 105, 0.24);+ --external-stroke: #a5b4c7;+ --arrow: #7890ad;+ --arrow-emphasis: #2dd4bf;+ --toolbar-bg: rgba(7, 16, 30, 0.86);+ --toolbar-border: #29415f;+ --toolbar-menu-bg: #07101e;+ }++ [data-preset="signal-flow"][data-theme="light"] {+ --bg: #f4f9fc;+ --grid: #d4e5ee;+ --panel: rgba(255, 255, 255, 0.82);+ --panel-border: #bfd5e2;+ --lane-fill: rgba(232, 243, 248, 0.62);+ --lane-stroke: #a9c5d5;+ --text: #102638;+ --text-muted: #587287;+ --text-dim: #8aa2b4;+ --text-faint: #668397;+ --mask: #ffffff;+ --frontend-fill: rgba(6, 182, 212, 0.09);+ --frontend-stroke: #0789a1;+ --backend-fill: rgba(5, 150, 105, 0.09);+ --backend-stroke: #087f69;+ --database-fill: rgba(124, 58, 237, 0.09);+ --database-stroke: #7254c7;+ --cloud-fill: rgba(217, 119, 6, 0.08);+ --cloud-stroke: #b9670b;+ --security-fill: rgba(225, 29, 72, 0.08);+ --security-stroke: #c53a59;+ --messagebus-fill: rgba(234, 88, 12, 0.08);+ --messagebus-stroke: #c65f27;+ --external-fill: rgba(100, 116, 139, 0.1);+ --external-stroke: #607a8c;+ --arrow: #7b97aa;+ --arrow-emphasis: #0d9488;+ }++ /* ==========================================================+ BLUEPRINT — a review-first drafting preset for deployment,+ infrastructure, and technical design documentation. It keeps+ the same semantic palette and geometry while trading glow for+ precise grid contrast, squared materials, and drafting marks.+ ========================================================== */+ [data-preset="blueprint"][data-theme="dark"] {+ --bg: #06131f;+ --grid: #17425a;+ --panel: rgba(7, 27, 43, 0.9);+ --panel-border: #27627f;+ --lane-fill: rgba(10, 43, 66, 0.36);+ --lane-stroke: #34799a;+ --text: #e3f6ff;+ --text-muted: #91b8ca;+ --text-dim: #557e92;+ --text-faint: #739caf;+ --mask: #0a2031;+ --frontend-fill: rgba(26, 157, 193, 0.14);+ --frontend-stroke: #66d9ef;+ --backend-fill: rgba(31, 155, 124, 0.13);+ --backend-stroke: #69dfbd;+ --database-fill: rgba(120, 105, 196, 0.14);+ --database-stroke: #b4a8ff;+ --cloud-fill: rgba(197, 145, 43, 0.13);+ --cloud-stroke: #ffd166;+ --security-fill: rgba(199, 76, 104, 0.13);+ --security-stroke: #ff8da1;+ --messagebus-fill: rgba(207, 112, 49, 0.13);+ --messagebus-stroke: #ffad66;+ --external-fill: rgba(84, 119, 139, 0.18);+ --external-stroke: #a7cad9;+ --arrow: #78a3b7;+ --arrow-emphasis: #64dfc1;+ --toolbar-bg: rgba(7, 28, 45, 0.92);+ --toolbar-border: #34799a;+ --toolbar-text: #d8f3ff;+ --toolbar-hover: rgba(18, 58, 83, 0.95);+ --toolbar-menu-bg: #0a2031;+ }++ [data-preset="blueprint"][data-theme="light"] {+ --bg: #edf7fa;+ --grid: #b5d5e1;+ --panel: rgba(249, 253, 255, 0.94);+ --panel-border: #78aabd;+ --lane-fill: rgba(210, 232, 240, 0.42);+ --lane-stroke: #83b2c4;+ --text: #123344;+ --text-muted: #4e7486;+ --text-dim: #86a6b4;+ --text-faint: #668c9d;+ --mask: #f9fdff;+ --frontend-fill: rgba(8, 145, 178, 0.08);+ --frontend-stroke: #087f9c;+ --backend-fill: rgba(5, 128, 101, 0.08);+ --backend-stroke: #08755f;+ --database-fill: rgba(100, 75, 180, 0.08);+ --database-stroke: #6757a8;+ --cloud-fill: rgba(181, 120, 15, 0.08);+ --cloud-stroke: #a86609;+ --security-fill: rgba(190, 48, 80, 0.07);+ --security-stroke: #b32f50;+ --messagebus-fill: rgba(196, 81, 22, 0.07);+ --messagebus-stroke: #b65120;+ --external-fill: rgba(79, 112, 128, 0.08);+ --external-stroke: #506f7e;+ --arrow: #6d93a5;+ --arrow-emphasis: #087f69;+ --toolbar-bg: rgba(247, 252, 254, 0.94);+ --toolbar-border: #8ab5c5;+ --toolbar-text: #294f61;+ --toolbar-hover: #ffffff;+ --toolbar-menu-bg: #f9fdff;+ }+* { margin: 0; padding: 0; box-sizing: border-box; }body {@@ -132,9 +282,233 @@transition: background 0.2s ease, color 0.2s ease;}+ html[data-preset="signal-flow"] body {+ background-image:+ radial-gradient(circle at 18% -8%, rgba(34, 211, 238, 0.14), transparent 34rem),+ radial-gradient(circle at 92% 18%, rgba(139, 92, 246, 0.12), transparent 30rem);+ background-attachment: fixed;+ }+ html[data-preset="signal-flow"][data-theme="light"] body {+ background-image:+ radial-gradient(circle at 18% -8%, rgba(6, 182, 212, 0.12), transparent 34rem),+ radial-gradient(circle at 92% 18%, rgba(139, 92, 246, 0.08), transparent 30rem);+ }+ html[data-preset="blueprint"] body {+ background-image:+ linear-gradient(var(--grid) 1px, transparent 1px),+ linear-gradient(90deg, var(--grid) 1px, transparent 1px);+ background-size: 32px 32px;+ background-position: -1px -1px;+ background-attachment: fixed;+ }++ /* Gallery/embed mode keeps the generated artifact as the source of truth+ while presenting only its diagram surface inside a proof card. */+ html[data-embed="true"] body {+ min-height: 0;+ padding: 0;+ overflow: hidden;+ background: var(--bg);+ background-image: none;+ }+ html[data-embed="true"] .toolbar,+ html[data-embed="true"] .header,+ html[data-embed="true"] .cards,+ html[data-embed="true"] .footer,+ html[data-embed="true"] .diagram-nav,+ html[data-embed="true"] .overview-map,+ html[data-embed="true"] .focus-chip,+ html[data-embed="true"] .route-probe,+ html[data-embed="true"] .semantic-lens,+ html[data-embed="true"] .diagram-guide,+ html[data-embed="true"] .node-finder,+ html[data-embed="true"] .guided-views { display: none !important; }+ html[data-embed="true"] .container { max-width: none; }+ html[data-embed="true"] .diagram-container {+ padding: 0.5rem;+ border: 0;+ border-radius: 0;+ box-shadow: none;+ }+ html[data-embed="true"] .diagram-container svg { min-width: 0; }++ /* Share Chapter Cue lives in the HTML viewer layer, not inside the SVG.+ It gives one-shot embeds a title, authored note, truthful stop order,+ and lifecycle state while canonical diagram geometry stays untouched. */+ .share-chapter-cue { display: none; }+ html[data-embed="true"][data-share-playback="true"] .share-chapter-cue:not([hidden]),+ html[data-embed="true"][data-share-moment="true"] .share-chapter-cue:not([hidden]) {+ position: absolute;+ z-index: 18;+ top: 0.85rem;+ left: 50%;+ display: grid;+ grid-template-columns: auto minmax(9rem, 13.5rem) minmax(0, 1fr);+ align-items: center;+ gap: 0.45rem 0.85rem;+ width: min(52rem, calc(100% - 1.5rem));+ min-height: 3.35rem;+ padding: 0.55rem 0.75rem 0.65rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 42%, var(--toolbar-border));+ border-radius: 0.75rem;+ background:+ linear-gradient(115deg, color-mix(in srgb, var(--frontend-fill) 52%, transparent), transparent 45%),+ color-mix(in srgb, var(--toolbar-menu-bg) 92%, transparent);+ color: var(--toolbar-text);+ box-shadow: 0 14px 42px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.045);+ backdrop-filter: blur(16px);+ pointer-events: none;+ animation: archify-share-cue-enter 280ms cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ html[data-preset="blueprint"] .share-chapter-cue {+ border-radius: 0.2rem;+ background:+ linear-gradient(90deg, color-mix(in srgb, var(--frontend-fill) 46%, transparent), transparent 36%),+ var(--toolbar-menu-bg);+ box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);+ backdrop-filter: none;+ }+ .share-chapter-index {+ display: grid;+ gap: 0.12rem;+ min-width: 5rem;+ padding-right: 0.75rem;+ border-right: 1px solid var(--toolbar-border);+ }+ .share-chapter-state {+ display: inline-flex;+ align-items: center;+ gap: 0.36rem;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.14em;+ text-transform: uppercase;+ }+ .share-chapter-state::before {+ width: 0.38rem;+ height: 0.38rem;+ border-radius: 50%;+ background: currentColor;+ box-shadow: 0 0 10px currentColor;+ content: '';+ }+ .share-chapter-cue[data-state="playing"] .share-chapter-state::before {+ animation: archify-share-cue-pulse 1.15s ease-in-out infinite;+ }+ .share-chapter-count {+ color: var(--text-faint);+ font-size: 0.5rem;+ font-weight: 700;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ }+ .share-chapter-copy { min-width: 0; }+ .share-chapter-copy strong,+ .share-chapter-copy small,+ .share-chapter-route {+ display: block;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .share-chapter-copy strong {+ color: var(--toolbar-text);+ font-size: 0.6875rem;+ line-height: 1.35;+ }+ .share-chapter-copy small {+ margin-top: 0.08rem;+ color: var(--text-muted);+ font-size: 0.5rem;+ line-height: 1.35;+ }+ .share-chapter-route {+ color: color-mix(in srgb, var(--frontend-stroke) 76%, var(--text-muted));+ font-size: 0.5625rem;+ font-weight: 650;+ letter-spacing: 0.015em;+ text-align: right;+ }+ .share-chapter-progress {+ position: absolute;+ right: 0;+ bottom: 0;+ left: 0;+ height: 2px;+ overflow: hidden;+ background: color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ }+ .share-chapter-progress span {+ display: block;+ width: 100%;+ height: 100%;+ background: linear-gradient(90deg, var(--frontend-stroke), var(--database-stroke));+ box-shadow: 0 0 12px var(--frontend-stroke);+ transform: scaleX(0);+ transform-origin: left center;+ }++ /* Presentation Stage is a viewer-only layer: it gives the live diagram+ the viewport while keeping guided views, theme, focus, and exports real.+ Embed mode wins when both query parameters are present. */+ html[data-present="true"]:not([data-embed="true"]) body {+ height: 100dvh;+ min-height: 0;+ padding: 1rem;+ overflow: hidden;+ }+ html[data-present="true"]:not([data-embed="true"]) .container {+ display: flex;+ flex-direction: column;+ gap: 0.75rem;+ width: 100%;+ max-width: none;+ height: calc(100dvh - 2rem);+ }+ html[data-present="true"]:not([data-embed="true"]) .header {+ flex: none;+ min-width: 0;+ margin: 0;+ padding-right: 23rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .header-row { margin-bottom: 0.25rem; }+ html[data-present="true"]:not([data-embed="true"]) .subtitle {+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ html[data-present="true"]:not([data-embed="true"]) .guided-views {+ flex: none;+ margin-bottom: 0;+ }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container {+ display: flex;+ flex: 1 1 auto;+ align-items: center;+ justify-content: center;+ min-height: 0;+ padding: 0.75rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container > svg {+ width: 100%;+ height: 100%;+ min-width: 0;+ }+ html[data-present="true"]:not([data-embed="true"]) .cards,+ html[data-present="true"]:not([data-embed="true"]) .footer { display: none; }+ html[data-present="true"]:not([data-embed="true"]) #btn-present {+ border-color: var(--frontend-stroke);+ color: var(--frontend-stroke);+ }+.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }++ html[data-preset="signal-flow"] .header,+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -148,9 +522,11 @@height: 12px;background: var(--frontend-stroke);border-radius: 50%;- animation: pulse 2s infinite;+ animation: none;}+ html[data-motion-capable="true"] .pulse-dot { animation: pulse 2s infinite; }+@keyframes pulse {0%, 100% { opacity: 1; }50% { opacity: 0.5; }@@ -168,337 +544,3240 @@margin-left: 1.75rem;}+ html[data-preset="signal-flow"] .header-row::after {+ content: "SIGNAL FLOW";+ margin-left: auto;+ color: var(--frontend-stroke);+ border: 1px solid var(--frontend-stroke);+ border-radius: 999px;+ padding: 0.28rem 0.6rem;+ font-size: 0.625rem;+ letter-spacing: 0.12em;+ opacity: 0.82;+ box-shadow: 0 0 20px rgba(34, 211, 238, 0.12);+ white-space: nowrap;+ }++ html[data-preset="blueprint"] .pulse-dot {+ width: 10px;+ height: 10px;+ border: 1px solid var(--frontend-stroke);+ border-radius: 1px;+ background: transparent;+ box-shadow: inset 0 0 0 2px var(--bg);+ transform: rotate(45deg);+ animation: none;+ }+ html[data-preset="blueprint"] .header-row::after {+ content: "BLUEPRINT / REV 01";+ margin-left: auto;+ padding: 0.28rem 0.55rem;+ border-top: 1px solid var(--frontend-stroke);+ border-bottom: 1px solid var(--frontend-stroke);+ color: var(--frontend-stroke);+ font-size: 0.5625rem;+ font-weight: 700;+ letter-spacing: 0.14em;+ white-space: nowrap;+ }+.diagram-container {background: var(--panel);border-radius: 1rem;border: 1px solid var(--panel-border);padding: 1.5rem;- overflow-x: auto;+ overflow: hidden;+ position: relative;}- svg {- width: 100%;- min-width: min(900px, 100%);- display: block;+ html[data-preset="signal-flow"] .diagram-container {+ position: relative;+ overflow: hidden;+ background: linear-gradient(180deg, rgba(8, 20, 38, 0.82), rgba(3, 8, 18, 0.94));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 28px 80px rgba(0, 0, 0, 0.34);}-- .cards {- display: grid;- grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));- gap: 1rem;- margin-top: 2rem;+ html[data-preset="signal-flow"][data-theme="light"] .diagram-container {+ background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(237, 246, 250, 0.94));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 24px 60px rgba(45, 78, 99, 0.12);}-- .card {+ html[data-preset="blueprint"] .diagram-container {+ border-color: var(--panel-border);+ border-radius: 0.35rem;background: var(--panel);- border-radius: 0.75rem;- border: 1px solid var(--panel-border);- padding: 1.25rem;+ box-shadow:+ inset 0 0 0 1px color-mix(in srgb, var(--panel-border) 34%, transparent),+ 0 18px 48px rgba(0, 0, 0, 0.16);}-- .card-header {- display: flex;- align-items: center;- gap: 0.5rem;- margin-bottom: 0.75rem;+ html[data-preset="blueprint"] .diagram-container::after {+ content: "";+ position: absolute;+ z-index: 10;+ inset: 0.7rem;+ pointer-events: none;+ background:+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left top / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left top / 1px 1.35rem no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right top / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right top / 1px 1.35rem no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left bottom / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left bottom / 1px 1.35rem no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right bottom / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right bottom / 1px 1.35rem no-repeat;+ opacity: 0.58;}-- .card-dot {- width: 8px;- height: 8px;- border-radius: 50%;+ html[data-motion-capable="true"][data-preset="signal-flow"][data-ambient-motion="running"] .diagram-container::before {+ content: "";+ position: absolute;+ inset: 0;+ pointer-events: none;+ background: linear-gradient(115deg, transparent 28%, rgba(103, 232, 249, 0.035) 48%, transparent 68%);+ transform: translateX(-70%);+ animation: archify-signal-scan 4.8s ease-in-out 1 both;}- .card-dot.cyan { background: var(--frontend-stroke); }- .card-dot.emerald { background: var(--backend-stroke); }- .card-dot.violet { background: var(--database-stroke); }- .card-dot.amber { background: var(--cloud-stroke); }- .card-dot.rose { background: var(--security-stroke); }- .card-dot.orange { background: var(--messagebus-stroke); }- .card-dot.slate { background: var(--external-stroke); }-- .card h3 { font-size: 0.875rem; font-weight: 600; color: var(--text); }-- .card ul {- list-style: none;- color: var(--text-muted);- font-size: 0.75rem;+ /* Motion Governor gives the reader a real static state and gives the+ strongest semantic action the only motion budget. Atmosphere resets to+ its authored base instead of freezing mid-cycle. Static artifacts never+ start a decorative pulse or scan. */+ html:not([data-motion-capable="true"]) svg[data-animation="trace"] [data-animate] {+ animation: none !important;}-- .card li { margin-bottom: 0.375rem; }-- .footer {- text-align: center;- margin-top: 1.5rem;- color: var(--text-faint);- font-size: 0.75rem;+ html[data-motion="still"] .pulse-dot,+ html[data-motion="still"] .diagram-container::before,+ html[data-motion="still"] svg[data-animation="trace"] [data-animate],+ html[data-motion-owner] .pulse-dot,+ html[data-motion-owner] .diagram-container::before,+ html[data-motion-owner] svg[data-animation="trace"] [data-animate],+ html[data-embed="true"] .pulse-dot,+ html[data-embed="true"] .diagram-container::before,+ html[data-share-playback="true"] .pulse-dot,+ html[data-share-playback="true"] .diagram-container::before,+ html[data-document-hidden="true"] .pulse-dot,+ html[data-document-hidden="true"] .diagram-container::before,+ html[data-document-hidden="true"] svg[data-animation="trace"] [data-animate] {+ animation: none !important;+ }+ html[data-motion="still"] .diagram-container::before,+ html[data-motion-owner] .diagram-container::before,+ html[data-embed="true"] .diagram-container::before,+ html[data-share-playback="true"] .diagram-container::before {+ opacity: 0;+ }+ html[data-motion="still"] .guided-view-progress span,+ html[data-motion="still"] .guided-story-caption,+ html[data-motion="still"] .story-trail-flow,+ html[data-motion="still"] .intent-trace-flow,+ html[data-motion="still"] .route-probe-flow,+ html[data-motion="still"] .route-journey-flow,+ html[data-motion="still"] .semantic-lens-flow,+ html[data-motion="still"] .diagram-guide,+ html[data-motion="still"] [data-story-step],+ html[data-motion="still"] .overview-map-live,+ html[data-motion="still"] .guided-view-stop,+ html[data-motion="still"] .share-chapter-cue,+ html[data-motion="still"] .share-chapter-state::before,+ html[data-motion="still"] .share-chapter-progress span,+ html[data-document-hidden="true"] .guided-view-progress span,+ html[data-document-hidden="true"] .story-trail-flow,+ html[data-document-hidden="true"] .intent-trace-flow,+ html[data-document-hidden="true"] .route-probe-flow,+ html[data-document-hidden="true"] .route-journey-flow,+ html[data-document-hidden="true"] .semantic-lens-flow,+ html[data-document-hidden="true"] .diagram-guide,+ html[data-document-hidden="true"] [data-story-step],+ html[data-document-hidden="true"] .overview-map-live,+ html[data-document-hidden="true"] .guided-view-stop,+ html[data-document-hidden="true"] .share-chapter-cue,+ html[data-document-hidden="true"] .share-chapter-state::before,+ html[data-document-hidden="true"] .share-chapter-progress span {+ animation: none !important;+ }+ html[data-motion="still"] .guided-view-progress span {+ transform: scaleX(1) !important;+ }+ html[data-motion="still"] svg[data-story-playing="true"] .story-trail-flow {+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.55;+ }+ html[data-motion="still"] .intent-trace-flow,+ html[data-motion="still"] .route-probe-flow {+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.72;+ }+ html[data-motion="still"] .route-journey-overlay,+ html[data-document-hidden="true"] .route-journey-overlay { display: none !important; }+ html[data-motion="still"] .relationship-pulse-overlay,+ html[data-motion="still"] .story-carrier-overlay,+ html[data-document-hidden="true"] .story-carrier-overlay { display: none !important; }+ html[data-motion="still"] .chapter-handoff-overlay { display: none !important; }+ html[data-motion="still"] .chapter-handoff-anchor { animation: none !important; }+ html[data-motion="still"] .guided-view-chapter,+ html[data-motion="still"] svg [data-node-id],+ html[data-motion="still"] svg [data-edge-from],+ html[data-motion="still"] svg [data-detail],+ html[data-motion="still"] svg [data-detail-anchor],+ html[data-motion="still"] svg [data-legend-hit],+ html[data-motion="still"] svg {+ transition: none !important;}- /* ==========================================================- Print stylesheet — hide interactive controls, force light,- drop the grid so the diagram doesn't waste ink, use landscape- so wide diagrams fit, pack summary cards into 2 columns to- avoid an orphan card on a trailing page.- ========================================================== */- @page { size: landscape; margin: 1.5cm; }+ svg {+ width: 100%;+ min-width: min(900px, 100%);+ display: block;+ transform-origin: 0 0;+ transition: transform 0.18s ease;+ }- @media print {- /* Force the FULL light palette — including component fills/strokes and- lane/arrow colors — so printing from dark theme doesn't put neon- strokes and translucent dark fills on white paper. */- :root, [data-theme="dark"], [data-theme="light"] {- --bg: #ffffff;- --grid: transparent;- --panel: #ffffff;- --panel-border: #e2e8f0;- --text: #0f172a;- --text-muted: #475569;- --text-dim: #94a3b8;- --text-faint: #64748b;- --mask: #ffffff;- --lane-fill: rgba(248, 250, 252, 0.65);- --lane-stroke: #cbd5e1;- --arrow: #94a3b8;- --arrow-emphasis: #059669;- --frontend-fill: rgba(34, 211, 238, 0.15);- --frontend-stroke: #0891b2;- --backend-fill: rgba(52, 211, 153, 0.18);- --backend-stroke: #059669;- --database-fill: rgba(167, 139, 250, 0.2);- --database-stroke: #7c3aed;- --cloud-fill: rgba(251, 191, 36, 0.18);- --cloud-stroke: #d97706;- --security-fill: rgba(251, 113, 133, 0.15);- --security-stroke: #e11d48;- --messagebus-fill: rgba(251, 146, 60, 0.15);- --messagebus-stroke:#ea580c;- --external-fill: rgba(148, 163, 184, 0.18);- --external-stroke: #64748b;- }- body { background: #ffffff !important; padding: 0; }- .container { max-width: none; }- .toolbar, .archify-toast, .no-print { display: none !important; }- .diagram-container, .card { box-shadow: none; border-color: #e2e8f0; }- .cards { grid-template-columns: 1fr 1fr; }- /* Ensure elements break sensibly across pages */- .card { break-inside: avoid; page-break-inside: avoid; }- .diagram-container { break-inside: avoid; page-break-inside: avoid; }- h1, .subtitle { color: #0f172a; }+ .diagram-container.is-camera-moving svg {+ transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);}+ .diagram-container.is-camera-transaction svg { transition: none; }+ .diagram-container.is-pannable { cursor: grab; }+ .diagram-container.is-panning { cursor: grabbing; user-select: none; }+ .diagram-container.is-panning svg { transition: none; }- /* ==========================================================- TOOLBAR (theme toggle + export menu)- ========================================================== */- .toolbar {- position: fixed;- top: 1rem;+ .diagram-nav {+ position: absolute;right: 1rem;- display: flex;- gap: 0.5rem;- z-index: 100;- }- .toolbar button {+ bottom: 1rem;+ z-index: 12;+ display: inline-flex;+ align-items: center;+ padding: 0.25rem;+ gap: 0.2rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.65rem;background: var(--toolbar-bg);+ box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);+ backdrop-filter: blur(10px);+ }+ .diagram-nav button,+ .focus-chip button,+ .guided-views button {+ border: 0;+ background: transparent;color: var(--toolbar-text);- border: 1px solid var(--toolbar-border);- padding: 0.5rem 0.875rem;- border-radius: 0.5rem;- font-family: inherit;- font-size: 0.75rem;- font-weight: 500;+ font: inherit;cursor: pointer;- backdrop-filter: blur(8px);- transition: background 0.15s, border-color 0.15s;- display: inline-flex;- align-items: center;- gap: 0.375rem;}- .toolbar button:hover {- background: var(--toolbar-hover);- border-color: var(--arrow);+ .diagram-nav button {+ min-width: 2rem;+ height: 2rem;+ padding: 0 0.45rem;+ border-radius: 0.4rem;+ font-size: 0.75rem;+ font-weight: 600;}- .toolbar button:focus-visible {+ .diagram-nav button:hover,+ .diagram-nav button:focus-visible,+ .focus-chip button:hover,+ .focus-chip button:focus-visible,+ .guided-views button:hover,+ .guided-views button:focus-visible { background: var(--toolbar-hover); }+ .diagram-nav button:focus-visible,+ .focus-chip button:focus-visible,+ .guided-views button:focus-visible {outline: 2px solid var(--frontend-stroke);- outline-offset: 2px;- }- .toolbar .export-wrap { position: relative; }- .toolbar .export-menu {- position: absolute;- top: calc(100% + 0.375rem);- right: 0;- background: var(--toolbar-menu-bg);- border: 1px solid var(--toolbar-border);- border-radius: 0.5rem;- padding: 0.375rem;- min-width: 160px;- display: none;- flex-direction: column;- box-shadow: 0 4px 20px rgba(0,0,0,0.25);+ outline-offset: 1px;}- .toolbar .export-menu.open { display: flex; }- .toolbar .export-menu button {- background: transparent;- border: 0;- justify-content: space-between;- width: 100%;- text-align: left;- padding: 0.5rem 0.75rem;+ .diagram-nav button:disabled { opacity: 0.38; cursor: default; }+ .diagram-nav [data-view="reset"] { min-width: 3.35rem; font-size: 0.625rem; }+ .diagram-container[data-camera-indicator="true"] .diagram-nav [data-view="reset"] {+ min-width: 5.2rem;+ color: var(--frontend-stroke);}- .toolbar .export-menu button:hover {+ .diagram-nav #btn-diagram-guide[aria-expanded="true"] {+ color: var(--cloud-stroke);background: var(--toolbar-hover);}- .toolbar .export-menu .hint {- color: var(--text-faint);++ /* Semantic Radar is a deliberately simplified, viewer-only overview. It+ uses authored node bounds and the live camera viewport rather than+ cloning the canonical SVG, so IDs, filters, animation, and export state+ stay singular and deterministic. */+ .overview-map {+ position: absolute;+ right: 1rem;+ bottom: 4.15rem;+ z-index: 12;+ width: 11.25rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 52%, var(--toolbar-border));+ border-radius: 0.78rem;+ background: var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 16px 42px rgba(0, 0, 0, 0.3);+ backdrop-filter: blur(16px);font-size: 0.625rem;}- .toolbar .export-menu hr {+ .overview-map[hidden] { display: none; }+ .overview-map[data-docked="true"] {+ position: fixed;+ right: var(--archify-radar-right, 1rem);+ top: var(--archify-radar-top, 1rem);+ bottom: auto;+ }+ .overview-map[data-docked="true"][data-dock-side="left"] {+ right: auto;+ left: var(--archify-radar-left, 1rem);+ }+ html[data-preset="blueprint"] .overview-map { border-radius: 0.28rem; }+ .overview-map-head {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.45rem;+ min-height: 2.25rem;+ padding: 0.42rem 0.48rem 0.38rem 0.55rem;+ border-bottom: 1px solid var(--toolbar-border);+ background: linear-gradient(110deg, color-mix(in srgb, var(--frontend-fill) 45%, transparent), transparent 68%);+ }+ .overview-map-live {+ width: 0.42rem;+ height: 0.42rem;+ border-radius: 50%;+ background: var(--backend-stroke);+ box-shadow: 0 0 0 0 color-mix(in srgb, var(--backend-stroke) 52%, transparent);+ animation: archify-radar-live 2.4s ease-out infinite;+ }+ .overview-map-copy { min-width: 0; line-height: 1.1; }+ .overview-map-copy strong {+ display: block;+ overflow: hidden;+ color: var(--frontend-stroke);+ font-size: 0.59rem;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+ .overview-map-copy small {+ display: block;+ margin-top: 0.18rem;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.52rem;+ letter-spacing: 0.04em;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+ .overview-map-close {+ width: 1.55rem;+ height: 1.55rem;+ padding: 0;+ border: 0;+ border-radius: 0.34rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 0.9rem;+ cursor: pointer;+ }+ .overview-map-close:hover,+ .overview-map-close:focus-visible { background: var(--toolbar-hover); }+ .overview-map-close:focus-visible,+ .overview-map-surface:focus-visible,+ .overview-map-node:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .overview-map-surface {+ position: relative;+ height: 7rem;+ margin: 0.42rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--panel-border) 72%, transparent);+ border-radius: 0.42rem;+ background:+ linear-gradient(color-mix(in srgb, var(--panel-border) 26%, transparent) 1px, transparent 1px),+ linear-gradient(90deg, color-mix(in srgb, var(--panel-border) 26%, transparent) 1px, transparent 1px),+ color-mix(in srgb, var(--bg) 86%, transparent);+ background-size: 12px 12px;+ cursor: crosshair;+ touch-action: none;+ }+ html[data-preset="blueprint"] .overview-map-surface { border-radius: 0.1rem; }+ .overview-map-surface > svg {+ width: 100%;+ height: 100%;+ min-width: 0;+ transform: none !important;+ transition: none !important;+ display: block;+ overflow: visible;+ }+ .overview-map-node {+ fill: var(--backend-stroke);+ fill-opacity: 0.52;+ stroke: var(--backend-stroke);+ stroke-opacity: 0.86;+ vector-effect: non-scaling-stroke;+ cursor: pointer;+ transition: fill-opacity 140ms ease, stroke-width 140ms ease, filter 140ms ease;+ }+ .overview-map-node[data-kind="frontend"],+ .overview-map-node[data-kind="start"] { fill: var(--frontend-stroke); stroke: var(--frontend-stroke); }+ .overview-map-node[data-kind="database"],+ .overview-map-node[data-kind="success"] { fill: var(--database-stroke); stroke: var(--database-stroke); }+ .overview-map-node[data-kind="cloud"],+ .overview-map-node[data-kind="waiting"] { fill: var(--cloud-stroke); stroke: var(--cloud-stroke); }+ .overview-map-node[data-kind="messagebus"] { fill: var(--messagebus-stroke); stroke: var(--messagebus-stroke); }+ .overview-map-node[data-kind="security"],+ .overview-map-node[data-kind="decision"],+ .overview-map-node[data-kind="failure"] { fill: var(--security-stroke); stroke: var(--security-stroke); }+ .overview-map-node[data-kind="external"],+ .overview-map-node[data-kind="neutral"] { fill: var(--external-stroke); stroke: var(--external-stroke); }+ .overview-map-node[data-radar-active="true"],+ .overview-map-node:hover,+ .overview-map-node:focus-visible {+ fill-opacity: 0.92;+ stroke-width: 2.2;+ filter: drop-shadow(0 0 3px currentColor);+ }+ .overview-map-viewport {+ fill: color-mix(in srgb, var(--frontend-fill) 56%, transparent);+ stroke: var(--frontend-stroke);+ stroke-width: 2;+ vector-effect: non-scaling-stroke;+ pointer-events: none;+ filter: drop-shadow(0 0 3px color-mix(in srgb, var(--frontend-stroke) 54%, transparent));+ }+ .overview-map-hint {+ display: flex;+ justify-content: space-between;+ gap: 0.5rem;+ padding: 0 0.52rem 0.46rem;+ color: var(--text-faint);+ font-size: 0.49rem;+ letter-spacing: 0.06em;+ text-transform: uppercase;+ }+ .diagram-nav #btn-overview-map[aria-expanded="true"] {+ color: var(--frontend-stroke);+ background: var(--toolbar-hover);+ }+ .diagram-nav #btn-route-probe[aria-pressed="true"] {+ color: var(--backend-stroke);+ background: var(--toolbar-hover);+ }+ .diagram-nav #btn-semantic-lens[aria-expanded="true"],+ .diagram-nav #btn-semantic-lens[aria-pressed="true"] {+ color: var(--database-stroke);+ background: var(--toolbar-hover);+ }++ /* Semantic Lens turns the compiled node-kind palette into an analytical+ legend. One kind reveals its real traffic; two kinds compare only their+ direct authored relationships. Geometry and the canonical SVG stay put. */+ .semantic-lens {+ position: absolute;+ right: 1rem;+ bottom: 4.15rem;+ z-index: 24;+ width: min(20rem, calc(100% - 2rem));+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--database-stroke) 58%, var(--toolbar-border));+ border-radius: 0.82rem;+ background:+ linear-gradient(135deg, color-mix(in srgb, var(--database-fill) 34%, transparent), transparent 48%),+ var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 52px rgba(0, 0, 0, 0.36);+ backdrop-filter: blur(18px);+ animation: archify-lens-in 180ms cubic-bezier(0.22, 1, 0.36, 1);+ }+ .semantic-lens[hidden] { display: none; }+ .semantic-lens[data-dock-side="left"] { left: 1rem; right: auto; }+ .semantic-lens[data-dock-side="right"] { left: auto; right: 1rem; }+ html[data-preset="blueprint"] .semantic-lens { border-radius: 0.28rem; }+ .semantic-lens-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 0.75rem;+ padding: 0.72rem 0.78rem 0.62rem;+ border-bottom: 1px solid var(--toolbar-border);+ }+ .semantic-lens-eyebrow {+ display: block;+ color: var(--database-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.16em;+ text-transform: uppercase;+ }+ .semantic-lens-title {+ display: block;+ margin-top: 0.16rem;+ color: var(--text);+ font-size: 0.82rem;+ letter-spacing: -0.02em;+ }+ .semantic-lens-close {+ width: 1.75rem;+ height: 1.75rem;+ padding: 0;border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 1rem;+ cursor: pointer;+ }+ .semantic-lens-close:hover,+ .semantic-lens-close:focus-visible { background: var(--toolbar-hover); }+ .semantic-lens-instruction {+ margin: 0;+ padding: 0.52rem 0.78rem 0.48rem;+ color: var(--text-faint);+ font-size: 0.55rem;+ line-height: 1.45;+ }+ .semantic-lens-kinds {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 0.3rem;+ max-height: min(15rem, 40vh);+ padding: 0 0.5rem 0.5rem;+ overflow-y: auto;+ scrollbar-width: thin;+ }+ .semantic-lens-kind {+ --lens-color: var(--external-stroke);+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.42rem;+ min-width: 0;+ min-height: 2.15rem;+ padding: 0.35rem 0.42rem;+ border: 1px solid color-mix(in srgb, var(--lens-color) 24%, var(--toolbar-border));+ border-radius: 0.45rem;+ background: color-mix(in srgb, var(--panel) 76%, transparent);+ color: var(--toolbar-text);+ font: inherit;+ text-align: left;+ cursor: pointer;+ transition: border-color 140ms ease, background 140ms ease, opacity 140ms ease;+ }+ html[data-preset="blueprint"] .semantic-lens-kind { border-radius: 0.12rem; }+ .semantic-lens-kind[data-kind="frontend"],+ .semantic-lens-kind[data-kind="start"] { --lens-color: var(--frontend-stroke); }+ .semantic-lens-kind[data-kind="backend"],+ .semantic-lens-kind[data-kind="active"] { --lens-color: var(--backend-stroke); }+ .semantic-lens-kind[data-kind="database"],+ .semantic-lens-kind[data-kind="success"] { --lens-color: var(--database-stroke); }+ .semantic-lens-kind[data-kind="cloud"],+ .semantic-lens-kind[data-kind="waiting"] { --lens-color: var(--cloud-stroke); }+ .semantic-lens-kind[data-kind="messagebus"] { --lens-color: var(--messagebus-stroke); }+ .semantic-lens-kind[data-kind="security"],+ .semantic-lens-kind[data-kind="decision"],+ .semantic-lens-kind[data-kind="failure"] { --lens-color: var(--security-stroke); }+ .semantic-lens-kind:hover,+ .semantic-lens-kind:focus-visible,+ .semantic-lens-kind[aria-pressed="true"] {+ border-color: color-mix(in srgb, var(--lens-color) 78%, var(--toolbar-border));+ background: color-mix(in srgb, var(--lens-color) 11%, var(--panel));+ }+ .semantic-lens-kind:focus-visible,+ .semantic-lens-close:focus-visible,+ .semantic-lens-actions button:focus-visible {+ outline: 2px solid var(--database-stroke);+ outline-offset: 1px;+ }+ .semantic-lens-kind:disabled { opacity: 0.34; cursor: default; }+ .semantic-lens-swatch {+ width: 0.48rem;+ height: 0.48rem;+ border-radius: 50%;+ background: var(--lens-color);+ box-shadow: 0 0 8px color-mix(in srgb, var(--lens-color) 58%, transparent);+ }+ .semantic-lens-kind strong {+ overflow: hidden;+ color: var(--text);+ font-size: 0.61rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-lens-kind em {+ color: var(--lens-color);+ font-size: 0.54rem;+ font-style: normal;+ font-weight: 800;+ }+ .semantic-lens-status {+ min-height: 2.5rem;+ margin: 0;+ padding: 0.55rem 0.78rem;border-top: 1px solid var(--toolbar-border);- margin: 0.25rem 0.375rem;- opacity: 0.5;+ color: var(--text-faint);+ font-size: 0.55rem;+ line-height: 1.45;+ }+ .semantic-lens-status strong { color: var(--database-stroke); font-weight: 800; }+ .semantic-lens-actions {+ display: flex;+ justify-content: flex-end;+ gap: 0.28rem;+ padding: 0 0.62rem 0.62rem;+ }+ .semantic-lens-actions button {+ min-height: 1.8rem;+ padding: 0.28rem 0.48rem;+ border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 0.56rem;+ cursor: pointer;+ }+ .semantic-lens-actions button:hover { background: var(--toolbar-hover); }+ .semantic-lens-actions #semantic-lens-copy { color: var(--database-stroke); }+ @keyframes archify-lens-in {+ from { opacity: 0; transform: translateY(5px) scale(0.985); }+ to { opacity: 1; transform: translateY(0) scale(1); }}- /* Toast — brief feedback for actions like "copied" */- .archify-toast {- position: fixed;+ /* Route Probe answers a reader question over the compiled semantic graph:+ choose two stable nodes and reveal the shortest authored directed route.+ The receipt and signal live entirely in the viewer layer. */+ .route-probe {+ position: absolute;+ left: 1rem;+ bottom: 1rem;+ z-index: 12;+ width: min(46rem, calc(100% - 25rem));+ min-width: 18rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--backend-stroke) 62%, var(--toolbar-border));+ border-radius: 0.82rem;+ background:+ linear-gradient(115deg, color-mix(in srgb, var(--backend-fill) 50%, transparent), transparent 62%),+ var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);+ backdrop-filter: blur(16px);+ font-size: 0.625rem;+ }+ .route-probe[hidden] { display: none; }+ .route-probe[data-route-dock="top"] {top: 1rem;- left: 50%;- transform: translateX(-50%) translateY(-8px);- background: var(--toolbar-menu-bg);+ bottom: auto;+ }+ html[data-preset="blueprint"] .route-probe { border-radius: 0.25rem; }+ .route-probe-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 0.65rem;+ padding: 0.52rem 0.58rem 0.44rem;+ border-bottom: 1px solid color-mix(in srgb, var(--toolbar-border) 80%, transparent);+ }+ .route-probe-copy { min-width: 0; }+ .route-probe-eyebrow {+ display: block;+ color: var(--backend-stroke);+ font-size: 0.48rem;+ font-weight: 800;+ letter-spacing: 0.15em;+ text-transform: uppercase;+ }+ .route-probe-title {+ display: block;+ margin-top: 0.14rem;+ overflow: hidden;+ color: var(--toolbar-text);+ font-size: 0.72rem;+ line-height: 1.25;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+ .route-probe-actions { display: flex; gap: 0.2rem; }+ .route-probe button {+ min-height: 1.55rem;+ padding: 0.25rem 0.42rem;+ border: 0;+ border-radius: 0.36rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ cursor: pointer;+ }+ .route-probe button:hover,+ .route-probe button:focus-visible { background: var(--toolbar-hover); }+ .route-probe button:focus-visible {+ outline: 2px solid var(--backend-stroke);+ outline-offset: 1px;+ }+ .route-probe-copy-link { color: var(--frontend-stroke) !important; }+ .route-probe-find { color: var(--backend-stroke) !important; }+ .route-probe-copy-link[hidden] { display: none; }+ .route-probe-find[hidden] { display: none; }+ .route-probe-path {+ display: flex;+ align-items: center;+ min-height: 2.2rem;+ padding: 0.42rem 0.58rem 0.24rem;+ overflow-x: auto;+ scrollbar-width: thin;+ white-space: nowrap;+ }+ .route-probe-node,+ .route-probe button.route-probe-node {+ flex: none;+ max-width: 9.5rem;+ overflow: hidden;+ min-height: 1.75rem !important;+ padding: 0.22rem 0.38rem;+ border: 1px solid color-mix(in srgb, var(--backend-stroke) 46%, var(--toolbar-border));+ border-radius: 999px;+ background: color-mix(in srgb, var(--backend-fill) 52%, transparent);color: var(--text);- border: 1px solid var(--toolbar-border);- padding: 0.5rem 1rem;- border-radius: 0.5rem;- font-family: inherit;- font-size: 0.75rem;- opacity: 0;- transition: opacity 0.2s, transform 0.2s;- z-index: 200;- pointer-events: none;- box-shadow: 0 4px 20px rgba(0,0,0,0.25);+ font-size: 0.56rem;+ font-weight: 700;+ text-overflow: ellipsis;+ white-space: nowrap;}- .archify-toast.show {+ .route-probe-node[data-endpoint="start"] {+ border-color: var(--frontend-stroke);+ color: var(--frontend-stroke);+ }+ .route-probe-node[data-endpoint="end"] {+ border-color: var(--security-stroke);+ color: var(--security-stroke);+ }+ .route-probe-node[data-route-journey-state="past"] { opacity: 0.66; }+ .route-probe-node[data-route-journey-state="future"] { opacity: 0.48; }+ .route-probe-node[aria-current="step"] {+ border-color: var(--backend-stroke);+ background: color-mix(in srgb, var(--backend-fill) 82%, var(--toolbar-menu-bg));+ color: var(--text);+ box-shadow: 0 0 0 1px color-mix(in srgb, var(--backend-stroke) 42%, transparent), 0 0 14px color-mix(in srgb, var(--backend-stroke) 34%, transparent);opacity: 1;- transform: translateX(-50%) translateY(0);}-- @media (max-width: 720px) {- body { padding: 1rem; }- .toolbar {- position: static;- justify-content: flex-end;- margin-bottom: 1rem;- }- .header { margin-bottom: 1.25rem; }- .header-row {- gap: 0.75rem;- align-items: flex-start;- }- h1 {- font-size: 1.25rem;- line-height: 1.25;- }- .subtitle {- margin-left: 0;- font-size: 0.8125rem;- line-height: 1.55;- }- .diagram-container {- padding: 0.75rem;- border-radius: 0.75rem;- }- .cards {- grid-template-columns: 1fr;- margin-top: 1rem;- }+ html[data-preset="blueprint"] .route-probe-node[aria-current="step"] {+ border-style: double;+ border-width: 3px;+ border-radius: 0.2rem;+ box-shadow: none;}+ .route-probe-arrow {+ flex: none;+ padding: 0 0.28rem;+ color: var(--text-faint);+ font-size: 0.65rem;+ }+ .route-probe-placeholder {+ color: var(--text-faint);+ font-size: 0.56rem;+ letter-spacing: 0.03em;+ }+ .route-probe-status {+ display: block;+ min-height: 1.45rem;+ padding: 0.08rem 0.58rem 0.44rem;+ color: var(--text-faint);+ font-size: 0.52rem;+ line-height: 1.35;+ }+ .route-journey-controls {+ display: grid;+ grid-template-columns: 2rem minmax(5.8rem, auto) 2rem minmax(4.8rem, auto);+ justify-content: start;+ gap: 0.22rem;+ padding: 0.08rem 0.58rem 0.28rem;+ }+ .route-journey-controls[hidden] { display: none; }+ .route-journey-controls button {+ min-height: 1.8rem;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 86%, transparent);+ background: color-mix(in srgb, var(--toolbar-bg) 72%, transparent);+ font-size: 0.54rem;+ font-weight: 700;+ }+ .route-journey-controls button:disabled {+ cursor: default;+ opacity: 0.34;+ }+ .route-journey-play { color: var(--backend-stroke) !important; }+ .route-journey-overview { color: var(--frontend-stroke) !important; }+ .route-journey-controls[data-playing="true"] .route-journey-play {+ border-color: color-mix(in srgb, var(--backend-stroke) 64%, var(--toolbar-border));+ background: color-mix(in srgb, var(--backend-fill) 62%, transparent);+ }+ .route-probe[data-state="error"] {+ border-color: color-mix(in srgb, var(--security-stroke) 72%, var(--toolbar-border));+ }+ .route-probe[data-state="error"] .route-probe-status { color: var(--security-stroke); }- /* ==========================================================- SVG SEMANTIC CLASSES — use these instead of inline fill/stroke- ========================================================== */- .c-grid { stroke: var(--grid); fill: none; }- .c-mask { fill: var(--mask); stroke: none; }-- .c-frontend { fill: var(--frontend-fill); stroke: var(--frontend-stroke); }- .c-backend { fill: var(--backend-fill); stroke: var(--backend-stroke); }- .c-database { fill: var(--database-fill); stroke: var(--database-stroke); }- .c-cloud { fill: var(--cloud-fill); stroke: var(--cloud-stroke); }- .c-security { fill: var(--security-fill); stroke: var(--security-stroke); }- .c-messagebus { fill: var(--messagebus-fill); stroke: var(--messagebus-stroke); }- .c-external { fill: var(--external-fill); stroke: var(--external-stroke); }-- /* Text helpers */- .t-primary { fill: var(--text); }- .t-muted { fill: var(--text-muted); }- .t-dim { fill: var(--text-dim); }- .t-frontend { fill: var(--frontend-stroke); }- .t-backend { fill: var(--backend-stroke); }- .t-database { fill: var(--database-stroke); }- .t-cloud { fill: var(--cloud-stroke); }- .t-security { fill: var(--security-stroke); }- .t-messagebus { fill: var(--messagebus-stroke); }- .t-external { fill: var(--external-stroke); }-- /* Arrows */- .a-default { stroke: var(--arrow); fill: none; }- .a-emphasis { stroke: var(--arrow-emphasis); fill: none; }- .a-security { stroke: var(--security-stroke); fill: none; stroke-dasharray: 5,5; }- .a-dashed { stroke: var(--database-stroke); fill: none; stroke-dasharray: 4,4; }-- /* Arrowhead markers reference these */- .m-default { fill: var(--arrow); }- .m-emphasis { fill: var(--arrow-emphasis); }- .m-security { fill: var(--security-stroke); }- .m-dashed { fill: var(--database-stroke); }-- /* Dashed boundary variants */- .c-security-group { fill: transparent; stroke: var(--security-stroke); stroke-dasharray: 4,4; }- .c-region { fill: rgba(251, 191, 36, 0.05); stroke: var(--cloud-stroke); stroke-dasharray: 8,4; }- .c-lane { fill: var(--lane-fill); stroke: var(--lane-stroke); stroke-dasharray: 6,6; }-- /* Optional trace animation, enabled only by meta.animation = "trace".- Static diagrams do not carry data-animation and render exactly as before. */- svg[data-animation="trace"] [data-animate="edge"] {- stroke-dasharray: 10 8;- stroke-dashoffset: 54;- animation: archify-edge-flow 2.4s linear infinite;- animation-delay: calc(var(--step, 0) * 160ms);+ .focus-chip {+ position: absolute;+ left: 1rem;+ top: 1rem;+ z-index: 12;+ display: block;+ width: min(22rem, calc(100% - 13rem));+ max-width: calc(100% - 13rem);+ overflow: hidden;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.85rem;+ background: var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);+ backdrop-filter: blur(16px);+ font-size: 0.6875rem;}- svg[data-animation="trace"] [data-animate="node"] {- transform-box: fill-box;- transform-origin: center;- animation: archify-node-pulse 3.6s ease-in-out infinite;- animation-delay: calc(var(--step, 0) * 160ms);+ .focus-chip[hidden] { display: none; }+ html[data-preset="blueprint"] .focus-chip { border-radius: 0.3rem; }+ .focus-chip button {+ flex: none;+ padding: 0.3rem 0.45rem;+ border-radius: 0.35rem;+ font-size: 0.625rem;}- @keyframes archify-edge-flow {- to { stroke-dashoffset: 0; }+ .relationship-lens-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 0.75rem;+ padding: 0.7rem 0.75rem 0.65rem;+ border-bottom: 1px solid var(--toolbar-border);+ background: linear-gradient(120deg, color-mix(in srgb, var(--frontend-fill) 34%, transparent), transparent 72%);}- @keyframes archify-node-pulse {- 0%, 72%, 100% { filter: none; stroke-width: 1.5; }- 18%, 36% {- filter: drop-shadow(0 0 8px var(--arrow-emphasis));- stroke-width: 2.4;- }+ .relationship-lens-copy { min-width: 0; }+ .relationship-lens-actions {+ display: flex;+ flex-direction: column;+ align-items: stretch;+ gap: 0.18rem;}- @media (prefers-reduced-motion: reduce) {- svg[data-animation="trace"] [data-animate] {- animation: none !important;- stroke-dashoffset: 0;- }+ .relationship-lens-actions button { white-space: nowrap; }+ .relationship-lens-actions #btn-focus-copy { color: var(--frontend-stroke); }+ .relationship-lens-actions #btn-focus-relations { display: none; }+ .relationship-lens-eyebrow {+ display: block;+ margin-bottom: 0.18rem;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.14em;+ text-transform: uppercase;}- </style>-</head>-<body>- <!-- Toolbar: theme toggle + export menu (present on every generated diagram)- Keyboard: T toggles theme, E opens export menu (when no input focused) -->- <div class="toolbar" role="toolbar" aria-label="Diagram actions">- <button id="btn-theme" type="button"- title="Toggle theme (T)"- aria-label="Toggle color theme"- aria-pressed="false">+ .relationship-lens-title {+ display: block;+ overflow: hidden;+ color: var(--text);+ font-size: 0.8rem;+ line-height: 1.35;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-detail {+ display: block;+ margin-top: 0.12rem;+ overflow: hidden;+ color: var(--text-muted);+ font-size: 0.625rem;+ line-height: 1.4;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-detail[hidden] { display: none; }+ .semantic-passport-meta {+ display: flex;+ flex-wrap: wrap;+ gap: 0.24rem;+ margin-top: 0.42rem;+ }+ .semantic-passport-meta span,+ .semantic-passport-meta code {+ max-width: 100%;+ overflow: hidden;+ padding: 0.14rem 0.34rem;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 82%, transparent);+ border-radius: 999px;+ background: color-mix(in srgb, var(--panel) 68%, transparent);+ color: var(--text-faint);+ font: inherit;+ font-size: 0.5rem;+ letter-spacing: 0.04em;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-meta [data-passport="kind"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 50%, var(--toolbar-border));+ color: var(--frontend-stroke);+ font-weight: 800;+ text-transform: uppercase;+ }+ .semantic-passport-meta [data-passport="tag"] { color: var(--cloud-stroke); }+ .semantic-passport-meta [hidden] { display: none; }+ html[data-preset="blueprint"] .semantic-passport-meta span,+ html[data-preset="blueprint"] .semantic-passport-meta code { border-radius: 0.1rem; }+ .relationship-lens-summary {+ display: block;+ margin-top: 0.12rem;+ color: var(--text-faint);+ font-size: 0.5625rem;+ }+ .relationship-lens-list {+ max-height: min(18rem, 46vh);+ overflow: auto;+ padding: 0.4rem;+ scrollbar-width: thin;+ scrollbar-color: var(--frontend-stroke) transparent;+ }+ .relationship-lens-list::-webkit-scrollbar { width: 4px; }+ .relationship-lens-list::-webkit-scrollbar-thumb {+ border-radius: 999px;+ background: color-mix(in srgb, var(--frontend-stroke) 68%, transparent);+ }+ .relationship-lens-group + .relationship-lens-group { margin-top: 0.35rem; }+ .relationship-lens-group-title {+ display: block;+ padding: 0.24rem 0.38rem 0.16rem;+ color: var(--text-faint);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ }+ .relationship-lens-row {+ display: grid;+ grid-template-columns: 2.1rem minmax(0, 1fr);+ gap: 0.06rem 0.45rem;+ width: 100%;+ padding: 0.45rem 0.5rem !important;+ text-align: left;+ }+ .relationship-lens-row:hover,+ .relationship-lens-row:focus-visible,+ .relationship-lens-row[data-preview-active="true"] {+ background: var(--toolbar-hover);+ box-shadow: inset 2px 0 0 var(--frontend-stroke);+ }+ .relationship-lens-row:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: -2px;+ }+ .relationship-lens-direction {+ grid-row: 1 / 3;+ align-self: center;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.08em;+ }+ .relationship-lens-row[data-direction="in"] .relationship-lens-direction { color: var(--database-stroke); }+ .relationship-lens-row[data-direction="loop"] .relationship-lens-direction { color: var(--security-stroke); }+ .relationship-lens-row strong {+ overflow: hidden;+ color: var(--text);+ font-size: 0.6875rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .relationship-lens-row small {+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5625rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .relationship-lens-empty {+ margin: 0;+ padding: 0.75rem;+ color: var(--text-faint);+ font-size: 0.625rem;+ text-align: center;+ }++ /* Diagram Guide keeps the artifact's growing reader vocabulary+ discoverable without widening the permanent control bar. It derives+ honest counts at runtime and delegates every action to an existing+ production interaction instead of creating a second command system. */+ .diagram-guide {+ position: absolute;+ top: 1rem;+ right: 1rem;+ z-index: 26;+ width: min(32rem, calc(100% - 2rem));+ max-height: min(42rem, calc(100% - 2rem));+ overflow: auto;+ border: 1px solid color-mix(in srgb, var(--cloud-stroke) 58%, var(--toolbar-border));+ border-radius: 0.82rem;+ background:+ linear-gradient(135deg, color-mix(in srgb, var(--cloud-fill) 32%, transparent), transparent 42%),+ var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 22px 64px rgba(0, 0, 0, 0.4);+ backdrop-filter: blur(18px);+ animation: archify-guide-in 180ms cubic-bezier(0.22, 1, 0.36, 1);+ }+ .diagram-guide[hidden] { display: none; }+ html[data-preset="blueprint"] .diagram-guide { border-radius: 0.28rem; }+ .diagram-guide-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 1rem;+ padding: 0.82rem 0.9rem 0.68rem;+ border-bottom: 1px solid var(--toolbar-border);+ }+ .diagram-guide-eyebrow {+ display: block;+ color: var(--cloud-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.16em;+ text-transform: uppercase;+ }+ .diagram-guide-title {+ display: block;+ margin-top: 0.16rem;+ color: var(--text);+ font-size: 0.86rem;+ letter-spacing: -0.02em;+ }+ .diagram-guide-close {+ width: 1.8rem;+ height: 1.8rem;+ border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 1rem;+ cursor: pointer;+ }+ .diagram-guide-close:hover,+ .diagram-guide-close:focus-visible { background: var(--toolbar-hover); }+ .diagram-guide-stats {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ margin: 0;+ padding: 0.54rem 0.9rem;+ border-bottom: 1px solid color-mix(in srgb, var(--toolbar-border) 74%, transparent);+ color: var(--text-faint);+ font-size: 0.56rem;+ letter-spacing: 0.025em;+ }+ .diagram-guide-stats::before {+ content: '';+ width: 0.42rem;+ height: 0.42rem;+ flex: none;+ border-radius: 50%;+ background: var(--backend-stroke);+ box-shadow: 0 0 10px color-mix(in srgb, var(--backend-stroke) 72%, transparent);+ }+ .diagram-guide-actions {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 0.38rem;+ padding: 0.62rem;+ }+ .diagram-guide-action {+ --guide-accent: var(--frontend-stroke);+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.55rem;+ min-height: 4.15rem;+ padding: 0.55rem 0.58rem;+ border: 1px solid color-mix(in srgb, var(--guide-accent) 22%, var(--toolbar-border));+ border-radius: 0.55rem;+ background: color-mix(in srgb, var(--panel) 78%, transparent);+ color: var(--toolbar-text);+ font: inherit;+ text-align: left;+ cursor: pointer;+ transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;+ }+ .diagram-guide-action[data-guide-action="route"] { --guide-accent: var(--backend-stroke); }+ .diagram-guide-action[data-guide-action="map"] { --guide-accent: var(--database-stroke); }+ .diagram-guide-action[data-guide-action="lens"] { --guide-accent: var(--messagebus-stroke); }+ .diagram-guide-action[data-guide-action="story"] { --guide-accent: var(--security-stroke); }+ .diagram-guide-action[data-guide-action="present"] {+ --guide-accent: var(--cloud-stroke);+ }+ .diagram-guide-action:hover,+ .diagram-guide-action:focus-visible {+ border-color: color-mix(in srgb, var(--guide-accent) 76%, var(--toolbar-border));+ background: color-mix(in srgb, var(--guide-accent) 9%, var(--panel));+ transform: translateY(-1px);+ }+ .diagram-guide-action:focus-visible,+ .diagram-guide-close:focus-visible {+ outline: 2px solid var(--cloud-stroke);+ outline-offset: 1px;+ }+ .diagram-guide-action:disabled {+ opacity: 0.42;+ cursor: default;+ transform: none;+ }+ .diagram-guide-index {+ display: grid;+ place-items: center;+ width: 1.65rem;+ height: 1.65rem;+ border: 1px solid color-mix(in srgb, var(--guide-accent) 64%, var(--toolbar-border));+ border-radius: 0.35rem;+ color: var(--guide-accent);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.06em;+ }+ .diagram-guide-action-copy { min-width: 0; }+ .diagram-guide-action strong {+ display: block;+ overflow: hidden;+ color: var(--text);+ font-size: 0.66rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .diagram-guide-action small {+ display: -webkit-box;+ margin-top: 0.18rem;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5rem;+ line-height: 1.35;+ -webkit-box-orient: vertical;+ -webkit-line-clamp: 2;+ }+ .diagram-guide kbd {+ align-self: start;+ min-width: 1.45rem;+ padding: 0.12rem 0.3rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.25rem;+ color: var(--text-faint);+ font: inherit;+ font-size: 0.5rem;+ text-align: center;+ }+ .diagram-guide-shortcuts {+ display: flex;+ flex-wrap: wrap;+ gap: 0.34rem 0.62rem;+ padding: 0.58rem 0.9rem 0.68rem;+ border-top: 1px solid var(--toolbar-border);+ color: var(--text-faint);+ font-size: 0.5rem;+ }+ .diagram-guide-shortcuts span {+ display: inline-flex;+ align-items: center;+ gap: 0.28rem;+ white-space: nowrap;+ }+ .diagram-guide-feedback {+ min-height: 1rem;+ margin: -0.18rem 0.9rem 0.62rem;+ color: var(--security-stroke);+ font-size: 0.5rem;+ }+ .diagram-guide-feedback:empty { display: none; }+ @keyframes archify-guide-in {+ from { opacity: 0; transform: translateY(-5px) scale(0.985); }+ to { opacity: 1; transform: translateY(0) scale(1); }+ }++ .node-finder {+ position: absolute;+ top: 1rem;+ left: 1rem;+ z-index: 24;+ width: min(22rem, calc(100% - 2rem));+ overflow: hidden;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.85rem;+ background: var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34);+ backdrop-filter: blur(16px);+ }+ .node-finder[hidden] { display: none; }+ .node-finder[data-context="route-source"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 68%, var(--toolbar-border));+ }+ .node-finder[data-context="route-target"] {+ border-color: color-mix(in srgb, var(--security-stroke) 68%, var(--toolbar-border));+ }+ html[data-preset="blueprint"] .node-finder { border-radius: 0.3rem; }+ .node-finder-head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 1rem;+ padding: 0.7rem 0.8rem 0.45rem;+ }+ .node-finder-head strong {+ color: var(--text);+ font-size: 0.6875rem;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ }+ .node-finder[data-context="route-source"] .node-finder-head strong { color: var(--frontend-stroke); }+ .node-finder[data-context="route-target"] .node-finder-head strong { color: var(--security-stroke); }+ .node-finder-close {+ width: 1.75rem;+ height: 1.75rem;+ border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 1rem;+ cursor: pointer;+ }+ .node-finder-close:hover,+ .node-finder-close:focus-visible { background: var(--toolbar-hover); }+ .node-finder-close:focus-visible,+ .node-finder-input:focus-visible,+ .node-finder-result:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: -2px;+ }+ .node-finder-search {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.55rem;+ margin: 0 0.55rem 0.55rem;+ padding: 0 0.7rem;+ min-height: 2.6rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.55rem;+ background: color-mix(in srgb, var(--panel) 78%, transparent);+ }+ html[data-preset="blueprint"] .node-finder-search { border-radius: 0.18rem; }+ .node-finder-search > span { color: var(--frontend-stroke); font-size: 0.875rem; }+ .node-finder-input {+ width: 100%;+ min-width: 0;+ border: 0;+ outline: 0;+ background: transparent;+ color: var(--text);+ font: inherit;+ font-size: 0.75rem;+ }+ .node-finder-input::placeholder { color: var(--text-faint); }+ .node-finder kbd {+ padding: 0.1rem 0.32rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.25rem;+ color: var(--text-faint);+ font: inherit;+ font-size: 0.5625rem;+ }+ .node-finder-results {+ display: grid;+ gap: 0.18rem;+ max-height: min(18rem, 48vh);+ margin: 0;+ padding: 0 0.55rem 0.55rem;+ overflow-y: auto;+ overscroll-behavior: contain;+ scrollbar-width: thin;+ }+ .node-finder-result {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ gap: 0.2rem 0.75rem;+ width: 100%;+ padding: 0.55rem 0.65rem;+ border: 0;+ border-radius: 0.45rem;+ background: transparent;+ color: var(--text);+ font: inherit;+ text-align: left;+ cursor: pointer;+ }+ html[data-preset="blueprint"] .node-finder-result { border-radius: 0.12rem; }+ .node-finder-result:hover,+ .node-finder-result:focus-visible { background: var(--toolbar-hover); }+ .node-finder-result strong {+ overflow: hidden;+ font-size: 0.75rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .node-finder-result small {+ grid-column: 1 / -1;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5625rem;+ letter-spacing: 0.03em;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .node-finder-result em {+ align-self: center;+ color: var(--frontend-stroke);+ font-size: 0.625rem;+ font-style: normal;+ }+ .node-finder[data-context^="route-"] .node-finder-result em {+ padding: 0.1rem 0.3rem;+ border: 1px solid color-mix(in srgb, currentColor 52%, transparent);+ border-radius: 999px;+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.05em;+ text-transform: uppercase;+ }+ .node-finder[data-context="route-target"] .node-finder-result em { color: var(--security-stroke); }+ .node-finder-empty {+ padding: 1.1rem 0.75rem 1.25rem;+ color: var(--text-faint);+ font-size: 0.6875rem;+ text-align: center;+ }+ .node-finder-status {+ padding: 0.5rem 0.8rem;+ border-top: 1px solid var(--toolbar-border);+ color: var(--text-faint);+ font-size: 0.5625rem;+ }++ .guided-views {+ display: grid;+ grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem auto;+ align-items: stretch;+ gap: 0.35rem;+ min-width: 0;+ margin: 0 0 0.75rem;+ padding: 0.35rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.85rem;+ background: var(--toolbar-bg);+ background: linear-gradient(120deg, var(--toolbar-bg), color-mix(in srgb, var(--toolbar-bg) 82%, var(--frontend-fill)));+ box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16);+ backdrop-filter: blur(12px);+ }+ .guided-views[hidden] { display: none; }++ html[data-preset="blueprint"] .guided-views {+ border-color: var(--panel-border);+ border-radius: 0.35rem;+ background:+ linear-gradient(90deg, color-mix(in srgb, var(--frontend-fill) 36%, transparent), transparent 24%),+ var(--toolbar-bg);+ box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);+ }+ html[data-preset="blueprint"] .guided-views button { border-radius: 0.2rem; }+ html[data-preset="blueprint"] .guided-view-progress { border-radius: 0; }+ html[data-preset="blueprint"] .guided-view-progress span { border-radius: 0; }+ .guided-views button {+ min-width: 0;+ padding: 0.45rem 0.6rem;+ border-radius: 0.55rem;+ font-size: 0.75rem;+ }+ .guided-views > #guided-view-prev,+ .guided-views > #guided-view-next { min-width: 2.75rem; min-height: 2.75rem; }+ .guided-views button:disabled { opacity: 0.3; cursor: default; }+ .guided-view-copy {+ min-width: 0;+ padding: 0.2rem 0.5rem;+ border-left: 1px solid var(--toolbar-border);+ overflow: hidden;+ }+ .guided-view-meta {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ min-height: 1rem;+ margin-bottom: 0.12rem;+ color: var(--frontend-stroke);+ font-size: 0.5625rem;+ font-weight: 700;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ }+ .guided-view-handoff {+ box-sizing: border-box;+ height: 1rem;+ min-width: 0;+ max-width: 15rem;+ overflow: hidden;+ padding: 0 0.38rem;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 46%, transparent);+ border-radius: 999px;+ color: var(--toolbar-text);+ background: color-mix(in srgb, var(--frontend-fill) 44%, transparent);+ font-size: 0.5rem;+ line-height: calc(1rem - 2px);+ letter-spacing: 0.06em;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .guided-view-handoff[hidden] { display: none; }+ html[data-preset="blueprint"] .guided-view-handoff { border-radius: 0.15rem; }+ .chapter-handoff-overlay { pointer-events: none; }+ .chapter-handoff-anchor {+ fill: color-mix(in srgb, var(--frontend-fill) 10%, transparent);+ stroke: var(--frontend-stroke);+ stroke-width: 2;+ stroke-dasharray: 4 4;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ animation: archify-chapter-anchor 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ svg[data-chapter-handoff] [data-node-id][data-chapter-role="stay"] { opacity: 1; }+ svg[data-chapter-handoff] [data-node-id][data-chapter-role="enter"] { opacity: 0.78; }+ svg[data-chapter-handoff] [data-node-id][data-chapter-role="leave"] { opacity: 0.26; }+ @keyframes archify-chapter-anchor {+ 0% { opacity: 0.35; stroke-dashoffset: 8; }+ 45% { opacity: 1; }+ 100% { opacity: 0.72; stroke-dashoffset: 0; }+ }+ .guided-view-progress {+ width: 3.5rem;+ height: 2px;+ overflow: hidden;+ border-radius: 999px;+ background: var(--toolbar-border);+ }+ .guided-view-progress span {+ display: block;+ width: 100%;+ height: 100%;+ border-radius: inherit;+ background: var(--frontend-stroke);+ transform: scaleX(0);+ transform-origin: left center;+ }+ .guided-view-copy strong,+ .guided-view-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+ .guided-view-copy strong { color: var(--toolbar-text); font-size: 0.75rem; line-height: 1.35; }+ .guided-view-copy small { margin-top: 0; color: var(--text-muted); font-size: 0.625rem; line-height: 1.35; }+ .guided-story-caption {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ gap: 0.12rem 0.55rem;+ align-items: center;+ min-width: 0;+ margin-top: 0.18rem;+ padding: 0.3rem 0.5rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 32%, var(--toolbar-border));+ border-radius: 0.58rem;+ background: color-mix(in srgb, var(--frontend-fill) 26%, transparent);+ animation: archify-story-caption-in 140ms cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ .guided-story-caption[hidden] { display: none; }+ .guided-story-caption-index {+ grid-row: 1 / span 2;+ align-self: stretch;+ display: inline-grid;+ min-width: 3.3rem;+ place-items: center;+ padding-right: 0.52rem;+ border-right: 1px solid color-mix(in srgb, var(--frontend-stroke) 28%, var(--toolbar-border));+ color: var(--frontend-stroke);+ font-size: 0.5625rem;+ font-weight: 800;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ }+ .guided-story-caption strong,+ .guided-story-caption small {+ display: block;+ min-width: 0;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .guided-story-caption strong { color: var(--toolbar-text); font-size: 0.6875rem; line-height: 1.3; }+ .guided-story-caption small { color: var(--text-muted); font-size: 0.5625rem; line-height: 1.35; }+ .guided-story-caption-next {+ grid-column: 3;+ grid-row: 1 / span 2;+ display: grid;+ min-width: 6.4rem;+ max-width: 9.5rem;+ align-self: stretch;+ align-content: center;+ padding-left: 0.58rem;+ border-left: 1px solid color-mix(in srgb, var(--frontend-stroke) 22%, var(--toolbar-border));+ }+ .guided-story-caption-next[hidden] { display: none; }+ .guided-story-caption-next small {+ color: color-mix(in srgb, var(--frontend-stroke) 72%, var(--text-muted));+ font-weight: 800;+ letter-spacing: 0.09em;+ text-transform: uppercase;+ }+ .guided-story-caption-next strong { color: var(--text-muted); font-weight: 700; }+ html[data-preset="blueprint"] .guided-story-caption { border-radius: 0.2rem; }+ .guided-views[data-story-beat] .guided-view-copy > #guided-view-label,+ .guided-views[data-story-beat] .guided-view-copy > #guided-view-note { display: none; }+ @keyframes archify-story-caption-in {+ from { opacity: 0; transform: translateY(3px); }+ to { opacity: 1; transform: translateY(0); }+ }+ .guided-view-trail {+ display: flex;+ align-items: center;+ gap: 0.28rem;+ min-width: 0;+ min-height: 1.7rem;+ margin-top: 0;+ padding: 0;+ overflow-x: auto;+ color: var(--text-faint);+ overscroll-behavior-x: contain;+ touch-action: pan-x;+ scrollbar-width: none;+ white-space: nowrap;+ }+ .guided-view-trail[hidden] { display: none; }+ .guided-view-trail::-webkit-scrollbar { display: none; }+ .guided-view-trail .guided-view-stop {+ appearance: none;+ box-sizing: border-box;+ display: inline-flex;+ flex: 0 0 auto;+ align-items: center;+ gap: 0.28rem;+ min-height: 1.5rem;+ padding: 0.1rem 0.3rem 0.1rem 0.18rem;+ border: 1px solid transparent;+ border-radius: 999px;+ background: transparent;+ color: var(--text-muted);+ cursor: pointer;+ font-family: inherit;+ font-size: 0.5625rem;+ font-weight: 650;+ letter-spacing: 0.02em;+ line-height: 1;+ transition: background 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;+ }+ .guided-view-stop:hover {+ border-color: color-mix(in srgb, var(--frontend-stroke) 36%, transparent);+ background: color-mix(in srgb, var(--frontend-fill) 34%, transparent);+ }+ .guided-view-stop:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .guided-view-stop:disabled { cursor: wait; }+ .guided-view-stop::before {+ display: inline-grid;+ width: 1rem;+ height: 1rem;+ place-items: center;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 54%, var(--toolbar-border));+ border-radius: 50%;+ background: color-mix(in srgb, var(--frontend-fill) 58%, var(--toolbar-bg));+ color: var(--frontend-stroke);+ content: attr(data-story-number);+ font-size: 0.5rem;+ line-height: 1;+ }+ .guided-view-stop + .guided-view-stop::after {+ order: -1;+ color: color-mix(in srgb, var(--frontend-stroke) 58%, var(--text-faint));+ content: '\00b7';+ font-size: 0.65rem;+ }+ .guided-view-stop[data-story-link="forward"]::after { content: '\2192'; }+ .guided-view-stop[data-story-link="reverse"]::after { content: '\2190'; }+ .guided-view-stop[data-story-link="multiple"]::after { content: '\21c4'; }+ .guided-view-stop[data-story-beat-state="pending"] { opacity: 0.38; }+ .guided-view-stop[data-story-beat-state="next"] {+ border-style: dashed;+ border-color: color-mix(in srgb, var(--frontend-stroke) 42%, var(--toolbar-border));+ color: color-mix(in srgb, var(--toolbar-text) 68%, var(--text-muted));+ opacity: 0.58;+ }+ .guided-view-stop[data-story-beat-state="past"] { color: var(--text-muted); opacity: 0.76; }+ .guided-view-stop[data-story-beat-state="active"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 72%, var(--toolbar-border));+ background: color-mix(in srgb, var(--frontend-fill) 42%, transparent);+ color: var(--toolbar-text);+ font-weight: 800;+ opacity: 1;+ }+ .guided-view-stop[data-story-beat-state="active"]::before {+ border-color: var(--frontend-stroke);+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 54%, transparent);+ }+ html[data-preset="blueprint"] .guided-view-stop,+ html[data-preset="blueprint"] .guided-view-stop::before { border-radius: 0.1rem; }+ html[data-preset="blueprint"] .guided-view-stop[data-story-beat-state="active"]::before { box-shadow: none; }+ .guided-view-actions { display: flex; align-items: stretch; gap: 0.2rem; }+ .guided-view-actions button { white-space: nowrap; }+ .guided-view-play {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 0.38rem;+ min-width: 6.25rem !important;+ color: var(--frontend-stroke) !important;+ font-size: 0.625rem !important;+ }+ .guided-view-play[aria-pressed="true"] { background: var(--toolbar-hover); }+ .guided-view-all { min-width: 3.25rem !important; color: var(--text-muted) !important; font-size: 0.625rem !important; }+ .guided-view-beat-link {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 0.3rem;+ min-width: 5.4rem !important;+ min-height: 1.5rem;+ color: var(--text-muted) !important;+ font-size: 0.5625rem !important;+ letter-spacing: 0.025em;+ transition: background 140ms ease, border-color 140ms ease, color 140ms ease;+ }+ .guided-view-beat-link:not(:disabled):hover {+ border-color: color-mix(in srgb, var(--frontend-stroke) 52%, var(--toolbar-border));+ color: var(--frontend-stroke) !important;+ }+ .guided-view-beat-link[data-copy-state="copied"] {+ border-color: color-mix(in srgb, var(--backend-stroke) 58%, var(--toolbar-border));+ background: color-mix(in srgb, var(--backend-fill) 46%, transparent);+ color: var(--backend-stroke) !important;+ }+ .guided-view-index {+ grid-column: 1 / -1;+ min-width: 0;+ padding: 0.28rem 0.12rem 0.08rem;+ overflow: hidden;+ border-top: 1px solid color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ }+ @media (min-width: 721px) {+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-index,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-beat-link,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-all,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-trail,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-copy > #guided-view-label,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-copy > #guided-view-note { display: none; }+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-story-caption { margin-top: 0.08rem; }+ }+ .guided-view-chapters {+ display: flex;+ gap: 0.28rem;+ min-width: 0;+ margin: 0;+ padding: 0.08rem 0.05rem 0.2rem;+ overflow-x: auto;+ list-style: none;+ scroll-padding-inline: 0.05rem;+ scroll-snap-type: x proximity;+ scrollbar-width: none;+ }+ .guided-view-chapters::-webkit-scrollbar { display: none; }+ .guided-view-chapters li {+ display: flex;+ flex: 1 1 0;+ min-width: 9.5rem;+ scroll-snap-align: center;+ }+ .guided-view-chapter {+ position: relative;+ display: grid !important;+ grid-template-columns: 1.55rem minmax(0, 1fr) auto;+ align-items: center;+ width: 100%;+ min-height: 2.75rem;+ padding: 0.36rem 0.48rem !important;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 86%, transparent) !important;+ border-radius: 0.48rem !important;+ background: color-mix(in srgb, var(--toolbar-bg) 88%, transparent) !important;+ color: var(--text-muted) !important;+ text-align: left;+ transition: background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;+ }+ .guided-view-chapter:hover {+ border-color: color-mix(in srgb, var(--frontend-stroke) 58%, var(--toolbar-border)) !important;+ background: color-mix(in srgb, var(--frontend-fill) 42%, var(--toolbar-bg)) !important;+ }+ .guided-view-chapter:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .guided-view-chapter-index {+ display: inline-grid;+ width: 1.32rem;+ height: 1.32rem;+ place-items: center;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 48%, var(--toolbar-border));+ border-radius: 50%;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.03em;+ }+ .guided-view-chapter-title {+ min-width: 0;+ overflow: hidden;+ color: var(--toolbar-text);+ font-size: 0.625rem;+ font-weight: 700;+ line-height: 1.3;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .guided-view-chapter-count {+ grid-column: 3;+ grid-row: 1;+ margin-left: 0.38rem;+ color: var(--text-faint);+ font-size: 0.5rem;+ font-style: normal;+ font-weight: 650;+ white-space: nowrap;+ }+ .guided-view-chapter-delta {+ display: inline-flex;+ grid-column: 3;+ grid-row: 1;+ align-items: center;+ gap: 0.22rem;+ margin-left: 0.38rem;+ color: var(--text-faint);+ font-size: 0.5rem;+ font-weight: 750;+ letter-spacing: 0.01em;+ white-space: nowrap;+ }+ .guided-view-chapter-delta[hidden] { display: none; }+ .guided-view-chapter-delta [data-delta-kind="stay"] { color: var(--text-muted); }+ .guided-view-chapter-delta [data-delta-kind="enter"] { color: var(--frontend-stroke); }+ .guided-view-chapter-delta [data-delta-kind="leave"] { color: var(--security-stroke); }+ .guided-view-chapter[data-preview-active="true"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 72%, var(--toolbar-border)) !important;+ background: color-mix(in srgb, var(--frontend-fill) 54%, var(--toolbar-bg)) !important;+ }+ .guided-view-chapter[data-chapter-position="current"] {+ border: 2px solid var(--frontend-stroke) !important;+ padding: calc(0.36rem - 1px) calc(0.48rem - 1px) !important;+ box-shadow: inset 3px 0 0 var(--frontend-stroke);+ color: var(--toolbar-text) !important;+ }+ .guided-view-chapter[data-chapter-position="current"] .guided-view-chapter-index {+ background: var(--frontend-stroke);+ color: var(--bg);+ }+ .guided-view-chapter[data-chapter-position="before"] {+ border-style: solid !important;+ opacity: 0.72;+ }+ .guided-view-chapter[data-chapter-position="after"] { border-style: dashed !important; }+ html[data-preset="signal-flow"] .guided-view-chapter[data-chapter-position="current"] {+ box-shadow: inset 3px 0 0 var(--frontend-stroke), 0 0 18px color-mix(in srgb, var(--frontend-stroke) 18%, transparent);+ }+ html[data-preset="blueprint"] .guided-view-chapter,+ html[data-preset="blueprint"] .guided-view-chapter-index { border-radius: 0.12rem !important; }++ /* Story Shelf — keep every authored chapter and the Play action visible,+ but do not spend a second row on unavailable director controls before+ the reader enters a chapter. Existing data-active-view state expands+ the full guided surface without a new toggle or stored preference. */+ .guided-views[data-active-view="all"] {+ grid-template-columns: minmax(11rem, .72fr) auto minmax(0, 2fr);+ align-items: center;+ padding: 0.28rem 0.35rem;+ }+ .guided-views[data-active-view="all"] > #guided-view-prev,+ .guided-views[data-active-view="all"] > #guided-view-next,+ .guided-views[data-active-view="all"] .guided-view-beat-link,+ .guided-views[data-active-view="all"] .guided-view-all { display: none; }+ .guided-views[data-active-view="all"] .guided-view-copy {+ grid-column: 1;+ grid-row: 1;+ padding: 0.1rem 0.55rem;+ }+ .guided-views[data-active-view="all"] .guided-view-copy > #guided-view-note { display: none; }+ .guided-views[data-active-view="all"] .guided-view-actions {+ display: block;+ grid-column: 2;+ grid-row: 1;+ }+ .guided-views[data-active-view="all"] .guided-view-play { min-height: 2.75rem; }+ .guided-views[data-active-view="all"] .guided-view-index {+ grid-column: 3;+ grid-row: 1;+ padding: 0 0.08rem 0 0.42rem;+ border-top: 0;+ border-left: 1px solid color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ }+ .guided-views[data-active-view="all"] .guided-view-chapters {+ gap: 0.3rem;+ padding: 0;+ }++ .cards {+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));+ gap: 1rem;+ margin-top: 2rem;+ }++ .card {+ background: var(--panel);+ border-radius: 0.75rem;+ border: 1px solid var(--panel-border);+ padding: 1.25rem;+ }++ html[data-preset="signal-flow"] .card {+ background: linear-gradient(145deg, rgba(10, 24, 43, 0.86), rgba(5, 12, 24, 0.92));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);+ }+ html[data-preset="signal-flow"][data-theme="light"] .card {+ background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(237, 246, 250, 0.9));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 12px 32px rgba(45, 78, 99, 0.08);+ }++ html[data-preset="blueprint"] .card {+ position: relative;+ border-color: var(--panel-border);+ border-radius: 0.3rem;+ background: var(--panel);+ box-shadow: none;+ }+ html[data-preset="blueprint"] .card::before {+ content: "";+ position: absolute;+ top: -1px;+ left: 1rem;+ width: 2.5rem;+ border-top: 2px solid var(--frontend-stroke);+ }++ .card-header {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ margin-bottom: 0.75rem;+ }++ .card-dot {+ width: 8px;+ height: 8px;+ border-radius: 50%;+ }++ .card-dot.cyan { background: var(--frontend-stroke); }+ .card-dot.emerald { background: var(--backend-stroke); }+ .card-dot.violet { background: var(--database-stroke); }+ .card-dot.amber { background: var(--cloud-stroke); }+ .card-dot.rose { background: var(--security-stroke); }+ .card-dot.orange { background: var(--messagebus-stroke); }+ .card-dot.slate { background: var(--external-stroke); }++ .card h3 { font-size: 0.875rem; font-weight: 600; color: var(--text); }++ .card ul {+ list-style: none;+ color: var(--text-muted);+ font-size: 0.75rem;+ }++ .card li { margin-bottom: 0.375rem; }++ .footer {+ text-align: center;+ margin-top: 1.5rem;+ color: var(--text-faint);+ font-size: 0.75rem;+ }++ .footer .artifact-start-link {+ color: var(--text-faint);+ text-decoration-color: color-mix(in srgb, var(--frontend-stroke) 48%, transparent);+ text-underline-offset: 0.22em;+ transition: color 0.15s ease, text-decoration-color 0.15s ease;+ }++ .footer .artifact-start-link:hover,+ .footer .artifact-start-link:focus-visible {+ color: var(--frontend-stroke);+ text-decoration-color: currentColor;+ }++ /* ==========================================================+ Print stylesheet — hide interactive controls, force light,+ drop the grid so the diagram doesn't waste ink, use landscape+ so wide diagrams fit, pack summary cards into 2 columns to+ avoid an orphan card on a trailing page.+ ========================================================== */+ @page { size: landscape; margin: 1.5cm; }++ @media print {+ /* Force the FULL light palette — including component fills/strokes and+ lane/arrow colors — so printing from dark theme doesn't put neon+ strokes and translucent dark fills on white paper. */+ :root, [data-theme="dark"], [data-theme="light"] {+ --bg: #ffffff;+ --grid: transparent;+ --panel: #ffffff;+ --panel-border: #e2e8f0;+ --text: #0f172a;+ --text-muted: #475569;+ --text-dim: #94a3b8;+ --text-faint: #64748b;+ --mask: #ffffff;+ --lane-fill: rgba(248, 250, 252, 0.65);+ --lane-stroke: #cbd5e1;+ --arrow: #94a3b8;+ --arrow-emphasis: #059669;+ --frontend-fill: rgba(34, 211, 238, 0.15);+ --frontend-stroke: #0891b2;+ --backend-fill: rgba(52, 211, 153, 0.18);+ --backend-stroke: #059669;+ --database-fill: rgba(167, 139, 250, 0.2);+ --database-stroke: #7c3aed;+ --cloud-fill: rgba(251, 191, 36, 0.18);+ --cloud-stroke: #d97706;+ --security-fill: rgba(251, 113, 133, 0.15);+ --security-stroke: #e11d48;+ --messagebus-fill: rgba(251, 146, 60, 0.15);+ --messagebus-stroke:#ea580c;+ --external-fill: rgba(148, 163, 184, 0.18);+ --external-stroke: #64748b;+ }+ body { background: #ffffff !important; padding: 0; }+ .container { max-width: none; }+ .toolbar, .diagram-nav, .focus-chip, .guided-views, .archify-toast, .no-print { display: none !important; }+ .chapter-handoff-overlay { display: none !important; }+ svg [data-node-id][data-chapter-role] { opacity: 1 !important; }+ svg[data-chapter-preview] [data-node-id],+ svg[data-chapter-preview] [data-edge-from] { opacity: 1 !important; filter: none !important; }+ .diagram-container, .card { box-shadow: none; border-color: #e2e8f0; }+ html[data-preset="signal-flow"] .diagram-container,+ html[data-preset="signal-flow"] .card { background: #ffffff; }+ .cards { grid-template-columns: 1fr 1fr; }+ /* Ensure elements break sensibly across pages */+ .card { break-inside: avoid; page-break-inside: avoid; }+ .diagram-container { break-inside: avoid; page-break-inside: avoid; }+ .diagram-container svg [data-detail] {+ opacity: 1 !important;+ pointer-events: auto !important;+ }+ .diagram-container svg [data-detail-anchor] { transform: none !important; }+ .diagram-container svg[data-lens-active] [data-node-id],+ .diagram-container svg[data-lens-active] [data-edge-from],+ .diagram-container svg[data-legend-preview-active] [data-node-id],+ .diagram-container svg[data-legend-preview-active] [data-edge-from] {+ opacity: 1 !important;+ filter: none !important;+ }+ [data-legend-bridge-runtime] { display: none !important; }+ .semantic-lens-overlay { display: none !important; }+ .relationship-hit-overlay { display: none !important; }+ .relationship-pulse-overlay { display: none !important; }+ .route-probe-overlay, .route-journey-overlay { display: none !important; }+ .story-trail-overlay,+ .story-carrier-overlay { display: none !important; }+ .diagram-container svg[data-focus-active] [data-node-id],+ .diagram-container svg[data-focus-active] [data-edge-from],+ .diagram-container svg[data-story-beat] [data-story-step],+ .diagram-container svg[data-story-beat] [data-edge-from][data-story-beat-step],+ .diagram-container svg[data-route-active] [data-node-id],+ .diagram-container svg[data-route-active] [data-edge-from] {+ opacity: 1 !important;+ filter: none !important;+ animation: none !important;+ }+ h1, .subtitle { color: #0f172a; }+ }++ /* ==========================================================+ TOOLBAR (theme toggle + export menu)+ ========================================================== */+ .toolbar {+ position: fixed;+ top: 1rem;+ right: 1rem;+ display: flex;+ gap: 0.5rem;+ z-index: 100;+ }+ .toolbar button {+ background: var(--toolbar-bg);+ color: var(--toolbar-text);+ border: 1px solid var(--toolbar-border);+ padding: 0.5rem 0.875rem;+ border-radius: 0.5rem;+ font-family: inherit;+ font-size: 0.75rem;+ font-weight: 500;+ cursor: pointer;+ backdrop-filter: blur(8px);+ transition: background 0.15s, border-color 0.15s;+ display: inline-flex;+ align-items: center;+ gap: 0.375rem;+ min-height: 2.75rem;+ }+ .toolbar button:hover {+ background: var(--toolbar-hover);+ border-color: var(--arrow);+ }+ .toolbar button:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 2px;+ }+ .toolbar #btn-motion[hidden] { display: none !important; }+ .toolbar #btn-motion { min-width: 4.4rem; }+ .toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }+ .motion-control-dot {+ width: 0.46rem;+ height: 0.46rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 50%;+ background: var(--frontend-stroke);+ box-shadow: 0 0 9px color-mix(in srgb, var(--frontend-stroke) 72%, transparent);+ }+ #btn-motion[aria-pressed="false"] .motion-control-dot {+ background: transparent;+ box-shadow: none;+ }+ .toolbar .export-wrap { position: relative; }+ .toolbar .export-menu {+ position: absolute;+ top: calc(100% + 0.375rem);+ right: 0;+ background: var(--toolbar-menu-bg);+ border: 1px solid var(--toolbar-border);+ border-radius: 0.5rem;+ padding: 0.375rem;+ min-width: 160px;+ display: none;+ flex-direction: column;+ box-shadow: 0 4px 20px rgba(0,0,0,0.25);+ }+ .toolbar .export-menu.open { display: flex; }+ .toolbar .export-menu button {+ background: transparent;+ border: 0;+ justify-content: space-between;+ width: 100%;+ text-align: left;+ padding: 0.5rem 0.75rem;+ }+ .toolbar .export-menu button:hover {+ background: var(--toolbar-hover);+ }+ .toolbar .export-menu .hint {+ color: var(--text-faint);+ font-size: 0.625rem;+ }+ .toolbar .export-menu hr {+ border: 0;+ border-top: 1px solid var(--toolbar-border);+ margin: 0.25rem 0.375rem;+ opacity: 0.5;+ }++ /* Toast — brief feedback for actions like "copied" */+ .archify-toast {+ position: fixed;+ top: 1rem;+ left: 50%;+ transform: translateX(-50%) translateY(-8px);+ background: var(--toolbar-menu-bg);+ color: var(--text);+ border: 1px solid var(--toolbar-border);+ padding: 0.5rem 1rem;+ border-radius: 0.5rem;+ font-family: inherit;+ font-size: 0.75rem;+ opacity: 0;+ transition: opacity 0.2s, transform 0.2s;+ z-index: 200;+ pointer-events: none;+ box-shadow: 0 4px 20px rgba(0,0,0,0.25);+ }+ .archify-toast.show {+ opacity: 1;+ transform: translateX(-50%) translateY(0);+ }++ @media (max-width: 720px) {+ body { padding: 1rem; }+ .toolbar {+ position: static;+ justify-content: flex-end;+ margin-bottom: 1rem;+ }+ .header { margin-bottom: 1.25rem; padding-right: 0; }+ html[data-preset="signal-flow"] .header,+ html[data-preset="blueprint"] .header { padding-right: 0; }+ .header-row {+ gap: 0.75rem;+ align-items: flex-start;+ }+ html[data-preset="signal-flow"] .header-row,+ html[data-preset="blueprint"] .header-row { flex-wrap: wrap; }+ html[data-preset="signal-flow"] .header-row::after {+ margin-left: 0;+ order: 3;+ }+ html[data-preset="blueprint"] .header-row::after {+ margin-left: 0;+ order: 3;+ }+ h1 {+ font-size: 1.25rem;+ line-height: 1.25;+ }+ .subtitle {+ margin-left: 0;+ font-size: 0.8125rem;+ line-height: 1.55;+ }+ .diagram-container {+ padding: 0.75rem;+ border-radius: 0.75rem;+ }+ html:not([data-embed="true"]) .diagram-container {+ padding: 0.75rem 0.75rem 4.25rem;+ }+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] {+ overflow-x: auto;+ overflow-y: hidden;+ overscroll-behavior-x: contain;+ scrollbar-width: thin;+ scroll-behavior: smooth;+ }+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] > svg {+ min-width: 720px;+ }+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .diagram-nav,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .overview-map,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .focus-chip,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .route-probe,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .semantic-lens,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .diagram-guide,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .node-finder {+ transform: translateX(var(--archify-scroll-x, 0px));+ }+ .diagram-nav { right: 0.5rem; bottom: 0.5rem; }+ .overview-map {+ right: 0.5rem;+ bottom: 3.7rem;+ width: min(10.25rem, calc(100% - 1rem));+ }+ .overview-map[data-docked="true"] {+ right: 0.5rem;+ top: var(--archify-radar-top, 0.5rem);+ bottom: auto;+ transform: none !important;+ }+ .overview-map[data-docked="true"][data-dock-side="left"] {+ right: auto;+ left: 0.5rem;+ }+ .overview-map-surface { height: 4rem; }+ .semantic-lens {+ right: 0.5rem;+ bottom: 3.7rem;+ width: calc(100% - 1rem);+ max-height: calc(100% - 4.2rem);+ }+ .semantic-lens[data-dock-side] { left: auto; right: 0.5rem; }+ .semantic-lens-kinds { max-height: min(12rem, 34vh); }+ .focus-chip {+ left: 0.5rem;+ top: 0.5rem;+ width: calc(100% - 1rem);+ max-width: none;+ }+ .relationship-lens-list { max-height: min(12rem, 38vh); }+ .relationship-lens-actions #btn-focus-relations { display: block; color: var(--database-stroke); }+ .focus-chip:not([data-relations-expanded="true"]) .relationship-lens-head { border-bottom-color: transparent; }+ .focus-chip:not([data-relations-expanded="true"]) .relationship-lens-list { display: none; }+ /* While a mobile reader previews one relationship, turn the full Lens+ into a compact peek card. This keeps the exact source and target on+ canvas instead of covering them with a long, scrollable list. */+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-list {+ max-height: none;+ padding: 0.35rem;+ overflow: hidden;+ }+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-group { margin: 0; }+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-group-title,+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-row:not([data-preview-active="true"]) {+ display: none;+ }+ .node-finder {+ top: 0.5rem;+ left: 0.5rem;+ width: min(22rem, calc(100% - 1rem));+ max-height: calc(100% - 1rem);+ }+ .diagram-guide {+ top: 0.5rem;+ right: 0.5rem;+ left: 0.5rem;+ width: auto;+ max-height: calc(100% - 1rem);+ }+ .diagram-guide-head { padding: 0.62rem 0.7rem 0.52rem; }+ .diagram-guide-stats { padding: 0.42rem 0.7rem; }+ .diagram-guide-actions {+ grid-template-columns: 1fr;+ gap: 0.28rem;+ padding: 0.42rem;+ }+ .diagram-guide-action {+ min-height: 3.1rem;+ padding: 0.42rem 0.48rem;+ }+ .diagram-guide-action small {+ display: block;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .diagram-guide-index {+ width: 1.5rem;+ height: 1.5rem;+ }+ .diagram-guide-shortcuts { padding: 0.46rem 0.7rem 0.52rem; }+ .diagram-guide-action[data-guide-action="present"] { grid-column: auto; }+ .route-probe[data-guide-open="true"] {+ visibility: hidden;+ pointer-events: none;+ }+ .node-finder-results { max-height: min(16rem, 38vh); }+ .route-probe {+ left: 0.5rem;+ bottom: 3.7rem;+ width: calc(100% - 1rem);+ min-width: 0;+ }+ .route-probe[data-route-dock="top"] {+ top: 0.5rem;+ bottom: auto;+ }+ .route-probe[data-finder-open="true"] {+ visibility: hidden;+ pointer-events: none;+ }+ .route-probe-head { padding: 0.45rem 0.48rem 0.38rem; }+ .route-probe-path { padding: 0.35rem 0.48rem 0.2rem; }+ .route-probe-node { min-height: 2.75rem !important; }+ .route-journey-controls {+ grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem minmax(0, 1fr);+ padding: 0.08rem 0.48rem 0.32rem;+ }+ .route-journey-controls button { min-height: 2.75rem; }+ .route-probe-status { padding: 0.05rem 0.48rem 0.38rem; }+ .route-probe-node { max-width: 7.5rem; }+ .guided-views {+ grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;+ gap: 0.2rem;+ padding: 0.25rem;+ }+ .guided-view-actions {+ grid-column: 1 / -1;+ display: grid;+ grid-template-columns: repeat(3, minmax(0, 1fr));+ }+ .guided-views > #guided-view-prev,+ .guided-views > #guided-view-next {+ align-self: center;+ height: 2.75rem;+ }+ .guided-view-play,+ .guided-view-all,+ .guided-view-beat-link { min-height: 2.75rem; }+ .guided-view-copy small { white-space: normal; }+ .guided-story-caption { padding: 0.32rem 0.45rem; }+ .guided-story-caption-index { min-width: 2.9rem; padding-right: 0.42rem; }+ .guided-story-caption strong,+ .guided-story-caption small { white-space: normal; }+ .guided-story-caption-next { display: none; }+ .guided-view-trail { min-height: 2rem; }+ .guided-view-trail .guided-view-stop {+ min-height: 2rem;+ padding: 0.22rem 0.42rem 0.22rem 0.28rem;+ }+ .guided-view-handoff { max-width: min(9rem, 32vw); }+ .guided-view-index { padding-top: 0.35rem; }+ .guided-view-chapters {+ gap: 0.35rem;+ scroll-padding-inline: 0.2rem;+ }+ .guided-view-chapters li {+ flex: 0 0 min(14rem, 78vw);+ min-width: 0;+ }+ .guided-view-chapter { min-height: 2.75rem; }+ .guided-views[data-active-view="all"] {+ grid-template-columns: minmax(0, 1fr) auto;+ gap: 0.2rem;+ padding: 0.25rem;+ }+ .guided-views[data-active-view="all"] .guided-view-copy {+ grid-column: 1;+ grid-row: 1;+ }+ .guided-views[data-active-view="all"] .guided-view-actions {+ grid-column: 2;+ grid-row: 1;+ }+ .guided-views[data-active-view="all"] .guided-view-play {+ min-width: 6rem !important;+ min-height: 2.75rem;+ }+ .guided-views[data-active-view="all"] .guided-view-index {+ grid-column: 1 / -1;+ grid-row: 2;+ padding: 0.3rem 0.08rem 0;+ border-top: 1px solid color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ border-left: 0;+ }+ html[data-embed="true"][data-share-playback="true"] .share-chapter-cue:not([hidden]),+ html[data-embed="true"][data-share-moment="true"] .share-chapter-cue:not([hidden]) {+ top: 0.5rem;+ grid-template-columns: auto minmax(0, 1fr);+ gap: 0.28rem 0.55rem;+ width: calc(100% - 1rem);+ min-height: 0;+ padding: 0.45rem 0.55rem 0.55rem;+ }+ html[data-embed="true"][data-share-playback="true"] .diagram-container {+ padding-top: 4.25rem;+ }+ html[data-embed="true"][data-share-moment="true"] .diagram-container {+ padding-top: 4.25rem;+ }+ .share-chapter-index {+ min-width: 4.4rem;+ padding-right: 0.5rem;+ }+ .share-chapter-copy small { font-size: 0.46rem; }+ .share-chapter-route {+ grid-column: 1 / -1;+ font-size: 0.5rem;+ text-align: left;+ }+ .cards {+ grid-template-columns: 1fr;+ margin-top: 1rem;+ }+ html[data-present="true"]:not([data-embed="true"]) body { padding: 0.5rem; }+ html[data-present="true"]:not([data-embed="true"]) .container {+ gap: 0.5rem;+ height: calc(100dvh - 1rem);+ }+ html[data-present="true"]:not([data-embed="true"]) .toolbar {+ position: fixed;+ top: 0.5rem;+ right: 0.5rem;+ margin: 0;+ gap: 0.25rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .toolbar button {+ min-height: 2.75rem;+ padding: 0.42rem 0.58rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .header {+ min-height: 2.25rem;+ padding: 3.5rem 0 0;+ }+ html[data-present="true"]:not([data-embed="true"]) .header-row {+ min-height: 2.25rem;+ margin: 0;+ align-items: center;+ flex-wrap: nowrap;+ }+ html[data-present="true"]:not([data-embed="true"]) .header-row::after,+ html[data-present="true"]:not([data-embed="true"]) .pulse-dot,+ html[data-present="true"]:not([data-embed="true"]) .subtitle { display: none; }+ html[data-present="true"]:not([data-embed="true"]) h1 {+ flex: 1 1 auto;+ min-width: 0;+ max-width: 100%;+ overflow: hidden;+ font-size: 0.875rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ html[data-present="true"]:not([data-embed="true"]) .guided-views {+ padding: 0.2rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .guided-view-copy small { display: none; }+ html[data-present="true"]:not([data-embed="true"]) .guided-story-caption small { display: block; }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container { padding: 0.5rem 0.5rem 3.75rem; }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] > svg {+ width: 720px;+ height: auto;+ min-width: 720px;+ }+ }++ @media (prefers-reduced-motion: reduce) {+ .guided-story-caption { animation: none !important; }+ }++ @media (max-width: 360px) {+ .toolbar { gap: 0.25rem; }+ .toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }+ .toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }+ #theme-label, #preset-label, #present-label { display: none; }+ .guided-view-handoff { max-width: 6.5rem; }+ }++ /* ==========================================================+ SVG SEMANTIC CLASSES — use these instead of inline fill/stroke+ ========================================================== */+ .c-grid { stroke: var(--grid); fill: none; }+ .c-mask { fill: var(--mask); stroke: none; }++ .c-frontend { fill: var(--frontend-fill); stroke: var(--frontend-stroke); }+ .c-backend { fill: var(--backend-fill); stroke: var(--backend-stroke); }+ .c-database { fill: var(--database-fill); stroke: var(--database-stroke); }+ .c-cloud { fill: var(--cloud-fill); stroke: var(--cloud-stroke); }+ .c-security { fill: var(--security-fill); stroke: var(--security-stroke); }+ .c-messagebus { fill: var(--messagebus-fill); stroke: var(--messagebus-stroke); }+ .c-external { fill: var(--external-fill); stroke: var(--external-stroke); }++ /* Text helpers */+ .t-primary { fill: var(--text); }+ .t-muted { fill: var(--text-muted); }+ .t-dim { fill: var(--text-dim); }+ .t-frontend { fill: var(--frontend-stroke); }+ .t-backend { fill: var(--backend-stroke); }+ .t-database { fill: var(--database-stroke); }+ .t-cloud { fill: var(--cloud-stroke); }+ .t-security { fill: var(--security-stroke); }+ .t-messagebus { fill: var(--messagebus-stroke); }+ .t-external { fill: var(--external-stroke); }++ /* Semantic Sigils are small authored role stamps, not icons from a brand+ pack and not viewer controls. Prefix selectors with svg so the canonical+ export's SVG-only stylesheet collector keeps them automatically. */+ svg .semantic-sigil {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ opacity: 0.76;+ pointer-events: none;+ }+ svg .semantic-sigil > * { vector-effect: non-scaling-stroke; }+ svg .semantic-sigil .sigil-fill { fill: currentColor; stroke: none; }+ svg .s-frontend { color: var(--frontend-stroke); }+ svg .s-backend { color: var(--backend-stroke); }+ svg .s-database { color: var(--database-stroke); }+ svg .s-cloud { color: var(--cloud-stroke); }+ svg .s-security { color: var(--security-stroke); }+ svg .s-messagebus { color: var(--messagebus-stroke); }+ svg .s-external { color: var(--external-stroke); }++ /* Reading Depth is a viewer-only level-of-detail layer. MAP preserves the+ authored structure and primary labels, READ restores relationship labels+ and node context, and FULL restores tags and fine annotations. Semantic+ intent can reveal the relevant detail without moving any geometry. */+ svg [data-detail] { transition: opacity 160ms ease; }+ svg [data-detail-anchor] {+ transform-box: fill-box;+ transform-origin: center;+ transition: transform 160ms ease;+ }+ .diagram-container[data-detail-level="map"] svg [data-detail="context"],+ .diagram-container[data-detail-level="map"] svg [data-detail="fine"],+ .diagram-container[data-detail-level="read"] svg [data-detail="fine"] {+ opacity: 0;+ pointer-events: none;+ }+ .diagram-container[data-detail-level="map"] svg [data-detail-anchor] {+ transform: translateY(8px);+ }++ /* Focus, lens, preview, route, and story states are stronger reader intent than+ the global zoom level. Reveal only their exact semantic matches. */+ svg[data-focus-active] [data-focus-match][data-detail],+ svg[data-focus-active] [data-focus-match] [data-detail],+ svg[data-lens-active] [data-lens-match][data-detail],+ svg[data-lens-active] [data-lens-match] [data-detail],+ svg[data-legend-preview-active] [data-legend-preview-match][data-detail],+ svg[data-legend-preview-active] [data-legend-preview-match] [data-detail],+ svg[data-intent-trace-active] [data-intent-trace-match][data-detail],+ svg[data-intent-trace-active] [data-intent-trace-match] [data-detail],+ svg[data-route-active] [data-route-match][data-detail],+ svg[data-route-active] [data-route-match] [data-detail],+ svg[data-story-active] [data-story-step][data-detail],+ svg[data-story-active] [data-story-step] [data-detail],+ svg[data-relationship-preview-active] [data-relationship-preview][data-detail],+ svg[data-relationship-preview-active] [data-relationship-preview] [data-detail],+ svg [data-node-id]:hover [data-detail],+ svg [data-node-id]:focus-visible [data-detail] {+ opacity: 1;+ pointer-events: auto;+ }+ svg[data-focus-active] [data-focus-match] [data-detail-anchor],+ svg[data-lens-active] [data-lens-match] [data-detail-anchor],+ svg[data-legend-preview-active] [data-legend-preview-match] [data-detail-anchor],+ svg[data-intent-trace-active] [data-intent-trace-match] [data-detail-anchor],+ svg[data-route-active] [data-route-match] [data-detail-anchor],+ svg[data-story-active] [data-story-step] [data-detail-anchor],+ svg [data-node-id]:hover [data-detail-anchor],+ svg [data-node-id]:focus-visible [data-detail-anchor] { transform: none; }++ /* Arrows */+ .a-default { stroke: var(--arrow); fill: none; }+ .a-emphasis { stroke: var(--arrow-emphasis); fill: none; }+ .a-security { stroke: var(--security-stroke); fill: none; stroke-dasharray: 5,5; }+ .a-dashed { stroke: var(--database-stroke); fill: none; stroke-dasharray: 4,4; }++ /* Arrowhead markers reference these */+ .m-default { fill: var(--arrow); }+ .m-emphasis { fill: var(--arrow-emphasis); }+ .m-security { fill: var(--security-stroke); }+ .m-dashed { fill: var(--database-stroke); }++ /* Stable semantic exploration hooks emitted by every renderer. */+ svg [data-node-id] {+ cursor: pointer;+ transition: opacity 0.18s ease, filter 0.18s ease;+ }+ svg [data-edge-from] { transition: opacity 0.18s ease, filter 0.18s ease; }+ svg [data-node-id]:hover,+ svg [data-node-id]:focus-visible {+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ outline: none;+ }+ svg [data-legend-kind][role="button"] { cursor: pointer; }+ svg [data-legend-kind]:focus { outline: none; }+ svg [data-legend-hit] {+ fill: transparent;+ stroke: transparent;+ stroke-width: 1.4;+ pointer-events: all;+ vector-effect: non-scaling-stroke;+ transition: stroke 150ms ease, stroke-width 150ms ease, filter 150ms ease;+ }+ svg [data-legend-count-badge] { pointer-events: none; }+ svg [data-legend-count-badge] rect {+ fill: var(--mask);+ stroke: var(--panel-border);+ stroke-width: 1;+ vector-effect: non-scaling-stroke;+ }+ svg [data-legend-count-badge] text {+ fill: var(--text-muted);+ font-size: 7px;+ font-weight: 700;+ text-anchor: middle;+ }+ svg [data-legend-kind][role="button"]:hover [data-legend-hit] {+ stroke: color-mix(in srgb, var(--database-stroke) 58%, transparent);+ }+ svg [data-legend-kind][role="button"]:focus-visible [data-legend-hit] {+ stroke: var(--frontend-stroke);+ stroke-width: 1.8;+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ svg [data-legend-kind][data-legend-selected] [data-legend-hit] {+ stroke: var(--database-stroke);+ stroke-width: 2.2;+ stroke-dasharray: 3 2;+ }+ svg [data-legend-kind][data-legend-selected] [data-legend-count-badge] rect {+ stroke: var(--database-stroke);+ stroke-width: 1.8;+ }+ svg [data-legend-kind][data-legend-zero] { opacity: 0.44; }+ svg[data-preset="signal-flow"] [data-legend-kind][data-legend-selected] [data-legend-hit] {+ filter: drop-shadow(0 0 4px var(--database-stroke));+ }+ svg[data-preset="blueprint"] [data-legend-hit],+ svg[data-preset="blueprint"] [data-legend-count-badge] rect { rx: 0; filter: none; }+ svg[data-legend-preview-active] [data-node-id],+ svg[data-legend-preview-active] [data-edge-from] { opacity: 0.11; }+ svg[data-legend-preview-active] [data-legend-preview-match] { opacity: 1; }+ svg[data-legend-preview-active] [data-legend-preview-peer] { opacity: 0.62; }+ svg[data-legend-preview-active] [data-legend-preview-selected] {+ filter: drop-shadow(0 0 8px var(--database-stroke));+ }+ svg[data-lens-active] [data-node-id],+ svg[data-lens-active] [data-edge-from] { opacity: 0.11; }+ svg[data-lens-active] [data-lens-match] { opacity: 1; }+ svg[data-lens-active] [data-lens-peer] { opacity: 0.62; }+ svg[data-lens-active] [data-lens-selected] {+ filter: drop-shadow(0 0 10px var(--database-stroke));+ }+ .semantic-lens-overlay { pointer-events: none; }+ .semantic-lens-flow {+ fill: none;+ stroke-width: 3.05;+ stroke-linecap: round;+ stroke-dasharray: 0.075 0.925;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0.9;+ animation: archify-semantic-lens-flow 1.35s linear 1 both;+ animation-delay: var(--lens-flow-delay, 0s);+ }+ .semantic-lens-flow[data-direction="out"],+ .semantic-lens-flow[data-direction="forward"] {+ stroke: var(--frontend-stroke);+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ .semantic-lens-flow[data-direction="in"],+ .semantic-lens-flow[data-direction="reverse"] {+ stroke: var(--database-stroke);+ filter: drop-shadow(0 0 3px var(--database-stroke));+ }+ .semantic-lens-flow[data-direction="within"] {+ stroke: var(--messagebus-stroke);+ filter: drop-shadow(0 0 3px var(--messagebus-stroke));+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow {+ stroke-width: 3.7;+ opacity: 1;+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="out"],+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="forward"] {+ filter: drop-shadow(0 0 6px var(--frontend-stroke));+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="in"],+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="reverse"] {+ filter: drop-shadow(0 0 6px var(--database-stroke));+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="within"] {+ filter: drop-shadow(0 0 6px var(--messagebus-stroke));+ }+ svg[data-preset="blueprint"] .semantic-lens-flow {+ stroke-width: 2.45;+ stroke-linecap: square;+ filter: none;+ opacity: 0.78;+ }+ html[data-embed="true"] .semantic-lens-overlay { display: none; }+ svg[data-focus-active] [data-node-id],+ svg[data-focus-active] [data-edge-from] { opacity: 0.13; }+ svg[data-focus-active] [data-focus-match] { opacity: 1; }+ svg[data-focus-active] [data-focus-selected] {+ filter: drop-shadow(0 0 10px var(--frontend-stroke));+ }++ /* Direct Relationship Explorer makes authored paths a real input surface+ without changing their visible stroke or canonical SVG. A transparent+ runtime rail supplies forgiving pointer geometry; the exact authored+ path and endpoints continue to carry every visible state. */+ .relationship-hit-overlay { pointer-events: none; }+ .relationship-hit-target { outline: none; }+ .relationship-hit-rail {+ fill: none;+ stroke: transparent;+ stroke-width: 24;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ pointer-events: stroke;+ cursor: pointer;+ }+ .relationship-focus-rail {+ fill: none;+ stroke: color-mix(in srgb, var(--frontend-stroke) 34%, transparent);+ stroke-width: 6;+ stroke-dasharray: 2 4;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ pointer-events: none;+ opacity: 0;+ }+ .relationship-hit-target:focus-visible .relationship-focus-rail {+ opacity: 1;+ }+ svg[data-preset="blueprint"] .relationship-hit-target:focus-visible .relationship-focus-rail {+ stroke-linecap: square;+ filter: none;+ }+ svg[data-relationship-direct-active] [data-node-id],+ svg[data-relationship-direct-active] [data-edge-from] { opacity: 0.16; }+ svg[data-relationship-direct-active] [data-relationship-preview],+ svg[data-relationship-direct-active] [data-relationship-preview-node] { opacity: 1; }+ svg[data-focus-active]:not([data-relationship-pin-active]) .relationship-hit-rail,+ svg[data-story-active] .relationship-hit-rail,+ svg[data-route-picking] .relationship-hit-rail,+ svg[data-route-active] .relationship-hit-rail,+ svg[data-lens-active] .relationship-hit-rail,+ svg[data-chapter-preview] .relationship-hit-rail { pointer-events: none; }+ html[data-embed="true"] .relationship-hit-overlay { display: none; }+ @media (hover: none), (pointer: coarse) {+ .relationship-hit-rail { stroke-width: 24; }+ }++ /* Relationship Preview is temporary exploration state layered on top of+ neighborhood focus. It changes emphasis only; exported geometry and the+ relationship's original solid/dashed visual language stay untouched. */+ svg[data-relationship-preview-active] [data-focus-match] { opacity: 0.18; }+ svg[data-relationship-preview-active] [data-relationship-preview],+ svg[data-relationship-preview-active] [data-relationship-preview-node] { opacity: 1; }+ svg[data-relationship-preview-active] [data-relationship-preview] {+ filter: drop-shadow(0 0 5px var(--arrow-emphasis));+ }+ svg[data-relationship-preview-active] [data-relationship-preview] path,+ svg[data-relationship-preview-active] path[data-relationship-preview],+ svg[data-relationship-preview-active] [data-relationship-preview] line,+ svg[data-relationship-preview-active] line[data-relationship-preview],+ svg[data-relationship-preview-active] [data-relationship-preview] polyline,+ svg[data-relationship-preview-active] polyline[data-relationship-preview] {+ stroke-width: 2.75;+ }+ svg[data-relationship-preview-active] [data-relationship-preview-source] {+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ }+ svg[data-relationship-preview-active] [data-relationship-preview-target] {+ filter: drop-shadow(0 0 7px var(--database-stroke));+ }+ .relationship-pulse-overlay { pointer-events: none; }+ .relationship-flow-pulse {+ fill: none;+ stroke: var(--arrow-emphasis);+ stroke-width: 3.35;+ stroke-linecap: round;+ stroke-dasharray: 0.085 0.915;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0;+ filter: drop-shadow(0 0 4px var(--arrow-emphasis));+ animation: archify-relationship-pulse 1.2s linear 1 both;+ }+ svg[data-preset="signal-flow"] .relationship-flow-pulse {+ stroke: var(--frontend-stroke);+ stroke-width: 3.85;+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ }+ svg[data-preset="blueprint"] .relationship-flow-pulse {+ stroke-width: 2.5;+ stroke-linecap: square;+ filter: none;+ }+ .semantic-flow-token {+ color: var(--frontend-stroke);+ opacity: 0;+ pointer-events: none;+ }+ .relationship-flow-token {+ animation: archify-relationship-token-life 1.2s linear 1 both;+ }+ .story-flow-token {+ animation: archify-relationship-token-life 0.78s linear 1 both;+ }+ .semantic-flow-token-halo {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.1;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ }+ .relationship-flow-token-shape {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-ink {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.05;+ stroke-linecap: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-dot { fill: currentColor; stroke: none; }+ .semantic-flow-token[data-token-kind="data"] { color: var(--database-stroke); }+ .semantic-flow-token[data-token-kind="event"] { color: var(--messagebus-stroke); }+ .semantic-flow-token[data-token-kind="security"] { color: var(--security-stroke); }+ .semantic-flow-token[data-token-kind="state"] { color: var(--cloud-stroke); }+ svg[data-preset="signal-flow"] .semantic-flow-token {+ filter: drop-shadow(0 0 5px currentColor);+ }+ svg[data-preset="blueprint"] .semantic-flow-token { filter: none; }+ html[data-embed="true"] .relationship-pulse-overlay { display: none; }++ /* Intent Trace is a temporary, pre-click exploration layer. Related+ topology stays readable while a short viewer-only signal runs over+ cloned edge geometry; the authored edge remains untouched underneath. */+ svg[data-intent-trace-active] [data-node-id],+ svg[data-intent-trace-active] [data-edge-from] { opacity: 0.2; }+ svg[data-intent-trace-active] [data-intent-trace-match] { opacity: 1; }+ svg[data-intent-trace-active] [data-intent-trace-selected] {+ filter: drop-shadow(0 0 10px var(--frontend-stroke));+ }+ .intent-trace-overlay { pointer-events: none; }+ .intent-trace-flow {+ fill: none;+ stroke-width: 3.1;+ stroke-linecap: round;+ stroke-dasharray: 0.1 0.9;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0.94;+ animation: archify-intent-trace-flow 1.15s linear 1 both;+ }+ .intent-trace-flow[data-direction="out"] {+ stroke: var(--frontend-stroke);+ filter: drop-shadow(0 0 4px var(--frontend-stroke));+ }+ .intent-trace-flow[data-direction="in"] {+ stroke: var(--database-stroke);+ filter: drop-shadow(0 0 4px var(--database-stroke));+ animation-direction: reverse;+ }+ .intent-trace-flow[data-direction="loop"] {+ stroke: var(--security-stroke);+ filter: drop-shadow(0 0 4px var(--security-stroke));+ }+ svg[data-preset="blueprint"] [data-intent-trace-selected],+ svg[data-preset="blueprint"] .intent-trace-flow {+ filter: none;+ stroke-linecap: square;+ }+ .intent-trace-status {+ 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;+ }++ /* Route Probe separates a durable two-point query from selection and+ one-hop hover. Only the chosen shortest directed path stays prominent;+ the traveling signal is cloned viewer geometry and never authored SVG. */+ svg[data-route-picking="target"] [data-node-id] { opacity: 0.24; }+ svg[data-route-picking="target"] [data-route-candidate],+ svg[data-route-picking="target"] [data-route-start] { opacity: 1; }+ svg[data-route-picking] [data-node-id] { cursor: crosshair; }+ svg[data-route-picking] [data-route-start] {+ filter: drop-shadow(0 0 10px var(--frontend-stroke));+ }+ svg[data-route-active] [data-node-id],+ svg[data-route-active] [data-edge-from] { opacity: 0.11; }+ svg[data-route-active] [data-route-match] { opacity: 1; }+ svg[data-route-active] [data-route-start] {+ filter: drop-shadow(0 0 11px var(--frontend-stroke));+ }+ svg[data-route-active] [data-route-end] {+ filter: drop-shadow(0 0 11px var(--security-stroke));+ }+ svg[data-route-active] [data-route-step]:not([data-route-start]):not([data-route-end]) {+ filter: drop-shadow(0 0 7px var(--backend-stroke));+ }+ svg[data-route-journey] [data-route-match][data-route-journey-state="past"] { opacity: 0.62; }+ svg[data-route-journey] [data-route-match][data-route-journey-state="future"] { opacity: 0.34; }+ svg[data-route-journey] [data-route-match][data-route-journey-state="current"] { opacity: 1; }+ svg[data-route-journey] [data-node-id][data-route-journey-current] {+ filter: drop-shadow(0 0 10px var(--backend-stroke));+ }+ svg[data-route-journey] [data-edge-from][data-route-journey-current] {+ opacity: 1;+ filter: drop-shadow(0 0 6px var(--backend-stroke));+ }+ .route-probe-overlay { pointer-events: none; }+ .route-journey-overlay { pointer-events: none; }+ .route-probe-flow {+ fill: none;+ stroke: var(--backend-stroke);+ stroke-width: 3.25;+ stroke-linecap: round;+ stroke-dasharray: 0.085 0.915;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ filter: drop-shadow(0 0 5px var(--backend-stroke));+ animation: archify-route-probe-flow 1.1s cubic-bezier(0.22, 1, 0.36, 1) 1 both;+ animation-delay: calc(var(--route-step, 0) * 0.16s);+ }+ .route-journey-flow {+ fill: none;+ stroke: var(--backend-stroke);+ stroke-width: 3.5;+ stroke-linecap: round;+ stroke-dasharray: 0.1 0.9;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0;+ filter: drop-shadow(0 0 6px var(--backend-stroke));+ animation: archify-route-journey-flow 780ms cubic-bezier(0.22, 1, 0.36, 1) 1 both;+ }+ svg[data-preset="blueprint"] [data-route-start],+ svg[data-preset="blueprint"] [data-route-end],+ svg[data-preset="blueprint"] [data-route-step],+ svg[data-preset="blueprint"] .route-probe-flow {+ filter: none;+ stroke-linecap: square;+ }+ svg[data-preset="blueprint"] .route-journey-flow {+ filter: none;+ stroke-linecap: square;+ }++ svg[data-preset="blueprint"] .c-grid {+ stroke-dasharray: 1 3;+ opacity: 0.78;+ }+ svg[data-preset="blueprint"] .c-region {+ fill: color-mix(in srgb, var(--cloud-fill) 58%, transparent);+ stroke-dasharray: 12 4 2 4;+ }+ svg[data-preset="blueprint"] .c-security-group,+ svg[data-preset="blueprint"] .c-lane { stroke-dasharray: 7 3; }+ svg[data-preset="blueprint"] [data-node-id]:hover,+ svg[data-preset="blueprint"] [data-node-id]:focus-visible {+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ svg[data-preset="blueprint"][data-focus-active] [data-focus-selected] {+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview],+ svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-source],+ svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-target] {+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }++ /* Story Trail is a viewer-only overlay derived from the ordered focus IDs+ of the active guided view. The authored edge stays underneath with its+ original color, dash pattern, marker, and geometry intact. */+ .story-trail-overlay { pointer-events: none; }+ .story-carrier-overlay { pointer-events: none; }+ .story-trail-flow {+ fill: none;+ stroke: var(--frontend-stroke);+ stroke-width: 2.8;+ stroke-linecap: round;+ vector-effect: non-scaling-stroke;+ opacity: 0.34;+ filter: drop-shadow(0 0 2px var(--frontend-stroke));+ }+ svg[data-story-beat] [data-story-step] {+ opacity: 0.22;+ filter: saturate(0.42);+ transition: opacity 180ms ease, filter 180ms ease;+ }+ svg[data-story-beat] [data-story-step][data-story-beat-state="past"] {+ opacity: 0.72;+ filter: saturate(0.82);+ }+ svg[data-story-beat] [data-story-step][data-story-beat-state="next"] {+ opacity: 0.5;+ filter: saturate(0.66);+ }+ svg[data-story-beat] [data-story-step][data-story-beat-state="active"] {+ opacity: 1;+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ animation: archify-story-beat-node 360ms cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ svg[data-story-beat] [data-edge-from][data-story-beat-step] {+ opacity: 0.16;+ transition: opacity 160ms ease;+ }+ svg[data-story-beat] [data-edge-from][data-story-beat-step][data-story-beat-state="past"] { opacity: 0.58; }+ svg[data-story-beat] [data-edge-from][data-story-beat-step][data-story-beat-state="next"] { opacity: 0.34; }+ svg[data-story-beat] [data-edge-from][data-story-beat-step][data-story-beat-state="active"] { opacity: 1; }+ svg[data-story-beat] .story-trail-flow { opacity: 0; transition: opacity 160ms ease; }+ svg[data-story-beat] .story-trail-flow[data-story-beat-state="past"] { opacity: 0.34; }+ svg[data-story-beat] .story-trail-flow[data-story-beat-state="next"] { opacity: 0.2; }+ svg[data-story-beat] .story-trail-flow[data-story-beat-state="active"] { opacity: 0.92; }+ svg[data-story-beat] .story-trail-flow[data-story-pulse="true"] {+ stroke-dasharray: 2 13;+ stroke-dashoffset: 30;+ opacity: 0.92;+ animation: archify-story-flow 0.78s linear 1 both;+ }+ svg[data-preset="blueprint"] .story-trail-flow {+ stroke-linecap: square;+ filter: none;+ opacity: 0.5;+ }+ svg[data-preset="blueprint"][data-story-beat] [data-story-step][data-story-beat-state="active"] {+ filter: none;+ animation: none;+ }++ /* Chapter Delta Preview is a static, pre-commit comparison between two+ chapter focus sets. Symbols in the rail carry the meaning without color;+ these SVG rules only make exact stable-ID membership easier to scan. */+ svg[data-chapter-preview] [data-node-id],+ svg[data-chapter-preview] [data-edge-from] {+ opacity: 0.1 !important;+ filter: none !important;+ transition: none !important;+ }+ svg[data-chapter-preview] .story-trail-overlay { opacity: 0.08 !important; }+ svg[data-chapter-preview] [data-node-id][data-chapter-preview-role="stay"] {+ opacity: 0.76 !important;+ filter: saturate(0.7) !important;+ }+ svg[data-chapter-preview] [data-node-id][data-chapter-preview-role="enter"] {+ opacity: 1 !important;+ filter: saturate(1.2) !important;+ }+ svg[data-chapter-preview] [data-node-id][data-chapter-preview-role="leave"] {+ opacity: 0.28 !important;+ filter: grayscale(0.72) !important;+ }+ svg[data-preset="blueprint"][data-chapter-preview] [data-node-id] { filter: none !important; }++ /* Dashed boundary variants */+ .c-security-group { fill: transparent; stroke: var(--security-stroke); stroke-dasharray: 4,4; }+ .c-region { fill: rgba(251, 191, 36, 0.05); stroke: var(--cloud-stroke); stroke-dasharray: 8,4; }+ .c-lane { fill: var(--lane-fill); stroke: var(--lane-stroke); stroke-dasharray: 6,6; }++ /* Optional trace animation, enabled only by meta.animation = "trace".+ The ordinary viewer performs one ambient pass and then restores the+ authored solid/security/async line language. WebM samples the same+ authored geometry into an explicit canvas timeline. */+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"] {+ animation: archify-edge-flow 2.4s linear 1;+ animation-delay: calc(var(--step, 0) * 160ms);+ }+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"] {+ transform-box: fill-box;+ transform-origin: center;+ animation: archify-node-pulse 3.6s ease-in-out 1;+ animation-delay: calc(var(--step, 0) * 160ms);+ }+ svg[data-preset="signal-flow"][data-animation="trace"] [data-animate="edge"] {+ stroke-linecap: round;+ filter: drop-shadow(0 0 3px var(--arrow-emphasis));+ animation-duration: 1.75s;+ }+ svg[data-preset="signal-flow"][data-animation="trace"] [data-animate="node"] {+ animation-duration: 3.1s;+ }+ svg[data-preset="blueprint"][data-animation="trace"] [data-animate="edge"] {+ stroke-linecap: square;+ filter: none;+ animation-duration: 2.15s;+ }+ svg[data-preset="blueprint"][data-animation="trace"] [data-animate="node"] {+ animation-name: archify-blueprint-node-pulse;+ animation-duration: 3.8s;+ }+ /* Embedded proofs are static until a named Story Trail chapter is played.+ This keeps proof grids calm and ensures ?play=1 stops all viewer motion+ after one 3.2 second chapter instead of leaving ambient trace loops on. */+ html[data-embed="true"] svg[data-animation="trace"] [data-animate],+ html[data-share-playback="true"] svg[data-animation="trace"] [data-animate] {+ animation: none !important;+ stroke-dashoffset: 0;+ }+ @keyframes archify-edge-flow {+ 0% { stroke-dasharray: 10 8; stroke-dashoffset: 54; opacity: 0.42; }+ 88% { stroke-dasharray: 10 8; stroke-dashoffset: 0; opacity: 1; }+ 99.9% { stroke-dasharray: 10 8; stroke-dashoffset: 0; opacity: 1; }+ 100% { stroke-dashoffset: 0; opacity: 1; }+ }+ @keyframes archify-node-pulse {+ 0%, 72%, 100% { filter: none; stroke-width: 1.5; }+ 18%, 36% {+ filter: drop-shadow(0 0 8px var(--arrow-emphasis));+ stroke-width: 2.4;+ }+ }+ @keyframes archify-blueprint-node-pulse {+ 0%, 72%, 100% { opacity: 1; filter: none; }+ 18%, 36% { opacity: 0.72; filter: drop-shadow(0 0 2px var(--frontend-stroke)); }+ }+ @keyframes archify-signal-scan {+ 0%, 18% { opacity: 1; transform: translateX(-70%); }+ 70% { opacity: 1; transform: translateX(70%); }+ 100% { opacity: 0; transform: translateX(70%); }+ }+ @keyframes archify-radar-live {+ 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--backend-stroke) 52%, transparent); }+ 55%, 100% { box-shadow: 0 0 0 0.32rem transparent; }+ }+ @keyframes archify-guided-progress {+ from { transform: scaleX(var(--guided-progress-start, 0)); }+ to { transform: scaleX(1); }+ }+ @keyframes archify-story-flow {+ to { stroke-dashoffset: 0; }+ }+ @keyframes archify-intent-trace-flow {+ 0% { opacity: 0.28; stroke-dashoffset: 0; }+ 12%, 78% { opacity: 0.94; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-route-probe-flow {+ 0% { stroke-dashoffset: 0; opacity: 0.96; }+ 78% { stroke-dashoffset: -1; opacity: 0.96; }+ 100% { stroke-dasharray: none; stroke-dashoffset: 0; opacity: 0.58; }+ }+ @keyframes archify-route-journey-flow {+ 0% { opacity: 0.16; stroke-dashoffset: 0; }+ 14%, 76% { opacity: 1; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-semantic-lens-flow {+ 0% { opacity: 0.2; stroke-dashoffset: 0; }+ 12%, 78% { opacity: 0.9; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-relationship-pulse {+ 0% { opacity: 0.18; stroke-dashoffset: 0; }+ 10%, 76% { opacity: 0.98; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-relationship-token-life {+ 0%, 7% { opacity: 0; }+ 13%, 82% { opacity: 1; }+ 100% { opacity: 0; }+ }+ @keyframes archify-story-beat-node {+ from { opacity: 0.48; filter: saturate(0.6); }+ 58% { opacity: 1; filter: drop-shadow(0 0 10px var(--frontend-stroke)); }+ to { opacity: 1; filter: drop-shadow(0 0 7px var(--frontend-stroke)); }+ }+ @keyframes archify-share-cue-enter {+ from { opacity: 0; transform: translate(-50%, -0.45rem); }+ to { opacity: 1; transform: translate(-50%, 0); }+ }+ @keyframes archify-share-cue-pulse {+ 0%, 100% { opacity: 1; transform: scale(1); }+ 50% { opacity: 0.48; transform: scale(0.78); }+ }+ @media (prefers-reduced-motion: reduce) {+ html[data-preset="signal-flow"] .diagram-container::before {+ animation: none !important;+ }+ .pulse-dot { animation: none !important; }+ svg[data-animation="trace"] [data-animate] {+ animation: none !important;+ stroke-dashoffset: 0;+ }+ .guided-view-progress span {+ animation: none !important;+ transform: scaleX(1) !important;+ }+ .story-trail-flow,+ .intent-trace-flow,+ .route-probe-flow,+ .semantic-lens,+ .diagram-guide,+ [data-story-step],+ .overview-map-live,+ .guided-view-stop,+ .share-chapter-cue,+ .chapter-handoff-anchor,+ .share-chapter-state::before,+ .share-chapter-progress span { animation: none !important; }+ .guided-view-chapter,+ svg[data-chapter-preview] [data-node-id],+ svg[data-chapter-preview] [data-edge-from] { transition: none !important; }+ svg[data-story-playing="true"] .story-trail-flow {+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.55;+ }+ .intent-trace-flow {+ animation: none !important;+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.72;+ }+ .route-probe-flow {+ animation: none !important;+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.78;+ }+ .route-journey-overlay,+ .story-carrier-overlay { display: none !important; }+ .semantic-lens-flow {+ animation: none !important;+ stroke-dasharray: none;+ stroke-width: 2.2;+ opacity: 0.34;+ filter: none;+ }+ .relationship-pulse-overlay { display: none !important; }+ .guided-view-chapter { transition: none !important; }+ svg [data-node-id], svg [data-edge-from], svg [data-detail], svg [data-detail-anchor], svg [data-legend-hit], svg { transition: none !important; }+ }+ </style>+</head>+<body>+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.+ Motion appears only for trace-enabled artifacts and has no shortcut;+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. -->+ <div class="toolbar" role="toolbar" aria-label="Diagram actions">+ <button id="btn-theme" type="button"+ title="Toggle theme (T)"+ aria-label="Toggle color theme"+ aria-pressed="false"><span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button>+ <button id="btn-motion" type="button" hidden+ title="Pause motion"+ aria-label="Pause motion"+ aria-pressed="true">+ <span class="motion-control-dot" aria-hidden="true"></span>+ <span id="motion-label">Live</span>+ </button>+ <button id="btn-present" type="button"+ title="Presentation stage (F)"+ aria-label="Enter presentation stage"+ aria-pressed="false">+ <span id="present-icon" aria-hidden="true">□</span>+ <span id="present-label">Present</span>+ </button><div class="export-wrap"><button id="btn-export" type="button"title="Export diagram (E)"@@ -516,673 +3795,7535 @@<button data-format="webp" type="button" role="menuitem" tabindex="-1">Download WebP</button><hr role="separator"><button data-format="svg" type="button" role="menuitem" tabindex="-1">Download SVG <span class="hint">vector</span></button>+ <button data-format="webm" type="button" role="menuitem" tabindex="-1">Download WebM <span class="hint">6s motion</span></button>+ </div>+ </div>+ </div>++ <div class="container">+ <!-- Header -->+ <div class="header">+ <div class="header-row">+ <div class="pulse-dot"></div>+ <h1>Archify Pipeline</h1>+ </div>+ <p class="subtitle">Grid placement demo — row/col instead of manual pos</p>+ </div>++ <script id="archify-guided-views-data" type="application/json">[]</script>+ <div class="guided-views no-print" id="guided-views" hidden aria-label="Guided diagram views">+ <button id="guided-view-prev" type="button" aria-label="Previous guided view" title="Previous guided view ([)">←</button>+ <div class="guided-view-copy">+ <div class="guided-view-meta">+ <span>Guided views</span>+ <span id="guided-view-count"></span>+ <span class="guided-view-progress" aria-hidden="true"><span id="guided-view-progress-bar"></span></span>+ <span class="guided-view-handoff" id="guided-view-handoff" hidden aria-hidden="true"></span>+ </div>+ <strong id="guided-view-label">Explore this system</strong>+ <small id="guided-view-note" aria-live="polite" aria-atomic="true">Step through curated paths without changing the source diagram.</small>+ <div class="guided-view-trail" id="guided-view-trail" hidden role="group" aria-label="Story trail"></div>+ <div class="guided-story-caption" id="guided-story-caption" hidden aria-live="polite" aria-atomic="true">+ <span class="guided-story-caption-index" id="guided-story-caption-index">Beat</span>+ <strong id="guided-story-caption-route"></strong>+ <small id="guided-story-caption-detail"></small>+ <span class="guided-story-caption-next" id="guided-story-caption-next" hidden aria-hidden="true">+ <small>Next</small>+ <strong id="guided-story-caption-next-label"></strong>+ </span>+ </div>+ </div>+ <button id="guided-view-next" type="button" aria-label="Next guided view" title="Next guided view (])">→</button>+ <div class="guided-view-actions">+ <button class="guided-view-play" id="guided-view-play" type="button" aria-label="Play guided story" aria-pressed="false" title="Play guided story (P)">+ <span id="guided-view-play-icon" aria-hidden="true">▶</span>+ <span id="guided-view-play-label">Play story</span>+ </button>+ <button class="guided-view-beat-link" id="guided-view-beat-link" type="button" aria-label="Select a Story Beat to copy its exact link" title="Select a Story Beat to copy its exact link" disabled>+ <span aria-hidden="true">#</span>+ <span id="guided-view-beat-link-label">Copy moment</span>+ </button>+ <button class="guided-view-all" id="guided-view-all" type="button" aria-label="Show entire diagram">Show all</button>+ </div>+ <nav class="guided-view-index" id="guided-view-index" aria-label="Story chapters">+ <ol class="guided-view-chapters" id="guided-view-chapters"></ol>+ </nav>+ </div>++ <!-- Main Diagram -->+ <div class="diagram-container" data-detail-level="map">+ <svg viewBox="0 0 1064 356" role="img" aria-labelledby="archify-diagram-title archify-diagram-description" data-preset="classic" data-quality-profile="standard" data-quality-gates="advisory">+ <title id="archify-diagram-title">Archify Pipeline</title>+ <desc id="archify-diagram-description">Grid placement demo — row/col instead of manual pos</desc>+ <!-- Definitions -->+ <defs>+ <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-default" />+ </marker>+ <marker id="arrowhead-emphasis" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-emphasis" />+ </marker>+ <marker id="arrowhead-security" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-security" />+ </marker>+ <marker id="arrowhead-dashed" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-dashed" />+ </marker>+ <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">+ <path d="M 40 0 L 0 0 0 40" class="c-grid" stroke-width="0.5"/>+ </pattern>+ </defs>++ <!-- Background Grid -->+ <rect width="100%" height="100%" fill="url(#grid)" />++ <!-- Boundaries (behind everything) -->+ <rect data-graph-role="structural-frame" data-composition-frame-kind="region" data-composition-frame-id="0" x="298" y="70" width="612" height="218" rx="12" class="c-region" stroke-width="1"/>+ <text x="306" y="88" class="t-cloud" font-size="9" font-weight="600">archify/ skill package</text>++ <!-- Connection paths (before components for correct z-order) -->+ <path data-edge-from="user" data-edge-to="agents" data-edge-key="0" data-composition-points="160,238;184,238" d="M 160 238 L 184 238" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="agents" data-edge-to="skill" data-edge-key="1" data-composition-points="244,208;244,160" d="M 244 208 L 244 160" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>+ <path data-edge-from="agents" data-edge-to="ir" data-edge-key="2" data-composition-points="304,238;328,238" d="M 304 238 L 328 238" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="ir" data-edge-to="schemas" data-edge-key="3" data-composition-points="388,208;388,160" d="M 388 208 L 388 160" class="a-security" stroke-width="1.5" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="ir" data-edge-to="renderers" data-edge-key="4" data-composition-points="448,238;472,238" d="M 448 238 L 472 238" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="renderers" data-edge-to="template" data-edge-key="5" data-composition-points="592,238;616,238" d="M 592 238 L 616 238" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="template" data-edge-to="checker" data-edge-key="6" data-composition-points="736,238;760,238" d="M 736 238 L 760 238" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="checker" data-edge-to="html" data-edge-key="7" data-composition-points="880,238;904,238" d="M 880 238 L 904 238" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>++ <!-- Components -->+ <g id="node-user" data-node-id="user" data-node-label="You" tabindex="0" role="button" aria-label="Focus You, NL / Mermaid, Architecture component" aria-pressed="false" data-node-kind="external" data-node-sublabel="NL / Mermaid" data-node-context="Architecture component">+ <title>You · NL / Mermaid · Architecture component</title>+ <rect x="40" y="208" width="120" height="60" rx="6" class="c-mask"/>+ <rect x="40" y="208" width="120" height="60" rx="6" class="c-external" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="external" class="semantic-sigil s-external" transform="translate(46 214) scale(0.6875)">+ <rect x="2.5" y="5" width="8.5" height="8" rx="1.5"/>+ <path d="M8 2.5h5.5V8M13.5 2.5 7.5 8.5"/>+ </g>+ <text data-detail-anchor x="100" y="236" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">You</text>+ <text data-detail="context" x="100" y="252" class="t-muted" font-size="9" text-anchor="middle">NL / Mermaid</text>+ </g>++ <g id="node-agents" data-node-id="agents" data-node-label="Agent Hosts" tabindex="0" role="button" aria-label="Focus Agent Hosts, Claude · Codex, Architecture component" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="Claude · Codex" data-node-context="Architecture component">+ <title>Agent Hosts · Claude · Codex · Architecture component</title>+ <rect x="184" y="208" width="120" height="60" rx="6" class="c-mask"/>+ <rect x="184" y="208" width="120" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(190 214) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g>+ <text data-detail-anchor x="244" y="236" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Agent Hosts</text>+ <text data-detail="context" x="244" y="252" class="t-muted" font-size="9" text-anchor="middle">Claude · Codex</text>+ </g>++ <g id="node-skill" data-node-id="skill" data-node-label="SKILL.md" tabindex="0" role="button" aria-label="Focus SKILL.md, layout rules, Architecture component" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="layout rules" data-node-context="Architecture component">+ <title>SKILL.md · layout rules · Architecture component</title>+ <rect x="184" y="100" width="120" height="60" rx="6" class="c-mask"/>+ <rect x="184" y="100" width="120" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(190 106) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g>+ <text data-detail-anchor x="244" y="128" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">SKILL.md</text>+ <text data-detail="context" x="244" y="144" class="t-muted" font-size="9" text-anchor="middle">layout rules</text>+ </g>++ <g id="node-ir" data-node-id="ir" data-node-label="JSON IR" tabindex="0" role="button" aria-label="Focus JSON IR, schema v1, archify/ skill package" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="schema v1" data-node-context="archify/ skill package">+ <title>JSON IR · schema v1 · archify/ skill package</title>+ <rect x="328" y="208" width="120" height="60" rx="6" class="c-mask"/>+ <rect x="328" y="208" width="120" height="60" rx="6" class="c-messagebus" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(334 214) scale(0.6875)">+ <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>+ <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>+ <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>+ <circle cx="7" cy="11.5" r="1" class="sigil-fill"/>+ </g>+ <text data-detail-anchor x="388" y="236" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">JSON IR</text>+ <text data-detail="context" x="388" y="252" class="t-muted" font-size="9" text-anchor="middle">schema v1</text>+ </g>++ <g id="node-schemas" data-node-id="schemas" data-node-label="Schema" tabindex="0" role="button" aria-label="Focus Schema, ajv, archify/ skill package" aria-pressed="false" data-node-kind="security" data-node-sublabel="ajv" data-node-context="archify/ skill package">+ <title>Schema · ajv · archify/ skill package</title>+ <rect x="328" y="100" width="120" height="60" rx="6" class="c-mask"/>+ <rect x="328" y="100" width="120" height="60" rx="6" class="c-security" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(334 106) scale(0.6875)">+ <path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>+ <path d="m5.8 8 1.5 1.5 3-3"/>+ </g>+ <text data-detail-anchor x="388" y="128" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Schema</text>+ <text data-detail="context" x="388" y="144" class="t-muted" font-size="9" text-anchor="middle">ajv</text>+ </g>++ <g id="node-renderers" data-node-id="renderers" data-node-label="Renderers ×5" tabindex="0" role="button" aria-label="Focus Renderers ×5, archify/ skill package" aria-pressed="false" data-node-kind="backend" data-node-context="archify/ skill package">+ <title>Renderers ×5 · archify/ skill package</title>+ <rect x="472" y="208" width="120" height="60" rx="6" class="c-mask"/>+ <rect x="472" y="208" width="120" height="60" rx="6" class="c-backend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(478 214) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g>+ <text x="532" y="242" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Renderers ×5</text>+ </g>++ <g id="node-template" data-node-id="template" data-node-label="template.html" tabindex="0" role="button" aria-label="Focus template.html, archify/ skill package" aria-pressed="false" data-node-kind="frontend" data-node-context="archify/ skill package">+ <title>template.html · archify/ skill package</title>+ <rect x="616" y="208" width="120" height="60" rx="6" class="c-mask"/>+ <rect x="616" y="208" width="120" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(622 214) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g>+ <text x="676" y="242" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">template.html</text>+ </g>++ <g id="node-checker" data-node-id="checker" data-node-label="Output Check" tabindex="0" role="button" aria-label="Focus Output Check, archify/ skill package" aria-pressed="false" data-node-kind="security" data-node-context="archify/ skill package">+ <title>Output Check · archify/ skill package</title>+ <rect x="760" y="208" width="120" height="60" rx="6" class="c-mask"/>+ <rect x="760" y="208" width="120" height="60" rx="6" class="c-security" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(766 214) scale(0.6875)">+ <path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>+ <path d="m5.8 8 1.5 1.5 3-3"/>+ </g>+ <text x="820" y="242" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Output Check</text>+ </g>++ <g id="node-html" data-node-id="html" data-node-label="HTML" tabindex="0" role="button" aria-label="Focus HTML, artifact, Architecture component" aria-pressed="false" data-node-kind="cloud" data-node-sublabel="artifact" data-node-context="Architecture component">+ <title>HTML · artifact · Architecture component</title>+ <rect x="904" y="208" width="120" height="60" rx="6" class="c-mask"/>+ <rect x="904" y="208" width="120" height="60" rx="6" class="c-cloud" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(910 214) scale(0.6875)">+ <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>+ </g>+ <text data-detail-anchor x="964" y="236" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">HTML</text>+ <text data-detail="context" x="964" y="252" class="t-muted" font-size="9" text-anchor="middle">artifact</text>+ </g>++ <!-- Connection labels -->++++++++++ <!-- Legend -->+ <g data-legend-bridge>+ <text x="40" y="327" class="t-primary" font-size="9" font-weight="600">Legend</text>+ <g data-legend-kind="external">+ <rect x="40" y="332" width="14" height="9" rx="2" class="c-external" stroke-width="1"/>+ <text x="60" y="340" class="t-muted" font-size="8">External</text>+ </g>+ <g data-legend-kind="frontend">+ <rect x="144" y="332" width="14" height="9" rx="2" class="c-frontend" stroke-width="1"/>+ <text x="164" y="340" class="t-muted" font-size="8">Frontend</text>+ </g>+ <g data-legend-kind="messagebus">+ <rect x="248" y="332" width="14" height="9" rx="2" class="c-messagebus" stroke-width="1"/>+ <text x="268" y="340" class="t-muted" font-size="8">Message bus</text>+ </g>+ <g data-legend-kind="security">+ <rect x="367" y="332" width="14" height="9" rx="2" class="c-security" stroke-width="1"/>+ <text x="387" y="340" class="t-muted" font-size="8">Security</text>+ </g>+ <g data-legend-kind="backend">+ <rect x="471" y="332" width="14" height="9" rx="2" class="c-backend" stroke-width="1"/>+ <text x="491" y="340" class="t-muted" font-size="8">Backend</text>+ </g>+ <g data-legend-kind="cloud">+ <rect x="570" y="332" width="14" height="9" rx="2" class="c-cloud" stroke-width="1"/>+ <text x="590" y="340" class="t-muted" font-size="8">Cloud</text>+ </g>+ </g>+ </svg>+ <p class="intent-trace-status no-print" id="intent-trace-status" role="status" aria-live="polite" aria-atomic="true"></p>+ <div class="share-chapter-cue no-print" id="share-chapter-cue" hidden role="status" aria-live="polite">+ <div class="share-chapter-index">+ <span class="share-chapter-state" id="share-chapter-state">Ready</span>+ <span class="share-chapter-count" id="share-chapter-count">Chapter 01 / 01</span>+ </div>+ <div class="share-chapter-copy">+ <strong id="share-chapter-label">Guided chapter</strong>+ <small id="share-chapter-note"></small>+ </div>+ <span class="share-chapter-route" id="share-chapter-route"></span>+ <span class="share-chapter-progress" aria-hidden="true"><span id="share-chapter-progress-bar"></span></span>+ </div>+ <div class="diagram-guide no-print" id="diagram-guide" hidden role="dialog" aria-modal="false" aria-labelledby="diagram-guide-title">+ <div class="diagram-guide-head">+ <span>+ <span class="diagram-guide-eyebrow">Diagram guide</span>+ <strong class="diagram-guide-title" id="diagram-guide-title">Explore this system</strong>+ </span>+ <button class="diagram-guide-close" id="diagram-guide-close" type="button" aria-label="Close diagram guide">×</button>+ </div>+ <p class="diagram-guide-stats" id="diagram-guide-stats">Inspecting compiled semantics</p>+ <div class="diagram-guide-actions" id="diagram-guide-actions" role="group" aria-label="Diagram exploration actions">+ <button class="diagram-guide-action" type="button" data-guide-action="find" aria-label="Find any node">+ <span class="diagram-guide-index" aria-hidden="true">01</span>+ <span class="diagram-guide-action-copy"><strong>Find any node</strong><small>Search labels, responsibilities, kinds, and stable IDs.</small></span>+ <kbd aria-hidden="true">/</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="route" aria-label="Trace a directed route">+ <span class="diagram-guide-index" aria-hidden="true">02</span>+ <span class="diagram-guide-action-copy"><strong>Trace a route</strong><small>Ask how two semantic nodes connect in authored direction.</small></span>+ <kbd aria-hidden="true">R</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="map" aria-label="See the whole system">+ <span class="diagram-guide-index" aria-hidden="true">03</span>+ <span class="diagram-guide-action-copy"><strong>See the whole system</strong><small>Open Semantic Radar with a live viewport and stable nodes.</small></span>+ <kbd aria-hidden="true">M</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="lens" aria-label="Compare semantic kinds">+ <span class="diagram-guide-index" aria-hidden="true">04</span>+ <span class="diagram-guide-action-copy"><strong>Compare semantic kinds</strong><small>Count roles, reveal their traffic, and compare direct authored links.</small></span>+ <kbd aria-hidden="true">L</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="story" aria-label="Play the guided story">+ <span class="diagram-guide-index" aria-hidden="true">05</span>+ <span class="diagram-guide-action-copy"><strong>Play the guided story</strong><small id="diagram-guide-story-copy">Walk the authored chapters and real relationships.</small></span>+ <kbd aria-hidden="true">P</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="present" aria-label="Enter presentation stage">+ <span class="diagram-guide-index" aria-hidden="true">06</span>+ <span class="diagram-guide-action-copy"><strong>Enter Presentation Stage</strong><small>Give the live diagram the viewport without changing export.</small></span>+ <kbd aria-hidden="true">F</kbd>+ </button>+ </div>+ <div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ </div>+ <p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p>+ </div>+ <div class="node-finder no-print" id="node-finder" hidden role="dialog" aria-modal="false" aria-labelledby="node-finder-title">+ <div class="node-finder-head">+ <strong id="node-finder-title">Find a node</strong>+ <button class="node-finder-close" id="node-finder-close" type="button" aria-label="Close node finder">×</button>+ </div>+ <div class="node-finder-search">+ <span aria-hidden="true">⌕</span>+ <input class="node-finder-input" id="node-finder-input" type="search" autocomplete="off" spellcheck="false" placeholder="Search labels or IDs" aria-describedby="node-finder-status">+ <kbd aria-hidden="true">/</kbd>+ </div>+ <div class="node-finder-results" id="node-finder-results" role="group" aria-label="Diagram nodes"></div>+ <p class="node-finder-empty" id="node-finder-empty" hidden>No matching nodes</p>+ <p class="node-finder-status" id="node-finder-status" aria-live="polite"></p>+ </div>+ <div class="focus-chip relationship-lens no-print" id="focus-chip" hidden role="region" aria-labelledby="relationship-lens-title">+ <div class="relationship-lens-head">+ <div class="relationship-lens-copy">+ <span class="relationship-lens-eyebrow">Semantic passport</span>+ <strong class="relationship-lens-title" id="relationship-lens-title"><span id="focus-label"></span></strong>+ <span class="semantic-passport-detail" id="focus-detail" hidden></span>+ <div class="semantic-passport-meta" id="focus-passport-meta" aria-label="Node metadata">+ <span id="focus-kind" data-passport="kind"></span>+ <span id="focus-context" data-passport="context" hidden></span>+ <span id="focus-tag" data-passport="tag" hidden></span>+ <code id="focus-id" data-passport="id"></code>+ </div>+ <span class="relationship-lens-summary" id="focus-summary" aria-live="polite"></span>+ </div>+ <div class="relationship-lens-actions">+ <button id="btn-focus-copy" type="button" aria-label="Copy link to focused node">Copy link</button>+ <button id="btn-focus-relations" type="button" aria-label="Show connected relationships" aria-expanded="false" aria-controls="relationship-lens-list">Relations</button>+ <button id="btn-focus-clear" type="button" aria-label="Clear focused node">Clear</button>+ </div>+ </div>+ <div class="relationship-lens-list" id="relationship-lens-list" aria-label="Connected relationships"></div>+ </div>+ <div class="route-probe no-print" id="route-probe" hidden role="region" aria-labelledby="route-probe-title" data-state="idle">+ <div class="route-probe-head">+ <span class="route-probe-copy">+ <span class="route-probe-eyebrow">Route probe</span>+ <strong class="route-probe-title" id="route-probe-title">Choose a start node</strong>+ </span>+ <span class="route-probe-actions">+ <button class="route-probe-find" id="route-probe-find" type="button" aria-label="Find a route start" data-node-finder-trigger>Find start</button>+ <button class="route-probe-copy-link" id="route-probe-copy" type="button" aria-label="Copy link to traced route" hidden>Copy link</button>+ <button id="route-probe-clear" type="button" aria-label="Clear route probe">Clear</button>+ </span>+ </div>+ <div class="route-probe-path" id="route-probe-path" aria-label="Traced route">+ <span class="route-probe-placeholder">Pick two semantic nodes on the diagram</span>+ </div>+ <div class="route-journey-controls" id="route-journey-controls" hidden role="group" aria-label="Route journey controls" data-playing="false">+ <button id="route-journey-prev" type="button" aria-label="Previous route position" title="Previous route position">←</button>+ <button class="route-journey-play" id="route-journey-play" type="button" aria-label="Play route journey" aria-pressed="false" title="Play route journey">+ <span id="route-journey-play-icon" aria-hidden="true">▶</span>+ <span id="route-journey-play-label">Journey</span>+ </button>+ <button id="route-journey-next" type="button" aria-label="Next route position" title="Next route position">→</button>+ <button class="route-journey-overview" id="route-journey-overview" type="button" aria-label="Show complete route overview" title="Show complete route overview">Overview</button>+ </div>+ <small class="route-probe-status" id="route-probe-status" aria-live="polite">Choose the source, then the destination. Direction matters.</small>+ </div>+ <div class="semantic-lens no-print" id="semantic-lens" hidden role="dialog" aria-modal="false" aria-labelledby="semantic-lens-title">+ <div class="semantic-lens-head">+ <span>+ <span class="semantic-lens-eyebrow">Semantic lens</span>+ <strong class="semantic-lens-title" id="semantic-lens-title">Compare system roles</strong>+ </span>+ <button class="semantic-lens-close" id="semantic-lens-close" type="button" aria-label="Close semantic lens">×</button>+ </div>+ <p class="semantic-lens-instruction">Choose up to two semantic kinds. One reveals its real traffic; two compare only direct authored relationships.</p>+ <div class="semantic-lens-kinds" id="semantic-lens-kinds" role="group" aria-label="Semantic kinds"></div>+ <p class="semantic-lens-status" id="semantic-lens-status" aria-live="polite">Choose a kind to inspect its nodes and touching relationships.</p>+ <div class="semantic-lens-actions">+ <button id="semantic-lens-copy" type="button" aria-label="Copy link to semantic lens" hidden>Copy link</button>+ <button id="semantic-lens-clear" type="button" aria-label="Clear semantic lens">Clear</button>+ </div>+ </div>+ <div class="overview-map no-print" id="overview-map" hidden role="region" aria-labelledby="overview-map-title">+ <div class="overview-map-head">+ <span class="overview-map-live" aria-hidden="true"></span>+ <span class="overview-map-copy">+ <strong id="overview-map-title">Semantic radar</strong>+ <small id="overview-map-status" aria-live="polite">Building overview</small>+ </span>+ <button class="overview-map-close" id="overview-map-close" type="button" aria-label="Close semantic radar">×</button>+ </div>+ <div class="overview-map-surface" id="overview-map-surface" tabindex="0" role="group" aria-label="Diagram overview. Click a node to focus it, or use arrow keys to pan."></div>+ <div class="overview-map-hint" aria-hidden="true"><span>Click node</span><span>Drag to pan</span></div>+ </div>+ <div class="diagram-nav no-print" role="toolbar" aria-label="Diagram view controls">+ <button id="btn-route-probe" type="button" aria-label="Trace a directed route" aria-pressed="false" aria-controls="route-probe" title="Trace route (R)">PATH</button>+ <button id="btn-overview-map" type="button" aria-label="Open semantic radar" aria-expanded="false" aria-controls="overview-map" title="Semantic radar (M)">MAP</button>+ <button id="btn-semantic-lens" type="button" aria-label="Open semantic lens" aria-haspopup="dialog" aria-expanded="false" aria-pressed="false" aria-controls="semantic-lens" title="Semantic lens (L)">LENS</button>+ <button id="btn-node-finder" type="button" aria-label="Find a node" aria-haspopup="dialog" aria-expanded="false" aria-controls="node-finder" title="Find a node (/)" data-node-finder-trigger>⌕</button>+ <button id="btn-diagram-guide" type="button" aria-label="Open diagram guide" aria-haspopup="dialog" aria-expanded="false" aria-controls="diagram-guide" title="Diagram guide (?)">?</button>+ <button data-view="out" type="button" aria-label="Zoom out" title="Zoom out (-)">−</button>+ <button data-view="reset" type="button" aria-label="Reset diagram view" title="Reset view (0)">100%</button>+ <button data-view="in" type="button" aria-label="Zoom in" title="Zoom in (+)">+</button>+ </div>+ </div>++ <!-- Info Cards -->+ <div class="cards">+ <div class="card">+ <div class="card-header">+ <div class="card-dot cyan"></div>+ <h3>Grid mode</h3>+ </div>+ <ul>+ <li>• Set layout.mode grid and place components with row/col</li>+ <li>• pos still overrides a cell when you need fine tuning</li>+ <li>• Not auto-layout — fixed cell spacing only</li>+ </ul></div></div>++ <!-- Footer -->+ <p class="footer">+ Architecture diagram • Built with Archify<span class="no-print"> • <a class="artifact-start-link" href="https://tt-a1i.github.io/archify/start.html?type=architecture" target="_blank" rel="noopener noreferrer">Create yours ↗</a> • Hover to trace • <kbd>R</kbd> route • Click to focus • <kbd>+</kbd>/<kbd>−</kbd> zoom • <kbd>M</kbd> radar • <kbd>T</kbd> theme • <kbd>E</kbd> export</span>+ </p></div>- <div class="container">- <!-- Header -->- <div class="header">- <div class="header-row">- <div class="pulse-dot"></div>- <h1>Archify Pipeline</h1>- </div>- <p class="subtitle">Grid placement demo — row/col instead of manual pos</p>- </div>+ <script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();++ /* ============================================================+ Theme toggle — persists to localStorage, respects system pref+ ============================================================ */++ Archify.theme = (function () {+ var STORAGE_KEY = 'archify-theme';+ var html = document.documentElement;+ var btn = document.getElementById('btn-theme');+ var icon = document.getElementById('theme-icon');+ var label = document.getElementById('theme-label');++ // localStorage can throw (blocked cookies, sandboxed iframes); the whole+ // script element dies on an uncaught error, so guard every access.+ function readStored() {+ try { return localStorage.getItem(STORAGE_KEY); } catch (_) { return null; }+ }+ function writeStored(value) {+ try { localStorage.setItem(STORAGE_KEY, value); } catch (_) {}+ }+ function urlOverride() {+ // URL param wins (useful for deterministic screenshots / share links)+ try {+ var param = new URLSearchParams(window.location.search).get('theme');+ if (param === 'light' || param === 'dark') return param;+ } catch (_) {}+ return null;+ }++ function resolveInitial() {+ var fromUrl = urlOverride();+ if (fromUrl) return fromUrl;+ var saved = readStored();+ if (saved === 'light' || saved === 'dark') return saved;+ return window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';+ }++ function apply(theme) {+ html.setAttribute('data-theme', theme);+ icon.textContent = theme === 'dark' ? '\u263E' : '\u263C';+ label.textContent = theme === 'dark' ? 'Dark' : 'Light';+ btn.setAttribute('aria-pressed', theme === 'light' ? 'true' : 'false');+ }++ function toggle() {+ var next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';+ apply(next);+ writeStored(next);+ }++ apply(resolveInitial());+ btn.addEventListener('click', toggle);++ // Follow live OS theme changes while the user has no explicit preference.+ try {+ var media = window.matchMedia('(prefers-color-scheme: light)');+ var onChange = function (e) {+ var saved = readStored();+ if (urlOverride() || saved === 'light' || saved === 'dark') return;+ apply(e.matches ? 'light' : 'dark');+ };+ if (media.addEventListener) media.addEventListener('change', onChange);+ else if (media.addListener) media.addListener(onChange);+ } catch (_) {}++ return { toggle: toggle };+ })();++ /* ============================================================+ Export — PNG / JPEG / WebP / SVG / WebM and Copy PNG (clipboard)++ Raster exports are always rendered at 4x source resolution for+ maximum sharpness. The trick: we set the serialized SVG's+ `width`/`height` to viewBox * 4 so the browser rasterizes the+ vectors at that resolution natively. drawImage then draws at+ the image's natural size (no upscaling = no blur).++ JPEG/WebP paint the current theme's background explicitly since+ those formats have no alpha channel.+ ============================================================ */+ (function () {+ var RASTER_SCALE = 4;+ var MOTION_DURATION = 6000;+ var MOTION_FPS = 30;++ function diagramFilename() {+ var title = (document.title || 'diagram')+ .replace(/\s+Architecture(\s+Diagram)?$/i, '')+ .replace(/\s+Diagram$/i, '')+ .trim();+ return title.replace(/[^a-z0-9_\-]+/gi, '-')+ .toLowerCase()+ .replace(/^-+|-+$/g, '') || 'diagram';+ }++ function currentBg() {+ return getComputedStyle(document.body).backgroundColor || '#ffffff';+ }++ /**+ * Serialize the main SVG into a standalone document.+ *+ * Two modes:+ * - Default (opts.autoTheme=false) — locks the serialized SVG to the+ * viewer's current theme. Used by the raster pipeline+ * (PNG/JPEG/WebP/clipboard) because canvas rasterization needs+ * deterministic colors; a raster cannot react to+ * prefers-color-scheme after encoding.+ * - autoTheme=true — emits BOTH dark and light variable sets plus a+ * `@media (prefers-color-scheme)` rule so the resulting SVG+ * self-themes when embedded in GitHub READMEs or other hosts that+ * expose a color scheme. Used for "Download SVG".+ */+ function serializeSvg(scale, opts) {+ // scale: integer multiplier for intrinsic SVG pixel dimensions used by+ // the raster path. Defaults to 1 (natural size) for SVG download.+ scale = scale || 1;+ opts = opts || {};+ var autoTheme = opts.autoTheme === true;+ var svg = document.querySelector('.diagram-container svg');+ var clone = svg.cloneNode(true);++ // View transforms and neighborhood focus are HTML exploration state,+ // never part of a downloaded full-diagram artifact.+ clone.style.removeProperty('transform');+ clone.removeAttribute('data-view-scale');+ clone.removeAttribute('data-focus-active');+ clone.removeAttribute('data-lens-active');+ clone.removeAttribute('data-lens-flow-count');+ clone.removeAttribute('data-lens-flow-density');+ clone.removeAttribute('data-legend-preview-active');+ clone.removeAttribute('data-relationship-preview-active');+ clone.removeAttribute('data-relationship-direct-active');+ clone.removeAttribute('data-relationship-pin-active');+ clone.removeAttribute('data-intent-trace-active');+ clone.removeAttribute('data-route-picking');+ clone.removeAttribute('data-route-active');+ clone.removeAttribute('data-route-journey');+ clone.removeAttribute('data-story-active');+ clone.removeAttribute('data-story-playing');+ clone.removeAttribute('data-story-beat');+ clone.removeAttribute('data-story-next');+ clone.removeAttribute('data-story-follow');+ clone.removeAttribute('data-chapter-handoff');+ clone.removeAttribute('data-chapter-anchor');+ clone.removeAttribute('data-chapter-preview');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-handoff-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-role]'), function (el) {+ el.removeAttribute('data-chapter-role');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-preview-role]'), function (el) {+ el.removeAttribute('data-chapter-preview-role');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-intent-trace-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-route-probe-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-route-journey-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-semantic-lens-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-bridge-runtime]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-kind]'), function (el) {+ el.removeAttribute('data-legend-kind');+ el.removeAttribute('data-legend-count');+ el.removeAttribute('data-legend-zero');+ el.removeAttribute('data-legend-selected');+ el.removeAttribute('role');+ el.removeAttribute('tabindex');+ el.removeAttribute('aria-label');+ el.removeAttribute('aria-pressed');+ el.removeAttribute('aria-haspopup');+ el.removeAttribute('aria-controls');+ el.removeAttribute('aria-expanded');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-bridge]'), function (el) {+ el.removeAttribute('data-legend-bridge');+ el.removeAttribute('role');+ el.removeAttribute('aria-label');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-pulse-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-hit-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-story-step], [data-story-beat-state], [data-story-beat-step]'), function (el) {+ el.removeAttribute('data-story-step');+ el.removeAttribute('data-story-beat-state');+ el.removeAttribute('data-story-beat-step');+ el.style.removeProperty('--story-step');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-focus-match], [data-focus-selected]'), function (el) {+ el.removeAttribute('data-focus-match');+ el.removeAttribute('data-focus-selected');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-lens-match], [data-lens-selected], [data-lens-peer]'), function (el) {+ el.removeAttribute('data-lens-match');+ el.removeAttribute('data-lens-selected');+ el.removeAttribute('data-lens-peer');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer]'), function (el) {+ el.removeAttribute('data-legend-preview-match');+ el.removeAttribute('data-legend-preview-selected');+ el.removeAttribute('data-legend-preview-peer');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target]'), function (el) {+ el.removeAttribute('data-relationship-preview');+ el.removeAttribute('data-relationship-preview-node');+ el.removeAttribute('data-relationship-preview-source');+ el.removeAttribute('data-relationship-preview-target');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-intent-trace-match], [data-intent-trace-selected]'), function (el) {+ el.removeAttribute('data-intent-trace-match');+ el.removeAttribute('data-intent-trace-selected');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current]'), function (el) {+ el.removeAttribute('data-route-match');+ el.removeAttribute('data-route-start');+ el.removeAttribute('data-route-end');+ el.removeAttribute('data-route-step');+ el.removeAttribute('data-route-candidate');+ el.removeAttribute('data-route-journey-state');+ el.removeAttribute('data-route-journey-current');+ el.style.removeProperty('--route-step');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {+ el.removeAttribute('data-detail');+ el.removeAttribute('data-detail-anchor');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-node-id][aria-pressed]'), function (el) {+ el.setAttribute('aria-pressed', 'false');+ });+ var canonicalStateClean = !clone.hasAttribute('data-view-scale') &&+ !clone.hasAttribute('data-focus-active') &&+ !clone.hasAttribute('data-lens-active') &&+ !clone.hasAttribute('data-lens-flow-count') &&+ !clone.hasAttribute('data-lens-flow-density') &&+ !clone.hasAttribute('data-legend-preview-active') &&+ !clone.hasAttribute('data-relationship-preview-active') &&+ !clone.hasAttribute('data-relationship-direct-active') &&+ !clone.hasAttribute('data-intent-trace-active') &&+ !clone.hasAttribute('data-route-picking') &&+ !clone.hasAttribute('data-route-active') &&+ !clone.hasAttribute('data-route-journey') &&+ !clone.hasAttribute('data-story-active') &&+ !clone.hasAttribute('data-story-playing') &&+ !clone.hasAttribute('data-story-beat') &&+ !clone.hasAttribute('data-story-next') &&+ !clone.hasAttribute('data-story-follow') &&+ !clone.hasAttribute('data-chapter-handoff') &&+ !clone.hasAttribute('data-chapter-anchor') &&+ !clone.hasAttribute('data-chapter-preview') &&+ !clone.style.getPropertyValue('transform') &&+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-detail], [data-detail-anchor]').length === 0;++ var vb = svg.viewBox.baseVal;+ // Scale width/height so the browser rasterizes the vectors at target+ // resolution directly. viewBox stays unchanged so coordinates don't+ // shift. This is the key to sharp rasters — do NOT scale later via+ // canvas upscaling.+ clone.setAttribute('width', vb.width * scale);+ clone.setAttribute('height', vb.height * scale);+ clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');++ // Only the SVG-relevant rules: semantic classes, markers, and the+ // theme variable blocks. Toolbar/cards/print CSS can never apply+ // inside a standalone SVG and would only bloat the export.+ var hostStyle = (function () {+ var out = [];+ Array.prototype.forEach.call(document.styleSheets, function (sheet) {+ var rules;+ try { rules = sheet.cssRules; } catch (_) { return; } // cross-origin+ if (!rules) return;+ Array.prototype.forEach.call(rules, function (rule) {+ if (rule.type === 7 && /^archify-/.test(rule.name || '')) {+ out.push(rule.cssText);+ return;+ }+ if (rule.type !== 1) return; // plain style rules only+ var sel = rule.selectorText || '';+ if (/(^|,)\s*(svg|:root|\[data-theme|\[data-preset|\.c-|\.t-|\.a-|\.m-)/.test(sel)) {+ out.push(rule.cssText);+ }+ });+ });+ return out.join('\n');+ })();++ // Derive the variable list from the stylesheet so newly added theme+ // variables can never be missed by the export pipeline again+ // (--lane-fill/--lane-stroke once were).+ var varNames = (function () {+ var seen = {};+ var names = [];+ (hostStyle.match(/--[a-zA-Z0-9-]+(?=\s*:)/g) || []).forEach(function (n) {+ if (!seen[n]) { seen[n] = true; names.push(n); }+ });+ return names;+ })();++ // Resolve the full variable set for a given data-theme via an+ // off-DOM probe, independent of what the viewer is currently set to.+ function resolveVars(themeAttr) {+ var probe = document.createElement('div');+ probe.setAttribute('data-theme', themeAttr);+ probe.setAttribute('data-preset', document.documentElement.getAttribute('data-preset') || 'classic');+ probe.style.cssText = 'position:absolute;width:0;height:0;visibility:hidden;';+ document.body.appendChild(probe);+ try {+ var c = getComputedStyle(probe);+ return varNames.map(function (n) {+ return n + ': ' + c.getPropertyValue(n).trim() + ';';+ }).join(' ');+ } finally {+ document.body.removeChild(probe);+ }+ }++ // Prepend a local()-only @font-face block for each weight so that the+ // sandboxed image-rendering context used during PNG/JPEG/WebP export+ // can find JetBrains Mono if the user has it installed locally, and+ // falls through cleanly to the monospace stack otherwise. The usual+ // Google-Fonts <link> in the host document is unreachable from the+ // serialized SVG, so url()-sourced faces would just hang.+ var fontFallback = [400, 500, 600, 700].map(function (w) {+ return "@font-face { font-family: 'JetBrains Mono'; font-weight: " + w ++ "; src: local('JetBrains Mono'), local('JetBrainsMono-Regular'); }";+ }).join('\n');++ var style = document.createElementNS('http://www.w3.org/2000/svg', 'style');+ var bgRect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');+ bgRect.setAttribute('width', '100%');+ bgRect.setAttribute('height', '100%');++ if (autoTheme) {+ // Dual-theme SVG. Dark is the default (so hosts without+ // prefers-color-scheme still render), light swaps in via media+ // query, and svg[data-theme="..."] still lets downstream+ // consumers force a specific theme.+ var darkVars = resolveVars('dark');+ var lightVars = resolveVars('light');++ style.textContent =+ fontFallback + "\n" ++ "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" ++ hostStyle + "\n" ++ ":root, svg { " + darkVars + " }\n" ++ "@media (prefers-color-scheme: light) { :root, svg { " + lightVars + " } }\n" ++ "svg[data-theme=\"light\"] { " + lightVars + " }\n" ++ "svg[data-theme=\"dark\"] { " + darkVars + " }\n" ++ "rect.c-bg-rect { fill: var(--bg); }\n";++ // Don't lock the serialized SVG to the viewer's current theme.+ clone.removeAttribute('data-theme');+ // Background follows the CSS variable, not a fixed color, so it+ // swaps with the media query.+ bgRect.setAttribute('class', 'c-bg-rect');+ } else {+ // Raster path: lock to the viewer's current theme.+ var theme = document.documentElement.getAttribute('data-theme') || 'dark';+ var themeHost = document.querySelector('[data-theme="' + theme + '"]') || document.documentElement;+ var computed = getComputedStyle(themeHost);+ var vars = varNames.map(function (n) {+ return n + ': ' + computed.getPropertyValue(n).trim() + ';';+ }).join(' ');++ // IMPORTANT: inject the resolved variables AFTER hostStyle,+ // otherwise hostStyle's ":root, [data-theme=\"dark\"] { ... }" rule+ // overrides our chosen theme via later-in-cascade equal-specificity.+ // Keep this order.+ style.textContent =+ fontFallback + "\n" ++ "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" ++ hostStyle + "\n" ++ ":root, svg { " + vars + " }\n";++ bgRect.setAttribute('fill', computed.getPropertyValue('--bg').trim() || '#ffffff');+ }++ clone.insertBefore(style, clone.firstChild);+ clone.insertBefore(bgRect, style.nextSibling);++ return {+ svgString: new XMLSerializer().serializeToString(clone),+ width: vb.width * scale,+ height: vb.height * scale,+ canonicalStateClean: canonicalStateClean+ };+ }++ function download(blob, filename) {+ var url = URL.createObjectURL(blob);+ var a = document.createElement('a');+ a.href = url;+ a.download = filename;+ document.body.appendChild(a);+ a.click();+ a.remove();+ setTimeout(function () { URL.revokeObjectURL(url); }, 1000);+ }++ // Conservative upper bound on total canvas pixels. Older Safari on iOS+ // silently produces a blank canvas above ~16 Mpx; Chrome / Firefox /+ // desktop Safari are far higher but start failing on memory-constrained+ // devices. We pick the largest integer scale in {4,3,2,1} whose target+ // pixel count fits under this cap.+ var MAX_CANVAS_PIXELS = 16 * 1024 * 1024;++ function pickSafeScale(vbW, vbH) {+ for (var s = RASTER_SCALE; s >= 1; s--) {+ if (vbW * s * vbH * s <= MAX_CANVAS_PIXELS) return s;+ }+ return 1;+ }++ function rasterize(format) {+ // Serialize at a safe scale (RASTER_SCALE=4 by default, reduced if the+ // resulting canvas would exceed MAX_CANVAS_PIXELS). The SVG itself is+ // rasterized at target resolution natively; drawImage draws at natural+ // size — no upsampling blur.+ var svg = document.querySelector('.diagram-container svg');+ var vb = svg.viewBox.baseVal;+ var scale = pickSafeScale(vb.width, vb.height);+ var data = serializeSvg(scale);+ var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });+ var svgUrl = URL.createObjectURL(svgBlob);++ return new Promise(function (resolve, reject) {+ var img = new Image();+ img.onload = function () {+ var canvas = document.createElement('canvas');+ canvas.width = data.width;+ canvas.height = data.height;+ var ctx = canvas.getContext('2d');+ if (format === 'jpeg') {+ ctx.fillStyle = currentBg();+ ctx.fillRect(0, 0, canvas.width, canvas.height);+ }+ // Draw at natural size — SVG was already rasterized at target res.+ ctx.drawImage(img, 0, 0);+ URL.revokeObjectURL(svgUrl);+ var mime = format === 'jpeg' ? 'image/jpeg' :+ format === 'webp' ? 'image/webp' : 'image/png';+ var quality = format === 'png' ? undefined : 0.95;+ canvas.toBlob(function (blob) {+ if (!blob) reject(new Error('toBlob returned null for ' + format));+ else resolve(blob);+ }, mime, quality);+ };+ img.onerror = function (e) {+ URL.revokeObjectURL(svgUrl);+ reject(e);+ };+ img.src = svgUrl;+ });+ }++ function motionMimeType() {+ if (typeof MediaRecorder === 'undefined') return '';+ var candidates = [+ 'video/webm;codecs=vp9',+ 'video/webm;codecs=vp8',+ 'video/webm'+ ];+ for (var i = 0; i < candidates.length; i++) {+ if (!MediaRecorder.isTypeSupported || MediaRecorder.isTypeSupported(candidates[i])) return candidates[i];+ }+ return '';+ }++ function canRecordMotion() {+ var svg = document.querySelector('.diagram-container svg');+ return !!(svg && svg.getAttribute('data-animation') === 'trace' &&+ typeof MediaRecorder !== 'undefined' && motionMimeType() &&+ typeof HTMLCanvasElement !== 'undefined' &&+ typeof HTMLCanvasElement.prototype.captureStream === 'function');+ }++ // Record the live CSS animation without Puppeteer, ffmpeg, or a network+ // dependency. SVG files loaded through Image are commonly rasterized as+ // one cached bitmap, so repeatedly drawing that Image does not reliably+ // advance its CSS animation. Keep one crisp static SVG background, then+ // render an explicit time-varying signal scene over the real authored+ // relationship geometry on every captured canvas frame.+ function recordWebm(options) {+ options = options || {};+ if (!canRecordMotion()) {+ return Promise.reject(new Error('WebM motion export requires a trace animation and browser MediaRecorder support'));+ }+ var duration = Math.max(250, Number(options.duration) || MOTION_DURATION);+ var fps = Math.max(1, Number(options.fps) || MOTION_FPS);+ var svg = document.querySelector('.diagram-container svg');+ var vb = svg.viewBox.baseVal;+ var scale = Math.min(1, 1280 / vb.width);+ var data = serializeSvg(scale);+ var sourceUrl = URL.createObjectURL(new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' }));++ function createMotionScene(root) {+ var rootMatrix = root.getCTM ? root.getCTM() : null;++ function pointInRoot(element, point) {+ if (!rootMatrix || !element.getCTM || !point.matrixTransform) return { x: point.x, y: point.y };+ try {+ var elementMatrix = element.getCTM();+ if (!elementMatrix) return { x: point.x, y: point.y };+ var mapped = point.matrixTransform(rootMatrix.inverse().multiply(elementMatrix));+ return { x: mapped.x, y: mapped.y };+ } catch (_) {+ return { x: point.x, y: point.y };+ }+ }++ function samplesFor(element) {+ if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];+ var length;+ try { length = element.getTotalLength(); } catch (_) { return []; }+ if (!Number.isFinite(length) || length <= 0) return [];+ var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));+ var points = [];+ for (var i = 0; i <= count; i++) {+ points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));+ }+ return points;+ }++ function authoredStep(element, fallback) {+ var raw = element.style.getPropertyValue('--step') || getComputedStyle(element).getPropertyValue('--step');+ var value = Number(raw);+ return Number.isFinite(value) ? value : fallback;+ }++ var edges = Array.prototype.slice.call(root.querySelectorAll('[data-animate="edge"]')).map(function (element, index) {+ var computed = getComputedStyle(element);+ return {+ points: samplesFor(element),+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ width: Math.max(1.5, parseFloat(computed.strokeWidth) || 1.5),+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(function (edge) { return edge.points.length > 1; });++ var nodes = Array.prototype.slice.call(root.querySelectorAll('[data-node-id][data-animate="node"]')).map(function (element, index) {+ var box;+ try { box = element.getBBox(); } catch (_) { return null; }+ var painted = element.querySelector('[class*="c-"]') || element;+ var computed = getComputedStyle(painted);+ return {+ x: box.x,+ y: box.y,+ width: box.width,+ height: box.height,+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(Boolean);++ return { edges: edges, nodes: nodes, x: vb.x, y: vb.y, width: vb.width, height: vb.height };+ }++ function pointAlong(points, progress) {+ var scaled = Math.max(0, Math.min(1, progress)) * (points.length - 1);+ var index = Math.min(points.length - 2, Math.floor(scaled));+ var mix = scaled - index;+ return {+ x: points[index].x + (points[index + 1].x - points[index].x) * mix,+ y: points[index].y + (points[index + 1].y - points[index].y) * mix+ };+ }++ function roundedRectPath(ctx, x, y, width, height, radius) {+ var r = Math.max(0, Math.min(radius, width / 2, height / 2));+ ctx.beginPath();+ ctx.moveTo(x + r, y);+ ctx.lineTo(x + width - r, y);+ ctx.quadraticCurveTo(x + width, y, x + width, y + r);+ ctx.lineTo(x + width, y + height - r);+ ctx.quadraticCurveTo(x + width, y + height, x + width - r, y + height);+ ctx.lineTo(x + r, y + height);+ ctx.quadraticCurveTo(x, y + height, x, y + height - r);+ ctx.lineTo(x, y + r);+ ctx.quadraticCurveTo(x, y, x + r, y);+ ctx.closePath();+ }++ function drawMotionFrame(ctx, backgroundImage, motionScene, elapsed) {+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.drawImage(backgroundImage, 0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.save();+ ctx.scale(ctx.canvas.width / motionScene.width, ctx.canvas.height / motionScene.height);+ ctx.translate(-motionScene.x, -motionScene.y);++ motionScene.edges.forEach(function (edge) {+ var duration = 1.75;+ var progress = (elapsed - edge.delay) / duration;+ if (progress < 0 || progress > 1) return;+ var head = Math.max(0, Math.min(1, progress));+ var tail = Math.max(0, head - 0.24);+ var opacity = Math.sin(Math.PI * Math.min(1, progress));++ ctx.save();+ ctx.strokeStyle = edge.color;+ ctx.fillStyle = edge.color;+ ctx.lineCap = 'round';+ ctx.lineJoin = 'round';+ ctx.lineWidth = Math.max(3.2, edge.width * 2.2);+ ctx.globalAlpha = 0.42 + opacity * 0.5;+ ctx.shadowColor = edge.color;+ ctx.shadowBlur = 10;+ ctx.beginPath();+ for (var i = 0; i <= 14; i++) {+ var trailPoint = pointAlong(edge.points, tail + (head - tail) * i / 14);+ if (i === 0) ctx.moveTo(trailPoint.x, trailPoint.y);+ else ctx.lineTo(trailPoint.x, trailPoint.y);+ }+ ctx.stroke();++ var point = pointAlong(edge.points, head);+ ctx.globalAlpha = 0.95;+ ctx.beginPath();+ ctx.arc(point.x, point.y, 4.8, 0, Math.PI * 2);+ ctx.fill();+ ctx.restore();+ });++ motionScene.nodes.forEach(function (node) {+ var progress = (elapsed - node.delay) / 2.6;+ if (progress < 0 || progress > 1) return;+ var pulse = Math.sin(Math.PI * progress);+ if (pulse <= 0.02) return;+ ctx.save();+ ctx.strokeStyle = node.color;+ ctx.lineWidth = 1.4 + pulse * 1.8;+ ctx.globalAlpha = pulse * 0.5;+ ctx.shadowColor = node.color;+ ctx.shadowBlur = 12 * pulse;+ var inset = 2 + pulse * 3;+ roundedRectPath(ctx, node.x - inset, node.y - inset, node.width + inset * 2, node.height + inset * 2, 8);+ ctx.stroke();+ ctx.restore();+ });++ ctx.restore();+ }++ var motionScene = createMotionScene(svg);++ return new Promise(function (resolve, reject) {+ var backgroundImage = new Image();+ backgroundImage.onload = function () {+ var canvas = document.createElement('canvas');+ canvas.width = Math.max(2, Math.round(data.width / 2) * 2);+ canvas.height = Math.max(2, Math.round(data.height / 2) * 2);+ var ctx = canvas.getContext('2d');+ var stream = canvas.captureStream(fps);+ var mime = motionMimeType();+ var recorder;+ try {+ recorder = new MediaRecorder(stream, { mimeType: mime, videoBitsPerSecond: 6000000 });+ } catch (err) {+ URL.revokeObjectURL(sourceUrl);+ stream.getTracks().forEach(function (track) { track.stop(); });+ reject(err);+ return;+ }+ var chunks = [];+ var raf = 0;+ var stopped = false;+ var startedAt = performance.now();+ function cleanup() {+ if (stopped) return;+ stopped = true;+ cancelAnimationFrame(raf);+ URL.revokeObjectURL(sourceUrl);+ stream.getTracks().forEach(function (track) { track.stop(); });+ }+ function draw(now) {+ var elapsed = Math.max(0, ((Number(now) || performance.now()) - startedAt) / 1000);+ drawMotionFrame(ctx, backgroundImage, motionScene, elapsed);+ raf = requestAnimationFrame(draw);+ }+ recorder.ondataavailable = function (event) {+ if (event.data && event.data.size) chunks.push(event.data);+ };+ recorder.onerror = function (event) {+ cleanup();+ reject(event.error || new Error('MediaRecorder failed'));+ };+ recorder.onstop = function () {+ cleanup();+ var blob = new Blob(chunks, { type: recorder.mimeType || mime });+ if (!blob.size) reject(new Error('MediaRecorder produced an empty WebM'));+ else resolve(blob);+ };+ drawMotionFrame(ctx, backgroundImage, motionScene, 0);+ recorder.start(250);+ startedAt = performance.now();+ raf = requestAnimationFrame(draw);+ setTimeout(function () {+ if (recorder.state === 'inactive') return;+ // Chromium normally emits the final chunk during stop(), but+ // some embedded browser shells need an explicit encoder flush+ // first. Keep the short grace window bounded and harmless for+ // browsers that already delivered timeslice chunks.+ try { recorder.requestData(); } catch (_) {}+ setTimeout(function () {+ if (recorder.state !== 'inactive') recorder.stop();+ }, 120);+ }, duration);+ };+ backgroundImage.onerror = function () {+ URL.revokeObjectURL(sourceUrl);+ reject(new Error('SVG background could not be loaded for WebM export'));+ };+ backgroundImage.src = sourceUrl;+ });+ }++ var menu = document.getElementById('export-menu');+ var btn = document.getElementById('btn-export');+ var items = function () {+ return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));+ };++ // ---- Clipboard support ----------------------------------------------+ function canCopyImage() {+ return typeof ClipboardItem !== 'undefined' &&+ navigator.clipboard &&+ typeof navigator.clipboard.write === 'function';+ }++ // ---- Raster format detection ----------------------------------------+ // canvas.toBlob('image/webp') silently returns a PNG on browsers without+ // WebP encoding (older Safari), so detect explicitly.+ function supports(format) {+ if (format === 'svg' || format === 'png') return true;+ if (format === 'webm') return canRecordMotion();+ var mime = format === 'jpeg' ? 'image/jpeg' : 'image/webp';+ try {+ var c = document.createElement('canvas');+ c.width = c.height = 2;+ return c.toDataURL(mime).indexOf('data:' + mime) === 0;+ } catch (_) { return false; }+ }++ // Gray out unsupported items.+ items().forEach(function (it) {+ if (it.dataset.format && !supports(it.dataset.format)) {+ it.disabled = true;+ it.title = 'Not supported by this browser';+ it.style.opacity = '0.5';+ }+ if (it.dataset.action === 'copy' && !canCopyImage()) {+ it.disabled = true;+ it.title = 'Clipboard image write not supported by this browser';+ it.style.opacity = '0.5';+ }+ });++ // ---- Toast ----------------------------------------------------------+ // A live region only announces CHANGES to an existing node, so the toast+ // element is created once up front and updated in place.+ var toastEl = document.createElement('div');+ toastEl.className = 'archify-toast';+ toastEl.setAttribute('role', 'status');+ document.body.appendChild(toastEl);+ var toastTimer = null;++ function toast(msg) {+ toastEl.textContent = '';+ requestAnimationFrame(function () {+ toastEl.textContent = msg;+ toastEl.classList.add('show');+ });+ clearTimeout(toastTimer);+ toastTimer = setTimeout(function () { toastEl.classList.remove('show'); }, 1500);+ }++ function open(focusLast) {+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });+ menu.classList.add('open');+ btn.setAttribute('aria-expanded', 'true');+ var available = items().filter(function (i) { return !i.disabled; });+ var target = focusLast ? available[available.length - 1] : available[0];+ if (target) target.focus();+ }+ function close(focusTrigger) {+ menu.classList.remove('open');+ btn.setAttribute('aria-expanded', 'false');+ if (focusTrigger) btn.focus();+ }+ function isOpen() { return menu.classList.contains('open'); }++ btn.addEventListener('click', function (e) {+ e.stopPropagation();+ if (isOpen()) close(false);+ else open();+ });+ // APG menu-button pattern: ArrowDown/ArrowUp on the trigger opens the menu.+ btn.addEventListener('keydown', function (e) {+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {+ e.preventDefault();+ if (!isOpen()) open(e.key === 'ArrowUp');+ }+ });+ document.addEventListener('click', function (e) {+ if (!menu.contains(e.target) && e.target !== btn) close(false);+ });++ // Keyboard navigation inside the menu.+ // Menu items: Up/Down, Home/End.+ // Esc closes + returns focus to trigger; Tab closes.+ menu.addEventListener('keydown', function (e) {+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }+ if (e.key === 'Tab') { close(false); return; }++ var available = items().filter(function (i) { return !i.disabled; });+ var current = available.indexOf(document.activeElement);+ switch (e.key) {+ case 'ArrowDown':+ e.preventDefault();+ if (available.length) available[(current + 1 + available.length) % available.length].focus();+ break;+ case 'ArrowUp':+ e.preventDefault();+ if (available.length) available[(current - 1 + available.length) % available.length].focus();+ break;+ case 'Home':+ e.preventDefault();+ if (available[0]) available[0].focus();+ break;+ case 'End':+ e.preventDefault();+ if (available.length) available[available.length - 1].focus();+ break;+ }+ });++ function runExport(format) {+ var base = diagramFilename();+ close(true);+ document.documentElement.removeAttribute('data-last-export-error');+ document.documentElement.removeAttribute('data-last-export-error-format');+ if (format === 'webm') toast('Recording 6 seconds of motion…');+ return (format === 'svg'+ ? Promise.resolve(serializeSvg(1, { autoTheme: true })).then(function (d) {+ var blob = new Blob([d.svgString], { type: 'image/svg+xml;charset=utf-8' });+ recordExportReceipt('svg', blob, d.canonicalStateClean);+ download(blob, base + '.svg');+ })+ : format === 'webm'+ ? recordWebm().then(function (blob) {+ document.documentElement.setAttribute('data-last-motion-bytes', String(blob.size));+ recordExportReceipt('webm', blob, true);+ download(blob, base + '.webm');+ toast('Downloaded WebM');+ })+ : rasterize(format).then(function (blob) {+ recordExportReceipt(format, blob, true);+ download(blob, base + '.' + format);+ })+ ).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : format;+ document.documentElement.setAttribute('data-last-export-error-format', format);+ document.documentElement.setAttribute('data-last-export-error', message);+ if (format === 'webm' && /MediaRecorder|WebM motion export|empty WebM/i.test(message)) {+ var motionItem = menu.querySelector('button[data-format="webm"]');+ if (motionItem) {+ motionItem.disabled = true;+ motionItem.title = 'Motion capture unavailable in this browser';+ motionItem.style.opacity = '0.5';+ }+ toast('WebM unavailable in this browser');+ return;+ }+ alert('Export failed: ' + message);+ });+ }++ // A compact, machine-readable receipt for local QA and generated proof+ // galleries. It exposes no diagram contents, only the completed format,+ // byte count, and whether temporary viewer state was excluded.+ function recordExportReceipt(format, blob, canonical) {+ document.documentElement.setAttribute('data-last-export-format', format);+ document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));+ document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');+ }++ function runCopy() {+ close(true);+ if (!canCopyImage()) {+ alert('Clipboard image write not supported in this browser.');+ return;+ }+ // WebKit requires ClipboardItem to be constructed synchronously inside+ // the user gesture — pass the pending Promise<Blob> as the item value.+ // Browsers that reject promise values throw synchronously; fall back+ // to awaiting the blob first (works in Chromium/Firefox).+ var blobPromise = rasterize('png');+ var writePromise;+ try {+ writePromise = navigator.clipboard.write([new ClipboardItem({ 'image/png': blobPromise })]);+ } catch (_) {+ writePromise = blobPromise.then(function (blob) {+ return navigator.clipboard.write([new ClipboardItem({ 'image/png': blob })]);+ });+ }+ return writePromise.then(function () {+ toast('Copied PNG to clipboard');+ }).catch(function (err) {+ console.error(err);+ alert('Copy failed: ' + (err && err.message ? err.message : 'unknown'));+ });+ }++ menu.addEventListener('click', function (e) {+ var copyBtn = e.target.closest('button[data-action="copy"]');+ if (copyBtn && !copyBtn.disabled) { runCopy(); return; }++ var formatBtn = e.target.closest('button[data-format]');+ if (formatBtn && !formatBtn.disabled) { runExport(formatBtn.dataset.format); }+ });++ Archify.motion = { canRecord: canRecordMotion, recordWebm: recordWebm };+ Archify.exportMenu = { open: open, close: close, isOpen: isOpen, run: runExport };++ // Auto-open on page load for demo/screenshot purposes: ?openExport=1+ // Wait for fonts (so the menu doesn't flash before typography lands)+ // and paint before opening. Fallback timeout for browsers without the+ // Font Loading API.+ try {+ if (new URLSearchParams(window.location.search).get('openExport') === '1') {+ var openWhenReady = function () {+ requestAnimationFrame(function () { requestAnimationFrame(open); });+ };+ if (document.fonts && document.fonts.ready) {+ document.fonts.ready.then(openWhenReady);+ } else {+ setTimeout(openWhenReady, 200);+ }+ }+ } catch (_) {}+ })();++ /* ============================================================+ Motion Governor — one reader switch and one motion budget. Ambient+ trace yields to the strongest semantic owner; Still also parks bounded+ viewer signals without discarding their static meaning.+ ============================================================ */+ Archify.motionGovernor = (function () {+ var STORAGE_KEY = 'archify-motion';+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-motion');+ var label = document.getElementById('motion-label');+ var motionQuery = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;+ var capable = !!(svg && svg.getAttribute('data-animation') === 'trace');+ var readerPaused = false;+ var suspensions = Object.create(null);+ var explicitOwner = '';+ var owner = '';+ var ownerToken = 0;+ var ownerCleanup = null;+ var lastEffectivePaused = null;+ var ambientStarted = false;+ var ambientPending = new Set();++ function detachAmbientBoundary() {+ if (!svg) return;+ svg.removeEventListener('animationend', onAmbientBoundary, true);+ svg.removeEventListener('animationcancel', onAmbientBoundary, true);+ }+ function settleAmbient(reason) {+ if (!capable) return false;+ ambientStarted = true;+ ambientPending.clear();+ detachAmbientBoundary();+ html.setAttribute('data-ambient-motion', 'settled');+ html.setAttribute('data-ambient-settle-reason', reason || 'complete');+ return true;+ }+ function onAmbientBoundary(event) {+ if (!ambientPending.has(event.target)) return;+ ambientPending.delete(event.target);+ if (!ambientPending.size) settleAmbient('complete');+ }+ function startAmbient() {+ if (ambientStarted || !capable) return false;+ ambientStarted = true;+ ambientPending = new Set(Array.prototype.slice.call(svg.querySelectorAll('[data-animate="edge"], [data-animate="node"]')));+ if (!ambientPending.size) return settleAmbient('empty');+ svg.addEventListener('animationend', onAmbientBoundary, true);+ svg.addEventListener('animationcancel', onAmbientBoundary, true);+ html.setAttribute('data-ambient-motion', 'running');+ html.removeAttribute('data-ambient-settle-reason');+ return true;+ }++ function readStored() {+ try { return localStorage.getItem(STORAGE_KEY); } catch (_) { return null; }+ }+ function writeStored() {+ try {+ if (readerPaused) localStorage.setItem(STORAGE_KEY, 'still');+ else localStorage.removeItem(STORAGE_KEY);+ } catch (_) {}+ }+ function reducedMotion() {+ return !!(motionQuery && motionQuery.matches);+ }+ function hasSuspension() {+ return Object.keys(suspensions).length > 0;+ }+ function effectivePaused() {+ return readerPaused || reducedMotion() || hasSuspension();+ }+ function ownerLabel(value) {+ if (value === 'story') return 'the guided story';+ if (value === 'chapter') return 'the active chapter';+ if (value === 'chapter-preview') return 'the chapter delta preview';+ if (value === 'handoff') return 'the chapter handoff';+ if (value === 'route') return 'Route Probe';+ if (value === 'lens') return 'Semantic Lens';+ if (value === 'relationship') return 'Relationship Preview';+ if (value === 'intent') return 'Intent Trace';+ if (value === 'focus') return 'semantic focus';+ if (value === 'legend') return 'legend preview';+ return 'reader interaction';+ }+ function render() {+ if (!capable) return;+ var systemPaused = reducedMotion();+ var paused = effectivePaused();+ html.setAttribute('data-motion', paused ? 'still' : 'live');+ if (paused || owner || html.hasAttribute('data-embed') || html.hasAttribute('data-share-playback') || html.hasAttribute('data-document-hidden')) {+ settleAmbient('suppressed');+ } else if (!ambientStarted) {+ startAmbient();+ }+ btn.setAttribute('aria-pressed', paused ? 'false' : 'true');+ btn.disabled = systemPaused;+ label.textContent = paused ? 'Still' : 'Live';+ if (paused && lastEffectivePaused !== true && Archify.guidedViews && Archify.guidedViews.isPlaying()) {+ Archify.guidedViews.pause();+ }+ if (paused && lastEffectivePaused !== true && Archify.guidedViews && Archify.guidedViews.settleHandoff) {+ Archify.guidedViews.settleHandoff(systemPaused ? 'reduced-motion' : (hasSuspension() ? 'hidden' : 'still'));+ }+ if (paused && lastEffectivePaused !== true && Archify.routeProbe && Archify.routeProbe.isJourneyPlaying && Archify.routeProbe.isJourneyPlaying()) {+ Archify.routeProbe.pauseJourney({ preserveElapsed: true, reason: systemPaused ? 'reduced-motion' : (hasSuspension() ? 'hidden' : 'still') });+ }+ lastEffectivePaused = paused;+ if (Archify.routeProbe && typeof Archify.routeProbe.syncMotion === 'function') Archify.routeProbe.syncMotion();+ if (systemPaused) {+ btn.setAttribute('aria-label', 'Motion paused by reduced-motion preference');+ btn.title = 'Motion paused by reduced-motion preference';+ } else if (hasSuspension()) {+ btn.setAttribute('aria-label', 'Motion paused while this page is hidden');+ btn.title = 'Motion paused while this page is hidden';+ } else if (paused) {+ btn.setAttribute('aria-label', 'Resume motion');+ btn.title = 'Resume motion';+ } else if (owner) {+ btn.setAttribute('aria-label', 'Pause motion; currently yielding to ' + ownerLabel(owner));+ btn.title = 'Live preview enabled · yielding to ' + ownerLabel(owner);+ } else {+ btn.setAttribute('aria-label', 'Pause motion');+ btn.title = 'Pause motion';+ }+ }+ function setPaused(next, options) {+ options = options || {};+ readerPaused = !!next;+ if (options.persist !== false) writeStored();+ render();+ return readerPaused;+ }+ function publishOwner() {+ owner = explicitOwner || deriveOwner();+ if (owner) html.setAttribute('data-motion-owner', owner);+ else html.removeAttribute('data-motion-owner');+ render();+ return owner;+ }+ function deriveOwner() {+ if (!svg) return '';+ if (svg.hasAttribute('data-story-playing') || svg.hasAttribute('data-story-follow')) return 'story';+ if (svg.hasAttribute('data-story-active')) return 'chapter';+ if (svg.hasAttribute('data-route-picking') || svg.hasAttribute('data-route-active')) return 'route';+ if (svg.hasAttribute('data-lens-active')) return 'lens';+ if (svg.hasAttribute('data-relationship-preview-active')) return 'relationship';+ if (svg.hasAttribute('data-intent-trace-active')) return 'intent';+ if (svg.hasAttribute('data-focus-active')) return 'focus';+ if (svg.hasAttribute('data-legend-preview-active')) return 'legend';+ return '';+ }+ function clearClaim(preempted) {+ var cleanup = ownerCleanup;+ ownerCleanup = null;+ explicitOwner = '';+ if (preempted && cleanup) {+ try { cleanup(); } catch (_) {}+ }+ }+ function claim(next, cleanup) {+ if (!capable || !next) return 0;+ clearClaim(true);+ ownerToken += 1;+ explicitOwner = next;+ ownerCleanup = typeof cleanup === 'function' ? cleanup : null;+ publishOwner();+ return ownerToken;+ }+ function release(token) {+ if (!capable || token !== ownerToken || !explicitOwner) return false;+ clearClaim(false);+ ownerToken += 1;+ publishOwner();+ return true;+ }+ function suspend(reason) {+ var key = String(reason || 'runtime');+ var active = true;+ suspensions[key] = (suspensions[key] || 0) + 1;+ render();+ return function () {+ if (!active) return false;+ active = false;+ if (suspensions[key] > 1) suspensions[key] -= 1;+ else delete suspensions[key];+ render();+ return true;+ };+ }+ function syncVisibility() {+ if (document.hidden) {+ suspensions.visibility = true;+ html.setAttribute('data-document-hidden', 'true');+ } else {+ delete suspensions.visibility;+ html.removeAttribute('data-document-hidden');+ }+ render();+ }++ if (!capable) {+ btn.hidden = true;+ html.removeAttribute('data-motion-capable');+ html.removeAttribute('data-motion');+ html.removeAttribute('data-motion-owner');+ html.removeAttribute('data-ambient-motion');+ html.removeAttribute('data-ambient-settle-reason');+ return {+ capable: false,+ pause: function () { return false; },+ resume: function () { return false; },+ toggle: function () { return false; },+ setMode: function () { return 'still'; },+ mode: function () { return 'still'; },+ claim: function () { return 0; },+ release: function () { return false; },+ suspend: function () { return function () { return false; }; },+ isPaused: function () { return true; },+ owner: function () { return ''; }+ };+ }++ html.setAttribute('data-motion-capable', 'true');+ btn.hidden = false;+ readerPaused = readStored() === 'still';+ btn.addEventListener('click', function () { setPaused(!readerPaused); });+ if (motionQuery) {+ if (typeof motionQuery.addEventListener === 'function') motionQuery.addEventListener('change', render);+ else if (typeof motionQuery.addListener === 'function') motionQuery.addListener(render);+ }+ document.addEventListener('visibilitychange', syncVisibility);+ if (document.documentElement.getAttribute('data-embed') !== 'true' && typeof MutationObserver !== 'undefined' && typeof Node !== 'undefined' && svg instanceof Node) {+ var ownerObserver = new MutationObserver(function () { publishOwner(); });+ ownerObserver.observe(svg, {+ attributes: true,+ attributeFilter: [+ 'data-story-playing', 'data-story-follow', 'data-story-active', 'data-route-picking', 'data-route-active',+ 'data-lens-active', 'data-relationship-preview-active', 'data-intent-trace-active',+ 'data-focus-active', 'data-legend-preview-active'+ ]+ });+ }+ syncVisibility();+ publishOwner();+ render();++ return {+ capable: true,+ pause: function () { return setPaused(true); },+ resume: function () { return setPaused(false); },+ toggle: function () { return setPaused(!readerPaused); },+ setMode: function (next, options) {+ setPaused(next === 'still', options);+ return effectivePaused() ? 'still' : 'live';+ },+ mode: function () { return effectivePaused() ? 'still' : 'live'; },+ claim: claim,+ release: release,+ suspend: suspend,+ isPaused: effectivePaused,+ owner: function () { return owner; }+ };+ })();++ /* ============================================================+ Explore — stable-ID neighborhood focus + dependency-free pan/zoom.+ Renderer IDs become deep-linkable semantic hooks without turning the+ standalone artifact into a canvas editor.+ ============================================================ */+ Archify.focus = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector('svg');+ var chip = document.getElementById('focus-chip');+ var label = document.getElementById('focus-label');+ var detail = document.getElementById('focus-detail');+ var kind = document.getElementById('focus-kind');+ var context = document.getElementById('focus-context');+ var tag = document.getElementById('focus-tag');+ var semanticId = document.getElementById('focus-id');+ var summary = document.getElementById('focus-summary');+ var relationshipList = document.getElementById('relationship-lens-list');+ var copyBtn = document.getElementById('btn-focus-copy');+ var relationsBtn = document.getElementById('btn-focus-relations');+ var clearBtn = document.getElementById('btn-focus-clear');+ var activeIds = [];+ var hoveredRelationship = null;+ var focusedRelationship = null;+ var pinnedRelationship = null;+ var pinnedRelationshipKey = null;+ var activeRelationshipPreview = null;+ var relationshipHitOverlay = null;+ var relationshipHitTargets = [];+ var directPreviewTimer = null;+ var svgNamespace = 'http://www.w3.org/2000/svg';+ var reducedMotionQuery = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;+ var finePointerQuery = window.matchMedia ? window.matchMedia('(hover: hover) and (pointer: fine)') : null;++ function nodes() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ }+ function edges() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ }+ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') || (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '');+ }+ function setPassportValue(element, value) {+ var normalized = value == null ? '' : String(value).trim();+ element.textContent = normalized;+ element.hidden = !normalized;+ }+ function renderPassport(id, node) {+ setPassportValue(detail, node.getAttribute('data-node-sublabel'));+ setPassportValue(kind, node.getAttribute('data-node-kind') || 'node');+ setPassportValue(context, node.getAttribute('data-node-context'));+ setPassportValue(tag, node.getAttribute('data-node-tag'));+ semanticId.textContent = id;+ semanticId.hidden = false;+ }+ function relationshipsFor(id, byId) {+ var seen = {};+ var relationships = [];+ edges().forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (from !== id && to !== id) return;+ var edgeLabel = edge.getAttribute('data-edge-label') || '';+ var edgeKey = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + edgeLabel);+ var edgeId = edge.getAttribute('data-edge-id') || '';+ if (seen[edgeKey]) return;+ seen[edgeKey] = true;+ var direction = from === id && to === id ? 'loop' : (from === id ? 'out' : 'in');+ var neighborId = direction === 'in' ? from : to;+ var neighbor = byId[neighborId];+ relationships.push({+ key: edgeKey,+ id: edgeId,+ from: from,+ to: to,+ direction: direction,+ neighborId: neighborId,+ neighborLabel: neighbor ? nodeLabel(neighbor, neighborId) : neighborId,+ label: edgeLabel || (direction === 'loop' ? 'loops back' : direction === 'out' ? 'connects to' : 'connects from')+ });+ });+ return relationships;+ }+ function relationshipEdgeShapes(edge) {+ if (!edge) return [];+ if (/^(path|line|polyline)$/i.test(edge.tagName || '')) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function relationshipHitRecords() {+ var recordsByKey = {};+ var recordsById = {};+ var byId = {};+ nodes().forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ var records = [];+ edges().forEach(function (edge) {+ var shapes = relationshipEdgeShapes(edge);+ if (!shapes.length) return;+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var labelValue = edge.getAttribute('data-edge-label') || '';+ var edgeId = edge.getAttribute('data-edge-id') || '';+ var key = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + labelValue);+ var existing = recordsByKey[key];+ if (existing) {+ if (existing.from !== from || existing.to !== to || existing.labelValue !== labelValue || existing.id !== edgeId) {+ existing.invalid = true;+ return;+ }+ shapes.forEach(function (shape) {+ if (existing.shapes.indexOf(shape) === -1) existing.shapes.push(shape);+ });+ return;+ }+ var record = {+ key: key,+ id: edgeId,+ from: from,+ to: to,+ fromLabel: byId[from] ? nodeLabel(byId[from], from) : from,+ toLabel: byId[to] ? nodeLabel(byId[to], to) : to,+ labelValue: labelValue,+ label: labelValue || (from === to ? 'loops back' : 'connects to'),+ edge: edge,+ shapes: shapes,+ invalid: false+ };+ recordsByKey[key] = record;+ if (edgeId) {+ if (recordsById[edgeId]) {+ recordsById[edgeId].invalid = true;+ record.invalid = true;+ } else {+ recordsById[edgeId] = record;+ }+ }+ records.push(record);+ });+ return records.filter(function (record) { return !record.invalid && record.from && record.to; });+ }+ function relationshipRecordForKey(key) {+ return relationshipHitRecords().find(function (record) { return record.key === key; }) || null;+ }+ function pinnedRelationshipRecord() {+ return pinnedRelationshipKey ? relationshipRecordForKey(pinnedRelationshipKey) : null;+ }+ function renderRelationshipCopyAction() {+ var record = pinnedRelationshipRecord();+ if (record && record.id) {+ copyBtn.textContent = 'Copy relation';+ copyBtn.setAttribute('aria-label', 'Copy link to pinned relationship');+ } else if (pinnedRelationshipKey) {+ copyBtn.textContent = 'Copy node';+ copyBtn.setAttribute('aria-label', 'Copy link to source node');+ } else {+ copyBtn.textContent = 'Copy link';+ copyBtn.setAttribute('aria-label', 'Copy link to focused node');+ }+ }+ function relationshipHitGeometry(shape, className) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('filter');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('tabindex');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('aria-hidden');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.setAttribute('class', className || 'relationship-hit-rail');+ return clone;+ }+ function removeRelationshipPulse() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-relationship-pulse-overlay]'), function (element) {+ element.remove();+ });+ }+ function relationshipPulseGeometry(shape) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('transform');+ clone.removeAttribute('filter');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('tabindex');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-hidden');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-focus-match');+ clone.removeAttribute('data-relationship-preview');+ clone.setAttribute('class', 'relationship-flow-pulse');+ clone.setAttribute('pathLength', '1');+ return clone;+ }+ function relationshipTokenKind(edge) {+ var shapes = relationshipEdgeShapes(edge);+ var classEvidence = [edge.getAttribute('class') || ''].concat(shapes.map(function (shape) {+ return shape.getAttribute('class') || '';+ })).join(' ');+ var from = edge.getAttribute('data-edge-from') || '';+ var to = edge.getAttribute('data-edge-to') || '';+ var source = nodes().find(function (node) { return node.getAttribute('data-node-id') === from; });+ var target = nodes().find(function (node) { return node.getAttribute('data-node-id') === to; });+ var sourceKind = source ? source.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ var targetKind = target ? target.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ if (/\ba-security\b/.test(classEvidence) || sourceKind === 'security' || targetKind === 'security' || targetKind === 'failure') return 'security';+ if (/\ba-dashed\b/.test(classEvidence) || sourceKind === 'messagebus' || targetKind === 'messagebus') return 'event';+ if (sourceKind === 'database' || targetKind === 'database') return 'data';+ if (targetKind === 'waiting' || targetKind === 'success') return 'state';+ return 'call';+ }+ function relationshipTokenPath(shape) {+ if (!shape) return '';+ var tagName = String(shape.tagName || '').toLowerCase();+ if (tagName === 'path') return shape.getAttribute('d') || '';+ if (tagName === 'line') {+ return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') ++ ' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');+ }+ if (tagName === 'polyline' && shape.points && shape.points.numberOfItems > 1) {+ var commands = [];+ for (var i = 0; i < shape.points.numberOfItems; i += 1) {+ var point = shape.points.getItem(i);+ commands.push((i === 0 ? 'M ' : 'L ') + point.x + ' ' + point.y);+ }+ return commands.join(' ');+ }+ return '';+ }+ function relationshipTokenPart(tagName, className, attrs) {+ var part = document.createElementNS(svgNamespace, tagName);+ part.setAttribute('class', className);+ Object.keys(attrs || {}).forEach(function (name) { part.setAttribute(name, attrs[name]); });+ return part;+ }+ function relationshipTokenGeometry(shape, kind, key, options) {+ options = options || {};+ var pathData = relationshipTokenPath(shape);+ if (!pathData) return null;+ var token = document.createElementNS(svgNamespace, 'g');+ token.setAttribute('class', 'semantic-flow-token ' + (options.className || 'relationship-flow-token'));+ token.setAttribute('data-token-kind', kind);+ token.setAttribute('data-token-edge-key', key);+ token.setAttribute('aria-hidden', 'true');+ token.appendChild(relationshipTokenPart('circle', 'semantic-flow-token-halo', { cx: '0', cy: '0', r: '7' }));+ if (kind === 'data') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-5', y: '-4', width: '10', height: '8', rx: '2' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -2.8 -1.2 h 5.6 M -2.8 1.4 h 3.8' }));+ } else if (kind === 'event') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-7', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-2', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '3', y: '-3', width: '4', height: '6', rx: '1' }));+ } else if (kind === 'security') {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-shape', { d: 'M 0 -5 L 4 -3.4 V 0 c 0 3 -1.6 4.5 -4 5.5 C -2.4 4.5 -4 3 -4 0 v -3.4 Z' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'm -2 .2 1.4 1.4 L 2 -1.4' }));+ } else if (kind === 'state') {+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-shape', { cx: '0', cy: '0', r: '5' }));+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-dot', { cx: '0', cy: '0', r: '1.35' }));+ } else {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -5 -3 L -1 0 L -5 3 M 0 -3 L 4 0 L 0 3' }));+ }+ var motion = document.createElementNS(svgNamespace, 'animateMotion');+ motion.setAttribute('path', pathData);+ motion.setAttribute('dur', options.duration || '1.2s');+ motion.setAttribute('begin', '0s');+ motion.setAttribute('fill', 'freeze');+ motion.setAttribute('rotate', 'auto');+ motion.setAttribute('calcMode', 'spline');+ motion.setAttribute('keyTimes', '0;1');+ motion.setAttribute('keySplines', '.2 0 .2 1');+ token.appendChild(motion);+ return token;+ }+ function createSemanticFlowToken(edge, shape, options) {+ if (!edge || !shape) return null;+ var key = edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ return relationshipTokenGeometry(shape, relationshipTokenKind(edge), key, options);+ }+ Archify.flowTokens = {+ create: createSemanticFlowToken,+ kind: function (edge) { return relationshipTokenKind(edge); },+ path: relationshipTokenPath+ };+ function renderRelationshipPulse(key) {+ removeRelationshipPulse();+ if (!key || document.documentElement.getAttribute('data-embed') === 'true') return false;+ if (document.hidden || (Archify.motionGovernor && Archify.motionGovernor.isPaused())) return false;+ if (reducedMotionQuery && reducedMotionQuery.matches) return false;+ var matchingEdges = edges().filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ if (!matchingEdges.length) return false;+ var overlay = document.createElementNS(svgNamespace, 'g');+ overlay.setAttribute('class', 'relationship-pulse-overlay');+ overlay.setAttribute('data-relationship-pulse-overlay', '');+ overlay.setAttribute('data-relationship-pulse-key', key);+ overlay.setAttribute('aria-hidden', 'true');+ var tokenAdded = false;+ matchingEdges.forEach(function (edge) {+ var wrapper = document.createElementNS(svgNamespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ var shapes = relationshipEdgeShapes(edge);+ shapes.forEach(function (shape) {+ wrapper.appendChild(relationshipPulseGeometry(shape));+ });+ if (!tokenAdded && shapes.length) {+ var tokenKind = relationshipTokenKind(edge);+ var token = relationshipTokenGeometry(shapes[0], tokenKind, key);+ if (token) {+ wrapper.appendChild(token);+ overlay.setAttribute('data-relationship-token-kind', tokenKind);+ tokenAdded = true;+ }+ }+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ if (!overlay.childNodes.length) return false;+ var finishPulse = function () {+ if (overlay.parentNode) overlay.remove();+ };+ overlay.addEventListener('animationend', finishPulse, { once: true });+ overlay.addEventListener('animationcancel', finishPulse, { once: true });+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ return true;+ }+ function clearRelationshipPreview(options) {+ options = options || {};+ if (directPreviewTimer) window.clearTimeout(directPreviewTimer);+ directPreviewTimer = null;+ removeRelationshipPulse();+ activeRelationshipPreview = null;+ svg.removeAttribute('data-relationship-preview-active');+ svg.removeAttribute('data-relationship-direct-active');+ if (options.clearPin === true) {+ pinnedRelationship = null;+ pinnedRelationshipKey = null;+ svg.removeAttribute('data-relationship-pin-active');+ }+ chip.removeAttribute('data-relationship-previewing');+ edges().forEach(function (edge) { edge.removeAttribute('data-relationship-preview'); });+ nodes().forEach(function (node) {+ node.removeAttribute('data-relationship-preview-node');+ node.removeAttribute('data-relationship-preview-source');+ node.removeAttribute('data-relationship-preview-target');+ });+ Array.prototype.forEach.call(relationshipList.querySelectorAll('[data-preview-active]'), function (button) {+ button.removeAttribute('data-preview-active');+ });+ relationshipHitTargets.forEach(function (target) {+ target.setAttribute('aria-pressed', pinnedRelationshipKey && target.getAttribute('data-relationship-key') === pinnedRelationshipKey ? 'true' : 'false');+ target.removeAttribute('data-preview-active');+ });+ renderRelationshipCopyAction();+ requestLensPlacement();+ }+ function previewRelationship(button, options) {+ options = options || {};+ if (pinnedRelationshipKey && pinnedRelationship && button !== pinnedRelationship) return;+ clearRelationshipPreview();+ if (!button) return;+ var key = button.getAttribute('data-relationship-key');+ var from = button.getAttribute('data-relationship-from');+ var to = button.getAttribute('data-relationship-to');+ if (!key || !from || !to) return;+ svg.setAttribute('data-relationship-preview-active', key);+ if (options.direct === true) svg.setAttribute('data-relationship-direct-active', key);+ edges().forEach(function (edge) {+ if (edge.getAttribute('data-edge-key') === key) edge.setAttribute('data-relationship-preview', '');+ });+ nodes().forEach(function (node) {+ var id = node.getAttribute('data-node-id');+ if (id !== from && id !== to) return;+ node.setAttribute('data-relationship-preview-node', '');+ if (id === from) node.setAttribute('data-relationship-preview-source', '');+ if (id === to) node.setAttribute('data-relationship-preview-target', '');+ });+ button.setAttribute('data-preview-active', 'true');+ if (!chip.hidden && options.direct !== true) chip.setAttribute('data-relationship-previewing', 'true');+ activeRelationshipPreview = button;+ renderRelationshipPulse(key);+ requestLensPlacement();+ }+ function syncRelationshipPreview() {+ var next = pinnedRelationship || focusedRelationship || hoveredRelationship;+ if (next === activeRelationshipPreview) return;+ previewRelationship(next, { direct: !!(next && next.hasAttribute('data-relationship-hit-key')) });+ }+ function directRelationshipBlocked() {+ return html.getAttribute('data-embed') === 'true' ||+ html.getAttribute('data-guide-open') === 'true' ||+ container.classList.contains('is-panning') ||+ (activeIds.length > 0 && !pinnedRelationshipKey) ||+ svg.hasAttribute('data-story-active') ||+ svg.hasAttribute('data-route-picking') ||+ svg.hasAttribute('data-route-active') ||+ svg.hasAttribute('data-lens-active') ||+ svg.hasAttribute('data-chapter-preview');+ }+ function scheduleDirectRelationshipPreview(target) {+ if (directPreviewTimer) window.clearTimeout(directPreviewTimer);+ if (pinnedRelationshipKey) return;+ directPreviewTimer = window.setTimeout(function () {+ directPreviewTimer = null;+ if (pinnedRelationshipKey || hoveredRelationship !== target || directRelationshipBlocked()) return;+ previewRelationship(target, { direct: true });+ }, reducedMotionQuery && reducedMotionQuery.matches ? 0 : 90);+ }+ function relationshipHitTarget(key) {+ return relationshipHitTargets.find(function (target) {+ return target.getAttribute('data-relationship-key') === key;+ }) || null;+ }+ function revealPinnedRelationship(record) {+ function reveal() {+ if (!record || pinnedRelationshipKey !== record.key) return true;+ if (!Archify.view || typeof Archify.view.reveal !== 'function') return false;+ Archify.view.reveal([record.from, record.to], { reason: 'relationship-direct' });+ return true;+ }+ if (!reveal()) requestAnimationFrame(reveal);+ }+ function inspectRelationship(key, options) {+ options = options || {};+ if (html.getAttribute('data-embed') === 'true') return false;+ if (directPreviewTimer) window.clearTimeout(directPreviewTimer);+ directPreviewTimer = null;+ hoveredRelationship = null;+ focusedRelationship = null;+ if (pinnedRelationshipKey === key) {+ if (options.toggle === false) return true;+ clear({ updateUrl: options.updateUrl !== false });+ return true;+ }+ var record = relationshipRecordForKey(key);+ if (!record) return false;+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ set(record.from, { toggle: false, updateUrl: false });+ var row = Array.prototype.slice.call(relationshipList.querySelectorAll('[data-relationship-key]')).find(function (candidate) {+ return candidate.getAttribute('data-relationship-key') === key;+ });+ if (!row) return false;+ previewRelationship(row);+ pinnedRelationship = row;+ pinnedRelationshipKey = key;+ svg.setAttribute('data-relationship-pin-active', key);+ var target = relationshipHitTarget(key);+ if (target) target.setAttribute('aria-pressed', 'true');+ renderRelationshipCopyAction();+ summary.textContent = 'Pinned relationship · ' + record.fromLabel + ' → ' + record.toLabel + ' · ' + record.label;+ revealPinnedRelationship(record);+ if (options.updateUrl !== false && record.id) {+ try { history.replaceState(null, '', location.pathname + location.search + '#relation=' + encodeURIComponent(record.id)); } catch (_) {}+ }+ return true;+ }+ function inspectRelationshipById(id, options) {+ var record = relationshipHitRecords().find(function (item) { return item.id === id; });+ return record ? inspectRelationship(record.key, options) : false;+ }+ function installRelationshipHitTargets() {+ if (html.getAttribute('data-embed') === 'true') return 0;+ var records = relationshipHitRecords();+ if (!records.length) return 0;+ relationshipHitOverlay = document.createElementNS(svgNamespace, 'g');+ relationshipHitOverlay.setAttribute('class', 'relationship-hit-overlay');+ relationshipHitOverlay.setAttribute('data-relationship-hit-overlay', '');+ relationshipHitOverlay.setAttribute('role', 'group');+ relationshipHitOverlay.setAttribute('aria-label', 'Direct relationship explorer');+ var relationshipHelp = document.createElementNS(svgNamespace, 'desc');+ relationshipHelp.id = 'archify-relationship-help';+ relationshipHelp.textContent = 'Use arrow keys to explore relationships. Press Enter or Space to pin details; Escape clears.';+ relationshipHitOverlay.appendChild(relationshipHelp);+ records.forEach(function (record, index) {+ var target = document.createElementNS(svgNamespace, 'g');+ target.setAttribute('class', 'relationship-hit-target');+ target.setAttribute('data-relationship-hit-key', record.key);+ target.setAttribute('data-relationship-key', record.key);+ target.setAttribute('data-relationship-from', record.from);+ target.setAttribute('data-relationship-to', record.to);+ if (record.id) target.setAttribute('data-relationship-id', record.id);+ target.setAttribute('role', 'button');+ target.setAttribute('tabindex', index === 0 ? '0' : '-1');+ target.setAttribute('aria-pressed', 'false');+ target.setAttribute('aria-describedby', relationshipHelp.id);+ var description = 'Inspect relationship ' + (index + 1) + ' of ' + records.length + ': ' + record.fromLabel + ' to ' + record.toLabel + ', ' + record.label + '. Press Enter for details.';+ target.setAttribute('aria-label', description);+ var title = document.createElementNS(svgNamespace, 'title');+ title.textContent = record.fromLabel + ' \u2192 ' + record.toLabel + ' \u00b7 ' + record.label;+ target.appendChild(title);+ record.shapes.forEach(function (shape) {+ target.appendChild(relationshipHitGeometry(shape));+ target.appendChild(relationshipHitGeometry(shape, 'relationship-focus-rail'));+ });+ if (target.childNodes.length > 1) {+ relationshipHitTargets.push(target);+ relationshipHitOverlay.appendChild(target);+ }+ });+ if (!relationshipHitTargets.length) return 0;+ var firstNode = svg.querySelector('[data-node-id]');+ var nodeLayer = firstNode;+ while (nodeLayer && nodeLayer.parentNode && nodeLayer.parentNode !== svg) nodeLayer = nodeLayer.parentNode;+ if (nodeLayer && nodeLayer.parentNode === svg) svg.insertBefore(relationshipHitOverlay, nodeLayer);+ else svg.appendChild(relationshipHitOverlay);++ relationshipHitOverlay.addEventListener('pointerdown', function (event) {+ if (event.target.closest('[data-relationship-hit-key]')) event.stopPropagation();+ });+ relationshipHitOverlay.addEventListener('pointerover', function (event) {+ if (event.pointerType === 'touch') return;+ if (finePointerQuery && !finePointerQuery.matches) return;+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || directRelationshipBlocked() || pinnedRelationshipKey) return;+ if (event.relatedTarget && target.contains(event.relatedTarget)) return;+ hoveredRelationship = target;+ scheduleDirectRelationshipPreview(target);+ });+ relationshipHitOverlay.addEventListener('pointerout', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || (event.relatedTarget && target.contains(event.relatedTarget))) return;+ if (hoveredRelationship === target) hoveredRelationship = null;+ syncRelationshipPreview();+ });+ relationshipHitOverlay.addEventListener('focusin', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || directRelationshipBlocked()) return;+ focusedRelationship = target;+ if (!pinnedRelationshipKey) previewRelationship(target, { direct: true });+ });+ relationshipHitOverlay.addEventListener('focusout', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || (event.relatedTarget && target.contains(event.relatedTarget))) return;+ if (focusedRelationship === target) focusedRelationship = null;+ syncRelationshipPreview();+ });+ relationshipHitOverlay.addEventListener('click', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || directRelationshipBlocked()) return;+ event.preventDefault();+ event.stopPropagation();+ focusedRelationship = null;+ hoveredRelationship = null;+ inspectRelationship(target.getAttribute('data-relationship-key'));+ });+ relationshipHitOverlay.addEventListener('keydown', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target) return;+ if (event.key === 'Escape' && pinnedRelationshipKey) {+ event.preventDefault();+ clear({ updateUrl: false });+ return;+ }+ if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault();+ focusedRelationship = null;+ hoveredRelationship = null;+ inspectRelationship(target.getAttribute('data-relationship-key'));+ return;+ }+ if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft' && event.key !== 'ArrowDown' && event.key !== 'ArrowUp' && event.key !== 'Home' && event.key !== 'End') return;+ var index = relationshipHitTargets.indexOf(target);+ if (event.key === 'Home') index = 0;+ else if (event.key === 'End') index = relationshipHitTargets.length - 1;+ else if (event.key === 'ArrowRight' || event.key === 'ArrowDown') index = (index + 1) % relationshipHitTargets.length;+ else index = (index - 1 + relationshipHitTargets.length) % relationshipHitTargets.length;+ event.preventDefault();+ relationshipHitTargets.forEach(function (item, itemIndex) { item.setAttribute('tabindex', itemIndex === index ? '0' : '-1'); });+ try { relationshipHitTargets[index].focus({ preventScroll: true }); }+ catch (_) { try { relationshipHitTargets[index].focus(); } catch (_) {} }+ });+ return relationshipHitTargets.length;+ }+ function renderRelationshipLens(id, byId) {+ hoveredRelationship = null;+ focusedRelationship = null;+ clearRelationshipPreview({ clearPin: true });+ renderPassport(id, byId[id]);+ var relationships = relationshipsFor(id, byId);+ chip.removeAttribute('data-relations-expanded');+ relationsBtn.setAttribute('aria-expanded', 'false');+ relationsBtn.textContent = relationships.length + ' relation' + (relationships.length === 1 ? '' : 's');+ relationsBtn.setAttribute('aria-label', 'Show ' + relationships.length + ' connected relationship' + (relationships.length === 1 ? '' : 's'));+ var counts = { out: 0, in: 0, loop: 0 };+ relationships.forEach(function (relationship) { counts[relationship.direction] += 1; });+ summary.textContent = counts.out + ' outgoing · ' + counts.in + ' incoming' + (counts.loop ? ' · ' + counts.loop + ' loop' : '');+ relationshipList.textContent = '';+ if (!relationships.length) {+ var empty = document.createElement('p');+ empty.className = 'relationship-lens-empty';+ empty.textContent = 'No connected relationships';+ relationshipList.appendChild(empty);+ return;+ }++ [+ { id: 'out', label: 'Outgoing' },+ { id: 'in', label: 'Incoming' },+ { id: 'loop', label: 'Self loops' }+ ].forEach(function (group) {+ var items = relationships.filter(function (relationship) { return relationship.direction === group.id; });+ if (!items.length) return;+ var section = document.createElement('div');+ section.className = 'relationship-lens-group';+ var heading = document.createElement('span');+ heading.className = 'relationship-lens-group-title';+ heading.textContent = group.label + ' · ' + items.length;+ section.appendChild(heading);+ items.forEach(function (relationship) {+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'relationship-lens-row';+ button.setAttribute('data-direction', relationship.direction);+ button.setAttribute('data-relationship-target', relationship.neighborId);+ button.setAttribute('data-relationship-key', relationship.key);+ button.setAttribute('data-relationship-from', relationship.from);+ button.setAttribute('data-relationship-to', relationship.to);+ if (relationship.id) button.setAttribute('data-relationship-id', relationship.id);+ button.setAttribute('aria-label', group.label + ': ' + relationship.label + ', ' + relationship.neighborLabel);+ var direction = document.createElement('span');+ direction.className = 'relationship-lens-direction';+ direction.setAttribute('aria-hidden', 'true');+ direction.textContent = relationship.direction === 'out' ? 'OUT →' : relationship.direction === 'in' ? '← IN' : 'LOOP';+ var target = document.createElement('strong');+ target.textContent = relationship.neighborLabel;+ var relation = document.createElement('small');+ relation.textContent = relationship.label;+ button.appendChild(direction);+ button.appendChild(target);+ button.appendChild(relation);+ section.appendChild(button);+ });+ relationshipList.appendChild(section);+ });+ }+ var lensFrame = 0;+ function placeRelationshipLens() {+ lensFrame = 0;+ if (chip.hidden || activeIds.length !== 1) return;+ var node = svg.querySelector('[data-node-id="' + activeIds[0] + '"]');+ if (!node) return;+ var containerRect = container.getBoundingClientRect();+ var nodeRect = node.getBoundingClientRect();+ if (containerRect.bottom <= 0 || containerRect.top >= window.innerHeight) return;+ var padding = window.innerWidth <= 720 ? 8 : 16;+ var visibleTop = Math.max(padding, -containerRect.top + padding);+ var visibleBottom = Math.min(containerRect.height - padding, window.innerHeight - containerRect.top - padding);+ var maxTop = Math.max(padding, visibleBottom - chip.offsetHeight);+ var minTop = Math.min(visibleTop, maxTop);+ var nodeCenter = nodeRect.top - containerRect.top + nodeRect.height / 2;+ var mobile = window.innerWidth <= 720;+ var previewingOnMobile = mobile && chip.getAttribute('data-relationship-previewing') === 'true';+ var compactOnMobile = mobile && chip.getAttribute('data-relations-expanded') !== 'true';+ var preferred;+ if (compactOnMobile) {+ var nodeTop = nodeRect.top - containerRect.top;+ var nodeBottom = nodeRect.bottom - containerRect.top;+ var gap = 10;+ var above = nodeTop - chip.offsetHeight - gap;+ var below = nodeBottom + gap;+ if (above >= visibleTop) preferred = above;+ else if (below + chip.offsetHeight <= visibleBottom - 56) preferred = below;+ else preferred = nodeCenter < (visibleTop + visibleBottom) / 2+ ? Math.max(minTop, visibleBottom - chip.offsetHeight - 56)+ : visibleTop;+ } else if (previewingOnMobile) {+ var pinnedTop = visibleTop;+ var pinnedBottom = Math.max(minTop, visibleBottom - chip.offsetHeight - 56);+ preferred = nodeCenter < (visibleTop + visibleBottom) / 2 ? pinnedBottom : pinnedTop;+ } else {+ preferred = nodeCenter - chip.offsetHeight / 2;+ }+ var top = Math.max(minTop, Math.min(maxTop, preferred));+ chip.style.top = Math.round(top) + 'px';+ if (Archify.radar && typeof Archify.radar.sync === 'function') Archify.radar.sync();+ }+ function requestLensPlacement() {+ if (lensFrame) return;+ lensFrame = requestAnimationFrame(placeRelationshipLens);+ }+ function clear(options) {+ options = options || {};+ if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') {+ Archify.intentTrace.clear({ announce: false });+ }+ hoveredRelationship = null;+ focusedRelationship = null;+ clearRelationshipPreview({ clearPin: true });+ activeIds = [];+ svg.removeAttribute('data-focus-active');+ nodes().forEach(function (node) {+ node.removeAttribute('data-focus-match');+ node.removeAttribute('data-focus-selected');+ node.setAttribute('aria-pressed', 'false');+ });+ edges().forEach(function (edge) { edge.removeAttribute('data-focus-match'); });+ chip.hidden = true;+ label.textContent = '';+ detail.textContent = '';+ detail.hidden = true;+ kind.textContent = '';+ kind.hidden = true;+ context.textContent = '';+ context.hidden = true;+ tag.textContent = '';+ tag.hidden = true;+ semanticId.textContent = '';+ semanticId.hidden = true;+ summary.textContent = '';+ relationshipList.textContent = '';+ copyBtn.textContent = 'Copy link';+ copyBtn.setAttribute('aria-label', 'Copy link to focused node');+ relationsBtn.textContent = 'Relations';+ relationsBtn.setAttribute('aria-label', 'Show connected relationships');+ relationsBtn.setAttribute('aria-expanded', 'false');+ chip.removeAttribute('data-relations-expanded');+ chip.style.removeProperty('top');+ if (options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ if (options.updateUrl !== false) {+ try { history.replaceState(null, '', location.pathname + location.search); } catch (_) {}+ }+ }++ function setMany(ids, options) {+ options = options || {};+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.semanticLens && Archify.semanticLens.active()) {+ Archify.semanticLens.clear({ updateUrl: false, preserveView: true, closePanel: true });+ }+ if (options.preserveRoute !== true && Archify.routeProbe && typeof Archify.routeProbe.clear === 'function') {+ Archify.routeProbe.clear({ updateUrl: false, restoreFocus: false });+ }+ var nodeList = nodes();+ var byId = {};+ nodeList.forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ var normalized = [];+ (ids || []).forEach(function (id) {+ if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);+ });+ if (!normalized.length) return false;+ if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {+ clear();+ return true;+ }++ clear({ updateUrl: false, preserveView: true });+ activeIds = normalized;+ var selected = {};+ var related = {};+ var seenEdges = {};+ var matchedEdges = 0;+ normalized.forEach(function (id) { selected[id] = true; related[id] = true; });+ var selectionMode = options.mode === 'selection' || normalized.length > 1;++ edges().forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var match = selectionMode ? selected[from] && selected[to] : selected[from] || selected[to];+ if (!match) return;+ edge.setAttribute('data-focus-match', '');+ if (!selectionMode) { related[from] = true; related[to] = true; }+ var edgeKey = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + (edge.getAttribute('data-edge-label') || ''));+ if (!seenEdges[edgeKey]) { seenEdges[edgeKey] = true; matchedEdges += 1; }+ });+ nodeList.forEach(function (node) {+ var nodeId = node.getAttribute('data-node-id');+ if (related[nodeId]) node.setAttribute('data-focus-match', '');+ if (selected[nodeId]) {+ node.setAttribute('data-focus-selected', '');+ node.setAttribute('aria-pressed', 'true');+ }+ });+ svg.setAttribute('data-focus-active', normalized.join(' '));+ var defaultLabel = normalized.length === 1+ ? nodeLabel(byId[normalized[0]], normalized[0])+ : normalized.length + ' selected nodes';+ label.textContent = options.label || defaultLabel;+ chip.hidden = options.hideChip === true || normalized.length !== 1 || selectionMode;+ if (!chip.hidden) {+ renderRelationshipLens(normalized[0], byId);+ requestLensPlacement();+ }+ if (options.updateUrl !== false) {+ var key = options.urlKey || 'focus';+ var value = options.urlValue || normalized[0];+ try { history.replaceState(null, '', location.pathname + location.search + '#' + key + '=' + encodeURIComponent(value)); } catch (_) {}+ }+ return true;+ }++ function set(id, options) {+ options = options || {};+ options.mode = 'neighborhood';+ return setMany([id], options);+ }++ function fallbackCopy(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }++ function copyFocusLink() {+ if (activeIds.length !== 1) return Promise.resolve(false);+ var record = pinnedRelationshipRecord();+ var relationId = record && record.id;+ var value = location.href.replace(/#.*$/, '') + (relationId+ ? '#relation=' + encodeURIComponent(relationId)+ : '#focus=' + encodeURIComponent(activeIds[0]));+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })+ : Promise.resolve(fallbackCopy(value));+ return copy.then(function (copied) {+ copyBtn.textContent = copied ? 'Copied' : 'Copy failed';+ copyBtn.setAttribute('aria-label', copied+ ? (relationId ? 'Pinned relationship link copied' : 'Focused node link copied')+ : (relationId ? 'Could not copy pinned relationship link' : 'Could not copy focused node link'));+ window.setTimeout(function () {+ renderRelationshipCopyAction();+ }, 1600);+ return copied;+ });+ }++ svg.addEventListener('click', function (event) {+ if (container.getAttribute('data-just-panned') === 'true') return;+ var node = event.target.closest('[data-node-id]');+ if (node) {+ var id = node.getAttribute('data-node-id');+ set(id);+ if (activeIds.indexOf(id) !== -1 && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'focus' });+ }+ }+ else if (activeIds.length) clear();+ });+ svg.addEventListener('keydown', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || (event.key !== 'Enter' && event.key !== ' ')) return;+ event.preventDefault();+ var id = node.getAttribute('data-node-id');+ set(id);+ if (activeIds.indexOf(id) !== -1 && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'focus' });+ }+ });+ clearBtn.addEventListener('click', function () { clear(); });+ copyBtn.addEventListener('click', copyFocusLink);+ relationsBtn.addEventListener('click', function () {+ var expanded = chip.getAttribute('data-relations-expanded') === 'true';+ if (expanded) chip.removeAttribute('data-relations-expanded');+ else chip.setAttribute('data-relations-expanded', 'true');+ relationsBtn.setAttribute('aria-expanded', expanded ? 'false' : 'true');+ relationsBtn.setAttribute('aria-label', expanded ? 'Show connected relationships' : 'Hide connected relationships');+ requestLensPlacement();+ });+ relationshipList.addEventListener('click', function (event) {+ var button = event.target.closest('[data-relationship-target]');+ if (!button) return;+ var id = button.getAttribute('data-relationship-target');+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ set(id, { toggle: false });+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'relationship' });+ }+ var node = svg.querySelector('[data-node-id="' + id + '"]');+ if (node) {+ try { node.focus({ preventScroll: true }); } catch (_) { try { node.focus(); } catch (_) {} }+ }+ });+ relationshipList.addEventListener('pointerover', function (event) {+ if (event.pointerType === 'touch') return;+ if (finePointerQuery && !finePointerQuery.matches) return;+ var button = event.target.closest('[data-relationship-key]');+ if (!button || !relationshipList.contains(button)) return;+ if (event.relatedTarget && button.contains(event.relatedTarget)) return;+ hoveredRelationship = button;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('pointerout', function (event) {+ var button = event.target.closest('[data-relationship-key]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ if (hoveredRelationship === button) hoveredRelationship = null;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('focusin', function (event) {+ var button = event.target.closest('[data-relationship-key]');+ if (!button) return;+ focusedRelationship = button;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('focusout', function (event) {+ var button = event.target.closest('[data-relationship-key]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ if (focusedRelationship === button) focusedRelationship = null;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('keydown', function (event) {+ if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp' && event.key !== 'Home' && event.key !== 'End') return;+ var buttons = Array.prototype.slice.call(relationshipList.querySelectorAll('[data-relationship-target]'));+ if (!buttons.length) return;+ var index = buttons.indexOf(document.activeElement);+ if (event.key === 'Home') index = 0;+ else if (event.key === 'End') index = buttons.length - 1;+ else if (event.key === 'ArrowDown') index = Math.min(buttons.length - 1, Math.max(0, index + 1));+ else index = Math.max(0, index < 0 ? 0 : index - 1);+ event.preventDefault();+ buttons[index].focus();+ });+ window.addEventListener('scroll', requestLensPlacement, { passive: true });+ window.addEventListener('resize', requestLensPlacement);+ container.addEventListener('scroll', requestLensPlacement, { passive: true });+ document.addEventListener('visibilitychange', function () {+ if (document.hidden) removeRelationshipPulse();+ });+ function syncRelationshipMotionPreference(event) {+ if (event.matches) removeRelationshipPulse();+ }+ if (reducedMotionQuery) {+ if (typeof reducedMotionQuery.addEventListener === 'function') {+ reducedMotionQuery.addEventListener('change', syncRelationshipMotionPreference);+ } else if (typeof reducedMotionQuery.addListener === 'function') {+ reducedMotionQuery.addListener(syncRelationshipMotionPreference);+ }+ }++ installRelationshipHitTargets();++ function syncFocusFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var relation = params.get('relation');+ var initial = params.get('focus');+ if (relation) {+ if (html.getAttribute('data-embed') === 'true' ||+ !inspectRelationshipById(relation, { updateUrl: false, toggle: false })) clear({ updateUrl: false });+ }+ else if (initial) set(initial, { updateUrl: false, toggle: false });+ else if (!params.get('view')) clear({ updateUrl: false });+ } catch (_) {}+ }++ window.addEventListener('hashchange', syncFocusFromHash);+ syncFocusFromHash();++ return {+ set: set,+ setMany: setMany,+ clear: clear,+ copyLink: copyFocusLink,+ inspectRelationship: inspectRelationship,+ inspectRelationshipById: inspectRelationshipById,+ reposition: requestLensPlacement,+ relationship: function () {+ var record = pinnedRelationshipRecord();+ return record ? { id: record.id || null, key: record.key, from: record.from, to: record.to, label: record.label } : null;+ },+ active: function () { return activeIds.length === 0 ? null : (activeIds.length === 1 ? activeIds[0] : activeIds.slice()); }+ };+ })();++ /* ============================================================+ Intent Trace — temporary one-hop topology before durable focus.+ Fine-pointer hover and keyboard focus share the same stable-ID preview;+ touch continues directly to the existing click-to-focus contract.+ ============================================================ */+ Archify.intentTrace = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var status = document.getElementById('intent-trace-status');+ var namespace = 'http://www.w3.org/2000/svg';+ var activeId = null;+ var hoveredNode = null;+ var focusedNode = null;+ var enterTimer = null;++ function nodes() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ }+ function edges() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ }+ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];+ }+ function finePointer() {+ return !window.matchMedia || window.matchMedia('(hover: hover) and (pointer: fine)').matches;+ }+ function reducedMotion() {+ return !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);+ }+ function blocked() {+ return html.getAttribute('data-embed') === 'true' ||+ html.getAttribute('data-guide-open') === 'true' ||+ container.classList.contains('is-panning') ||+ svg.hasAttribute('data-lens-active') ||+ svg.hasAttribute('data-story-active') ||+ svg.hasAttribute('data-relationship-preview-active') ||+ !!(Archify.routeProbe && typeof Archify.routeProbe.active === 'function' && Archify.routeProbe.active()) ||+ !!(Archify.focus && typeof Archify.focus.active === 'function' && Archify.focus.active());+ }+ function edgeShapes(edge) {+ if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function removeOverlay() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-intent-trace-overlay]'), function (overlay) {+ overlay.remove();+ });+ }+ function clear(options) {+ options = options || {};+ if (enterTimer) window.clearTimeout(enterTimer);+ enterTimer = null;+ activeId = null;+ svg.removeAttribute('data-intent-trace-active');+ removeOverlay();+ nodes().forEach(function (node) {+ node.removeAttribute('data-intent-trace-match');+ node.removeAttribute('data-intent-trace-selected');+ });+ edges().forEach(function (edge) { edge.removeAttribute('data-intent-trace-match'); });+ if (options.announce !== false) status.textContent = '';+ }+ function traceGeometry(shape, direction) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-intent-trace-match');+ clone.removeAttribute('data-intent-trace-selected');+ clone.setAttribute('class', 'intent-trace-flow');+ clone.setAttribute('data-direction', direction);+ clone.setAttribute('pathLength', '1');+ return clone;+ }+ function show(id, options) {+ options = options || {};+ if (!id || blocked()) {+ clear({ announce: false });+ return false;+ }+ if (activeId === id) return true;+ clear({ announce: false });+ var nodeList = nodes();+ var edgeList = edges();+ var byId = {};+ nodeList.forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ var selected = byId[id];+ if (!selected) return false;++ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'intent-trace-overlay');+ overlay.setAttribute('data-intent-trace-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ var related = {};+ var seen = {};+ var counts = { out: 0, in: 0, loop: 0 };+ related[id] = true;++ edgeList.forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (from !== id && to !== id) return;+ var direction = from === id && to === id ? 'loop' : (from === id ? 'out' : 'in');+ var key = edge.getAttribute('data-edge-key') ||+ (from + '\u0000' + to + '\u0000' + (edge.getAttribute('data-edge-label') || ''));+ if (!seen[key]) {+ seen[key] = true;+ counts[direction] += 1;+ }+ related[from] = true;+ related[to] = true;+ edge.setAttribute('data-intent-trace-match', '');+ var wrapper = document.createElementNS(namespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ edgeShapes(edge).forEach(function (shape) {+ wrapper.appendChild(traceGeometry(shape, direction));+ });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });++ nodeList.forEach(function (node) {+ var nodeId = node.getAttribute('data-node-id');+ if (related[nodeId]) node.setAttribute('data-intent-trace-match', '');+ if (nodeId === id) node.setAttribute('data-intent-trace-selected', '');+ });+ if (overlay.childNodes.length) {+ var firstEdge = edgeList[0];+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstEdge && firstEdge.parentNode) firstEdge.parentNode.insertBefore(overlay, firstEdge);+ else if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ }+ activeId = id;+ svg.setAttribute('data-intent-trace-active', id);+ if (options.announce === true) {+ var total = counts.out + counts.in + counts.loop;+ status.textContent = nodeLabel(selected, id) + '. ' + counts.out + ' outgoing, ' ++ counts.in + ' incoming' + (counts.loop ? ', ' + counts.loop + ' self loop' : '') ++ '. ' + total + ' connection' + (total === 1 ? '' : 's') + '. Press Enter for details.';+ }+ return true;+ }+ function schedule(node) {+ if (enterTimer) window.clearTimeout(enterTimer);+ enterTimer = window.setTimeout(function () {+ enterTimer = null;+ if (hoveredNode === node) show(node.getAttribute('data-node-id'), { announce: false });+ }, reducedMotion() ? 0 : 90);+ }+ function sync() {+ var candidate = focusedNode || hoveredNode;+ if (!candidate) {+ clear();+ return;+ }+ show(candidate.getAttribute('data-node-id'), { announce: candidate === focusedNode });+ }++ svg.addEventListener('pointerover', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || !finePointer() || event.pointerType === 'touch') return;+ if (event.relatedTarget && node.contains(event.relatedTarget)) return;+ hoveredNode = node;+ schedule(node);+ });+ svg.addEventListener('pointerout', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || (event.relatedTarget && node.contains(event.relatedTarget))) return;+ if (hoveredNode === node) hoveredNode = null;+ sync();+ });+ svg.addEventListener('focusin', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node) return;+ focusedNode = node;+ show(node.getAttribute('data-node-id'), { announce: true });+ });+ svg.addEventListener('focusout', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || (event.relatedTarget && node.contains(event.relatedTarget))) return;+ if (focusedNode === node) focusedNode = null;+ sync();+ });+ container.addEventListener('pointerdown', function (event) {+ if (!event.target.closest('[data-node-id]')) clear({ announce: false });+ });+ window.addEventListener('blur', function () { clear({ announce: false }); });++ return {+ show: show,+ clear: clear,+ active: function () { return activeId; }+ };+ })();++ Archify.guidedViews = (function () {+ var data = document.getElementById('archify-guided-views-data');+ var panel = document.getElementById('guided-views');+ var prev = document.getElementById('guided-view-prev');+ var next = document.getElementById('guided-view-next');+ var all = document.getElementById('guided-view-all');+ var play = document.getElementById('guided-view-play');+ var playIcon = document.getElementById('guided-view-play-icon');+ var playLabel = document.getElementById('guided-view-play-label');+ var beatLink = document.getElementById('guided-view-beat-link');+ var beatLinkLabel = document.getElementById('guided-view-beat-link-label');+ var progressBar = document.getElementById('guided-view-progress-bar');+ var count = document.getElementById('guided-view-count');+ var handoffReceipt = document.getElementById('guided-view-handoff');+ var label = document.getElementById('guided-view-label');+ var note = document.getElementById('guided-view-note');+ var trail = document.getElementById('guided-view-trail');+ var storyCaption = document.getElementById('guided-story-caption');+ var storyCaptionIndex = document.getElementById('guided-story-caption-index');+ var storyCaptionRoute = document.getElementById('guided-story-caption-route');+ var storyCaptionDetail = document.getElementById('guided-story-caption-detail');+ var storyCaptionNext = document.getElementById('guided-story-caption-next');+ var storyCaptionNextLabel = document.getElementById('guided-story-caption-next-label');+ var chapterIndex = document.getElementById('guided-view-index');+ var chapterList = document.getElementById('guided-view-chapters');+ var shareCue = document.getElementById('share-chapter-cue');+ var shareCueState = document.getElementById('share-chapter-state');+ var shareCueCount = document.getElementById('share-chapter-count');+ var shareCueLabel = document.getElementById('share-chapter-label');+ var shareCueNote = document.getElementById('share-chapter-note');+ var shareCueRoute = document.getElementById('share-chapter-route');+ var shareCueProgress = document.getElementById('share-chapter-progress-bar');+ var svg = document.querySelector('.diagram-container svg');+ var views = [];+ var activeIndex = -1;+ var playing = false;+ var storyBeatTimer = null;+ var storyBeatIndex = -1;+ var storyBeatStartedAt = 0;+ var storyBeatElapsedMs = 0;+ var storyBeatDwellMs = 0;+ var storyPlaybackGeneration = 0;+ var storyFollowGeneration = 0;+ var storyPlaybackScope = 'story';+ var storyPlaybackComplete = false;+ var beatLinkFeedbackTimer = null;+ var momentRestoreGeneration = 0;+ var storySteps = [];+ var storyPulseOwnerToken = 0;+ var storyPulseGeneration = 0;+ var autoplayPending = false;+ var VIEW_INTERVAL_MS = 3200;+ var STORY_FOLLOW_MIN_DWELL_MS = 1100;+ var STORY_FOLLOW_DURATION_MS = 320;+ var chapterButtons = [];+ var handoffGeneration = 0;+ var currentHandoff = null;+ var previewGeneration = 0;+ var pointerPreviewIntent = null;+ var focusPreviewIntent = null;+ var activePreviewIndex = -1;+ var previewOwnerToken = 0;++ try { views = JSON.parse(data.textContent || '[]'); } catch (_) { views = []; }+ if (!views.length) return { count: 0, active: function () { return null; } };+ var canonicalNodeIds = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ canonicalNodeIds[node.getAttribute('data-node-id')] = true;+ });+ views.forEach(function (view) {+ var seen = {};+ view.focus = (view.focus || []).filter(function (id) {+ if (!canonicalNodeIds[id] || seen[id]) return false;+ seen[id] = true;+ return true;+ });+ });+ // Establish the compact cold state before exposing the panel so the+ // full Director cannot flash during first paint. Hash restoration runs+ // in the same task and replaces this state before paint when valid.+ panel.setAttribute('data-active-view', 'all');+ panel.hidden = false;+ panel.setAttribute('data-view-interval-ms', String(VIEW_INTERVAL_MS));+ panel.setAttribute('data-story-follow-min-dwell-ms', String(STORY_FOLLOW_MIN_DWELL_MS));+ buildChapterIndex();++ function reducedMotion() {+ return !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);+ }++ function findNode(id) {+ return Array.prototype.find.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ return node.getAttribute('data-node-id') === id;+ }) || null;+ }++ function chapterDelta(previous, destination) {+ var previousFocus = previous ? previous.focus : [];+ var destinationFocus = destination ? destination.focus : [];+ var previousIds = {};+ var destinationIds = {};+ previousFocus.forEach(function (id) { previousIds[id] = true; });+ destinationFocus.forEach(function (id) { destinationIds[id] = true; });+ return {+ stay: previousFocus.filter(function (id) { return destinationIds[id]; }),+ enter: destinationFocus.filter(function (id) { return !previousIds[id]; }),+ leave: previousFocus.filter(function (id) { return !destinationIds[id]; })+ };+ }++ function chapterAnchor(previous, destination, outgoingBeatIndex, delta) {+ if (!previous || !destination) return '';+ var stayIds = {};+ delta.stay.forEach(function (id) { stayIds[id] = true; });+ var activeBeat = outgoingBeatIndex >= 0 ? previous.focus[outgoingBeatIndex] : '';+ if (activeBeat && stayIds[activeBeat]) return activeBeat;+ for (var index = previous.focus.length - 1; index >= 0; index -= 1) {+ if (stayIds[previous.focus[index]]) return previous.focus[index];+ }+ return '';+ }++ function handoffMotionAllowed() {+ if (document.hidden || reducedMotion()) return false;+ if (document.documentElement.getAttribute('data-embed') === 'true') return false;+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ return !(Archify.motionGovernor && Archify.motionGovernor.capable && Archify.motionGovernor.isPaused());+ }++ function classifyHandoff(delta, anchor) {+ var roles = {};+ delta.stay.forEach(function (id) { roles[id] = 'stay'; });+ delta.enter.forEach(function (id) { roles[id] = 'enter'; });+ delta.leave.forEach(function (id) { roles[id] = 'leave'; });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ var id = node.getAttribute('data-node-id');+ var role = roles[id] || '';+ if (role) node.setAttribute('data-chapter-role', role);+ else node.removeAttribute('data-chapter-role');+ });+ svg.setAttribute('data-chapter-handoff', anchor ? 'anchor' : 'no-anchor');+ if (anchor) svg.setAttribute('data-chapter-anchor', anchor);+ else svg.removeAttribute('data-chapter-anchor');+ }++ function drawHandoffAnchor(id) {+ var node = findNode(id);+ if (!node) return null;+ var box;+ try { box = node.getBBox(); } catch (_) { return null; }+ var overlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ var ring = document.createElementNS('http://www.w3.org/2000/svg', 'rect');+ overlay.setAttribute('class', 'chapter-handoff-overlay');+ overlay.setAttribute('data-chapter-handoff-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ ring.setAttribute('class', 'chapter-handoff-anchor');+ ring.setAttribute('x', String(box.x - 8));+ ring.setAttribute('y', String(box.y - 8));+ ring.setAttribute('width', String(box.width + 16));+ ring.setAttribute('height', String(box.height + 16));+ ring.setAttribute('rx', '10');+ overlay.appendChild(ring);+ svg.appendChild(overlay);+ return overlay;+ }++ function clearHandoffPresentation() {+ svg.removeAttribute('data-chapter-handoff');+ svg.removeAttribute('data-chapter-anchor');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-chapter-handoff-overlay]'), function (overlay) { overlay.remove(); });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-chapter-role]'), function (node) { node.removeAttribute('data-chapter-role'); });+ if (handoffReceipt) {+ handoffReceipt.hidden = true;+ handoffReceipt.textContent = '';+ }+ }++ function completeHandoff(handoff, outcome) {+ if (!handoff || currentHandoff !== handoff) return false;+ if (handoff.holdTimer) clearTimeout(handoff.holdTimer);+ handoff.holdTimer = null;+ currentHandoff = null;+ clearHandoffPresentation();+ if (handoff.ownerToken && Archify.motionGovernor) Archify.motionGovernor.release(handoff.ownerToken);+ handoff.resolve({ id: handoff.id, state: outcome || 'complete', anchor: handoff.anchor || null });+ syncStoryControlsDisabled();+ syncChapterPreview();+ return true;+ }++ function settleHandoff(reason) {+ var handoff = currentHandoff;+ if (!handoff) return false;+ if (handoff.holdTimer) clearTimeout(handoff.holdTimer);+ handoff.holdTimer = null;+ if (handoff.camera && handoff.camera.cancel) handoff.camera.cancel(reason || 'settled', true);+ else if (Archify.view && Archify.view.reveal) Archify.view.reveal(handoff.focus, { instant: true, reason: reason || 'settled' });+ completeHandoff(handoff, reason || 'settled');+ return true;+ }++ function cancelHandoff(reason) {+ var handoff = currentHandoff;+ if (!handoff) return false;+ if (handoff.holdTimer) clearTimeout(handoff.holdTimer);+ handoff.holdTimer = null;+ if (handoff.camera && handoff.camera.cancel) handoff.camera.cancel(reason || 'manual', false);+ completeHandoff(handoff, reason || 'manual');+ return true;+ }++ function afterHandoff(callback) {+ if (!currentHandoff) { callback(); return; }+ currentHandoff.finished.then(callback);+ }++ function beginHandoff(previousIndex, nextIndex, previous, destination, outgoingBeatIndex, reason) {+ if (!Archify.view || !Archify.view.reveal) return null;+ if (!previous || previousIndex === nextIndex) {+ Archify.view.reveal(destination.focus, { reason: reason });+ return null;+ }+ var delta = chapterDelta(previous, destination);+ var anchor = chapterAnchor(previous, destination, outgoingBeatIndex, delta);+ if (!handoffMotionAllowed()) {+ Archify.view.reveal(destination.focus, { instant: true, reason: reason });+ return null;+ }+ var resolver;+ var handoff = {+ id: ++handoffGeneration,+ mode: anchor ? 'holding' : 'no-anchor',+ anchor: anchor,+ focus: destination.focus.slice(),+ holdTimer: null,+ camera: null,+ ownerToken: 0,+ finished: new Promise(function (resolve) { resolver = resolve; }),+ resolve: resolver+ };+ currentHandoff = handoff;+ classifyHandoff(delta, anchor);+ if (anchor) {+ drawHandoffAnchor(anchor);+ var node = findNode(anchor);+ var nodeLabel = node ? (node.getAttribute('data-node-label') || anchor) : anchor;+ handoffReceipt.textContent = (previousIndex + 1 < 10 ? '0' : '') + (previousIndex + 1) ++ ' \u2192 ' + (nextIndex + 1 < 10 ? '0' : '') + (nextIndex + 1) + ' \u00b7 via ' + nodeLabel;+ handoffReceipt.hidden = false;+ }+ if (Archify.motionGovernor) {+ handoff.ownerToken = Archify.motionGovernor.claim('handoff', function () {+ if (currentHandoff === handoff) settleHandoff('preempted');+ });+ }+ var startCamera = function () {+ if (currentHandoff !== handoff) return;+ handoff.holdTimer = null;+ handoff.mode = 'settling';+ svg.setAttribute('data-chapter-handoff', anchor ? 'settling' : 'no-anchor');+ handoff.camera = Archify.view.reveal(destination.focus, { reason: reason, duration: 420 });+ if (handoff.camera && handoff.camera.finished) {+ handoff.camera.finished.then(function (outcome) {+ if (currentHandoff === handoff) completeHandoff(handoff, outcome && outcome.state || 'complete');+ });+ } else {+ completeHandoff(handoff, 'complete');+ }+ };+ if (anchor) handoff.holdTimer = setTimeout(startCamera, 110);+ else startCamera();+ return handoff;+ }++ function centerChapterButton(button) {+ if (!button || !chapterList) return false;+ var target = Math.max(0, button.offsetLeft - (chapterList.clientWidth - button.offsetWidth) / 2);+ if (typeof chapterList.scrollTo === 'function') chapterList.scrollTo({ left: target, behavior: 'auto' });+ else chapterList.scrollLeft = target;+ return true;+ }++ function focusChapterButton(index) {+ if (!chapterButtons.length) return false;+ index = Math.max(0, Math.min(chapterButtons.length - 1, index));+ chapterButtons.forEach(function (button, buttonIndex) {+ button.setAttribute('tabindex', buttonIndex === index ? '0' : '-1');+ });+ chapterButtons[index].focus();+ centerChapterButton(chapterButtons[index]);+ return true;+ }++ function buildChapterIndex() {+ chapterButtons = [];+ chapterList.textContent = '';+ views.forEach(function (view, index) {+ var item = document.createElement('li');+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'guided-view-chapter';+ button.setAttribute('data-guided-view-id', view.id);+ button.setAttribute('aria-pressed', 'false');+ button.setAttribute('tabindex', index === 0 ? '0' : '-1');+ button.setAttribute('aria-label', 'Open chapter ' + (index + 1) + ' of ' + views.length + ': ' + view.label + ', ' + view.focus.length + ' stops');+ button.title = view.label + ' — ' + (view.note || view.focus.length + ' selected nodes');+ var position = document.createElement('span');+ position.className = 'guided-view-chapter-index';+ position.setAttribute('aria-hidden', 'true');+ position.textContent = (index + 1 < 10 ? '0' : '') + (index + 1);+ var title = document.createElement('span');+ title.className = 'guided-view-chapter-title';+ title.textContent = view.label;+ var stops = document.createElement('em');+ stops.className = 'guided-view-chapter-count';+ stops.textContent = view.focus.length + ' stop' + (view.focus.length === 1 ? '' : 's');+ var delta = document.createElement('span');+ delta.className = 'guided-view-chapter-delta';+ delta.hidden = true;+ delta.setAttribute('aria-hidden', 'true');+ ['stay', 'enter', 'leave'].forEach(function (kind) {+ var value = document.createElement('span');+ value.setAttribute('data-delta-kind', kind);+ delta.appendChild(value);+ });+ button.appendChild(position);+ button.appendChild(title);+ button.appendChild(stops);+ button.appendChild(delta);+ item.appendChild(button);+ chapterList.appendChild(item);+ chapterButtons.push(button);+ });+ }++ function syncChapterIndex() {+ chapterButtons.forEach(function (button, index) {+ var current = index === activeIndex;+ var stops = button.querySelector('.guided-view-chapter-count');+ var deltaLabel = button.querySelector('.guided-view-chapter-delta');+ var position = activeIndex < 0 ? 'available' : (current ? 'current' : (index < activeIndex ? 'before' : 'after'));+ button.setAttribute('data-chapter-position', position);+ button.setAttribute('aria-pressed', current ? 'true' : 'false');+ button.setAttribute('tabindex', current || (activeIndex < 0 && index === 0) ? '0' : '-1');+ if (current) {+ stops.hidden = false;+ deltaLabel.hidden = true;+ button.removeAttribute('data-chapter-delta');+ button.setAttribute('aria-label', 'Current chapter ' + (index + 1) + ' of ' + views.length + ': ' + views[index].label + ', ' + views[index].focus.length + ' stops');+ button.title = views[index].label + ' — current chapter, ' + views[index].focus.length + ' stops';+ } else {+ var delta = chapterDelta(activeIndex >= 0 ? views[activeIndex] : null, views[index]);+ var compact = '=' + delta.stay.length + ' +' + delta.enter.length + ' \u2212' + delta.leave.length;+ var expanded = delta.stay.length + ' stay, ' + delta.enter.length + ' enter, ' + delta.leave.length + ' leave';+ stops.hidden = true;+ deltaLabel.hidden = false;+ deltaLabel.querySelector('[data-delta-kind="stay"]').textContent = '=' + delta.stay.length;+ deltaLabel.querySelector('[data-delta-kind="enter"]').textContent = '+' + delta.enter.length;+ deltaLabel.querySelector('[data-delta-kind="leave"]').textContent = '\u2212' + delta.leave.length;+ button.setAttribute('data-chapter-delta', compact);+ button.setAttribute('aria-label', 'Open chapter ' + (index + 1) + ' of ' + views.length + ': ' + views[index].label + '. Chapter focus delta: ' + expanded);+ button.title = views[index].label + ' — ' + compact + ' chapter focus';+ }+ if (current) button.setAttribute('aria-current', 'step');+ else button.removeAttribute('aria-current');+ if (button.parentElement) button.parentElement.setAttribute('data-chapter-position', position);+ });+ if (activeIndex >= 0) centerChapterButton(chapterButtons[activeIndex]);+ }++ function chapterPreviewBlocked() {+ if (document.hidden || playing || currentHandoff) return true;+ if (document.documentElement.getAttribute('data-embed') === 'true') return true;+ if (window.matchMedia && window.matchMedia('print').matches) return true;+ if (svg.hasAttribute('data-route-picking') || svg.hasAttribute('data-route-active')) return true;+ if (svg.hasAttribute('data-lens-active') || svg.hasAttribute('data-legend-preview-active')) return true;+ if (svg.hasAttribute('data-relationship-preview-active') || svg.hasAttribute('data-intent-trace-active')) return true;+ return activeIndex < 0 && svg.hasAttribute('data-focus-active');+ }++ function clearChapterPreviewPresentation() {+ svg.removeAttribute('data-chapter-preview');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-chapter-preview-role]'), function (node) {+ node.removeAttribute('data-chapter-preview-role');+ });+ chapterButtons.forEach(function (button) { button.removeAttribute('data-preview-active'); });+ activePreviewIndex = -1;+ if (previewOwnerToken && Archify.motionGovernor) {+ var token = previewOwnerToken;+ previewOwnerToken = 0;+ Archify.motionGovernor.release(token);+ }+ }++ function clearChapterPreview(options) {+ options = options || {};+ previewGeneration += 1;+ if (options.clearIntents !== false) {+ pointerPreviewIntent = null;+ focusPreviewIntent = null;+ }+ clearChapterPreviewPresentation();+ return true;+ }++ function winningChapterPreviewIntent() {+ return [pointerPreviewIntent, focusPreviewIntent].filter(function (intent) {+ return intent && intent.index >= 0 && intent.index < views.length && intent.index !== activeIndex;+ }).sort(function (left, right) { return right.generation - left.generation; })[0] || null;+ }++ function showChapterPreview(index) {+ if (index < 0 || index >= views.length || index === activeIndex || chapterPreviewBlocked()) {+ clearChapterPreviewPresentation();+ return false;+ }+ if (activePreviewIndex === index && svg.getAttribute('data-chapter-preview') === views[index].id) return true;+ clearChapterPreviewPresentation();+ var delta = chapterDelta(activeIndex >= 0 ? views[activeIndex] : null, views[index]);+ var roles = {};+ delta.stay.forEach(function (id) { roles[id] = 'stay'; });+ delta.enter.forEach(function (id) { roles[id] = 'enter'; });+ delta.leave.forEach(function (id) { roles[id] = 'leave'; });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ var role = roles[node.getAttribute('data-node-id')];+ if (role) node.setAttribute('data-chapter-preview-role', role);+ });+ svg.setAttribute('data-chapter-preview', views[index].id);+ chapterButtons[index].setAttribute('data-preview-active', 'true');+ activePreviewIndex = index;+ if (Archify.motionGovernor && Archify.motionGovernor.capable) {+ previewOwnerToken = Archify.motionGovernor.claim('chapter-preview', function () {+ previewOwnerToken = 0;+ clearChapterPreviewPresentation();+ });+ }+ return true;+ }++ function syncChapterPreview() {+ var intent = winningChapterPreviewIntent();+ if (!intent || chapterPreviewBlocked()) {+ clearChapterPreviewPresentation();+ return false;+ }+ return showChapterPreview(intent.index);+ }++ function setChapterPreviewIntent(source, index) {+ var intent = { index: index, generation: ++previewGeneration };+ if (source === 'pointer') pointerPreviewIntent = intent;+ else focusPreviewIntent = intent;+ if (playing) pausePlayback();+ return syncChapterPreview();+ }++ function clearChapterPreviewIntent(source, index) {+ var intent = source === 'pointer' ? pointerPreviewIntent : focusPreviewIntent;+ if (intent && (typeof index !== 'number' || intent.index === index)) {+ if (source === 'pointer') pointerPreviewIntent = null;+ else focusPreviewIntent = null;+ previewGeneration += 1;+ }+ return syncChapterPreview();+ }++ function hoverCapable() {+ return !!(window.matchMedia && window.matchMedia('(hover: hover)').matches);+ }++ function sharePlaybackRequested() {+ try { return new URLSearchParams(location.search).get('play') === '1'; }+ catch (_) { return false; }+ }++ autoplayPending = sharePlaybackRequested();+ if (autoplayPending) {+ document.documentElement.setAttribute('data-share-playback', 'true');+ setAutoplayState('pending');+ }++ function setAutoplayState(state) {+ if (state) panel.setAttribute('data-autoplay', state);+ else panel.removeAttribute('data-autoplay');+ renderShareCue();+ }++ function shareCueStatus(state) {+ return {+ pending: 'Ready',+ playing: 'Playing',+ complete: 'Settled',+ interrupted: 'Paused',+ pinned: 'Pinned',+ 'reduced-motion': 'Still'+ }[state] || 'Ready';+ }++ function shareCueBeatCopy(state, view, stops) {+ var total = stops.length;+ var activeStop = storyBeatIndex >= 0 ? stops[storyBeatIndex] : null;+ if ((state === 'playing' || state === 'interrupted') && activeStop) {+ return 'Step ' + (storyBeatIndex + 1 < 10 ? '0' : '') + (storyBeatIndex + 1) + ' / ' ++ (total < 10 ? '0' : '') + total + ' · ' + activeStop.textContent;+ }+ if (state === 'pinned' && activeStop) {+ return storyBeatCopy(storySteps[storyBeatIndex], total);+ }+ if (state === 'reduced-motion' && activeStop && hashBeatMatchesCurrent()) {+ return 'Step ' + (storyBeatIndex + 1 < 10 ? '0' : '') + (storyBeatIndex + 1) + ' / ' ++ (total < 10 ? '0' : '') + total + ' · ' + activeStop.textContent + ' · Static moment';+ }+ if (state === 'complete') return total + ' steps complete · ' + (view.note || 'Path settled for reading.');+ if (state === 'reduced-motion') return total + ' steps · Static path';+ if (state === 'pending') return total + ' steps · Ready';+ return view.note || view.focus.length + ' selected nodes';+ }++ function renderShareCue() {+ if (!shareCue) return;+ var view = activeIndex >= 0 ? views[activeIndex] : null;+ var shareMode = document.documentElement.getAttribute('data-share-playback') === 'true';+ var embedMode = document.documentElement.getAttribute('data-embed') === 'true';+ var pinnedMode = !shareMode && embedMode && hashBeatMatchesCurrent();+ if (pinnedMode) document.documentElement.setAttribute('data-share-moment', 'true');+ else document.documentElement.removeAttribute('data-share-moment');+ shareCue.hidden = !(embedMode && view && (shareMode || pinnedMode));+ if (shareCue.hidden) return;+ var state = pinnedMode ? 'pinned' : (panel.getAttribute('data-autoplay') || 'pending');+ var stops = Array.prototype.slice.call(trail.querySelectorAll('[data-story-node]'));+ var route = stops.map(function (stop, index) {+ if (index === 0) return stop.textContent;+ var kind = stop.getAttribute('data-story-link');+ var separator = kind === 'forward' ? '\u2192' : (kind === 'reverse' ? '\u2190' : (kind === 'multiple' ? '\u21c4' : '\u00b7'));+ return separator + ' ' + stop.textContent;+ }).join(' ');+ var beatCopy = shareCueBeatCopy(state, view, stops);+ shareCue.setAttribute('data-state', state);+ shareCue.setAttribute('aria-live', state === 'playing' ? 'off' : 'polite');+ shareCueState.textContent = shareCueStatus(state);+ shareCueCount.textContent = 'Chapter ' + (activeIndex + 1 < 10 ? '0' : '') + (activeIndex + 1) + ' / ' + (views.length < 10 ? '0' : '') + views.length;+ shareCueLabel.textContent = view.label;+ shareCueNote.textContent = beatCopy;+ shareCueRoute.textContent = route;+ shareCue.setAttribute('aria-label', shareCueStatus(state) + ' chapter ' + (activeIndex + 1) + ' of ' + views.length + ': ' + view.label + '. ' + beatCopy + '. ' + route);+ }++ function setShareCueProgress(fraction) {+ if (!shareCueProgress) return;+ shareCueProgress.style.animation = 'none';+ shareCueProgress.style.setProperty('--guided-progress-start', String(Math.max(0, Math.min(1, fraction))));+ shareCueProgress.style.transform = 'scaleX(' + Math.max(0, Math.min(1, fraction)) + ')';+ }++ function startShareCueProgress(fraction, duration) {+ if (!shareCueProgress) return;+ setShareCueProgress(fraction || 0);+ void shareCueProgress.offsetWidth;+ shareCueProgress.style.animation = 'archify-guided-progress ' + Math.max(1, duration || VIEW_INTERVAL_MS) + 'ms linear forwards';+ }++ function storyNodeLabel(node, fallback) {+ if (!node) return fallback;+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '');+ }++ function storyEdgeKey(edge) {+ return edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ }++ function uniqueStoryEdges(edgeList) {+ var positions = {};+ var unique = [];+ edgeList.forEach(function (edge) {+ var key = storyEdgeKey(edge);+ if (!Object.prototype.hasOwnProperty.call(positions, key)) {+ positions[key] = unique.length;+ unique.push(edge);+ return;+ }+ var index = positions[key];+ if (!storyGeometry(unique[index]).length && storyGeometry(edge).length) unique[index] = edge;+ });+ return unique;+ }++ function storyStep(view, index, edgeList, byId) {+ var id = view.focus[index];+ var node = byId[id];+ var previousId = index > 0 ? view.focus[index - 1] : '';+ var forward = [];+ var reverse = [];+ if (previousId) {+ edgeList.forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (from === previousId && to === id) forward.push(edge);+ else if (from === id && to === previousId) reverse.push(edge);+ });+ }+ forward = uniqueStoryEdges(forward);+ reverse = uniqueStoryEdges(reverse);+ var edges = forward.concat(reverse).sort(function (left, right) {+ return edgeList.indexOf(left) - edgeList.indexOf(right);+ });+ var relation = index === 0 ? 'start' : (!edges.length ? 'group' : (+ edges.length === 1 && forward.length === 1 ? 'forward' :+ (edges.length === 1 && reverse.length === 1 ? 'reverse' : 'multiple')+ ));+ return {+ index: index,+ nodeId: id,+ nodeLabel: storyNodeLabel(byId[id], id),+ previousId: previousId,+ previousLabel: previousId ? storyNodeLabel(byId[previousId], previousId) : '',+ relation: relation,+ edges: edges,+ edgeKeys: edges.map(storyEdgeKey),+ edgeLabels: edges.map(function (edge) { return edge.getAttribute('data-edge-label') || ''; }).filter(function (value, edgeIndex, values) {+ return value && values.indexOf(value) === edgeIndex;+ }),+ responsibility: node ? (node.getAttribute('data-node-sublabel') || '') : '',+ context: node ? (node.getAttribute('data-node-context') || '') : ''+ };+ }++ function storyBeatCopy(step, total) {+ if (!step) return '';+ var position = (step.index + 1 < 10 ? '0' : '') + (step.index + 1);+ var countValue = (total < 10 ? '0' : '') + total;+ if (step.relation === 'start') return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.nodeLabel + ' \u00b7 starting point';+ if (step.relation === 'forward') return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.previousLabel + ' \u2192 ' + step.nodeLabel;+ if (step.relation === 'reverse') return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.nodeLabel + ' \u2192 ' + step.previousLabel + ' \u00b7 reverse authored link';+ if (step.relation === 'multiple') return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.previousLabel + ' \u21c4 ' + step.nodeLabel + ' \u00b7 ' + step.edges.length + ' authored links';+ return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.previousLabel + ' \u00b7 ' + step.nodeLabel + ' \u00b7 grouped \u00b7 no direct link';+ }++ function storyBeatAria(step, total) {+ var prefix = 'Story beat ' + (step.index + 1) + ' of ' + total + ': ' + step.nodeLabel + '. ';+ if (step.relation === 'start') return prefix + 'Starting point.';+ if (step.relation === 'forward') return prefix + 'From ' + step.previousLabel + ' through one authored forward relationship.';+ if (step.relation === 'reverse') return prefix + 'From ' + step.previousLabel + '; the authored relationship points from ' + step.nodeLabel + ' to ' + step.previousLabel + '.';+ if (step.relation === 'multiple') return prefix + 'From ' + step.previousLabel + ' through ' + step.edges.length + ' authored relationships; shown without arbitrary motion.';+ return prefix + 'Grouped from ' + step.previousLabel + ' with no direct authored relationship.';+ }++ function storyCaptionRouteCopy(step) {+ if (step.relation === 'start') return step.nodeLabel + ' · Starting point';+ if (step.relation === 'reverse') return step.previousLabel + ' ← ' + step.nodeLabel;+ if (step.relation === 'multiple') return step.previousLabel + ' ⇄ ' + step.nodeLabel;+ if (step.relation === 'group') return step.previousLabel + ' · ' + step.nodeLabel;+ return step.previousLabel + ' → ' + step.nodeLabel;+ }++ function storyCaptionDetailCopy(step) {+ var facts = [];+ if (step.relation === 'group') facts.push('Grouped transition · no direct authored link');+ else if (step.edgeLabels.length) facts.push(step.edgeLabels.slice(0, 3).join(' + ') + (step.edgeLabels.length > 3 ? ' +' + (step.edgeLabels.length - 3) + ' more' : ''));+ else if (step.relation === 'reverse') facts.push('Reverse authored relationship');+ else if (step.relation === 'multiple') facts.push(step.edges.length + ' authored relationships');+ else if (step.relation !== 'start') facts.push('Authored relationship');+ if (step.relation === 'reverse') facts.push('authored direction: ' + step.nodeLabel + ' → ' + step.previousLabel);+ if (step.responsibility) facts.push(step.responsibility);+ if (step.context) facts.push(step.context);+ if (!facts.length) facts.push('Authored starting point');+ return facts.join(' · ');+ }++ function renderStoryCaption(step, total, nextStep) {+ if (!storyCaption) return;+ if (!step) {+ storyCaption.hidden = true;+ storyCaption.removeAttribute('data-story-caption');+ storyCaptionNext.hidden = true;+ storyCaptionNextLabel.textContent = '';+ return;+ }+ storyCaption.hidden = false;+ storyCaption.setAttribute('data-story-caption', step.relation);+ storyCaption.setAttribute('aria-live', playing ? 'off' : 'polite');+ storyCaptionIndex.textContent = (step.index + 1 < 10 ? '0' : '') + (step.index + 1) + ' / ' + (total < 10 ? '0' : '') + total;+ storyCaptionRoute.textContent = storyCaptionRouteCopy(step);+ storyCaptionDetail.textContent = storyCaptionDetailCopy(step);+ storyCaptionNext.hidden = !nextStep;+ storyCaptionNextLabel.textContent = nextStep+ ? ((nextStep.index + 1 < 10 ? '0' : '') + (nextStep.index + 1) + ' · ' + nextStep.nodeLabel)+ : '';+ storyCaption.style.animation = 'none';+ void storyCaption.offsetWidth;+ storyCaption.style.removeProperty('animation');+ }++ function storyMomentLink() {+ var view = activeIndex >= 0 ? views[activeIndex] : null;+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ if (!view || !step) return '';+ var url = new URL(location.href);+ url.searchParams.delete('play');+ url.hash = 'view=' + encodeURIComponent(view.id) + '&beat=' + encodeURIComponent(step.nodeId);+ return url.href;+ }++ function fallbackCopyStoryMoment(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }++ function resetBeatLinkFeedback() {+ if (beatLinkFeedbackTimer) clearTimeout(beatLinkFeedbackTimer);+ beatLinkFeedbackTimer = null;+ beatLink.removeAttribute('data-copy-state');+ beatLinkLabel.textContent = 'Copy moment';+ }++ function syncBeatLink() {+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ var available = !!(activeIndex >= 0 && step && !currentHandoff);+ beatLink.disabled = !available;+ if (!beatLink.hasAttribute('data-copy-state')) beatLinkLabel.textContent = 'Copy moment';+ var description = available+ ? 'Copy link to current story moment: Beat ' + (step.index + 1) + ' of ' + storySteps.length + ': ' + step.nodeLabel+ : 'Select a Story Beat to copy its exact link';+ beatLink.setAttribute('aria-label', description);+ beatLink.title = description;+ }++ function setBeatLinkFeedback(copied) {+ resetBeatLinkFeedback();+ beatLink.setAttribute('data-copy-state', copied ? 'copied' : 'failed');+ beatLinkLabel.textContent = copied ? 'Copied' : 'Copy failed';+ beatLink.setAttribute('aria-label', copied ? 'Moment link copied' : 'Could not copy story moment link');+ beatLinkFeedbackTimer = setTimeout(function () {+ resetBeatLinkFeedback();+ syncBeatLink();+ }, 1600);+ }++ function copyStoryMomentLink() {+ if (playing) pausePlayback();+ var value = storyMomentLink();+ if (!value) return Promise.resolve(false);+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopyStoryMoment(value); })+ : Promise.resolve(fallbackCopyStoryMoment(value));+ return copy.then(function (copied) {+ setBeatLinkFeedback(copied);+ return copied;+ });+ }++ function hashBeatMatchesCurrent() {+ var view = activeIndex >= 0 ? views[activeIndex] : null;+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ if (!view || !step) return false;+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ return params.get('view') === view.id && params.get('beat') === step.nodeId;+ } catch (_) { return false; }+ }++ function storyMotionAllowed() {+ if (document.hidden || reducedMotion()) return false;+ if (document.documentElement.getAttribute('data-motion') !== 'live') return false;+ if (document.documentElement.getAttribute('data-embed') === 'true' &&+ document.documentElement.getAttribute('data-share-playback') !== 'true') return false;+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ return !(Archify.motionGovernor && Archify.motionGovernor.isPaused());+ }++ function storyAutomaticPlaybackAllowed() {+ if (document.hidden || reducedMotion()) return false;+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ if (Archify.motionGovernor && Archify.motionGovernor.capable) return !Archify.motionGovernor.isPaused();+ return true;+ }++ function clearStoryPulse(options) {+ options = options || {};+ storyPulseGeneration += 1;+ Array.prototype.forEach.call(svg.querySelectorAll('.story-trail-flow[data-story-pulse]'), function (flow) {+ flow.removeAttribute('data-story-pulse');+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-carrier-overlay]'), function (overlay) {+ overlay.remove();+ });+ if (storyPulseOwnerToken && options.release !== false && Archify.motionGovernor) {+ var token = storyPulseOwnerToken;+ storyPulseOwnerToken = 0;+ Archify.motionGovernor.release(token);+ } else if (options.release === false) storyPulseOwnerToken = 0;+ }++ function pulseStoryStep(step) {+ clearStoryPulse();+ if (!step || (step.relation !== 'forward' && step.relation !== 'reverse') || step.edges.length !== 1 || !storyMotionAllowed()) return false;+ var flows = Array.prototype.slice.call(svg.querySelectorAll('.story-trail-flow[data-story-beat-step="' + step.index + '"]'));+ if (!flows.length) return false;+ var pulseGeneration = storyPulseGeneration;+ if (Archify.motionGovernor && Archify.motionGovernor.capable) {+ storyPulseOwnerToken = Archify.motionGovernor.claim('story', function () {+ clearStoryPulse({ release: false });+ });+ }+ flows.forEach(function (flow) { flow.setAttribute('data-story-pulse', 'true'); });+ if (Archify.flowTokens && typeof Archify.flowTokens.create === 'function') {+ var edge = step.edges[0];+ var shapes = storyGeometry(edge);+ var carrier = shapes.length ? Archify.flowTokens.create(edge, shapes[0], {+ className: 'story-flow-token',+ duration: '0.78s'+ }) : null;+ if (carrier) {+ var carrierOverlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ var carrierWrapper = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ carrierOverlay.setAttribute('class', 'story-carrier-overlay');+ carrierOverlay.setAttribute('data-story-carrier-overlay', '');+ carrierOverlay.setAttribute('aria-hidden', 'true');+ if (edge.hasAttribute('transform')) carrierWrapper.setAttribute('transform', edge.getAttribute('transform'));+ carrier.setAttribute('data-story-carrier-token', '');+ carrier.setAttribute('data-story-beat-step', String(step.index));+ carrierWrapper.appendChild(carrier);+ carrierOverlay.appendChild(carrierWrapper);+ var firstNode = svg.querySelector('[data-node-id]');+ while (firstNode && firstNode.parentNode !== svg) firstNode = firstNode.parentNode;+ if (firstNode) svg.insertBefore(carrierOverlay, firstNode);+ else svg.appendChild(carrierOverlay);+ }+ }+ void flows[0].getBoundingClientRect();+ flows[0].addEventListener('animationend', function () {+ if (pulseGeneration === storyPulseGeneration) clearStoryPulse();+ }, { once: true });+ return true;+ }++ function stopStoryBeatTimer(options) {+ options = options || {};+ storyPlaybackGeneration += 1;+ if (storyBeatTimer && options.preserveElapsed === true && storyBeatStartedAt) {+ storyBeatElapsedMs = Math.min(storyBeatDwellMs, storyBeatElapsedMs + Math.max(0, Date.now() - storyBeatStartedAt));+ }+ if (storyBeatTimer) clearTimeout(storyBeatTimer);+ storyBeatTimer = null;+ storyBeatStartedAt = 0;+ }++ function centerStoryStop(stop) {+ if (!stop || !trail) return false;+ var target = Math.max(0, stop.offsetLeft - (trail.clientWidth - stop.offsetWidth) / 2);+ trail.scrollLeft = target;+ return true;+ }++ function storyBeatDwell(total) {+ return Math.max(STORY_FOLLOW_MIN_DWELL_MS, VIEW_INTERVAL_MS / Math.max(1, total));+ }++ function clearStoryFollow() {+ storyFollowGeneration += 1;+ svg.removeAttribute('data-story-follow');+ panel.removeAttribute('data-story-follow');+ panel.removeAttribute('data-story-follow-node');+ }- <!-- Main Diagram -->- <div class="diagram-container">- <svg viewBox="0 0 1064 356" role="img" aria-label="Archify Pipeline — Grid placement demo — row/col instead of manual pos (architecture diagram)">- <!-- Definitions -->- <defs>- <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" class="m-default" />- </marker>- <marker id="arrowhead-emphasis" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" class="m-emphasis" />- </marker>- <marker id="arrowhead-security" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" class="m-security" />- </marker>- <marker id="arrowhead-dashed" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" class="m-dashed" />- </marker>- <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">- <path d="M 40 0 L 0 0 0 40" class="c-grid" stroke-width="0.5"/>- </pattern>- </defs>+ function storyFrameIds(step) {+ if (!step) return [];+ var ids = [];+ if (step.index > 0 && storySteps[step.index - 1]) ids.push(storySteps[step.index - 1].nodeId);+ ids.push(step.nodeId);+ if (step.index + 1 < storySteps.length) ids.push(storySteps[step.index + 1].nodeId);+ return ids;+ }- <!-- Background Grid -->- <rect width="100%" height="100%" fill="url(#grid)" />+ function followStoryStep(step, options) {+ options = options || {};+ if (!step || document.hidden) return false;+ if (!Archify.view || typeof Archify.view.reveal !== 'function') {+ var deferredIndex = step.index;+ var deferredGeneration = ++storyFollowGeneration;+ requestAnimationFrame(function () {+ if (deferredGeneration !== storyFollowGeneration || storyBeatIndex !== deferredIndex) return;+ if (Archify.view && typeof Archify.view.reveal === 'function') followStoryStep(step, options);+ });+ return true;+ }+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ var embed = document.documentElement.getAttribute('data-embed') === 'true';+ var explicitEmbedPlayback = document.documentElement.getAttribute('data-share-playback') === 'true';+ if (embed && !explicitEmbedPlayback && options.linked !== true) return false;+ var ids = storyFrameIds(step);+ var generation = ++storyFollowGeneration;+ svg.setAttribute('data-story-follow', step.nodeId);+ panel.setAttribute('data-story-follow', 'moving');+ panel.setAttribute('data-story-follow-node', step.nodeId);+ var receipt = Archify.view.reveal(ids, {+ reason: options.manual === true ? 'story-beat' : 'story-follow',+ padding: 64,+ maxScale: 1.65,+ duration: STORY_FOLLOW_DURATION_MS,+ instant: options.instant === true || reducedMotion() || document.documentElement.getAttribute('data-motion') !== 'live'+ });+ if (receipt && receipt.finished && typeof receipt.finished.then === 'function') {+ receipt.finished.then(function (result) {+ if (generation !== storyFollowGeneration || storyBeatIndex !== step.index) return;+ svg.removeAttribute('data-story-follow');+ panel.setAttribute('data-story-follow', result && result.state === 'complete' ? 'settled' : 'interrupted');+ });+ } else if (generation === storyFollowGeneration) {+ panel.setAttribute('data-story-follow', 'settled');+ }+ return receipt;+ }- <!-- Boundaries (behind everything) -->- <rect x="298" y="70" width="612" height="218" rx="12" class="c-region" stroke-width="1"/>- <text x="306" y="88" class="t-cloud" font-size="9" font-weight="600">archify/ skill package</text>+ function setStoryBeat(index, options) {+ options = options || {};+ var stops = Array.prototype.slice.call(trail.querySelectorAll('[data-story-node]'));+ if (!stops.length) return false;+ resetBeatLinkFeedback();+ storyBeatIndex = Math.max(0, Math.min(stops.length - 1, index));+ var nextStep = storyBeatIndex + 1 < storySteps.length ? storySteps[storyBeatIndex + 1] : null;+ svg.setAttribute('data-story-beat', (storyBeatIndex + 1) + '/' + stops.length);+ panel.setAttribute('data-story-beat', (storyBeatIndex + 1) + '/' + stops.length);+ if (nextStep) {+ svg.setAttribute('data-story-next', nextStep.nodeId);+ panel.setAttribute('data-story-next', nextStep.nodeId);+ } else {+ svg.removeAttribute('data-story-next');+ panel.removeAttribute('data-story-next');+ }+ function storyBeatState(step) {+ if (step < storyBeatIndex) return 'past';+ if (step === storyBeatIndex) return 'active';+ if (step === storyBeatIndex + 1) return 'next';+ return 'pending';+ }+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-step]'), function (node) {+ var step = Number(node.getAttribute('data-story-step'));+ node.setAttribute('data-story-beat-state', storyBeatState(step));+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-beat-step]'), function (edge) {+ var step = Number(edge.getAttribute('data-story-beat-step'));+ edge.setAttribute('data-story-beat-state', storyBeatState(step));+ });+ stops.forEach(function (stop, step) {+ stop.setAttribute('data-story-beat-state', storyBeatState(step));+ if (step === storyBeatIndex) stop.setAttribute('aria-current', 'step');+ else stop.removeAttribute('aria-current');+ });+ note.setAttribute('aria-live', 'off');+ note.textContent = storyBeatCopy(storySteps[storyBeatIndex], stops.length);+ renderStoryCaption(storySteps[storyBeatIndex], stops.length, nextStep);+ if (options.center === true) centerStoryStop(stops[storyBeatIndex]);+ if (options.pulse === true) pulseStoryStep(storySteps[storyBeatIndex]);+ else clearStoryPulse();+ if (options.follow === true) followStoryStep(storySteps[storyBeatIndex], {+ manual: options.manual === true,+ linked: options.linked === true,+ instant: options.followInstant === true+ });+ renderShareCue();+ syncBeatLink();+ return true;+ }- <!-- Connection paths (before components for correct z-order) -->- <path d="M 160 238 L 184 238" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 244 208 L 244 160" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>- <path d="M 304 238 L 328 238" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 388 208 L 388 160" class="a-security" stroke-width="1.5" marker-end="url(#arrowhead-security)"/>- <path d="M 448 238 L 472 238" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 592 238 L 616 238" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 736 238 L 760 238" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 880 238 L 904 238" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ function settleStoryBeats() {+ stopStoryBeatTimer();+ clearStoryPulse();+ clearStoryFollow();+ resetBeatLinkFeedback();+ storyBeatIndex = -1;+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = 0;+ svg.removeAttribute('data-story-beat');+ svg.removeAttribute('data-story-next');+ panel.removeAttribute('data-story-beat');+ panel.removeAttribute('data-story-next');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-beat-state]'), function (el) {+ el.removeAttribute('data-story-beat-state');+ });+ Array.prototype.forEach.call(trail.querySelectorAll('[data-story-beat-state]'), function (stop) {+ stop.removeAttribute('data-story-beat-state');+ stop.removeAttribute('aria-current');+ });+ note.setAttribute('aria-live', 'polite');+ if (activeIndex >= 0) note.textContent = views[activeIndex].note || views[activeIndex].focus.length + ' selected nodes';+ renderStoryCaption(null, 0);+ renderShareCue();+ syncBeatLink();+ }- <!-- Components -->- <rect x="40" y="208" width="120" height="60" rx="6" class="c-mask"/>- <rect x="40" y="208" width="120" height="60" rx="6" class="c-external" stroke-width="1.5"/>- <text x="100" y="236" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">You</text>- <text x="100" y="252" class="t-muted" font-size="9" text-anchor="middle">NL / Mermaid</text>-- <rect x="184" y="208" width="120" height="60" rx="6" class="c-mask"/>- <rect x="184" y="208" width="120" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>- <text x="244" y="236" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Agent Hosts</text>- <text x="244" y="252" class="t-muted" font-size="9" text-anchor="middle">Claude · Codex</text>-- <rect x="184" y="100" width="120" height="60" rx="6" class="c-mask"/>- <rect x="184" y="100" width="120" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>- <text x="244" y="128" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">SKILL.md</text>- <text x="244" y="144" class="t-muted" font-size="9" text-anchor="middle">layout rules</text>-- <rect x="328" y="208" width="120" height="60" rx="6" class="c-mask"/>- <rect x="328" y="208" width="120" height="60" rx="6" class="c-messagebus" stroke-width="1.5"/>- <text x="388" y="236" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">JSON IR</text>- <text x="388" y="252" class="t-muted" font-size="9" text-anchor="middle">schema v1</text>-- <rect x="328" y="100" width="120" height="60" rx="6" class="c-mask"/>- <rect x="328" y="100" width="120" height="60" rx="6" class="c-security" stroke-width="1.5"/>- <text x="388" y="128" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Schema</text>- <text x="388" y="144" class="t-muted" font-size="9" text-anchor="middle">ajv</text>-- <rect x="472" y="208" width="120" height="60" rx="6" class="c-mask"/>- <rect x="472" y="208" width="120" height="60" rx="6" class="c-backend" stroke-width="1.5"/>- <text x="532" y="242" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Renderers ×5</text>-- <rect x="616" y="208" width="120" height="60" rx="6" class="c-mask"/>- <rect x="616" y="208" width="120" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>- <text x="676" y="242" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">template.html</text>-- <rect x="760" y="208" width="120" height="60" rx="6" class="c-mask"/>- <rect x="760" y="208" width="120" height="60" rx="6" class="c-security" stroke-width="1.5"/>- <text x="820" y="242" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Output Check</text>-- <rect x="904" y="208" width="120" height="60" rx="6" class="c-mask"/>- <rect x="904" y="208" width="120" height="60" rx="6" class="c-cloud" stroke-width="1.5"/>- <text x="964" y="236" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">HTML</text>- <text x="964" y="252" class="t-muted" font-size="9" text-anchor="middle">artifact</text>+ function clearStoryTrail() {+ stopStoryBeatTimer();+ clearStoryPulse();+ clearStoryFollow();+ resetBeatLinkFeedback();+ storyBeatIndex = -1;+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = 0;+ storySteps = [];+ svg.removeAttribute('data-story-active');+ svg.removeAttribute('data-story-playing');+ svg.removeAttribute('data-story-beat');+ svg.removeAttribute('data-story-next');+ panel.removeAttribute('data-story-beat');+ panel.removeAttribute('data-story-next');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-overlay]'), function (overlay) {+ overlay.remove();+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-step], [data-story-beat-state]'), function (node) {+ node.removeAttribute('data-story-step');+ node.removeAttribute('data-story-beat-state');+ node.style.removeProperty('--story-step');+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-story-beat-step]'), function (edge) {+ edge.removeAttribute('data-story-beat-step');+ edge.removeAttribute('data-story-beat-state');+ });+ trail.textContent = '';+ trail.hidden = true;+ trail.removeAttribute('aria-label');+ renderStoryCaption(null, 0);+ syncBeatLink();+ }- <!-- Connection labels -->+ function storyGeometry(edge) {+ if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }++ function renderStoryTrail(view) {+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ clearStoryTrail();+ if (!view) return;++ var nodeList = Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ var edgeList = Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ var byId = {};+ nodeList.forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ storySteps = view.focus.map(function (_, index) { return storyStep(view, index, edgeList, byId); });+ var labels = [];+ storySteps.forEach(function (step, index) {+ var id = step.nodeId;+ var node = byId[id];+ if (!node) return;+ node.setAttribute('data-story-step', String(index));+ node.style.setProperty('--story-step', String(index));+ var nodeLabel = step.nodeLabel;+ labels.push(nodeLabel);+ var stop = document.createElement('button');+ stop.type = 'button';+ stop.className = 'guided-view-stop';+ stop.setAttribute('data-story-node', id);+ stop.setAttribute('data-story-index', String(index));+ stop.setAttribute('data-story-relation', step.relation);+ stop.setAttribute('data-story-number', (index + 1 < 10 ? '0' : '') + (index + 1));+ if (index > 0) stop.setAttribute('data-story-link', step.relation);+ stop.style.setProperty('--story-step', String(index));+ stop.setAttribute('aria-label', storyBeatAria(step, storySteps.length));+ stop.title = storyBeatCopy(step, storySteps.length);+ stop.textContent = nodeLabel;+ trail.appendChild(stop);+ });+ trail.hidden = labels.length === 0;+ trail.setAttribute('aria-label', 'Story trail for ' + view.label + ': ' + labels.length + ' beats');+ trail.scrollLeft = 0;+ svg.setAttribute('data-story-active', view.id);++ var overlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ overlay.setAttribute('class', 'story-trail-overlay');+ overlay.setAttribute('data-story-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ var copied = 0;+ storySteps.forEach(function (step) {+ step.edges.forEach(function (edge) {+ var edgeBeat = step.index;+ edge.setAttribute('data-story-beat-step', String(edgeBeat));+ var wrapper = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ storyGeometry(edge).forEach(function (shape) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('role');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.setAttribute('class', 'story-trail-flow');+ clone.setAttribute('data-story-beat-step', String(edgeBeat));+ clone.style.setProperty('--story-step', String(edgeBeat));+ wrapper.appendChild(clone);+ copied += 1;+ });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ });+ if (copied) {+ var firstEdge = edgeList[0];+ if (firstEdge && firstEdge.parentNode) firstEdge.parentNode.insertBefore(overlay, firstEdge);+ else svg.insertBefore(overlay, svg.firstChild);+ }+ }+ function syncStoryPlayback() {+ var shouldPlay = playing && activeIndex >= 0;+ if (shouldPlay && svg.getAttribute('data-story-playing') !== 'true') svg.setAttribute('data-story-playing', 'true');+ else if (!shouldPlay && svg.hasAttribute('data-story-playing')) svg.removeAttribute('data-story-playing');+ }+ function resetProgress(fraction) {+ fraction = Math.max(0, Math.min(1, Number(fraction) || 0));+ progressBar.style.animation = 'none';+ progressBar.style.setProperty('--guided-progress-start', String(fraction));+ progressBar.style.transform = 'scaleX(' + fraction + ')';+ }+ function startProgress(fraction, duration) {+ resetProgress(fraction);+ void progressBar.offsetWidth;+ progressBar.style.animation = 'archify-guided-progress ' + Math.max(1, duration || VIEW_INTERVAL_MS) + 'ms linear forwards';+ }+ function currentStoryProgress() {+ var total = storySteps.length;+ if (!total || storyBeatIndex < 0) return 0;+ var elapsed = storyBeatElapsedMs;+ if (playing && storyBeatTimer && storyBeatStartedAt) elapsed += Math.max(0, Date.now() - storyBeatStartedAt);+ var dwell = storyBeatDwellMs || storyBeatDwell(total);+ return Math.max(0, Math.min(1, (storyBeatIndex + Math.min(1, elapsed / dwell)) / total));+ }+ function renderPlayback() {+ var automaticPlaybackAllowed = storyAutomaticPlaybackAllowed();+ panel.setAttribute('data-playing', playing ? 'true' : 'false');+ syncStoryPlayback();+ play.disabled = !playing && !automaticPlaybackAllowed;+ play.setAttribute('aria-pressed', playing ? 'true' : 'false');+ play.setAttribute('aria-label', playing ? 'Pause guided story' : (!automaticPlaybackAllowed ? 'Story playback unavailable while motion is Still' : (storyPlaybackComplete ? 'Replay guided story' : 'Play guided story')));+ play.title = playing ? 'Pause guided story (P)' : (!automaticPlaybackAllowed ? 'Switch motion to Live to play the guided story' : (storyPlaybackComplete ? 'Replay guided story (P)' : 'Play guided story (P)'));+ playIcon.textContent = playing ? '\u2016' : '\u25b6';+ playLabel.textContent = playing ? 'Pause' : (storyPlaybackComplete ? 'Replay story' : 'Play story');+ if (storyCaption && !storyCaption.hidden) storyCaption.setAttribute('aria-live', playing ? 'off' : 'polite');+ }+ function render() {+ var view = views[activeIndex];+ count.textContent = activeIndex < 0 ? '0 / ' + views.length : (activeIndex + 1) + ' / ' + views.length;+ label.textContent = view ? view.label : 'Explore this system';+ note.setAttribute('aria-live', storyBeatIndex >= 0 ? 'off' : 'polite');+ note.textContent = storyBeatIndex >= 0+ ? storyBeatCopy(storySteps[storyBeatIndex], storySteps.length)+ : (view ? (view.note || view.focus.length + ' selected nodes') : 'Step through curated paths without changing the source diagram.');+ prev.disabled = activeIndex < 0;+ next.disabled = activeIndex >= views.length - 1;+ all.disabled = activeIndex < 0;+ panel.setAttribute('data-active-view', view ? view.id : 'all');+ syncChapterIndex();+ renderShareCue();+ renderPlayback();+ syncBeatLink();+ }+ function pausePlayback(options) {+ options = options || {};+ var progress = options.complete === true ? 1 : currentStoryProgress();+ if (panel.getAttribute('data-autoplay') === 'playing') {+ setShareCueProgress(progress);+ setAutoplayState(options.complete === true ? 'complete' : 'interrupted');+ }+ stopStoryBeatTimer({ preserveElapsed: options.complete !== true });+ clearStoryPulse();+ clearStoryFollow();+ playing = false;+ storyPlaybackComplete = options.complete === true;+ resetProgress(progress);+ renderPlayback();+ renderShareCue();+ }+ function finishStoryChapter() {+ if (!playing) return false;+ if (storyPlaybackScope === 'chapter') {+ pausePlayback({ complete: true });+ return true;+ }+ if (activeIndex < views.length - 1) {+ var destinationIndex = activeIndex + 1;+ activate(destinationIndex, { playback: true });+ afterHandoff(function () {+ if (!playing || activeIndex !== destinationIndex) return;+ storyBeatElapsedMs = 0;+ setStoryBeat(0, { pulse: true, follow: true });+ scheduleStoryPlayback();+ });+ return true;+ }+ pausePlayback({ complete: true });+ return true;+ }- <!-- Legend -->- <text x="40" y="327" class="t-primary" font-size="9" font-weight="600">Legend</text>- <rect x="40" y="332" width="14" height="9" rx="2" class="c-external" stroke-width="1"/>- <text x="60" y="340" class="t-muted" font-size="8">External</text>- <rect x="138" y="332" width="14" height="9" rx="2" class="c-frontend" stroke-width="1"/>- <text x="158" y="340" class="t-muted" font-size="8">Frontend</text>- <rect x="236" y="332" width="14" height="9" rx="2" class="c-messagebus" stroke-width="1"/>- <text x="256" y="340" class="t-muted" font-size="8">Message bus</text>- <rect x="349" y="332" width="14" height="9" rx="2" class="c-security" stroke-width="1"/>- <text x="369" y="340" class="t-muted" font-size="8">Security</text>- <rect x="447" y="332" width="14" height="9" rx="2" class="c-backend" stroke-width="1"/>- <text x="467" y="340" class="t-muted" font-size="8">Backend</text>- <rect x="540" y="332" width="14" height="9" rx="2" class="c-cloud" stroke-width="1"/>- <text x="560" y="340" class="t-muted" font-size="8">Cloud</text>- </svg>- </div>+ function scheduleStoryPlayback() {+ var total = storySteps.length;+ if (!playing || !total || reducedMotion()) {+ if (playing) pausePlayback();+ return false;+ }+ storyBeatDwellMs = storyBeatDwell(total);+ if (storyBeatIndex < 0) {+ storyBeatElapsedMs = 0;+ setStoryBeat(0, { pulse: true, follow: true });+ }+ storyBeatElapsedMs = Math.max(0, Math.min(storyBeatDwellMs, storyBeatElapsedMs));+ var remainingDwell = Math.max(1, storyBeatDwellMs - storyBeatElapsedMs);+ var progress = (storyBeatIndex + storyBeatElapsedMs / storyBeatDwellMs) / total;+ var remainingChapter = remainingDwell + Math.max(0, total - storyBeatIndex - 1) * storyBeatDwellMs;+ startProgress(progress, remainingChapter);+ if (panel.getAttribute('data-autoplay') === 'playing') startShareCueProgress(progress, remainingChapter);+ var generation = ++storyPlaybackGeneration;+ storyBeatStartedAt = Date.now();+ storyBeatTimer = setTimeout(function () {+ if (!playing || generation !== storyPlaybackGeneration) return;+ storyBeatTimer = null;+ storyBeatStartedAt = 0;+ storyBeatElapsedMs = 0;+ if (storyBeatIndex < total - 1) {+ setStoryBeat(storyBeatIndex + 1, { pulse: true, follow: true });+ scheduleStoryPlayback();+ } else finishStoryChapter();+ }, remainingDwell);+ return true;+ }- <!-- Info Cards -->- <div class="cards">- <div class="card">- <div class="card-header">- <div class="card-dot cyan"></div>- <h3>Grid mode</h3>- </div>- <ul>- <li>• Set layout.mode grid and place components with row/col</li>- <li>• pos still overrides a cell when you need fine tuning</li>- <li>• Not auto-layout — fixed cell spacing only</li>- </ul>- </div>- </div>+ function startPlayback() {+ if (!storyAutomaticPlaybackAllowed()) {+ renderPlayback();+ return false;+ }+ autoplayPending = false;+ setAutoplayState(null);+ setShareCueProgress(0);+ document.documentElement.removeAttribute('data-share-playback');+ storyPlaybackScope = 'story';+ if (storyPlaybackComplete) showAll({ updateUrl: false });+ storyPlaybackComplete = false;+ if (activeIndex < 0) activate(0, { playback: true });+ playing = true;+ renderPlayback();+ afterHandoff(function () {+ if (!playing) return;+ if (storyBeatIndex >= 0) followStoryStep(storySteps[storyBeatIndex]);+ scheduleStoryPlayback();+ });+ return true;+ }++ function startCurrentViewPlayback() {+ if (document.hidden) return false;+ autoplayPending = false;+ document.documentElement.setAttribute('data-share-playback', 'true');+ storyPlaybackScope = 'chapter';+ storyPlaybackComplete = false;+ if (activeIndex < 0) activate(0, { playback: true, updateUrl: false });+ if (!storyAutomaticPlaybackAllowed()) {+ var preserveMoment = hashBeatMatchesCurrent();+ setShareCueProgress(preserveMoment && storySteps.length ? (storyBeatIndex + 1) / storySteps.length : 1);+ setAutoplayState('reduced-motion');+ playing = false;+ if (preserveMoment) {+ clearStoryPulse();+ renderShareCue();+ } else settleStoryBeats();+ renderPlayback();+ return false;+ }+ playing = true;+ setAutoplayState('playing');+ renderPlayback();+ afterHandoff(function () {+ if (!playing) return;+ if (storyBeatIndex >= 0) followStoryStep(storySteps[storyBeatIndex]);+ scheduleStoryPlayback();+ });+ return true;+ }++ function maybeStartSharePlayback() {+ if (!autoplayPending || document.hidden) return false;+ return startCurrentViewPlayback();+ }++ function togglePlayback() {+ return playing ? (pausePlayback(), false) : startPlayback();+ }++ function syncStoryControlsDisabled() {+ Array.prototype.forEach.call(trail.querySelectorAll('[data-story-node]'), function (stop) {+ stop.disabled = !!currentHandoff;+ });+ syncBeatLink();+ }++ function selectStoryBeat(index) {+ if (currentHandoff || activeIndex < 0 || index < 0 || index >= storySteps.length) return false;+ momentRestoreGeneration += 1;+ clearChapterPreview({ clearIntents: true });+ if (playing) pausePlayback();+ else {+ stopStoryBeatTimer();+ clearStoryPulse();+ }+ storyPlaybackComplete = false;+ storyPlaybackScope = 'story';+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = storyBeatDwell(storySteps.length);+ var view = views[activeIndex];+ Archify.focus.setMany(view.focus, {+ toggle: false,+ updateUrl: false,+ mode: 'selection',+ label: view.label,+ hideChip: true+ });+ setStoryBeat(index, { manual: true, center: true, pulse: true, follow: true });+ resetProgress(index / storySteps.length);+ renderPlayback();+ return true;+ }++ function selectStoryBeatById(id, options) {+ options = options || {};+ var index = storySteps.findIndex(function (step) { return step.nodeId === id; });+ if (index < 0) return false;+ if (playing) pausePlayback();+ else {+ stopStoryBeatTimer();+ clearStoryPulse();+ }+ storyPlaybackComplete = false;+ storyPlaybackScope = 'story';+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = storyBeatDwell(storySteps.length);+ setStoryBeat(index, {+ manual: false,+ center: true,+ pulse: false,+ follow: options.follow === true,+ linked: options.linked === true,+ followInstant: options.followInstant === true+ });+ resetProgress(index / storySteps.length);+ renderPlayback();+ return true;+ }++ function updateUrl(view) {+ try {+ history.replaceState(null, '', location.pathname + location.search + (view ? '#view=' + encodeURIComponent(view.id) : ''));+ } catch (_) {}+ }++ function showAll(options) {+ options = options || {};+ if (options.restore !== true) momentRestoreGeneration += 1;+ clearChapterPreview({ clearIntents: true });+ if (playing && options.playback !== true) pausePlayback();+ if (options.playback !== true) storyPlaybackComplete = false;+ cancelHandoff('overview');+ activeIndex = -1;+ renderStoryTrail(null);+ if (options.clearFocus !== false) Archify.focus.clear({ updateUrl: false });+ if (options.resetView !== false && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ render();+ if (options.updateUrl !== false) updateUrl(null);+ }++ function activate(index, options) {+ options = options || {};+ if (options.restore !== true) momentRestoreGeneration += 1;+ if (playing && options.playback !== true) pausePlayback();+ if (options.playback !== true) storyPlaybackComplete = false;+ if (index < 0) { showAll(options); return true; }+ if (index >= views.length) return false;+ clearChapterPreview({ clearIntents: true });+ var previousIndex = activeIndex;+ var previous = previousIndex >= 0 ? views[previousIndex] : null;+ var outgoingBeatIndex = storyBeatIndex;+ cancelHandoff('replaced');+ activeIndex = index;+ var view = views[index];+ Archify.focus.setMany(view.focus, {+ toggle: false,+ updateUrl: false,+ mode: 'selection',+ label: view.label,+ hideChip: true+ });+ renderStoryTrail(view);+ beginHandoff(previousIndex, index, previous, view, outgoingBeatIndex, options.playback === true ? 'playback' : 'guided');+ syncStoryControlsDisabled();+ render();+ if (options.updateUrl !== false) updateUrl(view);+ return true;+ }++ function activateById(id, options) {+ var index = views.findIndex(function (view) { return view.id === id; });+ return index >= 0 && activate(index, options);+ }++ prev.addEventListener('click', function () { activate(activeIndex - 1); });+ next.addEventListener('click', function () { activate(activeIndex + 1); });+ all.addEventListener('click', function () { showAll(); });+ play.addEventListener('click', togglePlayback);+ beatLink.addEventListener('click', copyStoryMomentLink);+ trail.addEventListener('focusin', function (event) {+ if (!event.target.closest('[data-story-node]')) return;+ if (playing) pausePlayback();+ });+ trail.addEventListener('click', function (event) {+ var stop = event.target.closest('[data-story-node]');+ if (!stop || stop.disabled) return;+ selectStoryBeat(Number(stop.getAttribute('data-story-index')));+ });+ trail.addEventListener('keydown', function (event) {+ if (event.key !== 'Enter' && event.key !== ' ') return;+ var stop = event.target.closest('[data-story-node]');+ if (!stop || stop.disabled) return;+ event.preventDefault();+ selectStoryBeat(Number(stop.getAttribute('data-story-index')));+ });+ chapterList.addEventListener('click', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button) return;+ activateById(button.getAttribute('data-guided-view-id'));+ });+ chapterList.addEventListener('pointerover', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button || !hoverCapable() || event.pointerType === 'touch') return;+ if (event.relatedTarget && button.contains(event.relatedTarget)) return;+ setChapterPreviewIntent('pointer', chapterButtons.indexOf(button));+ });+ chapterList.addEventListener('pointerout', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ clearChapterPreviewIntent('pointer', chapterButtons.indexOf(button));+ });+ chapterIndex.addEventListener('focusin', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button) return;+ setChapterPreviewIntent('focus', chapterButtons.indexOf(button));+ });+ chapterIndex.addEventListener('focusout', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ clearChapterPreviewIntent('focus', chapterButtons.indexOf(button));+ });+ chapterList.addEventListener('keydown', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ var index = chapterButtons.indexOf(button);+ if (index < 0) return;+ var target = null;+ if (event.key === 'ArrowRight') target = Math.min(chapterButtons.length - 1, index + 1);+ else if (event.key === 'ArrowLeft') target = Math.max(0, index - 1);+ else if (event.key === 'Home') target = 0;+ else if (event.key === 'End') target = chapterButtons.length - 1;+ if (target === null) return;+ event.preventDefault();+ focusChapterButton(target);+ });++ // A direct node exploration supersedes the curated view. Capture phase+ // releases the view before the focus explorer writes its own deep link.+ function releaseForNode(event) {+ if (activeIndex >= 0 && event.target.closest('[data-node-id]')) {+ pausePlayback();+ showAll({ clearFocus: false, updateUrl: false });+ }+ }+ svg.addEventListener('click', releaseForNode, true);+ svg.addEventListener('keydown', function (event) {+ if (event.key === 'Enter' || event.key === ' ') releaseForNode(event);+ }, true);++ document.addEventListener('keydown', function (event) {+ if (event.metaKey || event.ctrlKey || event.altKey) return;+ if (document.documentElement.getAttribute('data-guide-open') === 'true') return;+ var target = event.target;+ if (target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable)) return;+ if (event.key === ']') {+ event.preventDefault();+ if (activeIndex < views.length - 1) activate(activeIndex + 1);+ } else if (event.key === '[') {+ event.preventDefault();+ if (activeIndex >= 0) activate(activeIndex - 1);+ } else if (event.key.toLowerCase() === 'p') {+ event.preventDefault();+ togglePlayback();+ } else if (event.key === 'Escape' && activePreviewIndex >= 0) {+ event.preventDefault();+ event.stopImmediatePropagation();+ clearChapterPreview({ clearIntents: true });+ } else if (event.key === 'Escape' && activeIndex >= 0) {+ event.preventDefault();+ showAll();+ }+ }, true);++ function syncViewFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var initial = params.get('view');+ var requestedBeat = params.get('beat');+ var restoreGeneration = ++momentRestoreGeneration;+ if (initial) {+ var activated = activateById(initial, { updateUrl: false, restore: true });+ if (!activated) {+ showAll({ updateUrl: false, restore: true });+ return;+ }+ if (requestedBeat) afterHandoff(function () {+ if (restoreGeneration !== momentRestoreGeneration) return;+ var latest = new URLSearchParams(location.hash.replace(/^#/, ''));+ if (latest.get('view') !== initial || latest.get('beat') !== requestedBeat) return;+ if (activeIndex < 0 || views[activeIndex].id !== initial) return;+ selectStoryBeatById(requestedBeat, { linked: true, follow: true, followInstant: true });+ });+ } else if (params.get('focus') || params.get('relation')) {+ activeIndex = -1;+ render();+ } else {+ showAll({ updateUrl: false, restore: true });+ }+ } catch (_) { showAll({ updateUrl: false, restore: true }); }+ }++ window.addEventListener('hashchange', syncViewFromHash);+ document.addEventListener('visibilitychange', function () {+ if (document.hidden) {+ clearChapterPreview({ clearIntents: true });+ if (playing) pausePlayback();+ else clearStoryPulse();+ settleHandoff('hidden');+ }+ else if (!document.hidden) maybeStartSharePlayback();+ });+ if (window.matchMedia) {+ var guidedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');+ var onGuidedMotionChange = function () {+ if (guidedMotionQuery.matches) {+ if (playing) pausePlayback();+ else clearStoryPulse();+ settleHandoff('reduced-motion');+ }+ };+ if (typeof guidedMotionQuery.addEventListener === 'function') guidedMotionQuery.addEventListener('change', onGuidedMotionChange);+ else if (typeof guidedMotionQuery.addListener === 'function') guidedMotionQuery.addListener(onGuidedMotionChange);+ }+ if (document.documentElement.getAttribute('data-embed') !== 'true' && typeof MutationObserver !== 'undefined' && typeof Node !== 'undefined' && svg instanceof Node && document.documentElement instanceof Node) {+ var chapterPreviewOwnerObserver = new MutationObserver(syncChapterPreview);+ chapterPreviewOwnerObserver.observe(svg, {+ attributes: true,+ attributeFilter: [+ 'data-route-picking', 'data-route-active', 'data-lens-active',+ 'data-legend-preview-active', 'data-relationship-preview-active',+ 'data-intent-trace-active', 'data-focus-active'+ ]+ });+ var storyMotionObserver = new MutationObserver(function () {+ if (document.documentElement.getAttribute('data-motion') !== 'live') clearStoryPulse();+ renderPlayback();+ });+ storyMotionObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['data-motion'] });+ }+ window.addEventListener('beforeprint', function () {+ clearChapterPreview({ clearIntents: true });+ if (playing) pausePlayback();+ else clearStoryPulse();+ settleHandoff('print');+ });+ syncViewFromHash();+ if (autoplayPending) {+ requestAnimationFrame(function () {+ requestAnimationFrame(maybeStartSharePlayback);+ });+ }++ return {+ count: views.length,+ activate: activateById,+ showAll: showAll,+ play: startPlayback,+ playCurrent: startCurrentViewPlayback,+ pause: pausePlayback,+ beatLink: storyMomentLink,+ copyBeatLink: copyStoryMomentLink,+ cancelHandoff: cancelHandoff,+ settleHandoff: settleHandoff,+ clearPreview: function () { return clearChapterPreview({ clearIntents: true }); },+ isPlaying: function () { return playing; },+ handoff: function () {+ return currentHandoff ? { id: currentHandoff.id, mode: currentHandoff.mode, anchor: currentHandoff.anchor || null } : null;+ },+ active: function () { return activeIndex < 0 ? null : views[activeIndex].id; },+ preview: function () { return activePreviewIndex < 0 ? null : views[activePreviewIndex].id; },+ delta: function (id) {+ var index = views.findIndex(function (view) { return view.id === id; });+ if (index < 0) return null;+ var value = chapterDelta(activeIndex >= 0 ? views[activeIndex] : null, views[index]);+ return { stay: value.stay.slice(), enter: value.enter.slice(), leave: value.leave.slice() };+ },+ beat: function () {+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ return step ? {+ index: step.index,+ position: step.index + 1,+ total: storySteps.length,+ nodeId: step.nodeId,+ relation: step.relation,+ edgeKeys: step.edgeKeys.slice()+ } : null;+ },+ focus: function () { return activeIndex < 0 ? [] : views[activeIndex].focus.slice(); }+ };+ })();++ Archify.view = (function () {+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector('svg');+ var outBtn = container.querySelector('[data-view="out"]');+ var resetBtn = container.querySelector('[data-view="reset"]');+ var inBtn = container.querySelector('[data-view="in"]');+ var state = { scale: 1, x: 0, y: 0, mode: 'overview' };+ var drag = null;+ var cameraTimer = null;+ var cameraFrame = null;+ var cameraGeneration = 0;+ var cameraTransaction = null;+ var resizeFrame = 0;+ var autoScrollUntil = 0;++ var viewBox = svg.viewBox && svg.viewBox.baseVal;+ if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {+ container.setAttribute('data-wide-diagram', 'true');+ }++ function clamp() {+ var width = svg.clientWidth || 1;+ var height = svg.clientHeight || 1;+ state.x = Math.min(0, Math.max(width - width * state.scale, state.x));+ state.y = Math.min(0, Math.max(height - height * state.scale, state.y));+ }+ function reducedMotion() {+ return window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;+ }+ function contentMetrics() {+ if (!viewBox || viewBox.width <= 0 || viewBox.height <= 0) return null;+ var width = svg.clientWidth || 1;+ var height = svg.clientHeight || 1;+ var scale = Math.min(width / viewBox.width, height / viewBox.height);+ return {+ width: width,+ height: height,+ scale: scale,+ offsetX: (width - viewBox.width * scale) / 2,+ offsetY: (height - viewBox.height * scale) / 2+ };+ }+ function logicalViewport() {+ var metrics = contentMetrics();+ if (!metrics) return null;+ var x;+ var y;+ var width;+ var height;+ if (window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram')) {+ x = viewBox.x + container.scrollLeft / metrics.scale;+ y = viewBox.y;+ width = Math.min(viewBox.width, Math.max(1, container.clientWidth / metrics.scale));+ height = viewBox.height;+ } else {+ x = viewBox.x + ((-state.x / state.scale) - metrics.offsetX) / metrics.scale;+ y = viewBox.y + ((-state.y / state.scale) - metrics.offsetY) / metrics.scale;+ width = Math.min(viewBox.width, metrics.width / state.scale / metrics.scale);+ height = Math.min(viewBox.height, metrics.height / state.scale / metrics.scale);+ }+ width = Math.max(1, Math.min(viewBox.width, width));+ height = Math.max(1, Math.min(viewBox.height, height));+ x = Math.max(viewBox.x, Math.min(viewBox.x + viewBox.width - width, x));+ y = Math.max(viewBox.y, Math.min(viewBox.y + viewBox.height - height, y));+ return { x: x, y: y, width: width, height: height, scale: state.scale };+ }+ function detailLevel() {+ if (state.mode === 'semantic') return 'full';+ if (state.scale >= 1.75) return 'full';+ if (state.scale >= 1.25) return 'read';+ return 'map';+ }+ function renderControls() {+ var semantic = state.mode === 'semantic' && state.scale > 1.01;+ var detail = detailLevel();+ var percent = Math.round(state.scale * 100) + '%';+ var levelLabel = detail === 'map' ? 'MAP ' : detail === 'read' ? 'READ ' : 'FULL ';+ var detailHint = detail === 'map'+ ? 'Zoom in to reveal relationship labels and node context'+ : detail === 'read'+ ? 'Zoom in again to reveal tags and annotations'+ : 'Full diagram detail';+ resetBtn.textContent = (semantic ? 'AUTO ' : levelLabel) + percent;+ resetBtn.title = (semantic ? 'Semantic camera active · ' : '') + detailHint + ' · reset view (0)';+ resetBtn.setAttribute('aria-label', detailHint + '. Reset diagram view');+ resetBtn.setAttribute('data-detail-level', detail);+ container.setAttribute('data-detail-level', detail);+ container.setAttribute('data-camera-mode', state.mode);+ container.setAttribute('data-camera-indicator', semantic ? 'true' : 'false');+ }+ function apply() {+ clamp();+ svg.style.transform = 'translate(' + state.x + 'px,' + state.y + 'px) scale(' + state.scale + ')';+ renderControls();+ outBtn.disabled = state.scale <= 1;+ inBtn.disabled = state.scale >= 3;+ container.classList.toggle('is-pannable', state.scale > 1);+ svg.setAttribute('data-view-scale', String(state.scale));+ if (Archify.radar && typeof Archify.radar.sync === 'function') Archify.radar.sync();+ }+ function sampleRenderedState() {+ var transform = '';+ try { transform = getComputedStyle(svg).transform || ''; } catch (_) {}+ var match = transform.match(/^matrix\(([^)]+)\)$/);+ if (!match) return { scale: state.scale, x: state.x, y: state.y, mode: state.mode };+ var values = match[1].split(',').map(Number);+ if (values.length !== 6 || !values.every(Number.isFinite)) {+ return { scale: state.scale, x: state.x, y: state.y, mode: state.mode };+ }+ return { scale: values[0], x: values[4], y: values[5], mode: state.mode };+ }+ function finishCameraTransaction(transaction, outcome) {+ if (!transaction || transaction.settled) return false;+ transaction.settled = true;+ transaction.state = outcome || 'complete';+ if (transaction.frame) cancelAnimationFrame(transaction.frame);+ if (transaction.timer) clearTimeout(transaction.timer);+ transaction.frame = null;+ transaction.timer = null;+ if (cameraTransaction === transaction) cameraTransaction = null;+ cameraFrame = null;+ cameraTimer = null;+ container.classList.remove('is-camera-moving');+ container.classList.remove('is-camera-transaction');+ container.removeAttribute('data-camera-transaction');+ if (Archify.focus && Archify.focus.reposition) Archify.focus.reposition();+ transaction.resolve({ id: transaction.id, state: transaction.state });+ return true;+ }+ function cameraReceipt(target, options) {+ var resolver;+ var transaction = {+ id: ++cameraGeneration,+ state: 'running',+ target: target,+ settled: false,+ frame: null,+ timer: null,+ finished: new Promise(function (resolve) { resolver = resolve; }),+ resolve: resolver,+ cancel: function (reason, commitTarget) {+ if (transaction.settled) return false;+ if (commitTarget && transaction.target) {+ if (Object.prototype.hasOwnProperty.call(transaction.target, 'scrollLeft')) {+ container.scrollLeft = transaction.target.scrollLeft;+ } else {+ state = {+ scale: transaction.target.scale,+ x: transaction.target.x,+ y: transaction.target.y,+ mode: transaction.target.mode+ };+ apply();+ }+ }+ return finishCameraTransaction(transaction, reason || 'cancelled');+ }+ };+ return transaction;+ }+ function stopCameraMotion(reason, commitTarget) {+ if (cameraTransaction && !cameraTransaction.settled) {+ cameraTransaction.cancel(reason || 'cancelled', commitTarget === true);+ return;+ }+ if (cameraTimer) clearTimeout(cameraTimer);+ if (cameraFrame) cancelAnimationFrame(cameraFrame);+ cameraTimer = null;+ cameraFrame = null;+ container.classList.remove('is-camera-moving');+ container.classList.remove('is-camera-transaction');+ container.removeAttribute('data-camera-transaction');+ }+ function interruptCamera(reason) {+ if (Archify.guidedViews && Archify.guidedViews.cancelHandoff) {+ Archify.guidedViews.cancelHandoff(reason || 'manual');+ }+ var rendered = sampleRenderedState();+ stopCameraMotion(reason || 'manual', false);+ state = rendered;+ state.mode = 'manual';+ apply();+ renderControls();+ if (Archify.guidedViews && Archify.guidedViews.isPlaying && Archify.guidedViews.isPlaying()) {+ Archify.guidedViews.pause();+ }+ if (Archify.routeProbe && Archify.routeProbe.isJourneyPlaying && Archify.routeProbe.isJourneyPlaying()) {+ Archify.routeProbe.pauseJourney({ preserveElapsed: true, reason: reason || 'manual' });+ }+ }+ function zoom(next, options) {+ options = options || {};+ if (options.manual !== false) interruptCamera();+ var previous = state.scale;+ next = Math.max(1, Math.min(3, Math.round(next * 4) / 4));+ if (next === previous) return;+ var centerX = (svg.clientWidth || 1) / 2;+ var centerY = (svg.clientHeight || 1) / 2;+ var contentX = (centerX - state.x) / previous;+ var contentY = (centerY - state.y) / previous;+ state.scale = next;+ state.x = centerX - contentX * next;+ state.y = centerY - contentY * next;+ apply();+ }+ function reset(options) {+ options = options || {};+ if (options.automatic !== true) interruptCamera();+ else stopCameraMotion('reset', false);+ state = { scale: 1, x: 0, y: 0, mode: 'overview' };+ apply();+ }+ function centerAt(logicalX, logicalY, options) {+ options = options || {};+ logicalX = Number(logicalX);+ logicalY = Number(logicalY);+ var metrics = contentMetrics();+ if (!metrics || !Number.isFinite(logicalX) || !Number.isFinite(logicalY)) return false;+ interruptCamera();+ if (window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram')) {+ state.scale = 1;+ state.x = 0;+ state.y = 0;+ state.mode = 'manual';+ apply();+ var mobileTarget = (logicalX - viewBox.x) * metrics.scale - container.clientWidth / 2;+ mobileTarget = Math.max(0, Math.min(svg.clientWidth - container.clientWidth, mobileTarget));+ autoScrollUntil = Date.now() + 80;+ try { container.scrollTo({ left: mobileTarget, behavior: options.instant ? 'auto' : 'smooth' }); }+ catch (_) { container.scrollLeft = mobileTarget; }+ return true;+ }+ var minimumScale = Math.max(1, Math.min(3, Number(options.minimumScale) || 1));+ var requestedScale = Number(options.scale);+ state.scale = Math.max(minimumScale, Math.min(3, Number.isFinite(requestedScale) ? requestedScale : state.scale));+ var contentX = metrics.offsetX + (logicalX - viewBox.x) * metrics.scale;+ var contentY = metrics.offsetY + (logicalY - viewBox.y) * metrics.scale;+ state.x = metrics.width / 2 - contentX * state.scale;+ state.y = metrics.height / 2 - contentY * state.scale;+ state.mode = 'manual';+ apply();+ if (Archify.focus && Archify.focus.reposition) Archify.focus.reposition();+ return true;+ }+ function semanticIds(ids, includeNeighbors) {+ var seeds = {};+ var wanted = {};+ (ids || []).forEach(function (id) { seeds[id] = true; wanted[id] = true; });+ if (includeNeighbors) {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (seeds[from] || seeds[to]) { wanted[from] = true; wanted[to] = true; }+ });+ }+ return wanted;+ }+ function boxesFor(ids, includeNeighbors) {+ var wanted = semanticIds(ids, includeNeighbors);+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'))+ .filter(function (node) { return wanted[node.getAttribute('data-node-id')]; })+ .map(function (node) {+ try { return node.getBBox(); } catch (_) { return null; }+ })+ .filter(Boolean);+ }+ function frameDesktop(ids, options) {+ options = options || {};+ var boxes = boxesFor(ids, options.includeNeighbors === true);+ if (!boxes.length || !viewBox || viewBox.width <= 0 || viewBox.height <= 0) return false;+ var svgWidth = svg.clientWidth || 1;+ var svgHeight = svg.clientHeight || 1;+ var contentScale = Math.min(svgWidth / viewBox.width, svgHeight / viewBox.height);+ var contentOffsetX = (svgWidth - viewBox.width * contentScale) / 2;+ var contentOffsetY = (svgHeight - viewBox.height * contentScale) / 2;+ var minX = Math.min.apply(Math, boxes.map(function (box) { return box.x; }));+ var minY = Math.min.apply(Math, boxes.map(function (box) { return box.y; }));+ var maxX = Math.max.apply(Math, boxes.map(function (box) { return box.x + box.width; }));+ var maxY = Math.max.apply(Math, boxes.map(function (box) { return box.y + box.height; }));+ var bounds = {+ x: contentOffsetX + minX * contentScale,+ y: contentOffsetY + minY * contentScale,+ width: Math.max(1, (maxX - minX) * contentScale),+ height: Math.max(1, (maxY - minY) * contentScale)+ };+ var padding = options.padding || 48;+ var left = padding;+ var right = svgWidth - padding;+ var top = padding;+ var bottom = svgHeight - Math.max(padding, 72);+ var containerRect = container.getBoundingClientRect();+ var visibleTop = Math.max(0, -containerRect.top);+ var visibleBottom = Math.min(svgHeight, window.innerHeight - containerRect.top);+ if (visibleBottom - visibleTop >= 240) {+ top = Math.max(top, visibleTop + padding);+ bottom = Math.min(bottom, visibleBottom - Math.max(padding, 72));+ }+ var chip = document.getElementById('focus-chip');+ if (chip && !chip.hidden) {+ var lensEnd = chip.offsetLeft + chip.offsetWidth + 24 - (svg.offsetLeft || 0);+ left = Math.max(left, Math.min(svgWidth * 0.42, lensEnd));+ }+ var routeReceipt = document.getElementById('route-probe');+ if (routeReceipt && !routeReceipt.hidden && routeReceipt.hasAttribute('data-route-journey')) {+ var receiptTop = routeReceipt.offsetTop;+ var receiptBottom = receiptTop + routeReceipt.offsetHeight;+ if (receiptTop < svgHeight / 2) top = Math.max(top, receiptBottom + 24);+ else bottom = Math.min(bottom, receiptTop - 24);+ }+ if (right <= left || bottom <= top) return false;+ var maxScale = options.maxScale || (options.includeNeighbors ? 1.9 : 2.15);+ var targetScale = Math.min((right - left) / bounds.width, (bottom - top) / bounds.height) * 0.9;+ targetScale = Math.max(1, Math.min(maxScale, targetScale));+ if (targetScale < 1.08) targetScale = 1;+ var target = {+ scale: Math.round(targetScale * 100) / 100,+ x: 0,+ y: 0,+ mode: 'semantic'+ };+ target.x = (left + right) / 2 - (bounds.x + bounds.width / 2) * target.scale;+ target.y = (top + bottom) / 2 - (bounds.y + bounds.height / 2) * target.scale;+ var start = sampleRenderedState();+ stopCameraMotion('replaced', false);+ var transaction = cameraReceipt(target, options);+ cameraTransaction = transaction;+ var instant = options.instant === true || reducedMotion() || document.hidden;+ if (instant) {+ state = target;+ apply();+ finishCameraTransaction(transaction, reducedMotion() ? 'reduced-motion' : (document.hidden ? 'hidden' : 'complete'));+ return transaction;+ }+ var duration = Math.max(180, Math.min(520, Number(options.duration) || 420));+ var startedAt = 0;+ state = start;+ state.mode = 'semantic';+ apply();+ container.classList.add('is-camera-moving');+ container.classList.add('is-camera-transaction');+ container.setAttribute('data-camera-transaction', String(transaction.id));+ var step = function (timestamp) {+ if (cameraTransaction !== transaction || transaction.settled) return;+ if (!startedAt) startedAt = timestamp;+ var fraction = Math.max(0, Math.min(1, (timestamp - startedAt) / duration));+ var eased = 1 - Math.pow(1 - fraction, 3);+ state = {+ scale: start.scale + (target.scale - start.scale) * eased,+ x: start.x + (target.x - start.x) * eased,+ y: start.y + (target.y - start.y) * eased,+ mode: 'semantic'+ };+ apply();+ if (fraction < 1) {+ transaction.frame = requestAnimationFrame(step);+ cameraFrame = transaction.frame;+ } else {+ state = target;+ apply();+ finishCameraTransaction(transaction, 'complete');+ }+ };+ transaction.frame = requestAnimationFrame(step);+ cameraFrame = transaction.frame;+ return transaction;+ }+ function reveal(ids, options) {+ options = options || {};+ if (window.innerWidth > 720) return frameDesktop(ids, options);+ stopCameraMotion('replaced', false);+ state.scale = 1;+ state.x = 0;+ state.y = 0;+ state.mode = 'semantic';+ apply();+ if (!container.hasAttribute('data-wide-diagram')) {+ var contained = cameraReceipt({ scale: 1, x: 0, y: 0, mode: 'semantic' }, options);+ cameraTransaction = contained;+ finishCameraTransaction(contained, 'complete');+ return contained;+ }+ var boxes = boxesFor(ids, options.includeNeighbors === true);+ if (!boxes.length || !viewBox || viewBox.width <= 0) return false;+ var minX = Math.min.apply(Math, boxes.map(function (box) { return box.x; }));+ var maxX = Math.max.apply(Math, boxes.map(function (box) { return box.x + box.width; }));+ var center = ((minX + maxX) / 2 / viewBox.width) * (svg.clientWidth || 1);+ var target = Math.max(0, Math.min(svg.clientWidth - container.clientWidth, center - container.clientWidth / 2));+ var transaction = cameraReceipt({ scrollLeft: target }, options);+ cameraTransaction = transaction;+ var instant = options.instant === true || reducedMotion() || document.hidden;+ autoScrollUntil = Date.now() + (instant ? 50 : 470);+ try { container.scrollTo({ left: target, behavior: instant ? 'auto' : 'smooth' }); }+ catch (_) { container.scrollLeft = target; }+ if (instant) finishCameraTransaction(transaction, reducedMotion() ? 'reduced-motion' : (document.hidden ? 'hidden' : 'complete'));+ else {+ transaction.timer = setTimeout(function () { finishCameraTransaction(transaction, 'complete'); }, 460);+ cameraTimer = transaction.timer;+ container.classList.add('is-camera-moving');+ container.setAttribute('data-camera-transaction', String(transaction.id));+ }+ return transaction;+ }+ function syncSemantic() {+ var guided = Archify.guidedViews && typeof Archify.guidedViews.focus === 'function'+ ? Archify.guidedViews.focus() : [];+ if (guided && guided.length) return reveal(guided, { reason: 'guided-sync' });+ var active = Archify.focus && typeof Archify.focus.active === 'function' ? Archify.focus.active() : null;+ if (typeof active === 'string') return reveal([active], { includeNeighbors: true, reason: 'focus-sync' });+ if (Array.isArray(active) && active.length) return reveal(active, { reason: 'selection-sync' });+ return false;+ }+ function pinControls() {+ container.style.setProperty('--archify-scroll-x', container.scrollLeft + 'px');+ }+ function onScroll() {+ pinControls();+ if (Archify.radar && typeof Archify.radar.sync === 'function') Archify.radar.sync();+ if (window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram') && Date.now() > autoScrollUntil) {+ interruptCamera();+ }+ }+ function onPointerEnd(event) {+ if (!drag) return;+ var moved = drag.moved;+ drag = null;+ container.classList.remove('is-panning');+ try { container.releasePointerCapture(event.pointerId); } catch (_) {}+ if (moved) {+ container.setAttribute('data-just-panned', 'true');+ setTimeout(function () { container.removeAttribute('data-just-panned'); }, 80);+ }+ }++ inBtn.addEventListener('click', function () { zoom(state.scale + 0.25); });+ outBtn.addEventListener('click', function () { zoom(state.scale - 0.25); });+ resetBtn.addEventListener('click', reset);+ container.addEventListener('pointerdown', function (event) {+ if (state.scale <= 1 || event.button !== 0 || event.target.closest('.diagram-nav, .focus-chip, .node-finder, .diagram-guide, .overview-map, .route-probe, .semantic-lens') || event.target.closest('[data-node-id]') || event.target.closest('[data-relationship-hit-key]')) return;+ interruptCamera();+ drag = { startX: event.clientX, startY: event.clientY, x: state.x, y: state.y, moved: false };+ container.classList.add('is-panning');+ try { container.setPointerCapture(event.pointerId); } catch (_) {}+ });+ container.addEventListener('pointermove', function (event) {+ if (!drag) return;+ var dx = event.clientX - drag.startX;+ var dy = event.clientY - drag.startY;+ if (Math.abs(dx) + Math.abs(dy) > 3) drag.moved = true;+ state.x = drag.x + dx;+ state.y = drag.y + dy;+ apply();+ });+ container.addEventListener('pointerup', onPointerEnd);+ container.addEventListener('pointercancel', onPointerEnd);+ container.addEventListener('scroll', onScroll, { passive: true });+ window.addEventListener('resize', function () {+ if (resizeFrame) cancelAnimationFrame(resizeFrame);+ resizeFrame = requestAnimationFrame(function () {+ resizeFrame = 0;+ if (state.mode === 'semantic') syncSemantic();+ else apply();+ });+ });+ window.addEventListener('hashchange', function () { requestAnimationFrame(syncSemantic); });+ apply();+ pinControls();+ requestAnimationFrame(syncSemantic);++ return {+ zoomIn: function () { zoom(state.scale + 0.25); },+ zoomOut: function () { zoom(state.scale - 0.25); },+ reset: reset,+ reveal: reveal,+ centerAt: centerAt,+ logicalViewport: logicalViewport,+ sync: syncSemantic,+ state: function () { return { scale: state.scale, x: state.x, y: state.y, mode: state.mode }; }+ };+ })();++ /* ============================================================+ Semantic Radar — simplified semantic bounds + live viewport.+ The radar is built at runtime so the checked artifact still contains+ one canonical SVG block, and export serialization remains untouched.+ ============================================================ */+ Archify.radar = (function () {+ var container = document.querySelector('.diagram-container');+ var diagram = container.querySelector(':scope > svg');+ var panel = document.getElementById('overview-map');+ var surface = document.getElementById('overview-map-surface');+ var status = document.getElementById('overview-map-status');+ var trigger = document.getElementById('btn-overview-map');+ var closeBtn = document.getElementById('overview-map-close');+ var namespace = 'http://www.w3.org/2000/svg';+ var viewBox = diagram.viewBox && diagram.viewBox.baseVal;+ var mapSvg = document.createElementNS(namespace, 'svg');+ var nodeLayer = document.createElementNS(namespace, 'g');+ var viewport = document.createElementNS(namespace, 'rect');+ var nodes = [];+ var drag = null;+ var syncFrame = 0;++ mapSvg.setAttribute('role', 'group');+ mapSvg.setAttribute('aria-label', 'Semantic diagram radar nodes');+ mapSvg.setAttribute('preserveAspectRatio', 'xMidYMid meet');+ nodeLayer.setAttribute('class', 'overview-map-nodes');+ viewport.setAttribute('class', 'overview-map-viewport');+ viewport.setAttribute('rx', '3');+ viewport.setAttribute('ry', '3');+ mapSvg.appendChild(nodeLayer);+ mapSvg.appendChild(viewport);+ surface.appendChild(mapSvg);++ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];+ }+ function build() {+ if (!viewBox || viewBox.width <= 0 || viewBox.height <= 0) return false;+ mapSvg.setAttribute('viewBox', [viewBox.x, viewBox.y, viewBox.width, viewBox.height].join(' '));+ nodeLayer.textContent = '';+ nodes = [];+ Array.prototype.forEach.call(diagram.querySelectorAll('[data-node-id]'), function (node) {+ var box;+ try { box = node.getBBox(); } catch (_) { box = null; }+ if (!box || box.width <= 0 || box.height <= 0) return;+ var id = node.getAttribute('data-node-id');+ var rect = document.createElementNS(namespace, 'rect');+ rect.setAttribute('class', 'overview-map-node');+ rect.setAttribute('x', String(box.x));+ rect.setAttribute('y', String(box.y));+ rect.setAttribute('width', String(Math.max(3, box.width)));+ rect.setAttribute('height', String(Math.max(3, box.height)));+ rect.setAttribute('rx', String(Math.max(2, Math.min(8, Math.min(box.width, box.height) * 0.1))));+ rect.setAttribute('data-radar-node-id', id);+ rect.setAttribute('data-kind', node.getAttribute('data-node-kind') || 'neutral');+ rect.setAttribute('tabindex', '0');+ rect.setAttribute('role', 'button');+ rect.setAttribute('aria-label', 'Focus ' + nodeLabel(node, id) + ' from Semantic Radar');+ nodeLayer.appendChild(rect);+ nodes.push({ id: id, node: node, rect: rect });+ });+ status.textContent = nodes.length + ' nodes · full map';+ return true;+ }+ function updateDocking() {+ if (panel.hidden) return;+ var containerRect = container.getBoundingClientRect();+ var intersectsWindow = containerRect.bottom > 12 && containerRect.top < window.innerHeight - 12;+ if (!intersectsWindow) {+ panel.removeAttribute('data-docked');+ panel.removeAttribute('data-dock-side');+ panel.style.removeProperty('--archify-radar-right');+ panel.style.removeProperty('--archify-radar-left');+ panel.style.removeProperty('--archify-radar-top');+ return;+ }+ var active = diagram.querySelector('[data-focus-selected]');+ var activeRect = active ? active.getBoundingClientRect() : null;+ var dockLeft = !!(activeRect && activeRect.left + activeRect.width / 2 > window.innerWidth / 2);+ var right = Math.max(16, window.innerWidth - Math.min(containerRect.right - 16, window.innerWidth - 16));+ var left = Math.max(16, Math.min(containerRect.left + 16, window.innerWidth - panel.offsetWidth - 16));+ var topLimit = Math.max(16, containerRect.top + 16);+ var bottomLimit = Math.min(window.innerHeight - 16, containerRect.bottom - 16);+ var panelLeft = dockLeft ? left : window.innerWidth - right - panel.offsetWidth;+ var panelRight = panelLeft + panel.offsetWidth;+ var lens = document.getElementById('focus-chip');+ var lensRect = lens && !lens.hidden ? lens.getBoundingClientRect() : null;+ var blockers = [activeRect, lensRect].filter(function (rect) {+ return rect && rect.right > panelLeft && rect.left < panelRight;+ });+ var desiredTop = bottomLimit - panel.offsetHeight;+ var candidates = [desiredTop, topLimit];+ blockers.forEach(function (rect) {+ candidates.push(rect.top - 10 - panel.offsetHeight, rect.bottom + 10);+ });+ var valid = candidates.filter(function (candidate) {+ if (candidate < topLimit || candidate + panel.offsetHeight > bottomLimit) return false;+ return blockers.every(function (rect) {+ return candidate + panel.offsetHeight <= rect.top - 10 || candidate >= rect.bottom + 10;+ });+ });+ valid.sort(function (a, b) { return Math.abs(a - desiredTop) - Math.abs(b - desiredTop); });+ var top = valid.length ? valid[0] : Math.max(topLimit, desiredTop);+ top = Math.min(window.innerHeight - panel.offsetHeight - 16, top);+ panel.setAttribute('data-docked', 'true');+ panel.setAttribute('data-dock-side', dockLeft ? 'left' : 'right');+ panel.style.setProperty('--archify-radar-right', Math.round(right) + 'px');+ panel.style.setProperty('--archify-radar-left', Math.round(left) + 'px');+ panel.style.setProperty('--archify-radar-top', Math.round(Math.max(16, top)) + 'px');+ }+ function syncNow() {+ syncFrame = 0;+ if (panel.hidden || !Archify.view || typeof Archify.view.logicalViewport !== 'function') return;+ updateDocking();+ var visible = Archify.view.logicalViewport();+ if (!visible) return;+ viewport.setAttribute('x', String(visible.x));+ viewport.setAttribute('y', String(visible.y));+ viewport.setAttribute('width', String(visible.width));+ viewport.setAttribute('height', String(visible.height));+ var full = visible.width >= viewBox.width * 0.98 && visible.height >= viewBox.height * 0.98;+ var mobileWide = window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram');+ var viewportCopy = full+ ? 'full map'+ : (mobileWide ? Math.round(visible.width / viewBox.width * 100) + '% width' : Math.round(visible.scale * 100) + '% viewport');+ status.textContent = nodes.length + ' nodes · ' + viewportCopy;+ nodes.forEach(function (item) {+ var active = item.node.hasAttribute('data-focus-selected') ||+ item.node.getAttribute('data-story-beat-state') === 'active';+ if (active) item.rect.setAttribute('data-radar-active', 'true');+ else item.rect.removeAttribute('data-radar-active');+ });+ }+ function sync() {+ if (syncFrame) return;+ syncFrame = requestAnimationFrame(syncNow);+ }+ function setOpen(next, options) {+ options = options || {};+ next = Boolean(next);+ if (next && Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (next && Archify.semanticLens && Archify.semanticLens.isOpen()) {+ Archify.semanticLens.close({ restoreFocus: false });+ }+ panel.hidden = !next;+ trigger.setAttribute('aria-expanded', next ? 'true' : 'false');+ trigger.setAttribute('aria-label', next ? 'Close semantic radar' : 'Open semantic radar');+ if (next) {+ build();+ updateDocking();+ sync();+ if (options.focus === true) surface.focus();+ } else {+ panel.removeAttribute('data-docked');+ panel.removeAttribute('data-dock-side');+ panel.style.removeProperty('--archify-radar-right');+ panel.style.removeProperty('--archify-radar-left');+ panel.style.removeProperty('--archify-radar-top');+ if (options.restoreFocus === true) trigger.focus();+ }+ return next;+ }+ function toggle() { return setOpen(panel.hidden, { focus: false }); }+ function close(options) { return setOpen(false, options); }+ function bringNodeIntoWindow(node) {+ var delay = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : 540;+ window.setTimeout(function () {+ var rect = node.getBoundingClientRect();+ var safeTop = 64;+ var safeBottom = window.innerHeight - 64;+ if (rect.top >= safeTop && rect.bottom <= safeBottom) return;+ var top = Math.max(0, window.scrollY + rect.top + rect.height / 2 - window.innerHeight / 2);+ try { window.scrollTo({ top: top, behavior: delay ? 'smooth' : 'auto' }); }+ catch (_) { window.scrollTo(0, top); }+ }, delay);+ }+ function focusNode(id) {+ var main = diagram.querySelector('[data-node-id="' + id + '"]');+ if (!main) return false;+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.focus && typeof Archify.focus.set === 'function') {+ Archify.focus.set(id, { toggle: false });+ }+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'radar' });+ }+ bringNodeIntoWindow(main);+ try { main.focus({ preventScroll: true }); } catch (_) { try { main.focus(); } catch (_) {} }+ sync();+ return true;+ }+ function diagramPoint(event) {+ var matrix = mapSvg.getScreenCTM();+ if (!matrix) return null;+ var point = mapSvg.createSVGPoint();+ point.x = event.clientX;+ point.y = event.clientY;+ return point.matrixTransform(matrix.inverse());+ }+ function navigate(event) {+ var point = diagramPoint(event);+ if (!point || !Archify.view || typeof Archify.view.centerAt !== 'function') return;+ Archify.view.centerAt(point.x, point.y, { minimumScale: 1.5, instant: true });+ sync();+ }+ function endDrag(event) {+ if (!drag) return;+ drag = null;+ panel.removeAttribute('data-dragging');+ container.classList.remove('is-panning');+ try { surface.releasePointerCapture(event.pointerId); } catch (_) {}+ }- <!-- Footer -->- <p class="footer">- Architecture diagram • Built with Archify<span class="no-print"> • Press <kbd>T</kbd> for theme and <kbd>E</kbd> for export</span>- </p>- </div>+ trigger.addEventListener('click', toggle);+ closeBtn.addEventListener('click', function () { close({ restoreFocus: true }); });+ surface.addEventListener('pointerdown', function (event) {+ if (event.button !== 0 || event.target.closest('[data-radar-node-id]')) return;+ event.preventDefault();+ drag = { pointerId: event.pointerId };+ panel.setAttribute('data-dragging', 'true');+ container.classList.add('is-panning');+ try { surface.setPointerCapture(event.pointerId); } catch (_) {}+ navigate(event);+ });+ surface.addEventListener('pointermove', function (event) {+ if (!drag || drag.pointerId !== event.pointerId) return;+ navigate(event);+ });+ surface.addEventListener('pointerup', endDrag);+ surface.addEventListener('pointercancel', endDrag);+ surface.addEventListener('click', function (event) {+ var node = event.target.closest('[data-radar-node-id]');+ if (node) focusNode(node.getAttribute('data-radar-node-id'));+ });+ surface.addEventListener('keydown', function (event) {+ if (event.key === 'Escape') {+ event.preventDefault();+ event.stopPropagation();+ close({ restoreFocus: true });+ return;+ }+ var node = event.target.closest('[data-radar-node-id]');+ if (node && (event.key === 'Enter' || event.key === ' ')) {+ event.preventDefault();+ focusNode(node.getAttribute('data-radar-node-id'));+ return;+ }+ if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight' && event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return;+ var visible = Archify.view && Archify.view.logicalViewport ? Archify.view.logicalViewport() : null;+ if (!visible) return;+ event.preventDefault();+ var x = visible.x + visible.width / 2;+ var y = visible.y + visible.height / 2;+ var stepX = Math.max(12, visible.width * 0.24);+ var stepY = Math.max(12, visible.height * 0.24);+ if (event.key === 'ArrowLeft') x -= stepX;+ else if (event.key === 'ArrowRight') x += stepX;+ else if (event.key === 'ArrowUp') y -= stepY;+ else y += stepY;+ Archify.view.centerAt(x, y, { minimumScale: 1.5, instant: true });+ sync();+ });+ window.addEventListener('resize', sync);+ window.addEventListener('scroll', function () { updateDocking(); sync(); }, { passive: true });+ requestAnimationFrame(build);++ return {+ open: function () { return setOpen(true); },+ close: close,+ toggle: toggle,+ sync: sync,+ focus: focusNode,+ isOpen: function () { return !panel.hidden; },+ count: function () { return nodes.length; }+ };+ })();- <script>/* ============================================================- Theme toggle — persists to localStorage, respects system pref+ Presentation Stage — a shareable, viewport-filling live view.+ It changes only HTML layout and URL state; SVG semantics and export+ serialization remain untouched. Escape first clears an active guided+ view/focus, then exits the stage.============================================================ */- var Archify = {};-- Archify.theme = (function () {- var STORAGE_KEY = 'archify-theme';+ Archify.presentation = (function () {var html = document.documentElement;- var btn = document.getElementById('btn-theme');- var icon = document.getElementById('theme-icon');- var label = document.getElementById('theme-label');+ var btn = document.getElementById('btn-present');+ var icon = document.getElementById('present-icon');+ var label = document.getElementById('present-label');+ var previousScrollY = 0;- // localStorage can throw (blocked cookies, sandboxed iframes); the whole- // script element dies on an uncaught error, so guard every access.- function readStored() {- try { return localStorage.getItem(STORAGE_KEY); } catch (_) { return null; }- }- function writeStored(value) {- try { localStorage.setItem(STORAGE_KEY, value); } catch (_) {}- }- function urlOverride() {- // URL param wins (useful for deterministic screenshots / share links)+ function active() { return html.getAttribute('data-present') === 'true'; }++ function updateUrl(next) {try {- var param = new URLSearchParams(window.location.search).get('theme');- if (param === 'light' || param === 'dark') return param;+ var url = new URL(window.location.href);+ if (next) url.searchParams.set('present', '1');+ else url.searchParams.delete('present');+ history.replaceState(null, '', url.pathname + url.search + url.hash);} catch (_) {}- return null;}- function resolveInitial() {- var fromUrl = urlOverride();- if (fromUrl) return fromUrl;- var saved = readStored();- if (saved === 'light' || saved === 'dark') return saved;- return window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';+ function render(next) {+ btn.setAttribute('aria-pressed', next ? 'true' : 'false');+ btn.setAttribute('aria-label', next ? 'Exit presentation stage' : 'Enter presentation stage');+ btn.title = next ? 'Exit presentation stage (F or Escape)' : 'Presentation stage (F)';+ icon.textContent = next ? '\u00d7' : '\u25a1';+ label.textContent = next ? 'Exit' : 'Present';}- function apply(theme) {- html.setAttribute('data-theme', theme);- icon.textContent = theme === 'dark' ? '\u263E' : '\u263C';- label.textContent = theme === 'dark' ? 'Dark' : 'Light';- btn.setAttribute('aria-pressed', theme === 'light' ? 'true' : 'false');+ function setActive(next, options) {+ options = options || {};+ next = Boolean(next);+ if (next === active()) {+ render(next);+ return next;+ }+ if (next) {+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ previousScrollY = window.scrollY || 0;+ html.setAttribute('data-present', 'true');+ try { window.scrollTo(0, 0); } catch (_) {}+ } else {+ html.removeAttribute('data-present');+ }+ render(next);+ if (options.updateUrl !== false) updateUrl(next);+ requestAnimationFrame(function () {+ if (Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ requestAnimationFrame(function () {+ if (Archify.view && typeof Archify.view.sync === 'function') Archify.view.sync();+ });+ }+ if (!next && previousScrollY) {+ try { window.scrollTo(0, previousScrollY); } catch (_) {}+ }+ });+ return next;}- function toggle() {- var next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';- apply(next);- writeStored(next);- }+ function toggle() { return setActive(!active()); }- apply(resolveInitial());+ render(active());btn.addEventListener('click', toggle);- // Follow live OS theme changes while the user has no explicit preference.- try {- var media = window.matchMedia('(prefers-color-scheme: light)');- var onChange = function (e) {- var saved = readStored();- if (urlOverride() || saved === 'light' || saved === 'dark') return;- apply(e.matches ? 'light' : 'dark');- };- if (media.addEventListener) media.addEventListener('change', onChange);- else if (media.addListener) media.addListener(onChange);- } catch (_) {}-- return { toggle: toggle };+ return {+ enter: function () { return setActive(true); },+ exit: function () { return setActive(false); },+ toggle: toggle,+ active: active+ };})();/* ============================================================- Export — PNG / JPEG / WebP / SVG (download) and Copy PNG (clipboard)-- Raster exports are always rendered at 4x source resolution for- maximum sharpness. The trick: we set the serialized SVG's- `width`/`height` to viewBox * 4 so the browser rasterizes the- vectors at that resolution natively. drawImage then draws at- the image's natural size (no upscaling = no blur).-- JPEG/WebP paint the current theme's background explicitly since- those formats have no alpha channel.+ Node Finder — stable-ID search over the existing semantic SVG.+ Search never changes the IR or SVG geometry: selecting a result resets+ the viewport, releases a guided view, and delegates to semantic focus.============================================================ */- (function () {- var RASTER_SCALE = 4;-- function diagramFilename() {- var title = (document.title || 'diagram')- .replace(/\s+Architecture(\s+Diagram)?$/i, '')- .replace(/\s+Diagram$/i, '')- .trim();- return title.replace(/[^a-z0-9_\-]+/gi, '-')- .toLowerCase()- .replace(/^-+|-+$/g, '') || 'diagram';- }+ Archify.finder = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector('svg');+ var trigger = document.getElementById('btn-node-finder');+ var panel = document.getElementById('node-finder');+ var heading = document.getElementById('node-finder-title');+ var closeBtn = document.getElementById('node-finder-close');+ var input = document.getElementById('node-finder-input');+ var results = document.getElementById('node-finder-results');+ var empty = document.getElementById('node-finder-empty');+ var status = document.getElementById('node-finder-status');+ var visibleItems = [];- function currentBg() {- return getComputedStyle(document.body).backgroundColor || '#ffffff';+ function defaultContext() {+ return {+ kind: 'focus',+ title: 'Find a node',+ placeholder: 'Search labels or IDs',+ empty: 'No matching nodes',+ resultsLabel: 'Diagram nodes',+ availableNoun: 'nodes',+ allowedIds: null,+ badges: null+ };}- /**- * Serialize the main SVG into a standalone document.- *- * Two modes:- * - Default (opts.autoTheme=false) — locks the serialized SVG to the- * viewer's current theme. Used by the raster pipeline- * (PNG/JPEG/WebP/clipboard) because canvas rasterization needs- * deterministic colors; a raster cannot react to- * prefers-color-scheme after encoding.- * - autoTheme=true — emits BOTH dark and light variable sets plus a- * `@media (prefers-color-scheme)` rule so the resulting SVG- * self-themes when embedded in GitHub READMEs or other hosts that- * expose a color scheme. Used for "Download SVG".- */- function serializeSvg(scale, opts) {- // scale: integer multiplier for intrinsic SVG pixel dimensions used by- // the raster path. Defaults to 1 (natural size) for SVG download.- scale = scale || 1;- opts = opts || {};- var autoTheme = opts.autoTheme === true;-- var svg = document.querySelector('.diagram-container svg');- var clone = svg.cloneNode(true);-- var vb = svg.viewBox.baseVal;- // Scale width/height so the browser rasterizes the vectors at target- // resolution directly. viewBox stays unchanged so coordinates don't- // shift. This is the key to sharp rasters — do NOT scale later via- // canvas upscaling.- clone.setAttribute('width', vb.width * scale);- clone.setAttribute('height', vb.height * scale);- clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');-- // Only the SVG-relevant rules: semantic classes, markers, and the- // theme variable blocks. Toolbar/cards/print CSS can never apply- // inside a standalone SVG and would only bloat the export.- var hostStyle = (function () {- var out = [];- Array.prototype.forEach.call(document.styleSheets, function (sheet) {- var rules;- try { rules = sheet.cssRules; } catch (_) { return; } // cross-origin- if (!rules) return;- Array.prototype.forEach.call(rules, function (rule) {- if (rule.type !== 1) return; // plain style rules only- var sel = rule.selectorText || '';- if (/(^|,)\s*(svg|:root|\[data-theme|\.c-|\.t-|\.a-|\.m-)/.test(sel)) {- out.push(rule.cssText);- }- });- });- return out.join('\n');- })();+ var context = defaultContext();- // Derive the variable list from the stylesheet so newly added theme- // variables can never be missed by the export pipeline again- // (--lane-fill/--lane-stroke once were).- var varNames = (function () {- var seen = {};- var names = [];- (hostStyle.match(/--[a-zA-Z0-9-]+(?=\s*:)/g) || []).forEach(function (n) {- if (!seen[n]) { seen[n] = true; names.push(n); }- });- return names;- })();+ function semanticType(node) {+ var authored = node.getAttribute('data-node-kind');+ if (authored) return authored;+ var types = ['frontend', 'backend', 'database', 'cloud', 'security', 'messagebus', 'external'];+ return types.find(function (type) { return node.querySelector('.c-' + type); }) || 'node';+ }- // Resolve the full variable set for a given data-theme via an- // off-DOM probe, independent of what the viewer is currently set to.- function resolveVars(themeAttr) {- var probe = document.createElement('div');- probe.setAttribute('data-theme', themeAttr);- probe.style.cssText = 'position:absolute;width:0;height:0;visibility:hidden;';- document.body.appendChild(probe);- try {- var c = getComputedStyle(probe);- return varNames.map(function (n) {- return n + ': ' + c.getPropertyValue(n).trim() + ';';- }).join(' ');- } finally {- document.body.removeChild(probe);+ function connectionsFor(id) {+ var count = 0;+ var seen = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var key = from + '\u0000' + to;+ if ((from === id || to === id) && !seen[key]) {+ seen[key] = true;+ count += 1;}- }-- // Prepend a local()-only @font-face block for each weight so that the- // sandboxed image-rendering context used during PNG/JPEG/WebP export- // can find JetBrains Mono if the user has it installed locally, and- // falls through cleanly to the monospace stack otherwise. The usual- // Google-Fonts <link> in the host document is unreachable from the- // serialized SVG, so url()-sourced faces would just hang.- var fontFallback = [400, 500, 600, 700].map(function (w) {- return "@font-face { font-family: 'JetBrains Mono'; font-weight: " + w +- "; src: local('JetBrains Mono'), local('JetBrainsMono-Regular'); }";- }).join('\n');-- var style = document.createElementNS('http://www.w3.org/2000/svg', 'style');- var bgRect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');- bgRect.setAttribute('width', '100%');- bgRect.setAttribute('height', '100%');-- if (autoTheme) {- // Dual-theme SVG. Dark is the default (so hosts without- // prefers-color-scheme still render), light swaps in via media- // query, and svg[data-theme="..."] still lets downstream- // consumers force a specific theme.- var darkVars = resolveVars('dark');- var lightVars = resolveVars('light');-- style.textContent =- fontFallback + "\n" +- "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" +- hostStyle + "\n" +- ":root, svg { " + darkVars + " }\n" +- "@media (prefers-color-scheme: light) { :root, svg { " + lightVars + " } }\n" +- "svg[data-theme=\"light\"] { " + lightVars + " }\n" +- "svg[data-theme=\"dark\"] { " + darkVars + " }\n" +- "rect.c-bg-rect { fill: var(--bg); }\n";+ });+ return count;+ }- // Don't lock the serialized SVG to the viewer's current theme.- clone.removeAttribute('data-theme');- // Background follows the CSS variable, not a fixed color, so it- // swaps with the media query.- bgRect.setAttribute('class', 'c-bg-rect');- } else {- // Raster path: lock to the viewer's current theme.- var theme = document.documentElement.getAttribute('data-theme') || 'dark';- var themeHost = document.querySelector('[data-theme="' + theme + '"]') || document.documentElement;- var computed = getComputedStyle(themeHost);- var vars = varNames.map(function (n) {- return n + ': ' + computed.getPropertyValue(n).trim() + ';';- }).join(' ');+ var items = Array.prototype.map.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ var id = node.getAttribute('data-node-id');+ var label = node.getAttribute('data-node-label') || (node.getAttribute('aria-label') || id).replace(/^Focus\s+/, '');+ var text = (node.textContent || '').replace(/\s+/g, ' ').trim();+ var sublabel = node.getAttribute('data-node-sublabel') || '';+ var context = node.getAttribute('data-node-context') || '';+ var tag = node.getAttribute('data-node-tag') || '';+ var type = semanticType(node);+ return {+ id: id,+ label: label,+ type: type,+ sublabel: sublabel,+ context: context,+ tag: tag,+ links: connectionsFor(id),+ search: (id + ' ' + label + ' ' + type + ' ' + sublabel + ' ' + context + ' ' + tag + ' ' + text).toLowerCase(),+ node: node+ };+ });- // IMPORTANT: inject the resolved variables AFTER hostStyle,- // otherwise hostStyle's ":root, [data-theme=\"dark\"] { ... }" rule- // overrides our chosen theme via later-in-cascade equal-specificity.- // Keep this order.- style.textContent =- fontFallback + "\n" +- "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" +- hostStyle + "\n" +- ":root, svg { " + vars + " }\n";+ function resultButtons() {+ return Array.prototype.slice.call(results.querySelectorAll('.node-finder-result'));+ }- bgRect.setAttribute('fill', computed.getPropertyValue('--bg').trim() || '#ffffff');+ function resolveContext(options) {+ var requested = options && options.context ? options.context : null;+ if (!requested && Archify.routeProbe && typeof Archify.routeProbe.finderContext === 'function') {+ requested = Archify.routeProbe.finderContext();}+ if (!requested) return defaultContext();+ var resolved = defaultContext();+ Object.keys(requested).forEach(function (key) { resolved[key] = requested[key]; });+ return resolved;+ }- clone.insertBefore(style, clone.firstChild);- clone.insertBefore(bgRect, style.nextSibling);+ function availableItems() {+ if (!context.allowedIds) return items.slice();+ return items.filter(function (item) { return context.allowedIds.indexOf(item.id) !== -1; });+ }- return {- svgString: new XMLSerializer().serializeToString(clone),- width: vb.width * scale,- height: vb.height * scale- };+ function applyContext() {+ panel.setAttribute('data-context', context.kind);+ heading.textContent = context.title;+ input.placeholder = context.placeholder;+ empty.textContent = context.empty;+ results.setAttribute('aria-label', context.resultsLabel);}- function download(blob, filename) {- var url = URL.createObjectURL(blob);- var a = document.createElement('a');- a.href = url;- a.download = filename;- document.body.appendChild(a);- a.click();- a.remove();- setTimeout(function () { URL.revokeObjectURL(url); }, 1000);+ function select(id) {+ var item = items.find(function (candidate) { return candidate.id === id; });+ if (!item) return false;+ var routeSelection = context.kind === 'route-source' || context.kind === 'route-target';+ if (routeSelection) {+ if (!Archify.routeProbe || typeof Archify.routeProbe.choose !== 'function' || !Archify.routeProbe.choose(id)) return false;+ if (Archify.routeProbe.active() === 'target' && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'route-pick' });+ }+ close({ restoreFocus: false });+ try { item.node.focus({ preventScroll: true }); } catch (_) { try { item.node.focus(); } catch (_) {} }+ return true;+ }+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.view && typeof Archify.view.reset === 'function') Archify.view.reset({ automatic: true });+ Archify.focus.set(id, { toggle: false });+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'finder' });+ }+ close({ restoreFocus: false });+ try { item.node.focus({ preventScroll: true }); } catch (_) { try { item.node.focus(); } catch (_) {} }+ return true;}- // Conservative upper bound on total canvas pixels. Older Safari on iOS- // silently produces a blank canvas above ~16 Mpx; Chrome / Firefox /- // desktop Safari are far higher but start failing on memory-constrained- // devices. We pick the largest integer scale in {4,3,2,1} whose target- // pixel count fits under this cap.- var MAX_CANVAS_PIXELS = 16 * 1024 * 1024;+ function render(query) {+ query = (query || '').trim().toLowerCase();+ var available = availableItems();+ visibleItems = available.filter(function (item) { return !query || item.search.indexOf(query) !== -1; });+ results.textContent = '';+ visibleItems.forEach(function (item) {+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'node-finder-result';+ button.setAttribute('data-node-id', item.id);+ var badge = context.badges && context.badges[item.id] ? context.badges[item.id] : String(item.links);+ var action = context.kind === 'route-source'+ ? 'Choose ' + item.label + ' as route start'+ : context.kind === 'route-target'+ ? 'Choose ' + item.label + ' as route destination, ' + badge+ : 'Focus ' + item.label + ', ' + item.links + ' related connection' + (item.links === 1 ? '' : 's');+ button.setAttribute('aria-label', action);- function pickSafeScale(vbW, vbH) {- for (var s = RASTER_SCALE; s >= 1; s--) {- if (vbW * s * vbH * s <= MAX_CANVAS_PIXELS) return s;+ var name = document.createElement('strong');+ name.textContent = item.label;+ var links = document.createElement('em');+ links.textContent = badge;+ links.title = context.kind === 'focus'+ ? item.links + ' related connection' + (item.links === 1 ? '' : 's')+ : action;+ var meta = document.createElement('small');+ meta.textContent = [item.type, item.context, item.sublabel, item.tag, item.id].filter(Boolean).join(' \u00b7 ');+ button.appendChild(name);+ button.appendChild(links);+ button.appendChild(meta);+ button.addEventListener('click', function () { select(item.id); });+ results.appendChild(button);+ });+ empty.hidden = visibleItems.length !== 0;+ status.textContent = visibleItems.length + ' of ' + available.length + ' ' + context.availableNoun + (query ? ' match' : ' available');+ }++ function open(options) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);+ if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });+ context = resolveContext(options || {});+ applyContext();+ panel.hidden = false;+ trigger.setAttribute('aria-expanded', 'true');+ if (context.kind.indexOf('route-') === 0 && Archify.routeProbe && typeof Archify.routeProbe.finderOpening === 'function') {+ Archify.routeProbe.finderOpening();}- return 1;+ input.value = '';+ render('');+ requestAnimationFrame(function () { input.focus(); });+ return true;}- function rasterize(format) {- // Serialize at a safe scale (RASTER_SCALE=4 by default, reduced if the- // resulting canvas would exceed MAX_CANVAS_PIXELS). The SVG itself is- // rasterized at target resolution natively; drawImage draws at natural- // size — no upsampling blur.- var svg = document.querySelector('.diagram-container svg');- var vb = svg.viewBox.baseVal;- var scale = pickSafeScale(vb.width, vb.height);- var data = serializeSvg(scale);- var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });- var svgUrl = URL.createObjectURL(svgBlob);+ function close(options) {+ options = options || {};+ var routeContext = context.kind.indexOf('route-') === 0;+ panel.hidden = true;+ trigger.setAttribute('aria-expanded', 'false');+ input.value = '';+ if (routeContext && Archify.routeProbe && typeof Archify.routeProbe.finderClosed === 'function') {+ Archify.routeProbe.finderClosed({ restoreFocus: options.restoreFocus !== false });+ } else if (options.restoreFocus !== false) {+ trigger.focus();+ }+ }- return new Promise(function (resolve, reject) {- var img = new Image();- img.onload = function () {- var canvas = document.createElement('canvas');- canvas.width = data.width;- canvas.height = data.height;- var ctx = canvas.getContext('2d');- if (format === 'jpeg') {- ctx.fillStyle = currentBg();- ctx.fillRect(0, 0, canvas.width, canvas.height);- }- // Draw at natural size — SVG was already rasterized at target res.- ctx.drawImage(img, 0, 0);- URL.revokeObjectURL(svgUrl);- var mime = format === 'jpeg' ? 'image/jpeg' :- format === 'webp' ? 'image/webp' : 'image/png';- var quality = format === 'png' ? undefined : 0.95;- canvas.toBlob(function (blob) {- if (!blob) reject(new Error('toBlob returned null for ' + format));- else resolve(blob);- }, mime, quality);+ function toggle() { return panel.hidden ? open() : (close(), false); }++ trigger.addEventListener('click', toggle);+ closeBtn.addEventListener('click', function () { close(); });+ input.addEventListener('input', function () { render(input.value); });+ input.addEventListener('keydown', function (event) {+ var buttons = resultButtons();+ if (event.key === 'ArrowDown' && buttons.length) {+ event.preventDefault();+ buttons[0].focus();+ } else if (event.key === 'Enter' && visibleItems.length) {+ event.preventDefault();+ select(visibleItems[0].id);+ }+ });+ results.addEventListener('keydown', function (event) {+ var buttons = resultButtons();+ var index = buttons.indexOf(document.activeElement);+ if (index < 0 || !buttons.length) return;+ var next = null;+ if (event.key === 'ArrowDown') next = (index + 1) % buttons.length;+ else if (event.key === 'ArrowUp') next = (index - 1 + buttons.length) % buttons.length;+ else if (event.key === 'Home') next = 0;+ else if (event.key === 'End') next = buttons.length - 1;+ if (next !== null) {+ event.preventDefault();+ buttons[next].focus();+ }+ });+ panel.addEventListener('keydown', function (event) {+ if (event.key !== 'Escape') return;+ event.preventDefault();+ event.stopPropagation();+ close();+ });+ document.addEventListener('click', function (event) {+ if (!panel.hidden && !panel.contains(event.target) && !event.target.closest('[data-node-finder-trigger]')) close({ restoreFocus: false });+ });++ render('');+ return {+ open: open,+ close: close,+ toggle: toggle,+ select: select,+ isOpen: function () { return !panel.hidden; },+ context: function () { return context.kind; },+ count: items.length+ };+ })();++ /* ============================================================+ Route Probe — shortest directed path over compiled semantics.+ The graph is read from renderer-owned stable IDs and relationship+ endpoints. BFS order follows authored DOM edge order, so equal-length+ choices are deterministic without adding weights or a graph runtime.+ ============================================================ */+ Archify.routeProbe = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var trigger = document.getElementById('btn-route-probe');+ var panel = document.getElementById('route-probe');+ var title = document.getElementById('route-probe-title');+ var path = document.getElementById('route-probe-path');+ var status = document.getElementById('route-probe-status');+ var findBtn = document.getElementById('route-probe-find');+ var copyBtn = document.getElementById('route-probe-copy');+ var clearBtn = document.getElementById('route-probe-clear');+ var journeyControls = document.getElementById('route-journey-controls');+ var journeyPrevBtn = document.getElementById('route-journey-prev');+ var journeyPlayBtn = document.getElementById('route-journey-play');+ var journeyPlayIcon = document.getElementById('route-journey-play-icon');+ var journeyPlayLabel = document.getElementById('route-journey-play-label');+ var journeyNextBtn = document.getElementById('route-journey-next');+ var journeyOverviewBtn = document.getElementById('route-journey-overview');+ var namespace = 'http://www.w3.org/2000/svg';+ var mode = 'idle';+ var startId = null;+ var endId = null;+ var activeNodeIds = [];+ var activeEdges = [];+ var journeyIndex = -1;+ var journeyPlaying = false;+ var journeyComplete = false;+ var journeyGeneration = 0;+ var journeyTimer = null;+ var journeyStartedAt = 0;+ var journeyElapsedMs = 0;+ var journeyOwnerToken = 0;+ var JOURNEY_DWELL_MS = 1100;++ function nodes() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ }+ function edges() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ }+ function nodesById() {+ var out = {};+ nodes().forEach(function (node) { out[node.getAttribute('data-node-id')] = node; });+ return out;+ }+ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];+ }+ function edgeShapes(edge) {+ if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function removeOverlay() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-route-probe-overlay]'), function (overlay) {+ overlay.remove();+ });+ }+ function removeJourneyPulse(options) {+ options = options || {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-route-journey-overlay]'), function (overlay) {+ overlay.remove();+ });+ if (journeyOwnerToken && options.release !== false && Archify.motionGovernor) {+ var token = journeyOwnerToken;+ journeyOwnerToken = 0;+ Archify.motionGovernor.release(token);+ }+ }+ function stopJourneyTimer(options) {+ options = options || {};+ journeyGeneration += 1;+ if (journeyTimer) {+ if (options.preserveElapsed === true && journeyStartedAt) {+ journeyElapsedMs = Math.min(JOURNEY_DWELL_MS, journeyElapsedMs + Math.max(0, Date.now() - journeyStartedAt));+ }+ window.clearTimeout(journeyTimer);+ }+ journeyTimer = null;+ journeyStartedAt = 0;+ if (options.preserveElapsed !== true) journeyElapsedMs = 0;+ }+ function clearJourneyPresentation(options) {+ options = options || {};+ removeJourneyPulse();+ svg.removeAttribute('data-route-journey');+ panel.removeAttribute('data-route-journey');+ nodes().forEach(function (node) {+ node.removeAttribute('data-route-journey-state');+ node.removeAttribute('data-route-journey-current');+ });+ edges().forEach(function (edge) {+ edge.removeAttribute('data-route-journey-state');+ edge.removeAttribute('data-route-journey-current');+ });+ Array.prototype.forEach.call(path.querySelectorAll('[data-route-journey-index]'), function (button, index) {+ button.removeAttribute('data-route-journey-state');+ button.removeAttribute('aria-current');+ button.setAttribute('tabindex', index === 0 ? '0' : '-1');+ });+ if (options.keepControls !== true) journeyControls.hidden = true;+ journeyControls.setAttribute('data-playing', 'false');+ }+ function resetJourneyState() {+ stopJourneyTimer();+ journeyPlaying = false;+ journeyComplete = false;+ journeyIndex = -1;+ clearJourneyPresentation();+ }+ function cleanSvgState() {+ resetJourneyState();+ svg.removeAttribute('data-route-picking');+ svg.removeAttribute('data-route-active');+ removeOverlay();+ nodes().forEach(function (node) {+ node.removeAttribute('data-route-match');+ node.removeAttribute('data-route-start');+ node.removeAttribute('data-route-end');+ node.removeAttribute('data-route-step');+ node.removeAttribute('data-route-candidate');+ node.style.removeProperty('--route-step');+ });+ edges().forEach(function (edge) {+ edge.removeAttribute('data-route-match');+ edge.removeAttribute('data-route-step');+ edge.style.removeProperty('--route-step');+ });+ panel.removeAttribute('data-route-dock');+ }+ function replaceRouteHash(value) {+ try {+ history.replaceState(null, '', location.pathname + location.search + (value ? '#route=' + value : ''));+ } catch (_) {}+ }+ function renderPlaceholder(copy) {+ path.textContent = '';+ var placeholder = document.createElement('span');+ placeholder.className = 'route-probe-placeholder';+ placeholder.textContent = copy;+ path.appendChild(placeholder);+ }+ function renderPath(ids, options) {+ options = options || {};+ var byId = nodesById();+ path.textContent = '';+ ids.forEach(function (id, index) {+ if (index) {+ var arrow = document.createElement('span');+ arrow.className = 'route-probe-arrow';+ arrow.setAttribute('aria-hidden', 'true');+ arrow.textContent = '\u2192';+ path.appendChild(arrow);+ }+ var item = document.createElement(options.interactive === true ? 'button' : 'span');+ if (options.interactive === true) {+ item.type = 'button';+ item.setAttribute('data-route-journey-index', String(index));+ item.setAttribute('data-route-node-id', id);+ item.setAttribute('tabindex', index === 0 ? '0' : '-1');+ item.setAttribute('aria-label', 'Route position ' + (index + 1) + ' of ' + ids.length + ': ' + nodeLabel(byId[id], id));+ }+ item.className = 'route-probe-node';+ item.textContent = nodeLabel(byId[id], id);+ item.title = nodeLabel(byId[id], id) + ' · ' + id;+ if (index === 0) item.setAttribute('data-endpoint', 'start');+ if (index === ids.length - 1 && ids.length > 1) item.setAttribute('data-endpoint', 'end');+ path.appendChild(item);+ });+ }+ function setTrigger(active) {+ trigger.setAttribute('aria-pressed', active ? 'true' : 'false');+ trigger.setAttribute('aria-label', active ? 'Clear traced route' : 'Trace a directed route');+ }+ function clear(options) {+ options = options || {};+ var wasActive = mode !== 'idle';+ if (Archify.finder && Archify.finder.isOpen() && typeof Archify.finder.context === 'function' && Archify.finder.context().indexOf('route-') === 0) {+ Archify.finder.close({ restoreFocus: false });+ }+ mode = 'idle';+ startId = null;+ endId = null;+ activeNodeIds = [];+ activeEdges = [];+ cleanSvgState();+ panel.hidden = true;+ panel.setAttribute('data-state', 'idle');+ panel.removeAttribute('data-finder-open');+ title.textContent = 'Choose a start node';+ renderPlaceholder('Pick two semantic nodes on the diagram');+ status.textContent = 'Choose the source, then the destination. Direction matters.';+ findBtn.hidden = true;+ findBtn.textContent = 'Find start';+ findBtn.setAttribute('aria-label', 'Find a route start');+ copyBtn.hidden = true;+ copyBtn.textContent = 'Copy link';+ setTrigger(false);+ if (wasActive && options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ if (options.updateUrl !== false) replaceRouteHash('');+ if (options.restoreFocus === true) trigger.focus();+ }+ function outgoingByNode() {+ var byId = nodesById();+ var outgoing = {};+ edges().forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (!byId[from] || !byId[to] || from === to) return;+ if (!outgoing[from]) outgoing[from] = [];+ outgoing[from].push({ edge: edge, to: to });+ });+ return outgoing;+ }+ function reachableFrom(source) {+ var outgoing = outgoingByNode();+ var reached = {};+ var queue = [source];+ reached[source] = true;+ for (var cursor = 0; cursor < queue.length; cursor += 1) {+ var links = outgoing[queue[cursor]] || [];+ links.forEach(function (link) {+ if (reached[link.to]) return;+ reached[link.to] = true;+ queue.push(link.to);+ });+ }+ return reached;+ }+ function hopDistancesFrom(source) {+ var outgoing = outgoingByNode();+ var distances = {};+ var queue = [source];+ distances[source] = 0;+ for (var cursor = 0; cursor < queue.length; cursor += 1) {+ var links = outgoing[queue[cursor]] || [];+ links.forEach(function (link) {+ if (Object.prototype.hasOwnProperty.call(distances, link.to)) return;+ distances[link.to] = distances[queue[cursor]] + 1;+ queue.push(link.to);+ });+ }+ return distances;+ }+ function shortestDirectedPath(source, target) {+ if (source === target) return null;+ var outgoing = outgoingByNode();+ var previous = {};+ var queue = [source];+ previous[source] = null;+ for (var cursor = 0; cursor < queue.length && !Object.prototype.hasOwnProperty.call(previous, target); cursor += 1) {+ var links = outgoing[queue[cursor]] || [];+ links.some(function (link) {+ if (Object.prototype.hasOwnProperty.call(previous, link.to)) return false;+ previous[link.to] = { from: queue[cursor], edge: link.edge };+ queue.push(link.to);+ return link.to === target;+ });+ }+ if (!Object.prototype.hasOwnProperty.call(previous, target)) return null;+ var nodeIds = [target];+ var routeEdges = [];+ var current = target;+ while (current !== source) {+ var step = previous[current];+ if (!step) return null;+ routeEdges.unshift(step.edge);+ nodeIds.unshift(step.from);+ current = step.from;+ }+ return { nodes: nodeIds, edges: routeEdges };+ }+ function traceGeometry(shape, step) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-route-match');+ clone.removeAttribute('data-route-step');+ clone.setAttribute('class', 'route-probe-flow');+ clone.setAttribute('pathLength', '1');+ clone.style.setProperty('--route-step', String(step));+ return clone;+ }+ function renderOverlay(routeEdges) {+ removeOverlay();+ if (!routeEdges.length) return;+ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'route-probe-overlay');+ overlay.setAttribute('data-route-probe-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ routeEdges.forEach(function (edge, step) {+ var wrapper = document.createElementNS(namespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ edgeShapes(edge).forEach(function (shape) { wrapper.appendChild(traceGeometry(shape, step)); });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ }+ function journeyButtons() {+ return Array.prototype.slice.call(path.querySelectorAll('[data-route-journey-index]'));+ }+ function journeyMotionAllowed() {+ return html.getAttribute('data-embed') !== 'true' &&+ !document.hidden &&+ Archify.motionGovernor &&+ Archify.motionGovernor.capable === true &&+ !Archify.motionGovernor.isPaused();+ }+ function routeOverviewStatus() {+ return activeNodeIds.length + ' nodes · ' + activeEdges.length + ' directed hop' + (activeEdges.length === 1 ? '' : 's') + ' · shortest authored route';+ }+ function centerJourneyButton(button) {+ if (!button) return;+ var target = button.offsetLeft - Math.max(0, (path.clientWidth - button.offsetWidth) / 2);+ path.scrollLeft = Math.max(0, target);+ }+ function focusJourneyButton(index) {+ var buttons = journeyButtons();+ if (!buttons.length) return false;+ var next = Math.max(0, Math.min(buttons.length - 1, index));+ buttons.forEach(function (button, buttonIndex) {+ button.setAttribute('tabindex', buttonIndex === next ? '0' : '-1');+ });+ try { buttons[next].focus({ preventScroll: true }); } catch (_) { buttons[next].focus(); }+ centerJourneyButton(buttons[next]);+ return true;+ }+ function renderJourneyControls() {+ var hasRoute = mode === 'result' && activeNodeIds.length > 1;+ var canPlay = hasRoute && journeyMotionAllowed();+ journeyControls.hidden = !hasRoute;+ journeyControls.setAttribute('data-playing', journeyPlaying ? 'true' : 'false');+ journeyPrevBtn.disabled = !hasRoute || journeyIndex <= 0;+ journeyNextBtn.disabled = !hasRoute || journeyIndex >= activeNodeIds.length - 1;+ journeyOverviewBtn.disabled = !hasRoute || journeyIndex < 0;+ journeyPlayBtn.disabled = !canPlay;+ journeyPlayBtn.setAttribute('aria-pressed', journeyPlaying ? 'true' : 'false');+ if (journeyPlaying) {+ journeyPlayIcon.textContent = '\u275a\u275a';+ journeyPlayLabel.textContent = 'Pause';+ journeyPlayBtn.setAttribute('aria-label', 'Pause route journey');+ journeyPlayBtn.title = 'Pause route journey';+ } else if (journeyComplete || journeyIndex === activeNodeIds.length - 1) {+ journeyPlayIcon.textContent = '\u21bb';+ journeyPlayLabel.textContent = 'Replay';+ journeyPlayBtn.setAttribute('aria-label', 'Replay route journey');+ journeyPlayBtn.title = canPlay ? 'Replay route journey' : 'Automatic journey requires Live motion';+ } else {+ journeyPlayIcon.textContent = '\u25b6';+ journeyPlayLabel.textContent = 'Journey';+ journeyPlayBtn.setAttribute('aria-label', 'Play route journey');+ journeyPlayBtn.title = canPlay ? 'Play route journey' : 'Automatic journey requires Live motion';+ }+ }+ function journeyGeometry(shape) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-route-match');+ clone.removeAttribute('data-route-step');+ clone.removeAttribute('data-route-journey-state');+ clone.removeAttribute('data-route-journey-current');+ clone.setAttribute('class', 'route-journey-flow');+ clone.setAttribute('pathLength', '1');+ return clone;+ }+ function renderJourneyPulse(edge) {+ removeJourneyPulse();+ if (!edge || !journeyMotionAllowed()) return false;+ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'route-journey-overlay');+ overlay.setAttribute('data-route-journey-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ var wrapper = document.createElementNS(namespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ edgeShapes(edge).forEach(function (shape) { wrapper.appendChild(journeyGeometry(shape)); });+ if (!wrapper.childNodes.length) return false;+ overlay.appendChild(wrapper);+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ if (Archify.motionGovernor && Archify.motionGovernor.capable) {+ var token = 0;+ token = Archify.motionGovernor.claim('route', function () {+ if (journeyOwnerToken === token) journeyOwnerToken = 0;+ removeJourneyPulse({ release: false });+ });+ journeyOwnerToken = token;+ }+ overlay.addEventListener('animationend', function () {+ if (overlay.isConnected) removeJourneyPulse();+ }, { once: true });+ window.setTimeout(function () {+ if (overlay.isConnected) removeJourneyPulse();+ }, 860);+ return true;+ }+ function applyJourneyState(index, options) {+ options = options || {};+ if (mode !== 'result' || !activeNodeIds.length) return false;+ var byId = nodesById();+ journeyIndex = Math.max(0, Math.min(activeNodeIds.length - 1, index));+ removeJourneyPulse();+ svg.setAttribute('data-route-journey', (journeyIndex + 1) + '/' + activeNodeIds.length);+ panel.setAttribute('data-route-journey', String(journeyIndex));+ activeNodeIds.forEach(function (id, step) {+ var node = byId[id];+ if (!node) return;+ var state = step < journeyIndex ? 'past' : (step === journeyIndex ? 'current' : 'future');+ node.setAttribute('data-route-journey-state', state);+ if (step === journeyIndex) node.setAttribute('data-route-journey-current', '');+ else node.removeAttribute('data-route-journey-current');+ });+ activeEdges.forEach(function (edge, step) {+ var destination = step + 1;+ var state = destination < journeyIndex ? 'past' : (destination === journeyIndex ? 'current' : 'future');+ edge.setAttribute('data-route-journey-state', state);+ if (destination === journeyIndex) edge.setAttribute('data-route-journey-current', '');+ else edge.removeAttribute('data-route-journey-current');+ });+ var buttons = journeyButtons();+ buttons.forEach(function (button, step) {+ var state = step < journeyIndex ? 'past' : (step === journeyIndex ? 'current' : 'future');+ button.setAttribute('data-route-journey-state', state);+ button.setAttribute('tabindex', step === journeyIndex ? '0' : '-1');+ if (step === journeyIndex) button.setAttribute('aria-current', 'step');+ else button.removeAttribute('aria-current');+ });+ if (options.center !== false) centerJourneyButton(buttons[journeyIndex]);+ var phase = journeyPlaying ? 'Playing' : (journeyComplete ? 'Complete' : 'Inspecting');+ status.textContent = 'Step ' + (journeyIndex + 1) + ' of ' + activeNodeIds.length + ' · ' + phase + ' · ' + nodeLabel(byId[activeNodeIds[journeyIndex]], activeNodeIds[journeyIndex]);+ if (options.pulse === true && journeyIndex > 0) renderJourneyPulse(activeEdges[journeyIndex - 1]);+ if (options.reveal !== false && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal(activeNodeIds.slice(Math.max(0, journeyIndex - 1), Math.min(activeNodeIds.length, journeyIndex + 2)), {+ includeNeighbors: false,+ reason: 'route-journey',+ maxScale: 1.65,+ padding: 64,+ duration: 360,+ instant: !journeyMotionAllowed()+ });+ }+ renderJourneyControls();+ requestDocking();+ return true;+ }+ function pauseJourney(options) {+ options = options || {};+ if (!journeyPlaying && options.complete !== true) {+ renderJourneyControls();+ return false;+ }+ stopJourneyTimer({ preserveElapsed: options.complete !== true && options.preserveElapsed !== false });+ journeyPlaying = false;+ journeyComplete = options.complete === true;+ if (journeyComplete) journeyElapsedMs = 0;+ removeJourneyPulse();+ if (journeyIndex >= 0) applyJourneyState(journeyIndex, { center: false, pulse: false, reveal: false });+ else renderJourneyControls();+ return true;+ }+ function selectJourneyIndex(index) {+ if (mode !== 'result') return false;+ stopJourneyTimer();+ journeyPlaying = false;+ journeyComplete = false;+ return applyJourneyState(index, { pulse: true, reveal: true });+ }+ function showJourneyOverview(options) {+ options = options || {};+ if (mode !== 'result') return false;+ stopJourneyTimer();+ journeyPlaying = false;+ journeyComplete = false;+ journeyIndex = -1;+ clearJourneyPresentation({ keepControls: true });+ status.textContent = routeOverviewStatus();+ renderJourneyControls();+ if (options.reveal !== false && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal(activeNodeIds, { includeNeighbors: false, reason: 'route', instant: !journeyMotionAllowed() });+ }+ requestDocking();+ return true;+ }+ function scheduleJourney() {+ if (!journeyPlaying || !journeyMotionAllowed()) {+ pauseJourney({ preserveElapsed: true });+ return false;+ }+ var generation = ++journeyGeneration;+ var remaining = Math.max(0, JOURNEY_DWELL_MS - journeyElapsedMs);+ journeyStartedAt = Date.now();+ journeyTimer = window.setTimeout(function () {+ if (generation !== journeyGeneration || !journeyPlaying) return;+ journeyTimer = null;+ journeyStartedAt = 0;+ journeyElapsedMs = 0;+ if (journeyIndex >= activeNodeIds.length - 1) {+ pauseJourney({ complete: true, preserveElapsed: false });+ return;+ }+ applyJourneyState(journeyIndex + 1, { pulse: true, reveal: true });+ // Camera and motion-owner handoff are allowed to synchronously+ // settle the previous step. The new step always starts with a fresh+ // dwell; never carry cleanup time into the next scheduler lease.+ journeyElapsedMs = 0;+ journeyStartedAt = 0;+ scheduleJourney();+ }, remaining);+ return true;+ }+ function playJourney() {+ if (mode !== 'result' || activeNodeIds.length < 2 || !journeyMotionAllowed()) {+ renderJourneyControls();+ return false;+ }+ if (journeyPlaying) return true;+ if (journeyComplete || journeyIndex >= activeNodeIds.length - 1) {+ journeyIndex = -1;+ journeyElapsedMs = 0;+ journeyComplete = false;+ }+ journeyPlaying = true;+ if (journeyIndex < 0) applyJourneyState(0, { pulse: false, reveal: true });+ else applyJourneyState(journeyIndex, { center: false, pulse: false, reveal: false });+ scheduleJourney();+ return true;+ }+ function toggleJourney() {+ return journeyPlaying ? pauseJourney({ preserveElapsed: true }) : playJourney();+ }+ function previousJourney() {+ return selectJourneyIndex(Math.max(0, journeyIndex < 0 ? 0 : journeyIndex - 1));+ }+ function nextJourney() {+ return selectJourneyIndex(Math.min(activeNodeIds.length - 1, journeyIndex + 1));+ }+ function overlapArea(a, b) {+ var width = Math.max(0, Math.min(a.right, b.right) - Math.max(a.left, b.left));+ var height = Math.max(0, Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top));+ return width * height;+ }+ function updateDocking() {+ if (panel.hidden) {+ panel.removeAttribute('data-route-dock');+ return;+ }+ var containerRect = container.getBoundingClientRect();+ var width = panel.offsetWidth;+ var height = panel.offsetHeight;+ if (!width || !height) return;+ var currentRect = panel.getBoundingClientRect();+ var left = currentRect.left;+ var topCandidate = {+ left: left,+ right: left + width,+ top: containerRect.top + 8,+ bottom: containerRect.top + 8 + height+ };+ var nav = container.querySelector('.diagram-nav');+ var navRect = nav ? nav.getBoundingClientRect() : null;+ var bottom = navRect ? navRect.top - 9 : containerRect.bottom - 8;+ var bottomCandidate = {+ left: left,+ right: left + width,+ top: bottom - height,+ bottom: bottom+ };+ var byId = nodesById();+ var relevant = activeNodeIds.length ? activeNodeIds : (startId ? [startId] : []);+ var blockers = relevant.map(function (id) { return byId[id]; }).filter(Boolean).map(function (node) {+ return node.getBoundingClientRect();+ });+ function score(candidate) {+ var value = blockers.reduce(function (sum, rect) { return sum + overlapArea(candidate, rect); }, 0);+ if (navRect) value += overlapArea(candidate, navRect) * 4;+ if (candidate.top < containerRect.top || candidate.bottom > containerRect.bottom) value += 1000000;+ return value;+ }+ if (score(topCandidate) <= score(bottomCandidate)) panel.setAttribute('data-route-dock', 'top');+ else panel.setAttribute('data-route-dock', 'bottom');+ }+ function requestDocking() {+ requestAnimationFrame(updateDocking);+ window.setTimeout(updateDocking, 120);+ window.setTimeout(updateDocking, 560);+ }+ function chooseStart(id) {+ var byId = nodesById();+ if (!byId[id]) return false;+ cleanSvgState();+ startId = id;+ endId = null;+ mode = 'target';+ var reached = reachableFrom(id);+ byId[id].setAttribute('data-route-start', '');+ byId[id].setAttribute('data-route-match', '');+ Object.keys(reached).forEach(function (candidateId) {+ if (candidateId !== id && byId[candidateId]) byId[candidateId].setAttribute('data-route-candidate', '');+ });+ svg.setAttribute('data-route-picking', 'target');+ panel.setAttribute('data-state', 'target');+ title.textContent = 'Choose a destination from ' + nodeLabel(byId[id], id);+ renderPath([id]);+ var count = Math.max(0, Object.keys(reached).length - 1);+ status.textContent = count+ ? count + ' directed destination' + (count === 1 ? '' : 's') + ' available. Pick a highlighted node.'+ : 'No outgoing route starts here. Clear and choose another source.';+ findBtn.hidden = false;+ findBtn.textContent = 'Find target';+ findBtn.setAttribute('aria-label', 'Find a reachable route destination');+ requestDocking();+ return true;+ }+ function showResult(result, options) {+ options = options || {};+ var byId = nodesById();+ cleanSvgState();+ mode = 'result';+ startId = result.nodes[0];+ endId = result.nodes[result.nodes.length - 1];+ activeNodeIds = result.nodes.slice();+ activeEdges = result.edges.slice();+ result.nodes.forEach(function (id, step) {+ var node = byId[id];+ if (!node) return;+ node.setAttribute('data-route-match', '');+ node.setAttribute('data-route-step', String(step));+ node.style.setProperty('--route-step', String(step));+ if (step === 0) node.setAttribute('data-route-start', '');+ if (step === result.nodes.length - 1) node.setAttribute('data-route-end', '');+ });+ result.edges.forEach(function (edge, step) {+ edge.setAttribute('data-route-match', '');+ edge.setAttribute('data-route-step', String(step));+ edge.style.setProperty('--route-step', String(step));+ });+ svg.setAttribute('data-route-active', startId + '~' + endId);+ renderOverlay(result.edges);+ renderPath(result.nodes, { interactive: true });+ panel.setAttribute('data-state', 'result');+ panel.hidden = false;+ title.textContent = nodeLabel(byId[startId], startId) + ' to ' + nodeLabel(byId[endId], endId);+ findBtn.hidden = true;+ copyBtn.hidden = false;+ setTrigger(true);+ if (options.updateUrl !== false) {+ replaceRouteHash(encodeURIComponent(startId) + '~' + encodeURIComponent(endId));+ }+ showJourneyOverview({ reveal: false });+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal(result.nodes, { includeNeighbors: false, reason: 'route' });+ }+ return true;+ }+ function choose(id, options) {+ options = options || {};+ var byId = nodesById();+ if (!byId[id]) return false;+ if (mode === 'source') return chooseStart(id);+ if (mode !== 'target') return false;+ if (id === startId) {+ panel.setAttribute('data-state', 'error');+ title.textContent = 'Choose a different destination';+ status.textContent = 'A route needs two distinct semantic nodes.';+ return false;+ }+ var result = shortestDirectedPath(startId, id);+ if (!result) {+ panel.setAttribute('data-state', 'error');+ title.textContent = 'No directed route to ' + nodeLabel(byId[id], id);+ status.textContent = nodeLabel(byId[id], id) + ' is not reachable from ' + nodeLabel(byId[startId], startId) + '. Pick a highlighted destination.';+ return false;+ }+ return showResult(result, options);+ }+ function begin(options) {+ options = options || {};+ if (html.getAttribute('data-embed') === 'true') return false;+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.semanticLens && Archify.semanticLens.active()) {+ Archify.semanticLens.clear({ updateUrl: false, preserveView: true, closePanel: true });+ }+ var focused = options.source || (Archify.focus && typeof Archify.focus.active === 'function' ? Archify.focus.active() : null);+ if (Array.isArray(focused)) focused = null;+ clear({ updateUrl: false, preserveView: true, restoreFocus: false });+ if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') Archify.intentTrace.clear({ announce: false });+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.focus && typeof Archify.focus.clear === 'function') {+ Archify.focus.clear({ updateUrl: false, preserveView: true });+ }+ if (Archify.finder && Archify.finder.isOpen()) Archify.finder.close({ restoreFocus: false });+ if (Archify.radar && Archify.radar.isOpen()) Archify.radar.close({ restoreFocus: false });+ mode = 'source';+ panel.hidden = false;+ panel.setAttribute('data-state', 'source');+ svg.setAttribute('data-route-picking', 'source');+ title.textContent = 'Choose a start node';+ renderPlaceholder('Pick a semantic node on the diagram');+ status.textContent = 'Select the source. The next step will reveal only directed destinations.';+ findBtn.hidden = false;+ findBtn.textContent = 'Find start';+ findBtn.setAttribute('aria-label', 'Find a route start');+ copyBtn.hidden = true;+ setTrigger(true);+ if (focused && nodesById()[focused]) chooseStart(focused);+ if (options.focusNode === true && !focused) {+ var first = nodes()[0];+ if (first) {+ try { first.focus({ preventScroll: true }); } catch (_) { try { first.focus(); } catch (_) {} }+ }+ }+ return true;+ }+ function toggle(options) {+ if (mode !== 'idle') {+ clear({ restoreFocus: true });+ return false;+ }+ return begin(options);+ }+ function finderContext() {+ var byId = nodesById();+ if (mode === 'source') {+ var outgoing = outgoingByNode();+ var sourceIds = nodes().map(function (node) { return node.getAttribute('data-node-id'); }).filter(function (id) {+ return outgoing[id] && outgoing[id].length;+ });+ var sourceBadges = {};+ sourceIds.forEach(function (id) { sourceBadges[id] = 'start'; });+ return {+ kind: 'route-source',+ title: 'Choose route start',+ placeholder: 'Search route sources',+ empty: 'No matching route sources',+ resultsLabel: 'Nodes that can start a route',+ availableNoun: 'route sources',+ allowedIds: sourceIds,+ badges: sourceBadges};- img.onerror = function (e) {- URL.revokeObjectURL(svgUrl);- reject(e);+ }+ if (mode === 'target' && startId && byId[startId]) {+ var distances = hopDistancesFrom(startId);+ var targetIds = Object.keys(distances).filter(function (id) { return id !== startId && byId[id]; });+ var targetBadges = {};+ targetIds.forEach(function (id) {+ targetBadges[id] = distances[id] + ' hop' + (distances[id] === 1 ? '' : 's');+ });+ return {+ kind: 'route-target',+ title: 'Destination from ' + nodeLabel(byId[startId], startId),+ placeholder: 'Search reachable destinations',+ empty: 'No matching reachable destinations',+ resultsLabel: 'Reachable route destinations',+ availableNoun: 'reachable destinations',+ allowedIds: targetIds,+ badges: targetBadges};- img.src = svgUrl;+ }+ return null;+ }+ function finderOpening() {+ panel.setAttribute('data-finder-open', 'true');+ }+ function finderClosed(options) {+ options = options || {};+ panel.removeAttribute('data-finder-open');+ requestDocking();+ if (options.restoreFocus === true && !findBtn.hidden) findBtn.focus();+ }+ function openFinder() {+ var context = finderContext();+ if (!context || !Archify.finder) return false;+ return Archify.finder.open({ context: context });+ }+ function fallbackCopy(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }+ function copyLink() {+ if (mode !== 'result') return Promise.resolve(false);+ var value = location.href.replace(/#.*$/, '') + '#route=' + encodeURIComponent(startId) + '~' + encodeURIComponent(endId);+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })+ : Promise.resolve(fallbackCopy(value));+ return copy.then(function (copied) {+ copyBtn.textContent = copied ? 'Copied' : 'Copy failed';+ copyBtn.setAttribute('aria-label', copied ? 'Traced route link copied' : 'Could not copy traced route link');+ window.setTimeout(function () {+ copyBtn.textContent = 'Copy link';+ copyBtn.setAttribute('aria-label', 'Copy link to traced route');+ }, 1600);+ return copied;+ });+ }+ function interceptSelection(event) {+ if (mode !== 'source' && mode !== 'target') return;+ if (container.getAttribute('data-just-panned') === 'true') return;+ var node = event.target.closest('[data-node-id]');+ if (!node) return;+ if (event.type === 'keydown' && event.key !== 'Enter' && event.key !== ' ') return;+ event.preventDefault();+ event.stopImmediatePropagation();+ choose(node.getAttribute('data-node-id'));+ }+ function syncFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var route = params.get('route');+ if (!route) {+ if (mode !== 'idle') clear({ updateUrl: false, restoreFocus: false });+ return;+ }+ var parts = route.split('~');+ if (parts.length !== 2) return;+ var byId = nodesById();+ if (!byId[parts[0]] || !byId[parts[1]]) return;+ begin({ source: parts[0], focusNode: false });+ choose(parts[1], { updateUrl: false });+ } catch (_) {}+ }+ function escapeRoute(options) {+ options = options || {};+ if (journeyPlaying) {+ pauseJourney({ preserveElapsed: true });+ if (options.restoreFocus === true) journeyPlayBtn.focus();+ return 'paused';+ }+ if (journeyIndex >= 0) {+ showJourneyOverview({ reveal: true });+ if (options.restoreFocus === true) journeyOverviewBtn.focus();+ return 'overview';+ }+ clear({ restoreFocus: options.restoreFocus === true });+ return 'cleared';+ }+ function syncJourneyMotion() {+ if (journeyPlaying && !journeyMotionAllowed()) pauseJourney({ preserveElapsed: true });+ renderJourneyControls();+ return journeyMotionAllowed();+ }++ trigger.addEventListener('click', function () { toggle({ focusNode: false }); });+ findBtn.addEventListener('click', openFinder);+ clearBtn.addEventListener('click', function () { clear({ restoreFocus: true }); });+ copyBtn.addEventListener('click', copyLink);+ journeyPrevBtn.addEventListener('click', previousJourney);+ journeyPlayBtn.addEventListener('click', toggleJourney);+ journeyNextBtn.addEventListener('click', nextJourney);+ journeyOverviewBtn.addEventListener('click', function () { showJourneyOverview({ reveal: true }); });+ path.addEventListener('click', function (event) {+ var button = event.target.closest('[data-route-journey-index]');+ if (!button) return;+ selectJourneyIndex(Number(button.getAttribute('data-route-journey-index')));+ });+ path.addEventListener('focusin', function (event) {+ if (journeyPlaying && event.target.closest('[data-route-journey-index]')) pauseJourney({ preserveElapsed: true });+ });+ path.addEventListener('keydown', function (event) {+ var button = event.target.closest('[data-route-journey-index]');+ if (!button) return;+ var index = Number(button.getAttribute('data-route-journey-index'));+ var next = null;+ if (event.key === 'ArrowRight') next = Math.min(activeNodeIds.length - 1, index + 1);+ else if (event.key === 'ArrowLeft') next = Math.max(0, index - 1);+ else if (event.key === 'Home') next = 0;+ else if (event.key === 'End') next = activeNodeIds.length - 1;+ if (next !== null) {+ event.preventDefault();+ focusJourneyButton(next);+ return;+ }+ if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault();+ selectJourneyIndex(index);+ }+ });+ svg.addEventListener('click', interceptSelection, true);+ svg.addEventListener('keydown', interceptSelection, true);+ container.addEventListener('scroll', updateDocking, { passive: true });+ window.addEventListener('resize', requestDocking);+ window.addEventListener('beforeprint', function () {+ if (journeyPlaying) pauseJourney({ preserveElapsed: true, reason: 'print' });+ else removeJourneyPulse();+ });+ window.addEventListener('hashchange', function () { requestAnimationFrame(syncFromHash); });+ syncFromHash();++ return {+ begin: begin,+ choose: choose,+ clear: clear,+ toggle: toggle,+ escape: escapeRoute,+ copyLink: copyLink,+ playJourney: playJourney,+ pauseJourney: pauseJourney,+ showOverview: showJourneyOverview,+ selectJourneyIndex: selectJourneyIndex,+ syncMotion: syncJourneyMotion,+ isJourneyPlaying: function () { return journeyPlaying; },+ finderContext: finderContext,+ finderOpening: finderOpening,+ finderClosed: finderClosed,+ openFinder: openFinder,+ active: function () { return mode === 'idle' ? null : mode; },+ result: function () {+ return mode === 'result'+ ? { source: startId, target: endId, nodes: activeNodeIds.slice(), hops: activeEdges.length, journey: journeyIndex, playing: journeyPlaying }+ : null;+ }+ };+ })();++ /* ============================================================+ Semantic Lens — a counted, viewer-only legend over data-node-kind.+ One selected kind reveals every authored relationship touching it.+ Two selected kinds compare only direct cross-kind relationships while+ preserving the full diagram as a dimmed spatial reference.+ ============================================================ */+ Archify.semanticLens = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var trigger = document.getElementById('btn-semantic-lens');+ var panel = document.getElementById('semantic-lens');+ var closeBtn = document.getElementById('semantic-lens-close');+ var kindsRoot = document.getElementById('semantic-lens-kinds');+ var status = document.getElementById('semantic-lens-status');+ var copyBtn = document.getElementById('semantic-lens-copy');+ var clearBtn = document.getElementById('semantic-lens-clear');+ var legendBridge = svg.querySelector('[data-legend-bridge]');+ var legendEntries = [];+ var hoveredLegendEntry = null;+ var focusedLegendEntry = null;+ var activeLegendPreview = null;+ var lensOpener = trigger;+ var selectedKinds = [];+ var namespace = 'http://www.w3.org/2000/svg';+ var finePointerQuery = window.matchMedia ? window.matchMedia('(hover: hover) and (pointer: fine)') : null;+ var MAX_LENS_FLOW_EDGES = 24;++ function kindLabel(value) {+ return String(value || 'neutral')+ .replace(/messagebus/gi, 'message bus')+ .replace(/[-_]+/g, ' ')+ .replace(/\b\w/g, function (letter) { return letter.toUpperCase(); });+ }+ function nodesById() {+ var byId = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id][data-node-kind]'), function (node) {+ var id = node.getAttribute('data-node-id');+ if (id && !byId[id]) byId[id] = node;+ });+ return byId;+ }+ function collectKinds() {+ var kinds = {};+ var byId = nodesById();+ Object.keys(byId).forEach(function (id) {+ var node = byId[id];+ var value = node.getAttribute('data-node-kind') || 'neutral';+ var kind = kinds[value] || (kinds[value] = { id: value, label: kindLabel(value), nodes: [] });+ kind.nodes.push(node);+ });+ return Object.keys(kinds).map(function (key) { return kinds[key]; }).sort(function (a, b) {+ return b.nodes.length - a.nodes.length || a.label.localeCompare(b.label);+ });+ }+ function edgeGroups() {+ var groups = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var key = edge.getAttribute('data-edge-key') || [from, to, edge.getAttribute('data-edge-label') || ''].join('\u0000');+ if (!groups[key]) groups[key] = { key: key, from: from, to: to, members: [] };+ groups[key].members.push(edge);+ });+ return Object.keys(groups).map(function (key) { return groups[key]; });+ }+ function edgeShapes(edge) {+ if (!edge) return [];+ if (/^(path|line|polyline)$/i.test(edge.tagName || '')) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function legendSourceBounds(entry) {+ var bounds = null;+ Array.prototype.forEach.call(entry.children, function (child) {+ if (child.hasAttribute('data-legend-bridge-runtime')) return;+ var box;+ try { box = child.getBBox(); } catch (_) { return; }+ if (!box || !Number.isFinite(box.x) || !Number.isFinite(box.y)) return;+ var next = { left: box.x, top: box.y, right: box.x + box.width, bottom: box.y + box.height };+ if (!bounds) bounds = next;+ else {+ bounds.left = Math.min(bounds.left, next.left);+ bounds.top = Math.min(bounds.top, next.top);+ bounds.right = Math.max(bounds.right, next.right);+ bounds.bottom = Math.max(bounds.bottom, next.bottom);+ }+ });+ return bounds;+ }+ function layoutLegendEntry(entry) {+ var bounds = legendSourceBounds(entry);+ var hit = entry.querySelector('[data-legend-hit]');+ var badge = entry.querySelector('[data-legend-count-badge]');+ if (!bounds || !hit || !badge) return false;+ var count = entry.getAttribute('data-legend-count') || '0';+ var centerY = (bounds.top + bounds.bottom) / 2;+ var badgeWidth = Math.max(14, count.length * 5 + 8);+ var badgeX = bounds.right + 3;+ var hitX = bounds.left - 5;+ var hitRight = badgeX + badgeWidth + 4;+ hit.setAttribute('x', hitX.toFixed(2));+ hit.setAttribute('y', (centerY - 12).toFixed(2));+ hit.setAttribute('width', Math.max(24, hitRight - hitX).toFixed(2));+ hit.setAttribute('height', '24');+ hit.setAttribute('rx', '4');+ var badgeRect = badge.querySelector('rect');+ var badgeText = badge.querySelector('text');+ badgeRect.setAttribute('x', badgeX.toFixed(2));+ badgeRect.setAttribute('y', (centerY - 7).toFixed(2));+ badgeRect.setAttribute('width', badgeWidth.toFixed(2));+ badgeRect.setAttribute('height', '14');+ badgeRect.setAttribute('rx', '7');+ badgeText.setAttribute('x', (badgeX + badgeWidth / 2).toFixed(2));+ badgeText.setAttribute('y', (centerY + 2.5).toFixed(2));+ return true;+ }+ function layoutLegendBridge() {+ legendEntries.forEach(layoutLegendEntry);+ if (!legendBridge) return;+ Array.prototype.forEach.call(legendBridge.querySelectorAll('[data-legend-zero]'), layoutLegendEntry);+ }+ function decorateLegendBridge() {+ legendEntries = [];+ if (!legendBridge || html.getAttribute('data-embed') === 'true') return false;+ var facts = {};+ collectKinds().forEach(function (kind) { facts[kind.id] = kind; });+ Array.prototype.forEach.call(legendBridge.querySelectorAll('[data-legend-kind]'), function (entry) {+ var kind = entry.getAttribute('data-legend-kind');+ var fact = facts[kind];+ var count = fact ? fact.nodes.length : 0;+ entry.setAttribute('data-legend-count', String(count));+ var hit = document.createElementNS(namespace, 'rect');+ hit.setAttribute('data-legend-bridge-runtime', '');+ hit.setAttribute('data-legend-hit', '');+ hit.setAttribute('aria-hidden', 'true');+ entry.insertBefore(hit, entry.firstChild);+ var badge = document.createElementNS(namespace, 'g');+ badge.setAttribute('data-legend-bridge-runtime', '');+ badge.setAttribute('data-legend-count-badge', '');+ badge.setAttribute('aria-hidden', 'true');+ badge.appendChild(document.createElementNS(namespace, 'rect'));+ var countText = document.createElementNS(namespace, 'text');+ countText.textContent = String(count);+ badge.appendChild(countText);+ entry.appendChild(badge);+ if (!fact || !count) {+ entry.setAttribute('data-legend-zero', '');+ return;+ }+ entry.setAttribute('role', 'button');+ entry.setAttribute('tabindex', legendEntries.length ? '-1' : '0');+ entry.setAttribute('aria-label', 'Inspect ' + fact.label + ', ' + count + ' node' + (count === 1 ? '' : 's'));+ entry.setAttribute('aria-pressed', 'false');+ entry.setAttribute('aria-haspopup', 'dialog');+ entry.setAttribute('aria-controls', 'semantic-lens');+ entry.setAttribute('aria-expanded', 'false');+ legendEntries.push(entry);+ });+ if (!legendEntries.length) return false;+ legendBridge.setAttribute('role', legendEntries.length >= 3 ? 'toolbar' : 'group');+ legendBridge.setAttribute('aria-label', 'Semantic legend');+ syncLegendBridge();+ layoutLegendBridge();+ try {+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(layoutLegendBridge);+ } catch (_) {}+ return true;+ }+ function syncLegendBridge() {+ legendEntries.forEach(function (entry) {+ var selected = selectedKinds.indexOf(entry.getAttribute('data-legend-kind')) >= 0;+ entry.setAttribute('aria-pressed', selected ? 'true' : 'false');+ entry.setAttribute('aria-expanded', !panel.hidden && lensOpener === entry ? 'true' : 'false');+ if (selected) entry.setAttribute('data-legend-selected', '');+ else entry.removeAttribute('data-legend-selected');+ });+ }+ function clearLegendPreview() {+ activeLegendPreview = null;+ svg.removeAttribute('data-legend-preview-active');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer]'), function (element) {+ element.removeAttribute('data-legend-preview-match');+ element.removeAttribute('data-legend-preview-selected');+ element.removeAttribute('data-legend-preview-peer');+ });+ }+ function strongerLegendOwnerActive() {+ return selectedKinds.length > 0 || !panel.hidden || html.getAttribute('data-present') === 'true' ||+ svg.hasAttribute('data-focus-active') || svg.hasAttribute('data-intent-trace-active') ||+ svg.hasAttribute('data-route-picking') || svg.hasAttribute('data-route-active') ||+ svg.hasAttribute('data-story-active') || svg.hasAttribute('data-relationship-preview-active');+ }+ function previewLegendKind(entry) {+ clearLegendPreview();+ if (!entry || strongerLegendOwnerActive()) return false;+ var kind = entry.getAttribute('data-legend-kind');+ var byId = nodesById();+ var matches = Object.keys(byId).filter(function (id) {+ return (byId[id].getAttribute('data-node-kind') || 'neutral') === kind;+ });+ if (!matches.length) return false;+ var chosen = {};+ matches.forEach(function (id) {+ chosen[id] = true;+ byId[id].setAttribute('data-legend-preview-match', '');+ byId[id].setAttribute('data-legend-preview-selected', '');+ });+ edgeGroups().forEach(function (edge) {+ if (!chosen[edge.from] && !chosen[edge.to]) return;+ edge.members.forEach(function (member) { member.setAttribute('data-legend-preview-match', ''); });+ [edge.from, edge.to].forEach(function (id) {+ if (!byId[id] || chosen[id]) return;+ byId[id].setAttribute('data-legend-preview-match', '');+ byId[id].setAttribute('data-legend-preview-peer', '');+ });});+ svg.setAttribute('data-legend-preview-active', kind);+ activeLegendPreview = entry;+ return true;}-- var menu = document.getElementById('export-menu');- var btn = document.getElementById('btn-export');- var items = function () {- return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));- };-- // ---- Clipboard support ----------------------------------------------- function canCopyImage() {- return typeof ClipboardItem !== 'undefined' &&- navigator.clipboard &&- typeof navigator.clipboard.write === 'function';+ function syncLegendPreview() {+ var next = focusedLegendEntry || hoveredLegendEntry;+ if (next === activeLegendPreview) return;+ clearLegendPreview();+ if (next) previewLegendKind(next);}-- // ---- Raster format detection ----------------------------------------- // canvas.toBlob('image/webp') silently returns a PNG on browsers without- // WebP encoding (older Safari), so detect explicitly.- function supports(format) {- if (format === 'svg' || format === 'png') return true;- var mime = format === 'jpeg' ? 'image/jpeg' : 'image/webp';- try {- var c = document.createElement('canvas');- c.width = c.height = 2;- return c.toDataURL(mime).indexOf('data:' + mime) === 0;- } catch (_) { return false; }+ function activateLegendEntry(entry) {+ if (!entry || entry.getAttribute('role') !== 'button') return false;+ clearLegendPreview();+ select(entry.getAttribute('data-legend-kind'));+ return open({ opener: entry });}-- // Gray out unsupported items.- items().forEach(function (it) {- if (it.dataset.format && !supports(it.dataset.format)) {- it.disabled = true;- it.title = 'Not supported by this browser';- it.style.opacity = '0.5';+ function removeFlowOverlay() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-semantic-lens-overlay]'), function (element) {+ element.remove();+ });+ svg.removeAttribute('data-lens-flow-count');+ svg.removeAttribute('data-lens-flow-density');+ }+ function flowGeometry(shape, direction, step) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-hidden');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-lens-match');+ clone.setAttribute('class', 'semantic-lens-flow');+ clone.setAttribute('data-direction', direction);+ clone.setAttribute('pathLength', '1');+ clone.style.setProperty('--lens-flow-delay', (step * 0.08).toFixed(2) + 's');+ return clone;+ }+ function renderFlowOverlay(entries) {+ removeFlowOverlay();+ svg.setAttribute('data-lens-flow-count', String(entries.length));+ if (!entries.length || html.getAttribute('data-embed') === 'true') return false;+ if (entries.length > MAX_LENS_FLOW_EDGES) {+ svg.setAttribute('data-lens-flow-density', 'quiet');+ return false;}- if (it.dataset.action === 'copy' && !canCopyImage()) {- it.disabled = true;- it.title = 'Clipboard image write not supported by this browser';- it.style.opacity = '0.5';+ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'semantic-lens-overlay');+ overlay.setAttribute('data-semantic-lens-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ entries.forEach(function (entry, step) {+ var wrapper = document.createElementNS(namespace, 'g');+ if (entry.edge.members[0].hasAttribute('transform')) {+ wrapper.setAttribute('transform', entry.edge.members[0].getAttribute('transform'));+ }+ edgeShapes(entry.edge.members[0]).forEach(function (shape) {+ wrapper.appendChild(flowGeometry(shape, entry.direction, step));+ });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ if (!overlay.childNodes.length) return false;+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ return true;+ }+ function cleanSvgState() {+ removeFlowOverlay();+ svg.removeAttribute('data-lens-active');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-lens-match], [data-lens-selected], [data-lens-peer]'), function (element) {+ element.removeAttribute('data-lens-match');+ element.removeAttribute('data-lens-selected');+ element.removeAttribute('data-lens-peer');+ });+ }+ function renderKinds() {+ kindsRoot.textContent = '';+ collectKinds().forEach(function (kind) {+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'semantic-lens-kind';+ button.setAttribute('data-kind', kind.id);+ button.setAttribute('aria-pressed', selectedKinds.indexOf(kind.id) >= 0 ? 'true' : 'false');+ button.setAttribute('aria-label', kind.label + ', ' + kind.nodes.length + ' node' + (kind.nodes.length === 1 ? '' : 's'));+ button.disabled = selectedKinds.length >= 2 && selectedKinds.indexOf(kind.id) === -1;+ var swatch = document.createElement('span');+ swatch.className = 'semantic-lens-swatch';+ swatch.setAttribute('aria-hidden', 'true');+ var label = document.createElement('strong');+ label.textContent = kind.label;+ var count = document.createElement('em');+ count.textContent = String(kind.nodes.length);+ button.appendChild(swatch);+ button.appendChild(label);+ button.appendChild(count);+ kindsRoot.appendChild(button);+ });+ }+ function updateHash() {+ try {+ var hash = selectedKinds.length+ ? '#lens=' + selectedKinds.map(encodeURIComponent).join('~')+ : '';+ history.replaceState(null, '', location.pathname + location.search + hash);+ } catch (_) {}+ }+ function updateTrigger() {+ var active = selectedKinds.length > 0;+ trigger.setAttribute('aria-pressed', active ? 'true' : 'false');+ trigger.setAttribute('aria-label', active ? 'Open active semantic lens' : 'Open semantic lens');+ copyBtn.hidden = !active;+ syncLegendBridge();+ }+ function overlapArea(a, b) {+ var width = Math.max(0, Math.min(a.right, b.right) - Math.max(a.left, b.left));+ var height = Math.max(0, Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top));+ return width * height;+ }+ function dockPanel(byId) {+ panel.removeAttribute('data-dock-side');+ if (panel.hidden || !selectedKinds.length || window.innerWidth <= 720) return 'right';+ var panelRect = panel.getBoundingClientRect();+ var containerRect = container.getBoundingClientRect();+ if (!panelRect.width || !panelRect.height) return 'right';+ var selectedRects = Object.keys(byId).filter(function (id) {+ return selectedKinds.indexOf(byId[id].getAttribute('data-node-kind') || 'neutral') >= 0;+ }).map(function (id) { return byId[id].getBoundingClientRect(); });+ var top = panelRect.top;+ var width = panelRect.width;+ var leftCandidate = { left: containerRect.left + 16, right: containerRect.left + 16 + width, top: top, bottom: panelRect.bottom };+ var rightCandidate = { left: containerRect.right - 16 - width, right: containerRect.right - 16, top: top, bottom: panelRect.bottom };+ var leftScore = selectedRects.reduce(function (score, rect) { return score + overlapArea(leftCandidate, rect); }, 0);+ var rightScore = selectedRects.reduce(function (score, rect) { return score + overlapArea(rightCandidate, rect); }, 0);+ var side = leftScore < rightScore ? 'left' : 'right';+ panel.setAttribute('data-dock-side', side);+ return side;+ }+ function applySelection(options) {+ options = options || {};+ cleanSvgState();+ var byId = nodesById();+ var nodeKind = {};+ Object.keys(byId).forEach(function (id) { nodeKind[id] = byId[id].getAttribute('data-node-kind') || 'neutral'; });+ if (!selectedKinds.length) {+ status.textContent = 'Choose a kind to inspect its nodes and touching relationships.';+ updateTrigger();+ renderKinds();+ dockPanel(byId);+ if (options.updateUrl !== false) updateHash();+ return false;}- });- // ---- Toast ----------------------------------------------------------- // A live region only announces CHANGES to an existing node, so the toast- // element is created once up front and updated in place.- var toastEl = document.createElement('div');- toastEl.className = 'archify-toast';- toastEl.setAttribute('role', 'status');- document.body.appendChild(toastEl);- var toastTimer = null;+ var chosen = {};+ selectedKinds.forEach(function (kind) { chosen[kind] = true; });+ Object.keys(byId).forEach(function (id) {+ if (!chosen[nodeKind[id]]) return;+ byId[id].setAttribute('data-lens-match', '');+ byId[id].setAttribute('data-lens-selected', '');+ });- function toast(msg) {- toastEl.textContent = '';+ var touching = 0;+ var forward = 0;+ var reverse = 0;+ var crossKind = selectedKinds.length === 2;+ var matchedFlow = [];+ edgeGroups().forEach(function (edge) {+ var fromKind = nodeKind[edge.from];+ var toKind = nodeKind[edge.to];+ var match = false;+ if (crossKind) {+ if (fromKind === selectedKinds[0] && toKind === selectedKinds[1]) { match = true; forward += 1; }+ if (fromKind === selectedKinds[1] && toKind === selectedKinds[0]) { match = true; reverse += 1; }+ } else if (fromKind === selectedKinds[0] || toKind === selectedKinds[0]) {+ match = true;+ touching += 1;+ }+ if (!match) return;+ var direction = 'within';+ if (crossKind) {+ direction = fromKind === selectedKinds[0] ? 'forward' : 'reverse';+ } else {+ direction = fromKind === selectedKinds[0] && toKind !== selectedKinds[0] ? 'out'+ : (toKind === selectedKinds[0] && fromKind !== selectedKinds[0] ? 'in' : 'within');+ }+ matchedFlow.push({ edge: edge, direction: direction });+ edge.members.forEach(function (member) { member.setAttribute('data-lens-match', ''); });+ if (!crossKind) {+ [edge.from, edge.to].forEach(function (id) {+ if (!byId[id]) return;+ byId[id].setAttribute('data-lens-match', '');+ if (!chosen[nodeKind[id]]) byId[id].setAttribute('data-lens-peer', '');+ });+ }+ });++ svg.setAttribute('data-lens-active', selectedKinds.join(' '));+ renderFlowOverlay(matchedFlow);+ if (crossKind) {+ var total = forward + reverse;+ status.textContent = kindLabel(selectedKinds[0]) + ' → ' + kindLabel(selectedKinds[1]) + ': ' + forward + ' · ' ++ kindLabel(selectedKinds[1]) + ' → ' + kindLabel(selectedKinds[0]) + ': ' + reverse + ' · ' ++ total + ' direct relationship' + (total === 1 ? '' : 's');+ } else {+ var nodeCount = collectKinds().filter(function (kind) { return kind.id === selectedKinds[0]; })[0].nodes.length;+ status.textContent = nodeCount + ' ' + kindLabel(selectedKinds[0]) + ' node' + (nodeCount === 1 ? '' : 's') + ' · ' ++ touching + ' touching relationship' + (touching === 1 ? '' : 's') + ' · connected peers remain visible';+ }+ updateTrigger();+ renderKinds();+ dockPanel(byId);+ if (options.updateUrl !== false) updateHash();+ return true;+ }+ function prepareForLens() {+ clearLegendPreview();+ if (Archify.focus && typeof Archify.focus.clear === 'function') {+ Archify.focus.clear({ updateUrl: false, preserveView: true });+ }+ if (Archify.routeProbe && typeof Archify.routeProbe.clear === 'function') {+ Archify.routeProbe.clear({ updateUrl: false, restoreFocus: false });+ }+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') {+ Archify.intentTrace.clear({ announce: false });+ }+ }+ function select(kind, options) {+ options = options || {};+ clearLegendPreview();+ var exists = collectKinds().some(function (entry) { return entry.id === kind; });+ if (!exists) return false;+ var index = selectedKinds.indexOf(kind);+ if (index >= 0) selectedKinds.splice(index, 1);+ else {+ if (selectedKinds.length >= 2) return false;+ if (!selectedKinds.length) prepareForLens();+ selectedKinds.push(kind);+ }+ return applySelection(options);+ }+ function close(options) {+ options = options || {};+ panel.hidden = true;+ trigger.setAttribute('aria-expanded', 'false');+ updateTrigger();+ if (options.restoreFocus !== false && lensOpener && typeof lensOpener.focus === 'function') lensOpener.focus();+ return false;+ }+ function open(options) {+ options = options || {};+ if (html.getAttribute('data-embed') === 'true') return false;+ lensOpener = options.opener || trigger;+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);+ if (Archify.finder && Archify.finder.isOpen()) Archify.finder.close({ restoreFocus: false });+ if (Archify.radar && Archify.radar.isOpen()) Archify.radar.close({ restoreFocus: false });+ if (Archify.guide && Archify.guide.isOpen()) Archify.guide.close({ restoreFocus: false });+ renderKinds();+ panel.hidden = false;+ trigger.setAttribute('aria-expanded', 'true');+ updateTrigger();requestAnimationFrame(function () {- toastEl.textContent = msg;- toastEl.classList.add('show');+ dockPanel(nodesById());+ var activeButton = kindsRoot.querySelector('[aria-pressed="true"]');+ var firstButton = activeButton || kindsRoot.querySelector('button:not(:disabled)');+ if (firstButton) firstButton.focus();});- clearTimeout(toastTimer);- toastTimer = setTimeout(function () { toastEl.classList.remove('show'); }, 1500);+ return true;}-- function open(focusLast) {- menu.classList.add('open');- btn.setAttribute('aria-expanded', 'true');- var available = items().filter(function (i) { return !i.disabled; });- var target = focusLast ? available[available.length - 1] : available[0];- if (target) target.focus();+ function toggle() { return panel.hidden ? open({ opener: trigger }) : close(); }+ function clear(options) {+ options = options || {};+ selectedKinds = [];+ cleanSvgState();+ panel.removeAttribute('data-dock-side');+ updateTrigger();+ renderKinds();+ status.textContent = 'Choose a kind to inspect its nodes and touching relationships.';+ if (options.updateUrl !== false) updateHash();+ if (options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ if (options.closePanel === true) close({ restoreFocus: false });+ return false;}- function close(focusTrigger) {- menu.classList.remove('open');- btn.setAttribute('aria-expanded', 'false');- if (focusTrigger) btn.focus();+ function fallbackCopy(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }+ function copyLink() {+ if (!selectedKinds.length) return Promise.resolve(false);+ var value = location.href.replace(/#.*$/, '') + '#lens=' + selectedKinds.map(encodeURIComponent).join('~');+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })+ : Promise.resolve(fallbackCopy(value));+ return copy.then(function (copied) {+ copyBtn.textContent = copied ? 'Copied' : 'Copy failed';+ window.setTimeout(function () { copyBtn.textContent = 'Copy link'; }, 1600);+ return copied;+ });+ }+ function syncFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var value = params.get('lens');+ if (!value) {+ if (selectedKinds.length) clear({ updateUrl: false, preserveView: true });+ return;+ }+ var available = collectKinds().map(function (kind) { return kind.id; });+ var requested = value.split('~').filter(function (kind, index, list) {+ return available.indexOf(kind) >= 0 && list.indexOf(kind) === index;+ }).slice(0, 2);+ if (!requested.length) return;+ prepareForLens();+ selectedKinds = requested;+ applySelection({ updateUrl: false });+ } catch (_) {}}- function isOpen() { return menu.classList.contains('open'); }- btn.addEventListener('click', function (e) {- e.stopPropagation();- if (isOpen()) close(false);- else open();+ trigger.addEventListener('click', toggle);+ if (decorateLegendBridge()) {+ legendBridge.addEventListener('click', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (entry) activateLegendEntry(entry);+ });+ legendBridge.addEventListener('pointerover', function (event) {+ if (event.pointerType === 'touch' || (finePointerQuery && !finePointerQuery.matches)) return;+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry || (event.relatedTarget && entry.contains(event.relatedTarget))) return;+ hoveredLegendEntry = entry;+ syncLegendPreview();+ });+ legendBridge.addEventListener('pointerout', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry || (event.relatedTarget && entry.contains(event.relatedTarget))) return;+ if (hoveredLegendEntry === entry) hoveredLegendEntry = null;+ syncLegendPreview();+ });+ legendBridge.addEventListener('focusin', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry) return;+ focusedLegendEntry = entry;+ legendEntries.forEach(function (candidate) {+ candidate.setAttribute('tabindex', candidate === entry ? '0' : '-1');+ });+ syncLegendPreview();+ });+ legendBridge.addEventListener('focusout', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry || (event.relatedTarget && entry.contains(event.relatedTarget))) return;+ if (focusedLegendEntry === entry) focusedLegendEntry = null;+ syncLegendPreview();+ });+ legendBridge.addEventListener('keydown', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry) return;+ if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault();+ activateLegendEntry(entry);+ return;+ }+ var index = legendEntries.indexOf(entry);+ var next = null;+ if (event.key === 'ArrowRight') next = (index + 1) % legendEntries.length;+ else if (event.key === 'ArrowLeft') next = (index - 1 + legendEntries.length) % legendEntries.length;+ else if (event.key === 'Home') next = 0;+ else if (event.key === 'End') next = legendEntries.length - 1;+ if (next === null) return;+ event.preventDefault();+ legendEntries.forEach(function (candidate, candidateIndex) {+ candidate.setAttribute('tabindex', candidateIndex === next ? '0' : '-1');+ });+ legendEntries[next].focus();+ });+ }+ closeBtn.addEventListener('click', function () { close(); });+ clearBtn.addEventListener('click', function () { clear({ preserveView: true }); });+ copyBtn.addEventListener('click', copyLink);+ kindsRoot.addEventListener('click', function (event) {+ var button = event.target.closest('[data-kind]');+ if (!button || button.disabled) return;+ select(button.getAttribute('data-kind'));});- // APG menu-button pattern: ArrowDown/ArrowUp on the trigger opens the menu.- btn.addEventListener('keydown', function (e) {- if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {- e.preventDefault();- if (!isOpen()) open(e.key === 'ArrowUp');- }+ kindsRoot.addEventListener('keydown', function (event) {+ var buttons = Array.prototype.slice.call(kindsRoot.querySelectorAll('button:not(:disabled)'));+ var index = buttons.indexOf(document.activeElement);+ var next = null;+ if (index >= 0 && (event.key === 'ArrowRight' || event.key === 'ArrowDown')) next = (index + 1) % buttons.length;+ else if (index >= 0 && (event.key === 'ArrowLeft' || event.key === 'ArrowUp')) next = (index - 1 + buttons.length) % buttons.length;+ else if (event.key === 'Home' && buttons.length) next = 0;+ else if (event.key === 'End' && buttons.length) next = buttons.length - 1;+ if (next !== null) { event.preventDefault(); buttons[next].focus(); }});- document.addEventListener('click', function (e) {- if (!menu.contains(e.target) && e.target !== btn) close(false);+ panel.addEventListener('keydown', function (event) {+ if (event.key !== 'Escape') return;+ event.preventDefault();+ event.stopPropagation();+ close();+ });+ document.addEventListener('click', function (event) {+ var eventPath = typeof event.composedPath === 'function' ? event.composedPath() : [];+ var clickedInside = eventPath.indexOf(panel) >= 0 || panel.contains(event.target);+ var clickedLauncher = event.target === trigger || legendEntries.some(function (entry) {+ return event.target === entry || entry.contains(event.target);+ });+ if (!panel.hidden && !clickedInside && !clickedLauncher) close({ restoreFocus: false });+ });+ window.addEventListener('hashchange', syncFromHash);+ window.addEventListener('resize', function () {+ if (!panel.hidden && selectedKinds.length) dockPanel(nodesById());+ layoutLegendBridge();});+ renderKinds();+ syncFromHash();- // Keyboard navigation inside the menu.- // Menu items: Up/Down, Home/End.- // Esc closes + returns focus to trigger; Tab closes.- menu.addEventListener('keydown', function (e) {- if (e.key === 'Escape') { e.preventDefault(); close(true); return; }- if (e.key === 'Tab') { close(false); return; }+ return {+ open: open,+ close: close,+ toggle: toggle,+ clear: clear,+ clearPreview: clearLegendPreview,+ select: select,+ copyLink: copyLink,+ isOpen: function () { return !panel.hidden; },+ active: function () { return selectedKinds.length ? selectedKinds.slice() : null; },+ kinds: function () { return collectKinds().map(function (kind) { return { id: kind.id, count: kind.nodes.length }; }); }+ };+ })();- var available = items().filter(function (i) { return !i.disabled; });- var current = available.indexOf(document.activeElement);- switch (e.key) {- case 'ArrowDown':- e.preventDefault();- if (available.length) available[(current + 1 + available.length) % available.length].focus();- break;- case 'ArrowUp':- e.preventDefault();- if (available.length) available[(current - 1 + available.length) % available.length].focus();- break;- case 'Home':- e.preventDefault();- if (available[0]) available[0].focus();- break;- case 'End':- e.preventDefault();- if (available.length) available[available.length - 1].focus();- break;- }- });+ /* ============================================================+ Diagram Guide — a factual command deck over existing interactions.+ Counts come from compiled semantics; actions delegate to Finder, Route+ Probe, Semantic Radar, Semantic Lens, Story Trail, Presentation, theme, export, and+ camera without adding a second command implementation or SVG state.+ ============================================================ */+ Archify.guide = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var trigger = document.getElementById('btn-diagram-guide');+ var panel = document.getElementById('diagram-guide');+ var closeBtn = document.getElementById('diagram-guide-close');+ var stats = document.getElementById('diagram-guide-stats');+ var actions = document.getElementById('diagram-guide-actions');+ var feedback = document.getElementById('diagram-guide-feedback');+ var storyBtn = actions.querySelector('[data-guide-action="story"]');+ var storyCopy = document.getElementById('diagram-guide-story-copy');+ var routePanel = document.getElementById('route-probe');- function runExport(format) {- var base = diagramFilename();- close(true);- return (format === 'svg'- ? Promise.resolve(serializeSvg(1, { autoTheme: true })).then(function (d) {- download(new Blob([d.svgString], { type: 'image/svg+xml;charset=utf-8' }), base + '.svg');- })- : rasterize(format).then(function (blob) {- download(blob, base + '.' + format);- })- ).catch(function (err) {- console.error(err);- alert('Export failed: ' + (err && err.message ? err.message : format));+ function viewCount() {+ return Archify.guidedViews && Number(Archify.guidedViews.count) || 0;+ }+ function relationshipCount() {+ var seen = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var key = edge.getAttribute('data-edge-key') || [+ edge.getAttribute('data-edge-from'),+ edge.getAttribute('data-edge-to'),+ edge.getAttribute('data-edge-label') || ''+ ].join('\u0000');+ seen[key] = true;});+ return Object.keys(seen).length;}-- function runCopy() {- close(true);- if (!canCopyImage()) {- alert('Clipboard image write not supported in this browser.');- return;+ function renderFacts() {+ var nodes = svg.querySelectorAll('[data-node-id]').length;+ var relationships = relationshipCount();+ var views = viewCount();+ stats.textContent = nodes + ' semantic node' + (nodes === 1 ? '' : 's') + ' · ' ++ relationships + ' relationship' + (relationships === 1 ? '' : 's') + ' · ' ++ views + ' guided view' + (views === 1 ? '' : 's');+ storyBtn.disabled = views === 0;+ storyBtn.setAttribute('aria-disabled', views === 0 ? 'true' : 'false');+ storyCopy.textContent = views+ ? 'Walk ' + views + ' authored chapter' + (views === 1 ? '' : 's') + ' and their real relationships.'+ : 'No authored guided story in this diagram.';+ }+ function actionButtons() {+ return Array.prototype.slice.call(actions.querySelectorAll('.diagram-guide-action:not(:disabled)'));+ }+ function close(options) {+ options = options || {};+ panel.hidden = true;+ html.removeAttribute('data-guide-open');+ routePanel.removeAttribute('data-guide-open');+ trigger.setAttribute('aria-expanded', 'false');+ trigger.setAttribute('aria-label', 'Open diagram guide');+ feedback.textContent = '';+ if (options.restoreFocus !== false) trigger.focus();+ return false;+ }+ function open() {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);+ if (Archify.finder && Archify.finder.isOpen()) Archify.finder.close({ restoreFocus: false });+ if (Archify.radar && Archify.radar.isOpen()) Archify.radar.close({ restoreFocus: false });+ if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });+ if (Archify.guidedViews && Archify.guidedViews.isPlaying && Archify.guidedViews.isPlaying()) {+ Archify.guidedViews.pause();}- // WebKit requires ClipboardItem to be constructed synchronously inside- // the user gesture — pass the pending Promise<Blob> as the item value.- // Browsers that reject promise values throw synchronously; fall back- // to awaiting the blob first (works in Chromium/Firefox).- var blobPromise = rasterize('png');- var writePromise;- try {- writePromise = navigator.clipboard.write([new ClipboardItem({ 'image/png': blobPromise })]);- } catch (_) {- writePromise = blobPromise.then(function (blob) {- return navigator.clipboard.write([new ClipboardItem({ 'image/png': blob })]);- });+ if (Archify.routeProbe && Archify.routeProbe.isJourneyPlaying && Archify.routeProbe.isJourneyPlaying()) {+ Archify.routeProbe.pauseJourney({ preserveElapsed: true, reason: 'guide' });}- return writePromise.then(function () {- toast('Copied PNG to clipboard');- }).catch(function (err) {- console.error(err);- alert('Copy failed: ' + (err && err.message ? err.message : 'unknown'));+ renderFacts();+ panel.hidden = false;+ html.setAttribute('data-guide-open', 'true');+ routePanel.setAttribute('data-guide-open', 'true');+ trigger.setAttribute('aria-expanded', 'true');+ trigger.setAttribute('aria-label', 'Close diagram guide');+ feedback.textContent = '';+ requestAnimationFrame(function () {+ var first = actionButtons()[0];+ if (first) first.focus();});+ return true;+ }+ function toggle() { return panel.hidden ? open() : close(); }+ function execute(action) {+ feedback.textContent = '';+ if (action === 'story' && !viewCount()) {+ feedback.textContent = 'This diagram has no authored guided story.';+ return false;+ }+ close({ restoreFocus: false });+ if (action === 'find') return Archify.finder.open();+ if (action === 'route') return Archify.routeProbe.begin({ focusNode: true });+ if (action === 'map') return Archify.radar.open();+ if (action === 'lens') return Archify.semanticLens.open();+ if (action === 'story') return Archify.guidedViews.play();+ if (action === 'present') return Archify.presentation.enter();+ if (action === 'export') return Archify.exportMenu.open();+ if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();+ if (action === 'reset') return Archify.view.reset();+ if (action === 'zoom-in') return Archify.view.zoomIn();+ if (action === 'zoom-out') return Archify.view.zoomOut();+ return false;+ }+ function actionForKey(key) {+ return {+ '/': 'find',+ r: 'route',+ m: 'map',+ l: 'lens',+ p: 'story',+ f: 'present',+ e: 'export',+ t: 'theme',+ s: 'preset',+ '0': 'reset',+ '+': 'zoom-in',+ '=': 'zoom-in',+ '-': 'zoom-out'+ }[key] || null;}- menu.addEventListener('click', function (e) {- var copyBtn = e.target.closest('button[data-action="copy"]');- if (copyBtn && !copyBtn.disabled) { runCopy(); return; }-- var formatBtn = e.target.closest('button[data-format]');- if (formatBtn && !formatBtn.disabled) { runExport(formatBtn.dataset.format); }+ trigger.addEventListener('click', toggle);+ closeBtn.addEventListener('click', function () { close(); });+ actions.addEventListener('click', function (event) {+ var button = event.target.closest('[data-guide-action]');+ if (!button || button.disabled) return;+ event.stopPropagation();+ execute(button.getAttribute('data-guide-action'));+ });+ panel.addEventListener('keydown', function (event) {+ if (event.key === 'Escape' || event.key === '?') {+ event.preventDefault();+ event.stopPropagation();+ close();+ return;+ }+ var buttons = actionButtons();+ var index = buttons.indexOf(document.activeElement);+ var next = null;+ if (index >= 0 && event.key === 'ArrowRight') next = (index + 1) % buttons.length;+ else if (index >= 0 && event.key === 'ArrowDown') next = (index + 1) % buttons.length;+ else if (index >= 0 && event.key === 'ArrowLeft') next = (index - 1 + buttons.length) % buttons.length;+ else if (index >= 0 && event.key === 'ArrowUp') next = (index - 1 + buttons.length) % buttons.length;+ else if (event.key === 'Home' && buttons.length) next = 0;+ else if (event.key === 'End' && buttons.length) next = buttons.length - 1;+ if (next !== null) {+ event.preventDefault();+ event.stopPropagation();+ buttons[next].focus();+ return;+ }+ var action = actionForKey(event.key.length === 1 ? event.key.toLowerCase() : event.key);+ if (!action) return;+ event.preventDefault();+ event.stopPropagation();+ execute(action);+ });+ document.addEventListener('click', function (event) {+ if (!panel.hidden && !panel.contains(event.target) && event.target !== trigger) close({ restoreFocus: false });});- Archify.exportMenu = { open: open, close: close, isOpen: isOpen, run: runExport };-- // Auto-open on page load for demo/screenshot purposes: ?openExport=1- // Wait for fonts (so the menu doesn't flash before typography lands)- // and paint before opening. Fallback timeout for browsers without the- // Font Loading API.- try {- if (new URLSearchParams(window.location.search).get('openExport') === '1') {- var openWhenReady = function () {- requestAnimationFrame(function () { requestAnimationFrame(open); });+ renderFacts();+ return {+ open: open,+ close: close,+ toggle: toggle,+ execute: execute,+ isOpen: function () { return !panel.hidden; },+ facts: function () {+ return {+ nodes: svg.querySelectorAll('[data-node-id]').length,+ relationships: relationshipCount(),+ views: viewCount()};- if (document.fonts && document.fonts.ready) {- document.fonts.ready.then(openWhenReady);- } else {- setTimeout(openWhenReady, 200);- }}- } catch (_) {}+ };})();/* ============================================================Global keyboard shortcuts- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menu+ F -> toggle presentation stage+ M -> toggle Semantic Radar+ L -> toggle Semantic Lens+ R -> start/clear Route Probe+ / -> open node finder or the active route endpoint picker+ + / - -> zoom, 0 -> reset view+ Escape -> clear temporary trace/focus/view first, then exit presentationIgnored when focus is inside an input/textarea/contenteditable.============================================================ */document.addEventListener('keydown', function (e) {if (e.metaKey || e.ctrlKey || e.altKey) return;+ if (e.defaultPrevented) return;var t = e.target;if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;- if (e.key === 't' || e.key === 'T') {+ if (e.key === '?') {+ e.preventDefault();+ Archify.guide.toggle();+ } else if (e.key === '/') {+ e.preventDefault();+ Archify.finder.open();+ } else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();+ } else if (e.key === 'f' || e.key === 'F') {+ e.preventDefault();+ Archify.presentation.toggle();+ } else if (e.key === 'm' || e.key === 'M') {+ e.preventDefault();+ Archify.radar.toggle();+ } else if (e.key === 'l' || e.key === 'L') {+ e.preventDefault();+ Archify.semanticLens.toggle();+ } else if (e.key === 'r' || e.key === 'R') {+ e.preventDefault();+ Archify.routeProbe.toggle({ focusNode: true });+ } else if (e.key === '+' || e.key === '=') {+ e.preventDefault();+ Archify.view.zoomIn();+ } else if (e.key === '-') {+ e.preventDefault();+ Archify.view.zoomOut();+ } else if (e.key === '0') {+ e.preventDefault();+ Archify.view.reset();+ } else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {+ e.preventDefault();+ Archify.semanticLens.close({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.semanticLens.active()) {+ e.preventDefault();+ Archify.semanticLens.clear({ preserveView: true });+ } else if (e.key === 'Escape' && Archify.guide.isOpen()) {+ e.preventDefault();+ Archify.guide.close({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.radar.isOpen()) {+ e.preventDefault();+ Archify.radar.close({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.routeProbe.active()) {+ e.preventDefault();+ Archify.routeProbe.escape({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.intentTrace.active()) {+ e.preventDefault();+ Archify.intentTrace.clear();+ } else if (e.key === 'Escape' && Archify.focus.active()) {+ e.preventDefault();+ Archify.focus.clear();+ } else if (e.key === 'Escape' && Archify.presentation.active()) {+ e.preventDefault();+ Archify.presentation.exit();}});</script>diff --git a/examples/archify-repo.html b/examples/archify-repo.htmlindex 10fb61c2..5ce3810b 100644--- a/examples/archify-repo.html+++ b/examples/archify-repo.html@@ -1,9 +1,9 @@<!DOCTYPE html>-<html lang="en" data-theme="dark">+<html lang="en" data-theme="dark" data-preset="classic"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">- <meta name="generator" content="archify 2.10.0">+ <meta name="generator" content="archify 2.11.0"><title>Archify Diagram</title><script>// Resolve the theme before first paint so light-preference users don't@@ -14,6 +14,12 @@try {var param = new URLSearchParams(window.location.search).get('theme');if (param === 'light' || param === 'dark') theme = param;+ if (new URLSearchParams(window.location.search).get('embed') === '1') {+ document.documentElement.setAttribute('data-embed', 'true');+ }+ if (new URLSearchParams(window.location.search).get('present') === '1') {+ document.documentElement.setAttribute('data-present', 'true');+ }} catch (_) {}if (!theme) {try { theme = localStorage.getItem('archify-theme'); } catch (_) {}@@ -121,6 +127,150 @@--toolbar-menu-bg: #ffffff;}+ /* ==========================================================+ SIGNAL FLOW — an opt-in, motion-forward visual preset.+ The variables also target a standalone exported SVG, whose+ root carries data-preset and data-theme directly.+ ========================================================== */+ [data-preset="signal-flow"][data-theme="dark"] {+ --bg: #030711;+ --grid: #15233a;+ --panel: rgba(6, 14, 28, 0.78);+ --panel-border: #1d3350;+ --lane-fill: rgba(9, 22, 40, 0.5);+ --lane-stroke: #2c4564;+ --text: #f5fbff;+ --text-muted: #9eb0c7;+ --text-dim: #52667f;+ --text-faint: #7890ad;+ --mask: #07101e;+ --frontend-fill: rgba(6, 182, 212, 0.14);+ --frontend-stroke: #67e8f9;+ --backend-fill: rgba(16, 185, 129, 0.14);+ --backend-stroke: #5eead4;+ --database-fill: rgba(139, 92, 246, 0.16);+ --database-stroke: #c4b5fd;+ --cloud-fill: rgba(245, 158, 11, 0.13);+ --cloud-stroke: #fcd34d;+ --security-fill: rgba(244, 63, 94, 0.13);+ --security-stroke: #fda4af;+ --messagebus-fill: rgba(249, 115, 22, 0.13);+ --messagebus-stroke: #fdba74;+ --external-fill: rgba(71, 85, 105, 0.24);+ --external-stroke: #a5b4c7;+ --arrow: #7890ad;+ --arrow-emphasis: #2dd4bf;+ --toolbar-bg: rgba(7, 16, 30, 0.86);+ --toolbar-border: #29415f;+ --toolbar-menu-bg: #07101e;+ }++ [data-preset="signal-flow"][data-theme="light"] {+ --bg: #f4f9fc;+ --grid: #d4e5ee;+ --panel: rgba(255, 255, 255, 0.82);+ --panel-border: #bfd5e2;+ --lane-fill: rgba(232, 243, 248, 0.62);+ --lane-stroke: #a9c5d5;+ --text: #102638;+ --text-muted: #587287;+ --text-dim: #8aa2b4;+ --text-faint: #668397;+ --mask: #ffffff;+ --frontend-fill: rgba(6, 182, 212, 0.09);+ --frontend-stroke: #0789a1;+ --backend-fill: rgba(5, 150, 105, 0.09);+ --backend-stroke: #087f69;+ --database-fill: rgba(124, 58, 237, 0.09);+ --database-stroke: #7254c7;+ --cloud-fill: rgba(217, 119, 6, 0.08);+ --cloud-stroke: #b9670b;+ --security-fill: rgba(225, 29, 72, 0.08);+ --security-stroke: #c53a59;+ --messagebus-fill: rgba(234, 88, 12, 0.08);+ --messagebus-stroke: #c65f27;+ --external-fill: rgba(100, 116, 139, 0.1);+ --external-stroke: #607a8c;+ --arrow: #7b97aa;+ --arrow-emphasis: #0d9488;+ }++ /* ==========================================================+ BLUEPRINT — a review-first drafting preset for deployment,+ infrastructure, and technical design documentation. It keeps+ the same semantic palette and geometry while trading glow for+ precise grid contrast, squared materials, and drafting marks.+ ========================================================== */+ [data-preset="blueprint"][data-theme="dark"] {+ --bg: #06131f;+ --grid: #17425a;+ --panel: rgba(7, 27, 43, 0.9);+ --panel-border: #27627f;+ --lane-fill: rgba(10, 43, 66, 0.36);+ --lane-stroke: #34799a;+ --text: #e3f6ff;+ --text-muted: #91b8ca;+ --text-dim: #557e92;+ --text-faint: #739caf;+ --mask: #0a2031;+ --frontend-fill: rgba(26, 157, 193, 0.14);+ --frontend-stroke: #66d9ef;+ --backend-fill: rgba(31, 155, 124, 0.13);+ --backend-stroke: #69dfbd;+ --database-fill: rgba(120, 105, 196, 0.14);+ --database-stroke: #b4a8ff;+ --cloud-fill: rgba(197, 145, 43, 0.13);+ --cloud-stroke: #ffd166;+ --security-fill: rgba(199, 76, 104, 0.13);+ --security-stroke: #ff8da1;+ --messagebus-fill: rgba(207, 112, 49, 0.13);+ --messagebus-stroke: #ffad66;+ --external-fill: rgba(84, 119, 139, 0.18);+ --external-stroke: #a7cad9;+ --arrow: #78a3b7;+ --arrow-emphasis: #64dfc1;+ --toolbar-bg: rgba(7, 28, 45, 0.92);+ --toolbar-border: #34799a;+ --toolbar-text: #d8f3ff;+ --toolbar-hover: rgba(18, 58, 83, 0.95);+ --toolbar-menu-bg: #0a2031;+ }++ [data-preset="blueprint"][data-theme="light"] {+ --bg: #edf7fa;+ --grid: #b5d5e1;+ --panel: rgba(249, 253, 255, 0.94);+ --panel-border: #78aabd;+ --lane-fill: rgba(210, 232, 240, 0.42);+ --lane-stroke: #83b2c4;+ --text: #123344;+ --text-muted: #4e7486;+ --text-dim: #86a6b4;+ --text-faint: #668c9d;+ --mask: #f9fdff;+ --frontend-fill: rgba(8, 145, 178, 0.08);+ --frontend-stroke: #087f9c;+ --backend-fill: rgba(5, 128, 101, 0.08);+ --backend-stroke: #08755f;+ --database-fill: rgba(100, 75, 180, 0.08);+ --database-stroke: #6757a8;+ --cloud-fill: rgba(181, 120, 15, 0.08);+ --cloud-stroke: #a86609;+ --security-fill: rgba(190, 48, 80, 0.07);+ --security-stroke: #b32f50;+ --messagebus-fill: rgba(196, 81, 22, 0.07);+ --messagebus-stroke: #b65120;+ --external-fill: rgba(79, 112, 128, 0.08);+ --external-stroke: #506f7e;+ --arrow: #6d93a5;+ --arrow-emphasis: #087f69;+ --toolbar-bg: rgba(247, 252, 254, 0.94);+ --toolbar-border: #8ab5c5;+ --toolbar-text: #294f61;+ --toolbar-hover: #ffffff;+ --toolbar-menu-bg: #f9fdff;+ }+* { margin: 0; padding: 0; box-sizing: border-box; }body {@@ -132,9 +282,233 @@transition: background 0.2s ease, color 0.2s ease;}+ html[data-preset="signal-flow"] body {+ background-image:+ radial-gradient(circle at 18% -8%, rgba(34, 211, 238, 0.14), transparent 34rem),+ radial-gradient(circle at 92% 18%, rgba(139, 92, 246, 0.12), transparent 30rem);+ background-attachment: fixed;+ }+ html[data-preset="signal-flow"][data-theme="light"] body {+ background-image:+ radial-gradient(circle at 18% -8%, rgba(6, 182, 212, 0.12), transparent 34rem),+ radial-gradient(circle at 92% 18%, rgba(139, 92, 246, 0.08), transparent 30rem);+ }+ html[data-preset="blueprint"] body {+ background-image:+ linear-gradient(var(--grid) 1px, transparent 1px),+ linear-gradient(90deg, var(--grid) 1px, transparent 1px);+ background-size: 32px 32px;+ background-position: -1px -1px;+ background-attachment: fixed;+ }++ /* Gallery/embed mode keeps the generated artifact as the source of truth+ while presenting only its diagram surface inside a proof card. */+ html[data-embed="true"] body {+ min-height: 0;+ padding: 0;+ overflow: hidden;+ background: var(--bg);+ background-image: none;+ }+ html[data-embed="true"] .toolbar,+ html[data-embed="true"] .header,+ html[data-embed="true"] .cards,+ html[data-embed="true"] .footer,+ html[data-embed="true"] .diagram-nav,+ html[data-embed="true"] .overview-map,+ html[data-embed="true"] .focus-chip,+ html[data-embed="true"] .route-probe,+ html[data-embed="true"] .semantic-lens,+ html[data-embed="true"] .diagram-guide,+ html[data-embed="true"] .node-finder,+ html[data-embed="true"] .guided-views { display: none !important; }+ html[data-embed="true"] .container { max-width: none; }+ html[data-embed="true"] .diagram-container {+ padding: 0.5rem;+ border: 0;+ border-radius: 0;+ box-shadow: none;+ }+ html[data-embed="true"] .diagram-container svg { min-width: 0; }++ /* Share Chapter Cue lives in the HTML viewer layer, not inside the SVG.+ It gives one-shot embeds a title, authored note, truthful stop order,+ and lifecycle state while canonical diagram geometry stays untouched. */+ .share-chapter-cue { display: none; }+ html[data-embed="true"][data-share-playback="true"] .share-chapter-cue:not([hidden]),+ html[data-embed="true"][data-share-moment="true"] .share-chapter-cue:not([hidden]) {+ position: absolute;+ z-index: 18;+ top: 0.85rem;+ left: 50%;+ display: grid;+ grid-template-columns: auto minmax(9rem, 13.5rem) minmax(0, 1fr);+ align-items: center;+ gap: 0.45rem 0.85rem;+ width: min(52rem, calc(100% - 1.5rem));+ min-height: 3.35rem;+ padding: 0.55rem 0.75rem 0.65rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 42%, var(--toolbar-border));+ border-radius: 0.75rem;+ background:+ linear-gradient(115deg, color-mix(in srgb, var(--frontend-fill) 52%, transparent), transparent 45%),+ color-mix(in srgb, var(--toolbar-menu-bg) 92%, transparent);+ color: var(--toolbar-text);+ box-shadow: 0 14px 42px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.045);+ backdrop-filter: blur(16px);+ pointer-events: none;+ animation: archify-share-cue-enter 280ms cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ html[data-preset="blueprint"] .share-chapter-cue {+ border-radius: 0.2rem;+ background:+ linear-gradient(90deg, color-mix(in srgb, var(--frontend-fill) 46%, transparent), transparent 36%),+ var(--toolbar-menu-bg);+ box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);+ backdrop-filter: none;+ }+ .share-chapter-index {+ display: grid;+ gap: 0.12rem;+ min-width: 5rem;+ padding-right: 0.75rem;+ border-right: 1px solid var(--toolbar-border);+ }+ .share-chapter-state {+ display: inline-flex;+ align-items: center;+ gap: 0.36rem;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.14em;+ text-transform: uppercase;+ }+ .share-chapter-state::before {+ width: 0.38rem;+ height: 0.38rem;+ border-radius: 50%;+ background: currentColor;+ box-shadow: 0 0 10px currentColor;+ content: '';+ }+ .share-chapter-cue[data-state="playing"] .share-chapter-state::before {+ animation: archify-share-cue-pulse 1.15s ease-in-out infinite;+ }+ .share-chapter-count {+ color: var(--text-faint);+ font-size: 0.5rem;+ font-weight: 700;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ }+ .share-chapter-copy { min-width: 0; }+ .share-chapter-copy strong,+ .share-chapter-copy small,+ .share-chapter-route {+ display: block;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .share-chapter-copy strong {+ color: var(--toolbar-text);+ font-size: 0.6875rem;+ line-height: 1.35;+ }+ .share-chapter-copy small {+ margin-top: 0.08rem;+ color: var(--text-muted);+ font-size: 0.5rem;+ line-height: 1.35;+ }+ .share-chapter-route {+ color: color-mix(in srgb, var(--frontend-stroke) 76%, var(--text-muted));+ font-size: 0.5625rem;+ font-weight: 650;+ letter-spacing: 0.015em;+ text-align: right;+ }+ .share-chapter-progress {+ position: absolute;+ right: 0;+ bottom: 0;+ left: 0;+ height: 2px;+ overflow: hidden;+ background: color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ }+ .share-chapter-progress span {+ display: block;+ width: 100%;+ height: 100%;+ background: linear-gradient(90deg, var(--frontend-stroke), var(--database-stroke));+ box-shadow: 0 0 12px var(--frontend-stroke);+ transform: scaleX(0);+ transform-origin: left center;+ }++ /* Presentation Stage is a viewer-only layer: it gives the live diagram+ the viewport while keeping guided views, theme, focus, and exports real.+ Embed mode wins when both query parameters are present. */+ html[data-present="true"]:not([data-embed="true"]) body {+ height: 100dvh;+ min-height: 0;+ padding: 1rem;+ overflow: hidden;+ }+ html[data-present="true"]:not([data-embed="true"]) .container {+ display: flex;+ flex-direction: column;+ gap: 0.75rem;+ width: 100%;+ max-width: none;+ height: calc(100dvh - 2rem);+ }+ html[data-present="true"]:not([data-embed="true"]) .header {+ flex: none;+ min-width: 0;+ margin: 0;+ padding-right: 23rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .header-row { margin-bottom: 0.25rem; }+ html[data-present="true"]:not([data-embed="true"]) .subtitle {+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ html[data-present="true"]:not([data-embed="true"]) .guided-views {+ flex: none;+ margin-bottom: 0;+ }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container {+ display: flex;+ flex: 1 1 auto;+ align-items: center;+ justify-content: center;+ min-height: 0;+ padding: 0.75rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container > svg {+ width: 100%;+ height: 100%;+ min-width: 0;+ }+ html[data-present="true"]:not([data-embed="true"]) .cards,+ html[data-present="true"]:not([data-embed="true"]) .footer { display: none; }+ html[data-present="true"]:not([data-embed="true"]) #btn-present {+ border-color: var(--frontend-stroke);+ color: var(--frontend-stroke);+ }+.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }++ html[data-preset="signal-flow"] .header,+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -148,9 +522,11 @@height: 12px;background: var(--frontend-stroke);border-radius: 50%;- animation: pulse 2s infinite;+ animation: none;}+ html[data-motion-capable="true"] .pulse-dot { animation: pulse 2s infinite; }+@keyframes pulse {0%, 100% { opacity: 1; }50% { opacity: 0.5; }@@ -168,337 +544,3240 @@margin-left: 1.75rem;}+ html[data-preset="signal-flow"] .header-row::after {+ content: "SIGNAL FLOW";+ margin-left: auto;+ color: var(--frontend-stroke);+ border: 1px solid var(--frontend-stroke);+ border-radius: 999px;+ padding: 0.28rem 0.6rem;+ font-size: 0.625rem;+ letter-spacing: 0.12em;+ opacity: 0.82;+ box-shadow: 0 0 20px rgba(34, 211, 238, 0.12);+ white-space: nowrap;+ }++ html[data-preset="blueprint"] .pulse-dot {+ width: 10px;+ height: 10px;+ border: 1px solid var(--frontend-stroke);+ border-radius: 1px;+ background: transparent;+ box-shadow: inset 0 0 0 2px var(--bg);+ transform: rotate(45deg);+ animation: none;+ }+ html[data-preset="blueprint"] .header-row::after {+ content: "BLUEPRINT / REV 01";+ margin-left: auto;+ padding: 0.28rem 0.55rem;+ border-top: 1px solid var(--frontend-stroke);+ border-bottom: 1px solid var(--frontend-stroke);+ color: var(--frontend-stroke);+ font-size: 0.5625rem;+ font-weight: 700;+ letter-spacing: 0.14em;+ white-space: nowrap;+ }+.diagram-container {background: var(--panel);border-radius: 1rem;border: 1px solid var(--panel-border);padding: 1.5rem;- overflow-x: auto;+ overflow: hidden;+ position: relative;}- svg {- width: 100%;- min-width: min(900px, 100%);- display: block;+ html[data-preset="signal-flow"] .diagram-container {+ position: relative;+ overflow: hidden;+ background: linear-gradient(180deg, rgba(8, 20, 38, 0.82), rgba(3, 8, 18, 0.94));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 28px 80px rgba(0, 0, 0, 0.34);}-- .cards {- display: grid;- grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));- gap: 1rem;- margin-top: 2rem;+ html[data-preset="signal-flow"][data-theme="light"] .diagram-container {+ background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(237, 246, 250, 0.94));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 24px 60px rgba(45, 78, 99, 0.12);}-- .card {+ html[data-preset="blueprint"] .diagram-container {+ border-color: var(--panel-border);+ border-radius: 0.35rem;background: var(--panel);- border-radius: 0.75rem;- border: 1px solid var(--panel-border);- padding: 1.25rem;+ box-shadow:+ inset 0 0 0 1px color-mix(in srgb, var(--panel-border) 34%, transparent),+ 0 18px 48px rgba(0, 0, 0, 0.16);}-- .card-header {- display: flex;- align-items: center;- gap: 0.5rem;- margin-bottom: 0.75rem;+ html[data-preset="blueprint"] .diagram-container::after {+ content: "";+ position: absolute;+ z-index: 10;+ inset: 0.7rem;+ pointer-events: none;+ background:+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left top / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left top / 1px 1.35rem no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right top / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right top / 1px 1.35rem no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left bottom / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left bottom / 1px 1.35rem no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right bottom / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right bottom / 1px 1.35rem no-repeat;+ opacity: 0.58;}-- .card-dot {- width: 8px;- height: 8px;- border-radius: 50%;+ html[data-motion-capable="true"][data-preset="signal-flow"][data-ambient-motion="running"] .diagram-container::before {+ content: "";+ position: absolute;+ inset: 0;+ pointer-events: none;+ background: linear-gradient(115deg, transparent 28%, rgba(103, 232, 249, 0.035) 48%, transparent 68%);+ transform: translateX(-70%);+ animation: archify-signal-scan 4.8s ease-in-out 1 both;}- .card-dot.cyan { background: var(--frontend-stroke); }- .card-dot.emerald { background: var(--backend-stroke); }- .card-dot.violet { background: var(--database-stroke); }- .card-dot.amber { background: var(--cloud-stroke); }- .card-dot.rose { background: var(--security-stroke); }- .card-dot.orange { background: var(--messagebus-stroke); }- .card-dot.slate { background: var(--external-stroke); }-- .card h3 { font-size: 0.875rem; font-weight: 600; color: var(--text); }-- .card ul {- list-style: none;- color: var(--text-muted);- font-size: 0.75rem;+ /* Motion Governor gives the reader a real static state and gives the+ strongest semantic action the only motion budget. Atmosphere resets to+ its authored base instead of freezing mid-cycle. Static artifacts never+ start a decorative pulse or scan. */+ html:not([data-motion-capable="true"]) svg[data-animation="trace"] [data-animate] {+ animation: none !important;}-- .card li { margin-bottom: 0.375rem; }-- .footer {- text-align: center;- margin-top: 1.5rem;- color: var(--text-faint);- font-size: 0.75rem;+ html[data-motion="still"] .pulse-dot,+ html[data-motion="still"] .diagram-container::before,+ html[data-motion="still"] svg[data-animation="trace"] [data-animate],+ html[data-motion-owner] .pulse-dot,+ html[data-motion-owner] .diagram-container::before,+ html[data-motion-owner] svg[data-animation="trace"] [data-animate],+ html[data-embed="true"] .pulse-dot,+ html[data-embed="true"] .diagram-container::before,+ html[data-share-playback="true"] .pulse-dot,+ html[data-share-playback="true"] .diagram-container::before,+ html[data-document-hidden="true"] .pulse-dot,+ html[data-document-hidden="true"] .diagram-container::before,+ html[data-document-hidden="true"] svg[data-animation="trace"] [data-animate] {+ animation: none !important;+ }+ html[data-motion="still"] .diagram-container::before,+ html[data-motion-owner] .diagram-container::before,+ html[data-embed="true"] .diagram-container::before,+ html[data-share-playback="true"] .diagram-container::before {+ opacity: 0;+ }+ html[data-motion="still"] .guided-view-progress span,+ html[data-motion="still"] .guided-story-caption,+ html[data-motion="still"] .story-trail-flow,+ html[data-motion="still"] .intent-trace-flow,+ html[data-motion="still"] .route-probe-flow,+ html[data-motion="still"] .route-journey-flow,+ html[data-motion="still"] .semantic-lens-flow,+ html[data-motion="still"] .diagram-guide,+ html[data-motion="still"] [data-story-step],+ html[data-motion="still"] .overview-map-live,+ html[data-motion="still"] .guided-view-stop,+ html[data-motion="still"] .share-chapter-cue,+ html[data-motion="still"] .share-chapter-state::before,+ html[data-motion="still"] .share-chapter-progress span,+ html[data-document-hidden="true"] .guided-view-progress span,+ html[data-document-hidden="true"] .story-trail-flow,+ html[data-document-hidden="true"] .intent-trace-flow,+ html[data-document-hidden="true"] .route-probe-flow,+ html[data-document-hidden="true"] .route-journey-flow,+ html[data-document-hidden="true"] .semantic-lens-flow,+ html[data-document-hidden="true"] .diagram-guide,+ html[data-document-hidden="true"] [data-story-step],+ html[data-document-hidden="true"] .overview-map-live,+ html[data-document-hidden="true"] .guided-view-stop,+ html[data-document-hidden="true"] .share-chapter-cue,+ html[data-document-hidden="true"] .share-chapter-state::before,+ html[data-document-hidden="true"] .share-chapter-progress span {+ animation: none !important;+ }+ html[data-motion="still"] .guided-view-progress span {+ transform: scaleX(1) !important;+ }+ html[data-motion="still"] svg[data-story-playing="true"] .story-trail-flow {+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.55;+ }+ html[data-motion="still"] .intent-trace-flow,+ html[data-motion="still"] .route-probe-flow {+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.72;+ }+ html[data-motion="still"] .route-journey-overlay,+ html[data-document-hidden="true"] .route-journey-overlay { display: none !important; }+ html[data-motion="still"] .relationship-pulse-overlay,+ html[data-motion="still"] .story-carrier-overlay,+ html[data-document-hidden="true"] .story-carrier-overlay { display: none !important; }+ html[data-motion="still"] .chapter-handoff-overlay { display: none !important; }+ html[data-motion="still"] .chapter-handoff-anchor { animation: none !important; }+ html[data-motion="still"] .guided-view-chapter,+ html[data-motion="still"] svg [data-node-id],+ html[data-motion="still"] svg [data-edge-from],+ html[data-motion="still"] svg [data-detail],+ html[data-motion="still"] svg [data-detail-anchor],+ html[data-motion="still"] svg [data-legend-hit],+ html[data-motion="still"] svg {+ transition: none !important;}- /* ==========================================================- Print stylesheet — hide interactive controls, force light,- drop the grid so the diagram doesn't waste ink, use landscape- so wide diagrams fit, pack summary cards into 2 columns to- avoid an orphan card on a trailing page.- ========================================================== */- @page { size: landscape; margin: 1.5cm; }+ svg {+ width: 100%;+ min-width: min(900px, 100%);+ display: block;+ transform-origin: 0 0;+ transition: transform 0.18s ease;+ }- @media print {- /* Force the FULL light palette — including component fills/strokes and- lane/arrow colors — so printing from dark theme doesn't put neon- strokes and translucent dark fills on white paper. */- :root, [data-theme="dark"], [data-theme="light"] {- --bg: #ffffff;- --grid: transparent;- --panel: #ffffff;- --panel-border: #e2e8f0;- --text: #0f172a;- --text-muted: #475569;- --text-dim: #94a3b8;- --text-faint: #64748b;- --mask: #ffffff;- --lane-fill: rgba(248, 250, 252, 0.65);- --lane-stroke: #cbd5e1;- --arrow: #94a3b8;- --arrow-emphasis: #059669;- --frontend-fill: rgba(34, 211, 238, 0.15);- --frontend-stroke: #0891b2;- --backend-fill: rgba(52, 211, 153, 0.18);- --backend-stroke: #059669;- --database-fill: rgba(167, 139, 250, 0.2);- --database-stroke: #7c3aed;- --cloud-fill: rgba(251, 191, 36, 0.18);- --cloud-stroke: #d97706;- --security-fill: rgba(251, 113, 133, 0.15);- --security-stroke: #e11d48;- --messagebus-fill: rgba(251, 146, 60, 0.15);- --messagebus-stroke:#ea580c;- --external-fill: rgba(148, 163, 184, 0.18);- --external-stroke: #64748b;- }- body { background: #ffffff !important; padding: 0; }- .container { max-width: none; }- .toolbar, .archify-toast, .no-print { display: none !important; }- .diagram-container, .card { box-shadow: none; border-color: #e2e8f0; }- .cards { grid-template-columns: 1fr 1fr; }- /* Ensure elements break sensibly across pages */- .card { break-inside: avoid; page-break-inside: avoid; }- .diagram-container { break-inside: avoid; page-break-inside: avoid; }- h1, .subtitle { color: #0f172a; }+ .diagram-container.is-camera-moving svg {+ transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);}+ .diagram-container.is-camera-transaction svg { transition: none; }+ .diagram-container.is-pannable { cursor: grab; }+ .diagram-container.is-panning { cursor: grabbing; user-select: none; }+ .diagram-container.is-panning svg { transition: none; }- /* ==========================================================- TOOLBAR (theme toggle + export menu)- ========================================================== */- .toolbar {- position: fixed;- top: 1rem;+ .diagram-nav {+ position: absolute;right: 1rem;- display: flex;- gap: 0.5rem;- z-index: 100;- }- .toolbar button {+ bottom: 1rem;+ z-index: 12;+ display: inline-flex;+ align-items: center;+ padding: 0.25rem;+ gap: 0.2rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.65rem;background: var(--toolbar-bg);+ box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);+ backdrop-filter: blur(10px);+ }+ .diagram-nav button,+ .focus-chip button,+ .guided-views button {+ border: 0;+ background: transparent;color: var(--toolbar-text);- border: 1px solid var(--toolbar-border);- padding: 0.5rem 0.875rem;- border-radius: 0.5rem;- font-family: inherit;- font-size: 0.75rem;- font-weight: 500;+ font: inherit;cursor: pointer;- backdrop-filter: blur(8px);- transition: background 0.15s, border-color 0.15s;- display: inline-flex;- align-items: center;- gap: 0.375rem;}- .toolbar button:hover {- background: var(--toolbar-hover);- border-color: var(--arrow);+ .diagram-nav button {+ min-width: 2rem;+ height: 2rem;+ padding: 0 0.45rem;+ border-radius: 0.4rem;+ font-size: 0.75rem;+ font-weight: 600;}- .toolbar button:focus-visible {+ .diagram-nav button:hover,+ .diagram-nav button:focus-visible,+ .focus-chip button:hover,+ .focus-chip button:focus-visible,+ .guided-views button:hover,+ .guided-views button:focus-visible { background: var(--toolbar-hover); }+ .diagram-nav button:focus-visible,+ .focus-chip button:focus-visible,+ .guided-views button:focus-visible {outline: 2px solid var(--frontend-stroke);- outline-offset: 2px;- }- .toolbar .export-wrap { position: relative; }- .toolbar .export-menu {- position: absolute;- top: calc(100% + 0.375rem);- right: 0;- background: var(--toolbar-menu-bg);- border: 1px solid var(--toolbar-border);- border-radius: 0.5rem;- padding: 0.375rem;- min-width: 160px;- display: none;- flex-direction: column;- box-shadow: 0 4px 20px rgba(0,0,0,0.25);+ outline-offset: 1px;}- .toolbar .export-menu.open { display: flex; }- .toolbar .export-menu button {- background: transparent;- border: 0;- justify-content: space-between;- width: 100%;- text-align: left;- padding: 0.5rem 0.75rem;+ .diagram-nav button:disabled { opacity: 0.38; cursor: default; }+ .diagram-nav [data-view="reset"] { min-width: 3.35rem; font-size: 0.625rem; }+ .diagram-container[data-camera-indicator="true"] .diagram-nav [data-view="reset"] {+ min-width: 5.2rem;+ color: var(--frontend-stroke);}- .toolbar .export-menu button:hover {+ .diagram-nav #btn-diagram-guide[aria-expanded="true"] {+ color: var(--cloud-stroke);background: var(--toolbar-hover);}- .toolbar .export-menu .hint {- color: var(--text-faint);++ /* Semantic Radar is a deliberately simplified, viewer-only overview. It+ uses authored node bounds and the live camera viewport rather than+ cloning the canonical SVG, so IDs, filters, animation, and export state+ stay singular and deterministic. */+ .overview-map {+ position: absolute;+ right: 1rem;+ bottom: 4.15rem;+ z-index: 12;+ width: 11.25rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 52%, var(--toolbar-border));+ border-radius: 0.78rem;+ background: var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 16px 42px rgba(0, 0, 0, 0.3);+ backdrop-filter: blur(16px);font-size: 0.625rem;}- .toolbar .export-menu hr {+ .overview-map[hidden] { display: none; }+ .overview-map[data-docked="true"] {+ position: fixed;+ right: var(--archify-radar-right, 1rem);+ top: var(--archify-radar-top, 1rem);+ bottom: auto;+ }+ .overview-map[data-docked="true"][data-dock-side="left"] {+ right: auto;+ left: var(--archify-radar-left, 1rem);+ }+ html[data-preset="blueprint"] .overview-map { border-radius: 0.28rem; }+ .overview-map-head {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.45rem;+ min-height: 2.25rem;+ padding: 0.42rem 0.48rem 0.38rem 0.55rem;+ border-bottom: 1px solid var(--toolbar-border);+ background: linear-gradient(110deg, color-mix(in srgb, var(--frontend-fill) 45%, transparent), transparent 68%);+ }+ .overview-map-live {+ width: 0.42rem;+ height: 0.42rem;+ border-radius: 50%;+ background: var(--backend-stroke);+ box-shadow: 0 0 0 0 color-mix(in srgb, var(--backend-stroke) 52%, transparent);+ animation: archify-radar-live 2.4s ease-out infinite;+ }+ .overview-map-copy { min-width: 0; line-height: 1.1; }+ .overview-map-copy strong {+ display: block;+ overflow: hidden;+ color: var(--frontend-stroke);+ font-size: 0.59rem;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+ .overview-map-copy small {+ display: block;+ margin-top: 0.18rem;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.52rem;+ letter-spacing: 0.04em;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+ .overview-map-close {+ width: 1.55rem;+ height: 1.55rem;+ padding: 0;+ border: 0;+ border-radius: 0.34rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 0.9rem;+ cursor: pointer;+ }+ .overview-map-close:hover,+ .overview-map-close:focus-visible { background: var(--toolbar-hover); }+ .overview-map-close:focus-visible,+ .overview-map-surface:focus-visible,+ .overview-map-node:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .overview-map-surface {+ position: relative;+ height: 7rem;+ margin: 0.42rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--panel-border) 72%, transparent);+ border-radius: 0.42rem;+ background:+ linear-gradient(color-mix(in srgb, var(--panel-border) 26%, transparent) 1px, transparent 1px),+ linear-gradient(90deg, color-mix(in srgb, var(--panel-border) 26%, transparent) 1px, transparent 1px),+ color-mix(in srgb, var(--bg) 86%, transparent);+ background-size: 12px 12px;+ cursor: crosshair;+ touch-action: none;+ }+ html[data-preset="blueprint"] .overview-map-surface { border-radius: 0.1rem; }+ .overview-map-surface > svg {+ width: 100%;+ height: 100%;+ min-width: 0;+ transform: none !important;+ transition: none !important;+ display: block;+ overflow: visible;+ }+ .overview-map-node {+ fill: var(--backend-stroke);+ fill-opacity: 0.52;+ stroke: var(--backend-stroke);+ stroke-opacity: 0.86;+ vector-effect: non-scaling-stroke;+ cursor: pointer;+ transition: fill-opacity 140ms ease, stroke-width 140ms ease, filter 140ms ease;+ }+ .overview-map-node[data-kind="frontend"],+ .overview-map-node[data-kind="start"] { fill: var(--frontend-stroke); stroke: var(--frontend-stroke); }+ .overview-map-node[data-kind="database"],+ .overview-map-node[data-kind="success"] { fill: var(--database-stroke); stroke: var(--database-stroke); }+ .overview-map-node[data-kind="cloud"],+ .overview-map-node[data-kind="waiting"] { fill: var(--cloud-stroke); stroke: var(--cloud-stroke); }+ .overview-map-node[data-kind="messagebus"] { fill: var(--messagebus-stroke); stroke: var(--messagebus-stroke); }+ .overview-map-node[data-kind="security"],+ .overview-map-node[data-kind="decision"],+ .overview-map-node[data-kind="failure"] { fill: var(--security-stroke); stroke: var(--security-stroke); }+ .overview-map-node[data-kind="external"],+ .overview-map-node[data-kind="neutral"] { fill: var(--external-stroke); stroke: var(--external-stroke); }+ .overview-map-node[data-radar-active="true"],+ .overview-map-node:hover,+ .overview-map-node:focus-visible {+ fill-opacity: 0.92;+ stroke-width: 2.2;+ filter: drop-shadow(0 0 3px currentColor);+ }+ .overview-map-viewport {+ fill: color-mix(in srgb, var(--frontend-fill) 56%, transparent);+ stroke: var(--frontend-stroke);+ stroke-width: 2;+ vector-effect: non-scaling-stroke;+ pointer-events: none;+ filter: drop-shadow(0 0 3px color-mix(in srgb, var(--frontend-stroke) 54%, transparent));+ }+ .overview-map-hint {+ display: flex;+ justify-content: space-between;+ gap: 0.5rem;+ padding: 0 0.52rem 0.46rem;+ color: var(--text-faint);+ font-size: 0.49rem;+ letter-spacing: 0.06em;+ text-transform: uppercase;+ }+ .diagram-nav #btn-overview-map[aria-expanded="true"] {+ color: var(--frontend-stroke);+ background: var(--toolbar-hover);+ }+ .diagram-nav #btn-route-probe[aria-pressed="true"] {+ color: var(--backend-stroke);+ background: var(--toolbar-hover);+ }+ .diagram-nav #btn-semantic-lens[aria-expanded="true"],+ .diagram-nav #btn-semantic-lens[aria-pressed="true"] {+ color: var(--database-stroke);+ background: var(--toolbar-hover);+ }++ /* Semantic Lens turns the compiled node-kind palette into an analytical+ legend. One kind reveals its real traffic; two kinds compare only their+ direct authored relationships. Geometry and the canonical SVG stay put. */+ .semantic-lens {+ position: absolute;+ right: 1rem;+ bottom: 4.15rem;+ z-index: 24;+ width: min(20rem, calc(100% - 2rem));+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--database-stroke) 58%, var(--toolbar-border));+ border-radius: 0.82rem;+ background:+ linear-gradient(135deg, color-mix(in srgb, var(--database-fill) 34%, transparent), transparent 48%),+ var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 52px rgba(0, 0, 0, 0.36);+ backdrop-filter: blur(18px);+ animation: archify-lens-in 180ms cubic-bezier(0.22, 1, 0.36, 1);+ }+ .semantic-lens[hidden] { display: none; }+ .semantic-lens[data-dock-side="left"] { left: 1rem; right: auto; }+ .semantic-lens[data-dock-side="right"] { left: auto; right: 1rem; }+ html[data-preset="blueprint"] .semantic-lens { border-radius: 0.28rem; }+ .semantic-lens-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 0.75rem;+ padding: 0.72rem 0.78rem 0.62rem;+ border-bottom: 1px solid var(--toolbar-border);+ }+ .semantic-lens-eyebrow {+ display: block;+ color: var(--database-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.16em;+ text-transform: uppercase;+ }+ .semantic-lens-title {+ display: block;+ margin-top: 0.16rem;+ color: var(--text);+ font-size: 0.82rem;+ letter-spacing: -0.02em;+ }+ .semantic-lens-close {+ width: 1.75rem;+ height: 1.75rem;+ padding: 0;border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 1rem;+ cursor: pointer;+ }+ .semantic-lens-close:hover,+ .semantic-lens-close:focus-visible { background: var(--toolbar-hover); }+ .semantic-lens-instruction {+ margin: 0;+ padding: 0.52rem 0.78rem 0.48rem;+ color: var(--text-faint);+ font-size: 0.55rem;+ line-height: 1.45;+ }+ .semantic-lens-kinds {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 0.3rem;+ max-height: min(15rem, 40vh);+ padding: 0 0.5rem 0.5rem;+ overflow-y: auto;+ scrollbar-width: thin;+ }+ .semantic-lens-kind {+ --lens-color: var(--external-stroke);+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.42rem;+ min-width: 0;+ min-height: 2.15rem;+ padding: 0.35rem 0.42rem;+ border: 1px solid color-mix(in srgb, var(--lens-color) 24%, var(--toolbar-border));+ border-radius: 0.45rem;+ background: color-mix(in srgb, var(--panel) 76%, transparent);+ color: var(--toolbar-text);+ font: inherit;+ text-align: left;+ cursor: pointer;+ transition: border-color 140ms ease, background 140ms ease, opacity 140ms ease;+ }+ html[data-preset="blueprint"] .semantic-lens-kind { border-radius: 0.12rem; }+ .semantic-lens-kind[data-kind="frontend"],+ .semantic-lens-kind[data-kind="start"] { --lens-color: var(--frontend-stroke); }+ .semantic-lens-kind[data-kind="backend"],+ .semantic-lens-kind[data-kind="active"] { --lens-color: var(--backend-stroke); }+ .semantic-lens-kind[data-kind="database"],+ .semantic-lens-kind[data-kind="success"] { --lens-color: var(--database-stroke); }+ .semantic-lens-kind[data-kind="cloud"],+ .semantic-lens-kind[data-kind="waiting"] { --lens-color: var(--cloud-stroke); }+ .semantic-lens-kind[data-kind="messagebus"] { --lens-color: var(--messagebus-stroke); }+ .semantic-lens-kind[data-kind="security"],+ .semantic-lens-kind[data-kind="decision"],+ .semantic-lens-kind[data-kind="failure"] { --lens-color: var(--security-stroke); }+ .semantic-lens-kind:hover,+ .semantic-lens-kind:focus-visible,+ .semantic-lens-kind[aria-pressed="true"] {+ border-color: color-mix(in srgb, var(--lens-color) 78%, var(--toolbar-border));+ background: color-mix(in srgb, var(--lens-color) 11%, var(--panel));+ }+ .semantic-lens-kind:focus-visible,+ .semantic-lens-close:focus-visible,+ .semantic-lens-actions button:focus-visible {+ outline: 2px solid var(--database-stroke);+ outline-offset: 1px;+ }+ .semantic-lens-kind:disabled { opacity: 0.34; cursor: default; }+ .semantic-lens-swatch {+ width: 0.48rem;+ height: 0.48rem;+ border-radius: 50%;+ background: var(--lens-color);+ box-shadow: 0 0 8px color-mix(in srgb, var(--lens-color) 58%, transparent);+ }+ .semantic-lens-kind strong {+ overflow: hidden;+ color: var(--text);+ font-size: 0.61rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-lens-kind em {+ color: var(--lens-color);+ font-size: 0.54rem;+ font-style: normal;+ font-weight: 800;+ }+ .semantic-lens-status {+ min-height: 2.5rem;+ margin: 0;+ padding: 0.55rem 0.78rem;border-top: 1px solid var(--toolbar-border);- margin: 0.25rem 0.375rem;- opacity: 0.5;+ color: var(--text-faint);+ font-size: 0.55rem;+ line-height: 1.45;+ }+ .semantic-lens-status strong { color: var(--database-stroke); font-weight: 800; }+ .semantic-lens-actions {+ display: flex;+ justify-content: flex-end;+ gap: 0.28rem;+ padding: 0 0.62rem 0.62rem;+ }+ .semantic-lens-actions button {+ min-height: 1.8rem;+ padding: 0.28rem 0.48rem;+ border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 0.56rem;+ cursor: pointer;+ }+ .semantic-lens-actions button:hover { background: var(--toolbar-hover); }+ .semantic-lens-actions #semantic-lens-copy { color: var(--database-stroke); }+ @keyframes archify-lens-in {+ from { opacity: 0; transform: translateY(5px) scale(0.985); }+ to { opacity: 1; transform: translateY(0) scale(1); }}- /* Toast — brief feedback for actions like "copied" */- .archify-toast {- position: fixed;+ /* Route Probe answers a reader question over the compiled semantic graph:+ choose two stable nodes and reveal the shortest authored directed route.+ The receipt and signal live entirely in the viewer layer. */+ .route-probe {+ position: absolute;+ left: 1rem;+ bottom: 1rem;+ z-index: 12;+ width: min(46rem, calc(100% - 25rem));+ min-width: 18rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--backend-stroke) 62%, var(--toolbar-border));+ border-radius: 0.82rem;+ background:+ linear-gradient(115deg, color-mix(in srgb, var(--backend-fill) 50%, transparent), transparent 62%),+ var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);+ backdrop-filter: blur(16px);+ font-size: 0.625rem;+ }+ .route-probe[hidden] { display: none; }+ .route-probe[data-route-dock="top"] {top: 1rem;- left: 50%;- transform: translateX(-50%) translateY(-8px);- background: var(--toolbar-menu-bg);+ bottom: auto;+ }+ html[data-preset="blueprint"] .route-probe { border-radius: 0.25rem; }+ .route-probe-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 0.65rem;+ padding: 0.52rem 0.58rem 0.44rem;+ border-bottom: 1px solid color-mix(in srgb, var(--toolbar-border) 80%, transparent);+ }+ .route-probe-copy { min-width: 0; }+ .route-probe-eyebrow {+ display: block;+ color: var(--backend-stroke);+ font-size: 0.48rem;+ font-weight: 800;+ letter-spacing: 0.15em;+ text-transform: uppercase;+ }+ .route-probe-title {+ display: block;+ margin-top: 0.14rem;+ overflow: hidden;+ color: var(--toolbar-text);+ font-size: 0.72rem;+ line-height: 1.25;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+ .route-probe-actions { display: flex; gap: 0.2rem; }+ .route-probe button {+ min-height: 1.55rem;+ padding: 0.25rem 0.42rem;+ border: 0;+ border-radius: 0.36rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ cursor: pointer;+ }+ .route-probe button:hover,+ .route-probe button:focus-visible { background: var(--toolbar-hover); }+ .route-probe button:focus-visible {+ outline: 2px solid var(--backend-stroke);+ outline-offset: 1px;+ }+ .route-probe-copy-link { color: var(--frontend-stroke) !important; }+ .route-probe-find { color: var(--backend-stroke) !important; }+ .route-probe-copy-link[hidden] { display: none; }+ .route-probe-find[hidden] { display: none; }+ .route-probe-path {+ display: flex;+ align-items: center;+ min-height: 2.2rem;+ padding: 0.42rem 0.58rem 0.24rem;+ overflow-x: auto;+ scrollbar-width: thin;+ white-space: nowrap;+ }+ .route-probe-node,+ .route-probe button.route-probe-node {+ flex: none;+ max-width: 9.5rem;+ overflow: hidden;+ min-height: 1.75rem !important;+ padding: 0.22rem 0.38rem;+ border: 1px solid color-mix(in srgb, var(--backend-stroke) 46%, var(--toolbar-border));+ border-radius: 999px;+ background: color-mix(in srgb, var(--backend-fill) 52%, transparent);color: var(--text);- border: 1px solid var(--toolbar-border);- padding: 0.5rem 1rem;- border-radius: 0.5rem;- font-family: inherit;- font-size: 0.75rem;- opacity: 0;- transition: opacity 0.2s, transform 0.2s;- z-index: 200;- pointer-events: none;- box-shadow: 0 4px 20px rgba(0,0,0,0.25);+ font-size: 0.56rem;+ font-weight: 700;+ text-overflow: ellipsis;+ white-space: nowrap;}- .archify-toast.show {+ .route-probe-node[data-endpoint="start"] {+ border-color: var(--frontend-stroke);+ color: var(--frontend-stroke);+ }+ .route-probe-node[data-endpoint="end"] {+ border-color: var(--security-stroke);+ color: var(--security-stroke);+ }+ .route-probe-node[data-route-journey-state="past"] { opacity: 0.66; }+ .route-probe-node[data-route-journey-state="future"] { opacity: 0.48; }+ .route-probe-node[aria-current="step"] {+ border-color: var(--backend-stroke);+ background: color-mix(in srgb, var(--backend-fill) 82%, var(--toolbar-menu-bg));+ color: var(--text);+ box-shadow: 0 0 0 1px color-mix(in srgb, var(--backend-stroke) 42%, transparent), 0 0 14px color-mix(in srgb, var(--backend-stroke) 34%, transparent);opacity: 1;- transform: translateX(-50%) translateY(0);}-- @media (max-width: 720px) {- body { padding: 1rem; }- .toolbar {- position: static;- justify-content: flex-end;- margin-bottom: 1rem;- }- .header { margin-bottom: 1.25rem; }- .header-row {- gap: 0.75rem;- align-items: flex-start;- }- h1 {- font-size: 1.25rem;- line-height: 1.25;- }- .subtitle {- margin-left: 0;- font-size: 0.8125rem;- line-height: 1.55;- }- .diagram-container {- padding: 0.75rem;- border-radius: 0.75rem;- }- .cards {- grid-template-columns: 1fr;- margin-top: 1rem;- }+ html[data-preset="blueprint"] .route-probe-node[aria-current="step"] {+ border-style: double;+ border-width: 3px;+ border-radius: 0.2rem;+ box-shadow: none;}+ .route-probe-arrow {+ flex: none;+ padding: 0 0.28rem;+ color: var(--text-faint);+ font-size: 0.65rem;+ }+ .route-probe-placeholder {+ color: var(--text-faint);+ font-size: 0.56rem;+ letter-spacing: 0.03em;+ }+ .route-probe-status {+ display: block;+ min-height: 1.45rem;+ padding: 0.08rem 0.58rem 0.44rem;+ color: var(--text-faint);+ font-size: 0.52rem;+ line-height: 1.35;+ }+ .route-journey-controls {+ display: grid;+ grid-template-columns: 2rem minmax(5.8rem, auto) 2rem minmax(4.8rem, auto);+ justify-content: start;+ gap: 0.22rem;+ padding: 0.08rem 0.58rem 0.28rem;+ }+ .route-journey-controls[hidden] { display: none; }+ .route-journey-controls button {+ min-height: 1.8rem;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 86%, transparent);+ background: color-mix(in srgb, var(--toolbar-bg) 72%, transparent);+ font-size: 0.54rem;+ font-weight: 700;+ }+ .route-journey-controls button:disabled {+ cursor: default;+ opacity: 0.34;+ }+ .route-journey-play { color: var(--backend-stroke) !important; }+ .route-journey-overview { color: var(--frontend-stroke) !important; }+ .route-journey-controls[data-playing="true"] .route-journey-play {+ border-color: color-mix(in srgb, var(--backend-stroke) 64%, var(--toolbar-border));+ background: color-mix(in srgb, var(--backend-fill) 62%, transparent);+ }+ .route-probe[data-state="error"] {+ border-color: color-mix(in srgb, var(--security-stroke) 72%, var(--toolbar-border));+ }+ .route-probe[data-state="error"] .route-probe-status { color: var(--security-stroke); }- /* ==========================================================- SVG SEMANTIC CLASSES — use these instead of inline fill/stroke- ========================================================== */- .c-grid { stroke: var(--grid); fill: none; }- .c-mask { fill: var(--mask); stroke: none; }-- .c-frontend { fill: var(--frontend-fill); stroke: var(--frontend-stroke); }- .c-backend { fill: var(--backend-fill); stroke: var(--backend-stroke); }- .c-database { fill: var(--database-fill); stroke: var(--database-stroke); }- .c-cloud { fill: var(--cloud-fill); stroke: var(--cloud-stroke); }- .c-security { fill: var(--security-fill); stroke: var(--security-stroke); }- .c-messagebus { fill: var(--messagebus-fill); stroke: var(--messagebus-stroke); }- .c-external { fill: var(--external-fill); stroke: var(--external-stroke); }-- /* Text helpers */- .t-primary { fill: var(--text); }- .t-muted { fill: var(--text-muted); }- .t-dim { fill: var(--text-dim); }- .t-frontend { fill: var(--frontend-stroke); }- .t-backend { fill: var(--backend-stroke); }- .t-database { fill: var(--database-stroke); }- .t-cloud { fill: var(--cloud-stroke); }- .t-security { fill: var(--security-stroke); }- .t-messagebus { fill: var(--messagebus-stroke); }- .t-external { fill: var(--external-stroke); }-- /* Arrows */- .a-default { stroke: var(--arrow); fill: none; }- .a-emphasis { stroke: var(--arrow-emphasis); fill: none; }- .a-security { stroke: var(--security-stroke); fill: none; stroke-dasharray: 5,5; }- .a-dashed { stroke: var(--database-stroke); fill: none; stroke-dasharray: 4,4; }-- /* Arrowhead markers reference these */- .m-default { fill: var(--arrow); }- .m-emphasis { fill: var(--arrow-emphasis); }- .m-security { fill: var(--security-stroke); }- .m-dashed { fill: var(--database-stroke); }-- /* Dashed boundary variants */- .c-security-group { fill: transparent; stroke: var(--security-stroke); stroke-dasharray: 4,4; }- .c-region { fill: rgba(251, 191, 36, 0.05); stroke: var(--cloud-stroke); stroke-dasharray: 8,4; }- .c-lane { fill: var(--lane-fill); stroke: var(--lane-stroke); stroke-dasharray: 6,6; }-- /* Optional trace animation, enabled only by meta.animation = "trace".- Static diagrams do not carry data-animation and render exactly as before. */- svg[data-animation="trace"] [data-animate="edge"] {- stroke-dasharray: 10 8;- stroke-dashoffset: 54;- animation: archify-edge-flow 2.4s linear infinite;- animation-delay: calc(var(--step, 0) * 160ms);+ .focus-chip {+ position: absolute;+ left: 1rem;+ top: 1rem;+ z-index: 12;+ display: block;+ width: min(22rem, calc(100% - 13rem));+ max-width: calc(100% - 13rem);+ overflow: hidden;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.85rem;+ background: var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);+ backdrop-filter: blur(16px);+ font-size: 0.6875rem;}- svg[data-animation="trace"] [data-animate="node"] {- transform-box: fill-box;- transform-origin: center;- animation: archify-node-pulse 3.6s ease-in-out infinite;- animation-delay: calc(var(--step, 0) * 160ms);+ .focus-chip[hidden] { display: none; }+ html[data-preset="blueprint"] .focus-chip { border-radius: 0.3rem; }+ .focus-chip button {+ flex: none;+ padding: 0.3rem 0.45rem;+ border-radius: 0.35rem;+ font-size: 0.625rem;}- @keyframes archify-edge-flow {- to { stroke-dashoffset: 0; }+ .relationship-lens-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 0.75rem;+ padding: 0.7rem 0.75rem 0.65rem;+ border-bottom: 1px solid var(--toolbar-border);+ background: linear-gradient(120deg, color-mix(in srgb, var(--frontend-fill) 34%, transparent), transparent 72%);}- @keyframes archify-node-pulse {- 0%, 72%, 100% { filter: none; stroke-width: 1.5; }- 18%, 36% {- filter: drop-shadow(0 0 8px var(--arrow-emphasis));- stroke-width: 2.4;- }+ .relationship-lens-copy { min-width: 0; }+ .relationship-lens-actions {+ display: flex;+ flex-direction: column;+ align-items: stretch;+ gap: 0.18rem;}- @media (prefers-reduced-motion: reduce) {- svg[data-animation="trace"] [data-animate] {- animation: none !important;- stroke-dashoffset: 0;- }+ .relationship-lens-actions button { white-space: nowrap; }+ .relationship-lens-actions #btn-focus-copy { color: var(--frontend-stroke); }+ .relationship-lens-actions #btn-focus-relations { display: none; }+ .relationship-lens-eyebrow {+ display: block;+ margin-bottom: 0.18rem;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.14em;+ text-transform: uppercase;}- </style>-</head>-<body>- <!-- Toolbar: theme toggle + export menu (present on every generated diagram)- Keyboard: T toggles theme, E opens export menu (when no input focused) -->- <div class="toolbar" role="toolbar" aria-label="Diagram actions">- <button id="btn-theme" type="button"- title="Toggle theme (T)"- aria-label="Toggle color theme"- aria-pressed="false">+ .relationship-lens-title {+ display: block;+ overflow: hidden;+ color: var(--text);+ font-size: 0.8rem;+ line-height: 1.35;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-detail {+ display: block;+ margin-top: 0.12rem;+ overflow: hidden;+ color: var(--text-muted);+ font-size: 0.625rem;+ line-height: 1.4;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-detail[hidden] { display: none; }+ .semantic-passport-meta {+ display: flex;+ flex-wrap: wrap;+ gap: 0.24rem;+ margin-top: 0.42rem;+ }+ .semantic-passport-meta span,+ .semantic-passport-meta code {+ max-width: 100%;+ overflow: hidden;+ padding: 0.14rem 0.34rem;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 82%, transparent);+ border-radius: 999px;+ background: color-mix(in srgb, var(--panel) 68%, transparent);+ color: var(--text-faint);+ font: inherit;+ font-size: 0.5rem;+ letter-spacing: 0.04em;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-meta [data-passport="kind"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 50%, var(--toolbar-border));+ color: var(--frontend-stroke);+ font-weight: 800;+ text-transform: uppercase;+ }+ .semantic-passport-meta [data-passport="tag"] { color: var(--cloud-stroke); }+ .semantic-passport-meta [hidden] { display: none; }+ html[data-preset="blueprint"] .semantic-passport-meta span,+ html[data-preset="blueprint"] .semantic-passport-meta code { border-radius: 0.1rem; }+ .relationship-lens-summary {+ display: block;+ margin-top: 0.12rem;+ color: var(--text-faint);+ font-size: 0.5625rem;+ }+ .relationship-lens-list {+ max-height: min(18rem, 46vh);+ overflow: auto;+ padding: 0.4rem;+ scrollbar-width: thin;+ scrollbar-color: var(--frontend-stroke) transparent;+ }+ .relationship-lens-list::-webkit-scrollbar { width: 4px; }+ .relationship-lens-list::-webkit-scrollbar-thumb {+ border-radius: 999px;+ background: color-mix(in srgb, var(--frontend-stroke) 68%, transparent);+ }+ .relationship-lens-group + .relationship-lens-group { margin-top: 0.35rem; }+ .relationship-lens-group-title {+ display: block;+ padding: 0.24rem 0.38rem 0.16rem;+ color: var(--text-faint);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ }+ .relationship-lens-row {+ display: grid;+ grid-template-columns: 2.1rem minmax(0, 1fr);+ gap: 0.06rem 0.45rem;+ width: 100%;+ padding: 0.45rem 0.5rem !important;+ text-align: left;+ }+ .relationship-lens-row:hover,+ .relationship-lens-row:focus-visible,+ .relationship-lens-row[data-preview-active="true"] {+ background: var(--toolbar-hover);+ box-shadow: inset 2px 0 0 var(--frontend-stroke);+ }+ .relationship-lens-row:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: -2px;+ }+ .relationship-lens-direction {+ grid-row: 1 / 3;+ align-self: center;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.08em;+ }+ .relationship-lens-row[data-direction="in"] .relationship-lens-direction { color: var(--database-stroke); }+ .relationship-lens-row[data-direction="loop"] .relationship-lens-direction { color: var(--security-stroke); }+ .relationship-lens-row strong {+ overflow: hidden;+ color: var(--text);+ font-size: 0.6875rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .relationship-lens-row small {+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5625rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .relationship-lens-empty {+ margin: 0;+ padding: 0.75rem;+ color: var(--text-faint);+ font-size: 0.625rem;+ text-align: center;+ }++ /* Diagram Guide keeps the artifact's growing reader vocabulary+ discoverable without widening the permanent control bar. It derives+ honest counts at runtime and delegates every action to an existing+ production interaction instead of creating a second command system. */+ .diagram-guide {+ position: absolute;+ top: 1rem;+ right: 1rem;+ z-index: 26;+ width: min(32rem, calc(100% - 2rem));+ max-height: min(42rem, calc(100% - 2rem));+ overflow: auto;+ border: 1px solid color-mix(in srgb, var(--cloud-stroke) 58%, var(--toolbar-border));+ border-radius: 0.82rem;+ background:+ linear-gradient(135deg, color-mix(in srgb, var(--cloud-fill) 32%, transparent), transparent 42%),+ var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 22px 64px rgba(0, 0, 0, 0.4);+ backdrop-filter: blur(18px);+ animation: archify-guide-in 180ms cubic-bezier(0.22, 1, 0.36, 1);+ }+ .diagram-guide[hidden] { display: none; }+ html[data-preset="blueprint"] .diagram-guide { border-radius: 0.28rem; }+ .diagram-guide-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 1rem;+ padding: 0.82rem 0.9rem 0.68rem;+ border-bottom: 1px solid var(--toolbar-border);+ }+ .diagram-guide-eyebrow {+ display: block;+ color: var(--cloud-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.16em;+ text-transform: uppercase;+ }+ .diagram-guide-title {+ display: block;+ margin-top: 0.16rem;+ color: var(--text);+ font-size: 0.86rem;+ letter-spacing: -0.02em;+ }+ .diagram-guide-close {+ width: 1.8rem;+ height: 1.8rem;+ border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 1rem;+ cursor: pointer;+ }+ .diagram-guide-close:hover,+ .diagram-guide-close:focus-visible { background: var(--toolbar-hover); }+ .diagram-guide-stats {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ margin: 0;+ padding: 0.54rem 0.9rem;+ border-bottom: 1px solid color-mix(in srgb, var(--toolbar-border) 74%, transparent);+ color: var(--text-faint);+ font-size: 0.56rem;+ letter-spacing: 0.025em;+ }+ .diagram-guide-stats::before {+ content: '';+ width: 0.42rem;+ height: 0.42rem;+ flex: none;+ border-radius: 50%;+ background: var(--backend-stroke);+ box-shadow: 0 0 10px color-mix(in srgb, var(--backend-stroke) 72%, transparent);+ }+ .diagram-guide-actions {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 0.38rem;+ padding: 0.62rem;+ }+ .diagram-guide-action {+ --guide-accent: var(--frontend-stroke);+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.55rem;+ min-height: 4.15rem;+ padding: 0.55rem 0.58rem;+ border: 1px solid color-mix(in srgb, var(--guide-accent) 22%, var(--toolbar-border));+ border-radius: 0.55rem;+ background: color-mix(in srgb, var(--panel) 78%, transparent);+ color: var(--toolbar-text);+ font: inherit;+ text-align: left;+ cursor: pointer;+ transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;+ }+ .diagram-guide-action[data-guide-action="route"] { --guide-accent: var(--backend-stroke); }+ .diagram-guide-action[data-guide-action="map"] { --guide-accent: var(--database-stroke); }+ .diagram-guide-action[data-guide-action="lens"] { --guide-accent: var(--messagebus-stroke); }+ .diagram-guide-action[data-guide-action="story"] { --guide-accent: var(--security-stroke); }+ .diagram-guide-action[data-guide-action="present"] {+ --guide-accent: var(--cloud-stroke);+ }+ .diagram-guide-action:hover,+ .diagram-guide-action:focus-visible {+ border-color: color-mix(in srgb, var(--guide-accent) 76%, var(--toolbar-border));+ background: color-mix(in srgb, var(--guide-accent) 9%, var(--panel));+ transform: translateY(-1px);+ }+ .diagram-guide-action:focus-visible,+ .diagram-guide-close:focus-visible {+ outline: 2px solid var(--cloud-stroke);+ outline-offset: 1px;+ }+ .diagram-guide-action:disabled {+ opacity: 0.42;+ cursor: default;+ transform: none;+ }+ .diagram-guide-index {+ display: grid;+ place-items: center;+ width: 1.65rem;+ height: 1.65rem;+ border: 1px solid color-mix(in srgb, var(--guide-accent) 64%, var(--toolbar-border));+ border-radius: 0.35rem;+ color: var(--guide-accent);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.06em;+ }+ .diagram-guide-action-copy { min-width: 0; }+ .diagram-guide-action strong {+ display: block;+ overflow: hidden;+ color: var(--text);+ font-size: 0.66rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .diagram-guide-action small {+ display: -webkit-box;+ margin-top: 0.18rem;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5rem;+ line-height: 1.35;+ -webkit-box-orient: vertical;+ -webkit-line-clamp: 2;+ }+ .diagram-guide kbd {+ align-self: start;+ min-width: 1.45rem;+ padding: 0.12rem 0.3rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.25rem;+ color: var(--text-faint);+ font: inherit;+ font-size: 0.5rem;+ text-align: center;+ }+ .diagram-guide-shortcuts {+ display: flex;+ flex-wrap: wrap;+ gap: 0.34rem 0.62rem;+ padding: 0.58rem 0.9rem 0.68rem;+ border-top: 1px solid var(--toolbar-border);+ color: var(--text-faint);+ font-size: 0.5rem;+ }+ .diagram-guide-shortcuts span {+ display: inline-flex;+ align-items: center;+ gap: 0.28rem;+ white-space: nowrap;+ }+ .diagram-guide-feedback {+ min-height: 1rem;+ margin: -0.18rem 0.9rem 0.62rem;+ color: var(--security-stroke);+ font-size: 0.5rem;+ }+ .diagram-guide-feedback:empty { display: none; }+ @keyframes archify-guide-in {+ from { opacity: 0; transform: translateY(-5px) scale(0.985); }+ to { opacity: 1; transform: translateY(0) scale(1); }+ }++ .node-finder {+ position: absolute;+ top: 1rem;+ left: 1rem;+ z-index: 24;+ width: min(22rem, calc(100% - 2rem));+ overflow: hidden;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.85rem;+ background: var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34);+ backdrop-filter: blur(16px);+ }+ .node-finder[hidden] { display: none; }+ .node-finder[data-context="route-source"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 68%, var(--toolbar-border));+ }+ .node-finder[data-context="route-target"] {+ border-color: color-mix(in srgb, var(--security-stroke) 68%, var(--toolbar-border));+ }+ html[data-preset="blueprint"] .node-finder { border-radius: 0.3rem; }+ .node-finder-head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 1rem;+ padding: 0.7rem 0.8rem 0.45rem;+ }+ .node-finder-head strong {+ color: var(--text);+ font-size: 0.6875rem;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ }+ .node-finder[data-context="route-source"] .node-finder-head strong { color: var(--frontend-stroke); }+ .node-finder[data-context="route-target"] .node-finder-head strong { color: var(--security-stroke); }+ .node-finder-close {+ width: 1.75rem;+ height: 1.75rem;+ border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 1rem;+ cursor: pointer;+ }+ .node-finder-close:hover,+ .node-finder-close:focus-visible { background: var(--toolbar-hover); }+ .node-finder-close:focus-visible,+ .node-finder-input:focus-visible,+ .node-finder-result:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: -2px;+ }+ .node-finder-search {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.55rem;+ margin: 0 0.55rem 0.55rem;+ padding: 0 0.7rem;+ min-height: 2.6rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.55rem;+ background: color-mix(in srgb, var(--panel) 78%, transparent);+ }+ html[data-preset="blueprint"] .node-finder-search { border-radius: 0.18rem; }+ .node-finder-search > span { color: var(--frontend-stroke); font-size: 0.875rem; }+ .node-finder-input {+ width: 100%;+ min-width: 0;+ border: 0;+ outline: 0;+ background: transparent;+ color: var(--text);+ font: inherit;+ font-size: 0.75rem;+ }+ .node-finder-input::placeholder { color: var(--text-faint); }+ .node-finder kbd {+ padding: 0.1rem 0.32rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.25rem;+ color: var(--text-faint);+ font: inherit;+ font-size: 0.5625rem;+ }+ .node-finder-results {+ display: grid;+ gap: 0.18rem;+ max-height: min(18rem, 48vh);+ margin: 0;+ padding: 0 0.55rem 0.55rem;+ overflow-y: auto;+ overscroll-behavior: contain;+ scrollbar-width: thin;+ }+ .node-finder-result {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ gap: 0.2rem 0.75rem;+ width: 100%;+ padding: 0.55rem 0.65rem;+ border: 0;+ border-radius: 0.45rem;+ background: transparent;+ color: var(--text);+ font: inherit;+ text-align: left;+ cursor: pointer;+ }+ html[data-preset="blueprint"] .node-finder-result { border-radius: 0.12rem; }+ .node-finder-result:hover,+ .node-finder-result:focus-visible { background: var(--toolbar-hover); }+ .node-finder-result strong {+ overflow: hidden;+ font-size: 0.75rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .node-finder-result small {+ grid-column: 1 / -1;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5625rem;+ letter-spacing: 0.03em;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .node-finder-result em {+ align-self: center;+ color: var(--frontend-stroke);+ font-size: 0.625rem;+ font-style: normal;+ }+ .node-finder[data-context^="route-"] .node-finder-result em {+ padding: 0.1rem 0.3rem;+ border: 1px solid color-mix(in srgb, currentColor 52%, transparent);+ border-radius: 999px;+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.05em;+ text-transform: uppercase;+ }+ .node-finder[data-context="route-target"] .node-finder-result em { color: var(--security-stroke); }+ .node-finder-empty {+ padding: 1.1rem 0.75rem 1.25rem;+ color: var(--text-faint);+ font-size: 0.6875rem;+ text-align: center;+ }+ .node-finder-status {+ padding: 0.5rem 0.8rem;+ border-top: 1px solid var(--toolbar-border);+ color: var(--text-faint);+ font-size: 0.5625rem;+ }++ .guided-views {+ display: grid;+ grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem auto;+ align-items: stretch;+ gap: 0.35rem;+ min-width: 0;+ margin: 0 0 0.75rem;+ padding: 0.35rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.85rem;+ background: var(--toolbar-bg);+ background: linear-gradient(120deg, var(--toolbar-bg), color-mix(in srgb, var(--toolbar-bg) 82%, var(--frontend-fill)));+ box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16);+ backdrop-filter: blur(12px);+ }+ .guided-views[hidden] { display: none; }++ html[data-preset="blueprint"] .guided-views {+ border-color: var(--panel-border);+ border-radius: 0.35rem;+ background:+ linear-gradient(90deg, color-mix(in srgb, var(--frontend-fill) 36%, transparent), transparent 24%),+ var(--toolbar-bg);+ box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);+ }+ html[data-preset="blueprint"] .guided-views button { border-radius: 0.2rem; }+ html[data-preset="blueprint"] .guided-view-progress { border-radius: 0; }+ html[data-preset="blueprint"] .guided-view-progress span { border-radius: 0; }+ .guided-views button {+ min-width: 0;+ padding: 0.45rem 0.6rem;+ border-radius: 0.55rem;+ font-size: 0.75rem;+ }+ .guided-views > #guided-view-prev,+ .guided-views > #guided-view-next { min-width: 2.75rem; min-height: 2.75rem; }+ .guided-views button:disabled { opacity: 0.3; cursor: default; }+ .guided-view-copy {+ min-width: 0;+ padding: 0.2rem 0.5rem;+ border-left: 1px solid var(--toolbar-border);+ overflow: hidden;+ }+ .guided-view-meta {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ min-height: 1rem;+ margin-bottom: 0.12rem;+ color: var(--frontend-stroke);+ font-size: 0.5625rem;+ font-weight: 700;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ }+ .guided-view-handoff {+ box-sizing: border-box;+ height: 1rem;+ min-width: 0;+ max-width: 15rem;+ overflow: hidden;+ padding: 0 0.38rem;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 46%, transparent);+ border-radius: 999px;+ color: var(--toolbar-text);+ background: color-mix(in srgb, var(--frontend-fill) 44%, transparent);+ font-size: 0.5rem;+ line-height: calc(1rem - 2px);+ letter-spacing: 0.06em;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .guided-view-handoff[hidden] { display: none; }+ html[data-preset="blueprint"] .guided-view-handoff { border-radius: 0.15rem; }+ .chapter-handoff-overlay { pointer-events: none; }+ .chapter-handoff-anchor {+ fill: color-mix(in srgb, var(--frontend-fill) 10%, transparent);+ stroke: var(--frontend-stroke);+ stroke-width: 2;+ stroke-dasharray: 4 4;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ animation: archify-chapter-anchor 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ svg[data-chapter-handoff] [data-node-id][data-chapter-role="stay"] { opacity: 1; }+ svg[data-chapter-handoff] [data-node-id][data-chapter-role="enter"] { opacity: 0.78; }+ svg[data-chapter-handoff] [data-node-id][data-chapter-role="leave"] { opacity: 0.26; }+ @keyframes archify-chapter-anchor {+ 0% { opacity: 0.35; stroke-dashoffset: 8; }+ 45% { opacity: 1; }+ 100% { opacity: 0.72; stroke-dashoffset: 0; }+ }+ .guided-view-progress {+ width: 3.5rem;+ height: 2px;+ overflow: hidden;+ border-radius: 999px;+ background: var(--toolbar-border);+ }+ .guided-view-progress span {+ display: block;+ width: 100%;+ height: 100%;+ border-radius: inherit;+ background: var(--frontend-stroke);+ transform: scaleX(0);+ transform-origin: left center;+ }+ .guided-view-copy strong,+ .guided-view-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+ .guided-view-copy strong { color: var(--toolbar-text); font-size: 0.75rem; line-height: 1.35; }+ .guided-view-copy small { margin-top: 0; color: var(--text-muted); font-size: 0.625rem; line-height: 1.35; }+ .guided-story-caption {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ gap: 0.12rem 0.55rem;+ align-items: center;+ min-width: 0;+ margin-top: 0.18rem;+ padding: 0.3rem 0.5rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 32%, var(--toolbar-border));+ border-radius: 0.58rem;+ background: color-mix(in srgb, var(--frontend-fill) 26%, transparent);+ animation: archify-story-caption-in 140ms cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ .guided-story-caption[hidden] { display: none; }+ .guided-story-caption-index {+ grid-row: 1 / span 2;+ align-self: stretch;+ display: inline-grid;+ min-width: 3.3rem;+ place-items: center;+ padding-right: 0.52rem;+ border-right: 1px solid color-mix(in srgb, var(--frontend-stroke) 28%, var(--toolbar-border));+ color: var(--frontend-stroke);+ font-size: 0.5625rem;+ font-weight: 800;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ }+ .guided-story-caption strong,+ .guided-story-caption small {+ display: block;+ min-width: 0;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .guided-story-caption strong { color: var(--toolbar-text); font-size: 0.6875rem; line-height: 1.3; }+ .guided-story-caption small { color: var(--text-muted); font-size: 0.5625rem; line-height: 1.35; }+ .guided-story-caption-next {+ grid-column: 3;+ grid-row: 1 / span 2;+ display: grid;+ min-width: 6.4rem;+ max-width: 9.5rem;+ align-self: stretch;+ align-content: center;+ padding-left: 0.58rem;+ border-left: 1px solid color-mix(in srgb, var(--frontend-stroke) 22%, var(--toolbar-border));+ }+ .guided-story-caption-next[hidden] { display: none; }+ .guided-story-caption-next small {+ color: color-mix(in srgb, var(--frontend-stroke) 72%, var(--text-muted));+ font-weight: 800;+ letter-spacing: 0.09em;+ text-transform: uppercase;+ }+ .guided-story-caption-next strong { color: var(--text-muted); font-weight: 700; }+ html[data-preset="blueprint"] .guided-story-caption { border-radius: 0.2rem; }+ .guided-views[data-story-beat] .guided-view-copy > #guided-view-label,+ .guided-views[data-story-beat] .guided-view-copy > #guided-view-note { display: none; }+ @keyframes archify-story-caption-in {+ from { opacity: 0; transform: translateY(3px); }+ to { opacity: 1; transform: translateY(0); }+ }+ .guided-view-trail {+ display: flex;+ align-items: center;+ gap: 0.28rem;+ min-width: 0;+ min-height: 1.7rem;+ margin-top: 0;+ padding: 0;+ overflow-x: auto;+ color: var(--text-faint);+ overscroll-behavior-x: contain;+ touch-action: pan-x;+ scrollbar-width: none;+ white-space: nowrap;+ }+ .guided-view-trail[hidden] { display: none; }+ .guided-view-trail::-webkit-scrollbar { display: none; }+ .guided-view-trail .guided-view-stop {+ appearance: none;+ box-sizing: border-box;+ display: inline-flex;+ flex: 0 0 auto;+ align-items: center;+ gap: 0.28rem;+ min-height: 1.5rem;+ padding: 0.1rem 0.3rem 0.1rem 0.18rem;+ border: 1px solid transparent;+ border-radius: 999px;+ background: transparent;+ color: var(--text-muted);+ cursor: pointer;+ font-family: inherit;+ font-size: 0.5625rem;+ font-weight: 650;+ letter-spacing: 0.02em;+ line-height: 1;+ transition: background 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;+ }+ .guided-view-stop:hover {+ border-color: color-mix(in srgb, var(--frontend-stroke) 36%, transparent);+ background: color-mix(in srgb, var(--frontend-fill) 34%, transparent);+ }+ .guided-view-stop:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .guided-view-stop:disabled { cursor: wait; }+ .guided-view-stop::before {+ display: inline-grid;+ width: 1rem;+ height: 1rem;+ place-items: center;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 54%, var(--toolbar-border));+ border-radius: 50%;+ background: color-mix(in srgb, var(--frontend-fill) 58%, var(--toolbar-bg));+ color: var(--frontend-stroke);+ content: attr(data-story-number);+ font-size: 0.5rem;+ line-height: 1;+ }+ .guided-view-stop + .guided-view-stop::after {+ order: -1;+ color: color-mix(in srgb, var(--frontend-stroke) 58%, var(--text-faint));+ content: '\00b7';+ font-size: 0.65rem;+ }+ .guided-view-stop[data-story-link="forward"]::after { content: '\2192'; }+ .guided-view-stop[data-story-link="reverse"]::after { content: '\2190'; }+ .guided-view-stop[data-story-link="multiple"]::after { content: '\21c4'; }+ .guided-view-stop[data-story-beat-state="pending"] { opacity: 0.38; }+ .guided-view-stop[data-story-beat-state="next"] {+ border-style: dashed;+ border-color: color-mix(in srgb, var(--frontend-stroke) 42%, var(--toolbar-border));+ color: color-mix(in srgb, var(--toolbar-text) 68%, var(--text-muted));+ opacity: 0.58;+ }+ .guided-view-stop[data-story-beat-state="past"] { color: var(--text-muted); opacity: 0.76; }+ .guided-view-stop[data-story-beat-state="active"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 72%, var(--toolbar-border));+ background: color-mix(in srgb, var(--frontend-fill) 42%, transparent);+ color: var(--toolbar-text);+ font-weight: 800;+ opacity: 1;+ }+ .guided-view-stop[data-story-beat-state="active"]::before {+ border-color: var(--frontend-stroke);+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 54%, transparent);+ }+ html[data-preset="blueprint"] .guided-view-stop,+ html[data-preset="blueprint"] .guided-view-stop::before { border-radius: 0.1rem; }+ html[data-preset="blueprint"] .guided-view-stop[data-story-beat-state="active"]::before { box-shadow: none; }+ .guided-view-actions { display: flex; align-items: stretch; gap: 0.2rem; }+ .guided-view-actions button { white-space: nowrap; }+ .guided-view-play {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 0.38rem;+ min-width: 6.25rem !important;+ color: var(--frontend-stroke) !important;+ font-size: 0.625rem !important;+ }+ .guided-view-play[aria-pressed="true"] { background: var(--toolbar-hover); }+ .guided-view-all { min-width: 3.25rem !important; color: var(--text-muted) !important; font-size: 0.625rem !important; }+ .guided-view-beat-link {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 0.3rem;+ min-width: 5.4rem !important;+ min-height: 1.5rem;+ color: var(--text-muted) !important;+ font-size: 0.5625rem !important;+ letter-spacing: 0.025em;+ transition: background 140ms ease, border-color 140ms ease, color 140ms ease;+ }+ .guided-view-beat-link:not(:disabled):hover {+ border-color: color-mix(in srgb, var(--frontend-stroke) 52%, var(--toolbar-border));+ color: var(--frontend-stroke) !important;+ }+ .guided-view-beat-link[data-copy-state="copied"] {+ border-color: color-mix(in srgb, var(--backend-stroke) 58%, var(--toolbar-border));+ background: color-mix(in srgb, var(--backend-fill) 46%, transparent);+ color: var(--backend-stroke) !important;+ }+ .guided-view-index {+ grid-column: 1 / -1;+ min-width: 0;+ padding: 0.28rem 0.12rem 0.08rem;+ overflow: hidden;+ border-top: 1px solid color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ }+ @media (min-width: 721px) {+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-index,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-beat-link,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-all,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-trail,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-copy > #guided-view-label,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-copy > #guided-view-note { display: none; }+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-story-caption { margin-top: 0.08rem; }+ }+ .guided-view-chapters {+ display: flex;+ gap: 0.28rem;+ min-width: 0;+ margin: 0;+ padding: 0.08rem 0.05rem 0.2rem;+ overflow-x: auto;+ list-style: none;+ scroll-padding-inline: 0.05rem;+ scroll-snap-type: x proximity;+ scrollbar-width: none;+ }+ .guided-view-chapters::-webkit-scrollbar { display: none; }+ .guided-view-chapters li {+ display: flex;+ flex: 1 1 0;+ min-width: 9.5rem;+ scroll-snap-align: center;+ }+ .guided-view-chapter {+ position: relative;+ display: grid !important;+ grid-template-columns: 1.55rem minmax(0, 1fr) auto;+ align-items: center;+ width: 100%;+ min-height: 2.75rem;+ padding: 0.36rem 0.48rem !important;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 86%, transparent) !important;+ border-radius: 0.48rem !important;+ background: color-mix(in srgb, var(--toolbar-bg) 88%, transparent) !important;+ color: var(--text-muted) !important;+ text-align: left;+ transition: background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;+ }+ .guided-view-chapter:hover {+ border-color: color-mix(in srgb, var(--frontend-stroke) 58%, var(--toolbar-border)) !important;+ background: color-mix(in srgb, var(--frontend-fill) 42%, var(--toolbar-bg)) !important;+ }+ .guided-view-chapter:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .guided-view-chapter-index {+ display: inline-grid;+ width: 1.32rem;+ height: 1.32rem;+ place-items: center;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 48%, var(--toolbar-border));+ border-radius: 50%;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.03em;+ }+ .guided-view-chapter-title {+ min-width: 0;+ overflow: hidden;+ color: var(--toolbar-text);+ font-size: 0.625rem;+ font-weight: 700;+ line-height: 1.3;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .guided-view-chapter-count {+ grid-column: 3;+ grid-row: 1;+ margin-left: 0.38rem;+ color: var(--text-faint);+ font-size: 0.5rem;+ font-style: normal;+ font-weight: 650;+ white-space: nowrap;+ }+ .guided-view-chapter-delta {+ display: inline-flex;+ grid-column: 3;+ grid-row: 1;+ align-items: center;+ gap: 0.22rem;+ margin-left: 0.38rem;+ color: var(--text-faint);+ font-size: 0.5rem;+ font-weight: 750;+ letter-spacing: 0.01em;+ white-space: nowrap;+ }+ .guided-view-chapter-delta[hidden] { display: none; }+ .guided-view-chapter-delta [data-delta-kind="stay"] { color: var(--text-muted); }+ .guided-view-chapter-delta [data-delta-kind="enter"] { color: var(--frontend-stroke); }+ .guided-view-chapter-delta [data-delta-kind="leave"] { color: var(--security-stroke); }+ .guided-view-chapter[data-preview-active="true"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 72%, var(--toolbar-border)) !important;+ background: color-mix(in srgb, var(--frontend-fill) 54%, var(--toolbar-bg)) !important;+ }+ .guided-view-chapter[data-chapter-position="current"] {+ border: 2px solid var(--frontend-stroke) !important;+ padding: calc(0.36rem - 1px) calc(0.48rem - 1px) !important;+ box-shadow: inset 3px 0 0 var(--frontend-stroke);+ color: var(--toolbar-text) !important;+ }+ .guided-view-chapter[data-chapter-position="current"] .guided-view-chapter-index {+ background: var(--frontend-stroke);+ color: var(--bg);+ }+ .guided-view-chapter[data-chapter-position="before"] {+ border-style: solid !important;+ opacity: 0.72;+ }+ .guided-view-chapter[data-chapter-position="after"] { border-style: dashed !important; }+ html[data-preset="signal-flow"] .guided-view-chapter[data-chapter-position="current"] {+ box-shadow: inset 3px 0 0 var(--frontend-stroke), 0 0 18px color-mix(in srgb, var(--frontend-stroke) 18%, transparent);+ }+ html[data-preset="blueprint"] .guided-view-chapter,+ html[data-preset="blueprint"] .guided-view-chapter-index { border-radius: 0.12rem !important; }++ /* Story Shelf — keep every authored chapter and the Play action visible,+ but do not spend a second row on unavailable director controls before+ the reader enters a chapter. Existing data-active-view state expands+ the full guided surface without a new toggle or stored preference. */+ .guided-views[data-active-view="all"] {+ grid-template-columns: minmax(11rem, .72fr) auto minmax(0, 2fr);+ align-items: center;+ padding: 0.28rem 0.35rem;+ }+ .guided-views[data-active-view="all"] > #guided-view-prev,+ .guided-views[data-active-view="all"] > #guided-view-next,+ .guided-views[data-active-view="all"] .guided-view-beat-link,+ .guided-views[data-active-view="all"] .guided-view-all { display: none; }+ .guided-views[data-active-view="all"] .guided-view-copy {+ grid-column: 1;+ grid-row: 1;+ padding: 0.1rem 0.55rem;+ }+ .guided-views[data-active-view="all"] .guided-view-copy > #guided-view-note { display: none; }+ .guided-views[data-active-view="all"] .guided-view-actions {+ display: block;+ grid-column: 2;+ grid-row: 1;+ }+ .guided-views[data-active-view="all"] .guided-view-play { min-height: 2.75rem; }+ .guided-views[data-active-view="all"] .guided-view-index {+ grid-column: 3;+ grid-row: 1;+ padding: 0 0.08rem 0 0.42rem;+ border-top: 0;+ border-left: 1px solid color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ }+ .guided-views[data-active-view="all"] .guided-view-chapters {+ gap: 0.3rem;+ padding: 0;+ }++ .cards {+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));+ gap: 1rem;+ margin-top: 2rem;+ }++ .card {+ background: var(--panel);+ border-radius: 0.75rem;+ border: 1px solid var(--panel-border);+ padding: 1.25rem;+ }++ html[data-preset="signal-flow"] .card {+ background: linear-gradient(145deg, rgba(10, 24, 43, 0.86), rgba(5, 12, 24, 0.92));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);+ }+ html[data-preset="signal-flow"][data-theme="light"] .card {+ background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(237, 246, 250, 0.9));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 12px 32px rgba(45, 78, 99, 0.08);+ }++ html[data-preset="blueprint"] .card {+ position: relative;+ border-color: var(--panel-border);+ border-radius: 0.3rem;+ background: var(--panel);+ box-shadow: none;+ }+ html[data-preset="blueprint"] .card::before {+ content: "";+ position: absolute;+ top: -1px;+ left: 1rem;+ width: 2.5rem;+ border-top: 2px solid var(--frontend-stroke);+ }++ .card-header {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ margin-bottom: 0.75rem;+ }++ .card-dot {+ width: 8px;+ height: 8px;+ border-radius: 50%;+ }++ .card-dot.cyan { background: var(--frontend-stroke); }+ .card-dot.emerald { background: var(--backend-stroke); }+ .card-dot.violet { background: var(--database-stroke); }+ .card-dot.amber { background: var(--cloud-stroke); }+ .card-dot.rose { background: var(--security-stroke); }+ .card-dot.orange { background: var(--messagebus-stroke); }+ .card-dot.slate { background: var(--external-stroke); }++ .card h3 { font-size: 0.875rem; font-weight: 600; color: var(--text); }++ .card ul {+ list-style: none;+ color: var(--text-muted);+ font-size: 0.75rem;+ }++ .card li { margin-bottom: 0.375rem; }++ .footer {+ text-align: center;+ margin-top: 1.5rem;+ color: var(--text-faint);+ font-size: 0.75rem;+ }++ .footer .artifact-start-link {+ color: var(--text-faint);+ text-decoration-color: color-mix(in srgb, var(--frontend-stroke) 48%, transparent);+ text-underline-offset: 0.22em;+ transition: color 0.15s ease, text-decoration-color 0.15s ease;+ }++ .footer .artifact-start-link:hover,+ .footer .artifact-start-link:focus-visible {+ color: var(--frontend-stroke);+ text-decoration-color: currentColor;+ }++ /* ==========================================================+ Print stylesheet — hide interactive controls, force light,+ drop the grid so the diagram doesn't waste ink, use landscape+ so wide diagrams fit, pack summary cards into 2 columns to+ avoid an orphan card on a trailing page.+ ========================================================== */+ @page { size: landscape; margin: 1.5cm; }++ @media print {+ /* Force the FULL light palette — including component fills/strokes and+ lane/arrow colors — so printing from dark theme doesn't put neon+ strokes and translucent dark fills on white paper. */+ :root, [data-theme="dark"], [data-theme="light"] {+ --bg: #ffffff;+ --grid: transparent;+ --panel: #ffffff;+ --panel-border: #e2e8f0;+ --text: #0f172a;+ --text-muted: #475569;+ --text-dim: #94a3b8;+ --text-faint: #64748b;+ --mask: #ffffff;+ --lane-fill: rgba(248, 250, 252, 0.65);+ --lane-stroke: #cbd5e1;+ --arrow: #94a3b8;+ --arrow-emphasis: #059669;+ --frontend-fill: rgba(34, 211, 238, 0.15);+ --frontend-stroke: #0891b2;+ --backend-fill: rgba(52, 211, 153, 0.18);+ --backend-stroke: #059669;+ --database-fill: rgba(167, 139, 250, 0.2);+ --database-stroke: #7c3aed;+ --cloud-fill: rgba(251, 191, 36, 0.18);+ --cloud-stroke: #d97706;+ --security-fill: rgba(251, 113, 133, 0.15);+ --security-stroke: #e11d48;+ --messagebus-fill: rgba(251, 146, 60, 0.15);+ --messagebus-stroke:#ea580c;+ --external-fill: rgba(148, 163, 184, 0.18);+ --external-stroke: #64748b;+ }+ body { background: #ffffff !important; padding: 0; }+ .container { max-width: none; }+ .toolbar, .diagram-nav, .focus-chip, .guided-views, .archify-toast, .no-print { display: none !important; }+ .chapter-handoff-overlay { display: none !important; }+ svg [data-node-id][data-chapter-role] { opacity: 1 !important; }+ svg[data-chapter-preview] [data-node-id],+ svg[data-chapter-preview] [data-edge-from] { opacity: 1 !important; filter: none !important; }+ .diagram-container, .card { box-shadow: none; border-color: #e2e8f0; }+ html[data-preset="signal-flow"] .diagram-container,+ html[data-preset="signal-flow"] .card { background: #ffffff; }+ .cards { grid-template-columns: 1fr 1fr; }+ /* Ensure elements break sensibly across pages */+ .card { break-inside: avoid; page-break-inside: avoid; }+ .diagram-container { break-inside: avoid; page-break-inside: avoid; }+ .diagram-container svg [data-detail] {+ opacity: 1 !important;+ pointer-events: auto !important;+ }+ .diagram-container svg [data-detail-anchor] { transform: none !important; }+ .diagram-container svg[data-lens-active] [data-node-id],+ .diagram-container svg[data-lens-active] [data-edge-from],+ .diagram-container svg[data-legend-preview-active] [data-node-id],+ .diagram-container svg[data-legend-preview-active] [data-edge-from] {+ opacity: 1 !important;+ filter: none !important;+ }+ [data-legend-bridge-runtime] { display: none !important; }+ .semantic-lens-overlay { display: none !important; }+ .relationship-hit-overlay { display: none !important; }+ .relationship-pulse-overlay { display: none !important; }+ .route-probe-overlay, .route-journey-overlay { display: none !important; }+ .story-trail-overlay,+ .story-carrier-overlay { display: none !important; }+ .diagram-container svg[data-focus-active] [data-node-id],+ .diagram-container svg[data-focus-active] [data-edge-from],+ .diagram-container svg[data-story-beat] [data-story-step],+ .diagram-container svg[data-story-beat] [data-edge-from][data-story-beat-step],+ .diagram-container svg[data-route-active] [data-node-id],+ .diagram-container svg[data-route-active] [data-edge-from] {+ opacity: 1 !important;+ filter: none !important;+ animation: none !important;+ }+ h1, .subtitle { color: #0f172a; }+ }++ /* ==========================================================+ TOOLBAR (theme toggle + export menu)+ ========================================================== */+ .toolbar {+ position: fixed;+ top: 1rem;+ right: 1rem;+ display: flex;+ gap: 0.5rem;+ z-index: 100;+ }+ .toolbar button {+ background: var(--toolbar-bg);+ color: var(--toolbar-text);+ border: 1px solid var(--toolbar-border);+ padding: 0.5rem 0.875rem;+ border-radius: 0.5rem;+ font-family: inherit;+ font-size: 0.75rem;+ font-weight: 500;+ cursor: pointer;+ backdrop-filter: blur(8px);+ transition: background 0.15s, border-color 0.15s;+ display: inline-flex;+ align-items: center;+ gap: 0.375rem;+ min-height: 2.75rem;+ }+ .toolbar button:hover {+ background: var(--toolbar-hover);+ border-color: var(--arrow);+ }+ .toolbar button:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 2px;+ }+ .toolbar #btn-motion[hidden] { display: none !important; }+ .toolbar #btn-motion { min-width: 4.4rem; }+ .toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }+ .motion-control-dot {+ width: 0.46rem;+ height: 0.46rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 50%;+ background: var(--frontend-stroke);+ box-shadow: 0 0 9px color-mix(in srgb, var(--frontend-stroke) 72%, transparent);+ }+ #btn-motion[aria-pressed="false"] .motion-control-dot {+ background: transparent;+ box-shadow: none;+ }+ .toolbar .export-wrap { position: relative; }+ .toolbar .export-menu {+ position: absolute;+ top: calc(100% + 0.375rem);+ right: 0;+ background: var(--toolbar-menu-bg);+ border: 1px solid var(--toolbar-border);+ border-radius: 0.5rem;+ padding: 0.375rem;+ min-width: 160px;+ display: none;+ flex-direction: column;+ box-shadow: 0 4px 20px rgba(0,0,0,0.25);+ }+ .toolbar .export-menu.open { display: flex; }+ .toolbar .export-menu button {+ background: transparent;+ border: 0;+ justify-content: space-between;+ width: 100%;+ text-align: left;+ padding: 0.5rem 0.75rem;+ }+ .toolbar .export-menu button:hover {+ background: var(--toolbar-hover);+ }+ .toolbar .export-menu .hint {+ color: var(--text-faint);+ font-size: 0.625rem;+ }+ .toolbar .export-menu hr {+ border: 0;+ border-top: 1px solid var(--toolbar-border);+ margin: 0.25rem 0.375rem;+ opacity: 0.5;+ }++ /* Toast — brief feedback for actions like "copied" */+ .archify-toast {+ position: fixed;+ top: 1rem;+ left: 50%;+ transform: translateX(-50%) translateY(-8px);+ background: var(--toolbar-menu-bg);+ color: var(--text);+ border: 1px solid var(--toolbar-border);+ padding: 0.5rem 1rem;+ border-radius: 0.5rem;+ font-family: inherit;+ font-size: 0.75rem;+ opacity: 0;+ transition: opacity 0.2s, transform 0.2s;+ z-index: 200;+ pointer-events: none;+ box-shadow: 0 4px 20px rgba(0,0,0,0.25);+ }+ .archify-toast.show {+ opacity: 1;+ transform: translateX(-50%) translateY(0);+ }++ @media (max-width: 720px) {+ body { padding: 1rem; }+ .toolbar {+ position: static;+ justify-content: flex-end;+ margin-bottom: 1rem;+ }+ .header { margin-bottom: 1.25rem; padding-right: 0; }+ html[data-preset="signal-flow"] .header,+ html[data-preset="blueprint"] .header { padding-right: 0; }+ .header-row {+ gap: 0.75rem;+ align-items: flex-start;+ }+ html[data-preset="signal-flow"] .header-row,+ html[data-preset="blueprint"] .header-row { flex-wrap: wrap; }+ html[data-preset="signal-flow"] .header-row::after {+ margin-left: 0;+ order: 3;+ }+ html[data-preset="blueprint"] .header-row::after {+ margin-left: 0;+ order: 3;+ }+ h1 {+ font-size: 1.25rem;+ line-height: 1.25;+ }+ .subtitle {+ margin-left: 0;+ font-size: 0.8125rem;+ line-height: 1.55;+ }+ .diagram-container {+ padding: 0.75rem;+ border-radius: 0.75rem;+ }+ html:not([data-embed="true"]) .diagram-container {+ padding: 0.75rem 0.75rem 4.25rem;+ }+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] {+ overflow-x: auto;+ overflow-y: hidden;+ overscroll-behavior-x: contain;+ scrollbar-width: thin;+ scroll-behavior: smooth;+ }+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] > svg {+ min-width: 720px;+ }+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .diagram-nav,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .overview-map,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .focus-chip,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .route-probe,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .semantic-lens,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .diagram-guide,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .node-finder {+ transform: translateX(var(--archify-scroll-x, 0px));+ }+ .diagram-nav { right: 0.5rem; bottom: 0.5rem; }+ .overview-map {+ right: 0.5rem;+ bottom: 3.7rem;+ width: min(10.25rem, calc(100% - 1rem));+ }+ .overview-map[data-docked="true"] {+ right: 0.5rem;+ top: var(--archify-radar-top, 0.5rem);+ bottom: auto;+ transform: none !important;+ }+ .overview-map[data-docked="true"][data-dock-side="left"] {+ right: auto;+ left: 0.5rem;+ }+ .overview-map-surface { height: 4rem; }+ .semantic-lens {+ right: 0.5rem;+ bottom: 3.7rem;+ width: calc(100% - 1rem);+ max-height: calc(100% - 4.2rem);+ }+ .semantic-lens[data-dock-side] { left: auto; right: 0.5rem; }+ .semantic-lens-kinds { max-height: min(12rem, 34vh); }+ .focus-chip {+ left: 0.5rem;+ top: 0.5rem;+ width: calc(100% - 1rem);+ max-width: none;+ }+ .relationship-lens-list { max-height: min(12rem, 38vh); }+ .relationship-lens-actions #btn-focus-relations { display: block; color: var(--database-stroke); }+ .focus-chip:not([data-relations-expanded="true"]) .relationship-lens-head { border-bottom-color: transparent; }+ .focus-chip:not([data-relations-expanded="true"]) .relationship-lens-list { display: none; }+ /* While a mobile reader previews one relationship, turn the full Lens+ into a compact peek card. This keeps the exact source and target on+ canvas instead of covering them with a long, scrollable list. */+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-list {+ max-height: none;+ padding: 0.35rem;+ overflow: hidden;+ }+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-group { margin: 0; }+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-group-title,+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-row:not([data-preview-active="true"]) {+ display: none;+ }+ .node-finder {+ top: 0.5rem;+ left: 0.5rem;+ width: min(22rem, calc(100% - 1rem));+ max-height: calc(100% - 1rem);+ }+ .diagram-guide {+ top: 0.5rem;+ right: 0.5rem;+ left: 0.5rem;+ width: auto;+ max-height: calc(100% - 1rem);+ }+ .diagram-guide-head { padding: 0.62rem 0.7rem 0.52rem; }+ .diagram-guide-stats { padding: 0.42rem 0.7rem; }+ .diagram-guide-actions {+ grid-template-columns: 1fr;+ gap: 0.28rem;+ padding: 0.42rem;+ }+ .diagram-guide-action {+ min-height: 3.1rem;+ padding: 0.42rem 0.48rem;+ }+ .diagram-guide-action small {+ display: block;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .diagram-guide-index {+ width: 1.5rem;+ height: 1.5rem;+ }+ .diagram-guide-shortcuts { padding: 0.46rem 0.7rem 0.52rem; }+ .diagram-guide-action[data-guide-action="present"] { grid-column: auto; }+ .route-probe[data-guide-open="true"] {+ visibility: hidden;+ pointer-events: none;+ }+ .node-finder-results { max-height: min(16rem, 38vh); }+ .route-probe {+ left: 0.5rem;+ bottom: 3.7rem;+ width: calc(100% - 1rem);+ min-width: 0;+ }+ .route-probe[data-route-dock="top"] {+ top: 0.5rem;+ bottom: auto;+ }+ .route-probe[data-finder-open="true"] {+ visibility: hidden;+ pointer-events: none;+ }+ .route-probe-head { padding: 0.45rem 0.48rem 0.38rem; }+ .route-probe-path { padding: 0.35rem 0.48rem 0.2rem; }+ .route-probe-node { min-height: 2.75rem !important; }+ .route-journey-controls {+ grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem minmax(0, 1fr);+ padding: 0.08rem 0.48rem 0.32rem;+ }+ .route-journey-controls button { min-height: 2.75rem; }+ .route-probe-status { padding: 0.05rem 0.48rem 0.38rem; }+ .route-probe-node { max-width: 7.5rem; }+ .guided-views {+ grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;+ gap: 0.2rem;+ padding: 0.25rem;+ }+ .guided-view-actions {+ grid-column: 1 / -1;+ display: grid;+ grid-template-columns: repeat(3, minmax(0, 1fr));+ }+ .guided-views > #guided-view-prev,+ .guided-views > #guided-view-next {+ align-self: center;+ height: 2.75rem;+ }+ .guided-view-play,+ .guided-view-all,+ .guided-view-beat-link { min-height: 2.75rem; }+ .guided-view-copy small { white-space: normal; }+ .guided-story-caption { padding: 0.32rem 0.45rem; }+ .guided-story-caption-index { min-width: 2.9rem; padding-right: 0.42rem; }+ .guided-story-caption strong,+ .guided-story-caption small { white-space: normal; }+ .guided-story-caption-next { display: none; }+ .guided-view-trail { min-height: 2rem; }+ .guided-view-trail .guided-view-stop {+ min-height: 2rem;+ padding: 0.22rem 0.42rem 0.22rem 0.28rem;+ }+ .guided-view-handoff { max-width: min(9rem, 32vw); }+ .guided-view-index { padding-top: 0.35rem; }+ .guided-view-chapters {+ gap: 0.35rem;+ scroll-padding-inline: 0.2rem;+ }+ .guided-view-chapters li {+ flex: 0 0 min(14rem, 78vw);+ min-width: 0;+ }+ .guided-view-chapter { min-height: 2.75rem; }+ .guided-views[data-active-view="all"] {+ grid-template-columns: minmax(0, 1fr) auto;+ gap: 0.2rem;+ padding: 0.25rem;+ }+ .guided-views[data-active-view="all"] .guided-view-copy {+ grid-column: 1;+ grid-row: 1;+ }+ .guided-views[data-active-view="all"] .guided-view-actions {+ grid-column: 2;+ grid-row: 1;+ }+ .guided-views[data-active-view="all"] .guided-view-play {+ min-width: 6rem !important;+ min-height: 2.75rem;+ }+ .guided-views[data-active-view="all"] .guided-view-index {+ grid-column: 1 / -1;+ grid-row: 2;+ padding: 0.3rem 0.08rem 0;+ border-top: 1px solid color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ border-left: 0;+ }+ html[data-embed="true"][data-share-playback="true"] .share-chapter-cue:not([hidden]),+ html[data-embed="true"][data-share-moment="true"] .share-chapter-cue:not([hidden]) {+ top: 0.5rem;+ grid-template-columns: auto minmax(0, 1fr);+ gap: 0.28rem 0.55rem;+ width: calc(100% - 1rem);+ min-height: 0;+ padding: 0.45rem 0.55rem 0.55rem;+ }+ html[data-embed="true"][data-share-playback="true"] .diagram-container {+ padding-top: 4.25rem;+ }+ html[data-embed="true"][data-share-moment="true"] .diagram-container {+ padding-top: 4.25rem;+ }+ .share-chapter-index {+ min-width: 4.4rem;+ padding-right: 0.5rem;+ }+ .share-chapter-copy small { font-size: 0.46rem; }+ .share-chapter-route {+ grid-column: 1 / -1;+ font-size: 0.5rem;+ text-align: left;+ }+ .cards {+ grid-template-columns: 1fr;+ margin-top: 1rem;+ }+ html[data-present="true"]:not([data-embed="true"]) body { padding: 0.5rem; }+ html[data-present="true"]:not([data-embed="true"]) .container {+ gap: 0.5rem;+ height: calc(100dvh - 1rem);+ }+ html[data-present="true"]:not([data-embed="true"]) .toolbar {+ position: fixed;+ top: 0.5rem;+ right: 0.5rem;+ margin: 0;+ gap: 0.25rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .toolbar button {+ min-height: 2.75rem;+ padding: 0.42rem 0.58rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .header {+ min-height: 2.25rem;+ padding: 3.5rem 0 0;+ }+ html[data-present="true"]:not([data-embed="true"]) .header-row {+ min-height: 2.25rem;+ margin: 0;+ align-items: center;+ flex-wrap: nowrap;+ }+ html[data-present="true"]:not([data-embed="true"]) .header-row::after,+ html[data-present="true"]:not([data-embed="true"]) .pulse-dot,+ html[data-present="true"]:not([data-embed="true"]) .subtitle { display: none; }+ html[data-present="true"]:not([data-embed="true"]) h1 {+ flex: 1 1 auto;+ min-width: 0;+ max-width: 100%;+ overflow: hidden;+ font-size: 0.875rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ html[data-present="true"]:not([data-embed="true"]) .guided-views {+ padding: 0.2rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .guided-view-copy small { display: none; }+ html[data-present="true"]:not([data-embed="true"]) .guided-story-caption small { display: block; }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container { padding: 0.5rem 0.5rem 3.75rem; }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] > svg {+ width: 720px;+ height: auto;+ min-width: 720px;+ }+ }++ @media (prefers-reduced-motion: reduce) {+ .guided-story-caption { animation: none !important; }+ }++ @media (max-width: 360px) {+ .toolbar { gap: 0.25rem; }+ .toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }+ .toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }+ #theme-label, #preset-label, #present-label { display: none; }+ .guided-view-handoff { max-width: 6.5rem; }+ }++ /* ==========================================================+ SVG SEMANTIC CLASSES — use these instead of inline fill/stroke+ ========================================================== */+ .c-grid { stroke: var(--grid); fill: none; }+ .c-mask { fill: var(--mask); stroke: none; }++ .c-frontend { fill: var(--frontend-fill); stroke: var(--frontend-stroke); }+ .c-backend { fill: var(--backend-fill); stroke: var(--backend-stroke); }+ .c-database { fill: var(--database-fill); stroke: var(--database-stroke); }+ .c-cloud { fill: var(--cloud-fill); stroke: var(--cloud-stroke); }+ .c-security { fill: var(--security-fill); stroke: var(--security-stroke); }+ .c-messagebus { fill: var(--messagebus-fill); stroke: var(--messagebus-stroke); }+ .c-external { fill: var(--external-fill); stroke: var(--external-stroke); }++ /* Text helpers */+ .t-primary { fill: var(--text); }+ .t-muted { fill: var(--text-muted); }+ .t-dim { fill: var(--text-dim); }+ .t-frontend { fill: var(--frontend-stroke); }+ .t-backend { fill: var(--backend-stroke); }+ .t-database { fill: var(--database-stroke); }+ .t-cloud { fill: var(--cloud-stroke); }+ .t-security { fill: var(--security-stroke); }+ .t-messagebus { fill: var(--messagebus-stroke); }+ .t-external { fill: var(--external-stroke); }++ /* Semantic Sigils are small authored role stamps, not icons from a brand+ pack and not viewer controls. Prefix selectors with svg so the canonical+ export's SVG-only stylesheet collector keeps them automatically. */+ svg .semantic-sigil {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ opacity: 0.76;+ pointer-events: none;+ }+ svg .semantic-sigil > * { vector-effect: non-scaling-stroke; }+ svg .semantic-sigil .sigil-fill { fill: currentColor; stroke: none; }+ svg .s-frontend { color: var(--frontend-stroke); }+ svg .s-backend { color: var(--backend-stroke); }+ svg .s-database { color: var(--database-stroke); }+ svg .s-cloud { color: var(--cloud-stroke); }+ svg .s-security { color: var(--security-stroke); }+ svg .s-messagebus { color: var(--messagebus-stroke); }+ svg .s-external { color: var(--external-stroke); }++ /* Reading Depth is a viewer-only level-of-detail layer. MAP preserves the+ authored structure and primary labels, READ restores relationship labels+ and node context, and FULL restores tags and fine annotations. Semantic+ intent can reveal the relevant detail without moving any geometry. */+ svg [data-detail] { transition: opacity 160ms ease; }+ svg [data-detail-anchor] {+ transform-box: fill-box;+ transform-origin: center;+ transition: transform 160ms ease;+ }+ .diagram-container[data-detail-level="map"] svg [data-detail="context"],+ .diagram-container[data-detail-level="map"] svg [data-detail="fine"],+ .diagram-container[data-detail-level="read"] svg [data-detail="fine"] {+ opacity: 0;+ pointer-events: none;+ }+ .diagram-container[data-detail-level="map"] svg [data-detail-anchor] {+ transform: translateY(8px);+ }++ /* Focus, lens, preview, route, and story states are stronger reader intent than+ the global zoom level. Reveal only their exact semantic matches. */+ svg[data-focus-active] [data-focus-match][data-detail],+ svg[data-focus-active] [data-focus-match] [data-detail],+ svg[data-lens-active] [data-lens-match][data-detail],+ svg[data-lens-active] [data-lens-match] [data-detail],+ svg[data-legend-preview-active] [data-legend-preview-match][data-detail],+ svg[data-legend-preview-active] [data-legend-preview-match] [data-detail],+ svg[data-intent-trace-active] [data-intent-trace-match][data-detail],+ svg[data-intent-trace-active] [data-intent-trace-match] [data-detail],+ svg[data-route-active] [data-route-match][data-detail],+ svg[data-route-active] [data-route-match] [data-detail],+ svg[data-story-active] [data-story-step][data-detail],+ svg[data-story-active] [data-story-step] [data-detail],+ svg[data-relationship-preview-active] [data-relationship-preview][data-detail],+ svg[data-relationship-preview-active] [data-relationship-preview] [data-detail],+ svg [data-node-id]:hover [data-detail],+ svg [data-node-id]:focus-visible [data-detail] {+ opacity: 1;+ pointer-events: auto;+ }+ svg[data-focus-active] [data-focus-match] [data-detail-anchor],+ svg[data-lens-active] [data-lens-match] [data-detail-anchor],+ svg[data-legend-preview-active] [data-legend-preview-match] [data-detail-anchor],+ svg[data-intent-trace-active] [data-intent-trace-match] [data-detail-anchor],+ svg[data-route-active] [data-route-match] [data-detail-anchor],+ svg[data-story-active] [data-story-step] [data-detail-anchor],+ svg [data-node-id]:hover [data-detail-anchor],+ svg [data-node-id]:focus-visible [data-detail-anchor] { transform: none; }++ /* Arrows */+ .a-default { stroke: var(--arrow); fill: none; }+ .a-emphasis { stroke: var(--arrow-emphasis); fill: none; }+ .a-security { stroke: var(--security-stroke); fill: none; stroke-dasharray: 5,5; }+ .a-dashed { stroke: var(--database-stroke); fill: none; stroke-dasharray: 4,4; }++ /* Arrowhead markers reference these */+ .m-default { fill: var(--arrow); }+ .m-emphasis { fill: var(--arrow-emphasis); }+ .m-security { fill: var(--security-stroke); }+ .m-dashed { fill: var(--database-stroke); }++ /* Stable semantic exploration hooks emitted by every renderer. */+ svg [data-node-id] {+ cursor: pointer;+ transition: opacity 0.18s ease, filter 0.18s ease;+ }+ svg [data-edge-from] { transition: opacity 0.18s ease, filter 0.18s ease; }+ svg [data-node-id]:hover,+ svg [data-node-id]:focus-visible {+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ outline: none;+ }+ svg [data-legend-kind][role="button"] { cursor: pointer; }+ svg [data-legend-kind]:focus { outline: none; }+ svg [data-legend-hit] {+ fill: transparent;+ stroke: transparent;+ stroke-width: 1.4;+ pointer-events: all;+ vector-effect: non-scaling-stroke;+ transition: stroke 150ms ease, stroke-width 150ms ease, filter 150ms ease;+ }+ svg [data-legend-count-badge] { pointer-events: none; }+ svg [data-legend-count-badge] rect {+ fill: var(--mask);+ stroke: var(--panel-border);+ stroke-width: 1;+ vector-effect: non-scaling-stroke;+ }+ svg [data-legend-count-badge] text {+ fill: var(--text-muted);+ font-size: 7px;+ font-weight: 700;+ text-anchor: middle;+ }+ svg [data-legend-kind][role="button"]:hover [data-legend-hit] {+ stroke: color-mix(in srgb, var(--database-stroke) 58%, transparent);+ }+ svg [data-legend-kind][role="button"]:focus-visible [data-legend-hit] {+ stroke: var(--frontend-stroke);+ stroke-width: 1.8;+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ svg [data-legend-kind][data-legend-selected] [data-legend-hit] {+ stroke: var(--database-stroke);+ stroke-width: 2.2;+ stroke-dasharray: 3 2;+ }+ svg [data-legend-kind][data-legend-selected] [data-legend-count-badge] rect {+ stroke: var(--database-stroke);+ stroke-width: 1.8;+ }+ svg [data-legend-kind][data-legend-zero] { opacity: 0.44; }+ svg[data-preset="signal-flow"] [data-legend-kind][data-legend-selected] [data-legend-hit] {+ filter: drop-shadow(0 0 4px var(--database-stroke));+ }+ svg[data-preset="blueprint"] [data-legend-hit],+ svg[data-preset="blueprint"] [data-legend-count-badge] rect { rx: 0; filter: none; }+ svg[data-legend-preview-active] [data-node-id],+ svg[data-legend-preview-active] [data-edge-from] { opacity: 0.11; }+ svg[data-legend-preview-active] [data-legend-preview-match] { opacity: 1; }+ svg[data-legend-preview-active] [data-legend-preview-peer] { opacity: 0.62; }+ svg[data-legend-preview-active] [data-legend-preview-selected] {+ filter: drop-shadow(0 0 8px var(--database-stroke));+ }+ svg[data-lens-active] [data-node-id],+ svg[data-lens-active] [data-edge-from] { opacity: 0.11; }+ svg[data-lens-active] [data-lens-match] { opacity: 1; }+ svg[data-lens-active] [data-lens-peer] { opacity: 0.62; }+ svg[data-lens-active] [data-lens-selected] {+ filter: drop-shadow(0 0 10px var(--database-stroke));+ }+ .semantic-lens-overlay { pointer-events: none; }+ .semantic-lens-flow {+ fill: none;+ stroke-width: 3.05;+ stroke-linecap: round;+ stroke-dasharray: 0.075 0.925;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0.9;+ animation: archify-semantic-lens-flow 1.35s linear 1 both;+ animation-delay: var(--lens-flow-delay, 0s);+ }+ .semantic-lens-flow[data-direction="out"],+ .semantic-lens-flow[data-direction="forward"] {+ stroke: var(--frontend-stroke);+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ .semantic-lens-flow[data-direction="in"],+ .semantic-lens-flow[data-direction="reverse"] {+ stroke: var(--database-stroke);+ filter: drop-shadow(0 0 3px var(--database-stroke));+ }+ .semantic-lens-flow[data-direction="within"] {+ stroke: var(--messagebus-stroke);+ filter: drop-shadow(0 0 3px var(--messagebus-stroke));+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow {+ stroke-width: 3.7;+ opacity: 1;+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="out"],+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="forward"] {+ filter: drop-shadow(0 0 6px var(--frontend-stroke));+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="in"],+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="reverse"] {+ filter: drop-shadow(0 0 6px var(--database-stroke));+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="within"] {+ filter: drop-shadow(0 0 6px var(--messagebus-stroke));+ }+ svg[data-preset="blueprint"] .semantic-lens-flow {+ stroke-width: 2.45;+ stroke-linecap: square;+ filter: none;+ opacity: 0.78;+ }+ html[data-embed="true"] .semantic-lens-overlay { display: none; }+ svg[data-focus-active] [data-node-id],+ svg[data-focus-active] [data-edge-from] { opacity: 0.13; }+ svg[data-focus-active] [data-focus-match] { opacity: 1; }+ svg[data-focus-active] [data-focus-selected] {+ filter: drop-shadow(0 0 10px var(--frontend-stroke));+ }++ /* Direct Relationship Explorer makes authored paths a real input surface+ without changing their visible stroke or canonical SVG. A transparent+ runtime rail supplies forgiving pointer geometry; the exact authored+ path and endpoints continue to carry every visible state. */+ .relationship-hit-overlay { pointer-events: none; }+ .relationship-hit-target { outline: none; }+ .relationship-hit-rail {+ fill: none;+ stroke: transparent;+ stroke-width: 24;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ pointer-events: stroke;+ cursor: pointer;+ }+ .relationship-focus-rail {+ fill: none;+ stroke: color-mix(in srgb, var(--frontend-stroke) 34%, transparent);+ stroke-width: 6;+ stroke-dasharray: 2 4;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ pointer-events: none;+ opacity: 0;+ }+ .relationship-hit-target:focus-visible .relationship-focus-rail {+ opacity: 1;+ }+ svg[data-preset="blueprint"] .relationship-hit-target:focus-visible .relationship-focus-rail {+ stroke-linecap: square;+ filter: none;+ }+ svg[data-relationship-direct-active] [data-node-id],+ svg[data-relationship-direct-active] [data-edge-from] { opacity: 0.16; }+ svg[data-relationship-direct-active] [data-relationship-preview],+ svg[data-relationship-direct-active] [data-relationship-preview-node] { opacity: 1; }+ svg[data-focus-active]:not([data-relationship-pin-active]) .relationship-hit-rail,+ svg[data-story-active] .relationship-hit-rail,+ svg[data-route-picking] .relationship-hit-rail,+ svg[data-route-active] .relationship-hit-rail,+ svg[data-lens-active] .relationship-hit-rail,+ svg[data-chapter-preview] .relationship-hit-rail { pointer-events: none; }+ html[data-embed="true"] .relationship-hit-overlay { display: none; }+ @media (hover: none), (pointer: coarse) {+ .relationship-hit-rail { stroke-width: 24; }+ }++ /* Relationship Preview is temporary exploration state layered on top of+ neighborhood focus. It changes emphasis only; exported geometry and the+ relationship's original solid/dashed visual language stay untouched. */+ svg[data-relationship-preview-active] [data-focus-match] { opacity: 0.18; }+ svg[data-relationship-preview-active] [data-relationship-preview],+ svg[data-relationship-preview-active] [data-relationship-preview-node] { opacity: 1; }+ svg[data-relationship-preview-active] [data-relationship-preview] {+ filter: drop-shadow(0 0 5px var(--arrow-emphasis));+ }+ svg[data-relationship-preview-active] [data-relationship-preview] path,+ svg[data-relationship-preview-active] path[data-relationship-preview],+ svg[data-relationship-preview-active] [data-relationship-preview] line,+ svg[data-relationship-preview-active] line[data-relationship-preview],+ svg[data-relationship-preview-active] [data-relationship-preview] polyline,+ svg[data-relationship-preview-active] polyline[data-relationship-preview] {+ stroke-width: 2.75;+ }+ svg[data-relationship-preview-active] [data-relationship-preview-source] {+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ }+ svg[data-relationship-preview-active] [data-relationship-preview-target] {+ filter: drop-shadow(0 0 7px var(--database-stroke));+ }+ .relationship-pulse-overlay { pointer-events: none; }+ .relationship-flow-pulse {+ fill: none;+ stroke: var(--arrow-emphasis);+ stroke-width: 3.35;+ stroke-linecap: round;+ stroke-dasharray: 0.085 0.915;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0;+ filter: drop-shadow(0 0 4px var(--arrow-emphasis));+ animation: archify-relationship-pulse 1.2s linear 1 both;+ }+ svg[data-preset="signal-flow"] .relationship-flow-pulse {+ stroke: var(--frontend-stroke);+ stroke-width: 3.85;+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ }+ svg[data-preset="blueprint"] .relationship-flow-pulse {+ stroke-width: 2.5;+ stroke-linecap: square;+ filter: none;+ }+ .semantic-flow-token {+ color: var(--frontend-stroke);+ opacity: 0;+ pointer-events: none;+ }+ .relationship-flow-token {+ animation: archify-relationship-token-life 1.2s linear 1 both;+ }+ .story-flow-token {+ animation: archify-relationship-token-life 0.78s linear 1 both;+ }+ .semantic-flow-token-halo {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.1;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ }+ .relationship-flow-token-shape {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-ink {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.05;+ stroke-linecap: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-dot { fill: currentColor; stroke: none; }+ .semantic-flow-token[data-token-kind="data"] { color: var(--database-stroke); }+ .semantic-flow-token[data-token-kind="event"] { color: var(--messagebus-stroke); }+ .semantic-flow-token[data-token-kind="security"] { color: var(--security-stroke); }+ .semantic-flow-token[data-token-kind="state"] { color: var(--cloud-stroke); }+ svg[data-preset="signal-flow"] .semantic-flow-token {+ filter: drop-shadow(0 0 5px currentColor);+ }+ svg[data-preset="blueprint"] .semantic-flow-token { filter: none; }+ html[data-embed="true"] .relationship-pulse-overlay { display: none; }++ /* Intent Trace is a temporary, pre-click exploration layer. Related+ topology stays readable while a short viewer-only signal runs over+ cloned edge geometry; the authored edge remains untouched underneath. */+ svg[data-intent-trace-active] [data-node-id],+ svg[data-intent-trace-active] [data-edge-from] { opacity: 0.2; }+ svg[data-intent-trace-active] [data-intent-trace-match] { opacity: 1; }+ svg[data-intent-trace-active] [data-intent-trace-selected] {+ filter: drop-shadow(0 0 10px var(--frontend-stroke));+ }+ .intent-trace-overlay { pointer-events: none; }+ .intent-trace-flow {+ fill: none;+ stroke-width: 3.1;+ stroke-linecap: round;+ stroke-dasharray: 0.1 0.9;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0.94;+ animation: archify-intent-trace-flow 1.15s linear 1 both;+ }+ .intent-trace-flow[data-direction="out"] {+ stroke: var(--frontend-stroke);+ filter: drop-shadow(0 0 4px var(--frontend-stroke));+ }+ .intent-trace-flow[data-direction="in"] {+ stroke: var(--database-stroke);+ filter: drop-shadow(0 0 4px var(--database-stroke));+ animation-direction: reverse;+ }+ .intent-trace-flow[data-direction="loop"] {+ stroke: var(--security-stroke);+ filter: drop-shadow(0 0 4px var(--security-stroke));+ }+ svg[data-preset="blueprint"] [data-intent-trace-selected],+ svg[data-preset="blueprint"] .intent-trace-flow {+ filter: none;+ stroke-linecap: square;+ }+ .intent-trace-status {+ 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;+ }++ /* Route Probe separates a durable two-point query from selection and+ one-hop hover. Only the chosen shortest directed path stays prominent;+ the traveling signal is cloned viewer geometry and never authored SVG. */+ svg[data-route-picking="target"] [data-node-id] { opacity: 0.24; }+ svg[data-route-picking="target"] [data-route-candidate],+ svg[data-route-picking="target"] [data-route-start] { opacity: 1; }+ svg[data-route-picking] [data-node-id] { cursor: crosshair; }+ svg[data-route-picking] [data-route-start] {+ filter: drop-shadow(0 0 10px var(--frontend-stroke));+ }+ svg[data-route-active] [data-node-id],+ svg[data-route-active] [data-edge-from] { opacity: 0.11; }+ svg[data-route-active] [data-route-match] { opacity: 1; }+ svg[data-route-active] [data-route-start] {+ filter: drop-shadow(0 0 11px var(--frontend-stroke));+ }+ svg[data-route-active] [data-route-end] {+ filter: drop-shadow(0 0 11px var(--security-stroke));+ }+ svg[data-route-active] [data-route-step]:not([data-route-start]):not([data-route-end]) {+ filter: drop-shadow(0 0 7px var(--backend-stroke));+ }+ svg[data-route-journey] [data-route-match][data-route-journey-state="past"] { opacity: 0.62; }+ svg[data-route-journey] [data-route-match][data-route-journey-state="future"] { opacity: 0.34; }+ svg[data-route-journey] [data-route-match][data-route-journey-state="current"] { opacity: 1; }+ svg[data-route-journey] [data-node-id][data-route-journey-current] {+ filter: drop-shadow(0 0 10px var(--backend-stroke));+ }+ svg[data-route-journey] [data-edge-from][data-route-journey-current] {+ opacity: 1;+ filter: drop-shadow(0 0 6px var(--backend-stroke));+ }+ .route-probe-overlay { pointer-events: none; }+ .route-journey-overlay { pointer-events: none; }+ .route-probe-flow {+ fill: none;+ stroke: var(--backend-stroke);+ stroke-width: 3.25;+ stroke-linecap: round;+ stroke-dasharray: 0.085 0.915;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ filter: drop-shadow(0 0 5px var(--backend-stroke));+ animation: archify-route-probe-flow 1.1s cubic-bezier(0.22, 1, 0.36, 1) 1 both;+ animation-delay: calc(var(--route-step, 0) * 0.16s);+ }+ .route-journey-flow {+ fill: none;+ stroke: var(--backend-stroke);+ stroke-width: 3.5;+ stroke-linecap: round;+ stroke-dasharray: 0.1 0.9;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0;+ filter: drop-shadow(0 0 6px var(--backend-stroke));+ animation: archify-route-journey-flow 780ms cubic-bezier(0.22, 1, 0.36, 1) 1 both;+ }+ svg[data-preset="blueprint"] [data-route-start],+ svg[data-preset="blueprint"] [data-route-end],+ svg[data-preset="blueprint"] [data-route-step],+ svg[data-preset="blueprint"] .route-probe-flow {+ filter: none;+ stroke-linecap: square;+ }+ svg[data-preset="blueprint"] .route-journey-flow {+ filter: none;+ stroke-linecap: square;+ }++ svg[data-preset="blueprint"] .c-grid {+ stroke-dasharray: 1 3;+ opacity: 0.78;+ }+ svg[data-preset="blueprint"] .c-region {+ fill: color-mix(in srgb, var(--cloud-fill) 58%, transparent);+ stroke-dasharray: 12 4 2 4;+ }+ svg[data-preset="blueprint"] .c-security-group,+ svg[data-preset="blueprint"] .c-lane { stroke-dasharray: 7 3; }+ svg[data-preset="blueprint"] [data-node-id]:hover,+ svg[data-preset="blueprint"] [data-node-id]:focus-visible {+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ svg[data-preset="blueprint"][data-focus-active] [data-focus-selected] {+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview],+ svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-source],+ svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-target] {+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }++ /* Story Trail is a viewer-only overlay derived from the ordered focus IDs+ of the active guided view. The authored edge stays underneath with its+ original color, dash pattern, marker, and geometry intact. */+ .story-trail-overlay { pointer-events: none; }+ .story-carrier-overlay { pointer-events: none; }+ .story-trail-flow {+ fill: none;+ stroke: var(--frontend-stroke);+ stroke-width: 2.8;+ stroke-linecap: round;+ vector-effect: non-scaling-stroke;+ opacity: 0.34;+ filter: drop-shadow(0 0 2px var(--frontend-stroke));+ }+ svg[data-story-beat] [data-story-step] {+ opacity: 0.22;+ filter: saturate(0.42);+ transition: opacity 180ms ease, filter 180ms ease;+ }+ svg[data-story-beat] [data-story-step][data-story-beat-state="past"] {+ opacity: 0.72;+ filter: saturate(0.82);+ }+ svg[data-story-beat] [data-story-step][data-story-beat-state="next"] {+ opacity: 0.5;+ filter: saturate(0.66);+ }+ svg[data-story-beat] [data-story-step][data-story-beat-state="active"] {+ opacity: 1;+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ animation: archify-story-beat-node 360ms cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ svg[data-story-beat] [data-edge-from][data-story-beat-step] {+ opacity: 0.16;+ transition: opacity 160ms ease;+ }+ svg[data-story-beat] [data-edge-from][data-story-beat-step][data-story-beat-state="past"] { opacity: 0.58; }+ svg[data-story-beat] [data-edge-from][data-story-beat-step][data-story-beat-state="next"] { opacity: 0.34; }+ svg[data-story-beat] [data-edge-from][data-story-beat-step][data-story-beat-state="active"] { opacity: 1; }+ svg[data-story-beat] .story-trail-flow { opacity: 0; transition: opacity 160ms ease; }+ svg[data-story-beat] .story-trail-flow[data-story-beat-state="past"] { opacity: 0.34; }+ svg[data-story-beat] .story-trail-flow[data-story-beat-state="next"] { opacity: 0.2; }+ svg[data-story-beat] .story-trail-flow[data-story-beat-state="active"] { opacity: 0.92; }+ svg[data-story-beat] .story-trail-flow[data-story-pulse="true"] {+ stroke-dasharray: 2 13;+ stroke-dashoffset: 30;+ opacity: 0.92;+ animation: archify-story-flow 0.78s linear 1 both;+ }+ svg[data-preset="blueprint"] .story-trail-flow {+ stroke-linecap: square;+ filter: none;+ opacity: 0.5;+ }+ svg[data-preset="blueprint"][data-story-beat] [data-story-step][data-story-beat-state="active"] {+ filter: none;+ animation: none;+ }++ /* Chapter Delta Preview is a static, pre-commit comparison between two+ chapter focus sets. Symbols in the rail carry the meaning without color;+ these SVG rules only make exact stable-ID membership easier to scan. */+ svg[data-chapter-preview] [data-node-id],+ svg[data-chapter-preview] [data-edge-from] {+ opacity: 0.1 !important;+ filter: none !important;+ transition: none !important;+ }+ svg[data-chapter-preview] .story-trail-overlay { opacity: 0.08 !important; }+ svg[data-chapter-preview] [data-node-id][data-chapter-preview-role="stay"] {+ opacity: 0.76 !important;+ filter: saturate(0.7) !important;+ }+ svg[data-chapter-preview] [data-node-id][data-chapter-preview-role="enter"] {+ opacity: 1 !important;+ filter: saturate(1.2) !important;+ }+ svg[data-chapter-preview] [data-node-id][data-chapter-preview-role="leave"] {+ opacity: 0.28 !important;+ filter: grayscale(0.72) !important;+ }+ svg[data-preset="blueprint"][data-chapter-preview] [data-node-id] { filter: none !important; }++ /* Dashed boundary variants */+ .c-security-group { fill: transparent; stroke: var(--security-stroke); stroke-dasharray: 4,4; }+ .c-region { fill: rgba(251, 191, 36, 0.05); stroke: var(--cloud-stroke); stroke-dasharray: 8,4; }+ .c-lane { fill: var(--lane-fill); stroke: var(--lane-stroke); stroke-dasharray: 6,6; }++ /* Optional trace animation, enabled only by meta.animation = "trace".+ The ordinary viewer performs one ambient pass and then restores the+ authored solid/security/async line language. WebM samples the same+ authored geometry into an explicit canvas timeline. */+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"] {+ animation: archify-edge-flow 2.4s linear 1;+ animation-delay: calc(var(--step, 0) * 160ms);+ }+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"] {+ transform-box: fill-box;+ transform-origin: center;+ animation: archify-node-pulse 3.6s ease-in-out 1;+ animation-delay: calc(var(--step, 0) * 160ms);+ }+ svg[data-preset="signal-flow"][data-animation="trace"] [data-animate="edge"] {+ stroke-linecap: round;+ filter: drop-shadow(0 0 3px var(--arrow-emphasis));+ animation-duration: 1.75s;+ }+ svg[data-preset="signal-flow"][data-animation="trace"] [data-animate="node"] {+ animation-duration: 3.1s;+ }+ svg[data-preset="blueprint"][data-animation="trace"] [data-animate="edge"] {+ stroke-linecap: square;+ filter: none;+ animation-duration: 2.15s;+ }+ svg[data-preset="blueprint"][data-animation="trace"] [data-animate="node"] {+ animation-name: archify-blueprint-node-pulse;+ animation-duration: 3.8s;+ }+ /* Embedded proofs are static until a named Story Trail chapter is played.+ This keeps proof grids calm and ensures ?play=1 stops all viewer motion+ after one 3.2 second chapter instead of leaving ambient trace loops on. */+ html[data-embed="true"] svg[data-animation="trace"] [data-animate],+ html[data-share-playback="true"] svg[data-animation="trace"] [data-animate] {+ animation: none !important;+ stroke-dashoffset: 0;+ }+ @keyframes archify-edge-flow {+ 0% { stroke-dasharray: 10 8; stroke-dashoffset: 54; opacity: 0.42; }+ 88% { stroke-dasharray: 10 8; stroke-dashoffset: 0; opacity: 1; }+ 99.9% { stroke-dasharray: 10 8; stroke-dashoffset: 0; opacity: 1; }+ 100% { stroke-dashoffset: 0; opacity: 1; }+ }+ @keyframes archify-node-pulse {+ 0%, 72%, 100% { filter: none; stroke-width: 1.5; }+ 18%, 36% {+ filter: drop-shadow(0 0 8px var(--arrow-emphasis));+ stroke-width: 2.4;+ }+ }+ @keyframes archify-blueprint-node-pulse {+ 0%, 72%, 100% { opacity: 1; filter: none; }+ 18%, 36% { opacity: 0.72; filter: drop-shadow(0 0 2px var(--frontend-stroke)); }+ }+ @keyframes archify-signal-scan {+ 0%, 18% { opacity: 1; transform: translateX(-70%); }+ 70% { opacity: 1; transform: translateX(70%); }+ 100% { opacity: 0; transform: translateX(70%); }+ }+ @keyframes archify-radar-live {+ 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--backend-stroke) 52%, transparent); }+ 55%, 100% { box-shadow: 0 0 0 0.32rem transparent; }+ }+ @keyframes archify-guided-progress {+ from { transform: scaleX(var(--guided-progress-start, 0)); }+ to { transform: scaleX(1); }+ }+ @keyframes archify-story-flow {+ to { stroke-dashoffset: 0; }+ }+ @keyframes archify-intent-trace-flow {+ 0% { opacity: 0.28; stroke-dashoffset: 0; }+ 12%, 78% { opacity: 0.94; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-route-probe-flow {+ 0% { stroke-dashoffset: 0; opacity: 0.96; }+ 78% { stroke-dashoffset: -1; opacity: 0.96; }+ 100% { stroke-dasharray: none; stroke-dashoffset: 0; opacity: 0.58; }+ }+ @keyframes archify-route-journey-flow {+ 0% { opacity: 0.16; stroke-dashoffset: 0; }+ 14%, 76% { opacity: 1; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-semantic-lens-flow {+ 0% { opacity: 0.2; stroke-dashoffset: 0; }+ 12%, 78% { opacity: 0.9; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-relationship-pulse {+ 0% { opacity: 0.18; stroke-dashoffset: 0; }+ 10%, 76% { opacity: 0.98; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-relationship-token-life {+ 0%, 7% { opacity: 0; }+ 13%, 82% { opacity: 1; }+ 100% { opacity: 0; }+ }+ @keyframes archify-story-beat-node {+ from { opacity: 0.48; filter: saturate(0.6); }+ 58% { opacity: 1; filter: drop-shadow(0 0 10px var(--frontend-stroke)); }+ to { opacity: 1; filter: drop-shadow(0 0 7px var(--frontend-stroke)); }+ }+ @keyframes archify-share-cue-enter {+ from { opacity: 0; transform: translate(-50%, -0.45rem); }+ to { opacity: 1; transform: translate(-50%, 0); }+ }+ @keyframes archify-share-cue-pulse {+ 0%, 100% { opacity: 1; transform: scale(1); }+ 50% { opacity: 0.48; transform: scale(0.78); }+ }+ @media (prefers-reduced-motion: reduce) {+ html[data-preset="signal-flow"] .diagram-container::before {+ animation: none !important;+ }+ .pulse-dot { animation: none !important; }+ svg[data-animation="trace"] [data-animate] {+ animation: none !important;+ stroke-dashoffset: 0;+ }+ .guided-view-progress span {+ animation: none !important;+ transform: scaleX(1) !important;+ }+ .story-trail-flow,+ .intent-trace-flow,+ .route-probe-flow,+ .semantic-lens,+ .diagram-guide,+ [data-story-step],+ .overview-map-live,+ .guided-view-stop,+ .share-chapter-cue,+ .chapter-handoff-anchor,+ .share-chapter-state::before,+ .share-chapter-progress span { animation: none !important; }+ .guided-view-chapter,+ svg[data-chapter-preview] [data-node-id],+ svg[data-chapter-preview] [data-edge-from] { transition: none !important; }+ svg[data-story-playing="true"] .story-trail-flow {+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.55;+ }+ .intent-trace-flow {+ animation: none !important;+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.72;+ }+ .route-probe-flow {+ animation: none !important;+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.78;+ }+ .route-journey-overlay,+ .story-carrier-overlay { display: none !important; }+ .semantic-lens-flow {+ animation: none !important;+ stroke-dasharray: none;+ stroke-width: 2.2;+ opacity: 0.34;+ filter: none;+ }+ .relationship-pulse-overlay { display: none !important; }+ .guided-view-chapter { transition: none !important; }+ svg [data-node-id], svg [data-edge-from], svg [data-detail], svg [data-detail-anchor], svg [data-legend-hit], svg { transition: none !important; }+ }+ </style>+</head>+<body>+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.+ Motion appears only for trace-enabled artifacts and has no shortcut;+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. -->+ <div class="toolbar" role="toolbar" aria-label="Diagram actions">+ <button id="btn-theme" type="button"+ title="Toggle theme (T)"+ aria-label="Toggle color theme"+ aria-pressed="false"><span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button>+ <button id="btn-motion" type="button" hidden+ title="Pause motion"+ aria-label="Pause motion"+ aria-pressed="true">+ <span class="motion-control-dot" aria-hidden="true"></span>+ <span id="motion-label">Live</span>+ </button>+ <button id="btn-present" type="button"+ title="Presentation stage (F)"+ aria-label="Enter presentation stage"+ aria-pressed="false">+ <span id="present-icon" aria-hidden="true">□</span>+ <span id="present-label">Present</span>+ </button><div class="export-wrap"><button id="btn-export" type="button"title="Export diagram (E)"@@ -516,719 +3795,7597 @@<button data-format="webp" type="button" role="menuitem" tabindex="-1">Download WebP</button><hr role="separator"><button data-format="svg" type="button" role="menuitem" tabindex="-1">Download SVG <span class="hint">vector</span></button>+ <button data-format="webm" type="button" role="menuitem" tabindex="-1">Download WebM <span class="hint">6s motion</span></button>+ </div>+ </div>+ </div>++ <div class="container">+ <!-- Header -->+ <div class="header">+ <div class="header-row">+ <div class="pulse-dot"></div>+ <h1>Archify</h1>+ </div>+ <p class="subtitle">Agent skill → JSON IR → typed renderers → standalone HTML</p>+ </div>++ <script id="archify-guided-views-data" type="application/json">[]</script>+ <div class="guided-views no-print" id="guided-views" hidden aria-label="Guided diagram views">+ <button id="guided-view-prev" type="button" aria-label="Previous guided view" title="Previous guided view ([)">←</button>+ <div class="guided-view-copy">+ <div class="guided-view-meta">+ <span>Guided views</span>+ <span id="guided-view-count"></span>+ <span class="guided-view-progress" aria-hidden="true"><span id="guided-view-progress-bar"></span></span>+ <span class="guided-view-handoff" id="guided-view-handoff" hidden aria-hidden="true"></span>+ </div>+ <strong id="guided-view-label">Explore this system</strong>+ <small id="guided-view-note" aria-live="polite" aria-atomic="true">Step through curated paths without changing the source diagram.</small>+ <div class="guided-view-trail" id="guided-view-trail" hidden role="group" aria-label="Story trail"></div>+ <div class="guided-story-caption" id="guided-story-caption" hidden aria-live="polite" aria-atomic="true">+ <span class="guided-story-caption-index" id="guided-story-caption-index">Beat</span>+ <strong id="guided-story-caption-route"></strong>+ <small id="guided-story-caption-detail"></small>+ <span class="guided-story-caption-next" id="guided-story-caption-next" hidden aria-hidden="true">+ <small>Next</small>+ <strong id="guided-story-caption-next-label"></strong>+ </span>+ </div>+ </div>+ <button id="guided-view-next" type="button" aria-label="Next guided view" title="Next guided view (])">→</button>+ <div class="guided-view-actions">+ <button class="guided-view-play" id="guided-view-play" type="button" aria-label="Play guided story" aria-pressed="false" title="Play guided story (P)">+ <span id="guided-view-play-icon" aria-hidden="true">▶</span>+ <span id="guided-view-play-label">Play story</span>+ </button>+ <button class="guided-view-beat-link" id="guided-view-beat-link" type="button" aria-label="Select a Story Beat to copy its exact link" title="Select a Story Beat to copy its exact link" disabled>+ <span aria-hidden="true">#</span>+ <span id="guided-view-beat-link-label">Copy moment</span>+ </button>+ <button class="guided-view-all" id="guided-view-all" type="button" aria-label="Show entire diagram">Show all</button>+ </div>+ <nav class="guided-view-index" id="guided-view-index" aria-label="Story chapters">+ <ol class="guided-view-chapters" id="guided-view-chapters"></ol>+ </nav>+ </div>++ <!-- Main Diagram -->+ <div class="diagram-container" data-detail-level="map">+ <svg viewBox="0 0 1340 568" role="img" aria-labelledby="archify-diagram-title archify-diagram-description" data-preset="classic" data-quality-profile="standard" data-quality-gates="advisory">+ <title id="archify-diagram-title">Archify</title>+ <desc id="archify-diagram-description">Agent skill → JSON IR → typed renderers → standalone HTML</desc>+ <!-- Definitions -->+ <defs>+ <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-default" />+ </marker>+ <marker id="arrowhead-emphasis" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-emphasis" />+ </marker>+ <marker id="arrowhead-security" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-security" />+ </marker>+ <marker id="arrowhead-dashed" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-dashed" />+ </marker>+ <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">+ <path d="M 40 0 L 0 0 0 40" class="c-grid" stroke-width="0.5"/>+ </pattern>+ </defs>++ <!-- Background Grid -->+ <rect width="100%" height="100%" fill="url(#grid)" />++ <!-- Boundaries (behind everything) -->+ <rect data-graph-role="structural-frame" data-composition-frame-kind="region" data-composition-frame-id="0" x="370" y="110" width="770" height="270" rx="12" class="c-region" stroke-width="1"/>+ <text x="378" y="128" class="t-cloud" font-size="9" font-weight="600">archify/ skill package</text>++ <!-- Connection paths (before components for correct z-order) -->+ <path data-edge-from="user" data-edge-to="agents" data-edge-key="0" data-composition-points="160,330;200,330" d="M 160 330 L 200 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="agents" data-edge-to="skill" data-edge-key="1" data-composition-points="275,300;275,200" d="M 275 300 L 275 200" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>+ <path data-edge-from="agents" data-edge-to="ir" data-edge-label="write IR" data-edge-key="2" data-composition-points="350,330;400,330" d="M 350 330 L 400 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="ir" data-edge-to="schemas" data-edge-key="3" data-composition-points="470,300;470,200" d="M 470 300 L 470 200" class="a-security" stroke-width="1.5" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="ir" data-edge-to="renderers" data-edge-key="4" data-composition-points="540,330;590,330" d="M 540 330 L 590 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="renderers" data-edge-to="template" data-edge-key="5" data-composition-points="730,330;780,330" d="M 730 330 L 780 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="template" data-edge-to="checker" data-edge-key="6" data-composition-points="920,330;970,330" d="M 920 330 L 970 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="checker" data-edge-to="html" data-edge-label="deliver" data-edge-key="7" data-composition-points="1110,330;1160,330" d="M 1110 330 L 1160 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="renderers" data-edge-to="ci" data-edge-key="8" data-composition-points="660,360;660,440" d="M 660 360 L 660 440" class="a-dashed" stroke-width="1.5" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="html" data-edge-to="zip" data-edge-key="9" data-composition-points="1230,300;1230,200" d="M 1230 300 L 1230 200" class="a-dashed" stroke-width="1.5" marker-end="url(#arrowhead-dashed)"/>++ <!-- Components -->+ <g id="node-user" data-node-id="user" data-node-label="You" tabindex="0" role="button" aria-label="Focus You, NL or Mermaid, Architecture component" aria-pressed="false" data-node-kind="external" data-node-sublabel="NL or Mermaid" data-node-context="Architecture component">+ <title>You · NL or Mermaid · Architecture component</title>+ <rect x="40" y="300" width="120" height="60" rx="6" class="c-mask"/>+ <rect x="40" y="300" width="120" height="60" rx="6" class="c-external" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="external" class="semantic-sigil s-external" transform="translate(46 306) scale(0.6875)">+ <rect x="2.5" y="5" width="8.5" height="8" rx="1.5"/>+ <path d="M8 2.5h5.5V8M13.5 2.5 7.5 8.5"/>+ </g>+ <text data-detail-anchor x="100" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">You</text>+ <text data-detail="context" x="100" y="344" class="t-muted" font-size="9" text-anchor="middle">NL or Mermaid</text>+ </g>++ <g id="node-agents" data-node-id="agents" data-node-label="Agent Hosts" tabindex="0" role="button" aria-label="Focus Agent Hosts, Claude · Codex · opencode, Architecture component" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="Claude · Codex · opencode" data-node-context="Architecture component">+ <title>Agent Hosts · Claude · Codex · opencode · Architecture component</title>+ <rect x="200" y="300" width="150" height="60" rx="6" class="c-mask"/>+ <rect x="200" y="300" width="150" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(206 306) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g>+ <text data-detail-anchor x="275" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Agent Hosts</text>+ <text data-detail="context" x="275" y="344" class="t-muted" font-size="9" text-anchor="middle">Claude · Codex · opencode</text>+ </g>++ <g id="node-skill" data-node-id="skill" data-node-label="SKILL.md" tabindex="0" role="button" aria-label="Focus SKILL.md, layout judgment, Architecture component" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="layout judgment" data-node-tag="prompt dialect" data-node-context="Architecture component">+ <title>SKILL.md · layout judgment · Architecture component · prompt dialect</title>+ <rect x="200" y="140" width="150" height="60" rx="6" class="c-mask"/>+ <rect x="200" y="140" width="150" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(206 146) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g>+ <text data-detail-anchor x="275" y="168" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">SKILL.md</text>+ <text data-detail="context" x="275" y="184" class="t-muted" font-size="9" text-anchor="middle">layout judgment</text>+ <text data-detail="fine" x="275" y="192" class="t-frontend" font-size="7" text-anchor="middle">prompt dialect</text>+ </g>++ <g id="node-ir" data-node-id="ir" data-node-label="JSON IR" tabindex="0" role="button" aria-label="Focus JSON IR, schema_version: 1, archify/ skill package" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="schema_version: 1" data-node-context="archify/ skill package">+ <title>JSON IR · schema_version: 1 · archify/ skill package</title>+ <rect x="400" y="300" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="400" y="300" width="140" height="60" rx="6" class="c-messagebus" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(406 306) scale(0.6875)">+ <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>+ <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>+ <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>+ <circle cx="7" cy="11.5" r="1" class="sigil-fill"/>+ </g>+ <text data-detail-anchor x="470" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">JSON IR</text>+ <text data-detail="context" x="470" y="344" class="t-muted" font-size="9" text-anchor="middle">schema_version: 1</text>+ </g>++ <g id="node-schemas" data-node-id="schemas" data-node-label="JSON Schema" tabindex="0" role="button" aria-label="Focus JSON Schema, ajv strict, archify/ skill package" aria-pressed="false" data-node-kind="security" data-node-sublabel="ajv strict" data-node-tag="fail-closed" data-node-context="archify/ skill package">+ <title>JSON Schema · ajv strict · archify/ skill package · fail-closed</title>+ <rect x="400" y="140" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="400" y="140" width="140" height="60" rx="6" class="c-security" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(406 146) scale(0.6875)">+ <path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>+ <path d="m5.8 8 1.5 1.5 3-3"/>+ </g>+ <text data-detail-anchor x="470" y="168" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">JSON Schema</text>+ <text data-detail="context" x="470" y="184" class="t-muted" font-size="9" text-anchor="middle">ajv strict</text>+ <text data-detail="fine" x="470" y="192" class="t-security" font-size="7" text-anchor="middle">fail-closed</text>+ </g>++ <g id="node-renderers" data-node-id="renderers" data-node-label="Renderers ×5" tabindex="0" role="button" aria-label="Focus Renderers ×5, layout checks, archify/ skill package" aria-pressed="false" data-node-kind="backend" data-node-sublabel="layout checks" data-node-tag="no auto-layout" data-node-context="archify/ skill package">+ <title>Renderers ×5 · layout checks · archify/ skill package · no auto-layout</title>+ <rect x="590" y="300" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="590" y="300" width="140" height="60" rx="6" class="c-backend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(596 306) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g>+ <text data-detail-anchor x="660" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Renderers ×5</text>+ <text data-detail="context" x="660" y="344" class="t-muted" font-size="9" text-anchor="middle">layout checks</text>+ <text data-detail="fine" x="660" y="352" class="t-backend" font-size="7" text-anchor="middle">no auto-layout</text>+ </g>++ <g id="node-template" data-node-id="template" data-node-label="template.html" tabindex="0" role="button" aria-label="Focus template.html, theme + export, archify/ skill package" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="theme + export" data-node-context="archify/ skill package">+ <title>template.html · theme + export · archify/ skill package</title>+ <rect x="780" y="300" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="780" y="300" width="140" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(786 306) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g>+ <text data-detail-anchor x="850" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">template.html</text>+ <text data-detail="context" x="850" y="344" class="t-muted" font-size="9" text-anchor="middle">theme + export</text>+ </g>++ <g id="node-checker" data-node-id="checker" data-node-label="Output Check" tabindex="0" role="button" aria-label="Focus Output Check, SVG gates, archify/ skill package" aria-pressed="false" data-node-kind="security" data-node-sublabel="SVG gates" data-node-context="archify/ skill package">+ <title>Output Check · SVG gates · archify/ skill package</title>+ <rect x="970" y="300" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="970" y="300" width="140" height="60" rx="6" class="c-security" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(976 306) scale(0.6875)">+ <path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>+ <path d="m5.8 8 1.5 1.5 3-3"/>+ </g>+ <text data-detail-anchor x="1040" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Output Check</text>+ <text data-detail="context" x="1040" y="344" class="t-muted" font-size="9" text-anchor="middle">SVG gates</text>+ </g>++ <g id="node-html" data-node-id="html" data-node-label="HTML Artifact" tabindex="0" role="button" aria-label="Focus HTML Artifact, single file, Architecture component" aria-pressed="false" data-node-kind="cloud" data-node-sublabel="single file" data-node-context="Architecture component">+ <title>HTML Artifact · single file · Architecture component</title>+ <rect x="1160" y="300" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="1160" y="300" width="140" height="60" rx="6" class="c-cloud" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(1166 306) scale(0.6875)">+ <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>+ </g>+ <text data-detail-anchor x="1230" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">HTML Artifact</text>+ <text data-detail="context" x="1230" y="344" class="t-muted" font-size="9" text-anchor="middle">single file</text>+ </g>++ <g id="node-zip" data-node-id="zip" data-node-label="archify.zip" tabindex="0" role="button" aria-label="Focus archify.zip, skill package, Architecture component" aria-pressed="false" data-node-kind="cloud" data-node-sublabel="skill package" data-node-context="Architecture component">+ <title>archify.zip · skill package · Architecture component</title>+ <rect x="1160" y="140" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="1160" y="140" width="140" height="60" rx="6" class="c-cloud" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(1166 146) scale(0.6875)">+ <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>+ </g>+ <text data-detail-anchor x="1230" y="168" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">archify.zip</text>+ <text data-detail="context" x="1230" y="184" class="t-muted" font-size="9" text-anchor="middle">skill package</text>+ </g>++ <g id="node-ci" data-node-id="ci" data-node-label="CI Gates" tabindex="0" role="button" aria-label="Focus CI Gates, golden + zip, Architecture component" aria-pressed="false" data-node-kind="backend" data-node-sublabel="golden + zip" data-node-context="Architecture component">+ <title>CI Gates · golden + zip · Architecture component</title>+ <rect x="590" y="440" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="590" y="440" width="140" height="60" rx="6" class="c-backend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(596 446) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g>+ <text data-detail-anchor x="660" y="468" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">CI Gates</text>+ <text data-detail="context" x="660" y="484" class="t-muted" font-size="9" text-anchor="middle">golden + zip</text>+ </g>++ <!-- Connection labels -->+++ <g data-detail="context" data-edge-from="agents" data-edge-to="ir" data-edge-label="write IR" data-edge-key="2">+ <rect x="350.8" y="310" width="48.4" height="14" rx="3" class="c-mask"/>+ <text x="375" y="320" class="t-backend" font-size="8" text-anchor="middle">write IR</text>+ </g>+++++ <g data-detail="context" data-edge-from="checker" data-edge-to="html" data-edge-label="deliver" data-edge-key="7">+ <rect x="1113.2" y="310" width="43.6" height="14" rx="3" class="c-mask"/>+ <text x="1135" y="320" class="t-backend" font-size="8" text-anchor="middle">deliver</text>+ </g>++++ <!-- Legend -->+ <g data-legend-bridge>+ <text x="40" y="539" class="t-primary" font-size="9" font-weight="600">Legend</text>+ <g data-legend-kind="external">+ <rect x="40" y="544" width="14" height="9" rx="2" class="c-external" stroke-width="1"/>+ <text x="60" y="552" class="t-muted" font-size="8">External</text>+ </g>+ <g data-legend-kind="frontend">+ <rect x="144" y="544" width="14" height="9" rx="2" class="c-frontend" stroke-width="1"/>+ <text x="164" y="552" class="t-muted" font-size="8">Frontend</text>+ </g>+ <g data-legend-kind="messagebus">+ <rect x="248" y="544" width="14" height="9" rx="2" class="c-messagebus" stroke-width="1"/>+ <text x="268" y="552" class="t-muted" font-size="8">Message bus</text>+ </g>+ <g data-legend-kind="security">+ <rect x="367" y="544" width="14" height="9" rx="2" class="c-security" stroke-width="1"/>+ <text x="387" y="552" class="t-muted" font-size="8">Security</text>+ </g>+ <g data-legend-kind="backend">+ <rect x="471" y="544" width="14" height="9" rx="2" class="c-backend" stroke-width="1"/>+ <text x="491" y="552" class="t-muted" font-size="8">Backend</text>+ </g>+ <g data-legend-kind="cloud">+ <rect x="570" y="544" width="14" height="9" rx="2" class="c-cloud" stroke-width="1"/>+ <text x="590" y="552" class="t-muted" font-size="8">Cloud</text>+ </g>+ </g>+ </svg>+ <p class="intent-trace-status no-print" id="intent-trace-status" role="status" aria-live="polite" aria-atomic="true"></p>+ <div class="share-chapter-cue no-print" id="share-chapter-cue" hidden role="status" aria-live="polite">+ <div class="share-chapter-index">+ <span class="share-chapter-state" id="share-chapter-state">Ready</span>+ <span class="share-chapter-count" id="share-chapter-count">Chapter 01 / 01</span>+ </div>+ <div class="share-chapter-copy">+ <strong id="share-chapter-label">Guided chapter</strong>+ <small id="share-chapter-note"></small>+ </div>+ <span class="share-chapter-route" id="share-chapter-route"></span>+ <span class="share-chapter-progress" aria-hidden="true"><span id="share-chapter-progress-bar"></span></span>+ </div>+ <div class="diagram-guide no-print" id="diagram-guide" hidden role="dialog" aria-modal="false" aria-labelledby="diagram-guide-title">+ <div class="diagram-guide-head">+ <span>+ <span class="diagram-guide-eyebrow">Diagram guide</span>+ <strong class="diagram-guide-title" id="diagram-guide-title">Explore this system</strong>+ </span>+ <button class="diagram-guide-close" id="diagram-guide-close" type="button" aria-label="Close diagram guide">×</button>+ </div>+ <p class="diagram-guide-stats" id="diagram-guide-stats">Inspecting compiled semantics</p>+ <div class="diagram-guide-actions" id="diagram-guide-actions" role="group" aria-label="Diagram exploration actions">+ <button class="diagram-guide-action" type="button" data-guide-action="find" aria-label="Find any node">+ <span class="diagram-guide-index" aria-hidden="true">01</span>+ <span class="diagram-guide-action-copy"><strong>Find any node</strong><small>Search labels, responsibilities, kinds, and stable IDs.</small></span>+ <kbd aria-hidden="true">/</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="route" aria-label="Trace a directed route">+ <span class="diagram-guide-index" aria-hidden="true">02</span>+ <span class="diagram-guide-action-copy"><strong>Trace a route</strong><small>Ask how two semantic nodes connect in authored direction.</small></span>+ <kbd aria-hidden="true">R</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="map" aria-label="See the whole system">+ <span class="diagram-guide-index" aria-hidden="true">03</span>+ <span class="diagram-guide-action-copy"><strong>See the whole system</strong><small>Open Semantic Radar with a live viewport and stable nodes.</small></span>+ <kbd aria-hidden="true">M</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="lens" aria-label="Compare semantic kinds">+ <span class="diagram-guide-index" aria-hidden="true">04</span>+ <span class="diagram-guide-action-copy"><strong>Compare semantic kinds</strong><small>Count roles, reveal their traffic, and compare direct authored links.</small></span>+ <kbd aria-hidden="true">L</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="story" aria-label="Play the guided story">+ <span class="diagram-guide-index" aria-hidden="true">05</span>+ <span class="diagram-guide-action-copy"><strong>Play the guided story</strong><small id="diagram-guide-story-copy">Walk the authored chapters and real relationships.</small></span>+ <kbd aria-hidden="true">P</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="present" aria-label="Enter presentation stage">+ <span class="diagram-guide-index" aria-hidden="true">06</span>+ <span class="diagram-guide-action-copy"><strong>Enter Presentation Stage</strong><small>Give the live diagram the viewport without changing export.</small></span>+ <kbd aria-hidden="true">F</kbd>+ </button>+ </div>+ <div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ </div>+ <p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p>+ </div>+ <div class="node-finder no-print" id="node-finder" hidden role="dialog" aria-modal="false" aria-labelledby="node-finder-title">+ <div class="node-finder-head">+ <strong id="node-finder-title">Find a node</strong>+ <button class="node-finder-close" id="node-finder-close" type="button" aria-label="Close node finder">×</button>+ </div>+ <div class="node-finder-search">+ <span aria-hidden="true">⌕</span>+ <input class="node-finder-input" id="node-finder-input" type="search" autocomplete="off" spellcheck="false" placeholder="Search labels or IDs" aria-describedby="node-finder-status">+ <kbd aria-hidden="true">/</kbd>+ </div>+ <div class="node-finder-results" id="node-finder-results" role="group" aria-label="Diagram nodes"></div>+ <p class="node-finder-empty" id="node-finder-empty" hidden>No matching nodes</p>+ <p class="node-finder-status" id="node-finder-status" aria-live="polite"></p>+ </div>+ <div class="focus-chip relationship-lens no-print" id="focus-chip" hidden role="region" aria-labelledby="relationship-lens-title">+ <div class="relationship-lens-head">+ <div class="relationship-lens-copy">+ <span class="relationship-lens-eyebrow">Semantic passport</span>+ <strong class="relationship-lens-title" id="relationship-lens-title"><span id="focus-label"></span></strong>+ <span class="semantic-passport-detail" id="focus-detail" hidden></span>+ <div class="semantic-passport-meta" id="focus-passport-meta" aria-label="Node metadata">+ <span id="focus-kind" data-passport="kind"></span>+ <span id="focus-context" data-passport="context" hidden></span>+ <span id="focus-tag" data-passport="tag" hidden></span>+ <code id="focus-id" data-passport="id"></code>+ </div>+ <span class="relationship-lens-summary" id="focus-summary" aria-live="polite"></span>+ </div>+ <div class="relationship-lens-actions">+ <button id="btn-focus-copy" type="button" aria-label="Copy link to focused node">Copy link</button>+ <button id="btn-focus-relations" type="button" aria-label="Show connected relationships" aria-expanded="false" aria-controls="relationship-lens-list">Relations</button>+ <button id="btn-focus-clear" type="button" aria-label="Clear focused node">Clear</button>+ </div>+ </div>+ <div class="relationship-lens-list" id="relationship-lens-list" aria-label="Connected relationships"></div>+ </div>+ <div class="route-probe no-print" id="route-probe" hidden role="region" aria-labelledby="route-probe-title" data-state="idle">+ <div class="route-probe-head">+ <span class="route-probe-copy">+ <span class="route-probe-eyebrow">Route probe</span>+ <strong class="route-probe-title" id="route-probe-title">Choose a start node</strong>+ </span>+ <span class="route-probe-actions">+ <button class="route-probe-find" id="route-probe-find" type="button" aria-label="Find a route start" data-node-finder-trigger>Find start</button>+ <button class="route-probe-copy-link" id="route-probe-copy" type="button" aria-label="Copy link to traced route" hidden>Copy link</button>+ <button id="route-probe-clear" type="button" aria-label="Clear route probe">Clear</button>+ </span>+ </div>+ <div class="route-probe-path" id="route-probe-path" aria-label="Traced route">+ <span class="route-probe-placeholder">Pick two semantic nodes on the diagram</span>+ </div>+ <div class="route-journey-controls" id="route-journey-controls" hidden role="group" aria-label="Route journey controls" data-playing="false">+ <button id="route-journey-prev" type="button" aria-label="Previous route position" title="Previous route position">←</button>+ <button class="route-journey-play" id="route-journey-play" type="button" aria-label="Play route journey" aria-pressed="false" title="Play route journey">+ <span id="route-journey-play-icon" aria-hidden="true">▶</span>+ <span id="route-journey-play-label">Journey</span>+ </button>+ <button id="route-journey-next" type="button" aria-label="Next route position" title="Next route position">→</button>+ <button class="route-journey-overview" id="route-journey-overview" type="button" aria-label="Show complete route overview" title="Show complete route overview">Overview</button>+ </div>+ <small class="route-probe-status" id="route-probe-status" aria-live="polite">Choose the source, then the destination. Direction matters.</small>+ </div>+ <div class="semantic-lens no-print" id="semantic-lens" hidden role="dialog" aria-modal="false" aria-labelledby="semantic-lens-title">+ <div class="semantic-lens-head">+ <span>+ <span class="semantic-lens-eyebrow">Semantic lens</span>+ <strong class="semantic-lens-title" id="semantic-lens-title">Compare system roles</strong>+ </span>+ <button class="semantic-lens-close" id="semantic-lens-close" type="button" aria-label="Close semantic lens">×</button>+ </div>+ <p class="semantic-lens-instruction">Choose up to two semantic kinds. One reveals its real traffic; two compare only direct authored relationships.</p>+ <div class="semantic-lens-kinds" id="semantic-lens-kinds" role="group" aria-label="Semantic kinds"></div>+ <p class="semantic-lens-status" id="semantic-lens-status" aria-live="polite">Choose a kind to inspect its nodes and touching relationships.</p>+ <div class="semantic-lens-actions">+ <button id="semantic-lens-copy" type="button" aria-label="Copy link to semantic lens" hidden>Copy link</button>+ <button id="semantic-lens-clear" type="button" aria-label="Clear semantic lens">Clear</button>+ </div>+ </div>+ <div class="overview-map no-print" id="overview-map" hidden role="region" aria-labelledby="overview-map-title">+ <div class="overview-map-head">+ <span class="overview-map-live" aria-hidden="true"></span>+ <span class="overview-map-copy">+ <strong id="overview-map-title">Semantic radar</strong>+ <small id="overview-map-status" aria-live="polite">Building overview</small>+ </span>+ <button class="overview-map-close" id="overview-map-close" type="button" aria-label="Close semantic radar">×</button>+ </div>+ <div class="overview-map-surface" id="overview-map-surface" tabindex="0" role="group" aria-label="Diagram overview. Click a node to focus it, or use arrow keys to pan."></div>+ <div class="overview-map-hint" aria-hidden="true"><span>Click node</span><span>Drag to pan</span></div>+ </div>+ <div class="diagram-nav no-print" role="toolbar" aria-label="Diagram view controls">+ <button id="btn-route-probe" type="button" aria-label="Trace a directed route" aria-pressed="false" aria-controls="route-probe" title="Trace route (R)">PATH</button>+ <button id="btn-overview-map" type="button" aria-label="Open semantic radar" aria-expanded="false" aria-controls="overview-map" title="Semantic radar (M)">MAP</button>+ <button id="btn-semantic-lens" type="button" aria-label="Open semantic lens" aria-haspopup="dialog" aria-expanded="false" aria-pressed="false" aria-controls="semantic-lens" title="Semantic lens (L)">LENS</button>+ <button id="btn-node-finder" type="button" aria-label="Find a node" aria-haspopup="dialog" aria-expanded="false" aria-controls="node-finder" title="Find a node (/)" data-node-finder-trigger>⌕</button>+ <button id="btn-diagram-guide" type="button" aria-label="Open diagram guide" aria-haspopup="dialog" aria-expanded="false" aria-controls="diagram-guide" title="Diagram guide (?)">?</button>+ <button data-view="out" type="button" aria-label="Zoom out" title="Zoom out (-)">−</button>+ <button data-view="reset" type="button" aria-label="Reset diagram view" title="Reset view (0)">100%</button>+ <button data-view="in" type="button" aria-label="Zoom in" title="Zoom in (+)">+</button>+ </div>+ </div>++ <!-- Info Cards -->+ <div class="cards">+ <div class="card">+ <div class="card-header">+ <div class="card-dot cyan"></div>+ <h3>Agent loop</h3>+ </div>+ <ul>+ <li>• Claude / Codex / opencode load the skill</li>+ <li>• SKILL.md teaches layout judgment, not auto-layout</li>+ <li>• Mermaid is an input dialect via prompt, not a parser</li>+ </ul>+ </div>++ <div class="card">+ <div class="card-header">+ <div class="card-dot emerald"></div>+ <h3>Render path</h3>+ </div>+ <ul>+ <li>• JSON IR pins schema_version: 1</li>+ <li>• Five typed renderers: architecture / workflow / sequence / dataflow / lifecycle</li>+ <li>• template.html owns theme toggle and 4× export</li>+ </ul>+ </div>++ <div class="card">+ <div class="card-header">+ <div class="card-dot rose"></div>+ <h3>Quality gates</h3>+ </div>+ <ul>+ <li>• ajv schema validation sits on the IR (fail-closed)</li>+ <li>• Renderer layout checks, then Output Check on the HTML</li>+ <li>• CI golden tests and zip freshness stay off the main path</li>+ </ul></div></div>++ <!-- Footer -->+ <p class="footer">+ Architecture diagram • Built with Archify<span class="no-print"> • <a class="artifact-start-link" href="https://tt-a1i.github.io/archify/start.html?type=architecture" target="_blank" rel="noopener noreferrer">Create yours ↗</a> • Hover to trace • <kbd>R</kbd> route • Click to focus • <kbd>+</kbd>/<kbd>−</kbd> zoom • <kbd>M</kbd> radar • <kbd>T</kbd> theme • <kbd>E</kbd> export</span>+ </p></div>- <div class="container">- <!-- Header -->- <div class="header">- <div class="header-row">- <div class="pulse-dot"></div>- <h1>Archify</h1>- </div>- <p class="subtitle">Agent skill → JSON IR → typed renderers → standalone HTML</p>- </div>+ <script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();++ /* ============================================================+ Theme toggle — persists to localStorage, respects system pref+ ============================================================ */++ Archify.theme = (function () {+ var STORAGE_KEY = 'archify-theme';+ var html = document.documentElement;+ var btn = document.getElementById('btn-theme');+ var icon = document.getElementById('theme-icon');+ var label = document.getElementById('theme-label');++ // localStorage can throw (blocked cookies, sandboxed iframes); the whole+ // script element dies on an uncaught error, so guard every access.+ function readStored() {+ try { return localStorage.getItem(STORAGE_KEY); } catch (_) { return null; }+ }+ function writeStored(value) {+ try { localStorage.setItem(STORAGE_KEY, value); } catch (_) {}+ }+ function urlOverride() {+ // URL param wins (useful for deterministic screenshots / share links)+ try {+ var param = new URLSearchParams(window.location.search).get('theme');+ if (param === 'light' || param === 'dark') return param;+ } catch (_) {}+ return null;+ }++ function resolveInitial() {+ var fromUrl = urlOverride();+ if (fromUrl) return fromUrl;+ var saved = readStored();+ if (saved === 'light' || saved === 'dark') return saved;+ return window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';+ }++ function apply(theme) {+ html.setAttribute('data-theme', theme);+ icon.textContent = theme === 'dark' ? '\u263E' : '\u263C';+ label.textContent = theme === 'dark' ? 'Dark' : 'Light';+ btn.setAttribute('aria-pressed', theme === 'light' ? 'true' : 'false');+ }++ function toggle() {+ var next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';+ apply(next);+ writeStored(next);+ }++ apply(resolveInitial());+ btn.addEventListener('click', toggle);++ // Follow live OS theme changes while the user has no explicit preference.+ try {+ var media = window.matchMedia('(prefers-color-scheme: light)');+ var onChange = function (e) {+ var saved = readStored();+ if (urlOverride() || saved === 'light' || saved === 'dark') return;+ apply(e.matches ? 'light' : 'dark');+ };+ if (media.addEventListener) media.addEventListener('change', onChange);+ else if (media.addListener) media.addListener(onChange);+ } catch (_) {}++ return { toggle: toggle };+ })();++ /* ============================================================+ Export — PNG / JPEG / WebP / SVG / WebM and Copy PNG (clipboard)++ Raster exports are always rendered at 4x source resolution for+ maximum sharpness. The trick: we set the serialized SVG's+ `width`/`height` to viewBox * 4 so the browser rasterizes the+ vectors at that resolution natively. drawImage then draws at+ the image's natural size (no upscaling = no blur).++ JPEG/WebP paint the current theme's background explicitly since+ those formats have no alpha channel.+ ============================================================ */+ (function () {+ var RASTER_SCALE = 4;+ var MOTION_DURATION = 6000;+ var MOTION_FPS = 30;++ function diagramFilename() {+ var title = (document.title || 'diagram')+ .replace(/\s+Architecture(\s+Diagram)?$/i, '')+ .replace(/\s+Diagram$/i, '')+ .trim();+ return title.replace(/[^a-z0-9_\-]+/gi, '-')+ .toLowerCase()+ .replace(/^-+|-+$/g, '') || 'diagram';+ }++ function currentBg() {+ return getComputedStyle(document.body).backgroundColor || '#ffffff';+ }++ /**+ * Serialize the main SVG into a standalone document.+ *+ * Two modes:+ * - Default (opts.autoTheme=false) — locks the serialized SVG to the+ * viewer's current theme. Used by the raster pipeline+ * (PNG/JPEG/WebP/clipboard) because canvas rasterization needs+ * deterministic colors; a raster cannot react to+ * prefers-color-scheme after encoding.+ * - autoTheme=true — emits BOTH dark and light variable sets plus a+ * `@media (prefers-color-scheme)` rule so the resulting SVG+ * self-themes when embedded in GitHub READMEs or other hosts that+ * expose a color scheme. Used for "Download SVG".+ */+ function serializeSvg(scale, opts) {+ // scale: integer multiplier for intrinsic SVG pixel dimensions used by+ // the raster path. Defaults to 1 (natural size) for SVG download.+ scale = scale || 1;+ opts = opts || {};+ var autoTheme = opts.autoTheme === true;+ var svg = document.querySelector('.diagram-container svg');+ var clone = svg.cloneNode(true);++ // View transforms and neighborhood focus are HTML exploration state,+ // never part of a downloaded full-diagram artifact.+ clone.style.removeProperty('transform');+ clone.removeAttribute('data-view-scale');+ clone.removeAttribute('data-focus-active');+ clone.removeAttribute('data-lens-active');+ clone.removeAttribute('data-lens-flow-count');+ clone.removeAttribute('data-lens-flow-density');+ clone.removeAttribute('data-legend-preview-active');+ clone.removeAttribute('data-relationship-preview-active');+ clone.removeAttribute('data-relationship-direct-active');+ clone.removeAttribute('data-relationship-pin-active');+ clone.removeAttribute('data-intent-trace-active');+ clone.removeAttribute('data-route-picking');+ clone.removeAttribute('data-route-active');+ clone.removeAttribute('data-route-journey');+ clone.removeAttribute('data-story-active');+ clone.removeAttribute('data-story-playing');+ clone.removeAttribute('data-story-beat');+ clone.removeAttribute('data-story-next');+ clone.removeAttribute('data-story-follow');+ clone.removeAttribute('data-chapter-handoff');+ clone.removeAttribute('data-chapter-anchor');+ clone.removeAttribute('data-chapter-preview');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-handoff-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-role]'), function (el) {+ el.removeAttribute('data-chapter-role');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-preview-role]'), function (el) {+ el.removeAttribute('data-chapter-preview-role');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-intent-trace-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-route-probe-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-route-journey-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-semantic-lens-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-bridge-runtime]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-kind]'), function (el) {+ el.removeAttribute('data-legend-kind');+ el.removeAttribute('data-legend-count');+ el.removeAttribute('data-legend-zero');+ el.removeAttribute('data-legend-selected');+ el.removeAttribute('role');+ el.removeAttribute('tabindex');+ el.removeAttribute('aria-label');+ el.removeAttribute('aria-pressed');+ el.removeAttribute('aria-haspopup');+ el.removeAttribute('aria-controls');+ el.removeAttribute('aria-expanded');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-bridge]'), function (el) {+ el.removeAttribute('data-legend-bridge');+ el.removeAttribute('role');+ el.removeAttribute('aria-label');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-pulse-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-hit-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-story-step], [data-story-beat-state], [data-story-beat-step]'), function (el) {+ el.removeAttribute('data-story-step');+ el.removeAttribute('data-story-beat-state');+ el.removeAttribute('data-story-beat-step');+ el.style.removeProperty('--story-step');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-focus-match], [data-focus-selected]'), function (el) {+ el.removeAttribute('data-focus-match');+ el.removeAttribute('data-focus-selected');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-lens-match], [data-lens-selected], [data-lens-peer]'), function (el) {+ el.removeAttribute('data-lens-match');+ el.removeAttribute('data-lens-selected');+ el.removeAttribute('data-lens-peer');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer]'), function (el) {+ el.removeAttribute('data-legend-preview-match');+ el.removeAttribute('data-legend-preview-selected');+ el.removeAttribute('data-legend-preview-peer');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target]'), function (el) {+ el.removeAttribute('data-relationship-preview');+ el.removeAttribute('data-relationship-preview-node');+ el.removeAttribute('data-relationship-preview-source');+ el.removeAttribute('data-relationship-preview-target');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-intent-trace-match], [data-intent-trace-selected]'), function (el) {+ el.removeAttribute('data-intent-trace-match');+ el.removeAttribute('data-intent-trace-selected');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current]'), function (el) {+ el.removeAttribute('data-route-match');+ el.removeAttribute('data-route-start');+ el.removeAttribute('data-route-end');+ el.removeAttribute('data-route-step');+ el.removeAttribute('data-route-candidate');+ el.removeAttribute('data-route-journey-state');+ el.removeAttribute('data-route-journey-current');+ el.style.removeProperty('--route-step');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {+ el.removeAttribute('data-detail');+ el.removeAttribute('data-detail-anchor');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-node-id][aria-pressed]'), function (el) {+ el.setAttribute('aria-pressed', 'false');+ });+ var canonicalStateClean = !clone.hasAttribute('data-view-scale') &&+ !clone.hasAttribute('data-focus-active') &&+ !clone.hasAttribute('data-lens-active') &&+ !clone.hasAttribute('data-lens-flow-count') &&+ !clone.hasAttribute('data-lens-flow-density') &&+ !clone.hasAttribute('data-legend-preview-active') &&+ !clone.hasAttribute('data-relationship-preview-active') &&+ !clone.hasAttribute('data-relationship-direct-active') &&+ !clone.hasAttribute('data-intent-trace-active') &&+ !clone.hasAttribute('data-route-picking') &&+ !clone.hasAttribute('data-route-active') &&+ !clone.hasAttribute('data-route-journey') &&+ !clone.hasAttribute('data-story-active') &&+ !clone.hasAttribute('data-story-playing') &&+ !clone.hasAttribute('data-story-beat') &&+ !clone.hasAttribute('data-story-next') &&+ !clone.hasAttribute('data-story-follow') &&+ !clone.hasAttribute('data-chapter-handoff') &&+ !clone.hasAttribute('data-chapter-anchor') &&+ !clone.hasAttribute('data-chapter-preview') &&+ !clone.style.getPropertyValue('transform') &&+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-detail], [data-detail-anchor]').length === 0;++ var vb = svg.viewBox.baseVal;+ // Scale width/height so the browser rasterizes the vectors at target+ // resolution directly. viewBox stays unchanged so coordinates don't+ // shift. This is the key to sharp rasters — do NOT scale later via+ // canvas upscaling.+ clone.setAttribute('width', vb.width * scale);+ clone.setAttribute('height', vb.height * scale);+ clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');++ // Only the SVG-relevant rules: semantic classes, markers, and the+ // theme variable blocks. Toolbar/cards/print CSS can never apply+ // inside a standalone SVG and would only bloat the export.+ var hostStyle = (function () {+ var out = [];+ Array.prototype.forEach.call(document.styleSheets, function (sheet) {+ var rules;+ try { rules = sheet.cssRules; } catch (_) { return; } // cross-origin+ if (!rules) return;+ Array.prototype.forEach.call(rules, function (rule) {+ if (rule.type === 7 && /^archify-/.test(rule.name || '')) {+ out.push(rule.cssText);+ return;+ }+ if (rule.type !== 1) return; // plain style rules only+ var sel = rule.selectorText || '';+ if (/(^|,)\s*(svg|:root|\[data-theme|\[data-preset|\.c-|\.t-|\.a-|\.m-)/.test(sel)) {+ out.push(rule.cssText);+ }+ });+ });+ return out.join('\n');+ })();++ // Derive the variable list from the stylesheet so newly added theme+ // variables can never be missed by the export pipeline again+ // (--lane-fill/--lane-stroke once were).+ var varNames = (function () {+ var seen = {};+ var names = [];+ (hostStyle.match(/--[a-zA-Z0-9-]+(?=\s*:)/g) || []).forEach(function (n) {+ if (!seen[n]) { seen[n] = true; names.push(n); }+ });+ return names;+ })();++ // Resolve the full variable set for a given data-theme via an+ // off-DOM probe, independent of what the viewer is currently set to.+ function resolveVars(themeAttr) {+ var probe = document.createElement('div');+ probe.setAttribute('data-theme', themeAttr);+ probe.setAttribute('data-preset', document.documentElement.getAttribute('data-preset') || 'classic');+ probe.style.cssText = 'position:absolute;width:0;height:0;visibility:hidden;';+ document.body.appendChild(probe);+ try {+ var c = getComputedStyle(probe);+ return varNames.map(function (n) {+ return n + ': ' + c.getPropertyValue(n).trim() + ';';+ }).join(' ');+ } finally {+ document.body.removeChild(probe);+ }+ }++ // Prepend a local()-only @font-face block for each weight so that the+ // sandboxed image-rendering context used during PNG/JPEG/WebP export+ // can find JetBrains Mono if the user has it installed locally, and+ // falls through cleanly to the monospace stack otherwise. The usual+ // Google-Fonts <link> in the host document is unreachable from the+ // serialized SVG, so url()-sourced faces would just hang.+ var fontFallback = [400, 500, 600, 700].map(function (w) {+ return "@font-face { font-family: 'JetBrains Mono'; font-weight: " + w ++ "; src: local('JetBrains Mono'), local('JetBrainsMono-Regular'); }";+ }).join('\n');++ var style = document.createElementNS('http://www.w3.org/2000/svg', 'style');+ var bgRect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');+ bgRect.setAttribute('width', '100%');+ bgRect.setAttribute('height', '100%');++ if (autoTheme) {+ // Dual-theme SVG. Dark is the default (so hosts without+ // prefers-color-scheme still render), light swaps in via media+ // query, and svg[data-theme="..."] still lets downstream+ // consumers force a specific theme.+ var darkVars = resolveVars('dark');+ var lightVars = resolveVars('light');++ style.textContent =+ fontFallback + "\n" ++ "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" ++ hostStyle + "\n" ++ ":root, svg { " + darkVars + " }\n" ++ "@media (prefers-color-scheme: light) { :root, svg { " + lightVars + " } }\n" ++ "svg[data-theme=\"light\"] { " + lightVars + " }\n" ++ "svg[data-theme=\"dark\"] { " + darkVars + " }\n" ++ "rect.c-bg-rect { fill: var(--bg); }\n";++ // Don't lock the serialized SVG to the viewer's current theme.+ clone.removeAttribute('data-theme');+ // Background follows the CSS variable, not a fixed color, so it+ // swaps with the media query.+ bgRect.setAttribute('class', 'c-bg-rect');+ } else {+ // Raster path: lock to the viewer's current theme.+ var theme = document.documentElement.getAttribute('data-theme') || 'dark';+ var themeHost = document.querySelector('[data-theme="' + theme + '"]') || document.documentElement;+ var computed = getComputedStyle(themeHost);+ var vars = varNames.map(function (n) {+ return n + ': ' + computed.getPropertyValue(n).trim() + ';';+ }).join(' ');++ // IMPORTANT: inject the resolved variables AFTER hostStyle,+ // otherwise hostStyle's ":root, [data-theme=\"dark\"] { ... }" rule+ // overrides our chosen theme via later-in-cascade equal-specificity.+ // Keep this order.+ style.textContent =+ fontFallback + "\n" ++ "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" ++ hostStyle + "\n" ++ ":root, svg { " + vars + " }\n";++ bgRect.setAttribute('fill', computed.getPropertyValue('--bg').trim() || '#ffffff');+ }++ clone.insertBefore(style, clone.firstChild);+ clone.insertBefore(bgRect, style.nextSibling);++ return {+ svgString: new XMLSerializer().serializeToString(clone),+ width: vb.width * scale,+ height: vb.height * scale,+ canonicalStateClean: canonicalStateClean+ };+ }++ function download(blob, filename) {+ var url = URL.createObjectURL(blob);+ var a = document.createElement('a');+ a.href = url;+ a.download = filename;+ document.body.appendChild(a);+ a.click();+ a.remove();+ setTimeout(function () { URL.revokeObjectURL(url); }, 1000);+ }++ // Conservative upper bound on total canvas pixels. Older Safari on iOS+ // silently produces a blank canvas above ~16 Mpx; Chrome / Firefox /+ // desktop Safari are far higher but start failing on memory-constrained+ // devices. We pick the largest integer scale in {4,3,2,1} whose target+ // pixel count fits under this cap.+ var MAX_CANVAS_PIXELS = 16 * 1024 * 1024;++ function pickSafeScale(vbW, vbH) {+ for (var s = RASTER_SCALE; s >= 1; s--) {+ if (vbW * s * vbH * s <= MAX_CANVAS_PIXELS) return s;+ }+ return 1;+ }++ function rasterize(format) {+ // Serialize at a safe scale (RASTER_SCALE=4 by default, reduced if the+ // resulting canvas would exceed MAX_CANVAS_PIXELS). The SVG itself is+ // rasterized at target resolution natively; drawImage draws at natural+ // size — no upsampling blur.+ var svg = document.querySelector('.diagram-container svg');+ var vb = svg.viewBox.baseVal;+ var scale = pickSafeScale(vb.width, vb.height);+ var data = serializeSvg(scale);+ var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });+ var svgUrl = URL.createObjectURL(svgBlob);++ return new Promise(function (resolve, reject) {+ var img = new Image();+ img.onload = function () {+ var canvas = document.createElement('canvas');+ canvas.width = data.width;+ canvas.height = data.height;+ var ctx = canvas.getContext('2d');+ if (format === 'jpeg') {+ ctx.fillStyle = currentBg();+ ctx.fillRect(0, 0, canvas.width, canvas.height);+ }+ // Draw at natural size — SVG was already rasterized at target res.+ ctx.drawImage(img, 0, 0);+ URL.revokeObjectURL(svgUrl);+ var mime = format === 'jpeg' ? 'image/jpeg' :+ format === 'webp' ? 'image/webp' : 'image/png';+ var quality = format === 'png' ? undefined : 0.95;+ canvas.toBlob(function (blob) {+ if (!blob) reject(new Error('toBlob returned null for ' + format));+ else resolve(blob);+ }, mime, quality);+ };+ img.onerror = function (e) {+ URL.revokeObjectURL(svgUrl);+ reject(e);+ };+ img.src = svgUrl;+ });+ }++ function motionMimeType() {+ if (typeof MediaRecorder === 'undefined') return '';+ var candidates = [+ 'video/webm;codecs=vp9',+ 'video/webm;codecs=vp8',+ 'video/webm'+ ];+ for (var i = 0; i < candidates.length; i++) {+ if (!MediaRecorder.isTypeSupported || MediaRecorder.isTypeSupported(candidates[i])) return candidates[i];+ }+ return '';+ }++ function canRecordMotion() {+ var svg = document.querySelector('.diagram-container svg');+ return !!(svg && svg.getAttribute('data-animation') === 'trace' &&+ typeof MediaRecorder !== 'undefined' && motionMimeType() &&+ typeof HTMLCanvasElement !== 'undefined' &&+ typeof HTMLCanvasElement.prototype.captureStream === 'function');+ }++ // Record the live CSS animation without Puppeteer, ffmpeg, or a network+ // dependency. SVG files loaded through Image are commonly rasterized as+ // one cached bitmap, so repeatedly drawing that Image does not reliably+ // advance its CSS animation. Keep one crisp static SVG background, then+ // render an explicit time-varying signal scene over the real authored+ // relationship geometry on every captured canvas frame.+ function recordWebm(options) {+ options = options || {};+ if (!canRecordMotion()) {+ return Promise.reject(new Error('WebM motion export requires a trace animation and browser MediaRecorder support'));+ }+ var duration = Math.max(250, Number(options.duration) || MOTION_DURATION);+ var fps = Math.max(1, Number(options.fps) || MOTION_FPS);+ var svg = document.querySelector('.diagram-container svg');+ var vb = svg.viewBox.baseVal;+ var scale = Math.min(1, 1280 / vb.width);+ var data = serializeSvg(scale);+ var sourceUrl = URL.createObjectURL(new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' }));++ function createMotionScene(root) {+ var rootMatrix = root.getCTM ? root.getCTM() : null;++ function pointInRoot(element, point) {+ if (!rootMatrix || !element.getCTM || !point.matrixTransform) return { x: point.x, y: point.y };+ try {+ var elementMatrix = element.getCTM();+ if (!elementMatrix) return { x: point.x, y: point.y };+ var mapped = point.matrixTransform(rootMatrix.inverse().multiply(elementMatrix));+ return { x: mapped.x, y: mapped.y };+ } catch (_) {+ return { x: point.x, y: point.y };+ }+ }++ function samplesFor(element) {+ if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];+ var length;+ try { length = element.getTotalLength(); } catch (_) { return []; }+ if (!Number.isFinite(length) || length <= 0) return [];+ var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));+ var points = [];+ for (var i = 0; i <= count; i++) {+ points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));+ }+ return points;+ }++ function authoredStep(element, fallback) {+ var raw = element.style.getPropertyValue('--step') || getComputedStyle(element).getPropertyValue('--step');+ var value = Number(raw);+ return Number.isFinite(value) ? value : fallback;+ }++ var edges = Array.prototype.slice.call(root.querySelectorAll('[data-animate="edge"]')).map(function (element, index) {+ var computed = getComputedStyle(element);+ return {+ points: samplesFor(element),+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ width: Math.max(1.5, parseFloat(computed.strokeWidth) || 1.5),+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(function (edge) { return edge.points.length > 1; });++ var nodes = Array.prototype.slice.call(root.querySelectorAll('[data-node-id][data-animate="node"]')).map(function (element, index) {+ var box;+ try { box = element.getBBox(); } catch (_) { return null; }+ var painted = element.querySelector('[class*="c-"]') || element;+ var computed = getComputedStyle(painted);+ return {+ x: box.x,+ y: box.y,+ width: box.width,+ height: box.height,+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(Boolean);++ return { edges: edges, nodes: nodes, x: vb.x, y: vb.y, width: vb.width, height: vb.height };+ }++ function pointAlong(points, progress) {+ var scaled = Math.max(0, Math.min(1, progress)) * (points.length - 1);+ var index = Math.min(points.length - 2, Math.floor(scaled));+ var mix = scaled - index;+ return {+ x: points[index].x + (points[index + 1].x - points[index].x) * mix,+ y: points[index].y + (points[index + 1].y - points[index].y) * mix+ };+ }++ function roundedRectPath(ctx, x, y, width, height, radius) {+ var r = Math.max(0, Math.min(radius, width / 2, height / 2));+ ctx.beginPath();+ ctx.moveTo(x + r, y);+ ctx.lineTo(x + width - r, y);+ ctx.quadraticCurveTo(x + width, y, x + width, y + r);+ ctx.lineTo(x + width, y + height - r);+ ctx.quadraticCurveTo(x + width, y + height, x + width - r, y + height);+ ctx.lineTo(x + r, y + height);+ ctx.quadraticCurveTo(x, y + height, x, y + height - r);+ ctx.lineTo(x, y + r);+ ctx.quadraticCurveTo(x, y, x + r, y);+ ctx.closePath();+ }++ function drawMotionFrame(ctx, backgroundImage, motionScene, elapsed) {+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.drawImage(backgroundImage, 0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.save();+ ctx.scale(ctx.canvas.width / motionScene.width, ctx.canvas.height / motionScene.height);+ ctx.translate(-motionScene.x, -motionScene.y);++ motionScene.edges.forEach(function (edge) {+ var duration = 1.75;+ var progress = (elapsed - edge.delay) / duration;+ if (progress < 0 || progress > 1) return;+ var head = Math.max(0, Math.min(1, progress));+ var tail = Math.max(0, head - 0.24);+ var opacity = Math.sin(Math.PI * Math.min(1, progress));++ ctx.save();+ ctx.strokeStyle = edge.color;+ ctx.fillStyle = edge.color;+ ctx.lineCap = 'round';+ ctx.lineJoin = 'round';+ ctx.lineWidth = Math.max(3.2, edge.width * 2.2);+ ctx.globalAlpha = 0.42 + opacity * 0.5;+ ctx.shadowColor = edge.color;+ ctx.shadowBlur = 10;+ ctx.beginPath();+ for (var i = 0; i <= 14; i++) {+ var trailPoint = pointAlong(edge.points, tail + (head - tail) * i / 14);+ if (i === 0) ctx.moveTo(trailPoint.x, trailPoint.y);+ else ctx.lineTo(trailPoint.x, trailPoint.y);+ }+ ctx.stroke();++ var point = pointAlong(edge.points, head);+ ctx.globalAlpha = 0.95;+ ctx.beginPath();+ ctx.arc(point.x, point.y, 4.8, 0, Math.PI * 2);+ ctx.fill();+ ctx.restore();+ });++ motionScene.nodes.forEach(function (node) {+ var progress = (elapsed - node.delay) / 2.6;+ if (progress < 0 || progress > 1) return;+ var pulse = Math.sin(Math.PI * progress);+ if (pulse <= 0.02) return;+ ctx.save();+ ctx.strokeStyle = node.color;+ ctx.lineWidth = 1.4 + pulse * 1.8;+ ctx.globalAlpha = pulse * 0.5;+ ctx.shadowColor = node.color;+ ctx.shadowBlur = 12 * pulse;+ var inset = 2 + pulse * 3;+ roundedRectPath(ctx, node.x - inset, node.y - inset, node.width + inset * 2, node.height + inset * 2, 8);+ ctx.stroke();+ ctx.restore();+ });++ ctx.restore();+ }++ var motionScene = createMotionScene(svg);++ return new Promise(function (resolve, reject) {+ var backgroundImage = new Image();+ backgroundImage.onload = function () {+ var canvas = document.createElement('canvas');+ canvas.width = Math.max(2, Math.round(data.width / 2) * 2);+ canvas.height = Math.max(2, Math.round(data.height / 2) * 2);+ var ctx = canvas.getContext('2d');+ var stream = canvas.captureStream(fps);+ var mime = motionMimeType();+ var recorder;+ try {+ recorder = new MediaRecorder(stream, { mimeType: mime, videoBitsPerSecond: 6000000 });+ } catch (err) {+ URL.revokeObjectURL(sourceUrl);+ stream.getTracks().forEach(function (track) { track.stop(); });+ reject(err);+ return;+ }+ var chunks = [];+ var raf = 0;+ var stopped = false;+ var startedAt = performance.now();+ function cleanup() {+ if (stopped) return;+ stopped = true;+ cancelAnimationFrame(raf);+ URL.revokeObjectURL(sourceUrl);+ stream.getTracks().forEach(function (track) { track.stop(); });+ }+ function draw(now) {+ var elapsed = Math.max(0, ((Number(now) || performance.now()) - startedAt) / 1000);+ drawMotionFrame(ctx, backgroundImage, motionScene, elapsed);+ raf = requestAnimationFrame(draw);+ }+ recorder.ondataavailable = function (event) {+ if (event.data && event.data.size) chunks.push(event.data);+ };+ recorder.onerror = function (event) {+ cleanup();+ reject(event.error || new Error('MediaRecorder failed'));+ };+ recorder.onstop = function () {+ cleanup();+ var blob = new Blob(chunks, { type: recorder.mimeType || mime });+ if (!blob.size) reject(new Error('MediaRecorder produced an empty WebM'));+ else resolve(blob);+ };+ drawMotionFrame(ctx, backgroundImage, motionScene, 0);+ recorder.start(250);+ startedAt = performance.now();+ raf = requestAnimationFrame(draw);+ setTimeout(function () {+ if (recorder.state === 'inactive') return;+ // Chromium normally emits the final chunk during stop(), but+ // some embedded browser shells need an explicit encoder flush+ // first. Keep the short grace window bounded and harmless for+ // browsers that already delivered timeslice chunks.+ try { recorder.requestData(); } catch (_) {}+ setTimeout(function () {+ if (recorder.state !== 'inactive') recorder.stop();+ }, 120);+ }, duration);+ };+ backgroundImage.onerror = function () {+ URL.revokeObjectURL(sourceUrl);+ reject(new Error('SVG background could not be loaded for WebM export'));+ };+ backgroundImage.src = sourceUrl;+ });+ }++ var menu = document.getElementById('export-menu');+ var btn = document.getElementById('btn-export');+ var items = function () {+ return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));+ };++ // ---- Clipboard support ----------------------------------------------+ function canCopyImage() {+ return typeof ClipboardItem !== 'undefined' &&+ navigator.clipboard &&+ typeof navigator.clipboard.write === 'function';+ }++ // ---- Raster format detection ----------------------------------------+ // canvas.toBlob('image/webp') silently returns a PNG on browsers without+ // WebP encoding (older Safari), so detect explicitly.+ function supports(format) {+ if (format === 'svg' || format === 'png') return true;+ if (format === 'webm') return canRecordMotion();+ var mime = format === 'jpeg' ? 'image/jpeg' : 'image/webp';+ try {+ var c = document.createElement('canvas');+ c.width = c.height = 2;+ return c.toDataURL(mime).indexOf('data:' + mime) === 0;+ } catch (_) { return false; }+ }++ // Gray out unsupported items.+ items().forEach(function (it) {+ if (it.dataset.format && !supports(it.dataset.format)) {+ it.disabled = true;+ it.title = 'Not supported by this browser';+ it.style.opacity = '0.5';+ }+ if (it.dataset.action === 'copy' && !canCopyImage()) {+ it.disabled = true;+ it.title = 'Clipboard image write not supported by this browser';+ it.style.opacity = '0.5';+ }+ });++ // ---- Toast ----------------------------------------------------------+ // A live region only announces CHANGES to an existing node, so the toast+ // element is created once up front and updated in place.+ var toastEl = document.createElement('div');+ toastEl.className = 'archify-toast';+ toastEl.setAttribute('role', 'status');+ document.body.appendChild(toastEl);+ var toastTimer = null;++ function toast(msg) {+ toastEl.textContent = '';+ requestAnimationFrame(function () {+ toastEl.textContent = msg;+ toastEl.classList.add('show');+ });+ clearTimeout(toastTimer);+ toastTimer = setTimeout(function () { toastEl.classList.remove('show'); }, 1500);+ }++ function open(focusLast) {+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });+ menu.classList.add('open');+ btn.setAttribute('aria-expanded', 'true');+ var available = items().filter(function (i) { return !i.disabled; });+ var target = focusLast ? available[available.length - 1] : available[0];+ if (target) target.focus();+ }+ function close(focusTrigger) {+ menu.classList.remove('open');+ btn.setAttribute('aria-expanded', 'false');+ if (focusTrigger) btn.focus();+ }+ function isOpen() { return menu.classList.contains('open'); }++ btn.addEventListener('click', function (e) {+ e.stopPropagation();+ if (isOpen()) close(false);+ else open();+ });+ // APG menu-button pattern: ArrowDown/ArrowUp on the trigger opens the menu.+ btn.addEventListener('keydown', function (e) {+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {+ e.preventDefault();+ if (!isOpen()) open(e.key === 'ArrowUp');+ }+ });+ document.addEventListener('click', function (e) {+ if (!menu.contains(e.target) && e.target !== btn) close(false);+ });++ // Keyboard navigation inside the menu.+ // Menu items: Up/Down, Home/End.+ // Esc closes + returns focus to trigger; Tab closes.+ menu.addEventListener('keydown', function (e) {+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }+ if (e.key === 'Tab') { close(false); return; }++ var available = items().filter(function (i) { return !i.disabled; });+ var current = available.indexOf(document.activeElement);+ switch (e.key) {+ case 'ArrowDown':+ e.preventDefault();+ if (available.length) available[(current + 1 + available.length) % available.length].focus();+ break;+ case 'ArrowUp':+ e.preventDefault();+ if (available.length) available[(current - 1 + available.length) % available.length].focus();+ break;+ case 'Home':+ e.preventDefault();+ if (available[0]) available[0].focus();+ break;+ case 'End':+ e.preventDefault();+ if (available.length) available[available.length - 1].focus();+ break;+ }+ });++ function runExport(format) {+ var base = diagramFilename();+ close(true);+ document.documentElement.removeAttribute('data-last-export-error');+ document.documentElement.removeAttribute('data-last-export-error-format');+ if (format === 'webm') toast('Recording 6 seconds of motion…');+ return (format === 'svg'+ ? Promise.resolve(serializeSvg(1, { autoTheme: true })).then(function (d) {+ var blob = new Blob([d.svgString], { type: 'image/svg+xml;charset=utf-8' });+ recordExportReceipt('svg', blob, d.canonicalStateClean);+ download(blob, base + '.svg');+ })+ : format === 'webm'+ ? recordWebm().then(function (blob) {+ document.documentElement.setAttribute('data-last-motion-bytes', String(blob.size));+ recordExportReceipt('webm', blob, true);+ download(blob, base + '.webm');+ toast('Downloaded WebM');+ })+ : rasterize(format).then(function (blob) {+ recordExportReceipt(format, blob, true);+ download(blob, base + '.' + format);+ })+ ).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : format;+ document.documentElement.setAttribute('data-last-export-error-format', format);+ document.documentElement.setAttribute('data-last-export-error', message);+ if (format === 'webm' && /MediaRecorder|WebM motion export|empty WebM/i.test(message)) {+ var motionItem = menu.querySelector('button[data-format="webm"]');+ if (motionItem) {+ motionItem.disabled = true;+ motionItem.title = 'Motion capture unavailable in this browser';+ motionItem.style.opacity = '0.5';+ }+ toast('WebM unavailable in this browser');+ return;+ }+ alert('Export failed: ' + message);+ });+ }++ // A compact, machine-readable receipt for local QA and generated proof+ // galleries. It exposes no diagram contents, only the completed format,+ // byte count, and whether temporary viewer state was excluded.+ function recordExportReceipt(format, blob, canonical) {+ document.documentElement.setAttribute('data-last-export-format', format);+ document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));+ document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');+ }++ function runCopy() {+ close(true);+ if (!canCopyImage()) {+ alert('Clipboard image write not supported in this browser.');+ return;+ }+ // WebKit requires ClipboardItem to be constructed synchronously inside+ // the user gesture — pass the pending Promise<Blob> as the item value.+ // Browsers that reject promise values throw synchronously; fall back+ // to awaiting the blob first (works in Chromium/Firefox).+ var blobPromise = rasterize('png');+ var writePromise;+ try {+ writePromise = navigator.clipboard.write([new ClipboardItem({ 'image/png': blobPromise })]);+ } catch (_) {+ writePromise = blobPromise.then(function (blob) {+ return navigator.clipboard.write([new ClipboardItem({ 'image/png': blob })]);+ });+ }+ return writePromise.then(function () {+ toast('Copied PNG to clipboard');+ }).catch(function (err) {+ console.error(err);+ alert('Copy failed: ' + (err && err.message ? err.message : 'unknown'));+ });+ }++ menu.addEventListener('click', function (e) {+ var copyBtn = e.target.closest('button[data-action="copy"]');+ if (copyBtn && !copyBtn.disabled) { runCopy(); return; }++ var formatBtn = e.target.closest('button[data-format]');+ if (formatBtn && !formatBtn.disabled) { runExport(formatBtn.dataset.format); }+ });++ Archify.motion = { canRecord: canRecordMotion, recordWebm: recordWebm };+ Archify.exportMenu = { open: open, close: close, isOpen: isOpen, run: runExport };++ // Auto-open on page load for demo/screenshot purposes: ?openExport=1+ // Wait for fonts (so the menu doesn't flash before typography lands)+ // and paint before opening. Fallback timeout for browsers without the+ // Font Loading API.+ try {+ if (new URLSearchParams(window.location.search).get('openExport') === '1') {+ var openWhenReady = function () {+ requestAnimationFrame(function () { requestAnimationFrame(open); });+ };+ if (document.fonts && document.fonts.ready) {+ document.fonts.ready.then(openWhenReady);+ } else {+ setTimeout(openWhenReady, 200);+ }+ }+ } catch (_) {}+ })();++ /* ============================================================+ Motion Governor — one reader switch and one motion budget. Ambient+ trace yields to the strongest semantic owner; Still also parks bounded+ viewer signals without discarding their static meaning.+ ============================================================ */+ Archify.motionGovernor = (function () {+ var STORAGE_KEY = 'archify-motion';+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-motion');+ var label = document.getElementById('motion-label');+ var motionQuery = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;+ var capable = !!(svg && svg.getAttribute('data-animation') === 'trace');+ var readerPaused = false;+ var suspensions = Object.create(null);+ var explicitOwner = '';+ var owner = '';+ var ownerToken = 0;+ var ownerCleanup = null;+ var lastEffectivePaused = null;+ var ambientStarted = false;+ var ambientPending = new Set();++ function detachAmbientBoundary() {+ if (!svg) return;+ svg.removeEventListener('animationend', onAmbientBoundary, true);+ svg.removeEventListener('animationcancel', onAmbientBoundary, true);+ }+ function settleAmbient(reason) {+ if (!capable) return false;+ ambientStarted = true;+ ambientPending.clear();+ detachAmbientBoundary();+ html.setAttribute('data-ambient-motion', 'settled');+ html.setAttribute('data-ambient-settle-reason', reason || 'complete');+ return true;+ }+ function onAmbientBoundary(event) {+ if (!ambientPending.has(event.target)) return;+ ambientPending.delete(event.target);+ if (!ambientPending.size) settleAmbient('complete');+ }+ function startAmbient() {+ if (ambientStarted || !capable) return false;+ ambientStarted = true;+ ambientPending = new Set(Array.prototype.slice.call(svg.querySelectorAll('[data-animate="edge"], [data-animate="node"]')));+ if (!ambientPending.size) return settleAmbient('empty');+ svg.addEventListener('animationend', onAmbientBoundary, true);+ svg.addEventListener('animationcancel', onAmbientBoundary, true);+ html.setAttribute('data-ambient-motion', 'running');+ html.removeAttribute('data-ambient-settle-reason');+ return true;+ }++ function readStored() {+ try { return localStorage.getItem(STORAGE_KEY); } catch (_) { return null; }+ }+ function writeStored() {+ try {+ if (readerPaused) localStorage.setItem(STORAGE_KEY, 'still');+ else localStorage.removeItem(STORAGE_KEY);+ } catch (_) {}+ }+ function reducedMotion() {+ return !!(motionQuery && motionQuery.matches);+ }+ function hasSuspension() {+ return Object.keys(suspensions).length > 0;+ }+ function effectivePaused() {+ return readerPaused || reducedMotion() || hasSuspension();+ }+ function ownerLabel(value) {+ if (value === 'story') return 'the guided story';+ if (value === 'chapter') return 'the active chapter';+ if (value === 'chapter-preview') return 'the chapter delta preview';+ if (value === 'handoff') return 'the chapter handoff';+ if (value === 'route') return 'Route Probe';+ if (value === 'lens') return 'Semantic Lens';+ if (value === 'relationship') return 'Relationship Preview';+ if (value === 'intent') return 'Intent Trace';+ if (value === 'focus') return 'semantic focus';+ if (value === 'legend') return 'legend preview';+ return 'reader interaction';+ }+ function render() {+ if (!capable) return;+ var systemPaused = reducedMotion();+ var paused = effectivePaused();+ html.setAttribute('data-motion', paused ? 'still' : 'live');+ if (paused || owner || html.hasAttribute('data-embed') || html.hasAttribute('data-share-playback') || html.hasAttribute('data-document-hidden')) {+ settleAmbient('suppressed');+ } else if (!ambientStarted) {+ startAmbient();+ }+ btn.setAttribute('aria-pressed', paused ? 'false' : 'true');+ btn.disabled = systemPaused;+ label.textContent = paused ? 'Still' : 'Live';+ if (paused && lastEffectivePaused !== true && Archify.guidedViews && Archify.guidedViews.isPlaying()) {+ Archify.guidedViews.pause();+ }+ if (paused && lastEffectivePaused !== true && Archify.guidedViews && Archify.guidedViews.settleHandoff) {+ Archify.guidedViews.settleHandoff(systemPaused ? 'reduced-motion' : (hasSuspension() ? 'hidden' : 'still'));+ }+ if (paused && lastEffectivePaused !== true && Archify.routeProbe && Archify.routeProbe.isJourneyPlaying && Archify.routeProbe.isJourneyPlaying()) {+ Archify.routeProbe.pauseJourney({ preserveElapsed: true, reason: systemPaused ? 'reduced-motion' : (hasSuspension() ? 'hidden' : 'still') });+ }+ lastEffectivePaused = paused;+ if (Archify.routeProbe && typeof Archify.routeProbe.syncMotion === 'function') Archify.routeProbe.syncMotion();+ if (systemPaused) {+ btn.setAttribute('aria-label', 'Motion paused by reduced-motion preference');+ btn.title = 'Motion paused by reduced-motion preference';+ } else if (hasSuspension()) {+ btn.setAttribute('aria-label', 'Motion paused while this page is hidden');+ btn.title = 'Motion paused while this page is hidden';+ } else if (paused) {+ btn.setAttribute('aria-label', 'Resume motion');+ btn.title = 'Resume motion';+ } else if (owner) {+ btn.setAttribute('aria-label', 'Pause motion; currently yielding to ' + ownerLabel(owner));+ btn.title = 'Live preview enabled · yielding to ' + ownerLabel(owner);+ } else {+ btn.setAttribute('aria-label', 'Pause motion');+ btn.title = 'Pause motion';+ }+ }+ function setPaused(next, options) {+ options = options || {};+ readerPaused = !!next;+ if (options.persist !== false) writeStored();+ render();+ return readerPaused;+ }+ function publishOwner() {+ owner = explicitOwner || deriveOwner();+ if (owner) html.setAttribute('data-motion-owner', owner);+ else html.removeAttribute('data-motion-owner');+ render();+ return owner;+ }+ function deriveOwner() {+ if (!svg) return '';+ if (svg.hasAttribute('data-story-playing') || svg.hasAttribute('data-story-follow')) return 'story';+ if (svg.hasAttribute('data-story-active')) return 'chapter';+ if (svg.hasAttribute('data-route-picking') || svg.hasAttribute('data-route-active')) return 'route';+ if (svg.hasAttribute('data-lens-active')) return 'lens';+ if (svg.hasAttribute('data-relationship-preview-active')) return 'relationship';+ if (svg.hasAttribute('data-intent-trace-active')) return 'intent';+ if (svg.hasAttribute('data-focus-active')) return 'focus';+ if (svg.hasAttribute('data-legend-preview-active')) return 'legend';+ return '';+ }+ function clearClaim(preempted) {+ var cleanup = ownerCleanup;+ ownerCleanup = null;+ explicitOwner = '';+ if (preempted && cleanup) {+ try { cleanup(); } catch (_) {}+ }+ }+ function claim(next, cleanup) {+ if (!capable || !next) return 0;+ clearClaim(true);+ ownerToken += 1;+ explicitOwner = next;+ ownerCleanup = typeof cleanup === 'function' ? cleanup : null;+ publishOwner();+ return ownerToken;+ }+ function release(token) {+ if (!capable || token !== ownerToken || !explicitOwner) return false;+ clearClaim(false);+ ownerToken += 1;+ publishOwner();+ return true;+ }+ function suspend(reason) {+ var key = String(reason || 'runtime');+ var active = true;+ suspensions[key] = (suspensions[key] || 0) + 1;+ render();+ return function () {+ if (!active) return false;+ active = false;+ if (suspensions[key] > 1) suspensions[key] -= 1;+ else delete suspensions[key];+ render();+ return true;+ };+ }+ function syncVisibility() {+ if (document.hidden) {+ suspensions.visibility = true;+ html.setAttribute('data-document-hidden', 'true');+ } else {+ delete suspensions.visibility;+ html.removeAttribute('data-document-hidden');+ }+ render();+ }++ if (!capable) {+ btn.hidden = true;+ html.removeAttribute('data-motion-capable');+ html.removeAttribute('data-motion');+ html.removeAttribute('data-motion-owner');+ html.removeAttribute('data-ambient-motion');+ html.removeAttribute('data-ambient-settle-reason');+ return {+ capable: false,+ pause: function () { return false; },+ resume: function () { return false; },+ toggle: function () { return false; },+ setMode: function () { return 'still'; },+ mode: function () { return 'still'; },+ claim: function () { return 0; },+ release: function () { return false; },+ suspend: function () { return function () { return false; }; },+ isPaused: function () { return true; },+ owner: function () { return ''; }+ };+ }++ html.setAttribute('data-motion-capable', 'true');+ btn.hidden = false;+ readerPaused = readStored() === 'still';+ btn.addEventListener('click', function () { setPaused(!readerPaused); });+ if (motionQuery) {+ if (typeof motionQuery.addEventListener === 'function') motionQuery.addEventListener('change', render);+ else if (typeof motionQuery.addListener === 'function') motionQuery.addListener(render);+ }+ document.addEventListener('visibilitychange', syncVisibility);+ if (document.documentElement.getAttribute('data-embed') !== 'true' && typeof MutationObserver !== 'undefined' && typeof Node !== 'undefined' && svg instanceof Node) {+ var ownerObserver = new MutationObserver(function () { publishOwner(); });+ ownerObserver.observe(svg, {+ attributes: true,+ attributeFilter: [+ 'data-story-playing', 'data-story-follow', 'data-story-active', 'data-route-picking', 'data-route-active',+ 'data-lens-active', 'data-relationship-preview-active', 'data-intent-trace-active',+ 'data-focus-active', 'data-legend-preview-active'+ ]+ });+ }+ syncVisibility();+ publishOwner();+ render();++ return {+ capable: true,+ pause: function () { return setPaused(true); },+ resume: function () { return setPaused(false); },+ toggle: function () { return setPaused(!readerPaused); },+ setMode: function (next, options) {+ setPaused(next === 'still', options);+ return effectivePaused() ? 'still' : 'live';+ },+ mode: function () { return effectivePaused() ? 'still' : 'live'; },+ claim: claim,+ release: release,+ suspend: suspend,+ isPaused: effectivePaused,+ owner: function () { return owner; }+ };+ })();++ /* ============================================================+ Explore — stable-ID neighborhood focus + dependency-free pan/zoom.+ Renderer IDs become deep-linkable semantic hooks without turning the+ standalone artifact into a canvas editor.+ ============================================================ */+ Archify.focus = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector('svg');+ var chip = document.getElementById('focus-chip');+ var label = document.getElementById('focus-label');+ var detail = document.getElementById('focus-detail');+ var kind = document.getElementById('focus-kind');+ var context = document.getElementById('focus-context');+ var tag = document.getElementById('focus-tag');+ var semanticId = document.getElementById('focus-id');+ var summary = document.getElementById('focus-summary');+ var relationshipList = document.getElementById('relationship-lens-list');+ var copyBtn = document.getElementById('btn-focus-copy');+ var relationsBtn = document.getElementById('btn-focus-relations');+ var clearBtn = document.getElementById('btn-focus-clear');+ var activeIds = [];+ var hoveredRelationship = null;+ var focusedRelationship = null;+ var pinnedRelationship = null;+ var pinnedRelationshipKey = null;+ var activeRelationshipPreview = null;+ var relationshipHitOverlay = null;+ var relationshipHitTargets = [];+ var directPreviewTimer = null;+ var svgNamespace = 'http://www.w3.org/2000/svg';+ var reducedMotionQuery = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;+ var finePointerQuery = window.matchMedia ? window.matchMedia('(hover: hover) and (pointer: fine)') : null;++ function nodes() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ }+ function edges() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ }+ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') || (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '');+ }+ function setPassportValue(element, value) {+ var normalized = value == null ? '' : String(value).trim();+ element.textContent = normalized;+ element.hidden = !normalized;+ }+ function renderPassport(id, node) {+ setPassportValue(detail, node.getAttribute('data-node-sublabel'));+ setPassportValue(kind, node.getAttribute('data-node-kind') || 'node');+ setPassportValue(context, node.getAttribute('data-node-context'));+ setPassportValue(tag, node.getAttribute('data-node-tag'));+ semanticId.textContent = id;+ semanticId.hidden = false;+ }+ function relationshipsFor(id, byId) {+ var seen = {};+ var relationships = [];+ edges().forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (from !== id && to !== id) return;+ var edgeLabel = edge.getAttribute('data-edge-label') || '';+ var edgeKey = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + edgeLabel);+ var edgeId = edge.getAttribute('data-edge-id') || '';+ if (seen[edgeKey]) return;+ seen[edgeKey] = true;+ var direction = from === id && to === id ? 'loop' : (from === id ? 'out' : 'in');+ var neighborId = direction === 'in' ? from : to;+ var neighbor = byId[neighborId];+ relationships.push({+ key: edgeKey,+ id: edgeId,+ from: from,+ to: to,+ direction: direction,+ neighborId: neighborId,+ neighborLabel: neighbor ? nodeLabel(neighbor, neighborId) : neighborId,+ label: edgeLabel || (direction === 'loop' ? 'loops back' : direction === 'out' ? 'connects to' : 'connects from')+ });+ });+ return relationships;+ }+ function relationshipEdgeShapes(edge) {+ if (!edge) return [];+ if (/^(path|line|polyline)$/i.test(edge.tagName || '')) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function relationshipHitRecords() {+ var recordsByKey = {};+ var recordsById = {};+ var byId = {};+ nodes().forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ var records = [];+ edges().forEach(function (edge) {+ var shapes = relationshipEdgeShapes(edge);+ if (!shapes.length) return;+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var labelValue = edge.getAttribute('data-edge-label') || '';+ var edgeId = edge.getAttribute('data-edge-id') || '';+ var key = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + labelValue);+ var existing = recordsByKey[key];+ if (existing) {+ if (existing.from !== from || existing.to !== to || existing.labelValue !== labelValue || existing.id !== edgeId) {+ existing.invalid = true;+ return;+ }+ shapes.forEach(function (shape) {+ if (existing.shapes.indexOf(shape) === -1) existing.shapes.push(shape);+ });+ return;+ }+ var record = {+ key: key,+ id: edgeId,+ from: from,+ to: to,+ fromLabel: byId[from] ? nodeLabel(byId[from], from) : from,+ toLabel: byId[to] ? nodeLabel(byId[to], to) : to,+ labelValue: labelValue,+ label: labelValue || (from === to ? 'loops back' : 'connects to'),+ edge: edge,+ shapes: shapes,+ invalid: false+ };+ recordsByKey[key] = record;+ if (edgeId) {+ if (recordsById[edgeId]) {+ recordsById[edgeId].invalid = true;+ record.invalid = true;+ } else {+ recordsById[edgeId] = record;+ }+ }+ records.push(record);+ });+ return records.filter(function (record) { return !record.invalid && record.from && record.to; });+ }+ function relationshipRecordForKey(key) {+ return relationshipHitRecords().find(function (record) { return record.key === key; }) || null;+ }+ function pinnedRelationshipRecord() {+ return pinnedRelationshipKey ? relationshipRecordForKey(pinnedRelationshipKey) : null;+ }+ function renderRelationshipCopyAction() {+ var record = pinnedRelationshipRecord();+ if (record && record.id) {+ copyBtn.textContent = 'Copy relation';+ copyBtn.setAttribute('aria-label', 'Copy link to pinned relationship');+ } else if (pinnedRelationshipKey) {+ copyBtn.textContent = 'Copy node';+ copyBtn.setAttribute('aria-label', 'Copy link to source node');+ } else {+ copyBtn.textContent = 'Copy link';+ copyBtn.setAttribute('aria-label', 'Copy link to focused node');+ }+ }+ function relationshipHitGeometry(shape, className) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('filter');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('tabindex');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('aria-hidden');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.setAttribute('class', className || 'relationship-hit-rail');+ return clone;+ }+ function removeRelationshipPulse() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-relationship-pulse-overlay]'), function (element) {+ element.remove();+ });+ }+ function relationshipPulseGeometry(shape) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('transform');+ clone.removeAttribute('filter');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('tabindex');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-hidden');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-focus-match');+ clone.removeAttribute('data-relationship-preview');+ clone.setAttribute('class', 'relationship-flow-pulse');+ clone.setAttribute('pathLength', '1');+ return clone;+ }+ function relationshipTokenKind(edge) {+ var shapes = relationshipEdgeShapes(edge);+ var classEvidence = [edge.getAttribute('class') || ''].concat(shapes.map(function (shape) {+ return shape.getAttribute('class') || '';+ })).join(' ');+ var from = edge.getAttribute('data-edge-from') || '';+ var to = edge.getAttribute('data-edge-to') || '';+ var source = nodes().find(function (node) { return node.getAttribute('data-node-id') === from; });+ var target = nodes().find(function (node) { return node.getAttribute('data-node-id') === to; });+ var sourceKind = source ? source.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ var targetKind = target ? target.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ if (/\ba-security\b/.test(classEvidence) || sourceKind === 'security' || targetKind === 'security' || targetKind === 'failure') return 'security';+ if (/\ba-dashed\b/.test(classEvidence) || sourceKind === 'messagebus' || targetKind === 'messagebus') return 'event';+ if (sourceKind === 'database' || targetKind === 'database') return 'data';+ if (targetKind === 'waiting' || targetKind === 'success') return 'state';+ return 'call';+ }+ function relationshipTokenPath(shape) {+ if (!shape) return '';+ var tagName = String(shape.tagName || '').toLowerCase();+ if (tagName === 'path') return shape.getAttribute('d') || '';+ if (tagName === 'line') {+ return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') ++ ' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');+ }+ if (tagName === 'polyline' && shape.points && shape.points.numberOfItems > 1) {+ var commands = [];+ for (var i = 0; i < shape.points.numberOfItems; i += 1) {+ var point = shape.points.getItem(i);+ commands.push((i === 0 ? 'M ' : 'L ') + point.x + ' ' + point.y);+ }+ return commands.join(' ');+ }+ return '';+ }+ function relationshipTokenPart(tagName, className, attrs) {+ var part = document.createElementNS(svgNamespace, tagName);+ part.setAttribute('class', className);+ Object.keys(attrs || {}).forEach(function (name) { part.setAttribute(name, attrs[name]); });+ return part;+ }+ function relationshipTokenGeometry(shape, kind, key, options) {+ options = options || {};+ var pathData = relationshipTokenPath(shape);+ if (!pathData) return null;+ var token = document.createElementNS(svgNamespace, 'g');+ token.setAttribute('class', 'semantic-flow-token ' + (options.className || 'relationship-flow-token'));+ token.setAttribute('data-token-kind', kind);+ token.setAttribute('data-token-edge-key', key);+ token.setAttribute('aria-hidden', 'true');+ token.appendChild(relationshipTokenPart('circle', 'semantic-flow-token-halo', { cx: '0', cy: '0', r: '7' }));+ if (kind === 'data') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-5', y: '-4', width: '10', height: '8', rx: '2' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -2.8 -1.2 h 5.6 M -2.8 1.4 h 3.8' }));+ } else if (kind === 'event') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-7', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-2', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '3', y: '-3', width: '4', height: '6', rx: '1' }));+ } else if (kind === 'security') {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-shape', { d: 'M 0 -5 L 4 -3.4 V 0 c 0 3 -1.6 4.5 -4 5.5 C -2.4 4.5 -4 3 -4 0 v -3.4 Z' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'm -2 .2 1.4 1.4 L 2 -1.4' }));+ } else if (kind === 'state') {+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-shape', { cx: '0', cy: '0', r: '5' }));+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-dot', { cx: '0', cy: '0', r: '1.35' }));+ } else {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -5 -3 L -1 0 L -5 3 M 0 -3 L 4 0 L 0 3' }));+ }+ var motion = document.createElementNS(svgNamespace, 'animateMotion');+ motion.setAttribute('path', pathData);+ motion.setAttribute('dur', options.duration || '1.2s');+ motion.setAttribute('begin', '0s');+ motion.setAttribute('fill', 'freeze');+ motion.setAttribute('rotate', 'auto');+ motion.setAttribute('calcMode', 'spline');+ motion.setAttribute('keyTimes', '0;1');+ motion.setAttribute('keySplines', '.2 0 .2 1');+ token.appendChild(motion);+ return token;+ }+ function createSemanticFlowToken(edge, shape, options) {+ if (!edge || !shape) return null;+ var key = edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ return relationshipTokenGeometry(shape, relationshipTokenKind(edge), key, options);+ }+ Archify.flowTokens = {+ create: createSemanticFlowToken,+ kind: function (edge) { return relationshipTokenKind(edge); },+ path: relationshipTokenPath+ };+ function renderRelationshipPulse(key) {+ removeRelationshipPulse();+ if (!key || document.documentElement.getAttribute('data-embed') === 'true') return false;+ if (document.hidden || (Archify.motionGovernor && Archify.motionGovernor.isPaused())) return false;+ if (reducedMotionQuery && reducedMotionQuery.matches) return false;+ var matchingEdges = edges().filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ if (!matchingEdges.length) return false;+ var overlay = document.createElementNS(svgNamespace, 'g');+ overlay.setAttribute('class', 'relationship-pulse-overlay');+ overlay.setAttribute('data-relationship-pulse-overlay', '');+ overlay.setAttribute('data-relationship-pulse-key', key);+ overlay.setAttribute('aria-hidden', 'true');+ var tokenAdded = false;+ matchingEdges.forEach(function (edge) {+ var wrapper = document.createElementNS(svgNamespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ var shapes = relationshipEdgeShapes(edge);+ shapes.forEach(function (shape) {+ wrapper.appendChild(relationshipPulseGeometry(shape));+ });+ if (!tokenAdded && shapes.length) {+ var tokenKind = relationshipTokenKind(edge);+ var token = relationshipTokenGeometry(shapes[0], tokenKind, key);+ if (token) {+ wrapper.appendChild(token);+ overlay.setAttribute('data-relationship-token-kind', tokenKind);+ tokenAdded = true;+ }+ }+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ if (!overlay.childNodes.length) return false;+ var finishPulse = function () {+ if (overlay.parentNode) overlay.remove();+ };+ overlay.addEventListener('animationend', finishPulse, { once: true });+ overlay.addEventListener('animationcancel', finishPulse, { once: true });+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ return true;+ }+ function clearRelationshipPreview(options) {+ options = options || {};+ if (directPreviewTimer) window.clearTimeout(directPreviewTimer);+ directPreviewTimer = null;+ removeRelationshipPulse();+ activeRelationshipPreview = null;+ svg.removeAttribute('data-relationship-preview-active');+ svg.removeAttribute('data-relationship-direct-active');+ if (options.clearPin === true) {+ pinnedRelationship = null;+ pinnedRelationshipKey = null;+ svg.removeAttribute('data-relationship-pin-active');+ }+ chip.removeAttribute('data-relationship-previewing');+ edges().forEach(function (edge) { edge.removeAttribute('data-relationship-preview'); });+ nodes().forEach(function (node) {+ node.removeAttribute('data-relationship-preview-node');+ node.removeAttribute('data-relationship-preview-source');+ node.removeAttribute('data-relationship-preview-target');+ });+ Array.prototype.forEach.call(relationshipList.querySelectorAll('[data-preview-active]'), function (button) {+ button.removeAttribute('data-preview-active');+ });+ relationshipHitTargets.forEach(function (target) {+ target.setAttribute('aria-pressed', pinnedRelationshipKey && target.getAttribute('data-relationship-key') === pinnedRelationshipKey ? 'true' : 'false');+ target.removeAttribute('data-preview-active');+ });+ renderRelationshipCopyAction();+ requestLensPlacement();+ }+ function previewRelationship(button, options) {+ options = options || {};+ if (pinnedRelationshipKey && pinnedRelationship && button !== pinnedRelationship) return;+ clearRelationshipPreview();+ if (!button) return;+ var key = button.getAttribute('data-relationship-key');+ var from = button.getAttribute('data-relationship-from');+ var to = button.getAttribute('data-relationship-to');+ if (!key || !from || !to) return;+ svg.setAttribute('data-relationship-preview-active', key);+ if (options.direct === true) svg.setAttribute('data-relationship-direct-active', key);+ edges().forEach(function (edge) {+ if (edge.getAttribute('data-edge-key') === key) edge.setAttribute('data-relationship-preview', '');+ });+ nodes().forEach(function (node) {+ var id = node.getAttribute('data-node-id');+ if (id !== from && id !== to) return;+ node.setAttribute('data-relationship-preview-node', '');+ if (id === from) node.setAttribute('data-relationship-preview-source', '');+ if (id === to) node.setAttribute('data-relationship-preview-target', '');+ });+ button.setAttribute('data-preview-active', 'true');+ if (!chip.hidden && options.direct !== true) chip.setAttribute('data-relationship-previewing', 'true');+ activeRelationshipPreview = button;+ renderRelationshipPulse(key);+ requestLensPlacement();+ }+ function syncRelationshipPreview() {+ var next = pinnedRelationship || focusedRelationship || hoveredRelationship;+ if (next === activeRelationshipPreview) return;+ previewRelationship(next, { direct: !!(next && next.hasAttribute('data-relationship-hit-key')) });+ }+ function directRelationshipBlocked() {+ return html.getAttribute('data-embed') === 'true' ||+ html.getAttribute('data-guide-open') === 'true' ||+ container.classList.contains('is-panning') ||+ (activeIds.length > 0 && !pinnedRelationshipKey) ||+ svg.hasAttribute('data-story-active') ||+ svg.hasAttribute('data-route-picking') ||+ svg.hasAttribute('data-route-active') ||+ svg.hasAttribute('data-lens-active') ||+ svg.hasAttribute('data-chapter-preview');+ }+ function scheduleDirectRelationshipPreview(target) {+ if (directPreviewTimer) window.clearTimeout(directPreviewTimer);+ if (pinnedRelationshipKey) return;+ directPreviewTimer = window.setTimeout(function () {+ directPreviewTimer = null;+ if (pinnedRelationshipKey || hoveredRelationship !== target || directRelationshipBlocked()) return;+ previewRelationship(target, { direct: true });+ }, reducedMotionQuery && reducedMotionQuery.matches ? 0 : 90);+ }+ function relationshipHitTarget(key) {+ return relationshipHitTargets.find(function (target) {+ return target.getAttribute('data-relationship-key') === key;+ }) || null;+ }+ function revealPinnedRelationship(record) {+ function reveal() {+ if (!record || pinnedRelationshipKey !== record.key) return true;+ if (!Archify.view || typeof Archify.view.reveal !== 'function') return false;+ Archify.view.reveal([record.from, record.to], { reason: 'relationship-direct' });+ return true;+ }+ if (!reveal()) requestAnimationFrame(reveal);+ }+ function inspectRelationship(key, options) {+ options = options || {};+ if (html.getAttribute('data-embed') === 'true') return false;+ if (directPreviewTimer) window.clearTimeout(directPreviewTimer);+ directPreviewTimer = null;+ hoveredRelationship = null;+ focusedRelationship = null;+ if (pinnedRelationshipKey === key) {+ if (options.toggle === false) return true;+ clear({ updateUrl: options.updateUrl !== false });+ return true;+ }+ var record = relationshipRecordForKey(key);+ if (!record) return false;+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ set(record.from, { toggle: false, updateUrl: false });+ var row = Array.prototype.slice.call(relationshipList.querySelectorAll('[data-relationship-key]')).find(function (candidate) {+ return candidate.getAttribute('data-relationship-key') === key;+ });+ if (!row) return false;+ previewRelationship(row);+ pinnedRelationship = row;+ pinnedRelationshipKey = key;+ svg.setAttribute('data-relationship-pin-active', key);+ var target = relationshipHitTarget(key);+ if (target) target.setAttribute('aria-pressed', 'true');+ renderRelationshipCopyAction();+ summary.textContent = 'Pinned relationship · ' + record.fromLabel + ' → ' + record.toLabel + ' · ' + record.label;+ revealPinnedRelationship(record);+ if (options.updateUrl !== false && record.id) {+ try { history.replaceState(null, '', location.pathname + location.search + '#relation=' + encodeURIComponent(record.id)); } catch (_) {}+ }+ return true;+ }+ function inspectRelationshipById(id, options) {+ var record = relationshipHitRecords().find(function (item) { return item.id === id; });+ return record ? inspectRelationship(record.key, options) : false;+ }+ function installRelationshipHitTargets() {+ if (html.getAttribute('data-embed') === 'true') return 0;+ var records = relationshipHitRecords();+ if (!records.length) return 0;+ relationshipHitOverlay = document.createElementNS(svgNamespace, 'g');+ relationshipHitOverlay.setAttribute('class', 'relationship-hit-overlay');+ relationshipHitOverlay.setAttribute('data-relationship-hit-overlay', '');+ relationshipHitOverlay.setAttribute('role', 'group');+ relationshipHitOverlay.setAttribute('aria-label', 'Direct relationship explorer');+ var relationshipHelp = document.createElementNS(svgNamespace, 'desc');+ relationshipHelp.id = 'archify-relationship-help';+ relationshipHelp.textContent = 'Use arrow keys to explore relationships. Press Enter or Space to pin details; Escape clears.';+ relationshipHitOverlay.appendChild(relationshipHelp);+ records.forEach(function (record, index) {+ var target = document.createElementNS(svgNamespace, 'g');+ target.setAttribute('class', 'relationship-hit-target');+ target.setAttribute('data-relationship-hit-key', record.key);+ target.setAttribute('data-relationship-key', record.key);+ target.setAttribute('data-relationship-from', record.from);+ target.setAttribute('data-relationship-to', record.to);+ if (record.id) target.setAttribute('data-relationship-id', record.id);+ target.setAttribute('role', 'button');+ target.setAttribute('tabindex', index === 0 ? '0' : '-1');+ target.setAttribute('aria-pressed', 'false');+ target.setAttribute('aria-describedby', relationshipHelp.id);+ var description = 'Inspect relationship ' + (index + 1) + ' of ' + records.length + ': ' + record.fromLabel + ' to ' + record.toLabel + ', ' + record.label + '. Press Enter for details.';+ target.setAttribute('aria-label', description);+ var title = document.createElementNS(svgNamespace, 'title');+ title.textContent = record.fromLabel + ' \u2192 ' + record.toLabel + ' \u00b7 ' + record.label;+ target.appendChild(title);+ record.shapes.forEach(function (shape) {+ target.appendChild(relationshipHitGeometry(shape));+ target.appendChild(relationshipHitGeometry(shape, 'relationship-focus-rail'));+ });+ if (target.childNodes.length > 1) {+ relationshipHitTargets.push(target);+ relationshipHitOverlay.appendChild(target);+ }+ });+ if (!relationshipHitTargets.length) return 0;+ var firstNode = svg.querySelector('[data-node-id]');+ var nodeLayer = firstNode;+ while (nodeLayer && nodeLayer.parentNode && nodeLayer.parentNode !== svg) nodeLayer = nodeLayer.parentNode;+ if (nodeLayer && nodeLayer.parentNode === svg) svg.insertBefore(relationshipHitOverlay, nodeLayer);+ else svg.appendChild(relationshipHitOverlay);++ relationshipHitOverlay.addEventListener('pointerdown', function (event) {+ if (event.target.closest('[data-relationship-hit-key]')) event.stopPropagation();+ });+ relationshipHitOverlay.addEventListener('pointerover', function (event) {+ if (event.pointerType === 'touch') return;+ if (finePointerQuery && !finePointerQuery.matches) return;+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || directRelationshipBlocked() || pinnedRelationshipKey) return;+ if (event.relatedTarget && target.contains(event.relatedTarget)) return;+ hoveredRelationship = target;+ scheduleDirectRelationshipPreview(target);+ });+ relationshipHitOverlay.addEventListener('pointerout', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || (event.relatedTarget && target.contains(event.relatedTarget))) return;+ if (hoveredRelationship === target) hoveredRelationship = null;+ syncRelationshipPreview();+ });+ relationshipHitOverlay.addEventListener('focusin', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || directRelationshipBlocked()) return;+ focusedRelationship = target;+ if (!pinnedRelationshipKey) previewRelationship(target, { direct: true });+ });+ relationshipHitOverlay.addEventListener('focusout', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || (event.relatedTarget && target.contains(event.relatedTarget))) return;+ if (focusedRelationship === target) focusedRelationship = null;+ syncRelationshipPreview();+ });+ relationshipHitOverlay.addEventListener('click', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || directRelationshipBlocked()) return;+ event.preventDefault();+ event.stopPropagation();+ focusedRelationship = null;+ hoveredRelationship = null;+ inspectRelationship(target.getAttribute('data-relationship-key'));+ });+ relationshipHitOverlay.addEventListener('keydown', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target) return;+ if (event.key === 'Escape' && pinnedRelationshipKey) {+ event.preventDefault();+ clear({ updateUrl: false });+ return;+ }+ if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault();+ focusedRelationship = null;+ hoveredRelationship = null;+ inspectRelationship(target.getAttribute('data-relationship-key'));+ return;+ }+ if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft' && event.key !== 'ArrowDown' && event.key !== 'ArrowUp' && event.key !== 'Home' && event.key !== 'End') return;+ var index = relationshipHitTargets.indexOf(target);+ if (event.key === 'Home') index = 0;+ else if (event.key === 'End') index = relationshipHitTargets.length - 1;+ else if (event.key === 'ArrowRight' || event.key === 'ArrowDown') index = (index + 1) % relationshipHitTargets.length;+ else index = (index - 1 + relationshipHitTargets.length) % relationshipHitTargets.length;+ event.preventDefault();+ relationshipHitTargets.forEach(function (item, itemIndex) { item.setAttribute('tabindex', itemIndex === index ? '0' : '-1'); });+ try { relationshipHitTargets[index].focus({ preventScroll: true }); }+ catch (_) { try { relationshipHitTargets[index].focus(); } catch (_) {} }+ });+ return relationshipHitTargets.length;+ }+ function renderRelationshipLens(id, byId) {+ hoveredRelationship = null;+ focusedRelationship = null;+ clearRelationshipPreview({ clearPin: true });+ renderPassport(id, byId[id]);+ var relationships = relationshipsFor(id, byId);+ chip.removeAttribute('data-relations-expanded');+ relationsBtn.setAttribute('aria-expanded', 'false');+ relationsBtn.textContent = relationships.length + ' relation' + (relationships.length === 1 ? '' : 's');+ relationsBtn.setAttribute('aria-label', 'Show ' + relationships.length + ' connected relationship' + (relationships.length === 1 ? '' : 's'));+ var counts = { out: 0, in: 0, loop: 0 };+ relationships.forEach(function (relationship) { counts[relationship.direction] += 1; });+ summary.textContent = counts.out + ' outgoing · ' + counts.in + ' incoming' + (counts.loop ? ' · ' + counts.loop + ' loop' : '');+ relationshipList.textContent = '';+ if (!relationships.length) {+ var empty = document.createElement('p');+ empty.className = 'relationship-lens-empty';+ empty.textContent = 'No connected relationships';+ relationshipList.appendChild(empty);+ return;+ }++ [+ { id: 'out', label: 'Outgoing' },+ { id: 'in', label: 'Incoming' },+ { id: 'loop', label: 'Self loops' }+ ].forEach(function (group) {+ var items = relationships.filter(function (relationship) { return relationship.direction === group.id; });+ if (!items.length) return;+ var section = document.createElement('div');+ section.className = 'relationship-lens-group';+ var heading = document.createElement('span');+ heading.className = 'relationship-lens-group-title';+ heading.textContent = group.label + ' · ' + items.length;+ section.appendChild(heading);+ items.forEach(function (relationship) {+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'relationship-lens-row';+ button.setAttribute('data-direction', relationship.direction);+ button.setAttribute('data-relationship-target', relationship.neighborId);+ button.setAttribute('data-relationship-key', relationship.key);+ button.setAttribute('data-relationship-from', relationship.from);+ button.setAttribute('data-relationship-to', relationship.to);+ if (relationship.id) button.setAttribute('data-relationship-id', relationship.id);+ button.setAttribute('aria-label', group.label + ': ' + relationship.label + ', ' + relationship.neighborLabel);+ var direction = document.createElement('span');+ direction.className = 'relationship-lens-direction';+ direction.setAttribute('aria-hidden', 'true');+ direction.textContent = relationship.direction === 'out' ? 'OUT →' : relationship.direction === 'in' ? '← IN' : 'LOOP';+ var target = document.createElement('strong');+ target.textContent = relationship.neighborLabel;+ var relation = document.createElement('small');+ relation.textContent = relationship.label;+ button.appendChild(direction);+ button.appendChild(target);+ button.appendChild(relation);+ section.appendChild(button);+ });+ relationshipList.appendChild(section);+ });+ }+ var lensFrame = 0;+ function placeRelationshipLens() {+ lensFrame = 0;+ if (chip.hidden || activeIds.length !== 1) return;+ var node = svg.querySelector('[data-node-id="' + activeIds[0] + '"]');+ if (!node) return;+ var containerRect = container.getBoundingClientRect();+ var nodeRect = node.getBoundingClientRect();+ if (containerRect.bottom <= 0 || containerRect.top >= window.innerHeight) return;+ var padding = window.innerWidth <= 720 ? 8 : 16;+ var visibleTop = Math.max(padding, -containerRect.top + padding);+ var visibleBottom = Math.min(containerRect.height - padding, window.innerHeight - containerRect.top - padding);+ var maxTop = Math.max(padding, visibleBottom - chip.offsetHeight);+ var minTop = Math.min(visibleTop, maxTop);+ var nodeCenter = nodeRect.top - containerRect.top + nodeRect.height / 2;+ var mobile = window.innerWidth <= 720;+ var previewingOnMobile = mobile && chip.getAttribute('data-relationship-previewing') === 'true';+ var compactOnMobile = mobile && chip.getAttribute('data-relations-expanded') !== 'true';+ var preferred;+ if (compactOnMobile) {+ var nodeTop = nodeRect.top - containerRect.top;+ var nodeBottom = nodeRect.bottom - containerRect.top;+ var gap = 10;+ var above = nodeTop - chip.offsetHeight - gap;+ var below = nodeBottom + gap;+ if (above >= visibleTop) preferred = above;+ else if (below + chip.offsetHeight <= visibleBottom - 56) preferred = below;+ else preferred = nodeCenter < (visibleTop + visibleBottom) / 2+ ? Math.max(minTop, visibleBottom - chip.offsetHeight - 56)+ : visibleTop;+ } else if (previewingOnMobile) {+ var pinnedTop = visibleTop;+ var pinnedBottom = Math.max(minTop, visibleBottom - chip.offsetHeight - 56);+ preferred = nodeCenter < (visibleTop + visibleBottom) / 2 ? pinnedBottom : pinnedTop;+ } else {+ preferred = nodeCenter - chip.offsetHeight / 2;+ }+ var top = Math.max(minTop, Math.min(maxTop, preferred));+ chip.style.top = Math.round(top) + 'px';+ if (Archify.radar && typeof Archify.radar.sync === 'function') Archify.radar.sync();+ }+ function requestLensPlacement() {+ if (lensFrame) return;+ lensFrame = requestAnimationFrame(placeRelationshipLens);+ }+ function clear(options) {+ options = options || {};+ if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') {+ Archify.intentTrace.clear({ announce: false });+ }+ hoveredRelationship = null;+ focusedRelationship = null;+ clearRelationshipPreview({ clearPin: true });+ activeIds = [];+ svg.removeAttribute('data-focus-active');+ nodes().forEach(function (node) {+ node.removeAttribute('data-focus-match');+ node.removeAttribute('data-focus-selected');+ node.setAttribute('aria-pressed', 'false');+ });+ edges().forEach(function (edge) { edge.removeAttribute('data-focus-match'); });+ chip.hidden = true;+ label.textContent = '';+ detail.textContent = '';+ detail.hidden = true;+ kind.textContent = '';+ kind.hidden = true;+ context.textContent = '';+ context.hidden = true;+ tag.textContent = '';+ tag.hidden = true;+ semanticId.textContent = '';+ semanticId.hidden = true;+ summary.textContent = '';+ relationshipList.textContent = '';+ copyBtn.textContent = 'Copy link';+ copyBtn.setAttribute('aria-label', 'Copy link to focused node');+ relationsBtn.textContent = 'Relations';+ relationsBtn.setAttribute('aria-label', 'Show connected relationships');+ relationsBtn.setAttribute('aria-expanded', 'false');+ chip.removeAttribute('data-relations-expanded');+ chip.style.removeProperty('top');+ if (options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ if (options.updateUrl !== false) {+ try { history.replaceState(null, '', location.pathname + location.search); } catch (_) {}+ }+ }++ function setMany(ids, options) {+ options = options || {};+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.semanticLens && Archify.semanticLens.active()) {+ Archify.semanticLens.clear({ updateUrl: false, preserveView: true, closePanel: true });+ }+ if (options.preserveRoute !== true && Archify.routeProbe && typeof Archify.routeProbe.clear === 'function') {+ Archify.routeProbe.clear({ updateUrl: false, restoreFocus: false });+ }+ var nodeList = nodes();+ var byId = {};+ nodeList.forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ var normalized = [];+ (ids || []).forEach(function (id) {+ if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);+ });+ if (!normalized.length) return false;+ if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {+ clear();+ return true;+ }++ clear({ updateUrl: false, preserveView: true });+ activeIds = normalized;+ var selected = {};+ var related = {};+ var seenEdges = {};+ var matchedEdges = 0;+ normalized.forEach(function (id) { selected[id] = true; related[id] = true; });+ var selectionMode = options.mode === 'selection' || normalized.length > 1;++ edges().forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var match = selectionMode ? selected[from] && selected[to] : selected[from] || selected[to];+ if (!match) return;+ edge.setAttribute('data-focus-match', '');+ if (!selectionMode) { related[from] = true; related[to] = true; }+ var edgeKey = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + (edge.getAttribute('data-edge-label') || ''));+ if (!seenEdges[edgeKey]) { seenEdges[edgeKey] = true; matchedEdges += 1; }+ });+ nodeList.forEach(function (node) {+ var nodeId = node.getAttribute('data-node-id');+ if (related[nodeId]) node.setAttribute('data-focus-match', '');+ if (selected[nodeId]) {+ node.setAttribute('data-focus-selected', '');+ node.setAttribute('aria-pressed', 'true');+ }+ });+ svg.setAttribute('data-focus-active', normalized.join(' '));+ var defaultLabel = normalized.length === 1+ ? nodeLabel(byId[normalized[0]], normalized[0])+ : normalized.length + ' selected nodes';+ label.textContent = options.label || defaultLabel;+ chip.hidden = options.hideChip === true || normalized.length !== 1 || selectionMode;+ if (!chip.hidden) {+ renderRelationshipLens(normalized[0], byId);+ requestLensPlacement();+ }+ if (options.updateUrl !== false) {+ var key = options.urlKey || 'focus';+ var value = options.urlValue || normalized[0];+ try { history.replaceState(null, '', location.pathname + location.search + '#' + key + '=' + encodeURIComponent(value)); } catch (_) {}+ }+ return true;+ }++ function set(id, options) {+ options = options || {};+ options.mode = 'neighborhood';+ return setMany([id], options);+ }++ function fallbackCopy(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }++ function copyFocusLink() {+ if (activeIds.length !== 1) return Promise.resolve(false);+ var record = pinnedRelationshipRecord();+ var relationId = record && record.id;+ var value = location.href.replace(/#.*$/, '') + (relationId+ ? '#relation=' + encodeURIComponent(relationId)+ : '#focus=' + encodeURIComponent(activeIds[0]));+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })+ : Promise.resolve(fallbackCopy(value));+ return copy.then(function (copied) {+ copyBtn.textContent = copied ? 'Copied' : 'Copy failed';+ copyBtn.setAttribute('aria-label', copied+ ? (relationId ? 'Pinned relationship link copied' : 'Focused node link copied')+ : (relationId ? 'Could not copy pinned relationship link' : 'Could not copy focused node link'));+ window.setTimeout(function () {+ renderRelationshipCopyAction();+ }, 1600);+ return copied;+ });+ }++ svg.addEventListener('click', function (event) {+ if (container.getAttribute('data-just-panned') === 'true') return;+ var node = event.target.closest('[data-node-id]');+ if (node) {+ var id = node.getAttribute('data-node-id');+ set(id);+ if (activeIds.indexOf(id) !== -1 && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'focus' });+ }+ }+ else if (activeIds.length) clear();+ });+ svg.addEventListener('keydown', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || (event.key !== 'Enter' && event.key !== ' ')) return;+ event.preventDefault();+ var id = node.getAttribute('data-node-id');+ set(id);+ if (activeIds.indexOf(id) !== -1 && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'focus' });+ }+ });+ clearBtn.addEventListener('click', function () { clear(); });+ copyBtn.addEventListener('click', copyFocusLink);+ relationsBtn.addEventListener('click', function () {+ var expanded = chip.getAttribute('data-relations-expanded') === 'true';+ if (expanded) chip.removeAttribute('data-relations-expanded');+ else chip.setAttribute('data-relations-expanded', 'true');+ relationsBtn.setAttribute('aria-expanded', expanded ? 'false' : 'true');+ relationsBtn.setAttribute('aria-label', expanded ? 'Show connected relationships' : 'Hide connected relationships');+ requestLensPlacement();+ });+ relationshipList.addEventListener('click', function (event) {+ var button = event.target.closest('[data-relationship-target]');+ if (!button) return;+ var id = button.getAttribute('data-relationship-target');+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ set(id, { toggle: false });+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'relationship' });+ }+ var node = svg.querySelector('[data-node-id="' + id + '"]');+ if (node) {+ try { node.focus({ preventScroll: true }); } catch (_) { try { node.focus(); } catch (_) {} }+ }+ });+ relationshipList.addEventListener('pointerover', function (event) {+ if (event.pointerType === 'touch') return;+ if (finePointerQuery && !finePointerQuery.matches) return;+ var button = event.target.closest('[data-relationship-key]');+ if (!button || !relationshipList.contains(button)) return;+ if (event.relatedTarget && button.contains(event.relatedTarget)) return;+ hoveredRelationship = button;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('pointerout', function (event) {+ var button = event.target.closest('[data-relationship-key]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ if (hoveredRelationship === button) hoveredRelationship = null;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('focusin', function (event) {+ var button = event.target.closest('[data-relationship-key]');+ if (!button) return;+ focusedRelationship = button;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('focusout', function (event) {+ var button = event.target.closest('[data-relationship-key]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ if (focusedRelationship === button) focusedRelationship = null;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('keydown', function (event) {+ if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp' && event.key !== 'Home' && event.key !== 'End') return;+ var buttons = Array.prototype.slice.call(relationshipList.querySelectorAll('[data-relationship-target]'));+ if (!buttons.length) return;+ var index = buttons.indexOf(document.activeElement);+ if (event.key === 'Home') index = 0;+ else if (event.key === 'End') index = buttons.length - 1;+ else if (event.key === 'ArrowDown') index = Math.min(buttons.length - 1, Math.max(0, index + 1));+ else index = Math.max(0, index < 0 ? 0 : index - 1);+ event.preventDefault();+ buttons[index].focus();+ });+ window.addEventListener('scroll', requestLensPlacement, { passive: true });+ window.addEventListener('resize', requestLensPlacement);+ container.addEventListener('scroll', requestLensPlacement, { passive: true });+ document.addEventListener('visibilitychange', function () {+ if (document.hidden) removeRelationshipPulse();+ });+ function syncRelationshipMotionPreference(event) {+ if (event.matches) removeRelationshipPulse();+ }+ if (reducedMotionQuery) {+ if (typeof reducedMotionQuery.addEventListener === 'function') {+ reducedMotionQuery.addEventListener('change', syncRelationshipMotionPreference);+ } else if (typeof reducedMotionQuery.addListener === 'function') {+ reducedMotionQuery.addListener(syncRelationshipMotionPreference);+ }+ }++ installRelationshipHitTargets();++ function syncFocusFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var relation = params.get('relation');+ var initial = params.get('focus');+ if (relation) {+ if (html.getAttribute('data-embed') === 'true' ||+ !inspectRelationshipById(relation, { updateUrl: false, toggle: false })) clear({ updateUrl: false });+ }+ else if (initial) set(initial, { updateUrl: false, toggle: false });+ else if (!params.get('view')) clear({ updateUrl: false });+ } catch (_) {}+ }++ window.addEventListener('hashchange', syncFocusFromHash);+ syncFocusFromHash();++ return {+ set: set,+ setMany: setMany,+ clear: clear,+ copyLink: copyFocusLink,+ inspectRelationship: inspectRelationship,+ inspectRelationshipById: inspectRelationshipById,+ reposition: requestLensPlacement,+ relationship: function () {+ var record = pinnedRelationshipRecord();+ return record ? { id: record.id || null, key: record.key, from: record.from, to: record.to, label: record.label } : null;+ },+ active: function () { return activeIds.length === 0 ? null : (activeIds.length === 1 ? activeIds[0] : activeIds.slice()); }+ };+ })();++ /* ============================================================+ Intent Trace — temporary one-hop topology before durable focus.+ Fine-pointer hover and keyboard focus share the same stable-ID preview;+ touch continues directly to the existing click-to-focus contract.+ ============================================================ */+ Archify.intentTrace = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var status = document.getElementById('intent-trace-status');+ var namespace = 'http://www.w3.org/2000/svg';+ var activeId = null;+ var hoveredNode = null;+ var focusedNode = null;+ var enterTimer = null;++ function nodes() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ }+ function edges() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ }+ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];+ }+ function finePointer() {+ return !window.matchMedia || window.matchMedia('(hover: hover) and (pointer: fine)').matches;+ }+ function reducedMotion() {+ return !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);+ }+ function blocked() {+ return html.getAttribute('data-embed') === 'true' ||+ html.getAttribute('data-guide-open') === 'true' ||+ container.classList.contains('is-panning') ||+ svg.hasAttribute('data-lens-active') ||+ svg.hasAttribute('data-story-active') ||+ svg.hasAttribute('data-relationship-preview-active') ||+ !!(Archify.routeProbe && typeof Archify.routeProbe.active === 'function' && Archify.routeProbe.active()) ||+ !!(Archify.focus && typeof Archify.focus.active === 'function' && Archify.focus.active());+ }+ function edgeShapes(edge) {+ if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function removeOverlay() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-intent-trace-overlay]'), function (overlay) {+ overlay.remove();+ });+ }+ function clear(options) {+ options = options || {};+ if (enterTimer) window.clearTimeout(enterTimer);+ enterTimer = null;+ activeId = null;+ svg.removeAttribute('data-intent-trace-active');+ removeOverlay();+ nodes().forEach(function (node) {+ node.removeAttribute('data-intent-trace-match');+ node.removeAttribute('data-intent-trace-selected');+ });+ edges().forEach(function (edge) { edge.removeAttribute('data-intent-trace-match'); });+ if (options.announce !== false) status.textContent = '';+ }+ function traceGeometry(shape, direction) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-intent-trace-match');+ clone.removeAttribute('data-intent-trace-selected');+ clone.setAttribute('class', 'intent-trace-flow');+ clone.setAttribute('data-direction', direction);+ clone.setAttribute('pathLength', '1');+ return clone;+ }+ function show(id, options) {+ options = options || {};+ if (!id || blocked()) {+ clear({ announce: false });+ return false;+ }+ if (activeId === id) return true;+ clear({ announce: false });+ var nodeList = nodes();+ var edgeList = edges();+ var byId = {};+ nodeList.forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ var selected = byId[id];+ if (!selected) return false;++ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'intent-trace-overlay');+ overlay.setAttribute('data-intent-trace-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ var related = {};+ var seen = {};+ var counts = { out: 0, in: 0, loop: 0 };+ related[id] = true;++ edgeList.forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (from !== id && to !== id) return;+ var direction = from === id && to === id ? 'loop' : (from === id ? 'out' : 'in');+ var key = edge.getAttribute('data-edge-key') ||+ (from + '\u0000' + to + '\u0000' + (edge.getAttribute('data-edge-label') || ''));+ if (!seen[key]) {+ seen[key] = true;+ counts[direction] += 1;+ }+ related[from] = true;+ related[to] = true;+ edge.setAttribute('data-intent-trace-match', '');+ var wrapper = document.createElementNS(namespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ edgeShapes(edge).forEach(function (shape) {+ wrapper.appendChild(traceGeometry(shape, direction));+ });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });++ nodeList.forEach(function (node) {+ var nodeId = node.getAttribute('data-node-id');+ if (related[nodeId]) node.setAttribute('data-intent-trace-match', '');+ if (nodeId === id) node.setAttribute('data-intent-trace-selected', '');+ });+ if (overlay.childNodes.length) {+ var firstEdge = edgeList[0];+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstEdge && firstEdge.parentNode) firstEdge.parentNode.insertBefore(overlay, firstEdge);+ else if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ }+ activeId = id;+ svg.setAttribute('data-intent-trace-active', id);+ if (options.announce === true) {+ var total = counts.out + counts.in + counts.loop;+ status.textContent = nodeLabel(selected, id) + '. ' + counts.out + ' outgoing, ' ++ counts.in + ' incoming' + (counts.loop ? ', ' + counts.loop + ' self loop' : '') ++ '. ' + total + ' connection' + (total === 1 ? '' : 's') + '. Press Enter for details.';+ }+ return true;+ }+ function schedule(node) {+ if (enterTimer) window.clearTimeout(enterTimer);+ enterTimer = window.setTimeout(function () {+ enterTimer = null;+ if (hoveredNode === node) show(node.getAttribute('data-node-id'), { announce: false });+ }, reducedMotion() ? 0 : 90);+ }+ function sync() {+ var candidate = focusedNode || hoveredNode;+ if (!candidate) {+ clear();+ return;+ }+ show(candidate.getAttribute('data-node-id'), { announce: candidate === focusedNode });+ }++ svg.addEventListener('pointerover', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || !finePointer() || event.pointerType === 'touch') return;+ if (event.relatedTarget && node.contains(event.relatedTarget)) return;+ hoveredNode = node;+ schedule(node);+ });+ svg.addEventListener('pointerout', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || (event.relatedTarget && node.contains(event.relatedTarget))) return;+ if (hoveredNode === node) hoveredNode = null;+ sync();+ });+ svg.addEventListener('focusin', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node) return;+ focusedNode = node;+ show(node.getAttribute('data-node-id'), { announce: true });+ });+ svg.addEventListener('focusout', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || (event.relatedTarget && node.contains(event.relatedTarget))) return;+ if (focusedNode === node) focusedNode = null;+ sync();+ });+ container.addEventListener('pointerdown', function (event) {+ if (!event.target.closest('[data-node-id]')) clear({ announce: false });+ });+ window.addEventListener('blur', function () { clear({ announce: false }); });++ return {+ show: show,+ clear: clear,+ active: function () { return activeId; }+ };+ })();++ Archify.guidedViews = (function () {+ var data = document.getElementById('archify-guided-views-data');+ var panel = document.getElementById('guided-views');+ var prev = document.getElementById('guided-view-prev');+ var next = document.getElementById('guided-view-next');+ var all = document.getElementById('guided-view-all');+ var play = document.getElementById('guided-view-play');+ var playIcon = document.getElementById('guided-view-play-icon');+ var playLabel = document.getElementById('guided-view-play-label');+ var beatLink = document.getElementById('guided-view-beat-link');+ var beatLinkLabel = document.getElementById('guided-view-beat-link-label');+ var progressBar = document.getElementById('guided-view-progress-bar');+ var count = document.getElementById('guided-view-count');+ var handoffReceipt = document.getElementById('guided-view-handoff');+ var label = document.getElementById('guided-view-label');+ var note = document.getElementById('guided-view-note');+ var trail = document.getElementById('guided-view-trail');+ var storyCaption = document.getElementById('guided-story-caption');+ var storyCaptionIndex = document.getElementById('guided-story-caption-index');+ var storyCaptionRoute = document.getElementById('guided-story-caption-route');+ var storyCaptionDetail = document.getElementById('guided-story-caption-detail');+ var storyCaptionNext = document.getElementById('guided-story-caption-next');+ var storyCaptionNextLabel = document.getElementById('guided-story-caption-next-label');+ var chapterIndex = document.getElementById('guided-view-index');+ var chapterList = document.getElementById('guided-view-chapters');+ var shareCue = document.getElementById('share-chapter-cue');+ var shareCueState = document.getElementById('share-chapter-state');+ var shareCueCount = document.getElementById('share-chapter-count');+ var shareCueLabel = document.getElementById('share-chapter-label');+ var shareCueNote = document.getElementById('share-chapter-note');+ var shareCueRoute = document.getElementById('share-chapter-route');+ var shareCueProgress = document.getElementById('share-chapter-progress-bar');+ var svg = document.querySelector('.diagram-container svg');+ var views = [];+ var activeIndex = -1;+ var playing = false;+ var storyBeatTimer = null;+ var storyBeatIndex = -1;+ var storyBeatStartedAt = 0;+ var storyBeatElapsedMs = 0;+ var storyBeatDwellMs = 0;+ var storyPlaybackGeneration = 0;+ var storyFollowGeneration = 0;+ var storyPlaybackScope = 'story';+ var storyPlaybackComplete = false;+ var beatLinkFeedbackTimer = null;+ var momentRestoreGeneration = 0;+ var storySteps = [];+ var storyPulseOwnerToken = 0;+ var storyPulseGeneration = 0;+ var autoplayPending = false;+ var VIEW_INTERVAL_MS = 3200;+ var STORY_FOLLOW_MIN_DWELL_MS = 1100;+ var STORY_FOLLOW_DURATION_MS = 320;+ var chapterButtons = [];+ var handoffGeneration = 0;+ var currentHandoff = null;+ var previewGeneration = 0;+ var pointerPreviewIntent = null;+ var focusPreviewIntent = null;+ var activePreviewIndex = -1;+ var previewOwnerToken = 0;++ try { views = JSON.parse(data.textContent || '[]'); } catch (_) { views = []; }+ if (!views.length) return { count: 0, active: function () { return null; } };+ var canonicalNodeIds = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ canonicalNodeIds[node.getAttribute('data-node-id')] = true;+ });+ views.forEach(function (view) {+ var seen = {};+ view.focus = (view.focus || []).filter(function (id) {+ if (!canonicalNodeIds[id] || seen[id]) return false;+ seen[id] = true;+ return true;+ });+ });+ // Establish the compact cold state before exposing the panel so the+ // full Director cannot flash during first paint. Hash restoration runs+ // in the same task and replaces this state before paint when valid.+ panel.setAttribute('data-active-view', 'all');+ panel.hidden = false;+ panel.setAttribute('data-view-interval-ms', String(VIEW_INTERVAL_MS));+ panel.setAttribute('data-story-follow-min-dwell-ms', String(STORY_FOLLOW_MIN_DWELL_MS));+ buildChapterIndex();++ function reducedMotion() {+ return !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);+ }++ function findNode(id) {+ return Array.prototype.find.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ return node.getAttribute('data-node-id') === id;+ }) || null;+ }++ function chapterDelta(previous, destination) {+ var previousFocus = previous ? previous.focus : [];+ var destinationFocus = destination ? destination.focus : [];+ var previousIds = {};+ var destinationIds = {};+ previousFocus.forEach(function (id) { previousIds[id] = true; });+ destinationFocus.forEach(function (id) { destinationIds[id] = true; });+ return {+ stay: previousFocus.filter(function (id) { return destinationIds[id]; }),+ enter: destinationFocus.filter(function (id) { return !previousIds[id]; }),+ leave: previousFocus.filter(function (id) { return !destinationIds[id]; })+ };+ }++ function chapterAnchor(previous, destination, outgoingBeatIndex, delta) {+ if (!previous || !destination) return '';+ var stayIds = {};+ delta.stay.forEach(function (id) { stayIds[id] = true; });+ var activeBeat = outgoingBeatIndex >= 0 ? previous.focus[outgoingBeatIndex] : '';+ if (activeBeat && stayIds[activeBeat]) return activeBeat;+ for (var index = previous.focus.length - 1; index >= 0; index -= 1) {+ if (stayIds[previous.focus[index]]) return previous.focus[index];+ }+ return '';+ }++ function handoffMotionAllowed() {+ if (document.hidden || reducedMotion()) return false;+ if (document.documentElement.getAttribute('data-embed') === 'true') return false;+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ return !(Archify.motionGovernor && Archify.motionGovernor.capable && Archify.motionGovernor.isPaused());+ }++ function classifyHandoff(delta, anchor) {+ var roles = {};+ delta.stay.forEach(function (id) { roles[id] = 'stay'; });+ delta.enter.forEach(function (id) { roles[id] = 'enter'; });+ delta.leave.forEach(function (id) { roles[id] = 'leave'; });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ var id = node.getAttribute('data-node-id');+ var role = roles[id] || '';+ if (role) node.setAttribute('data-chapter-role', role);+ else node.removeAttribute('data-chapter-role');+ });+ svg.setAttribute('data-chapter-handoff', anchor ? 'anchor' : 'no-anchor');+ if (anchor) svg.setAttribute('data-chapter-anchor', anchor);+ else svg.removeAttribute('data-chapter-anchor');+ }++ function drawHandoffAnchor(id) {+ var node = findNode(id);+ if (!node) return null;+ var box;+ try { box = node.getBBox(); } catch (_) { return null; }+ var overlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ var ring = document.createElementNS('http://www.w3.org/2000/svg', 'rect');+ overlay.setAttribute('class', 'chapter-handoff-overlay');+ overlay.setAttribute('data-chapter-handoff-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ ring.setAttribute('class', 'chapter-handoff-anchor');+ ring.setAttribute('x', String(box.x - 8));+ ring.setAttribute('y', String(box.y - 8));+ ring.setAttribute('width', String(box.width + 16));+ ring.setAttribute('height', String(box.height + 16));+ ring.setAttribute('rx', '10');+ overlay.appendChild(ring);+ svg.appendChild(overlay);+ return overlay;+ }++ function clearHandoffPresentation() {+ svg.removeAttribute('data-chapter-handoff');+ svg.removeAttribute('data-chapter-anchor');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-chapter-handoff-overlay]'), function (overlay) { overlay.remove(); });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-chapter-role]'), function (node) { node.removeAttribute('data-chapter-role'); });+ if (handoffReceipt) {+ handoffReceipt.hidden = true;+ handoffReceipt.textContent = '';+ }+ }++ function completeHandoff(handoff, outcome) {+ if (!handoff || currentHandoff !== handoff) return false;+ if (handoff.holdTimer) clearTimeout(handoff.holdTimer);+ handoff.holdTimer = null;+ currentHandoff = null;+ clearHandoffPresentation();+ if (handoff.ownerToken && Archify.motionGovernor) Archify.motionGovernor.release(handoff.ownerToken);+ handoff.resolve({ id: handoff.id, state: outcome || 'complete', anchor: handoff.anchor || null });+ syncStoryControlsDisabled();+ syncChapterPreview();+ return true;+ }++ function settleHandoff(reason) {+ var handoff = currentHandoff;+ if (!handoff) return false;+ if (handoff.holdTimer) clearTimeout(handoff.holdTimer);+ handoff.holdTimer = null;+ if (handoff.camera && handoff.camera.cancel) handoff.camera.cancel(reason || 'settled', true);+ else if (Archify.view && Archify.view.reveal) Archify.view.reveal(handoff.focus, { instant: true, reason: reason || 'settled' });+ completeHandoff(handoff, reason || 'settled');+ return true;+ }++ function cancelHandoff(reason) {+ var handoff = currentHandoff;+ if (!handoff) return false;+ if (handoff.holdTimer) clearTimeout(handoff.holdTimer);+ handoff.holdTimer = null;+ if (handoff.camera && handoff.camera.cancel) handoff.camera.cancel(reason || 'manual', false);+ completeHandoff(handoff, reason || 'manual');+ return true;+ }++ function afterHandoff(callback) {+ if (!currentHandoff) { callback(); return; }+ currentHandoff.finished.then(callback);+ }++ function beginHandoff(previousIndex, nextIndex, previous, destination, outgoingBeatIndex, reason) {+ if (!Archify.view || !Archify.view.reveal) return null;+ if (!previous || previousIndex === nextIndex) {+ Archify.view.reveal(destination.focus, { reason: reason });+ return null;+ }+ var delta = chapterDelta(previous, destination);+ var anchor = chapterAnchor(previous, destination, outgoingBeatIndex, delta);+ if (!handoffMotionAllowed()) {+ Archify.view.reveal(destination.focus, { instant: true, reason: reason });+ return null;+ }+ var resolver;+ var handoff = {+ id: ++handoffGeneration,+ mode: anchor ? 'holding' : 'no-anchor',+ anchor: anchor,+ focus: destination.focus.slice(),+ holdTimer: null,+ camera: null,+ ownerToken: 0,+ finished: new Promise(function (resolve) { resolver = resolve; }),+ resolve: resolver+ };+ currentHandoff = handoff;+ classifyHandoff(delta, anchor);+ if (anchor) {+ drawHandoffAnchor(anchor);+ var node = findNode(anchor);+ var nodeLabel = node ? (node.getAttribute('data-node-label') || anchor) : anchor;+ handoffReceipt.textContent = (previousIndex + 1 < 10 ? '0' : '') + (previousIndex + 1) ++ ' \u2192 ' + (nextIndex + 1 < 10 ? '0' : '') + (nextIndex + 1) + ' \u00b7 via ' + nodeLabel;+ handoffReceipt.hidden = false;+ }+ if (Archify.motionGovernor) {+ handoff.ownerToken = Archify.motionGovernor.claim('handoff', function () {+ if (currentHandoff === handoff) settleHandoff('preempted');+ });+ }+ var startCamera = function () {+ if (currentHandoff !== handoff) return;+ handoff.holdTimer = null;+ handoff.mode = 'settling';+ svg.setAttribute('data-chapter-handoff', anchor ? 'settling' : 'no-anchor');+ handoff.camera = Archify.view.reveal(destination.focus, { reason: reason, duration: 420 });+ if (handoff.camera && handoff.camera.finished) {+ handoff.camera.finished.then(function (outcome) {+ if (currentHandoff === handoff) completeHandoff(handoff, outcome && outcome.state || 'complete');+ });+ } else {+ completeHandoff(handoff, 'complete');+ }+ };+ if (anchor) handoff.holdTimer = setTimeout(startCamera, 110);+ else startCamera();+ return handoff;+ }++ function centerChapterButton(button) {+ if (!button || !chapterList) return false;+ var target = Math.max(0, button.offsetLeft - (chapterList.clientWidth - button.offsetWidth) / 2);+ if (typeof chapterList.scrollTo === 'function') chapterList.scrollTo({ left: target, behavior: 'auto' });+ else chapterList.scrollLeft = target;+ return true;+ }++ function focusChapterButton(index) {+ if (!chapterButtons.length) return false;+ index = Math.max(0, Math.min(chapterButtons.length - 1, index));+ chapterButtons.forEach(function (button, buttonIndex) {+ button.setAttribute('tabindex', buttonIndex === index ? '0' : '-1');+ });+ chapterButtons[index].focus();+ centerChapterButton(chapterButtons[index]);+ return true;+ }++ function buildChapterIndex() {+ chapterButtons = [];+ chapterList.textContent = '';+ views.forEach(function (view, index) {+ var item = document.createElement('li');+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'guided-view-chapter';+ button.setAttribute('data-guided-view-id', view.id);+ button.setAttribute('aria-pressed', 'false');+ button.setAttribute('tabindex', index === 0 ? '0' : '-1');+ button.setAttribute('aria-label', 'Open chapter ' + (index + 1) + ' of ' + views.length + ': ' + view.label + ', ' + view.focus.length + ' stops');+ button.title = view.label + ' — ' + (view.note || view.focus.length + ' selected nodes');+ var position = document.createElement('span');+ position.className = 'guided-view-chapter-index';+ position.setAttribute('aria-hidden', 'true');+ position.textContent = (index + 1 < 10 ? '0' : '') + (index + 1);+ var title = document.createElement('span');+ title.className = 'guided-view-chapter-title';+ title.textContent = view.label;+ var stops = document.createElement('em');+ stops.className = 'guided-view-chapter-count';+ stops.textContent = view.focus.length + ' stop' + (view.focus.length === 1 ? '' : 's');+ var delta = document.createElement('span');+ delta.className = 'guided-view-chapter-delta';+ delta.hidden = true;+ delta.setAttribute('aria-hidden', 'true');+ ['stay', 'enter', 'leave'].forEach(function (kind) {+ var value = document.createElement('span');+ value.setAttribute('data-delta-kind', kind);+ delta.appendChild(value);+ });+ button.appendChild(position);+ button.appendChild(title);+ button.appendChild(stops);+ button.appendChild(delta);+ item.appendChild(button);+ chapterList.appendChild(item);+ chapterButtons.push(button);+ });+ }++ function syncChapterIndex() {+ chapterButtons.forEach(function (button, index) {+ var current = index === activeIndex;+ var stops = button.querySelector('.guided-view-chapter-count');+ var deltaLabel = button.querySelector('.guided-view-chapter-delta');+ var position = activeIndex < 0 ? 'available' : (current ? 'current' : (index < activeIndex ? 'before' : 'after'));+ button.setAttribute('data-chapter-position', position);+ button.setAttribute('aria-pressed', current ? 'true' : 'false');+ button.setAttribute('tabindex', current || (activeIndex < 0 && index === 0) ? '0' : '-1');+ if (current) {+ stops.hidden = false;+ deltaLabel.hidden = true;+ button.removeAttribute('data-chapter-delta');+ button.setAttribute('aria-label', 'Current chapter ' + (index + 1) + ' of ' + views.length + ': ' + views[index].label + ', ' + views[index].focus.length + ' stops');+ button.title = views[index].label + ' — current chapter, ' + views[index].focus.length + ' stops';+ } else {+ var delta = chapterDelta(activeIndex >= 0 ? views[activeIndex] : null, views[index]);+ var compact = '=' + delta.stay.length + ' +' + delta.enter.length + ' \u2212' + delta.leave.length;+ var expanded = delta.stay.length + ' stay, ' + delta.enter.length + ' enter, ' + delta.leave.length + ' leave';+ stops.hidden = true;+ deltaLabel.hidden = false;+ deltaLabel.querySelector('[data-delta-kind="stay"]').textContent = '=' + delta.stay.length;+ deltaLabel.querySelector('[data-delta-kind="enter"]').textContent = '+' + delta.enter.length;+ deltaLabel.querySelector('[data-delta-kind="leave"]').textContent = '\u2212' + delta.leave.length;+ button.setAttribute('data-chapter-delta', compact);+ button.setAttribute('aria-label', 'Open chapter ' + (index + 1) + ' of ' + views.length + ': ' + views[index].label + '. Chapter focus delta: ' + expanded);+ button.title = views[index].label + ' — ' + compact + ' chapter focus';+ }+ if (current) button.setAttribute('aria-current', 'step');+ else button.removeAttribute('aria-current');+ if (button.parentElement) button.parentElement.setAttribute('data-chapter-position', position);+ });+ if (activeIndex >= 0) centerChapterButton(chapterButtons[activeIndex]);+ }++ function chapterPreviewBlocked() {+ if (document.hidden || playing || currentHandoff) return true;+ if (document.documentElement.getAttribute('data-embed') === 'true') return true;+ if (window.matchMedia && window.matchMedia('print').matches) return true;+ if (svg.hasAttribute('data-route-picking') || svg.hasAttribute('data-route-active')) return true;+ if (svg.hasAttribute('data-lens-active') || svg.hasAttribute('data-legend-preview-active')) return true;+ if (svg.hasAttribute('data-relationship-preview-active') || svg.hasAttribute('data-intent-trace-active')) return true;+ return activeIndex < 0 && svg.hasAttribute('data-focus-active');+ }++ function clearChapterPreviewPresentation() {+ svg.removeAttribute('data-chapter-preview');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-chapter-preview-role]'), function (node) {+ node.removeAttribute('data-chapter-preview-role');+ });+ chapterButtons.forEach(function (button) { button.removeAttribute('data-preview-active'); });+ activePreviewIndex = -1;+ if (previewOwnerToken && Archify.motionGovernor) {+ var token = previewOwnerToken;+ previewOwnerToken = 0;+ Archify.motionGovernor.release(token);+ }+ }++ function clearChapterPreview(options) {+ options = options || {};+ previewGeneration += 1;+ if (options.clearIntents !== false) {+ pointerPreviewIntent = null;+ focusPreviewIntent = null;+ }+ clearChapterPreviewPresentation();+ return true;+ }++ function winningChapterPreviewIntent() {+ return [pointerPreviewIntent, focusPreviewIntent].filter(function (intent) {+ return intent && intent.index >= 0 && intent.index < views.length && intent.index !== activeIndex;+ }).sort(function (left, right) { return right.generation - left.generation; })[0] || null;+ }++ function showChapterPreview(index) {+ if (index < 0 || index >= views.length || index === activeIndex || chapterPreviewBlocked()) {+ clearChapterPreviewPresentation();+ return false;+ }+ if (activePreviewIndex === index && svg.getAttribute('data-chapter-preview') === views[index].id) return true;+ clearChapterPreviewPresentation();+ var delta = chapterDelta(activeIndex >= 0 ? views[activeIndex] : null, views[index]);+ var roles = {};+ delta.stay.forEach(function (id) { roles[id] = 'stay'; });+ delta.enter.forEach(function (id) { roles[id] = 'enter'; });+ delta.leave.forEach(function (id) { roles[id] = 'leave'; });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ var role = roles[node.getAttribute('data-node-id')];+ if (role) node.setAttribute('data-chapter-preview-role', role);+ });+ svg.setAttribute('data-chapter-preview', views[index].id);+ chapterButtons[index].setAttribute('data-preview-active', 'true');+ activePreviewIndex = index;+ if (Archify.motionGovernor && Archify.motionGovernor.capable) {+ previewOwnerToken = Archify.motionGovernor.claim('chapter-preview', function () {+ previewOwnerToken = 0;+ clearChapterPreviewPresentation();+ });+ }+ return true;+ }++ function syncChapterPreview() {+ var intent = winningChapterPreviewIntent();+ if (!intent || chapterPreviewBlocked()) {+ clearChapterPreviewPresentation();+ return false;+ }+ return showChapterPreview(intent.index);+ }++ function setChapterPreviewIntent(source, index) {+ var intent = { index: index, generation: ++previewGeneration };+ if (source === 'pointer') pointerPreviewIntent = intent;+ else focusPreviewIntent = intent;+ if (playing) pausePlayback();+ return syncChapterPreview();+ }++ function clearChapterPreviewIntent(source, index) {+ var intent = source === 'pointer' ? pointerPreviewIntent : focusPreviewIntent;+ if (intent && (typeof index !== 'number' || intent.index === index)) {+ if (source === 'pointer') pointerPreviewIntent = null;+ else focusPreviewIntent = null;+ previewGeneration += 1;+ }+ return syncChapterPreview();+ }++ function hoverCapable() {+ return !!(window.matchMedia && window.matchMedia('(hover: hover)').matches);+ }++ function sharePlaybackRequested() {+ try { return new URLSearchParams(location.search).get('play') === '1'; }+ catch (_) { return false; }+ }++ autoplayPending = sharePlaybackRequested();+ if (autoplayPending) {+ document.documentElement.setAttribute('data-share-playback', 'true');+ setAutoplayState('pending');+ }++ function setAutoplayState(state) {+ if (state) panel.setAttribute('data-autoplay', state);+ else panel.removeAttribute('data-autoplay');+ renderShareCue();+ }++ function shareCueStatus(state) {+ return {+ pending: 'Ready',+ playing: 'Playing',+ complete: 'Settled',+ interrupted: 'Paused',+ pinned: 'Pinned',+ 'reduced-motion': 'Still'+ }[state] || 'Ready';+ }++ function shareCueBeatCopy(state, view, stops) {+ var total = stops.length;+ var activeStop = storyBeatIndex >= 0 ? stops[storyBeatIndex] : null;+ if ((state === 'playing' || state === 'interrupted') && activeStop) {+ return 'Step ' + (storyBeatIndex + 1 < 10 ? '0' : '') + (storyBeatIndex + 1) + ' / ' ++ (total < 10 ? '0' : '') + total + ' · ' + activeStop.textContent;+ }+ if (state === 'pinned' && activeStop) {+ return storyBeatCopy(storySteps[storyBeatIndex], total);+ }+ if (state === 'reduced-motion' && activeStop && hashBeatMatchesCurrent()) {+ return 'Step ' + (storyBeatIndex + 1 < 10 ? '0' : '') + (storyBeatIndex + 1) + ' / ' ++ (total < 10 ? '0' : '') + total + ' · ' + activeStop.textContent + ' · Static moment';+ }+ if (state === 'complete') return total + ' steps complete · ' + (view.note || 'Path settled for reading.');+ if (state === 'reduced-motion') return total + ' steps · Static path';+ if (state === 'pending') return total + ' steps · Ready';+ return view.note || view.focus.length + ' selected nodes';+ }++ function renderShareCue() {+ if (!shareCue) return;+ var view = activeIndex >= 0 ? views[activeIndex] : null;+ var shareMode = document.documentElement.getAttribute('data-share-playback') === 'true';+ var embedMode = document.documentElement.getAttribute('data-embed') === 'true';+ var pinnedMode = !shareMode && embedMode && hashBeatMatchesCurrent();+ if (pinnedMode) document.documentElement.setAttribute('data-share-moment', 'true');+ else document.documentElement.removeAttribute('data-share-moment');+ shareCue.hidden = !(embedMode && view && (shareMode || pinnedMode));+ if (shareCue.hidden) return;+ var state = pinnedMode ? 'pinned' : (panel.getAttribute('data-autoplay') || 'pending');+ var stops = Array.prototype.slice.call(trail.querySelectorAll('[data-story-node]'));+ var route = stops.map(function (stop, index) {+ if (index === 0) return stop.textContent;+ var kind = stop.getAttribute('data-story-link');+ var separator = kind === 'forward' ? '\u2192' : (kind === 'reverse' ? '\u2190' : (kind === 'multiple' ? '\u21c4' : '\u00b7'));+ return separator + ' ' + stop.textContent;+ }).join(' ');+ var beatCopy = shareCueBeatCopy(state, view, stops);+ shareCue.setAttribute('data-state', state);+ shareCue.setAttribute('aria-live', state === 'playing' ? 'off' : 'polite');+ shareCueState.textContent = shareCueStatus(state);+ shareCueCount.textContent = 'Chapter ' + (activeIndex + 1 < 10 ? '0' : '') + (activeIndex + 1) + ' / ' + (views.length < 10 ? '0' : '') + views.length;+ shareCueLabel.textContent = view.label;+ shareCueNote.textContent = beatCopy;+ shareCueRoute.textContent = route;+ shareCue.setAttribute('aria-label', shareCueStatus(state) + ' chapter ' + (activeIndex + 1) + ' of ' + views.length + ': ' + view.label + '. ' + beatCopy + '. ' + route);+ }++ function setShareCueProgress(fraction) {+ if (!shareCueProgress) return;+ shareCueProgress.style.animation = 'none';+ shareCueProgress.style.setProperty('--guided-progress-start', String(Math.max(0, Math.min(1, fraction))));+ shareCueProgress.style.transform = 'scaleX(' + Math.max(0, Math.min(1, fraction)) + ')';+ }++ function startShareCueProgress(fraction, duration) {+ if (!shareCueProgress) return;+ setShareCueProgress(fraction || 0);+ void shareCueProgress.offsetWidth;+ shareCueProgress.style.animation = 'archify-guided-progress ' + Math.max(1, duration || VIEW_INTERVAL_MS) + 'ms linear forwards';+ }++ function storyNodeLabel(node, fallback) {+ if (!node) return fallback;+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '');+ }++ function storyEdgeKey(edge) {+ return edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ }++ function uniqueStoryEdges(edgeList) {+ var positions = {};+ var unique = [];+ edgeList.forEach(function (edge) {+ var key = storyEdgeKey(edge);+ if (!Object.prototype.hasOwnProperty.call(positions, key)) {+ positions[key] = unique.length;+ unique.push(edge);+ return;+ }+ var index = positions[key];+ if (!storyGeometry(unique[index]).length && storyGeometry(edge).length) unique[index] = edge;+ });+ return unique;+ }++ function storyStep(view, index, edgeList, byId) {+ var id = view.focus[index];+ var node = byId[id];+ var previousId = index > 0 ? view.focus[index - 1] : '';+ var forward = [];+ var reverse = [];+ if (previousId) {+ edgeList.forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (from === previousId && to === id) forward.push(edge);+ else if (from === id && to === previousId) reverse.push(edge);+ });+ }+ forward = uniqueStoryEdges(forward);+ reverse = uniqueStoryEdges(reverse);+ var edges = forward.concat(reverse).sort(function (left, right) {+ return edgeList.indexOf(left) - edgeList.indexOf(right);+ });+ var relation = index === 0 ? 'start' : (!edges.length ? 'group' : (+ edges.length === 1 && forward.length === 1 ? 'forward' :+ (edges.length === 1 && reverse.length === 1 ? 'reverse' : 'multiple')+ ));+ return {+ index: index,+ nodeId: id,+ nodeLabel: storyNodeLabel(byId[id], id),+ previousId: previousId,+ previousLabel: previousId ? storyNodeLabel(byId[previousId], previousId) : '',+ relation: relation,+ edges: edges,+ edgeKeys: edges.map(storyEdgeKey),+ edgeLabels: edges.map(function (edge) { return edge.getAttribute('data-edge-label') || ''; }).filter(function (value, edgeIndex, values) {+ return value && values.indexOf(value) === edgeIndex;+ }),+ responsibility: node ? (node.getAttribute('data-node-sublabel') || '') : '',+ context: node ? (node.getAttribute('data-node-context') || '') : ''+ };+ }++ function storyBeatCopy(step, total) {+ if (!step) return '';+ var position = (step.index + 1 < 10 ? '0' : '') + (step.index + 1);+ var countValue = (total < 10 ? '0' : '') + total;+ if (step.relation === 'start') return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.nodeLabel + ' \u00b7 starting point';+ if (step.relation === 'forward') return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.previousLabel + ' \u2192 ' + step.nodeLabel;+ if (step.relation === 'reverse') return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.nodeLabel + ' \u2192 ' + step.previousLabel + ' \u00b7 reverse authored link';+ if (step.relation === 'multiple') return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.previousLabel + ' \u21c4 ' + step.nodeLabel + ' \u00b7 ' + step.edges.length + ' authored links';+ return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.previousLabel + ' \u00b7 ' + step.nodeLabel + ' \u00b7 grouped \u00b7 no direct link';+ }++ function storyBeatAria(step, total) {+ var prefix = 'Story beat ' + (step.index + 1) + ' of ' + total + ': ' + step.nodeLabel + '. ';+ if (step.relation === 'start') return prefix + 'Starting point.';+ if (step.relation === 'forward') return prefix + 'From ' + step.previousLabel + ' through one authored forward relationship.';+ if (step.relation === 'reverse') return prefix + 'From ' + step.previousLabel + '; the authored relationship points from ' + step.nodeLabel + ' to ' + step.previousLabel + '.';+ if (step.relation === 'multiple') return prefix + 'From ' + step.previousLabel + ' through ' + step.edges.length + ' authored relationships; shown without arbitrary motion.';+ return prefix + 'Grouped from ' + step.previousLabel + ' with no direct authored relationship.';+ }++ function storyCaptionRouteCopy(step) {+ if (step.relation === 'start') return step.nodeLabel + ' · Starting point';+ if (step.relation === 'reverse') return step.previousLabel + ' ← ' + step.nodeLabel;+ if (step.relation === 'multiple') return step.previousLabel + ' ⇄ ' + step.nodeLabel;+ if (step.relation === 'group') return step.previousLabel + ' · ' + step.nodeLabel;+ return step.previousLabel + ' → ' + step.nodeLabel;+ }++ function storyCaptionDetailCopy(step) {+ var facts = [];+ if (step.relation === 'group') facts.push('Grouped transition · no direct authored link');+ else if (step.edgeLabels.length) facts.push(step.edgeLabels.slice(0, 3).join(' + ') + (step.edgeLabels.length > 3 ? ' +' + (step.edgeLabels.length - 3) + ' more' : ''));+ else if (step.relation === 'reverse') facts.push('Reverse authored relationship');+ else if (step.relation === 'multiple') facts.push(step.edges.length + ' authored relationships');+ else if (step.relation !== 'start') facts.push('Authored relationship');+ if (step.relation === 'reverse') facts.push('authored direction: ' + step.nodeLabel + ' → ' + step.previousLabel);+ if (step.responsibility) facts.push(step.responsibility);+ if (step.context) facts.push(step.context);+ if (!facts.length) facts.push('Authored starting point');+ return facts.join(' · ');+ }++ function renderStoryCaption(step, total, nextStep) {+ if (!storyCaption) return;+ if (!step) {+ storyCaption.hidden = true;+ storyCaption.removeAttribute('data-story-caption');+ storyCaptionNext.hidden = true;+ storyCaptionNextLabel.textContent = '';+ return;+ }+ storyCaption.hidden = false;+ storyCaption.setAttribute('data-story-caption', step.relation);+ storyCaption.setAttribute('aria-live', playing ? 'off' : 'polite');+ storyCaptionIndex.textContent = (step.index + 1 < 10 ? '0' : '') + (step.index + 1) + ' / ' + (total < 10 ? '0' : '') + total;+ storyCaptionRoute.textContent = storyCaptionRouteCopy(step);+ storyCaptionDetail.textContent = storyCaptionDetailCopy(step);+ storyCaptionNext.hidden = !nextStep;+ storyCaptionNextLabel.textContent = nextStep+ ? ((nextStep.index + 1 < 10 ? '0' : '') + (nextStep.index + 1) + ' · ' + nextStep.nodeLabel)+ : '';+ storyCaption.style.animation = 'none';+ void storyCaption.offsetWidth;+ storyCaption.style.removeProperty('animation');+ }++ function storyMomentLink() {+ var view = activeIndex >= 0 ? views[activeIndex] : null;+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ if (!view || !step) return '';+ var url = new URL(location.href);+ url.searchParams.delete('play');+ url.hash = 'view=' + encodeURIComponent(view.id) + '&beat=' + encodeURIComponent(step.nodeId);+ return url.href;+ }++ function fallbackCopyStoryMoment(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }++ function resetBeatLinkFeedback() {+ if (beatLinkFeedbackTimer) clearTimeout(beatLinkFeedbackTimer);+ beatLinkFeedbackTimer = null;+ beatLink.removeAttribute('data-copy-state');+ beatLinkLabel.textContent = 'Copy moment';+ }++ function syncBeatLink() {+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ var available = !!(activeIndex >= 0 && step && !currentHandoff);+ beatLink.disabled = !available;+ if (!beatLink.hasAttribute('data-copy-state')) beatLinkLabel.textContent = 'Copy moment';+ var description = available+ ? 'Copy link to current story moment: Beat ' + (step.index + 1) + ' of ' + storySteps.length + ': ' + step.nodeLabel+ : 'Select a Story Beat to copy its exact link';+ beatLink.setAttribute('aria-label', description);+ beatLink.title = description;+ }++ function setBeatLinkFeedback(copied) {+ resetBeatLinkFeedback();+ beatLink.setAttribute('data-copy-state', copied ? 'copied' : 'failed');+ beatLinkLabel.textContent = copied ? 'Copied' : 'Copy failed';+ beatLink.setAttribute('aria-label', copied ? 'Moment link copied' : 'Could not copy story moment link');+ beatLinkFeedbackTimer = setTimeout(function () {+ resetBeatLinkFeedback();+ syncBeatLink();+ }, 1600);+ }++ function copyStoryMomentLink() {+ if (playing) pausePlayback();+ var value = storyMomentLink();+ if (!value) return Promise.resolve(false);+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopyStoryMoment(value); })+ : Promise.resolve(fallbackCopyStoryMoment(value));+ return copy.then(function (copied) {+ setBeatLinkFeedback(copied);+ return copied;+ });+ }++ function hashBeatMatchesCurrent() {+ var view = activeIndex >= 0 ? views[activeIndex] : null;+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ if (!view || !step) return false;+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ return params.get('view') === view.id && params.get('beat') === step.nodeId;+ } catch (_) { return false; }+ }++ function storyMotionAllowed() {+ if (document.hidden || reducedMotion()) return false;+ if (document.documentElement.getAttribute('data-motion') !== 'live') return false;+ if (document.documentElement.getAttribute('data-embed') === 'true' &&+ document.documentElement.getAttribute('data-share-playback') !== 'true') return false;+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ return !(Archify.motionGovernor && Archify.motionGovernor.isPaused());+ }++ function storyAutomaticPlaybackAllowed() {+ if (document.hidden || reducedMotion()) return false;+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ if (Archify.motionGovernor && Archify.motionGovernor.capable) return !Archify.motionGovernor.isPaused();+ return true;+ }++ function clearStoryPulse(options) {+ options = options || {};+ storyPulseGeneration += 1;+ Array.prototype.forEach.call(svg.querySelectorAll('.story-trail-flow[data-story-pulse]'), function (flow) {+ flow.removeAttribute('data-story-pulse');+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-carrier-overlay]'), function (overlay) {+ overlay.remove();+ });+ if (storyPulseOwnerToken && options.release !== false && Archify.motionGovernor) {+ var token = storyPulseOwnerToken;+ storyPulseOwnerToken = 0;+ Archify.motionGovernor.release(token);+ } else if (options.release === false) storyPulseOwnerToken = 0;+ }++ function pulseStoryStep(step) {+ clearStoryPulse();+ if (!step || (step.relation !== 'forward' && step.relation !== 'reverse') || step.edges.length !== 1 || !storyMotionAllowed()) return false;+ var flows = Array.prototype.slice.call(svg.querySelectorAll('.story-trail-flow[data-story-beat-step="' + step.index + '"]'));+ if (!flows.length) return false;+ var pulseGeneration = storyPulseGeneration;+ if (Archify.motionGovernor && Archify.motionGovernor.capable) {+ storyPulseOwnerToken = Archify.motionGovernor.claim('story', function () {+ clearStoryPulse({ release: false });+ });+ }+ flows.forEach(function (flow) { flow.setAttribute('data-story-pulse', 'true'); });+ if (Archify.flowTokens && typeof Archify.flowTokens.create === 'function') {+ var edge = step.edges[0];+ var shapes = storyGeometry(edge);+ var carrier = shapes.length ? Archify.flowTokens.create(edge, shapes[0], {+ className: 'story-flow-token',+ duration: '0.78s'+ }) : null;+ if (carrier) {+ var carrierOverlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ var carrierWrapper = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ carrierOverlay.setAttribute('class', 'story-carrier-overlay');+ carrierOverlay.setAttribute('data-story-carrier-overlay', '');+ carrierOverlay.setAttribute('aria-hidden', 'true');+ if (edge.hasAttribute('transform')) carrierWrapper.setAttribute('transform', edge.getAttribute('transform'));+ carrier.setAttribute('data-story-carrier-token', '');+ carrier.setAttribute('data-story-beat-step', String(step.index));+ carrierWrapper.appendChild(carrier);+ carrierOverlay.appendChild(carrierWrapper);+ var firstNode = svg.querySelector('[data-node-id]');+ while (firstNode && firstNode.parentNode !== svg) firstNode = firstNode.parentNode;+ if (firstNode) svg.insertBefore(carrierOverlay, firstNode);+ else svg.appendChild(carrierOverlay);+ }+ }+ void flows[0].getBoundingClientRect();+ flows[0].addEventListener('animationend', function () {+ if (pulseGeneration === storyPulseGeneration) clearStoryPulse();+ }, { once: true });+ return true;+ }++ function stopStoryBeatTimer(options) {+ options = options || {};+ storyPlaybackGeneration += 1;+ if (storyBeatTimer && options.preserveElapsed === true && storyBeatStartedAt) {+ storyBeatElapsedMs = Math.min(storyBeatDwellMs, storyBeatElapsedMs + Math.max(0, Date.now() - storyBeatStartedAt));+ }+ if (storyBeatTimer) clearTimeout(storyBeatTimer);+ storyBeatTimer = null;+ storyBeatStartedAt = 0;+ }++ function centerStoryStop(stop) {+ if (!stop || !trail) return false;+ var target = Math.max(0, stop.offsetLeft - (trail.clientWidth - stop.offsetWidth) / 2);+ trail.scrollLeft = target;+ return true;+ }++ function storyBeatDwell(total) {+ return Math.max(STORY_FOLLOW_MIN_DWELL_MS, VIEW_INTERVAL_MS / Math.max(1, total));+ }++ function clearStoryFollow() {+ storyFollowGeneration += 1;+ svg.removeAttribute('data-story-follow');+ panel.removeAttribute('data-story-follow');+ panel.removeAttribute('data-story-follow-node');+ }++ function storyFrameIds(step) {+ if (!step) return [];+ var ids = [];+ if (step.index > 0 && storySteps[step.index - 1]) ids.push(storySteps[step.index - 1].nodeId);+ ids.push(step.nodeId);+ if (step.index + 1 < storySteps.length) ids.push(storySteps[step.index + 1].nodeId);+ return ids;+ }++ function followStoryStep(step, options) {+ options = options || {};+ if (!step || document.hidden) return false;+ if (!Archify.view || typeof Archify.view.reveal !== 'function') {+ var deferredIndex = step.index;+ var deferredGeneration = ++storyFollowGeneration;+ requestAnimationFrame(function () {+ if (deferredGeneration !== storyFollowGeneration || storyBeatIndex !== deferredIndex) return;+ if (Archify.view && typeof Archify.view.reveal === 'function') followStoryStep(step, options);+ });+ return true;+ }+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ var embed = document.documentElement.getAttribute('data-embed') === 'true';+ var explicitEmbedPlayback = document.documentElement.getAttribute('data-share-playback') === 'true';+ if (embed && !explicitEmbedPlayback && options.linked !== true) return false;+ var ids = storyFrameIds(step);+ var generation = ++storyFollowGeneration;+ svg.setAttribute('data-story-follow', step.nodeId);+ panel.setAttribute('data-story-follow', 'moving');+ panel.setAttribute('data-story-follow-node', step.nodeId);+ var receipt = Archify.view.reveal(ids, {+ reason: options.manual === true ? 'story-beat' : 'story-follow',+ padding: 64,+ maxScale: 1.65,+ duration: STORY_FOLLOW_DURATION_MS,+ instant: options.instant === true || reducedMotion() || document.documentElement.getAttribute('data-motion') !== 'live'+ });+ if (receipt && receipt.finished && typeof receipt.finished.then === 'function') {+ receipt.finished.then(function (result) {+ if (generation !== storyFollowGeneration || storyBeatIndex !== step.index) return;+ svg.removeAttribute('data-story-follow');+ panel.setAttribute('data-story-follow', result && result.state === 'complete' ? 'settled' : 'interrupted');+ });+ } else if (generation === storyFollowGeneration) {+ panel.setAttribute('data-story-follow', 'settled');+ }+ return receipt;+ }++ function setStoryBeat(index, options) {+ options = options || {};+ var stops = Array.prototype.slice.call(trail.querySelectorAll('[data-story-node]'));+ if (!stops.length) return false;+ resetBeatLinkFeedback();+ storyBeatIndex = Math.max(0, Math.min(stops.length - 1, index));+ var nextStep = storyBeatIndex + 1 < storySteps.length ? storySteps[storyBeatIndex + 1] : null;+ svg.setAttribute('data-story-beat', (storyBeatIndex + 1) + '/' + stops.length);+ panel.setAttribute('data-story-beat', (storyBeatIndex + 1) + '/' + stops.length);+ if (nextStep) {+ svg.setAttribute('data-story-next', nextStep.nodeId);+ panel.setAttribute('data-story-next', nextStep.nodeId);+ } else {+ svg.removeAttribute('data-story-next');+ panel.removeAttribute('data-story-next');+ }+ function storyBeatState(step) {+ if (step < storyBeatIndex) return 'past';+ if (step === storyBeatIndex) return 'active';+ if (step === storyBeatIndex + 1) return 'next';+ return 'pending';+ }+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-step]'), function (node) {+ var step = Number(node.getAttribute('data-story-step'));+ node.setAttribute('data-story-beat-state', storyBeatState(step));+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-beat-step]'), function (edge) {+ var step = Number(edge.getAttribute('data-story-beat-step'));+ edge.setAttribute('data-story-beat-state', storyBeatState(step));+ });+ stops.forEach(function (stop, step) {+ stop.setAttribute('data-story-beat-state', storyBeatState(step));+ if (step === storyBeatIndex) stop.setAttribute('aria-current', 'step');+ else stop.removeAttribute('aria-current');+ });+ note.setAttribute('aria-live', 'off');+ note.textContent = storyBeatCopy(storySteps[storyBeatIndex], stops.length);+ renderStoryCaption(storySteps[storyBeatIndex], stops.length, nextStep);+ if (options.center === true) centerStoryStop(stops[storyBeatIndex]);+ if (options.pulse === true) pulseStoryStep(storySteps[storyBeatIndex]);+ else clearStoryPulse();+ if (options.follow === true) followStoryStep(storySteps[storyBeatIndex], {+ manual: options.manual === true,+ linked: options.linked === true,+ instant: options.followInstant === true+ });+ renderShareCue();+ syncBeatLink();+ return true;+ }++ function settleStoryBeats() {+ stopStoryBeatTimer();+ clearStoryPulse();+ clearStoryFollow();+ resetBeatLinkFeedback();+ storyBeatIndex = -1;+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = 0;+ svg.removeAttribute('data-story-beat');+ svg.removeAttribute('data-story-next');+ panel.removeAttribute('data-story-beat');+ panel.removeAttribute('data-story-next');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-beat-state]'), function (el) {+ el.removeAttribute('data-story-beat-state');+ });+ Array.prototype.forEach.call(trail.querySelectorAll('[data-story-beat-state]'), function (stop) {+ stop.removeAttribute('data-story-beat-state');+ stop.removeAttribute('aria-current');+ });+ note.setAttribute('aria-live', 'polite');+ if (activeIndex >= 0) note.textContent = views[activeIndex].note || views[activeIndex].focus.length + ' selected nodes';+ renderStoryCaption(null, 0);+ renderShareCue();+ syncBeatLink();+ }- <!-- Main Diagram -->- <div class="diagram-container">- <svg viewBox="0 0 1340 568" role="img" aria-label="Archify — Agent skill → JSON IR → typed renderers → standalone HTML (architecture diagram)">- <!-- Definitions -->- <defs>- <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" class="m-default" />- </marker>- <marker id="arrowhead-emphasis" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" class="m-emphasis" />- </marker>- <marker id="arrowhead-security" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" class="m-security" />- </marker>- <marker id="arrowhead-dashed" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" class="m-dashed" />- </marker>- <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">- <path d="M 40 0 L 0 0 0 40" class="c-grid" stroke-width="0.5"/>- </pattern>- </defs>+ function clearStoryTrail() {+ stopStoryBeatTimer();+ clearStoryPulse();+ clearStoryFollow();+ resetBeatLinkFeedback();+ storyBeatIndex = -1;+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = 0;+ storySteps = [];+ svg.removeAttribute('data-story-active');+ svg.removeAttribute('data-story-playing');+ svg.removeAttribute('data-story-beat');+ svg.removeAttribute('data-story-next');+ panel.removeAttribute('data-story-beat');+ panel.removeAttribute('data-story-next');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-overlay]'), function (overlay) {+ overlay.remove();+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-step], [data-story-beat-state]'), function (node) {+ node.removeAttribute('data-story-step');+ node.removeAttribute('data-story-beat-state');+ node.style.removeProperty('--story-step');+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-story-beat-step]'), function (edge) {+ edge.removeAttribute('data-story-beat-step');+ edge.removeAttribute('data-story-beat-state');+ });+ trail.textContent = '';+ trail.hidden = true;+ trail.removeAttribute('aria-label');+ renderStoryCaption(null, 0);+ syncBeatLink();+ }- <!-- Background Grid -->- <rect width="100%" height="100%" fill="url(#grid)" />+ function storyGeometry(edge) {+ if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }- <!-- Boundaries (behind everything) -->- <rect x="370" y="110" width="770" height="270" rx="12" class="c-region" stroke-width="1"/>- <text x="378" y="128" class="t-cloud" font-size="9" font-weight="600">archify/ skill package</text>+ function renderStoryTrail(view) {+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ clearStoryTrail();+ if (!view) return;- <!-- Connection paths (before components for correct z-order) -->- <path d="M 160 330 L 200 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 275 300 L 275 200" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>- <path d="M 350 330 L 400 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 470 300 L 470 200" class="a-security" stroke-width="1.5" marker-end="url(#arrowhead-security)"/>- <path d="M 540 330 L 590 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 730 330 L 780 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 920 330 L 970 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 1110 330 L 1160 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 660 360 L 660 440" class="a-dashed" stroke-width="1.5" marker-end="url(#arrowhead-dashed)"/>- <path d="M 1230 300 L 1230 200" class="a-dashed" stroke-width="1.5" marker-end="url(#arrowhead-dashed)"/>+ var nodeList = Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ var edgeList = Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ var byId = {};+ nodeList.forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ storySteps = view.focus.map(function (_, index) { return storyStep(view, index, edgeList, byId); });+ var labels = [];+ storySteps.forEach(function (step, index) {+ var id = step.nodeId;+ var node = byId[id];+ if (!node) return;+ node.setAttribute('data-story-step', String(index));+ node.style.setProperty('--story-step', String(index));+ var nodeLabel = step.nodeLabel;+ labels.push(nodeLabel);+ var stop = document.createElement('button');+ stop.type = 'button';+ stop.className = 'guided-view-stop';+ stop.setAttribute('data-story-node', id);+ stop.setAttribute('data-story-index', String(index));+ stop.setAttribute('data-story-relation', step.relation);+ stop.setAttribute('data-story-number', (index + 1 < 10 ? '0' : '') + (index + 1));+ if (index > 0) stop.setAttribute('data-story-link', step.relation);+ stop.style.setProperty('--story-step', String(index));+ stop.setAttribute('aria-label', storyBeatAria(step, storySteps.length));+ stop.title = storyBeatCopy(step, storySteps.length);+ stop.textContent = nodeLabel;+ trail.appendChild(stop);+ });+ trail.hidden = labels.length === 0;+ trail.setAttribute('aria-label', 'Story trail for ' + view.label + ': ' + labels.length + ' beats');+ trail.scrollLeft = 0;+ svg.setAttribute('data-story-active', view.id);- <!-- Components -->- <rect x="40" y="300" width="120" height="60" rx="6" class="c-mask"/>- <rect x="40" y="300" width="120" height="60" rx="6" class="c-external" stroke-width="1.5"/>- <text x="100" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">You</text>- <text x="100" y="344" class="t-muted" font-size="9" text-anchor="middle">NL or Mermaid</text>-- <rect x="200" y="300" width="150" height="60" rx="6" class="c-mask"/>- <rect x="200" y="300" width="150" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>- <text x="275" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Agent Hosts</text>- <text x="275" y="344" class="t-muted" font-size="9" text-anchor="middle">Claude · Codex · opencode</text>-- <rect x="200" y="140" width="150" height="60" rx="6" class="c-mask"/>- <rect x="200" y="140" width="150" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>- <text x="275" y="168" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">SKILL.md</text>- <text x="275" y="184" class="t-muted" font-size="9" text-anchor="middle">layout judgment</text>- <text x="275" y="192" class="t-frontend" font-size="7" text-anchor="middle">prompt dialect</text>-- <rect x="400" y="300" width="140" height="60" rx="6" class="c-mask"/>- <rect x="400" y="300" width="140" height="60" rx="6" class="c-messagebus" stroke-width="1.5"/>- <text x="470" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">JSON IR</text>- <text x="470" y="344" class="t-muted" font-size="9" text-anchor="middle">schema_version: 1</text>-- <rect x="400" y="140" width="140" height="60" rx="6" class="c-mask"/>- <rect x="400" y="140" width="140" height="60" rx="6" class="c-security" stroke-width="1.5"/>- <text x="470" y="168" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">JSON Schema</text>- <text x="470" y="184" class="t-muted" font-size="9" text-anchor="middle">ajv strict</text>- <text x="470" y="192" class="t-security" font-size="7" text-anchor="middle">fail-closed</text>-- <rect x="590" y="300" width="140" height="60" rx="6" class="c-mask"/>- <rect x="590" y="300" width="140" height="60" rx="6" class="c-backend" stroke-width="1.5"/>- <text x="660" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Renderers ×5</text>- <text x="660" y="344" class="t-muted" font-size="9" text-anchor="middle">layout checks</text>- <text x="660" y="352" class="t-backend" font-size="7" text-anchor="middle">no auto-layout</text>-- <rect x="780" y="300" width="140" height="60" rx="6" class="c-mask"/>- <rect x="780" y="300" width="140" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>- <text x="850" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">template.html</text>- <text x="850" y="344" class="t-muted" font-size="9" text-anchor="middle">theme + export</text>-- <rect x="970" y="300" width="140" height="60" rx="6" class="c-mask"/>- <rect x="970" y="300" width="140" height="60" rx="6" class="c-security" stroke-width="1.5"/>- <text x="1040" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Output Check</text>- <text x="1040" y="344" class="t-muted" font-size="9" text-anchor="middle">SVG gates</text>-- <rect x="1160" y="300" width="140" height="60" rx="6" class="c-mask"/>- <rect x="1160" y="300" width="140" height="60" rx="6" class="c-cloud" stroke-width="1.5"/>- <text x="1230" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">HTML Artifact</text>- <text x="1230" y="344" class="t-muted" font-size="9" text-anchor="middle">single file</text>-- <rect x="1160" y="140" width="140" height="60" rx="6" class="c-mask"/>- <rect x="1160" y="140" width="140" height="60" rx="6" class="c-cloud" stroke-width="1.5"/>- <text x="1230" y="168" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">archify.zip</text>- <text x="1230" y="184" class="t-muted" font-size="9" text-anchor="middle">skill package</text>-- <rect x="590" y="440" width="140" height="60" rx="6" class="c-mask"/>- <rect x="590" y="440" width="140" height="60" rx="6" class="c-backend" stroke-width="1.5"/>- <text x="660" y="468" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">CI Gates</text>- <text x="660" y="484" class="t-muted" font-size="9" text-anchor="middle">golden + zip</text>+ var overlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ overlay.setAttribute('class', 'story-trail-overlay');+ overlay.setAttribute('data-story-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ var copied = 0;+ storySteps.forEach(function (step) {+ step.edges.forEach(function (edge) {+ var edgeBeat = step.index;+ edge.setAttribute('data-story-beat-step', String(edgeBeat));+ var wrapper = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ storyGeometry(edge).forEach(function (shape) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('role');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.setAttribute('class', 'story-trail-flow');+ clone.setAttribute('data-story-beat-step', String(edgeBeat));+ clone.style.setProperty('--story-step', String(edgeBeat));+ wrapper.appendChild(clone);+ copied += 1;+ });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ });+ if (copied) {+ var firstEdge = edgeList[0];+ if (firstEdge && firstEdge.parentNode) firstEdge.parentNode.insertBefore(overlay, firstEdge);+ else svg.insertBefore(overlay, svg.firstChild);+ }+ }- <!-- Connection labels -->+ function syncStoryPlayback() {+ var shouldPlay = playing && activeIndex >= 0;+ if (shouldPlay && svg.getAttribute('data-story-playing') !== 'true') svg.setAttribute('data-story-playing', 'true');+ else if (!shouldPlay && svg.hasAttribute('data-story-playing')) svg.removeAttribute('data-story-playing');+ }++ function resetProgress(fraction) {+ fraction = Math.max(0, Math.min(1, Number(fraction) || 0));+ progressBar.style.animation = 'none';+ progressBar.style.setProperty('--guided-progress-start', String(fraction));+ progressBar.style.transform = 'scaleX(' + fraction + ')';+ }++ function startProgress(fraction, duration) {+ resetProgress(fraction);+ void progressBar.offsetWidth;+ progressBar.style.animation = 'archify-guided-progress ' + Math.max(1, duration || VIEW_INTERVAL_MS) + 'ms linear forwards';+ }++ function currentStoryProgress() {+ var total = storySteps.length;+ if (!total || storyBeatIndex < 0) return 0;+ var elapsed = storyBeatElapsedMs;+ if (playing && storyBeatTimer && storyBeatStartedAt) elapsed += Math.max(0, Date.now() - storyBeatStartedAt);+ var dwell = storyBeatDwellMs || storyBeatDwell(total);+ return Math.max(0, Math.min(1, (storyBeatIndex + Math.min(1, elapsed / dwell)) / total));+ }++ function renderPlayback() {+ var automaticPlaybackAllowed = storyAutomaticPlaybackAllowed();+ panel.setAttribute('data-playing', playing ? 'true' : 'false');+ syncStoryPlayback();+ play.disabled = !playing && !automaticPlaybackAllowed;+ play.setAttribute('aria-pressed', playing ? 'true' : 'false');+ play.setAttribute('aria-label', playing ? 'Pause guided story' : (!automaticPlaybackAllowed ? 'Story playback unavailable while motion is Still' : (storyPlaybackComplete ? 'Replay guided story' : 'Play guided story')));+ play.title = playing ? 'Pause guided story (P)' : (!automaticPlaybackAllowed ? 'Switch motion to Live to play the guided story' : (storyPlaybackComplete ? 'Replay guided story (P)' : 'Play guided story (P)'));+ playIcon.textContent = playing ? '\u2016' : '\u25b6';+ playLabel.textContent = playing ? 'Pause' : (storyPlaybackComplete ? 'Replay story' : 'Play story');+ if (storyCaption && !storyCaption.hidden) storyCaption.setAttribute('aria-live', playing ? 'off' : 'polite');+ }++ function render() {+ var view = views[activeIndex];+ count.textContent = activeIndex < 0 ? '0 / ' + views.length : (activeIndex + 1) + ' / ' + views.length;+ label.textContent = view ? view.label : 'Explore this system';+ note.setAttribute('aria-live', storyBeatIndex >= 0 ? 'off' : 'polite');+ note.textContent = storyBeatIndex >= 0+ ? storyBeatCopy(storySteps[storyBeatIndex], storySteps.length)+ : (view ? (view.note || view.focus.length + ' selected nodes') : 'Step through curated paths without changing the source diagram.');+ prev.disabled = activeIndex < 0;+ next.disabled = activeIndex >= views.length - 1;+ all.disabled = activeIndex < 0;+ panel.setAttribute('data-active-view', view ? view.id : 'all');+ syncChapterIndex();+ renderShareCue();+ renderPlayback();+ syncBeatLink();+ }++ function pausePlayback(options) {+ options = options || {};+ var progress = options.complete === true ? 1 : currentStoryProgress();+ if (panel.getAttribute('data-autoplay') === 'playing') {+ setShareCueProgress(progress);+ setAutoplayState(options.complete === true ? 'complete' : 'interrupted');+ }+ stopStoryBeatTimer({ preserveElapsed: options.complete !== true });+ clearStoryPulse();+ clearStoryFollow();+ playing = false;+ storyPlaybackComplete = options.complete === true;+ resetProgress(progress);+ renderPlayback();+ renderShareCue();+ }++ function finishStoryChapter() {+ if (!playing) return false;+ if (storyPlaybackScope === 'chapter') {+ pausePlayback({ complete: true });+ return true;+ }+ if (activeIndex < views.length - 1) {+ var destinationIndex = activeIndex + 1;+ activate(destinationIndex, { playback: true });+ afterHandoff(function () {+ if (!playing || activeIndex !== destinationIndex) return;+ storyBeatElapsedMs = 0;+ setStoryBeat(0, { pulse: true, follow: true });+ scheduleStoryPlayback();+ });+ return true;+ }+ pausePlayback({ complete: true });+ return true;+ }+ function scheduleStoryPlayback() {+ var total = storySteps.length;+ if (!playing || !total || reducedMotion()) {+ if (playing) pausePlayback();+ return false;+ }+ storyBeatDwellMs = storyBeatDwell(total);+ if (storyBeatIndex < 0) {+ storyBeatElapsedMs = 0;+ setStoryBeat(0, { pulse: true, follow: true });+ }+ storyBeatElapsedMs = Math.max(0, Math.min(storyBeatDwellMs, storyBeatElapsedMs));+ var remainingDwell = Math.max(1, storyBeatDwellMs - storyBeatElapsedMs);+ var progress = (storyBeatIndex + storyBeatElapsedMs / storyBeatDwellMs) / total;+ var remainingChapter = remainingDwell + Math.max(0, total - storyBeatIndex - 1) * storyBeatDwellMs;+ startProgress(progress, remainingChapter);+ if (panel.getAttribute('data-autoplay') === 'playing') startShareCueProgress(progress, remainingChapter);+ var generation = ++storyPlaybackGeneration;+ storyBeatStartedAt = Date.now();+ storyBeatTimer = setTimeout(function () {+ if (!playing || generation !== storyPlaybackGeneration) return;+ storyBeatTimer = null;+ storyBeatStartedAt = 0;+ storyBeatElapsedMs = 0;+ if (storyBeatIndex < total - 1) {+ setStoryBeat(storyBeatIndex + 1, { pulse: true, follow: true });+ scheduleStoryPlayback();+ } else finishStoryChapter();+ }, remainingDwell);+ return true;+ }- <rect x="350.8" y="310" width="48.4" height="14" rx="3" class="c-mask"/>- <text x="375" y="320" class="t-backend" font-size="8" text-anchor="middle">write IR</text>+ function startPlayback() {+ if (!storyAutomaticPlaybackAllowed()) {+ renderPlayback();+ return false;+ }+ autoplayPending = false;+ setAutoplayState(null);+ setShareCueProgress(0);+ document.documentElement.removeAttribute('data-share-playback');+ storyPlaybackScope = 'story';+ if (storyPlaybackComplete) showAll({ updateUrl: false });+ storyPlaybackComplete = false;+ if (activeIndex < 0) activate(0, { playback: true });+ playing = true;+ renderPlayback();+ afterHandoff(function () {+ if (!playing) return;+ if (storyBeatIndex >= 0) followStoryStep(storySteps[storyBeatIndex]);+ scheduleStoryPlayback();+ });+ return true;+ }+ function startCurrentViewPlayback() {+ if (document.hidden) return false;+ autoplayPending = false;+ document.documentElement.setAttribute('data-share-playback', 'true');+ storyPlaybackScope = 'chapter';+ storyPlaybackComplete = false;+ if (activeIndex < 0) activate(0, { playback: true, updateUrl: false });+ if (!storyAutomaticPlaybackAllowed()) {+ var preserveMoment = hashBeatMatchesCurrent();+ setShareCueProgress(preserveMoment && storySteps.length ? (storyBeatIndex + 1) / storySteps.length : 1);+ setAutoplayState('reduced-motion');+ playing = false;+ if (preserveMoment) {+ clearStoryPulse();+ renderShareCue();+ } else settleStoryBeats();+ renderPlayback();+ return false;+ }+ playing = true;+ setAutoplayState('playing');+ renderPlayback();+ afterHandoff(function () {+ if (!playing) return;+ if (storyBeatIndex >= 0) followStoryStep(storySteps[storyBeatIndex]);+ scheduleStoryPlayback();+ });+ return true;+ }+ function maybeStartSharePlayback() {+ if (!autoplayPending || document.hidden) return false;+ return startCurrentViewPlayback();+ }+ function togglePlayback() {+ return playing ? (pausePlayback(), false) : startPlayback();+ }- <rect x="1113.2" y="310" width="43.6" height="14" rx="3" class="c-mask"/>- <text x="1135" y="320" class="t-backend" font-size="8" text-anchor="middle">deliver</text>+ function syncStoryControlsDisabled() {+ Array.prototype.forEach.call(trail.querySelectorAll('[data-story-node]'), function (stop) {+ stop.disabled = !!currentHandoff;+ });+ syncBeatLink();+ }+ function selectStoryBeat(index) {+ if (currentHandoff || activeIndex < 0 || index < 0 || index >= storySteps.length) return false;+ momentRestoreGeneration += 1;+ clearChapterPreview({ clearIntents: true });+ if (playing) pausePlayback();+ else {+ stopStoryBeatTimer();+ clearStoryPulse();+ }+ storyPlaybackComplete = false;+ storyPlaybackScope = 'story';+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = storyBeatDwell(storySteps.length);+ var view = views[activeIndex];+ Archify.focus.setMany(view.focus, {+ toggle: false,+ updateUrl: false,+ mode: 'selection',+ label: view.label,+ hideChip: true+ });+ setStoryBeat(index, { manual: true, center: true, pulse: true, follow: true });+ resetProgress(index / storySteps.length);+ renderPlayback();+ return true;+ }+ function selectStoryBeatById(id, options) {+ options = options || {};+ var index = storySteps.findIndex(function (step) { return step.nodeId === id; });+ if (index < 0) return false;+ if (playing) pausePlayback();+ else {+ stopStoryBeatTimer();+ clearStoryPulse();+ }+ storyPlaybackComplete = false;+ storyPlaybackScope = 'story';+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = storyBeatDwell(storySteps.length);+ setStoryBeat(index, {+ manual: false,+ center: true,+ pulse: false,+ follow: options.follow === true,+ linked: options.linked === true,+ followInstant: options.followInstant === true+ });+ resetProgress(index / storySteps.length);+ renderPlayback();+ return true;+ }- <!-- Legend -->- <text x="40" y="539" class="t-primary" font-size="9" font-weight="600">Legend</text>- <rect x="40" y="544" width="14" height="9" rx="2" class="c-external" stroke-width="1"/>- <text x="60" y="552" class="t-muted" font-size="8">External</text>- <rect x="138" y="544" width="14" height="9" rx="2" class="c-frontend" stroke-width="1"/>- <text x="158" y="552" class="t-muted" font-size="8">Frontend</text>- <rect x="236" y="544" width="14" height="9" rx="2" class="c-messagebus" stroke-width="1"/>- <text x="256" y="552" class="t-muted" font-size="8">Message bus</text>- <rect x="349" y="544" width="14" height="9" rx="2" class="c-security" stroke-width="1"/>- <text x="369" y="552" class="t-muted" font-size="8">Security</text>- <rect x="447" y="544" width="14" height="9" rx="2" class="c-backend" stroke-width="1"/>- <text x="467" y="552" class="t-muted" font-size="8">Backend</text>- <rect x="540" y="544" width="14" height="9" rx="2" class="c-cloud" stroke-width="1"/>- <text x="560" y="552" class="t-muted" font-size="8">Cloud</text>- </svg>- </div>+ function updateUrl(view) {+ try {+ history.replaceState(null, '', location.pathname + location.search + (view ? '#view=' + encodeURIComponent(view.id) : ''));+ } catch (_) {}+ }- <!-- Info Cards -->- <div class="cards">- <div class="card">- <div class="card-header">- <div class="card-dot cyan"></div>- <h3>Agent loop</h3>- </div>- <ul>- <li>• Claude / Codex / opencode load the skill</li>- <li>• SKILL.md teaches layout judgment, not auto-layout</li>- <li>• Mermaid is an input dialect via prompt, not a parser</li>- </ul>- </div>+ function showAll(options) {+ options = options || {};+ if (options.restore !== true) momentRestoreGeneration += 1;+ clearChapterPreview({ clearIntents: true });+ if (playing && options.playback !== true) pausePlayback();+ if (options.playback !== true) storyPlaybackComplete = false;+ cancelHandoff('overview');+ activeIndex = -1;+ renderStoryTrail(null);+ if (options.clearFocus !== false) Archify.focus.clear({ updateUrl: false });+ if (options.resetView !== false && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ render();+ if (options.updateUrl !== false) updateUrl(null);+ }- <div class="card">- <div class="card-header">- <div class="card-dot emerald"></div>- <h3>Render path</h3>- </div>- <ul>- <li>• JSON IR pins schema_version: 1</li>- <li>• Five typed renderers: architecture / workflow / sequence / dataflow / lifecycle</li>- <li>• template.html owns theme toggle and 4× export</li>- </ul>- </div>+ function activate(index, options) {+ options = options || {};+ if (options.restore !== true) momentRestoreGeneration += 1;+ if (playing && options.playback !== true) pausePlayback();+ if (options.playback !== true) storyPlaybackComplete = false;+ if (index < 0) { showAll(options); return true; }+ if (index >= views.length) return false;+ clearChapterPreview({ clearIntents: true });+ var previousIndex = activeIndex;+ var previous = previousIndex >= 0 ? views[previousIndex] : null;+ var outgoingBeatIndex = storyBeatIndex;+ cancelHandoff('replaced');+ activeIndex = index;+ var view = views[index];+ Archify.focus.setMany(view.focus, {+ toggle: false,+ updateUrl: false,+ mode: 'selection',+ label: view.label,+ hideChip: true+ });+ renderStoryTrail(view);+ beginHandoff(previousIndex, index, previous, view, outgoingBeatIndex, options.playback === true ? 'playback' : 'guided');+ syncStoryControlsDisabled();+ render();+ if (options.updateUrl !== false) updateUrl(view);+ return true;+ }++ function activateById(id, options) {+ var index = views.findIndex(function (view) { return view.id === id; });+ return index >= 0 && activate(index, options);+ }++ prev.addEventListener('click', function () { activate(activeIndex - 1); });+ next.addEventListener('click', function () { activate(activeIndex + 1); });+ all.addEventListener('click', function () { showAll(); });+ play.addEventListener('click', togglePlayback);+ beatLink.addEventListener('click', copyStoryMomentLink);+ trail.addEventListener('focusin', function (event) {+ if (!event.target.closest('[data-story-node]')) return;+ if (playing) pausePlayback();+ });+ trail.addEventListener('click', function (event) {+ var stop = event.target.closest('[data-story-node]');+ if (!stop || stop.disabled) return;+ selectStoryBeat(Number(stop.getAttribute('data-story-index')));+ });+ trail.addEventListener('keydown', function (event) {+ if (event.key !== 'Enter' && event.key !== ' ') return;+ var stop = event.target.closest('[data-story-node]');+ if (!stop || stop.disabled) return;+ event.preventDefault();+ selectStoryBeat(Number(stop.getAttribute('data-story-index')));+ });+ chapterList.addEventListener('click', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button) return;+ activateById(button.getAttribute('data-guided-view-id'));+ });+ chapterList.addEventListener('pointerover', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button || !hoverCapable() || event.pointerType === 'touch') return;+ if (event.relatedTarget && button.contains(event.relatedTarget)) return;+ setChapterPreviewIntent('pointer', chapterButtons.indexOf(button));+ });+ chapterList.addEventListener('pointerout', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ clearChapterPreviewIntent('pointer', chapterButtons.indexOf(button));+ });+ chapterIndex.addEventListener('focusin', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button) return;+ setChapterPreviewIntent('focus', chapterButtons.indexOf(button));+ });+ chapterIndex.addEventListener('focusout', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ clearChapterPreviewIntent('focus', chapterButtons.indexOf(button));+ });+ chapterList.addEventListener('keydown', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ var index = chapterButtons.indexOf(button);+ if (index < 0) return;+ var target = null;+ if (event.key === 'ArrowRight') target = Math.min(chapterButtons.length - 1, index + 1);+ else if (event.key === 'ArrowLeft') target = Math.max(0, index - 1);+ else if (event.key === 'Home') target = 0;+ else if (event.key === 'End') target = chapterButtons.length - 1;+ if (target === null) return;+ event.preventDefault();+ focusChapterButton(target);+ });++ // A direct node exploration supersedes the curated view. Capture phase+ // releases the view before the focus explorer writes its own deep link.+ function releaseForNode(event) {+ if (activeIndex >= 0 && event.target.closest('[data-node-id]')) {+ pausePlayback();+ showAll({ clearFocus: false, updateUrl: false });+ }+ }+ svg.addEventListener('click', releaseForNode, true);+ svg.addEventListener('keydown', function (event) {+ if (event.key === 'Enter' || event.key === ' ') releaseForNode(event);+ }, true);++ document.addEventListener('keydown', function (event) {+ if (event.metaKey || event.ctrlKey || event.altKey) return;+ if (document.documentElement.getAttribute('data-guide-open') === 'true') return;+ var target = event.target;+ if (target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable)) return;+ if (event.key === ']') {+ event.preventDefault();+ if (activeIndex < views.length - 1) activate(activeIndex + 1);+ } else if (event.key === '[') {+ event.preventDefault();+ if (activeIndex >= 0) activate(activeIndex - 1);+ } else if (event.key.toLowerCase() === 'p') {+ event.preventDefault();+ togglePlayback();+ } else if (event.key === 'Escape' && activePreviewIndex >= 0) {+ event.preventDefault();+ event.stopImmediatePropagation();+ clearChapterPreview({ clearIntents: true });+ } else if (event.key === 'Escape' && activeIndex >= 0) {+ event.preventDefault();+ showAll();+ }+ }, true);++ function syncViewFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var initial = params.get('view');+ var requestedBeat = params.get('beat');+ var restoreGeneration = ++momentRestoreGeneration;+ if (initial) {+ var activated = activateById(initial, { updateUrl: false, restore: true });+ if (!activated) {+ showAll({ updateUrl: false, restore: true });+ return;+ }+ if (requestedBeat) afterHandoff(function () {+ if (restoreGeneration !== momentRestoreGeneration) return;+ var latest = new URLSearchParams(location.hash.replace(/^#/, ''));+ if (latest.get('view') !== initial || latest.get('beat') !== requestedBeat) return;+ if (activeIndex < 0 || views[activeIndex].id !== initial) return;+ selectStoryBeatById(requestedBeat, { linked: true, follow: true, followInstant: true });+ });+ } else if (params.get('focus') || params.get('relation')) {+ activeIndex = -1;+ render();+ } else {+ showAll({ updateUrl: false, restore: true });+ }+ } catch (_) { showAll({ updateUrl: false, restore: true }); }+ }++ window.addEventListener('hashchange', syncViewFromHash);+ document.addEventListener('visibilitychange', function () {+ if (document.hidden) {+ clearChapterPreview({ clearIntents: true });+ if (playing) pausePlayback();+ else clearStoryPulse();+ settleHandoff('hidden');+ }+ else if (!document.hidden) maybeStartSharePlayback();+ });+ if (window.matchMedia) {+ var guidedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');+ var onGuidedMotionChange = function () {+ if (guidedMotionQuery.matches) {+ if (playing) pausePlayback();+ else clearStoryPulse();+ settleHandoff('reduced-motion');+ }+ };+ if (typeof guidedMotionQuery.addEventListener === 'function') guidedMotionQuery.addEventListener('change', onGuidedMotionChange);+ else if (typeof guidedMotionQuery.addListener === 'function') guidedMotionQuery.addListener(onGuidedMotionChange);+ }+ if (document.documentElement.getAttribute('data-embed') !== 'true' && typeof MutationObserver !== 'undefined' && typeof Node !== 'undefined' && svg instanceof Node && document.documentElement instanceof Node) {+ var chapterPreviewOwnerObserver = new MutationObserver(syncChapterPreview);+ chapterPreviewOwnerObserver.observe(svg, {+ attributes: true,+ attributeFilter: [+ 'data-route-picking', 'data-route-active', 'data-lens-active',+ 'data-legend-preview-active', 'data-relationship-preview-active',+ 'data-intent-trace-active', 'data-focus-active'+ ]+ });+ var storyMotionObserver = new MutationObserver(function () {+ if (document.documentElement.getAttribute('data-motion') !== 'live') clearStoryPulse();+ renderPlayback();+ });+ storyMotionObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['data-motion'] });+ }+ window.addEventListener('beforeprint', function () {+ clearChapterPreview({ clearIntents: true });+ if (playing) pausePlayback();+ else clearStoryPulse();+ settleHandoff('print');+ });+ syncViewFromHash();+ if (autoplayPending) {+ requestAnimationFrame(function () {+ requestAnimationFrame(maybeStartSharePlayback);+ });+ }++ return {+ count: views.length,+ activate: activateById,+ showAll: showAll,+ play: startPlayback,+ playCurrent: startCurrentViewPlayback,+ pause: pausePlayback,+ beatLink: storyMomentLink,+ copyBeatLink: copyStoryMomentLink,+ cancelHandoff: cancelHandoff,+ settleHandoff: settleHandoff,+ clearPreview: function () { return clearChapterPreview({ clearIntents: true }); },+ isPlaying: function () { return playing; },+ handoff: function () {+ return currentHandoff ? { id: currentHandoff.id, mode: currentHandoff.mode, anchor: currentHandoff.anchor || null } : null;+ },+ active: function () { return activeIndex < 0 ? null : views[activeIndex].id; },+ preview: function () { return activePreviewIndex < 0 ? null : views[activePreviewIndex].id; },+ delta: function (id) {+ var index = views.findIndex(function (view) { return view.id === id; });+ if (index < 0) return null;+ var value = chapterDelta(activeIndex >= 0 ? views[activeIndex] : null, views[index]);+ return { stay: value.stay.slice(), enter: value.enter.slice(), leave: value.leave.slice() };+ },+ beat: function () {+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ return step ? {+ index: step.index,+ position: step.index + 1,+ total: storySteps.length,+ nodeId: step.nodeId,+ relation: step.relation,+ edgeKeys: step.edgeKeys.slice()+ } : null;+ },+ focus: function () { return activeIndex < 0 ? [] : views[activeIndex].focus.slice(); }+ };+ })();++ Archify.view = (function () {+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector('svg');+ var outBtn = container.querySelector('[data-view="out"]');+ var resetBtn = container.querySelector('[data-view="reset"]');+ var inBtn = container.querySelector('[data-view="in"]');+ var state = { scale: 1, x: 0, y: 0, mode: 'overview' };+ var drag = null;+ var cameraTimer = null;+ var cameraFrame = null;+ var cameraGeneration = 0;+ var cameraTransaction = null;+ var resizeFrame = 0;+ var autoScrollUntil = 0;++ var viewBox = svg.viewBox && svg.viewBox.baseVal;+ if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {+ container.setAttribute('data-wide-diagram', 'true');+ }++ function clamp() {+ var width = svg.clientWidth || 1;+ var height = svg.clientHeight || 1;+ state.x = Math.min(0, Math.max(width - width * state.scale, state.x));+ state.y = Math.min(0, Math.max(height - height * state.scale, state.y));+ }+ function reducedMotion() {+ return window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;+ }+ function contentMetrics() {+ if (!viewBox || viewBox.width <= 0 || viewBox.height <= 0) return null;+ var width = svg.clientWidth || 1;+ var height = svg.clientHeight || 1;+ var scale = Math.min(width / viewBox.width, height / viewBox.height);+ return {+ width: width,+ height: height,+ scale: scale,+ offsetX: (width - viewBox.width * scale) / 2,+ offsetY: (height - viewBox.height * scale) / 2+ };+ }+ function logicalViewport() {+ var metrics = contentMetrics();+ if (!metrics) return null;+ var x;+ var y;+ var width;+ var height;+ if (window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram')) {+ x = viewBox.x + container.scrollLeft / metrics.scale;+ y = viewBox.y;+ width = Math.min(viewBox.width, Math.max(1, container.clientWidth / metrics.scale));+ height = viewBox.height;+ } else {+ x = viewBox.x + ((-state.x / state.scale) - metrics.offsetX) / metrics.scale;+ y = viewBox.y + ((-state.y / state.scale) - metrics.offsetY) / metrics.scale;+ width = Math.min(viewBox.width, metrics.width / state.scale / metrics.scale);+ height = Math.min(viewBox.height, metrics.height / state.scale / metrics.scale);+ }+ width = Math.max(1, Math.min(viewBox.width, width));+ height = Math.max(1, Math.min(viewBox.height, height));+ x = Math.max(viewBox.x, Math.min(viewBox.x + viewBox.width - width, x));+ y = Math.max(viewBox.y, Math.min(viewBox.y + viewBox.height - height, y));+ return { x: x, y: y, width: width, height: height, scale: state.scale };+ }+ function detailLevel() {+ if (state.mode === 'semantic') return 'full';+ if (state.scale >= 1.75) return 'full';+ if (state.scale >= 1.25) return 'read';+ return 'map';+ }+ function renderControls() {+ var semantic = state.mode === 'semantic' && state.scale > 1.01;+ var detail = detailLevel();+ var percent = Math.round(state.scale * 100) + '%';+ var levelLabel = detail === 'map' ? 'MAP ' : detail === 'read' ? 'READ ' : 'FULL ';+ var detailHint = detail === 'map'+ ? 'Zoom in to reveal relationship labels and node context'+ : detail === 'read'+ ? 'Zoom in again to reveal tags and annotations'+ : 'Full diagram detail';+ resetBtn.textContent = (semantic ? 'AUTO ' : levelLabel) + percent;+ resetBtn.title = (semantic ? 'Semantic camera active · ' : '') + detailHint + ' · reset view (0)';+ resetBtn.setAttribute('aria-label', detailHint + '. Reset diagram view');+ resetBtn.setAttribute('data-detail-level', detail);+ container.setAttribute('data-detail-level', detail);+ container.setAttribute('data-camera-mode', state.mode);+ container.setAttribute('data-camera-indicator', semantic ? 'true' : 'false');+ }+ function apply() {+ clamp();+ svg.style.transform = 'translate(' + state.x + 'px,' + state.y + 'px) scale(' + state.scale + ')';+ renderControls();+ outBtn.disabled = state.scale <= 1;+ inBtn.disabled = state.scale >= 3;+ container.classList.toggle('is-pannable', state.scale > 1);+ svg.setAttribute('data-view-scale', String(state.scale));+ if (Archify.radar && typeof Archify.radar.sync === 'function') Archify.radar.sync();+ }+ function sampleRenderedState() {+ var transform = '';+ try { transform = getComputedStyle(svg).transform || ''; } catch (_) {}+ var match = transform.match(/^matrix\(([^)]+)\)$/);+ if (!match) return { scale: state.scale, x: state.x, y: state.y, mode: state.mode };+ var values = match[1].split(',').map(Number);+ if (values.length !== 6 || !values.every(Number.isFinite)) {+ return { scale: state.scale, x: state.x, y: state.y, mode: state.mode };+ }+ return { scale: values[0], x: values[4], y: values[5], mode: state.mode };+ }+ function finishCameraTransaction(transaction, outcome) {+ if (!transaction || transaction.settled) return false;+ transaction.settled = true;+ transaction.state = outcome || 'complete';+ if (transaction.frame) cancelAnimationFrame(transaction.frame);+ if (transaction.timer) clearTimeout(transaction.timer);+ transaction.frame = null;+ transaction.timer = null;+ if (cameraTransaction === transaction) cameraTransaction = null;+ cameraFrame = null;+ cameraTimer = null;+ container.classList.remove('is-camera-moving');+ container.classList.remove('is-camera-transaction');+ container.removeAttribute('data-camera-transaction');+ if (Archify.focus && Archify.focus.reposition) Archify.focus.reposition();+ transaction.resolve({ id: transaction.id, state: transaction.state });+ return true;+ }+ function cameraReceipt(target, options) {+ var resolver;+ var transaction = {+ id: ++cameraGeneration,+ state: 'running',+ target: target,+ settled: false,+ frame: null,+ timer: null,+ finished: new Promise(function (resolve) { resolver = resolve; }),+ resolve: resolver,+ cancel: function (reason, commitTarget) {+ if (transaction.settled) return false;+ if (commitTarget && transaction.target) {+ if (Object.prototype.hasOwnProperty.call(transaction.target, 'scrollLeft')) {+ container.scrollLeft = transaction.target.scrollLeft;+ } else {+ state = {+ scale: transaction.target.scale,+ x: transaction.target.x,+ y: transaction.target.y,+ mode: transaction.target.mode+ };+ apply();+ }+ }+ return finishCameraTransaction(transaction, reason || 'cancelled');+ }+ };+ return transaction;+ }+ function stopCameraMotion(reason, commitTarget) {+ if (cameraTransaction && !cameraTransaction.settled) {+ cameraTransaction.cancel(reason || 'cancelled', commitTarget === true);+ return;+ }+ if (cameraTimer) clearTimeout(cameraTimer);+ if (cameraFrame) cancelAnimationFrame(cameraFrame);+ cameraTimer = null;+ cameraFrame = null;+ container.classList.remove('is-camera-moving');+ container.classList.remove('is-camera-transaction');+ container.removeAttribute('data-camera-transaction');+ }+ function interruptCamera(reason) {+ if (Archify.guidedViews && Archify.guidedViews.cancelHandoff) {+ Archify.guidedViews.cancelHandoff(reason || 'manual');+ }+ var rendered = sampleRenderedState();+ stopCameraMotion(reason || 'manual', false);+ state = rendered;+ state.mode = 'manual';+ apply();+ renderControls();+ if (Archify.guidedViews && Archify.guidedViews.isPlaying && Archify.guidedViews.isPlaying()) {+ Archify.guidedViews.pause();+ }+ if (Archify.routeProbe && Archify.routeProbe.isJourneyPlaying && Archify.routeProbe.isJourneyPlaying()) {+ Archify.routeProbe.pauseJourney({ preserveElapsed: true, reason: reason || 'manual' });+ }+ }+ function zoom(next, options) {+ options = options || {};+ if (options.manual !== false) interruptCamera();+ var previous = state.scale;+ next = Math.max(1, Math.min(3, Math.round(next * 4) / 4));+ if (next === previous) return;+ var centerX = (svg.clientWidth || 1) / 2;+ var centerY = (svg.clientHeight || 1) / 2;+ var contentX = (centerX - state.x) / previous;+ var contentY = (centerY - state.y) / previous;+ state.scale = next;+ state.x = centerX - contentX * next;+ state.y = centerY - contentY * next;+ apply();+ }+ function reset(options) {+ options = options || {};+ if (options.automatic !== true) interruptCamera();+ else stopCameraMotion('reset', false);+ state = { scale: 1, x: 0, y: 0, mode: 'overview' };+ apply();+ }+ function centerAt(logicalX, logicalY, options) {+ options = options || {};+ logicalX = Number(logicalX);+ logicalY = Number(logicalY);+ var metrics = contentMetrics();+ if (!metrics || !Number.isFinite(logicalX) || !Number.isFinite(logicalY)) return false;+ interruptCamera();+ if (window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram')) {+ state.scale = 1;+ state.x = 0;+ state.y = 0;+ state.mode = 'manual';+ apply();+ var mobileTarget = (logicalX - viewBox.x) * metrics.scale - container.clientWidth / 2;+ mobileTarget = Math.max(0, Math.min(svg.clientWidth - container.clientWidth, mobileTarget));+ autoScrollUntil = Date.now() + 80;+ try { container.scrollTo({ left: mobileTarget, behavior: options.instant ? 'auto' : 'smooth' }); }+ catch (_) { container.scrollLeft = mobileTarget; }+ return true;+ }+ var minimumScale = Math.max(1, Math.min(3, Number(options.minimumScale) || 1));+ var requestedScale = Number(options.scale);+ state.scale = Math.max(minimumScale, Math.min(3, Number.isFinite(requestedScale) ? requestedScale : state.scale));+ var contentX = metrics.offsetX + (logicalX - viewBox.x) * metrics.scale;+ var contentY = metrics.offsetY + (logicalY - viewBox.y) * metrics.scale;+ state.x = metrics.width / 2 - contentX * state.scale;+ state.y = metrics.height / 2 - contentY * state.scale;+ state.mode = 'manual';+ apply();+ if (Archify.focus && Archify.focus.reposition) Archify.focus.reposition();+ return true;+ }+ function semanticIds(ids, includeNeighbors) {+ var seeds = {};+ var wanted = {};+ (ids || []).forEach(function (id) { seeds[id] = true; wanted[id] = true; });+ if (includeNeighbors) {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (seeds[from] || seeds[to]) { wanted[from] = true; wanted[to] = true; }+ });+ }+ return wanted;+ }+ function boxesFor(ids, includeNeighbors) {+ var wanted = semanticIds(ids, includeNeighbors);+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'))+ .filter(function (node) { return wanted[node.getAttribute('data-node-id')]; })+ .map(function (node) {+ try { return node.getBBox(); } catch (_) { return null; }+ })+ .filter(Boolean);+ }+ function frameDesktop(ids, options) {+ options = options || {};+ var boxes = boxesFor(ids, options.includeNeighbors === true);+ if (!boxes.length || !viewBox || viewBox.width <= 0 || viewBox.height <= 0) return false;+ var svgWidth = svg.clientWidth || 1;+ var svgHeight = svg.clientHeight || 1;+ var contentScale = Math.min(svgWidth / viewBox.width, svgHeight / viewBox.height);+ var contentOffsetX = (svgWidth - viewBox.width * contentScale) / 2;+ var contentOffsetY = (svgHeight - viewBox.height * contentScale) / 2;+ var minX = Math.min.apply(Math, boxes.map(function (box) { return box.x; }));+ var minY = Math.min.apply(Math, boxes.map(function (box) { return box.y; }));+ var maxX = Math.max.apply(Math, boxes.map(function (box) { return box.x + box.width; }));+ var maxY = Math.max.apply(Math, boxes.map(function (box) { return box.y + box.height; }));+ var bounds = {+ x: contentOffsetX + minX * contentScale,+ y: contentOffsetY + minY * contentScale,+ width: Math.max(1, (maxX - minX) * contentScale),+ height: Math.max(1, (maxY - minY) * contentScale)+ };+ var padding = options.padding || 48;+ var left = padding;+ var right = svgWidth - padding;+ var top = padding;+ var bottom = svgHeight - Math.max(padding, 72);+ var containerRect = container.getBoundingClientRect();+ var visibleTop = Math.max(0, -containerRect.top);+ var visibleBottom = Math.min(svgHeight, window.innerHeight - containerRect.top);+ if (visibleBottom - visibleTop >= 240) {+ top = Math.max(top, visibleTop + padding);+ bottom = Math.min(bottom, visibleBottom - Math.max(padding, 72));+ }+ var chip = document.getElementById('focus-chip');+ if (chip && !chip.hidden) {+ var lensEnd = chip.offsetLeft + chip.offsetWidth + 24 - (svg.offsetLeft || 0);+ left = Math.max(left, Math.min(svgWidth * 0.42, lensEnd));+ }+ var routeReceipt = document.getElementById('route-probe');+ if (routeReceipt && !routeReceipt.hidden && routeReceipt.hasAttribute('data-route-journey')) {+ var receiptTop = routeReceipt.offsetTop;+ var receiptBottom = receiptTop + routeReceipt.offsetHeight;+ if (receiptTop < svgHeight / 2) top = Math.max(top, receiptBottom + 24);+ else bottom = Math.min(bottom, receiptTop - 24);+ }+ if (right <= left || bottom <= top) return false;+ var maxScale = options.maxScale || (options.includeNeighbors ? 1.9 : 2.15);+ var targetScale = Math.min((right - left) / bounds.width, (bottom - top) / bounds.height) * 0.9;+ targetScale = Math.max(1, Math.min(maxScale, targetScale));+ if (targetScale < 1.08) targetScale = 1;+ var target = {+ scale: Math.round(targetScale * 100) / 100,+ x: 0,+ y: 0,+ mode: 'semantic'+ };+ target.x = (left + right) / 2 - (bounds.x + bounds.width / 2) * target.scale;+ target.y = (top + bottom) / 2 - (bounds.y + bounds.height / 2) * target.scale;+ var start = sampleRenderedState();+ stopCameraMotion('replaced', false);+ var transaction = cameraReceipt(target, options);+ cameraTransaction = transaction;+ var instant = options.instant === true || reducedMotion() || document.hidden;+ if (instant) {+ state = target;+ apply();+ finishCameraTransaction(transaction, reducedMotion() ? 'reduced-motion' : (document.hidden ? 'hidden' : 'complete'));+ return transaction;+ }+ var duration = Math.max(180, Math.min(520, Number(options.duration) || 420));+ var startedAt = 0;+ state = start;+ state.mode = 'semantic';+ apply();+ container.classList.add('is-camera-moving');+ container.classList.add('is-camera-transaction');+ container.setAttribute('data-camera-transaction', String(transaction.id));+ var step = function (timestamp) {+ if (cameraTransaction !== transaction || transaction.settled) return;+ if (!startedAt) startedAt = timestamp;+ var fraction = Math.max(0, Math.min(1, (timestamp - startedAt) / duration));+ var eased = 1 - Math.pow(1 - fraction, 3);+ state = {+ scale: start.scale + (target.scale - start.scale) * eased,+ x: start.x + (target.x - start.x) * eased,+ y: start.y + (target.y - start.y) * eased,+ mode: 'semantic'+ };+ apply();+ if (fraction < 1) {+ transaction.frame = requestAnimationFrame(step);+ cameraFrame = transaction.frame;+ } else {+ state = target;+ apply();+ finishCameraTransaction(transaction, 'complete');+ }+ };+ transaction.frame = requestAnimationFrame(step);+ cameraFrame = transaction.frame;+ return transaction;+ }+ function reveal(ids, options) {+ options = options || {};+ if (window.innerWidth > 720) return frameDesktop(ids, options);+ stopCameraMotion('replaced', false);+ state.scale = 1;+ state.x = 0;+ state.y = 0;+ state.mode = 'semantic';+ apply();+ if (!container.hasAttribute('data-wide-diagram')) {+ var contained = cameraReceipt({ scale: 1, x: 0, y: 0, mode: 'semantic' }, options);+ cameraTransaction = contained;+ finishCameraTransaction(contained, 'complete');+ return contained;+ }+ var boxes = boxesFor(ids, options.includeNeighbors === true);+ if (!boxes.length || !viewBox || viewBox.width <= 0) return false;+ var minX = Math.min.apply(Math, boxes.map(function (box) { return box.x; }));+ var maxX = Math.max.apply(Math, boxes.map(function (box) { return box.x + box.width; }));+ var center = ((minX + maxX) / 2 / viewBox.width) * (svg.clientWidth || 1);+ var target = Math.max(0, Math.min(svg.clientWidth - container.clientWidth, center - container.clientWidth / 2));+ var transaction = cameraReceipt({ scrollLeft: target }, options);+ cameraTransaction = transaction;+ var instant = options.instant === true || reducedMotion() || document.hidden;+ autoScrollUntil = Date.now() + (instant ? 50 : 470);+ try { container.scrollTo({ left: target, behavior: instant ? 'auto' : 'smooth' }); }+ catch (_) { container.scrollLeft = target; }+ if (instant) finishCameraTransaction(transaction, reducedMotion() ? 'reduced-motion' : (document.hidden ? 'hidden' : 'complete'));+ else {+ transaction.timer = setTimeout(function () { finishCameraTransaction(transaction, 'complete'); }, 460);+ cameraTimer = transaction.timer;+ container.classList.add('is-camera-moving');+ container.setAttribute('data-camera-transaction', String(transaction.id));+ }+ return transaction;+ }+ function syncSemantic() {+ var guided = Archify.guidedViews && typeof Archify.guidedViews.focus === 'function'+ ? Archify.guidedViews.focus() : [];+ if (guided && guided.length) return reveal(guided, { reason: 'guided-sync' });+ var active = Archify.focus && typeof Archify.focus.active === 'function' ? Archify.focus.active() : null;+ if (typeof active === 'string') return reveal([active], { includeNeighbors: true, reason: 'focus-sync' });+ if (Array.isArray(active) && active.length) return reveal(active, { reason: 'selection-sync' });+ return false;+ }+ function pinControls() {+ container.style.setProperty('--archify-scroll-x', container.scrollLeft + 'px');+ }+ function onScroll() {+ pinControls();+ if (Archify.radar && typeof Archify.radar.sync === 'function') Archify.radar.sync();+ if (window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram') && Date.now() > autoScrollUntil) {+ interruptCamera();+ }+ }+ function onPointerEnd(event) {+ if (!drag) return;+ var moved = drag.moved;+ drag = null;+ container.classList.remove('is-panning');+ try { container.releasePointerCapture(event.pointerId); } catch (_) {}+ if (moved) {+ container.setAttribute('data-just-panned', 'true');+ setTimeout(function () { container.removeAttribute('data-just-panned'); }, 80);+ }+ }++ inBtn.addEventListener('click', function () { zoom(state.scale + 0.25); });+ outBtn.addEventListener('click', function () { zoom(state.scale - 0.25); });+ resetBtn.addEventListener('click', reset);+ container.addEventListener('pointerdown', function (event) {+ if (state.scale <= 1 || event.button !== 0 || event.target.closest('.diagram-nav, .focus-chip, .node-finder, .diagram-guide, .overview-map, .route-probe, .semantic-lens') || event.target.closest('[data-node-id]') || event.target.closest('[data-relationship-hit-key]')) return;+ interruptCamera();+ drag = { startX: event.clientX, startY: event.clientY, x: state.x, y: state.y, moved: false };+ container.classList.add('is-panning');+ try { container.setPointerCapture(event.pointerId); } catch (_) {}+ });+ container.addEventListener('pointermove', function (event) {+ if (!drag) return;+ var dx = event.clientX - drag.startX;+ var dy = event.clientY - drag.startY;+ if (Math.abs(dx) + Math.abs(dy) > 3) drag.moved = true;+ state.x = drag.x + dx;+ state.y = drag.y + dy;+ apply();+ });+ container.addEventListener('pointerup', onPointerEnd);+ container.addEventListener('pointercancel', onPointerEnd);+ container.addEventListener('scroll', onScroll, { passive: true });+ window.addEventListener('resize', function () {+ if (resizeFrame) cancelAnimationFrame(resizeFrame);+ resizeFrame = requestAnimationFrame(function () {+ resizeFrame = 0;+ if (state.mode === 'semantic') syncSemantic();+ else apply();+ });+ });+ window.addEventListener('hashchange', function () { requestAnimationFrame(syncSemantic); });+ apply();+ pinControls();+ requestAnimationFrame(syncSemantic);++ return {+ zoomIn: function () { zoom(state.scale + 0.25); },+ zoomOut: function () { zoom(state.scale - 0.25); },+ reset: reset,+ reveal: reveal,+ centerAt: centerAt,+ logicalViewport: logicalViewport,+ sync: syncSemantic,+ state: function () { return { scale: state.scale, x: state.x, y: state.y, mode: state.mode }; }+ };+ })();++ /* ============================================================+ Semantic Radar — simplified semantic bounds + live viewport.+ The radar is built at runtime so the checked artifact still contains+ one canonical SVG block, and export serialization remains untouched.+ ============================================================ */+ Archify.radar = (function () {+ var container = document.querySelector('.diagram-container');+ var diagram = container.querySelector(':scope > svg');+ var panel = document.getElementById('overview-map');+ var surface = document.getElementById('overview-map-surface');+ var status = document.getElementById('overview-map-status');+ var trigger = document.getElementById('btn-overview-map');+ var closeBtn = document.getElementById('overview-map-close');+ var namespace = 'http://www.w3.org/2000/svg';+ var viewBox = diagram.viewBox && diagram.viewBox.baseVal;+ var mapSvg = document.createElementNS(namespace, 'svg');+ var nodeLayer = document.createElementNS(namespace, 'g');+ var viewport = document.createElementNS(namespace, 'rect');+ var nodes = [];+ var drag = null;+ var syncFrame = 0;++ mapSvg.setAttribute('role', 'group');+ mapSvg.setAttribute('aria-label', 'Semantic diagram radar nodes');+ mapSvg.setAttribute('preserveAspectRatio', 'xMidYMid meet');+ nodeLayer.setAttribute('class', 'overview-map-nodes');+ viewport.setAttribute('class', 'overview-map-viewport');+ viewport.setAttribute('rx', '3');+ viewport.setAttribute('ry', '3');+ mapSvg.appendChild(nodeLayer);+ mapSvg.appendChild(viewport);+ surface.appendChild(mapSvg);++ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];+ }+ function build() {+ if (!viewBox || viewBox.width <= 0 || viewBox.height <= 0) return false;+ mapSvg.setAttribute('viewBox', [viewBox.x, viewBox.y, viewBox.width, viewBox.height].join(' '));+ nodeLayer.textContent = '';+ nodes = [];+ Array.prototype.forEach.call(diagram.querySelectorAll('[data-node-id]'), function (node) {+ var box;+ try { box = node.getBBox(); } catch (_) { box = null; }+ if (!box || box.width <= 0 || box.height <= 0) return;+ var id = node.getAttribute('data-node-id');+ var rect = document.createElementNS(namespace, 'rect');+ rect.setAttribute('class', 'overview-map-node');+ rect.setAttribute('x', String(box.x));+ rect.setAttribute('y', String(box.y));+ rect.setAttribute('width', String(Math.max(3, box.width)));+ rect.setAttribute('height', String(Math.max(3, box.height)));+ rect.setAttribute('rx', String(Math.max(2, Math.min(8, Math.min(box.width, box.height) * 0.1))));+ rect.setAttribute('data-radar-node-id', id);+ rect.setAttribute('data-kind', node.getAttribute('data-node-kind') || 'neutral');+ rect.setAttribute('tabindex', '0');+ rect.setAttribute('role', 'button');+ rect.setAttribute('aria-label', 'Focus ' + nodeLabel(node, id) + ' from Semantic Radar');+ nodeLayer.appendChild(rect);+ nodes.push({ id: id, node: node, rect: rect });+ });+ status.textContent = nodes.length + ' nodes · full map';+ return true;+ }+ function updateDocking() {+ if (panel.hidden) return;+ var containerRect = container.getBoundingClientRect();+ var intersectsWindow = containerRect.bottom > 12 && containerRect.top < window.innerHeight - 12;+ if (!intersectsWindow) {+ panel.removeAttribute('data-docked');+ panel.removeAttribute('data-dock-side');+ panel.style.removeProperty('--archify-radar-right');+ panel.style.removeProperty('--archify-radar-left');+ panel.style.removeProperty('--archify-radar-top');+ return;+ }+ var active = diagram.querySelector('[data-focus-selected]');+ var activeRect = active ? active.getBoundingClientRect() : null;+ var dockLeft = !!(activeRect && activeRect.left + activeRect.width / 2 > window.innerWidth / 2);+ var right = Math.max(16, window.innerWidth - Math.min(containerRect.right - 16, window.innerWidth - 16));+ var left = Math.max(16, Math.min(containerRect.left + 16, window.innerWidth - panel.offsetWidth - 16));+ var topLimit = Math.max(16, containerRect.top + 16);+ var bottomLimit = Math.min(window.innerHeight - 16, containerRect.bottom - 16);+ var panelLeft = dockLeft ? left : window.innerWidth - right - panel.offsetWidth;+ var panelRight = panelLeft + panel.offsetWidth;+ var lens = document.getElementById('focus-chip');+ var lensRect = lens && !lens.hidden ? lens.getBoundingClientRect() : null;+ var blockers = [activeRect, lensRect].filter(function (rect) {+ return rect && rect.right > panelLeft && rect.left < panelRight;+ });+ var desiredTop = bottomLimit - panel.offsetHeight;+ var candidates = [desiredTop, topLimit];+ blockers.forEach(function (rect) {+ candidates.push(rect.top - 10 - panel.offsetHeight, rect.bottom + 10);+ });+ var valid = candidates.filter(function (candidate) {+ if (candidate < topLimit || candidate + panel.offsetHeight > bottomLimit) return false;+ return blockers.every(function (rect) {+ return candidate + panel.offsetHeight <= rect.top - 10 || candidate >= rect.bottom + 10;+ });+ });+ valid.sort(function (a, b) { return Math.abs(a - desiredTop) - Math.abs(b - desiredTop); });+ var top = valid.length ? valid[0] : Math.max(topLimit, desiredTop);+ top = Math.min(window.innerHeight - panel.offsetHeight - 16, top);+ panel.setAttribute('data-docked', 'true');+ panel.setAttribute('data-dock-side', dockLeft ? 'left' : 'right');+ panel.style.setProperty('--archify-radar-right', Math.round(right) + 'px');+ panel.style.setProperty('--archify-radar-left', Math.round(left) + 'px');+ panel.style.setProperty('--archify-radar-top', Math.round(Math.max(16, top)) + 'px');+ }+ function syncNow() {+ syncFrame = 0;+ if (panel.hidden || !Archify.view || typeof Archify.view.logicalViewport !== 'function') return;+ updateDocking();+ var visible = Archify.view.logicalViewport();+ if (!visible) return;+ viewport.setAttribute('x', String(visible.x));+ viewport.setAttribute('y', String(visible.y));+ viewport.setAttribute('width', String(visible.width));+ viewport.setAttribute('height', String(visible.height));+ var full = visible.width >= viewBox.width * 0.98 && visible.height >= viewBox.height * 0.98;+ var mobileWide = window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram');+ var viewportCopy = full+ ? 'full map'+ : (mobileWide ? Math.round(visible.width / viewBox.width * 100) + '% width' : Math.round(visible.scale * 100) + '% viewport');+ status.textContent = nodes.length + ' nodes · ' + viewportCopy;+ nodes.forEach(function (item) {+ var active = item.node.hasAttribute('data-focus-selected') ||+ item.node.getAttribute('data-story-beat-state') === 'active';+ if (active) item.rect.setAttribute('data-radar-active', 'true');+ else item.rect.removeAttribute('data-radar-active');+ });+ }+ function sync() {+ if (syncFrame) return;+ syncFrame = requestAnimationFrame(syncNow);+ }+ function setOpen(next, options) {+ options = options || {};+ next = Boolean(next);+ if (next && Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (next && Archify.semanticLens && Archify.semanticLens.isOpen()) {+ Archify.semanticLens.close({ restoreFocus: false });+ }+ panel.hidden = !next;+ trigger.setAttribute('aria-expanded', next ? 'true' : 'false');+ trigger.setAttribute('aria-label', next ? 'Close semantic radar' : 'Open semantic radar');+ if (next) {+ build();+ updateDocking();+ sync();+ if (options.focus === true) surface.focus();+ } else {+ panel.removeAttribute('data-docked');+ panel.removeAttribute('data-dock-side');+ panel.style.removeProperty('--archify-radar-right');+ panel.style.removeProperty('--archify-radar-left');+ panel.style.removeProperty('--archify-radar-top');+ if (options.restoreFocus === true) trigger.focus();+ }+ return next;+ }+ function toggle() { return setOpen(panel.hidden, { focus: false }); }+ function close(options) { return setOpen(false, options); }+ function bringNodeIntoWindow(node) {+ var delay = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : 540;+ window.setTimeout(function () {+ var rect = node.getBoundingClientRect();+ var safeTop = 64;+ var safeBottom = window.innerHeight - 64;+ if (rect.top >= safeTop && rect.bottom <= safeBottom) return;+ var top = Math.max(0, window.scrollY + rect.top + rect.height / 2 - window.innerHeight / 2);+ try { window.scrollTo({ top: top, behavior: delay ? 'smooth' : 'auto' }); }+ catch (_) { window.scrollTo(0, top); }+ }, delay);+ }+ function focusNode(id) {+ var main = diagram.querySelector('[data-node-id="' + id + '"]');+ if (!main) return false;+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.focus && typeof Archify.focus.set === 'function') {+ Archify.focus.set(id, { toggle: false });+ }+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'radar' });+ }+ bringNodeIntoWindow(main);+ try { main.focus({ preventScroll: true }); } catch (_) { try { main.focus(); } catch (_) {} }+ sync();+ return true;+ }+ function diagramPoint(event) {+ var matrix = mapSvg.getScreenCTM();+ if (!matrix) return null;+ var point = mapSvg.createSVGPoint();+ point.x = event.clientX;+ point.y = event.clientY;+ return point.matrixTransform(matrix.inverse());+ }+ function navigate(event) {+ var point = diagramPoint(event);+ if (!point || !Archify.view || typeof Archify.view.centerAt !== 'function') return;+ Archify.view.centerAt(point.x, point.y, { minimumScale: 1.5, instant: true });+ sync();+ }+ function endDrag(event) {+ if (!drag) return;+ drag = null;+ panel.removeAttribute('data-dragging');+ container.classList.remove('is-panning');+ try { surface.releasePointerCapture(event.pointerId); } catch (_) {}+ }- <div class="card">- <div class="card-header">- <div class="card-dot rose"></div>- <h3>Quality gates</h3>- </div>- <ul>- <li>• ajv schema validation sits on the IR (fail-closed)</li>- <li>• Renderer layout checks, then Output Check on the HTML</li>- <li>• CI golden tests and zip freshness stay off the main path</li>- </ul>- </div>- </div>+ trigger.addEventListener('click', toggle);+ closeBtn.addEventListener('click', function () { close({ restoreFocus: true }); });+ surface.addEventListener('pointerdown', function (event) {+ if (event.button !== 0 || event.target.closest('[data-radar-node-id]')) return;+ event.preventDefault();+ drag = { pointerId: event.pointerId };+ panel.setAttribute('data-dragging', 'true');+ container.classList.add('is-panning');+ try { surface.setPointerCapture(event.pointerId); } catch (_) {}+ navigate(event);+ });+ surface.addEventListener('pointermove', function (event) {+ if (!drag || drag.pointerId !== event.pointerId) return;+ navigate(event);+ });+ surface.addEventListener('pointerup', endDrag);+ surface.addEventListener('pointercancel', endDrag);+ surface.addEventListener('click', function (event) {+ var node = event.target.closest('[data-radar-node-id]');+ if (node) focusNode(node.getAttribute('data-radar-node-id'));+ });+ surface.addEventListener('keydown', function (event) {+ if (event.key === 'Escape') {+ event.preventDefault();+ event.stopPropagation();+ close({ restoreFocus: true });+ return;+ }+ var node = event.target.closest('[data-radar-node-id]');+ if (node && (event.key === 'Enter' || event.key === ' ')) {+ event.preventDefault();+ focusNode(node.getAttribute('data-radar-node-id'));+ return;+ }+ if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight' && event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return;+ var visible = Archify.view && Archify.view.logicalViewport ? Archify.view.logicalViewport() : null;+ if (!visible) return;+ event.preventDefault();+ var x = visible.x + visible.width / 2;+ var y = visible.y + visible.height / 2;+ var stepX = Math.max(12, visible.width * 0.24);+ var stepY = Math.max(12, visible.height * 0.24);+ if (event.key === 'ArrowLeft') x -= stepX;+ else if (event.key === 'ArrowRight') x += stepX;+ else if (event.key === 'ArrowUp') y -= stepY;+ else y += stepY;+ Archify.view.centerAt(x, y, { minimumScale: 1.5, instant: true });+ sync();+ });+ window.addEventListener('resize', sync);+ window.addEventListener('scroll', function () { updateDocking(); sync(); }, { passive: true });+ requestAnimationFrame(build);- <!-- Footer -->- <p class="footer">- Architecture diagram • Built with Archify<span class="no-print"> • Press <kbd>T</kbd> for theme and <kbd>E</kbd> for export</span>- </p>- </div>+ return {+ open: function () { return setOpen(true); },+ close: close,+ toggle: toggle,+ sync: sync,+ focus: focusNode,+ isOpen: function () { return !panel.hidden; },+ count: function () { return nodes.length; }+ };+ })();- <script>/* ============================================================- Theme toggle — persists to localStorage, respects system pref+ Presentation Stage — a shareable, viewport-filling live view.+ It changes only HTML layout and URL state; SVG semantics and export+ serialization remain untouched. Escape first clears an active guided+ view/focus, then exits the stage.============================================================ */- var Archify = {};-- Archify.theme = (function () {- var STORAGE_KEY = 'archify-theme';+ Archify.presentation = (function () {var html = document.documentElement;- var btn = document.getElementById('btn-theme');- var icon = document.getElementById('theme-icon');- var label = document.getElementById('theme-label');+ var btn = document.getElementById('btn-present');+ var icon = document.getElementById('present-icon');+ var label = document.getElementById('present-label');+ var previousScrollY = 0;- // localStorage can throw (blocked cookies, sandboxed iframes); the whole- // script element dies on an uncaught error, so guard every access.- function readStored() {- try { return localStorage.getItem(STORAGE_KEY); } catch (_) { return null; }- }- function writeStored(value) {- try { localStorage.setItem(STORAGE_KEY, value); } catch (_) {}- }- function urlOverride() {- // URL param wins (useful for deterministic screenshots / share links)+ function active() { return html.getAttribute('data-present') === 'true'; }++ function updateUrl(next) {try {- var param = new URLSearchParams(window.location.search).get('theme');- if (param === 'light' || param === 'dark') return param;+ var url = new URL(window.location.href);+ if (next) url.searchParams.set('present', '1');+ else url.searchParams.delete('present');+ history.replaceState(null, '', url.pathname + url.search + url.hash);} catch (_) {}- return null;}- function resolveInitial() {- var fromUrl = urlOverride();- if (fromUrl) return fromUrl;- var saved = readStored();- if (saved === 'light' || saved === 'dark') return saved;- return window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';+ function render(next) {+ btn.setAttribute('aria-pressed', next ? 'true' : 'false');+ btn.setAttribute('aria-label', next ? 'Exit presentation stage' : 'Enter presentation stage');+ btn.title = next ? 'Exit presentation stage (F or Escape)' : 'Presentation stage (F)';+ icon.textContent = next ? '\u00d7' : '\u25a1';+ label.textContent = next ? 'Exit' : 'Present';}- function apply(theme) {- html.setAttribute('data-theme', theme);- icon.textContent = theme === 'dark' ? '\u263E' : '\u263C';- label.textContent = theme === 'dark' ? 'Dark' : 'Light';- btn.setAttribute('aria-pressed', theme === 'light' ? 'true' : 'false');+ function setActive(next, options) {+ options = options || {};+ next = Boolean(next);+ if (next === active()) {+ render(next);+ return next;+ }+ if (next) {+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ previousScrollY = window.scrollY || 0;+ html.setAttribute('data-present', 'true');+ try { window.scrollTo(0, 0); } catch (_) {}+ } else {+ html.removeAttribute('data-present');+ }+ render(next);+ if (options.updateUrl !== false) updateUrl(next);+ requestAnimationFrame(function () {+ if (Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ requestAnimationFrame(function () {+ if (Archify.view && typeof Archify.view.sync === 'function') Archify.view.sync();+ });+ }+ if (!next && previousScrollY) {+ try { window.scrollTo(0, previousScrollY); } catch (_) {}+ }+ });+ return next;}- function toggle() {- var next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';- apply(next);- writeStored(next);- }+ function toggle() { return setActive(!active()); }- apply(resolveInitial());+ render(active());btn.addEventListener('click', toggle);- // Follow live OS theme changes while the user has no explicit preference.- try {- var media = window.matchMedia('(prefers-color-scheme: light)');- var onChange = function (e) {- var saved = readStored();- if (urlOverride() || saved === 'light' || saved === 'dark') return;- apply(e.matches ? 'light' : 'dark');- };- if (media.addEventListener) media.addEventListener('change', onChange);- else if (media.addListener) media.addListener(onChange);- } catch (_) {}-- return { toggle: toggle };+ return {+ enter: function () { return setActive(true); },+ exit: function () { return setActive(false); },+ toggle: toggle,+ active: active+ };})();/* ============================================================- Export — PNG / JPEG / WebP / SVG (download) and Copy PNG (clipboard)-- Raster exports are always rendered at 4x source resolution for- maximum sharpness. The trick: we set the serialized SVG's- `width`/`height` to viewBox * 4 so the browser rasterizes the- vectors at that resolution natively. drawImage then draws at- the image's natural size (no upscaling = no blur).-- JPEG/WebP paint the current theme's background explicitly since- those formats have no alpha channel.+ Node Finder — stable-ID search over the existing semantic SVG.+ Search never changes the IR or SVG geometry: selecting a result resets+ the viewport, releases a guided view, and delegates to semantic focus.============================================================ */- (function () {- var RASTER_SCALE = 4;-- function diagramFilename() {- var title = (document.title || 'diagram')- .replace(/\s+Architecture(\s+Diagram)?$/i, '')- .replace(/\s+Diagram$/i, '')- .trim();- return title.replace(/[^a-z0-9_\-]+/gi, '-')- .toLowerCase()- .replace(/^-+|-+$/g, '') || 'diagram';- }+ Archify.finder = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector('svg');+ var trigger = document.getElementById('btn-node-finder');+ var panel = document.getElementById('node-finder');+ var heading = document.getElementById('node-finder-title');+ var closeBtn = document.getElementById('node-finder-close');+ var input = document.getElementById('node-finder-input');+ var results = document.getElementById('node-finder-results');+ var empty = document.getElementById('node-finder-empty');+ var status = document.getElementById('node-finder-status');+ var visibleItems = [];- function currentBg() {- return getComputedStyle(document.body).backgroundColor || '#ffffff';+ function defaultContext() {+ return {+ kind: 'focus',+ title: 'Find a node',+ placeholder: 'Search labels or IDs',+ empty: 'No matching nodes',+ resultsLabel: 'Diagram nodes',+ availableNoun: 'nodes',+ allowedIds: null,+ badges: null+ };}- /**- * Serialize the main SVG into a standalone document.- *- * Two modes:- * - Default (opts.autoTheme=false) — locks the serialized SVG to the- * viewer's current theme. Used by the raster pipeline- * (PNG/JPEG/WebP/clipboard) because canvas rasterization needs- * deterministic colors; a raster cannot react to- * prefers-color-scheme after encoding.- * - autoTheme=true — emits BOTH dark and light variable sets plus a- * `@media (prefers-color-scheme)` rule so the resulting SVG- * self-themes when embedded in GitHub READMEs or other hosts that- * expose a color scheme. Used for "Download SVG".- */- function serializeSvg(scale, opts) {- // scale: integer multiplier for intrinsic SVG pixel dimensions used by- // the raster path. Defaults to 1 (natural size) for SVG download.- scale = scale || 1;- opts = opts || {};- var autoTheme = opts.autoTheme === true;-- var svg = document.querySelector('.diagram-container svg');- var clone = svg.cloneNode(true);-- var vb = svg.viewBox.baseVal;- // Scale width/height so the browser rasterizes the vectors at target- // resolution directly. viewBox stays unchanged so coordinates don't- // shift. This is the key to sharp rasters — do NOT scale later via- // canvas upscaling.- clone.setAttribute('width', vb.width * scale);- clone.setAttribute('height', vb.height * scale);- clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');-- // Only the SVG-relevant rules: semantic classes, markers, and the- // theme variable blocks. Toolbar/cards/print CSS can never apply- // inside a standalone SVG and would only bloat the export.- var hostStyle = (function () {- var out = [];- Array.prototype.forEach.call(document.styleSheets, function (sheet) {- var rules;- try { rules = sheet.cssRules; } catch (_) { return; } // cross-origin- if (!rules) return;- Array.prototype.forEach.call(rules, function (rule) {- if (rule.type !== 1) return; // plain style rules only- var sel = rule.selectorText || '';- if (/(^|,)\s*(svg|:root|\[data-theme|\.c-|\.t-|\.a-|\.m-)/.test(sel)) {- out.push(rule.cssText);- }- });- });- return out.join('\n');- })();+ var context = defaultContext();- // Derive the variable list from the stylesheet so newly added theme- // variables can never be missed by the export pipeline again- // (--lane-fill/--lane-stroke once were).- var varNames = (function () {- var seen = {};- var names = [];- (hostStyle.match(/--[a-zA-Z0-9-]+(?=\s*:)/g) || []).forEach(function (n) {- if (!seen[n]) { seen[n] = true; names.push(n); }- });- return names;- })();+ function semanticType(node) {+ var authored = node.getAttribute('data-node-kind');+ if (authored) return authored;+ var types = ['frontend', 'backend', 'database', 'cloud', 'security', 'messagebus', 'external'];+ return types.find(function (type) { return node.querySelector('.c-' + type); }) || 'node';+ }- // Resolve the full variable set for a given data-theme via an- // off-DOM probe, independent of what the viewer is currently set to.- function resolveVars(themeAttr) {- var probe = document.createElement('div');- probe.setAttribute('data-theme', themeAttr);- probe.style.cssText = 'position:absolute;width:0;height:0;visibility:hidden;';- document.body.appendChild(probe);- try {- var c = getComputedStyle(probe);- return varNames.map(function (n) {- return n + ': ' + c.getPropertyValue(n).trim() + ';';- }).join(' ');- } finally {- document.body.removeChild(probe);+ function connectionsFor(id) {+ var count = 0;+ var seen = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var key = from + '\u0000' + to;+ if ((from === id || to === id) && !seen[key]) {+ seen[key] = true;+ count += 1;}- }-- // Prepend a local()-only @font-face block for each weight so that the- // sandboxed image-rendering context used during PNG/JPEG/WebP export- // can find JetBrains Mono if the user has it installed locally, and- // falls through cleanly to the monospace stack otherwise. The usual- // Google-Fonts <link> in the host document is unreachable from the- // serialized SVG, so url()-sourced faces would just hang.- var fontFallback = [400, 500, 600, 700].map(function (w) {- return "@font-face { font-family: 'JetBrains Mono'; font-weight: " + w +- "; src: local('JetBrains Mono'), local('JetBrainsMono-Regular'); }";- }).join('\n');-- var style = document.createElementNS('http://www.w3.org/2000/svg', 'style');- var bgRect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');- bgRect.setAttribute('width', '100%');- bgRect.setAttribute('height', '100%');-- if (autoTheme) {- // Dual-theme SVG. Dark is the default (so hosts without- // prefers-color-scheme still render), light swaps in via media- // query, and svg[data-theme="..."] still lets downstream- // consumers force a specific theme.- var darkVars = resolveVars('dark');- var lightVars = resolveVars('light');-- style.textContent =- fontFallback + "\n" +- "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" +- hostStyle + "\n" +- ":root, svg { " + darkVars + " }\n" +- "@media (prefers-color-scheme: light) { :root, svg { " + lightVars + " } }\n" +- "svg[data-theme=\"light\"] { " + lightVars + " }\n" +- "svg[data-theme=\"dark\"] { " + darkVars + " }\n" +- "rect.c-bg-rect { fill: var(--bg); }\n";+ });+ return count;+ }- // Don't lock the serialized SVG to the viewer's current theme.- clone.removeAttribute('data-theme');- // Background follows the CSS variable, not a fixed color, so it- // swaps with the media query.- bgRect.setAttribute('class', 'c-bg-rect');- } else {- // Raster path: lock to the viewer's current theme.- var theme = document.documentElement.getAttribute('data-theme') || 'dark';- var themeHost = document.querySelector('[data-theme="' + theme + '"]') || document.documentElement;- var computed = getComputedStyle(themeHost);- var vars = varNames.map(function (n) {- return n + ': ' + computed.getPropertyValue(n).trim() + ';';- }).join(' ');+ var items = Array.prototype.map.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ var id = node.getAttribute('data-node-id');+ var label = node.getAttribute('data-node-label') || (node.getAttribute('aria-label') || id).replace(/^Focus\s+/, '');+ var text = (node.textContent || '').replace(/\s+/g, ' ').trim();+ var sublabel = node.getAttribute('data-node-sublabel') || '';+ var context = node.getAttribute('data-node-context') || '';+ var tag = node.getAttribute('data-node-tag') || '';+ var type = semanticType(node);+ return {+ id: id,+ label: label,+ type: type,+ sublabel: sublabel,+ context: context,+ tag: tag,+ links: connectionsFor(id),+ search: (id + ' ' + label + ' ' + type + ' ' + sublabel + ' ' + context + ' ' + tag + ' ' + text).toLowerCase(),+ node: node+ };+ });- // IMPORTANT: inject the resolved variables AFTER hostStyle,- // otherwise hostStyle's ":root, [data-theme=\"dark\"] { ... }" rule- // overrides our chosen theme via later-in-cascade equal-specificity.- // Keep this order.- style.textContent =- fontFallback + "\n" +- "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" +- hostStyle + "\n" +- ":root, svg { " + vars + " }\n";+ function resultButtons() {+ return Array.prototype.slice.call(results.querySelectorAll('.node-finder-result'));+ }- bgRect.setAttribute('fill', computed.getPropertyValue('--bg').trim() || '#ffffff');+ function resolveContext(options) {+ var requested = options && options.context ? options.context : null;+ if (!requested && Archify.routeProbe && typeof Archify.routeProbe.finderContext === 'function') {+ requested = Archify.routeProbe.finderContext();}+ if (!requested) return defaultContext();+ var resolved = defaultContext();+ Object.keys(requested).forEach(function (key) { resolved[key] = requested[key]; });+ return resolved;+ }- clone.insertBefore(style, clone.firstChild);- clone.insertBefore(bgRect, style.nextSibling);+ function availableItems() {+ if (!context.allowedIds) return items.slice();+ return items.filter(function (item) { return context.allowedIds.indexOf(item.id) !== -1; });+ }- return {- svgString: new XMLSerializer().serializeToString(clone),- width: vb.width * scale,- height: vb.height * scale- };+ function applyContext() {+ panel.setAttribute('data-context', context.kind);+ heading.textContent = context.title;+ input.placeholder = context.placeholder;+ empty.textContent = context.empty;+ results.setAttribute('aria-label', context.resultsLabel);}- function download(blob, filename) {- var url = URL.createObjectURL(blob);- var a = document.createElement('a');- a.href = url;- a.download = filename;- document.body.appendChild(a);- a.click();- a.remove();- setTimeout(function () { URL.revokeObjectURL(url); }, 1000);+ function select(id) {+ var item = items.find(function (candidate) { return candidate.id === id; });+ if (!item) return false;+ var routeSelection = context.kind === 'route-source' || context.kind === 'route-target';+ if (routeSelection) {+ if (!Archify.routeProbe || typeof Archify.routeProbe.choose !== 'function' || !Archify.routeProbe.choose(id)) return false;+ if (Archify.routeProbe.active() === 'target' && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'route-pick' });+ }+ close({ restoreFocus: false });+ try { item.node.focus({ preventScroll: true }); } catch (_) { try { item.node.focus(); } catch (_) {} }+ return true;+ }+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.view && typeof Archify.view.reset === 'function') Archify.view.reset({ automatic: true });+ Archify.focus.set(id, { toggle: false });+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'finder' });+ }+ close({ restoreFocus: false });+ try { item.node.focus({ preventScroll: true }); } catch (_) { try { item.node.focus(); } catch (_) {} }+ return true;}- // Conservative upper bound on total canvas pixels. Older Safari on iOS- // silently produces a blank canvas above ~16 Mpx; Chrome / Firefox /- // desktop Safari are far higher but start failing on memory-constrained- // devices. We pick the largest integer scale in {4,3,2,1} whose target- // pixel count fits under this cap.- var MAX_CANVAS_PIXELS = 16 * 1024 * 1024;+ function render(query) {+ query = (query || '').trim().toLowerCase();+ var available = availableItems();+ visibleItems = available.filter(function (item) { return !query || item.search.indexOf(query) !== -1; });+ results.textContent = '';+ visibleItems.forEach(function (item) {+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'node-finder-result';+ button.setAttribute('data-node-id', item.id);+ var badge = context.badges && context.badges[item.id] ? context.badges[item.id] : String(item.links);+ var action = context.kind === 'route-source'+ ? 'Choose ' + item.label + ' as route start'+ : context.kind === 'route-target'+ ? 'Choose ' + item.label + ' as route destination, ' + badge+ : 'Focus ' + item.label + ', ' + item.links + ' related connection' + (item.links === 1 ? '' : 's');+ button.setAttribute('aria-label', action);- function pickSafeScale(vbW, vbH) {- for (var s = RASTER_SCALE; s >= 1; s--) {- if (vbW * s * vbH * s <= MAX_CANVAS_PIXELS) return s;+ var name = document.createElement('strong');+ name.textContent = item.label;+ var links = document.createElement('em');+ links.textContent = badge;+ links.title = context.kind === 'focus'+ ? item.links + ' related connection' + (item.links === 1 ? '' : 's')+ : action;+ var meta = document.createElement('small');+ meta.textContent = [item.type, item.context, item.sublabel, item.tag, item.id].filter(Boolean).join(' \u00b7 ');+ button.appendChild(name);+ button.appendChild(links);+ button.appendChild(meta);+ button.addEventListener('click', function () { select(item.id); });+ results.appendChild(button);+ });+ empty.hidden = visibleItems.length !== 0;+ status.textContent = visibleItems.length + ' of ' + available.length + ' ' + context.availableNoun + (query ? ' match' : ' available');+ }++ function open(options) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);+ if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });+ context = resolveContext(options || {});+ applyContext();+ panel.hidden = false;+ trigger.setAttribute('aria-expanded', 'true');+ if (context.kind.indexOf('route-') === 0 && Archify.routeProbe && typeof Archify.routeProbe.finderOpening === 'function') {+ Archify.routeProbe.finderOpening();}- return 1;+ input.value = '';+ render('');+ requestAnimationFrame(function () { input.focus(); });+ return true;}- function rasterize(format) {- // Serialize at a safe scale (RASTER_SCALE=4 by default, reduced if the- // resulting canvas would exceed MAX_CANVAS_PIXELS). The SVG itself is- // rasterized at target resolution natively; drawImage draws at natural- // size — no upsampling blur.- var svg = document.querySelector('.diagram-container svg');- var vb = svg.viewBox.baseVal;- var scale = pickSafeScale(vb.width, vb.height);- var data = serializeSvg(scale);- var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });- var svgUrl = URL.createObjectURL(svgBlob);+ function close(options) {+ options = options || {};+ var routeContext = context.kind.indexOf('route-') === 0;+ panel.hidden = true;+ trigger.setAttribute('aria-expanded', 'false');+ input.value = '';+ if (routeContext && Archify.routeProbe && typeof Archify.routeProbe.finderClosed === 'function') {+ Archify.routeProbe.finderClosed({ restoreFocus: options.restoreFocus !== false });+ } else if (options.restoreFocus !== false) {+ trigger.focus();+ }+ }- return new Promise(function (resolve, reject) {- var img = new Image();- img.onload = function () {- var canvas = document.createElement('canvas');- canvas.width = data.width;- canvas.height = data.height;- var ctx = canvas.getContext('2d');- if (format === 'jpeg') {- ctx.fillStyle = currentBg();- ctx.fillRect(0, 0, canvas.width, canvas.height);- }- // Draw at natural size — SVG was already rasterized at target res.- ctx.drawImage(img, 0, 0);- URL.revokeObjectURL(svgUrl);- var mime = format === 'jpeg' ? 'image/jpeg' :- format === 'webp' ? 'image/webp' : 'image/png';- var quality = format === 'png' ? undefined : 0.95;- canvas.toBlob(function (blob) {- if (!blob) reject(new Error('toBlob returned null for ' + format));- else resolve(blob);- }, mime, quality);+ function toggle() { return panel.hidden ? open() : (close(), false); }++ trigger.addEventListener('click', toggle);+ closeBtn.addEventListener('click', function () { close(); });+ input.addEventListener('input', function () { render(input.value); });+ input.addEventListener('keydown', function (event) {+ var buttons = resultButtons();+ if (event.key === 'ArrowDown' && buttons.length) {+ event.preventDefault();+ buttons[0].focus();+ } else if (event.key === 'Enter' && visibleItems.length) {+ event.preventDefault();+ select(visibleItems[0].id);+ }+ });+ results.addEventListener('keydown', function (event) {+ var buttons = resultButtons();+ var index = buttons.indexOf(document.activeElement);+ if (index < 0 || !buttons.length) return;+ var next = null;+ if (event.key === 'ArrowDown') next = (index + 1) % buttons.length;+ else if (event.key === 'ArrowUp') next = (index - 1 + buttons.length) % buttons.length;+ else if (event.key === 'Home') next = 0;+ else if (event.key === 'End') next = buttons.length - 1;+ if (next !== null) {+ event.preventDefault();+ buttons[next].focus();+ }+ });+ panel.addEventListener('keydown', function (event) {+ if (event.key !== 'Escape') return;+ event.preventDefault();+ event.stopPropagation();+ close();+ });+ document.addEventListener('click', function (event) {+ if (!panel.hidden && !panel.contains(event.target) && !event.target.closest('[data-node-finder-trigger]')) close({ restoreFocus: false });+ });++ render('');+ return {+ open: open,+ close: close,+ toggle: toggle,+ select: select,+ isOpen: function () { return !panel.hidden; },+ context: function () { return context.kind; },+ count: items.length+ };+ })();++ /* ============================================================+ Route Probe — shortest directed path over compiled semantics.+ The graph is read from renderer-owned stable IDs and relationship+ endpoints. BFS order follows authored DOM edge order, so equal-length+ choices are deterministic without adding weights or a graph runtime.+ ============================================================ */+ Archify.routeProbe = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var trigger = document.getElementById('btn-route-probe');+ var panel = document.getElementById('route-probe');+ var title = document.getElementById('route-probe-title');+ var path = document.getElementById('route-probe-path');+ var status = document.getElementById('route-probe-status');+ var findBtn = document.getElementById('route-probe-find');+ var copyBtn = document.getElementById('route-probe-copy');+ var clearBtn = document.getElementById('route-probe-clear');+ var journeyControls = document.getElementById('route-journey-controls');+ var journeyPrevBtn = document.getElementById('route-journey-prev');+ var journeyPlayBtn = document.getElementById('route-journey-play');+ var journeyPlayIcon = document.getElementById('route-journey-play-icon');+ var journeyPlayLabel = document.getElementById('route-journey-play-label');+ var journeyNextBtn = document.getElementById('route-journey-next');+ var journeyOverviewBtn = document.getElementById('route-journey-overview');+ var namespace = 'http://www.w3.org/2000/svg';+ var mode = 'idle';+ var startId = null;+ var endId = null;+ var activeNodeIds = [];+ var activeEdges = [];+ var journeyIndex = -1;+ var journeyPlaying = false;+ var journeyComplete = false;+ var journeyGeneration = 0;+ var journeyTimer = null;+ var journeyStartedAt = 0;+ var journeyElapsedMs = 0;+ var journeyOwnerToken = 0;+ var JOURNEY_DWELL_MS = 1100;++ function nodes() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ }+ function edges() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ }+ function nodesById() {+ var out = {};+ nodes().forEach(function (node) { out[node.getAttribute('data-node-id')] = node; });+ return out;+ }+ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];+ }+ function edgeShapes(edge) {+ if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function removeOverlay() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-route-probe-overlay]'), function (overlay) {+ overlay.remove();+ });+ }+ function removeJourneyPulse(options) {+ options = options || {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-route-journey-overlay]'), function (overlay) {+ overlay.remove();+ });+ if (journeyOwnerToken && options.release !== false && Archify.motionGovernor) {+ var token = journeyOwnerToken;+ journeyOwnerToken = 0;+ Archify.motionGovernor.release(token);+ }+ }+ function stopJourneyTimer(options) {+ options = options || {};+ journeyGeneration += 1;+ if (journeyTimer) {+ if (options.preserveElapsed === true && journeyStartedAt) {+ journeyElapsedMs = Math.min(JOURNEY_DWELL_MS, journeyElapsedMs + Math.max(0, Date.now() - journeyStartedAt));+ }+ window.clearTimeout(journeyTimer);+ }+ journeyTimer = null;+ journeyStartedAt = 0;+ if (options.preserveElapsed !== true) journeyElapsedMs = 0;+ }+ function clearJourneyPresentation(options) {+ options = options || {};+ removeJourneyPulse();+ svg.removeAttribute('data-route-journey');+ panel.removeAttribute('data-route-journey');+ nodes().forEach(function (node) {+ node.removeAttribute('data-route-journey-state');+ node.removeAttribute('data-route-journey-current');+ });+ edges().forEach(function (edge) {+ edge.removeAttribute('data-route-journey-state');+ edge.removeAttribute('data-route-journey-current');+ });+ Array.prototype.forEach.call(path.querySelectorAll('[data-route-journey-index]'), function (button, index) {+ button.removeAttribute('data-route-journey-state');+ button.removeAttribute('aria-current');+ button.setAttribute('tabindex', index === 0 ? '0' : '-1');+ });+ if (options.keepControls !== true) journeyControls.hidden = true;+ journeyControls.setAttribute('data-playing', 'false');+ }+ function resetJourneyState() {+ stopJourneyTimer();+ journeyPlaying = false;+ journeyComplete = false;+ journeyIndex = -1;+ clearJourneyPresentation();+ }+ function cleanSvgState() {+ resetJourneyState();+ svg.removeAttribute('data-route-picking');+ svg.removeAttribute('data-route-active');+ removeOverlay();+ nodes().forEach(function (node) {+ node.removeAttribute('data-route-match');+ node.removeAttribute('data-route-start');+ node.removeAttribute('data-route-end');+ node.removeAttribute('data-route-step');+ node.removeAttribute('data-route-candidate');+ node.style.removeProperty('--route-step');+ });+ edges().forEach(function (edge) {+ edge.removeAttribute('data-route-match');+ edge.removeAttribute('data-route-step');+ edge.style.removeProperty('--route-step');+ });+ panel.removeAttribute('data-route-dock');+ }+ function replaceRouteHash(value) {+ try {+ history.replaceState(null, '', location.pathname + location.search + (value ? '#route=' + value : ''));+ } catch (_) {}+ }+ function renderPlaceholder(copy) {+ path.textContent = '';+ var placeholder = document.createElement('span');+ placeholder.className = 'route-probe-placeholder';+ placeholder.textContent = copy;+ path.appendChild(placeholder);+ }+ function renderPath(ids, options) {+ options = options || {};+ var byId = nodesById();+ path.textContent = '';+ ids.forEach(function (id, index) {+ if (index) {+ var arrow = document.createElement('span');+ arrow.className = 'route-probe-arrow';+ arrow.setAttribute('aria-hidden', 'true');+ arrow.textContent = '\u2192';+ path.appendChild(arrow);+ }+ var item = document.createElement(options.interactive === true ? 'button' : 'span');+ if (options.interactive === true) {+ item.type = 'button';+ item.setAttribute('data-route-journey-index', String(index));+ item.setAttribute('data-route-node-id', id);+ item.setAttribute('tabindex', index === 0 ? '0' : '-1');+ item.setAttribute('aria-label', 'Route position ' + (index + 1) + ' of ' + ids.length + ': ' + nodeLabel(byId[id], id));+ }+ item.className = 'route-probe-node';+ item.textContent = nodeLabel(byId[id], id);+ item.title = nodeLabel(byId[id], id) + ' · ' + id;+ if (index === 0) item.setAttribute('data-endpoint', 'start');+ if (index === ids.length - 1 && ids.length > 1) item.setAttribute('data-endpoint', 'end');+ path.appendChild(item);+ });+ }+ function setTrigger(active) {+ trigger.setAttribute('aria-pressed', active ? 'true' : 'false');+ trigger.setAttribute('aria-label', active ? 'Clear traced route' : 'Trace a directed route');+ }+ function clear(options) {+ options = options || {};+ var wasActive = mode !== 'idle';+ if (Archify.finder && Archify.finder.isOpen() && typeof Archify.finder.context === 'function' && Archify.finder.context().indexOf('route-') === 0) {+ Archify.finder.close({ restoreFocus: false });+ }+ mode = 'idle';+ startId = null;+ endId = null;+ activeNodeIds = [];+ activeEdges = [];+ cleanSvgState();+ panel.hidden = true;+ panel.setAttribute('data-state', 'idle');+ panel.removeAttribute('data-finder-open');+ title.textContent = 'Choose a start node';+ renderPlaceholder('Pick two semantic nodes on the diagram');+ status.textContent = 'Choose the source, then the destination. Direction matters.';+ findBtn.hidden = true;+ findBtn.textContent = 'Find start';+ findBtn.setAttribute('aria-label', 'Find a route start');+ copyBtn.hidden = true;+ copyBtn.textContent = 'Copy link';+ setTrigger(false);+ if (wasActive && options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ if (options.updateUrl !== false) replaceRouteHash('');+ if (options.restoreFocus === true) trigger.focus();+ }+ function outgoingByNode() {+ var byId = nodesById();+ var outgoing = {};+ edges().forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (!byId[from] || !byId[to] || from === to) return;+ if (!outgoing[from]) outgoing[from] = [];+ outgoing[from].push({ edge: edge, to: to });+ });+ return outgoing;+ }+ function reachableFrom(source) {+ var outgoing = outgoingByNode();+ var reached = {};+ var queue = [source];+ reached[source] = true;+ for (var cursor = 0; cursor < queue.length; cursor += 1) {+ var links = outgoing[queue[cursor]] || [];+ links.forEach(function (link) {+ if (reached[link.to]) return;+ reached[link.to] = true;+ queue.push(link.to);+ });+ }+ return reached;+ }+ function hopDistancesFrom(source) {+ var outgoing = outgoingByNode();+ var distances = {};+ var queue = [source];+ distances[source] = 0;+ for (var cursor = 0; cursor < queue.length; cursor += 1) {+ var links = outgoing[queue[cursor]] || [];+ links.forEach(function (link) {+ if (Object.prototype.hasOwnProperty.call(distances, link.to)) return;+ distances[link.to] = distances[queue[cursor]] + 1;+ queue.push(link.to);+ });+ }+ return distances;+ }+ function shortestDirectedPath(source, target) {+ if (source === target) return null;+ var outgoing = outgoingByNode();+ var previous = {};+ var queue = [source];+ previous[source] = null;+ for (var cursor = 0; cursor < queue.length && !Object.prototype.hasOwnProperty.call(previous, target); cursor += 1) {+ var links = outgoing[queue[cursor]] || [];+ links.some(function (link) {+ if (Object.prototype.hasOwnProperty.call(previous, link.to)) return false;+ previous[link.to] = { from: queue[cursor], edge: link.edge };+ queue.push(link.to);+ return link.to === target;+ });+ }+ if (!Object.prototype.hasOwnProperty.call(previous, target)) return null;+ var nodeIds = [target];+ var routeEdges = [];+ var current = target;+ while (current !== source) {+ var step = previous[current];+ if (!step) return null;+ routeEdges.unshift(step.edge);+ nodeIds.unshift(step.from);+ current = step.from;+ }+ return { nodes: nodeIds, edges: routeEdges };+ }+ function traceGeometry(shape, step) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-route-match');+ clone.removeAttribute('data-route-step');+ clone.setAttribute('class', 'route-probe-flow');+ clone.setAttribute('pathLength', '1');+ clone.style.setProperty('--route-step', String(step));+ return clone;+ }+ function renderOverlay(routeEdges) {+ removeOverlay();+ if (!routeEdges.length) return;+ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'route-probe-overlay');+ overlay.setAttribute('data-route-probe-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ routeEdges.forEach(function (edge, step) {+ var wrapper = document.createElementNS(namespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ edgeShapes(edge).forEach(function (shape) { wrapper.appendChild(traceGeometry(shape, step)); });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ }+ function journeyButtons() {+ return Array.prototype.slice.call(path.querySelectorAll('[data-route-journey-index]'));+ }+ function journeyMotionAllowed() {+ return html.getAttribute('data-embed') !== 'true' &&+ !document.hidden &&+ Archify.motionGovernor &&+ Archify.motionGovernor.capable === true &&+ !Archify.motionGovernor.isPaused();+ }+ function routeOverviewStatus() {+ return activeNodeIds.length + ' nodes · ' + activeEdges.length + ' directed hop' + (activeEdges.length === 1 ? '' : 's') + ' · shortest authored route';+ }+ function centerJourneyButton(button) {+ if (!button) return;+ var target = button.offsetLeft - Math.max(0, (path.clientWidth - button.offsetWidth) / 2);+ path.scrollLeft = Math.max(0, target);+ }+ function focusJourneyButton(index) {+ var buttons = journeyButtons();+ if (!buttons.length) return false;+ var next = Math.max(0, Math.min(buttons.length - 1, index));+ buttons.forEach(function (button, buttonIndex) {+ button.setAttribute('tabindex', buttonIndex === next ? '0' : '-1');+ });+ try { buttons[next].focus({ preventScroll: true }); } catch (_) { buttons[next].focus(); }+ centerJourneyButton(buttons[next]);+ return true;+ }+ function renderJourneyControls() {+ var hasRoute = mode === 'result' && activeNodeIds.length > 1;+ var canPlay = hasRoute && journeyMotionAllowed();+ journeyControls.hidden = !hasRoute;+ journeyControls.setAttribute('data-playing', journeyPlaying ? 'true' : 'false');+ journeyPrevBtn.disabled = !hasRoute || journeyIndex <= 0;+ journeyNextBtn.disabled = !hasRoute || journeyIndex >= activeNodeIds.length - 1;+ journeyOverviewBtn.disabled = !hasRoute || journeyIndex < 0;+ journeyPlayBtn.disabled = !canPlay;+ journeyPlayBtn.setAttribute('aria-pressed', journeyPlaying ? 'true' : 'false');+ if (journeyPlaying) {+ journeyPlayIcon.textContent = '\u275a\u275a';+ journeyPlayLabel.textContent = 'Pause';+ journeyPlayBtn.setAttribute('aria-label', 'Pause route journey');+ journeyPlayBtn.title = 'Pause route journey';+ } else if (journeyComplete || journeyIndex === activeNodeIds.length - 1) {+ journeyPlayIcon.textContent = '\u21bb';+ journeyPlayLabel.textContent = 'Replay';+ journeyPlayBtn.setAttribute('aria-label', 'Replay route journey');+ journeyPlayBtn.title = canPlay ? 'Replay route journey' : 'Automatic journey requires Live motion';+ } else {+ journeyPlayIcon.textContent = '\u25b6';+ journeyPlayLabel.textContent = 'Journey';+ journeyPlayBtn.setAttribute('aria-label', 'Play route journey');+ journeyPlayBtn.title = canPlay ? 'Play route journey' : 'Automatic journey requires Live motion';+ }+ }+ function journeyGeometry(shape) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-route-match');+ clone.removeAttribute('data-route-step');+ clone.removeAttribute('data-route-journey-state');+ clone.removeAttribute('data-route-journey-current');+ clone.setAttribute('class', 'route-journey-flow');+ clone.setAttribute('pathLength', '1');+ return clone;+ }+ function renderJourneyPulse(edge) {+ removeJourneyPulse();+ if (!edge || !journeyMotionAllowed()) return false;+ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'route-journey-overlay');+ overlay.setAttribute('data-route-journey-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ var wrapper = document.createElementNS(namespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ edgeShapes(edge).forEach(function (shape) { wrapper.appendChild(journeyGeometry(shape)); });+ if (!wrapper.childNodes.length) return false;+ overlay.appendChild(wrapper);+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ if (Archify.motionGovernor && Archify.motionGovernor.capable) {+ var token = 0;+ token = Archify.motionGovernor.claim('route', function () {+ if (journeyOwnerToken === token) journeyOwnerToken = 0;+ removeJourneyPulse({ release: false });+ });+ journeyOwnerToken = token;+ }+ overlay.addEventListener('animationend', function () {+ if (overlay.isConnected) removeJourneyPulse();+ }, { once: true });+ window.setTimeout(function () {+ if (overlay.isConnected) removeJourneyPulse();+ }, 860);+ return true;+ }+ function applyJourneyState(index, options) {+ options = options || {};+ if (mode !== 'result' || !activeNodeIds.length) return false;+ var byId = nodesById();+ journeyIndex = Math.max(0, Math.min(activeNodeIds.length - 1, index));+ removeJourneyPulse();+ svg.setAttribute('data-route-journey', (journeyIndex + 1) + '/' + activeNodeIds.length);+ panel.setAttribute('data-route-journey', String(journeyIndex));+ activeNodeIds.forEach(function (id, step) {+ var node = byId[id];+ if (!node) return;+ var state = step < journeyIndex ? 'past' : (step === journeyIndex ? 'current' : 'future');+ node.setAttribute('data-route-journey-state', state);+ if (step === journeyIndex) node.setAttribute('data-route-journey-current', '');+ else node.removeAttribute('data-route-journey-current');+ });+ activeEdges.forEach(function (edge, step) {+ var destination = step + 1;+ var state = destination < journeyIndex ? 'past' : (destination === journeyIndex ? 'current' : 'future');+ edge.setAttribute('data-route-journey-state', state);+ if (destination === journeyIndex) edge.setAttribute('data-route-journey-current', '');+ else edge.removeAttribute('data-route-journey-current');+ });+ var buttons = journeyButtons();+ buttons.forEach(function (button, step) {+ var state = step < journeyIndex ? 'past' : (step === journeyIndex ? 'current' : 'future');+ button.setAttribute('data-route-journey-state', state);+ button.setAttribute('tabindex', step === journeyIndex ? '0' : '-1');+ if (step === journeyIndex) button.setAttribute('aria-current', 'step');+ else button.removeAttribute('aria-current');+ });+ if (options.center !== false) centerJourneyButton(buttons[journeyIndex]);+ var phase = journeyPlaying ? 'Playing' : (journeyComplete ? 'Complete' : 'Inspecting');+ status.textContent = 'Step ' + (journeyIndex + 1) + ' of ' + activeNodeIds.length + ' · ' + phase + ' · ' + nodeLabel(byId[activeNodeIds[journeyIndex]], activeNodeIds[journeyIndex]);+ if (options.pulse === true && journeyIndex > 0) renderJourneyPulse(activeEdges[journeyIndex - 1]);+ if (options.reveal !== false && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal(activeNodeIds.slice(Math.max(0, journeyIndex - 1), Math.min(activeNodeIds.length, journeyIndex + 2)), {+ includeNeighbors: false,+ reason: 'route-journey',+ maxScale: 1.65,+ padding: 64,+ duration: 360,+ instant: !journeyMotionAllowed()+ });+ }+ renderJourneyControls();+ requestDocking();+ return true;+ }+ function pauseJourney(options) {+ options = options || {};+ if (!journeyPlaying && options.complete !== true) {+ renderJourneyControls();+ return false;+ }+ stopJourneyTimer({ preserveElapsed: options.complete !== true && options.preserveElapsed !== false });+ journeyPlaying = false;+ journeyComplete = options.complete === true;+ if (journeyComplete) journeyElapsedMs = 0;+ removeJourneyPulse();+ if (journeyIndex >= 0) applyJourneyState(journeyIndex, { center: false, pulse: false, reveal: false });+ else renderJourneyControls();+ return true;+ }+ function selectJourneyIndex(index) {+ if (mode !== 'result') return false;+ stopJourneyTimer();+ journeyPlaying = false;+ journeyComplete = false;+ return applyJourneyState(index, { pulse: true, reveal: true });+ }+ function showJourneyOverview(options) {+ options = options || {};+ if (mode !== 'result') return false;+ stopJourneyTimer();+ journeyPlaying = false;+ journeyComplete = false;+ journeyIndex = -1;+ clearJourneyPresentation({ keepControls: true });+ status.textContent = routeOverviewStatus();+ renderJourneyControls();+ if (options.reveal !== false && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal(activeNodeIds, { includeNeighbors: false, reason: 'route', instant: !journeyMotionAllowed() });+ }+ requestDocking();+ return true;+ }+ function scheduleJourney() {+ if (!journeyPlaying || !journeyMotionAllowed()) {+ pauseJourney({ preserveElapsed: true });+ return false;+ }+ var generation = ++journeyGeneration;+ var remaining = Math.max(0, JOURNEY_DWELL_MS - journeyElapsedMs);+ journeyStartedAt = Date.now();+ journeyTimer = window.setTimeout(function () {+ if (generation !== journeyGeneration || !journeyPlaying) return;+ journeyTimer = null;+ journeyStartedAt = 0;+ journeyElapsedMs = 0;+ if (journeyIndex >= activeNodeIds.length - 1) {+ pauseJourney({ complete: true, preserveElapsed: false });+ return;+ }+ applyJourneyState(journeyIndex + 1, { pulse: true, reveal: true });+ // Camera and motion-owner handoff are allowed to synchronously+ // settle the previous step. The new step always starts with a fresh+ // dwell; never carry cleanup time into the next scheduler lease.+ journeyElapsedMs = 0;+ journeyStartedAt = 0;+ scheduleJourney();+ }, remaining);+ return true;+ }+ function playJourney() {+ if (mode !== 'result' || activeNodeIds.length < 2 || !journeyMotionAllowed()) {+ renderJourneyControls();+ return false;+ }+ if (journeyPlaying) return true;+ if (journeyComplete || journeyIndex >= activeNodeIds.length - 1) {+ journeyIndex = -1;+ journeyElapsedMs = 0;+ journeyComplete = false;+ }+ journeyPlaying = true;+ if (journeyIndex < 0) applyJourneyState(0, { pulse: false, reveal: true });+ else applyJourneyState(journeyIndex, { center: false, pulse: false, reveal: false });+ scheduleJourney();+ return true;+ }+ function toggleJourney() {+ return journeyPlaying ? pauseJourney({ preserveElapsed: true }) : playJourney();+ }+ function previousJourney() {+ return selectJourneyIndex(Math.max(0, journeyIndex < 0 ? 0 : journeyIndex - 1));+ }+ function nextJourney() {+ return selectJourneyIndex(Math.min(activeNodeIds.length - 1, journeyIndex + 1));+ }+ function overlapArea(a, b) {+ var width = Math.max(0, Math.min(a.right, b.right) - Math.max(a.left, b.left));+ var height = Math.max(0, Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top));+ return width * height;+ }+ function updateDocking() {+ if (panel.hidden) {+ panel.removeAttribute('data-route-dock');+ return;+ }+ var containerRect = container.getBoundingClientRect();+ var width = panel.offsetWidth;+ var height = panel.offsetHeight;+ if (!width || !height) return;+ var currentRect = panel.getBoundingClientRect();+ var left = currentRect.left;+ var topCandidate = {+ left: left,+ right: left + width,+ top: containerRect.top + 8,+ bottom: containerRect.top + 8 + height+ };+ var nav = container.querySelector('.diagram-nav');+ var navRect = nav ? nav.getBoundingClientRect() : null;+ var bottom = navRect ? navRect.top - 9 : containerRect.bottom - 8;+ var bottomCandidate = {+ left: left,+ right: left + width,+ top: bottom - height,+ bottom: bottom+ };+ var byId = nodesById();+ var relevant = activeNodeIds.length ? activeNodeIds : (startId ? [startId] : []);+ var blockers = relevant.map(function (id) { return byId[id]; }).filter(Boolean).map(function (node) {+ return node.getBoundingClientRect();+ });+ function score(candidate) {+ var value = blockers.reduce(function (sum, rect) { return sum + overlapArea(candidate, rect); }, 0);+ if (navRect) value += overlapArea(candidate, navRect) * 4;+ if (candidate.top < containerRect.top || candidate.bottom > containerRect.bottom) value += 1000000;+ return value;+ }+ if (score(topCandidate) <= score(bottomCandidate)) panel.setAttribute('data-route-dock', 'top');+ else panel.setAttribute('data-route-dock', 'bottom');+ }+ function requestDocking() {+ requestAnimationFrame(updateDocking);+ window.setTimeout(updateDocking, 120);+ window.setTimeout(updateDocking, 560);+ }+ function chooseStart(id) {+ var byId = nodesById();+ if (!byId[id]) return false;+ cleanSvgState();+ startId = id;+ endId = null;+ mode = 'target';+ var reached = reachableFrom(id);+ byId[id].setAttribute('data-route-start', '');+ byId[id].setAttribute('data-route-match', '');+ Object.keys(reached).forEach(function (candidateId) {+ if (candidateId !== id && byId[candidateId]) byId[candidateId].setAttribute('data-route-candidate', '');+ });+ svg.setAttribute('data-route-picking', 'target');+ panel.setAttribute('data-state', 'target');+ title.textContent = 'Choose a destination from ' + nodeLabel(byId[id], id);+ renderPath([id]);+ var count = Math.max(0, Object.keys(reached).length - 1);+ status.textContent = count+ ? count + ' directed destination' + (count === 1 ? '' : 's') + ' available. Pick a highlighted node.'+ : 'No outgoing route starts here. Clear and choose another source.';+ findBtn.hidden = false;+ findBtn.textContent = 'Find target';+ findBtn.setAttribute('aria-label', 'Find a reachable route destination');+ requestDocking();+ return true;+ }+ function showResult(result, options) {+ options = options || {};+ var byId = nodesById();+ cleanSvgState();+ mode = 'result';+ startId = result.nodes[0];+ endId = result.nodes[result.nodes.length - 1];+ activeNodeIds = result.nodes.slice();+ activeEdges = result.edges.slice();+ result.nodes.forEach(function (id, step) {+ var node = byId[id];+ if (!node) return;+ node.setAttribute('data-route-match', '');+ node.setAttribute('data-route-step', String(step));+ node.style.setProperty('--route-step', String(step));+ if (step === 0) node.setAttribute('data-route-start', '');+ if (step === result.nodes.length - 1) node.setAttribute('data-route-end', '');+ });+ result.edges.forEach(function (edge, step) {+ edge.setAttribute('data-route-match', '');+ edge.setAttribute('data-route-step', String(step));+ edge.style.setProperty('--route-step', String(step));+ });+ svg.setAttribute('data-route-active', startId + '~' + endId);+ renderOverlay(result.edges);+ renderPath(result.nodes, { interactive: true });+ panel.setAttribute('data-state', 'result');+ panel.hidden = false;+ title.textContent = nodeLabel(byId[startId], startId) + ' to ' + nodeLabel(byId[endId], endId);+ findBtn.hidden = true;+ copyBtn.hidden = false;+ setTrigger(true);+ if (options.updateUrl !== false) {+ replaceRouteHash(encodeURIComponent(startId) + '~' + encodeURIComponent(endId));+ }+ showJourneyOverview({ reveal: false });+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal(result.nodes, { includeNeighbors: false, reason: 'route' });+ }+ return true;+ }+ function choose(id, options) {+ options = options || {};+ var byId = nodesById();+ if (!byId[id]) return false;+ if (mode === 'source') return chooseStart(id);+ if (mode !== 'target') return false;+ if (id === startId) {+ panel.setAttribute('data-state', 'error');+ title.textContent = 'Choose a different destination';+ status.textContent = 'A route needs two distinct semantic nodes.';+ return false;+ }+ var result = shortestDirectedPath(startId, id);+ if (!result) {+ panel.setAttribute('data-state', 'error');+ title.textContent = 'No directed route to ' + nodeLabel(byId[id], id);+ status.textContent = nodeLabel(byId[id], id) + ' is not reachable from ' + nodeLabel(byId[startId], startId) + '. Pick a highlighted destination.';+ return false;+ }+ return showResult(result, options);+ }+ function begin(options) {+ options = options || {};+ if (html.getAttribute('data-embed') === 'true') return false;+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.semanticLens && Archify.semanticLens.active()) {+ Archify.semanticLens.clear({ updateUrl: false, preserveView: true, closePanel: true });+ }+ var focused = options.source || (Archify.focus && typeof Archify.focus.active === 'function' ? Archify.focus.active() : null);+ if (Array.isArray(focused)) focused = null;+ clear({ updateUrl: false, preserveView: true, restoreFocus: false });+ if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') Archify.intentTrace.clear({ announce: false });+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.focus && typeof Archify.focus.clear === 'function') {+ Archify.focus.clear({ updateUrl: false, preserveView: true });+ }+ if (Archify.finder && Archify.finder.isOpen()) Archify.finder.close({ restoreFocus: false });+ if (Archify.radar && Archify.radar.isOpen()) Archify.radar.close({ restoreFocus: false });+ mode = 'source';+ panel.hidden = false;+ panel.setAttribute('data-state', 'source');+ svg.setAttribute('data-route-picking', 'source');+ title.textContent = 'Choose a start node';+ renderPlaceholder('Pick a semantic node on the diagram');+ status.textContent = 'Select the source. The next step will reveal only directed destinations.';+ findBtn.hidden = false;+ findBtn.textContent = 'Find start';+ findBtn.setAttribute('aria-label', 'Find a route start');+ copyBtn.hidden = true;+ setTrigger(true);+ if (focused && nodesById()[focused]) chooseStart(focused);+ if (options.focusNode === true && !focused) {+ var first = nodes()[0];+ if (first) {+ try { first.focus({ preventScroll: true }); } catch (_) { try { first.focus(); } catch (_) {} }+ }+ }+ return true;+ }+ function toggle(options) {+ if (mode !== 'idle') {+ clear({ restoreFocus: true });+ return false;+ }+ return begin(options);+ }+ function finderContext() {+ var byId = nodesById();+ if (mode === 'source') {+ var outgoing = outgoingByNode();+ var sourceIds = nodes().map(function (node) { return node.getAttribute('data-node-id'); }).filter(function (id) {+ return outgoing[id] && outgoing[id].length;+ });+ var sourceBadges = {};+ sourceIds.forEach(function (id) { sourceBadges[id] = 'start'; });+ return {+ kind: 'route-source',+ title: 'Choose route start',+ placeholder: 'Search route sources',+ empty: 'No matching route sources',+ resultsLabel: 'Nodes that can start a route',+ availableNoun: 'route sources',+ allowedIds: sourceIds,+ badges: sourceBadges};- img.onerror = function (e) {- URL.revokeObjectURL(svgUrl);- reject(e);+ }+ if (mode === 'target' && startId && byId[startId]) {+ var distances = hopDistancesFrom(startId);+ var targetIds = Object.keys(distances).filter(function (id) { return id !== startId && byId[id]; });+ var targetBadges = {};+ targetIds.forEach(function (id) {+ targetBadges[id] = distances[id] + ' hop' + (distances[id] === 1 ? '' : 's');+ });+ return {+ kind: 'route-target',+ title: 'Destination from ' + nodeLabel(byId[startId], startId),+ placeholder: 'Search reachable destinations',+ empty: 'No matching reachable destinations',+ resultsLabel: 'Reachable route destinations',+ availableNoun: 'reachable destinations',+ allowedIds: targetIds,+ badges: targetBadges};- img.src = svgUrl;+ }+ return null;+ }+ function finderOpening() {+ panel.setAttribute('data-finder-open', 'true');+ }+ function finderClosed(options) {+ options = options || {};+ panel.removeAttribute('data-finder-open');+ requestDocking();+ if (options.restoreFocus === true && !findBtn.hidden) findBtn.focus();+ }+ function openFinder() {+ var context = finderContext();+ if (!context || !Archify.finder) return false;+ return Archify.finder.open({ context: context });+ }+ function fallbackCopy(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }+ function copyLink() {+ if (mode !== 'result') return Promise.resolve(false);+ var value = location.href.replace(/#.*$/, '') + '#route=' + encodeURIComponent(startId) + '~' + encodeURIComponent(endId);+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })+ : Promise.resolve(fallbackCopy(value));+ return copy.then(function (copied) {+ copyBtn.textContent = copied ? 'Copied' : 'Copy failed';+ copyBtn.setAttribute('aria-label', copied ? 'Traced route link copied' : 'Could not copy traced route link');+ window.setTimeout(function () {+ copyBtn.textContent = 'Copy link';+ copyBtn.setAttribute('aria-label', 'Copy link to traced route');+ }, 1600);+ return copied;+ });+ }+ function interceptSelection(event) {+ if (mode !== 'source' && mode !== 'target') return;+ if (container.getAttribute('data-just-panned') === 'true') return;+ var node = event.target.closest('[data-node-id]');+ if (!node) return;+ if (event.type === 'keydown' && event.key !== 'Enter' && event.key !== ' ') return;+ event.preventDefault();+ event.stopImmediatePropagation();+ choose(node.getAttribute('data-node-id'));+ }+ function syncFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var route = params.get('route');+ if (!route) {+ if (mode !== 'idle') clear({ updateUrl: false, restoreFocus: false });+ return;+ }+ var parts = route.split('~');+ if (parts.length !== 2) return;+ var byId = nodesById();+ if (!byId[parts[0]] || !byId[parts[1]]) return;+ begin({ source: parts[0], focusNode: false });+ choose(parts[1], { updateUrl: false });+ } catch (_) {}+ }+ function escapeRoute(options) {+ options = options || {};+ if (journeyPlaying) {+ pauseJourney({ preserveElapsed: true });+ if (options.restoreFocus === true) journeyPlayBtn.focus();+ return 'paused';+ }+ if (journeyIndex >= 0) {+ showJourneyOverview({ reveal: true });+ if (options.restoreFocus === true) journeyOverviewBtn.focus();+ return 'overview';+ }+ clear({ restoreFocus: options.restoreFocus === true });+ return 'cleared';+ }+ function syncJourneyMotion() {+ if (journeyPlaying && !journeyMotionAllowed()) pauseJourney({ preserveElapsed: true });+ renderJourneyControls();+ return journeyMotionAllowed();+ }++ trigger.addEventListener('click', function () { toggle({ focusNode: false }); });+ findBtn.addEventListener('click', openFinder);+ clearBtn.addEventListener('click', function () { clear({ restoreFocus: true }); });+ copyBtn.addEventListener('click', copyLink);+ journeyPrevBtn.addEventListener('click', previousJourney);+ journeyPlayBtn.addEventListener('click', toggleJourney);+ journeyNextBtn.addEventListener('click', nextJourney);+ journeyOverviewBtn.addEventListener('click', function () { showJourneyOverview({ reveal: true }); });+ path.addEventListener('click', function (event) {+ var button = event.target.closest('[data-route-journey-index]');+ if (!button) return;+ selectJourneyIndex(Number(button.getAttribute('data-route-journey-index')));+ });+ path.addEventListener('focusin', function (event) {+ if (journeyPlaying && event.target.closest('[data-route-journey-index]')) pauseJourney({ preserveElapsed: true });+ });+ path.addEventListener('keydown', function (event) {+ var button = event.target.closest('[data-route-journey-index]');+ if (!button) return;+ var index = Number(button.getAttribute('data-route-journey-index'));+ var next = null;+ if (event.key === 'ArrowRight') next = Math.min(activeNodeIds.length - 1, index + 1);+ else if (event.key === 'ArrowLeft') next = Math.max(0, index - 1);+ else if (event.key === 'Home') next = 0;+ else if (event.key === 'End') next = activeNodeIds.length - 1;+ if (next !== null) {+ event.preventDefault();+ focusJourneyButton(next);+ return;+ }+ if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault();+ selectJourneyIndex(index);+ }+ });+ svg.addEventListener('click', interceptSelection, true);+ svg.addEventListener('keydown', interceptSelection, true);+ container.addEventListener('scroll', updateDocking, { passive: true });+ window.addEventListener('resize', requestDocking);+ window.addEventListener('beforeprint', function () {+ if (journeyPlaying) pauseJourney({ preserveElapsed: true, reason: 'print' });+ else removeJourneyPulse();+ });+ window.addEventListener('hashchange', function () { requestAnimationFrame(syncFromHash); });+ syncFromHash();++ return {+ begin: begin,+ choose: choose,+ clear: clear,+ toggle: toggle,+ escape: escapeRoute,+ copyLink: copyLink,+ playJourney: playJourney,+ pauseJourney: pauseJourney,+ showOverview: showJourneyOverview,+ selectJourneyIndex: selectJourneyIndex,+ syncMotion: syncJourneyMotion,+ isJourneyPlaying: function () { return journeyPlaying; },+ finderContext: finderContext,+ finderOpening: finderOpening,+ finderClosed: finderClosed,+ openFinder: openFinder,+ active: function () { return mode === 'idle' ? null : mode; },+ result: function () {+ return mode === 'result'+ ? { source: startId, target: endId, nodes: activeNodeIds.slice(), hops: activeEdges.length, journey: journeyIndex, playing: journeyPlaying }+ : null;+ }+ };+ })();++ /* ============================================================+ Semantic Lens — a counted, viewer-only legend over data-node-kind.+ One selected kind reveals every authored relationship touching it.+ Two selected kinds compare only direct cross-kind relationships while+ preserving the full diagram as a dimmed spatial reference.+ ============================================================ */+ Archify.semanticLens = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var trigger = document.getElementById('btn-semantic-lens');+ var panel = document.getElementById('semantic-lens');+ var closeBtn = document.getElementById('semantic-lens-close');+ var kindsRoot = document.getElementById('semantic-lens-kinds');+ var status = document.getElementById('semantic-lens-status');+ var copyBtn = document.getElementById('semantic-lens-copy');+ var clearBtn = document.getElementById('semantic-lens-clear');+ var legendBridge = svg.querySelector('[data-legend-bridge]');+ var legendEntries = [];+ var hoveredLegendEntry = null;+ var focusedLegendEntry = null;+ var activeLegendPreview = null;+ var lensOpener = trigger;+ var selectedKinds = [];+ var namespace = 'http://www.w3.org/2000/svg';+ var finePointerQuery = window.matchMedia ? window.matchMedia('(hover: hover) and (pointer: fine)') : null;+ var MAX_LENS_FLOW_EDGES = 24;++ function kindLabel(value) {+ return String(value || 'neutral')+ .replace(/messagebus/gi, 'message bus')+ .replace(/[-_]+/g, ' ')+ .replace(/\b\w/g, function (letter) { return letter.toUpperCase(); });+ }+ function nodesById() {+ var byId = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id][data-node-kind]'), function (node) {+ var id = node.getAttribute('data-node-id');+ if (id && !byId[id]) byId[id] = node;+ });+ return byId;+ }+ function collectKinds() {+ var kinds = {};+ var byId = nodesById();+ Object.keys(byId).forEach(function (id) {+ var node = byId[id];+ var value = node.getAttribute('data-node-kind') || 'neutral';+ var kind = kinds[value] || (kinds[value] = { id: value, label: kindLabel(value), nodes: [] });+ kind.nodes.push(node);+ });+ return Object.keys(kinds).map(function (key) { return kinds[key]; }).sort(function (a, b) {+ return b.nodes.length - a.nodes.length || a.label.localeCompare(b.label);+ });+ }+ function edgeGroups() {+ var groups = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var key = edge.getAttribute('data-edge-key') || [from, to, edge.getAttribute('data-edge-label') || ''].join('\u0000');+ if (!groups[key]) groups[key] = { key: key, from: from, to: to, members: [] };+ groups[key].members.push(edge);+ });+ return Object.keys(groups).map(function (key) { return groups[key]; });+ }+ function edgeShapes(edge) {+ if (!edge) return [];+ if (/^(path|line|polyline)$/i.test(edge.tagName || '')) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function legendSourceBounds(entry) {+ var bounds = null;+ Array.prototype.forEach.call(entry.children, function (child) {+ if (child.hasAttribute('data-legend-bridge-runtime')) return;+ var box;+ try { box = child.getBBox(); } catch (_) { return; }+ if (!box || !Number.isFinite(box.x) || !Number.isFinite(box.y)) return;+ var next = { left: box.x, top: box.y, right: box.x + box.width, bottom: box.y + box.height };+ if (!bounds) bounds = next;+ else {+ bounds.left = Math.min(bounds.left, next.left);+ bounds.top = Math.min(bounds.top, next.top);+ bounds.right = Math.max(bounds.right, next.right);+ bounds.bottom = Math.max(bounds.bottom, next.bottom);+ }+ });+ return bounds;+ }+ function layoutLegendEntry(entry) {+ var bounds = legendSourceBounds(entry);+ var hit = entry.querySelector('[data-legend-hit]');+ var badge = entry.querySelector('[data-legend-count-badge]');+ if (!bounds || !hit || !badge) return false;+ var count = entry.getAttribute('data-legend-count') || '0';+ var centerY = (bounds.top + bounds.bottom) / 2;+ var badgeWidth = Math.max(14, count.length * 5 + 8);+ var badgeX = bounds.right + 3;+ var hitX = bounds.left - 5;+ var hitRight = badgeX + badgeWidth + 4;+ hit.setAttribute('x', hitX.toFixed(2));+ hit.setAttribute('y', (centerY - 12).toFixed(2));+ hit.setAttribute('width', Math.max(24, hitRight - hitX).toFixed(2));+ hit.setAttribute('height', '24');+ hit.setAttribute('rx', '4');+ var badgeRect = badge.querySelector('rect');+ var badgeText = badge.querySelector('text');+ badgeRect.setAttribute('x', badgeX.toFixed(2));+ badgeRect.setAttribute('y', (centerY - 7).toFixed(2));+ badgeRect.setAttribute('width', badgeWidth.toFixed(2));+ badgeRect.setAttribute('height', '14');+ badgeRect.setAttribute('rx', '7');+ badgeText.setAttribute('x', (badgeX + badgeWidth / 2).toFixed(2));+ badgeText.setAttribute('y', (centerY + 2.5).toFixed(2));+ return true;+ }+ function layoutLegendBridge() {+ legendEntries.forEach(layoutLegendEntry);+ if (!legendBridge) return;+ Array.prototype.forEach.call(legendBridge.querySelectorAll('[data-legend-zero]'), layoutLegendEntry);+ }+ function decorateLegendBridge() {+ legendEntries = [];+ if (!legendBridge || html.getAttribute('data-embed') === 'true') return false;+ var facts = {};+ collectKinds().forEach(function (kind) { facts[kind.id] = kind; });+ Array.prototype.forEach.call(legendBridge.querySelectorAll('[data-legend-kind]'), function (entry) {+ var kind = entry.getAttribute('data-legend-kind');+ var fact = facts[kind];+ var count = fact ? fact.nodes.length : 0;+ entry.setAttribute('data-legend-count', String(count));+ var hit = document.createElementNS(namespace, 'rect');+ hit.setAttribute('data-legend-bridge-runtime', '');+ hit.setAttribute('data-legend-hit', '');+ hit.setAttribute('aria-hidden', 'true');+ entry.insertBefore(hit, entry.firstChild);+ var badge = document.createElementNS(namespace, 'g');+ badge.setAttribute('data-legend-bridge-runtime', '');+ badge.setAttribute('data-legend-count-badge', '');+ badge.setAttribute('aria-hidden', 'true');+ badge.appendChild(document.createElementNS(namespace, 'rect'));+ var countText = document.createElementNS(namespace, 'text');+ countText.textContent = String(count);+ badge.appendChild(countText);+ entry.appendChild(badge);+ if (!fact || !count) {+ entry.setAttribute('data-legend-zero', '');+ return;+ }+ entry.setAttribute('role', 'button');+ entry.setAttribute('tabindex', legendEntries.length ? '-1' : '0');+ entry.setAttribute('aria-label', 'Inspect ' + fact.label + ', ' + count + ' node' + (count === 1 ? '' : 's'));+ entry.setAttribute('aria-pressed', 'false');+ entry.setAttribute('aria-haspopup', 'dialog');+ entry.setAttribute('aria-controls', 'semantic-lens');+ entry.setAttribute('aria-expanded', 'false');+ legendEntries.push(entry);+ });+ if (!legendEntries.length) return false;+ legendBridge.setAttribute('role', legendEntries.length >= 3 ? 'toolbar' : 'group');+ legendBridge.setAttribute('aria-label', 'Semantic legend');+ syncLegendBridge();+ layoutLegendBridge();+ try {+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(layoutLegendBridge);+ } catch (_) {}+ return true;+ }+ function syncLegendBridge() {+ legendEntries.forEach(function (entry) {+ var selected = selectedKinds.indexOf(entry.getAttribute('data-legend-kind')) >= 0;+ entry.setAttribute('aria-pressed', selected ? 'true' : 'false');+ entry.setAttribute('aria-expanded', !panel.hidden && lensOpener === entry ? 'true' : 'false');+ if (selected) entry.setAttribute('data-legend-selected', '');+ else entry.removeAttribute('data-legend-selected');+ });+ }+ function clearLegendPreview() {+ activeLegendPreview = null;+ svg.removeAttribute('data-legend-preview-active');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer]'), function (element) {+ element.removeAttribute('data-legend-preview-match');+ element.removeAttribute('data-legend-preview-selected');+ element.removeAttribute('data-legend-preview-peer');+ });+ }+ function strongerLegendOwnerActive() {+ return selectedKinds.length > 0 || !panel.hidden || html.getAttribute('data-present') === 'true' ||+ svg.hasAttribute('data-focus-active') || svg.hasAttribute('data-intent-trace-active') ||+ svg.hasAttribute('data-route-picking') || svg.hasAttribute('data-route-active') ||+ svg.hasAttribute('data-story-active') || svg.hasAttribute('data-relationship-preview-active');+ }+ function previewLegendKind(entry) {+ clearLegendPreview();+ if (!entry || strongerLegendOwnerActive()) return false;+ var kind = entry.getAttribute('data-legend-kind');+ var byId = nodesById();+ var matches = Object.keys(byId).filter(function (id) {+ return (byId[id].getAttribute('data-node-kind') || 'neutral') === kind;+ });+ if (!matches.length) return false;+ var chosen = {};+ matches.forEach(function (id) {+ chosen[id] = true;+ byId[id].setAttribute('data-legend-preview-match', '');+ byId[id].setAttribute('data-legend-preview-selected', '');+ });+ edgeGroups().forEach(function (edge) {+ if (!chosen[edge.from] && !chosen[edge.to]) return;+ edge.members.forEach(function (member) { member.setAttribute('data-legend-preview-match', ''); });+ [edge.from, edge.to].forEach(function (id) {+ if (!byId[id] || chosen[id]) return;+ byId[id].setAttribute('data-legend-preview-match', '');+ byId[id].setAttribute('data-legend-preview-peer', '');+ });});+ svg.setAttribute('data-legend-preview-active', kind);+ activeLegendPreview = entry;+ return true;}-- var menu = document.getElementById('export-menu');- var btn = document.getElementById('btn-export');- var items = function () {- return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));- };-- // ---- Clipboard support ----------------------------------------------- function canCopyImage() {- return typeof ClipboardItem !== 'undefined' &&- navigator.clipboard &&- typeof navigator.clipboard.write === 'function';+ function syncLegendPreview() {+ var next = focusedLegendEntry || hoveredLegendEntry;+ if (next === activeLegendPreview) return;+ clearLegendPreview();+ if (next) previewLegendKind(next);}-- // ---- Raster format detection ----------------------------------------- // canvas.toBlob('image/webp') silently returns a PNG on browsers without- // WebP encoding (older Safari), so detect explicitly.- function supports(format) {- if (format === 'svg' || format === 'png') return true;- var mime = format === 'jpeg' ? 'image/jpeg' : 'image/webp';- try {- var c = document.createElement('canvas');- c.width = c.height = 2;- return c.toDataURL(mime).indexOf('data:' + mime) === 0;- } catch (_) { return false; }+ function activateLegendEntry(entry) {+ if (!entry || entry.getAttribute('role') !== 'button') return false;+ clearLegendPreview();+ select(entry.getAttribute('data-legend-kind'));+ return open({ opener: entry });}-- // Gray out unsupported items.- items().forEach(function (it) {- if (it.dataset.format && !supports(it.dataset.format)) {- it.disabled = true;- it.title = 'Not supported by this browser';- it.style.opacity = '0.5';+ function removeFlowOverlay() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-semantic-lens-overlay]'), function (element) {+ element.remove();+ });+ svg.removeAttribute('data-lens-flow-count');+ svg.removeAttribute('data-lens-flow-density');+ }+ function flowGeometry(shape, direction, step) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-hidden');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-lens-match');+ clone.setAttribute('class', 'semantic-lens-flow');+ clone.setAttribute('data-direction', direction);+ clone.setAttribute('pathLength', '1');+ clone.style.setProperty('--lens-flow-delay', (step * 0.08).toFixed(2) + 's');+ return clone;+ }+ function renderFlowOverlay(entries) {+ removeFlowOverlay();+ svg.setAttribute('data-lens-flow-count', String(entries.length));+ if (!entries.length || html.getAttribute('data-embed') === 'true') return false;+ if (entries.length > MAX_LENS_FLOW_EDGES) {+ svg.setAttribute('data-lens-flow-density', 'quiet');+ return false;}- if (it.dataset.action === 'copy' && !canCopyImage()) {- it.disabled = true;- it.title = 'Clipboard image write not supported by this browser';- it.style.opacity = '0.5';+ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'semantic-lens-overlay');+ overlay.setAttribute('data-semantic-lens-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ entries.forEach(function (entry, step) {+ var wrapper = document.createElementNS(namespace, 'g');+ if (entry.edge.members[0].hasAttribute('transform')) {+ wrapper.setAttribute('transform', entry.edge.members[0].getAttribute('transform'));+ }+ edgeShapes(entry.edge.members[0]).forEach(function (shape) {+ wrapper.appendChild(flowGeometry(shape, entry.direction, step));+ });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ if (!overlay.childNodes.length) return false;+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ return true;+ }+ function cleanSvgState() {+ removeFlowOverlay();+ svg.removeAttribute('data-lens-active');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-lens-match], [data-lens-selected], [data-lens-peer]'), function (element) {+ element.removeAttribute('data-lens-match');+ element.removeAttribute('data-lens-selected');+ element.removeAttribute('data-lens-peer');+ });+ }+ function renderKinds() {+ kindsRoot.textContent = '';+ collectKinds().forEach(function (kind) {+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'semantic-lens-kind';+ button.setAttribute('data-kind', kind.id);+ button.setAttribute('aria-pressed', selectedKinds.indexOf(kind.id) >= 0 ? 'true' : 'false');+ button.setAttribute('aria-label', kind.label + ', ' + kind.nodes.length + ' node' + (kind.nodes.length === 1 ? '' : 's'));+ button.disabled = selectedKinds.length >= 2 && selectedKinds.indexOf(kind.id) === -1;+ var swatch = document.createElement('span');+ swatch.className = 'semantic-lens-swatch';+ swatch.setAttribute('aria-hidden', 'true');+ var label = document.createElement('strong');+ label.textContent = kind.label;+ var count = document.createElement('em');+ count.textContent = String(kind.nodes.length);+ button.appendChild(swatch);+ button.appendChild(label);+ button.appendChild(count);+ kindsRoot.appendChild(button);+ });+ }+ function updateHash() {+ try {+ var hash = selectedKinds.length+ ? '#lens=' + selectedKinds.map(encodeURIComponent).join('~')+ : '';+ history.replaceState(null, '', location.pathname + location.search + hash);+ } catch (_) {}+ }+ function updateTrigger() {+ var active = selectedKinds.length > 0;+ trigger.setAttribute('aria-pressed', active ? 'true' : 'false');+ trigger.setAttribute('aria-label', active ? 'Open active semantic lens' : 'Open semantic lens');+ copyBtn.hidden = !active;+ syncLegendBridge();+ }+ function overlapArea(a, b) {+ var width = Math.max(0, Math.min(a.right, b.right) - Math.max(a.left, b.left));+ var height = Math.max(0, Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top));+ return width * height;+ }+ function dockPanel(byId) {+ panel.removeAttribute('data-dock-side');+ if (panel.hidden || !selectedKinds.length || window.innerWidth <= 720) return 'right';+ var panelRect = panel.getBoundingClientRect();+ var containerRect = container.getBoundingClientRect();+ if (!panelRect.width || !panelRect.height) return 'right';+ var selectedRects = Object.keys(byId).filter(function (id) {+ return selectedKinds.indexOf(byId[id].getAttribute('data-node-kind') || 'neutral') >= 0;+ }).map(function (id) { return byId[id].getBoundingClientRect(); });+ var top = panelRect.top;+ var width = panelRect.width;+ var leftCandidate = { left: containerRect.left + 16, right: containerRect.left + 16 + width, top: top, bottom: panelRect.bottom };+ var rightCandidate = { left: containerRect.right - 16 - width, right: containerRect.right - 16, top: top, bottom: panelRect.bottom };+ var leftScore = selectedRects.reduce(function (score, rect) { return score + overlapArea(leftCandidate, rect); }, 0);+ var rightScore = selectedRects.reduce(function (score, rect) { return score + overlapArea(rightCandidate, rect); }, 0);+ var side = leftScore < rightScore ? 'left' : 'right';+ panel.setAttribute('data-dock-side', side);+ return side;+ }+ function applySelection(options) {+ options = options || {};+ cleanSvgState();+ var byId = nodesById();+ var nodeKind = {};+ Object.keys(byId).forEach(function (id) { nodeKind[id] = byId[id].getAttribute('data-node-kind') || 'neutral'; });+ if (!selectedKinds.length) {+ status.textContent = 'Choose a kind to inspect its nodes and touching relationships.';+ updateTrigger();+ renderKinds();+ dockPanel(byId);+ if (options.updateUrl !== false) updateHash();+ return false;}- });- // ---- Toast ----------------------------------------------------------- // A live region only announces CHANGES to an existing node, so the toast- // element is created once up front and updated in place.- var toastEl = document.createElement('div');- toastEl.className = 'archify-toast';- toastEl.setAttribute('role', 'status');- document.body.appendChild(toastEl);- var toastTimer = null;+ var chosen = {};+ selectedKinds.forEach(function (kind) { chosen[kind] = true; });+ Object.keys(byId).forEach(function (id) {+ if (!chosen[nodeKind[id]]) return;+ byId[id].setAttribute('data-lens-match', '');+ byId[id].setAttribute('data-lens-selected', '');+ });- function toast(msg) {- toastEl.textContent = '';+ var touching = 0;+ var forward = 0;+ var reverse = 0;+ var crossKind = selectedKinds.length === 2;+ var matchedFlow = [];+ edgeGroups().forEach(function (edge) {+ var fromKind = nodeKind[edge.from];+ var toKind = nodeKind[edge.to];+ var match = false;+ if (crossKind) {+ if (fromKind === selectedKinds[0] && toKind === selectedKinds[1]) { match = true; forward += 1; }+ if (fromKind === selectedKinds[1] && toKind === selectedKinds[0]) { match = true; reverse += 1; }+ } else if (fromKind === selectedKinds[0] || toKind === selectedKinds[0]) {+ match = true;+ touching += 1;+ }+ if (!match) return;+ var direction = 'within';+ if (crossKind) {+ direction = fromKind === selectedKinds[0] ? 'forward' : 'reverse';+ } else {+ direction = fromKind === selectedKinds[0] && toKind !== selectedKinds[0] ? 'out'+ : (toKind === selectedKinds[0] && fromKind !== selectedKinds[0] ? 'in' : 'within');+ }+ matchedFlow.push({ edge: edge, direction: direction });+ edge.members.forEach(function (member) { member.setAttribute('data-lens-match', ''); });+ if (!crossKind) {+ [edge.from, edge.to].forEach(function (id) {+ if (!byId[id]) return;+ byId[id].setAttribute('data-lens-match', '');+ if (!chosen[nodeKind[id]]) byId[id].setAttribute('data-lens-peer', '');+ });+ }+ });++ svg.setAttribute('data-lens-active', selectedKinds.join(' '));+ renderFlowOverlay(matchedFlow);+ if (crossKind) {+ var total = forward + reverse;+ status.textContent = kindLabel(selectedKinds[0]) + ' → ' + kindLabel(selectedKinds[1]) + ': ' + forward + ' · ' ++ kindLabel(selectedKinds[1]) + ' → ' + kindLabel(selectedKinds[0]) + ': ' + reverse + ' · ' ++ total + ' direct relationship' + (total === 1 ? '' : 's');+ } else {+ var nodeCount = collectKinds().filter(function (kind) { return kind.id === selectedKinds[0]; })[0].nodes.length;+ status.textContent = nodeCount + ' ' + kindLabel(selectedKinds[0]) + ' node' + (nodeCount === 1 ? '' : 's') + ' · ' ++ touching + ' touching relationship' + (touching === 1 ? '' : 's') + ' · connected peers remain visible';+ }+ updateTrigger();+ renderKinds();+ dockPanel(byId);+ if (options.updateUrl !== false) updateHash();+ return true;+ }+ function prepareForLens() {+ clearLegendPreview();+ if (Archify.focus && typeof Archify.focus.clear === 'function') {+ Archify.focus.clear({ updateUrl: false, preserveView: true });+ }+ if (Archify.routeProbe && typeof Archify.routeProbe.clear === 'function') {+ Archify.routeProbe.clear({ updateUrl: false, restoreFocus: false });+ }+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') {+ Archify.intentTrace.clear({ announce: false });+ }+ }+ function select(kind, options) {+ options = options || {};+ clearLegendPreview();+ var exists = collectKinds().some(function (entry) { return entry.id === kind; });+ if (!exists) return false;+ var index = selectedKinds.indexOf(kind);+ if (index >= 0) selectedKinds.splice(index, 1);+ else {+ if (selectedKinds.length >= 2) return false;+ if (!selectedKinds.length) prepareForLens();+ selectedKinds.push(kind);+ }+ return applySelection(options);+ }+ function close(options) {+ options = options || {};+ panel.hidden = true;+ trigger.setAttribute('aria-expanded', 'false');+ updateTrigger();+ if (options.restoreFocus !== false && lensOpener && typeof lensOpener.focus === 'function') lensOpener.focus();+ return false;+ }+ function open(options) {+ options = options || {};+ if (html.getAttribute('data-embed') === 'true') return false;+ lensOpener = options.opener || trigger;+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);+ if (Archify.finder && Archify.finder.isOpen()) Archify.finder.close({ restoreFocus: false });+ if (Archify.radar && Archify.radar.isOpen()) Archify.radar.close({ restoreFocus: false });+ if (Archify.guide && Archify.guide.isOpen()) Archify.guide.close({ restoreFocus: false });+ renderKinds();+ panel.hidden = false;+ trigger.setAttribute('aria-expanded', 'true');+ updateTrigger();requestAnimationFrame(function () {- toastEl.textContent = msg;- toastEl.classList.add('show');+ dockPanel(nodesById());+ var activeButton = kindsRoot.querySelector('[aria-pressed="true"]');+ var firstButton = activeButton || kindsRoot.querySelector('button:not(:disabled)');+ if (firstButton) firstButton.focus();});- clearTimeout(toastTimer);- toastTimer = setTimeout(function () { toastEl.classList.remove('show'); }, 1500);+ return true;}-- function open(focusLast) {- menu.classList.add('open');- btn.setAttribute('aria-expanded', 'true');- var available = items().filter(function (i) { return !i.disabled; });- var target = focusLast ? available[available.length - 1] : available[0];- if (target) target.focus();+ function toggle() { return panel.hidden ? open({ opener: trigger }) : close(); }+ function clear(options) {+ options = options || {};+ selectedKinds = [];+ cleanSvgState();+ panel.removeAttribute('data-dock-side');+ updateTrigger();+ renderKinds();+ status.textContent = 'Choose a kind to inspect its nodes and touching relationships.';+ if (options.updateUrl !== false) updateHash();+ if (options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ if (options.closePanel === true) close({ restoreFocus: false });+ return false;}- function close(focusTrigger) {- menu.classList.remove('open');- btn.setAttribute('aria-expanded', 'false');- if (focusTrigger) btn.focus();+ function fallbackCopy(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }+ function copyLink() {+ if (!selectedKinds.length) return Promise.resolve(false);+ var value = location.href.replace(/#.*$/, '') + '#lens=' + selectedKinds.map(encodeURIComponent).join('~');+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })+ : Promise.resolve(fallbackCopy(value));+ return copy.then(function (copied) {+ copyBtn.textContent = copied ? 'Copied' : 'Copy failed';+ window.setTimeout(function () { copyBtn.textContent = 'Copy link'; }, 1600);+ return copied;+ });+ }+ function syncFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var value = params.get('lens');+ if (!value) {+ if (selectedKinds.length) clear({ updateUrl: false, preserveView: true });+ return;+ }+ var available = collectKinds().map(function (kind) { return kind.id; });+ var requested = value.split('~').filter(function (kind, index, list) {+ return available.indexOf(kind) >= 0 && list.indexOf(kind) === index;+ }).slice(0, 2);+ if (!requested.length) return;+ prepareForLens();+ selectedKinds = requested;+ applySelection({ updateUrl: false });+ } catch (_) {}}- function isOpen() { return menu.classList.contains('open'); }- btn.addEventListener('click', function (e) {- e.stopPropagation();- if (isOpen()) close(false);- else open();+ trigger.addEventListener('click', toggle);+ if (decorateLegendBridge()) {+ legendBridge.addEventListener('click', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (entry) activateLegendEntry(entry);+ });+ legendBridge.addEventListener('pointerover', function (event) {+ if (event.pointerType === 'touch' || (finePointerQuery && !finePointerQuery.matches)) return;+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry || (event.relatedTarget && entry.contains(event.relatedTarget))) return;+ hoveredLegendEntry = entry;+ syncLegendPreview();+ });+ legendBridge.addEventListener('pointerout', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry || (event.relatedTarget && entry.contains(event.relatedTarget))) return;+ if (hoveredLegendEntry === entry) hoveredLegendEntry = null;+ syncLegendPreview();+ });+ legendBridge.addEventListener('focusin', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry) return;+ focusedLegendEntry = entry;+ legendEntries.forEach(function (candidate) {+ candidate.setAttribute('tabindex', candidate === entry ? '0' : '-1');+ });+ syncLegendPreview();+ });+ legendBridge.addEventListener('focusout', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry || (event.relatedTarget && entry.contains(event.relatedTarget))) return;+ if (focusedLegendEntry === entry) focusedLegendEntry = null;+ syncLegendPreview();+ });+ legendBridge.addEventListener('keydown', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry) return;+ if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault();+ activateLegendEntry(entry);+ return;+ }+ var index = legendEntries.indexOf(entry);+ var next = null;+ if (event.key === 'ArrowRight') next = (index + 1) % legendEntries.length;+ else if (event.key === 'ArrowLeft') next = (index - 1 + legendEntries.length) % legendEntries.length;+ else if (event.key === 'Home') next = 0;+ else if (event.key === 'End') next = legendEntries.length - 1;+ if (next === null) return;+ event.preventDefault();+ legendEntries.forEach(function (candidate, candidateIndex) {+ candidate.setAttribute('tabindex', candidateIndex === next ? '0' : '-1');+ });+ legendEntries[next].focus();+ });+ }+ closeBtn.addEventListener('click', function () { close(); });+ clearBtn.addEventListener('click', function () { clear({ preserveView: true }); });+ copyBtn.addEventListener('click', copyLink);+ kindsRoot.addEventListener('click', function (event) {+ var button = event.target.closest('[data-kind]');+ if (!button || button.disabled) return;+ select(button.getAttribute('data-kind'));});- // APG menu-button pattern: ArrowDown/ArrowUp on the trigger opens the menu.- btn.addEventListener('keydown', function (e) {- if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {- e.preventDefault();- if (!isOpen()) open(e.key === 'ArrowUp');- }+ kindsRoot.addEventListener('keydown', function (event) {+ var buttons = Array.prototype.slice.call(kindsRoot.querySelectorAll('button:not(:disabled)'));+ var index = buttons.indexOf(document.activeElement);+ var next = null;+ if (index >= 0 && (event.key === 'ArrowRight' || event.key === 'ArrowDown')) next = (index + 1) % buttons.length;+ else if (index >= 0 && (event.key === 'ArrowLeft' || event.key === 'ArrowUp')) next = (index - 1 + buttons.length) % buttons.length;+ else if (event.key === 'Home' && buttons.length) next = 0;+ else if (event.key === 'End' && buttons.length) next = buttons.length - 1;+ if (next !== null) { event.preventDefault(); buttons[next].focus(); }});- document.addEventListener('click', function (e) {- if (!menu.contains(e.target) && e.target !== btn) close(false);+ panel.addEventListener('keydown', function (event) {+ if (event.key !== 'Escape') return;+ event.preventDefault();+ event.stopPropagation();+ close();+ });+ document.addEventListener('click', function (event) {+ var eventPath = typeof event.composedPath === 'function' ? event.composedPath() : [];+ var clickedInside = eventPath.indexOf(panel) >= 0 || panel.contains(event.target);+ var clickedLauncher = event.target === trigger || legendEntries.some(function (entry) {+ return event.target === entry || entry.contains(event.target);+ });+ if (!panel.hidden && !clickedInside && !clickedLauncher) close({ restoreFocus: false });+ });+ window.addEventListener('hashchange', syncFromHash);+ window.addEventListener('resize', function () {+ if (!panel.hidden && selectedKinds.length) dockPanel(nodesById());+ layoutLegendBridge();});+ renderKinds();+ syncFromHash();- // Keyboard navigation inside the menu.- // Menu items: Up/Down, Home/End.- // Esc closes + returns focus to trigger; Tab closes.- menu.addEventListener('keydown', function (e) {- if (e.key === 'Escape') { e.preventDefault(); close(true); return; }- if (e.key === 'Tab') { close(false); return; }+ return {+ open: open,+ close: close,+ toggle: toggle,+ clear: clear,+ clearPreview: clearLegendPreview,+ select: select,+ copyLink: copyLink,+ isOpen: function () { return !panel.hidden; },+ active: function () { return selectedKinds.length ? selectedKinds.slice() : null; },+ kinds: function () { return collectKinds().map(function (kind) { return { id: kind.id, count: kind.nodes.length }; }); }+ };+ })();- var available = items().filter(function (i) { return !i.disabled; });- var current = available.indexOf(document.activeElement);- switch (e.key) {- case 'ArrowDown':- e.preventDefault();- if (available.length) available[(current + 1 + available.length) % available.length].focus();- break;- case 'ArrowUp':- e.preventDefault();- if (available.length) available[(current - 1 + available.length) % available.length].focus();- break;- case 'Home':- e.preventDefault();- if (available[0]) available[0].focus();- break;- case 'End':- e.preventDefault();- if (available.length) available[available.length - 1].focus();- break;- }- });+ /* ============================================================+ Diagram Guide — a factual command deck over existing interactions.+ Counts come from compiled semantics; actions delegate to Finder, Route+ Probe, Semantic Radar, Semantic Lens, Story Trail, Presentation, theme, export, and+ camera without adding a second command implementation or SVG state.+ ============================================================ */+ Archify.guide = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var trigger = document.getElementById('btn-diagram-guide');+ var panel = document.getElementById('diagram-guide');+ var closeBtn = document.getElementById('diagram-guide-close');+ var stats = document.getElementById('diagram-guide-stats');+ var actions = document.getElementById('diagram-guide-actions');+ var feedback = document.getElementById('diagram-guide-feedback');+ var storyBtn = actions.querySelector('[data-guide-action="story"]');+ var storyCopy = document.getElementById('diagram-guide-story-copy');+ var routePanel = document.getElementById('route-probe');- function runExport(format) {- var base = diagramFilename();- close(true);- return (format === 'svg'- ? Promise.resolve(serializeSvg(1, { autoTheme: true })).then(function (d) {- download(new Blob([d.svgString], { type: 'image/svg+xml;charset=utf-8' }), base + '.svg');- })- : rasterize(format).then(function (blob) {- download(blob, base + '.' + format);- })- ).catch(function (err) {- console.error(err);- alert('Export failed: ' + (err && err.message ? err.message : format));+ function viewCount() {+ return Archify.guidedViews && Number(Archify.guidedViews.count) || 0;+ }+ function relationshipCount() {+ var seen = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var key = edge.getAttribute('data-edge-key') || [+ edge.getAttribute('data-edge-from'),+ edge.getAttribute('data-edge-to'),+ edge.getAttribute('data-edge-label') || ''+ ].join('\u0000');+ seen[key] = true;});+ return Object.keys(seen).length;}-- function runCopy() {- close(true);- if (!canCopyImage()) {- alert('Clipboard image write not supported in this browser.');- return;+ function renderFacts() {+ var nodes = svg.querySelectorAll('[data-node-id]').length;+ var relationships = relationshipCount();+ var views = viewCount();+ stats.textContent = nodes + ' semantic node' + (nodes === 1 ? '' : 's') + ' · ' ++ relationships + ' relationship' + (relationships === 1 ? '' : 's') + ' · ' ++ views + ' guided view' + (views === 1 ? '' : 's');+ storyBtn.disabled = views === 0;+ storyBtn.setAttribute('aria-disabled', views === 0 ? 'true' : 'false');+ storyCopy.textContent = views+ ? 'Walk ' + views + ' authored chapter' + (views === 1 ? '' : 's') + ' and their real relationships.'+ : 'No authored guided story in this diagram.';+ }+ function actionButtons() {+ return Array.prototype.slice.call(actions.querySelectorAll('.diagram-guide-action:not(:disabled)'));+ }+ function close(options) {+ options = options || {};+ panel.hidden = true;+ html.removeAttribute('data-guide-open');+ routePanel.removeAttribute('data-guide-open');+ trigger.setAttribute('aria-expanded', 'false');+ trigger.setAttribute('aria-label', 'Open diagram guide');+ feedback.textContent = '';+ if (options.restoreFocus !== false) trigger.focus();+ return false;+ }+ function open() {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);+ if (Archify.finder && Archify.finder.isOpen()) Archify.finder.close({ restoreFocus: false });+ if (Archify.radar && Archify.radar.isOpen()) Archify.radar.close({ restoreFocus: false });+ if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });+ if (Archify.guidedViews && Archify.guidedViews.isPlaying && Archify.guidedViews.isPlaying()) {+ Archify.guidedViews.pause();}- // WebKit requires ClipboardItem to be constructed synchronously inside- // the user gesture — pass the pending Promise<Blob> as the item value.- // Browsers that reject promise values throw synchronously; fall back- // to awaiting the blob first (works in Chromium/Firefox).- var blobPromise = rasterize('png');- var writePromise;- try {- writePromise = navigator.clipboard.write([new ClipboardItem({ 'image/png': blobPromise })]);- } catch (_) {- writePromise = blobPromise.then(function (blob) {- return navigator.clipboard.write([new ClipboardItem({ 'image/png': blob })]);- });+ if (Archify.routeProbe && Archify.routeProbe.isJourneyPlaying && Archify.routeProbe.isJourneyPlaying()) {+ Archify.routeProbe.pauseJourney({ preserveElapsed: true, reason: 'guide' });}- return writePromise.then(function () {- toast('Copied PNG to clipboard');- }).catch(function (err) {- console.error(err);- alert('Copy failed: ' + (err && err.message ? err.message : 'unknown'));+ renderFacts();+ panel.hidden = false;+ html.setAttribute('data-guide-open', 'true');+ routePanel.setAttribute('data-guide-open', 'true');+ trigger.setAttribute('aria-expanded', 'true');+ trigger.setAttribute('aria-label', 'Close diagram guide');+ feedback.textContent = '';+ requestAnimationFrame(function () {+ var first = actionButtons()[0];+ if (first) first.focus();});+ return true;+ }+ function toggle() { return panel.hidden ? open() : close(); }+ function execute(action) {+ feedback.textContent = '';+ if (action === 'story' && !viewCount()) {+ feedback.textContent = 'This diagram has no authored guided story.';+ return false;+ }+ close({ restoreFocus: false });+ if (action === 'find') return Archify.finder.open();+ if (action === 'route') return Archify.routeProbe.begin({ focusNode: true });+ if (action === 'map') return Archify.radar.open();+ if (action === 'lens') return Archify.semanticLens.open();+ if (action === 'story') return Archify.guidedViews.play();+ if (action === 'present') return Archify.presentation.enter();+ if (action === 'export') return Archify.exportMenu.open();+ if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();+ if (action === 'reset') return Archify.view.reset();+ if (action === 'zoom-in') return Archify.view.zoomIn();+ if (action === 'zoom-out') return Archify.view.zoomOut();+ return false;+ }+ function actionForKey(key) {+ return {+ '/': 'find',+ r: 'route',+ m: 'map',+ l: 'lens',+ p: 'story',+ f: 'present',+ e: 'export',+ t: 'theme',+ s: 'preset',+ '0': 'reset',+ '+': 'zoom-in',+ '=': 'zoom-in',+ '-': 'zoom-out'+ }[key] || null;}- menu.addEventListener('click', function (e) {- var copyBtn = e.target.closest('button[data-action="copy"]');- if (copyBtn && !copyBtn.disabled) { runCopy(); return; }-- var formatBtn = e.target.closest('button[data-format]');- if (formatBtn && !formatBtn.disabled) { runExport(formatBtn.dataset.format); }+ trigger.addEventListener('click', toggle);+ closeBtn.addEventListener('click', function () { close(); });+ actions.addEventListener('click', function (event) {+ var button = event.target.closest('[data-guide-action]');+ if (!button || button.disabled) return;+ event.stopPropagation();+ execute(button.getAttribute('data-guide-action'));+ });+ panel.addEventListener('keydown', function (event) {+ if (event.key === 'Escape' || event.key === '?') {+ event.preventDefault();+ event.stopPropagation();+ close();+ return;+ }+ var buttons = actionButtons();+ var index = buttons.indexOf(document.activeElement);+ var next = null;+ if (index >= 0 && event.key === 'ArrowRight') next = (index + 1) % buttons.length;+ else if (index >= 0 && event.key === 'ArrowDown') next = (index + 1) % buttons.length;+ else if (index >= 0 && event.key === 'ArrowLeft') next = (index - 1 + buttons.length) % buttons.length;+ else if (index >= 0 && event.key === 'ArrowUp') next = (index - 1 + buttons.length) % buttons.length;+ else if (event.key === 'Home' && buttons.length) next = 0;+ else if (event.key === 'End' && buttons.length) next = buttons.length - 1;+ if (next !== null) {+ event.preventDefault();+ event.stopPropagation();+ buttons[next].focus();+ return;+ }+ var action = actionForKey(event.key.length === 1 ? event.key.toLowerCase() : event.key);+ if (!action) return;+ event.preventDefault();+ event.stopPropagation();+ execute(action);+ });+ document.addEventListener('click', function (event) {+ if (!panel.hidden && !panel.contains(event.target) && event.target !== trigger) close({ restoreFocus: false });});- Archify.exportMenu = { open: open, close: close, isOpen: isOpen, run: runExport };-- // Auto-open on page load for demo/screenshot purposes: ?openExport=1- // Wait for fonts (so the menu doesn't flash before typography lands)- // and paint before opening. Fallback timeout for browsers without the- // Font Loading API.- try {- if (new URLSearchParams(window.location.search).get('openExport') === '1') {- var openWhenReady = function () {- requestAnimationFrame(function () { requestAnimationFrame(open); });+ renderFacts();+ return {+ open: open,+ close: close,+ toggle: toggle,+ execute: execute,+ isOpen: function () { return !panel.hidden; },+ facts: function () {+ return {+ nodes: svg.querySelectorAll('[data-node-id]').length,+ relationships: relationshipCount(),+ views: viewCount()};- if (document.fonts && document.fonts.ready) {- document.fonts.ready.then(openWhenReady);- } else {- setTimeout(openWhenReady, 200);- }}- } catch (_) {}+ };})();/* ============================================================Global keyboard shortcuts- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menu+ F -> toggle presentation stage+ M -> toggle Semantic Radar+ L -> toggle Semantic Lens+ R -> start/clear Route Probe+ / -> open node finder or the active route endpoint picker+ + / - -> zoom, 0 -> reset view+ Escape -> clear temporary trace/focus/view first, then exit presentationIgnored when focus is inside an input/textarea/contenteditable.============================================================ */document.addEventListener('keydown', function (e) {if (e.metaKey || e.ctrlKey || e.altKey) return;+ if (e.defaultPrevented) return;var t = e.target;if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;- if (e.key === 't' || e.key === 'T') {+ if (e.key === '?') {+ e.preventDefault();+ Archify.guide.toggle();+ } else if (e.key === '/') {+ e.preventDefault();+ Archify.finder.open();+ } else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();+ } else if (e.key === 'f' || e.key === 'F') {+ e.preventDefault();+ Archify.presentation.toggle();+ } else if (e.key === 'm' || e.key === 'M') {+ e.preventDefault();+ Archify.radar.toggle();+ } else if (e.key === 'l' || e.key === 'L') {+ e.preventDefault();+ Archify.semanticLens.toggle();+ } else if (e.key === 'r' || e.key === 'R') {+ e.preventDefault();+ Archify.routeProbe.toggle({ focusNode: true });+ } else if (e.key === '+' || e.key === '=') {+ e.preventDefault();+ Archify.view.zoomIn();+ } else if (e.key === '-') {+ e.preventDefault();+ Archify.view.zoomOut();+ } else if (e.key === '0') {+ e.preventDefault();+ Archify.view.reset();+ } else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {+ e.preventDefault();+ Archify.semanticLens.close({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.semanticLens.active()) {+ e.preventDefault();+ Archify.semanticLens.clear({ preserveView: true });+ } else if (e.key === 'Escape' && Archify.guide.isOpen()) {+ e.preventDefault();+ Archify.guide.close({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.radar.isOpen()) {+ e.preventDefault();+ Archify.radar.close({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.routeProbe.active()) {+ e.preventDefault();+ Archify.routeProbe.escape({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.intentTrace.active()) {+ e.preventDefault();+ Archify.intentTrace.clear();+ } else if (e.key === 'Escape' && Archify.focus.active()) {+ e.preventDefault();+ Archify.focus.clear();+ } else if (e.key === 'Escape' && Archify.presentation.active()) {+ e.preventDefault();+ Archify.presentation.exit();}});</script>diff --git a/examples/dataflow-product-analytics.html b/examples/dataflow-product-analytics.htmlindex 9fcf73cd..4d4db825 100644--- a/examples/dataflow-product-analytics.html+++ b/examples/dataflow-product-analytics.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4131,7 +4157,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4283,10 +4309,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11177,6 +11247,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11192,6 +11263,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11258,9 +11330,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11284,6 +11357,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/examples/lifecycle-agent-run.html b/examples/lifecycle-agent-run.htmlindex ae6c6be9..0b09fa6b 100644--- a/examples/lifecycle-agent-run.html+++ b/examples/lifecycle-agent-run.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4084,7 +4110,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4236,10 +4262,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11130,6 +11200,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11145,6 +11216,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11211,9 +11283,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11237,6 +11310,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/examples/maka-architecture.architecture.json b/examples/maka-architecture.architecture.jsonindex 208e0ae2..df4beb4a 100644--- a/examples/maka-architecture.architecture.json+++ b/examples/maka-architecture.architecture.json@@ -190,8 +190,9 @@"from": "toolrt","to": "permission","variant": "security",- "fromSide": "top",- "toSide": "bottom"+ "fromSide": "bottom",+ "toSide": "top",+ "via": [[850, 540], [1160, 540], [1160, 100], [850, 100]]}],"cards": [diff --git a/examples/maka-architecture.html b/examples/maka-architecture.htmlindex e7698cb0..8ab7af4c 100644--- a/examples/maka-architecture.html+++ b/examples/maka-architecture.html@@ -1,9 +1,9 @@<!DOCTYPE html>-<html lang="en" data-theme="dark">+<html lang="en" data-theme="dark" data-preset="classic"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">- <meta name="generator" content="archify 2.10.0">+ <meta name="generator" content="archify 2.11.0"><title>Maka Diagram</title><script>// Resolve the theme before first paint so light-preference users don't@@ -14,6 +14,12 @@try {var param = new URLSearchParams(window.location.search).get('theme');if (param === 'light' || param === 'dark') theme = param;+ if (new URLSearchParams(window.location.search).get('embed') === '1') {+ document.documentElement.setAttribute('data-embed', 'true');+ }+ if (new URLSearchParams(window.location.search).get('present') === '1') {+ document.documentElement.setAttribute('data-present', 'true');+ }} catch (_) {}if (!theme) {try { theme = localStorage.getItem('archify-theme'); } catch (_) {}@@ -121,6 +127,150 @@--toolbar-menu-bg: #ffffff;}+ /* ==========================================================+ SIGNAL FLOW — an opt-in, motion-forward visual preset.+ The variables also target a standalone exported SVG, whose+ root carries data-preset and data-theme directly.+ ========================================================== */+ [data-preset="signal-flow"][data-theme="dark"] {+ --bg: #030711;+ --grid: #15233a;+ --panel: rgba(6, 14, 28, 0.78);+ --panel-border: #1d3350;+ --lane-fill: rgba(9, 22, 40, 0.5);+ --lane-stroke: #2c4564;+ --text: #f5fbff;+ --text-muted: #9eb0c7;+ --text-dim: #52667f;+ --text-faint: #7890ad;+ --mask: #07101e;+ --frontend-fill: rgba(6, 182, 212, 0.14);+ --frontend-stroke: #67e8f9;+ --backend-fill: rgba(16, 185, 129, 0.14);+ --backend-stroke: #5eead4;+ --database-fill: rgba(139, 92, 246, 0.16);+ --database-stroke: #c4b5fd;+ --cloud-fill: rgba(245, 158, 11, 0.13);+ --cloud-stroke: #fcd34d;+ --security-fill: rgba(244, 63, 94, 0.13);+ --security-stroke: #fda4af;+ --messagebus-fill: rgba(249, 115, 22, 0.13);+ --messagebus-stroke: #fdba74;+ --external-fill: rgba(71, 85, 105, 0.24);+ --external-stroke: #a5b4c7;+ --arrow: #7890ad;+ --arrow-emphasis: #2dd4bf;+ --toolbar-bg: rgba(7, 16, 30, 0.86);+ --toolbar-border: #29415f;+ --toolbar-menu-bg: #07101e;+ }++ [data-preset="signal-flow"][data-theme="light"] {+ --bg: #f4f9fc;+ --grid: #d4e5ee;+ --panel: rgba(255, 255, 255, 0.82);+ --panel-border: #bfd5e2;+ --lane-fill: rgba(232, 243, 248, 0.62);+ --lane-stroke: #a9c5d5;+ --text: #102638;+ --text-muted: #587287;+ --text-dim: #8aa2b4;+ --text-faint: #668397;+ --mask: #ffffff;+ --frontend-fill: rgba(6, 182, 212, 0.09);+ --frontend-stroke: #0789a1;+ --backend-fill: rgba(5, 150, 105, 0.09);+ --backend-stroke: #087f69;+ --database-fill: rgba(124, 58, 237, 0.09);+ --database-stroke: #7254c7;+ --cloud-fill: rgba(217, 119, 6, 0.08);+ --cloud-stroke: #b9670b;+ --security-fill: rgba(225, 29, 72, 0.08);+ --security-stroke: #c53a59;+ --messagebus-fill: rgba(234, 88, 12, 0.08);+ --messagebus-stroke: #c65f27;+ --external-fill: rgba(100, 116, 139, 0.1);+ --external-stroke: #607a8c;+ --arrow: #7b97aa;+ --arrow-emphasis: #0d9488;+ }++ /* ==========================================================+ BLUEPRINT — a review-first drafting preset for deployment,+ infrastructure, and technical design documentation. It keeps+ the same semantic palette and geometry while trading glow for+ precise grid contrast, squared materials, and drafting marks.+ ========================================================== */+ [data-preset="blueprint"][data-theme="dark"] {+ --bg: #06131f;+ --grid: #17425a;+ --panel: rgba(7, 27, 43, 0.9);+ --panel-border: #27627f;+ --lane-fill: rgba(10, 43, 66, 0.36);+ --lane-stroke: #34799a;+ --text: #e3f6ff;+ --text-muted: #91b8ca;+ --text-dim: #557e92;+ --text-faint: #739caf;+ --mask: #0a2031;+ --frontend-fill: rgba(26, 157, 193, 0.14);+ --frontend-stroke: #66d9ef;+ --backend-fill: rgba(31, 155, 124, 0.13);+ --backend-stroke: #69dfbd;+ --database-fill: rgba(120, 105, 196, 0.14);+ --database-stroke: #b4a8ff;+ --cloud-fill: rgba(197, 145, 43, 0.13);+ --cloud-stroke: #ffd166;+ --security-fill: rgba(199, 76, 104, 0.13);+ --security-stroke: #ff8da1;+ --messagebus-fill: rgba(207, 112, 49, 0.13);+ --messagebus-stroke: #ffad66;+ --external-fill: rgba(84, 119, 139, 0.18);+ --external-stroke: #a7cad9;+ --arrow: #78a3b7;+ --arrow-emphasis: #64dfc1;+ --toolbar-bg: rgba(7, 28, 45, 0.92);+ --toolbar-border: #34799a;+ --toolbar-text: #d8f3ff;+ --toolbar-hover: rgba(18, 58, 83, 0.95);+ --toolbar-menu-bg: #0a2031;+ }++ [data-preset="blueprint"][data-theme="light"] {+ --bg: #edf7fa;+ --grid: #b5d5e1;+ --panel: rgba(249, 253, 255, 0.94);+ --panel-border: #78aabd;+ --lane-fill: rgba(210, 232, 240, 0.42);+ --lane-stroke: #83b2c4;+ --text: #123344;+ --text-muted: #4e7486;+ --text-dim: #86a6b4;+ --text-faint: #668c9d;+ --mask: #f9fdff;+ --frontend-fill: rgba(8, 145, 178, 0.08);+ --frontend-stroke: #087f9c;+ --backend-fill: rgba(5, 128, 101, 0.08);+ --backend-stroke: #08755f;+ --database-fill: rgba(100, 75, 180, 0.08);+ --database-stroke: #6757a8;+ --cloud-fill: rgba(181, 120, 15, 0.08);+ --cloud-stroke: #a86609;+ --security-fill: rgba(190, 48, 80, 0.07);+ --security-stroke: #b32f50;+ --messagebus-fill: rgba(196, 81, 22, 0.07);+ --messagebus-stroke: #b65120;+ --external-fill: rgba(79, 112, 128, 0.08);+ --external-stroke: #506f7e;+ --arrow: #6d93a5;+ --arrow-emphasis: #087f69;+ --toolbar-bg: rgba(247, 252, 254, 0.94);+ --toolbar-border: #8ab5c5;+ --toolbar-text: #294f61;+ --toolbar-hover: #ffffff;+ --toolbar-menu-bg: #f9fdff;+ }+* { margin: 0; padding: 0; box-sizing: border-box; }body {@@ -132,9 +282,233 @@transition: background 0.2s ease, color 0.2s ease;}+ html[data-preset="signal-flow"] body {+ background-image:+ radial-gradient(circle at 18% -8%, rgba(34, 211, 238, 0.14), transparent 34rem),+ radial-gradient(circle at 92% 18%, rgba(139, 92, 246, 0.12), transparent 30rem);+ background-attachment: fixed;+ }+ html[data-preset="signal-flow"][data-theme="light"] body {+ background-image:+ radial-gradient(circle at 18% -8%, rgba(6, 182, 212, 0.12), transparent 34rem),+ radial-gradient(circle at 92% 18%, rgba(139, 92, 246, 0.08), transparent 30rem);+ }+ html[data-preset="blueprint"] body {+ background-image:+ linear-gradient(var(--grid) 1px, transparent 1px),+ linear-gradient(90deg, var(--grid) 1px, transparent 1px);+ background-size: 32px 32px;+ background-position: -1px -1px;+ background-attachment: fixed;+ }++ /* Gallery/embed mode keeps the generated artifact as the source of truth+ while presenting only its diagram surface inside a proof card. */+ html[data-embed="true"] body {+ min-height: 0;+ padding: 0;+ overflow: hidden;+ background: var(--bg);+ background-image: none;+ }+ html[data-embed="true"] .toolbar,+ html[data-embed="true"] .header,+ html[data-embed="true"] .cards,+ html[data-embed="true"] .footer,+ html[data-embed="true"] .diagram-nav,+ html[data-embed="true"] .overview-map,+ html[data-embed="true"] .focus-chip,+ html[data-embed="true"] .route-probe,+ html[data-embed="true"] .semantic-lens,+ html[data-embed="true"] .diagram-guide,+ html[data-embed="true"] .node-finder,+ html[data-embed="true"] .guided-views { display: none !important; }+ html[data-embed="true"] .container { max-width: none; }+ html[data-embed="true"] .diagram-container {+ padding: 0.5rem;+ border: 0;+ border-radius: 0;+ box-shadow: none;+ }+ html[data-embed="true"] .diagram-container svg { min-width: 0; }++ /* Share Chapter Cue lives in the HTML viewer layer, not inside the SVG.+ It gives one-shot embeds a title, authored note, truthful stop order,+ and lifecycle state while canonical diagram geometry stays untouched. */+ .share-chapter-cue { display: none; }+ html[data-embed="true"][data-share-playback="true"] .share-chapter-cue:not([hidden]),+ html[data-embed="true"][data-share-moment="true"] .share-chapter-cue:not([hidden]) {+ position: absolute;+ z-index: 18;+ top: 0.85rem;+ left: 50%;+ display: grid;+ grid-template-columns: auto minmax(9rem, 13.5rem) minmax(0, 1fr);+ align-items: center;+ gap: 0.45rem 0.85rem;+ width: min(52rem, calc(100% - 1.5rem));+ min-height: 3.35rem;+ padding: 0.55rem 0.75rem 0.65rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 42%, var(--toolbar-border));+ border-radius: 0.75rem;+ background:+ linear-gradient(115deg, color-mix(in srgb, var(--frontend-fill) 52%, transparent), transparent 45%),+ color-mix(in srgb, var(--toolbar-menu-bg) 92%, transparent);+ color: var(--toolbar-text);+ box-shadow: 0 14px 42px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.045);+ backdrop-filter: blur(16px);+ pointer-events: none;+ animation: archify-share-cue-enter 280ms cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ html[data-preset="blueprint"] .share-chapter-cue {+ border-radius: 0.2rem;+ background:+ linear-gradient(90deg, color-mix(in srgb, var(--frontend-fill) 46%, transparent), transparent 36%),+ var(--toolbar-menu-bg);+ box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);+ backdrop-filter: none;+ }+ .share-chapter-index {+ display: grid;+ gap: 0.12rem;+ min-width: 5rem;+ padding-right: 0.75rem;+ border-right: 1px solid var(--toolbar-border);+ }+ .share-chapter-state {+ display: inline-flex;+ align-items: center;+ gap: 0.36rem;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.14em;+ text-transform: uppercase;+ }+ .share-chapter-state::before {+ width: 0.38rem;+ height: 0.38rem;+ border-radius: 50%;+ background: currentColor;+ box-shadow: 0 0 10px currentColor;+ content: '';+ }+ .share-chapter-cue[data-state="playing"] .share-chapter-state::before {+ animation: archify-share-cue-pulse 1.15s ease-in-out infinite;+ }+ .share-chapter-count {+ color: var(--text-faint);+ font-size: 0.5rem;+ font-weight: 700;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ }+ .share-chapter-copy { min-width: 0; }+ .share-chapter-copy strong,+ .share-chapter-copy small,+ .share-chapter-route {+ display: block;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .share-chapter-copy strong {+ color: var(--toolbar-text);+ font-size: 0.6875rem;+ line-height: 1.35;+ }+ .share-chapter-copy small {+ margin-top: 0.08rem;+ color: var(--text-muted);+ font-size: 0.5rem;+ line-height: 1.35;+ }+ .share-chapter-route {+ color: color-mix(in srgb, var(--frontend-stroke) 76%, var(--text-muted));+ font-size: 0.5625rem;+ font-weight: 650;+ letter-spacing: 0.015em;+ text-align: right;+ }+ .share-chapter-progress {+ position: absolute;+ right: 0;+ bottom: 0;+ left: 0;+ height: 2px;+ overflow: hidden;+ background: color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ }+ .share-chapter-progress span {+ display: block;+ width: 100%;+ height: 100%;+ background: linear-gradient(90deg, var(--frontend-stroke), var(--database-stroke));+ box-shadow: 0 0 12px var(--frontend-stroke);+ transform: scaleX(0);+ transform-origin: left center;+ }++ /* Presentation Stage is a viewer-only layer: it gives the live diagram+ the viewport while keeping guided views, theme, focus, and exports real.+ Embed mode wins when both query parameters are present. */+ html[data-present="true"]:not([data-embed="true"]) body {+ height: 100dvh;+ min-height: 0;+ padding: 1rem;+ overflow: hidden;+ }+ html[data-present="true"]:not([data-embed="true"]) .container {+ display: flex;+ flex-direction: column;+ gap: 0.75rem;+ width: 100%;+ max-width: none;+ height: calc(100dvh - 2rem);+ }+ html[data-present="true"]:not([data-embed="true"]) .header {+ flex: none;+ min-width: 0;+ margin: 0;+ padding-right: 23rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .header-row { margin-bottom: 0.25rem; }+ html[data-present="true"]:not([data-embed="true"]) .subtitle {+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ html[data-present="true"]:not([data-embed="true"]) .guided-views {+ flex: none;+ margin-bottom: 0;+ }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container {+ display: flex;+ flex: 1 1 auto;+ align-items: center;+ justify-content: center;+ min-height: 0;+ padding: 0.75rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container > svg {+ width: 100%;+ height: 100%;+ min-width: 0;+ }+ html[data-present="true"]:not([data-embed="true"]) .cards,+ html[data-present="true"]:not([data-embed="true"]) .footer { display: none; }+ html[data-present="true"]:not([data-embed="true"]) #btn-present {+ border-color: var(--frontend-stroke);+ color: var(--frontend-stroke);+ }+.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }++ html[data-preset="signal-flow"] .header,+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -148,9 +522,11 @@height: 12px;background: var(--frontend-stroke);border-radius: 50%;- animation: pulse 2s infinite;+ animation: none;}+ html[data-motion-capable="true"] .pulse-dot { animation: pulse 2s infinite; }+@keyframes pulse {0%, 100% { opacity: 1; }50% { opacity: 0.5; }@@ -168,337 +544,3240 @@margin-left: 1.75rem;}+ html[data-preset="signal-flow"] .header-row::after {+ content: "SIGNAL FLOW";+ margin-left: auto;+ color: var(--frontend-stroke);+ border: 1px solid var(--frontend-stroke);+ border-radius: 999px;+ padding: 0.28rem 0.6rem;+ font-size: 0.625rem;+ letter-spacing: 0.12em;+ opacity: 0.82;+ box-shadow: 0 0 20px rgba(34, 211, 238, 0.12);+ white-space: nowrap;+ }++ html[data-preset="blueprint"] .pulse-dot {+ width: 10px;+ height: 10px;+ border: 1px solid var(--frontend-stroke);+ border-radius: 1px;+ background: transparent;+ box-shadow: inset 0 0 0 2px var(--bg);+ transform: rotate(45deg);+ animation: none;+ }+ html[data-preset="blueprint"] .header-row::after {+ content: "BLUEPRINT / REV 01";+ margin-left: auto;+ padding: 0.28rem 0.55rem;+ border-top: 1px solid var(--frontend-stroke);+ border-bottom: 1px solid var(--frontend-stroke);+ color: var(--frontend-stroke);+ font-size: 0.5625rem;+ font-weight: 700;+ letter-spacing: 0.14em;+ white-space: nowrap;+ }+.diagram-container {background: var(--panel);border-radius: 1rem;border: 1px solid var(--panel-border);padding: 1.5rem;- overflow-x: auto;+ overflow: hidden;+ position: relative;}- svg {- width: 100%;- min-width: min(900px, 100%);- display: block;+ html[data-preset="signal-flow"] .diagram-container {+ position: relative;+ overflow: hidden;+ background: linear-gradient(180deg, rgba(8, 20, 38, 0.82), rgba(3, 8, 18, 0.94));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 28px 80px rgba(0, 0, 0, 0.34);}-- .cards {- display: grid;- grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));- gap: 1rem;- margin-top: 2rem;+ html[data-preset="signal-flow"][data-theme="light"] .diagram-container {+ background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(237, 246, 250, 0.94));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 24px 60px rgba(45, 78, 99, 0.12);}-- .card {+ html[data-preset="blueprint"] .diagram-container {+ border-color: var(--panel-border);+ border-radius: 0.35rem;background: var(--panel);- border-radius: 0.75rem;- border: 1px solid var(--panel-border);- padding: 1.25rem;+ box-shadow:+ inset 0 0 0 1px color-mix(in srgb, var(--panel-border) 34%, transparent),+ 0 18px 48px rgba(0, 0, 0, 0.16);}-- .card-header {- display: flex;- align-items: center;- gap: 0.5rem;- margin-bottom: 0.75rem;+ html[data-preset="blueprint"] .diagram-container::after {+ content: "";+ position: absolute;+ z-index: 10;+ inset: 0.7rem;+ pointer-events: none;+ background:+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left top / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left top / 1px 1.35rem no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right top / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right top / 1px 1.35rem no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left bottom / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left bottom / 1px 1.35rem no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right bottom / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right bottom / 1px 1.35rem no-repeat;+ opacity: 0.58;}-- .card-dot {- width: 8px;- height: 8px;- border-radius: 50%;+ html[data-motion-capable="true"][data-preset="signal-flow"][data-ambient-motion="running"] .diagram-container::before {+ content: "";+ position: absolute;+ inset: 0;+ pointer-events: none;+ background: linear-gradient(115deg, transparent 28%, rgba(103, 232, 249, 0.035) 48%, transparent 68%);+ transform: translateX(-70%);+ animation: archify-signal-scan 4.8s ease-in-out 1 both;}- .card-dot.cyan { background: var(--frontend-stroke); }- .card-dot.emerald { background: var(--backend-stroke); }- .card-dot.violet { background: var(--database-stroke); }- .card-dot.amber { background: var(--cloud-stroke); }- .card-dot.rose { background: var(--security-stroke); }- .card-dot.orange { background: var(--messagebus-stroke); }- .card-dot.slate { background: var(--external-stroke); }-- .card h3 { font-size: 0.875rem; font-weight: 600; color: var(--text); }-- .card ul {- list-style: none;- color: var(--text-muted);- font-size: 0.75rem;+ /* Motion Governor gives the reader a real static state and gives the+ strongest semantic action the only motion budget. Atmosphere resets to+ its authored base instead of freezing mid-cycle. Static artifacts never+ start a decorative pulse or scan. */+ html:not([data-motion-capable="true"]) svg[data-animation="trace"] [data-animate] {+ animation: none !important;}-- .card li { margin-bottom: 0.375rem; }-- .footer {- text-align: center;- margin-top: 1.5rem;- color: var(--text-faint);- font-size: 0.75rem;+ html[data-motion="still"] .pulse-dot,+ html[data-motion="still"] .diagram-container::before,+ html[data-motion="still"] svg[data-animation="trace"] [data-animate],+ html[data-motion-owner] .pulse-dot,+ html[data-motion-owner] .diagram-container::before,+ html[data-motion-owner] svg[data-animation="trace"] [data-animate],+ html[data-embed="true"] .pulse-dot,+ html[data-embed="true"] .diagram-container::before,+ html[data-share-playback="true"] .pulse-dot,+ html[data-share-playback="true"] .diagram-container::before,+ html[data-document-hidden="true"] .pulse-dot,+ html[data-document-hidden="true"] .diagram-container::before,+ html[data-document-hidden="true"] svg[data-animation="trace"] [data-animate] {+ animation: none !important;+ }+ html[data-motion="still"] .diagram-container::before,+ html[data-motion-owner] .diagram-container::before,+ html[data-embed="true"] .diagram-container::before,+ html[data-share-playback="true"] .diagram-container::before {+ opacity: 0;+ }+ html[data-motion="still"] .guided-view-progress span,+ html[data-motion="still"] .guided-story-caption,+ html[data-motion="still"] .story-trail-flow,+ html[data-motion="still"] .intent-trace-flow,+ html[data-motion="still"] .route-probe-flow,+ html[data-motion="still"] .route-journey-flow,+ html[data-motion="still"] .semantic-lens-flow,+ html[data-motion="still"] .diagram-guide,+ html[data-motion="still"] [data-story-step],+ html[data-motion="still"] .overview-map-live,+ html[data-motion="still"] .guided-view-stop,+ html[data-motion="still"] .share-chapter-cue,+ html[data-motion="still"] .share-chapter-state::before,+ html[data-motion="still"] .share-chapter-progress span,+ html[data-document-hidden="true"] .guided-view-progress span,+ html[data-document-hidden="true"] .story-trail-flow,+ html[data-document-hidden="true"] .intent-trace-flow,+ html[data-document-hidden="true"] .route-probe-flow,+ html[data-document-hidden="true"] .route-journey-flow,+ html[data-document-hidden="true"] .semantic-lens-flow,+ html[data-document-hidden="true"] .diagram-guide,+ html[data-document-hidden="true"] [data-story-step],+ html[data-document-hidden="true"] .overview-map-live,+ html[data-document-hidden="true"] .guided-view-stop,+ html[data-document-hidden="true"] .share-chapter-cue,+ html[data-document-hidden="true"] .share-chapter-state::before,+ html[data-document-hidden="true"] .share-chapter-progress span {+ animation: none !important;+ }+ html[data-motion="still"] .guided-view-progress span {+ transform: scaleX(1) !important;+ }+ html[data-motion="still"] svg[data-story-playing="true"] .story-trail-flow {+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.55;+ }+ html[data-motion="still"] .intent-trace-flow,+ html[data-motion="still"] .route-probe-flow {+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.72;+ }+ html[data-motion="still"] .route-journey-overlay,+ html[data-document-hidden="true"] .route-journey-overlay { display: none !important; }+ html[data-motion="still"] .relationship-pulse-overlay,+ html[data-motion="still"] .story-carrier-overlay,+ html[data-document-hidden="true"] .story-carrier-overlay { display: none !important; }+ html[data-motion="still"] .chapter-handoff-overlay { display: none !important; }+ html[data-motion="still"] .chapter-handoff-anchor { animation: none !important; }+ html[data-motion="still"] .guided-view-chapter,+ html[data-motion="still"] svg [data-node-id],+ html[data-motion="still"] svg [data-edge-from],+ html[data-motion="still"] svg [data-detail],+ html[data-motion="still"] svg [data-detail-anchor],+ html[data-motion="still"] svg [data-legend-hit],+ html[data-motion="still"] svg {+ transition: none !important;}- /* ==========================================================- Print stylesheet — hide interactive controls, force light,- drop the grid so the diagram doesn't waste ink, use landscape- so wide diagrams fit, pack summary cards into 2 columns to- avoid an orphan card on a trailing page.- ========================================================== */- @page { size: landscape; margin: 1.5cm; }+ svg {+ width: 100%;+ min-width: min(900px, 100%);+ display: block;+ transform-origin: 0 0;+ transition: transform 0.18s ease;+ }- @media print {- /* Force the FULL light palette — including component fills/strokes and- lane/arrow colors — so printing from dark theme doesn't put neon- strokes and translucent dark fills on white paper. */- :root, [data-theme="dark"], [data-theme="light"] {- --bg: #ffffff;- --grid: transparent;- --panel: #ffffff;- --panel-border: #e2e8f0;- --text: #0f172a;- --text-muted: #475569;- --text-dim: #94a3b8;- --text-faint: #64748b;- --mask: #ffffff;- --lane-fill: rgba(248, 250, 252, 0.65);- --lane-stroke: #cbd5e1;- --arrow: #94a3b8;- --arrow-emphasis: #059669;- --frontend-fill: rgba(34, 211, 238, 0.15);- --frontend-stroke: #0891b2;- --backend-fill: rgba(52, 211, 153, 0.18);- --backend-stroke: #059669;- --database-fill: rgba(167, 139, 250, 0.2);- --database-stroke: #7c3aed;- --cloud-fill: rgba(251, 191, 36, 0.18);- --cloud-stroke: #d97706;- --security-fill: rgba(251, 113, 133, 0.15);- --security-stroke: #e11d48;- --messagebus-fill: rgba(251, 146, 60, 0.15);- --messagebus-stroke:#ea580c;- --external-fill: rgba(148, 163, 184, 0.18);- --external-stroke: #64748b;- }- body { background: #ffffff !important; padding: 0; }- .container { max-width: none; }- .toolbar, .archify-toast, .no-print { display: none !important; }- .diagram-container, .card { box-shadow: none; border-color: #e2e8f0; }- .cards { grid-template-columns: 1fr 1fr; }- /* Ensure elements break sensibly across pages */- .card { break-inside: avoid; page-break-inside: avoid; }- .diagram-container { break-inside: avoid; page-break-inside: avoid; }- h1, .subtitle { color: #0f172a; }+ .diagram-container.is-camera-moving svg {+ transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);}+ .diagram-container.is-camera-transaction svg { transition: none; }+ .diagram-container.is-pannable { cursor: grab; }+ .diagram-container.is-panning { cursor: grabbing; user-select: none; }+ .diagram-container.is-panning svg { transition: none; }- /* ==========================================================- TOOLBAR (theme toggle + export menu)- ========================================================== */- .toolbar {- position: fixed;- top: 1rem;+ .diagram-nav {+ position: absolute;right: 1rem;- display: flex;- gap: 0.5rem;- z-index: 100;- }- .toolbar button {+ bottom: 1rem;+ z-index: 12;+ display: inline-flex;+ align-items: center;+ padding: 0.25rem;+ gap: 0.2rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.65rem;background: var(--toolbar-bg);+ box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);+ backdrop-filter: blur(10px);+ }+ .diagram-nav button,+ .focus-chip button,+ .guided-views button {+ border: 0;+ background: transparent;color: var(--toolbar-text);- border: 1px solid var(--toolbar-border);- padding: 0.5rem 0.875rem;- border-radius: 0.5rem;- font-family: inherit;- font-size: 0.75rem;- font-weight: 500;+ font: inherit;cursor: pointer;- backdrop-filter: blur(8px);- transition: background 0.15s, border-color 0.15s;- display: inline-flex;- align-items: center;- gap: 0.375rem;}- .toolbar button:hover {- background: var(--toolbar-hover);- border-color: var(--arrow);+ .diagram-nav button {+ min-width: 2rem;+ height: 2rem;+ padding: 0 0.45rem;+ border-radius: 0.4rem;+ font-size: 0.75rem;+ font-weight: 600;}- .toolbar button:focus-visible {+ .diagram-nav button:hover,+ .diagram-nav button:focus-visible,+ .focus-chip button:hover,+ .focus-chip button:focus-visible,+ .guided-views button:hover,+ .guided-views button:focus-visible { background: var(--toolbar-hover); }+ .diagram-nav button:focus-visible,+ .focus-chip button:focus-visible,+ .guided-views button:focus-visible {outline: 2px solid var(--frontend-stroke);- outline-offset: 2px;- }- .toolbar .export-wrap { position: relative; }- .toolbar .export-menu {- position: absolute;- top: calc(100% + 0.375rem);- right: 0;- background: var(--toolbar-menu-bg);- border: 1px solid var(--toolbar-border);- border-radius: 0.5rem;- padding: 0.375rem;- min-width: 160px;- display: none;- flex-direction: column;- box-shadow: 0 4px 20px rgba(0,0,0,0.25);+ outline-offset: 1px;}- .toolbar .export-menu.open { display: flex; }- .toolbar .export-menu button {- background: transparent;- border: 0;- justify-content: space-between;- width: 100%;- text-align: left;- padding: 0.5rem 0.75rem;+ .diagram-nav button:disabled { opacity: 0.38; cursor: default; }+ .diagram-nav [data-view="reset"] { min-width: 3.35rem; font-size: 0.625rem; }+ .diagram-container[data-camera-indicator="true"] .diagram-nav [data-view="reset"] {+ min-width: 5.2rem;+ color: var(--frontend-stroke);}- .toolbar .export-menu button:hover {+ .diagram-nav #btn-diagram-guide[aria-expanded="true"] {+ color: var(--cloud-stroke);background: var(--toolbar-hover);}- .toolbar .export-menu .hint {- color: var(--text-faint);++ /* Semantic Radar is a deliberately simplified, viewer-only overview. It+ uses authored node bounds and the live camera viewport rather than+ cloning the canonical SVG, so IDs, filters, animation, and export state+ stay singular and deterministic. */+ .overview-map {+ position: absolute;+ right: 1rem;+ bottom: 4.15rem;+ z-index: 12;+ width: 11.25rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 52%, var(--toolbar-border));+ border-radius: 0.78rem;+ background: var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 16px 42px rgba(0, 0, 0, 0.3);+ backdrop-filter: blur(16px);font-size: 0.625rem;}- .toolbar .export-menu hr {+ .overview-map[hidden] { display: none; }+ .overview-map[data-docked="true"] {+ position: fixed;+ right: var(--archify-radar-right, 1rem);+ top: var(--archify-radar-top, 1rem);+ bottom: auto;+ }+ .overview-map[data-docked="true"][data-dock-side="left"] {+ right: auto;+ left: var(--archify-radar-left, 1rem);+ }+ html[data-preset="blueprint"] .overview-map { border-radius: 0.28rem; }+ .overview-map-head {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.45rem;+ min-height: 2.25rem;+ padding: 0.42rem 0.48rem 0.38rem 0.55rem;+ border-bottom: 1px solid var(--toolbar-border);+ background: linear-gradient(110deg, color-mix(in srgb, var(--frontend-fill) 45%, transparent), transparent 68%);+ }+ .overview-map-live {+ width: 0.42rem;+ height: 0.42rem;+ border-radius: 50%;+ background: var(--backend-stroke);+ box-shadow: 0 0 0 0 color-mix(in srgb, var(--backend-stroke) 52%, transparent);+ animation: archify-radar-live 2.4s ease-out infinite;+ }+ .overview-map-copy { min-width: 0; line-height: 1.1; }+ .overview-map-copy strong {+ display: block;+ overflow: hidden;+ color: var(--frontend-stroke);+ font-size: 0.59rem;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+ .overview-map-copy small {+ display: block;+ margin-top: 0.18rem;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.52rem;+ letter-spacing: 0.04em;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+ .overview-map-close {+ width: 1.55rem;+ height: 1.55rem;+ padding: 0;+ border: 0;+ border-radius: 0.34rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 0.9rem;+ cursor: pointer;+ }+ .overview-map-close:hover,+ .overview-map-close:focus-visible { background: var(--toolbar-hover); }+ .overview-map-close:focus-visible,+ .overview-map-surface:focus-visible,+ .overview-map-node:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .overview-map-surface {+ position: relative;+ height: 7rem;+ margin: 0.42rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--panel-border) 72%, transparent);+ border-radius: 0.42rem;+ background:+ linear-gradient(color-mix(in srgb, var(--panel-border) 26%, transparent) 1px, transparent 1px),+ linear-gradient(90deg, color-mix(in srgb, var(--panel-border) 26%, transparent) 1px, transparent 1px),+ color-mix(in srgb, var(--bg) 86%, transparent);+ background-size: 12px 12px;+ cursor: crosshair;+ touch-action: none;+ }+ html[data-preset="blueprint"] .overview-map-surface { border-radius: 0.1rem; }+ .overview-map-surface > svg {+ width: 100%;+ height: 100%;+ min-width: 0;+ transform: none !important;+ transition: none !important;+ display: block;+ overflow: visible;+ }+ .overview-map-node {+ fill: var(--backend-stroke);+ fill-opacity: 0.52;+ stroke: var(--backend-stroke);+ stroke-opacity: 0.86;+ vector-effect: non-scaling-stroke;+ cursor: pointer;+ transition: fill-opacity 140ms ease, stroke-width 140ms ease, filter 140ms ease;+ }+ .overview-map-node[data-kind="frontend"],+ .overview-map-node[data-kind="start"] { fill: var(--frontend-stroke); stroke: var(--frontend-stroke); }+ .overview-map-node[data-kind="database"],+ .overview-map-node[data-kind="success"] { fill: var(--database-stroke); stroke: var(--database-stroke); }+ .overview-map-node[data-kind="cloud"],+ .overview-map-node[data-kind="waiting"] { fill: var(--cloud-stroke); stroke: var(--cloud-stroke); }+ .overview-map-node[data-kind="messagebus"] { fill: var(--messagebus-stroke); stroke: var(--messagebus-stroke); }+ .overview-map-node[data-kind="security"],+ .overview-map-node[data-kind="decision"],+ .overview-map-node[data-kind="failure"] { fill: var(--security-stroke); stroke: var(--security-stroke); }+ .overview-map-node[data-kind="external"],+ .overview-map-node[data-kind="neutral"] { fill: var(--external-stroke); stroke: var(--external-stroke); }+ .overview-map-node[data-radar-active="true"],+ .overview-map-node:hover,+ .overview-map-node:focus-visible {+ fill-opacity: 0.92;+ stroke-width: 2.2;+ filter: drop-shadow(0 0 3px currentColor);+ }+ .overview-map-viewport {+ fill: color-mix(in srgb, var(--frontend-fill) 56%, transparent);+ stroke: var(--frontend-stroke);+ stroke-width: 2;+ vector-effect: non-scaling-stroke;+ pointer-events: none;+ filter: drop-shadow(0 0 3px color-mix(in srgb, var(--frontend-stroke) 54%, transparent));+ }+ .overview-map-hint {+ display: flex;+ justify-content: space-between;+ gap: 0.5rem;+ padding: 0 0.52rem 0.46rem;+ color: var(--text-faint);+ font-size: 0.49rem;+ letter-spacing: 0.06em;+ text-transform: uppercase;+ }+ .diagram-nav #btn-overview-map[aria-expanded="true"] {+ color: var(--frontend-stroke);+ background: var(--toolbar-hover);+ }+ .diagram-nav #btn-route-probe[aria-pressed="true"] {+ color: var(--backend-stroke);+ background: var(--toolbar-hover);+ }+ .diagram-nav #btn-semantic-lens[aria-expanded="true"],+ .diagram-nav #btn-semantic-lens[aria-pressed="true"] {+ color: var(--database-stroke);+ background: var(--toolbar-hover);+ }++ /* Semantic Lens turns the compiled node-kind palette into an analytical+ legend. One kind reveals its real traffic; two kinds compare only their+ direct authored relationships. Geometry and the canonical SVG stay put. */+ .semantic-lens {+ position: absolute;+ right: 1rem;+ bottom: 4.15rem;+ z-index: 24;+ width: min(20rem, calc(100% - 2rem));+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--database-stroke) 58%, var(--toolbar-border));+ border-radius: 0.82rem;+ background:+ linear-gradient(135deg, color-mix(in srgb, var(--database-fill) 34%, transparent), transparent 48%),+ var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 52px rgba(0, 0, 0, 0.36);+ backdrop-filter: blur(18px);+ animation: archify-lens-in 180ms cubic-bezier(0.22, 1, 0.36, 1);+ }+ .semantic-lens[hidden] { display: none; }+ .semantic-lens[data-dock-side="left"] { left: 1rem; right: auto; }+ .semantic-lens[data-dock-side="right"] { left: auto; right: 1rem; }+ html[data-preset="blueprint"] .semantic-lens { border-radius: 0.28rem; }+ .semantic-lens-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 0.75rem;+ padding: 0.72rem 0.78rem 0.62rem;+ border-bottom: 1px solid var(--toolbar-border);+ }+ .semantic-lens-eyebrow {+ display: block;+ color: var(--database-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.16em;+ text-transform: uppercase;+ }+ .semantic-lens-title {+ display: block;+ margin-top: 0.16rem;+ color: var(--text);+ font-size: 0.82rem;+ letter-spacing: -0.02em;+ }+ .semantic-lens-close {+ width: 1.75rem;+ height: 1.75rem;+ padding: 0;border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 1rem;+ cursor: pointer;+ }+ .semantic-lens-close:hover,+ .semantic-lens-close:focus-visible { background: var(--toolbar-hover); }+ .semantic-lens-instruction {+ margin: 0;+ padding: 0.52rem 0.78rem 0.48rem;+ color: var(--text-faint);+ font-size: 0.55rem;+ line-height: 1.45;+ }+ .semantic-lens-kinds {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 0.3rem;+ max-height: min(15rem, 40vh);+ padding: 0 0.5rem 0.5rem;+ overflow-y: auto;+ scrollbar-width: thin;+ }+ .semantic-lens-kind {+ --lens-color: var(--external-stroke);+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.42rem;+ min-width: 0;+ min-height: 2.15rem;+ padding: 0.35rem 0.42rem;+ border: 1px solid color-mix(in srgb, var(--lens-color) 24%, var(--toolbar-border));+ border-radius: 0.45rem;+ background: color-mix(in srgb, var(--panel) 76%, transparent);+ color: var(--toolbar-text);+ font: inherit;+ text-align: left;+ cursor: pointer;+ transition: border-color 140ms ease, background 140ms ease, opacity 140ms ease;+ }+ html[data-preset="blueprint"] .semantic-lens-kind { border-radius: 0.12rem; }+ .semantic-lens-kind[data-kind="frontend"],+ .semantic-lens-kind[data-kind="start"] { --lens-color: var(--frontend-stroke); }+ .semantic-lens-kind[data-kind="backend"],+ .semantic-lens-kind[data-kind="active"] { --lens-color: var(--backend-stroke); }+ .semantic-lens-kind[data-kind="database"],+ .semantic-lens-kind[data-kind="success"] { --lens-color: var(--database-stroke); }+ .semantic-lens-kind[data-kind="cloud"],+ .semantic-lens-kind[data-kind="waiting"] { --lens-color: var(--cloud-stroke); }+ .semantic-lens-kind[data-kind="messagebus"] { --lens-color: var(--messagebus-stroke); }+ .semantic-lens-kind[data-kind="security"],+ .semantic-lens-kind[data-kind="decision"],+ .semantic-lens-kind[data-kind="failure"] { --lens-color: var(--security-stroke); }+ .semantic-lens-kind:hover,+ .semantic-lens-kind:focus-visible,+ .semantic-lens-kind[aria-pressed="true"] {+ border-color: color-mix(in srgb, var(--lens-color) 78%, var(--toolbar-border));+ background: color-mix(in srgb, var(--lens-color) 11%, var(--panel));+ }+ .semantic-lens-kind:focus-visible,+ .semantic-lens-close:focus-visible,+ .semantic-lens-actions button:focus-visible {+ outline: 2px solid var(--database-stroke);+ outline-offset: 1px;+ }+ .semantic-lens-kind:disabled { opacity: 0.34; cursor: default; }+ .semantic-lens-swatch {+ width: 0.48rem;+ height: 0.48rem;+ border-radius: 50%;+ background: var(--lens-color);+ box-shadow: 0 0 8px color-mix(in srgb, var(--lens-color) 58%, transparent);+ }+ .semantic-lens-kind strong {+ overflow: hidden;+ color: var(--text);+ font-size: 0.61rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-lens-kind em {+ color: var(--lens-color);+ font-size: 0.54rem;+ font-style: normal;+ font-weight: 800;+ }+ .semantic-lens-status {+ min-height: 2.5rem;+ margin: 0;+ padding: 0.55rem 0.78rem;border-top: 1px solid var(--toolbar-border);- margin: 0.25rem 0.375rem;- opacity: 0.5;+ color: var(--text-faint);+ font-size: 0.55rem;+ line-height: 1.45;+ }+ .semantic-lens-status strong { color: var(--database-stroke); font-weight: 800; }+ .semantic-lens-actions {+ display: flex;+ justify-content: flex-end;+ gap: 0.28rem;+ padding: 0 0.62rem 0.62rem;+ }+ .semantic-lens-actions button {+ min-height: 1.8rem;+ padding: 0.28rem 0.48rem;+ border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 0.56rem;+ cursor: pointer;+ }+ .semantic-lens-actions button:hover { background: var(--toolbar-hover); }+ .semantic-lens-actions #semantic-lens-copy { color: var(--database-stroke); }+ @keyframes archify-lens-in {+ from { opacity: 0; transform: translateY(5px) scale(0.985); }+ to { opacity: 1; transform: translateY(0) scale(1); }}- /* Toast — brief feedback for actions like "copied" */- .archify-toast {- position: fixed;+ /* Route Probe answers a reader question over the compiled semantic graph:+ choose two stable nodes and reveal the shortest authored directed route.+ The receipt and signal live entirely in the viewer layer. */+ .route-probe {+ position: absolute;+ left: 1rem;+ bottom: 1rem;+ z-index: 12;+ width: min(46rem, calc(100% - 25rem));+ min-width: 18rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--backend-stroke) 62%, var(--toolbar-border));+ border-radius: 0.82rem;+ background:+ linear-gradient(115deg, color-mix(in srgb, var(--backend-fill) 50%, transparent), transparent 62%),+ var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);+ backdrop-filter: blur(16px);+ font-size: 0.625rem;+ }+ .route-probe[hidden] { display: none; }+ .route-probe[data-route-dock="top"] {top: 1rem;- left: 50%;- transform: translateX(-50%) translateY(-8px);- background: var(--toolbar-menu-bg);+ bottom: auto;+ }+ html[data-preset="blueprint"] .route-probe { border-radius: 0.25rem; }+ .route-probe-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 0.65rem;+ padding: 0.52rem 0.58rem 0.44rem;+ border-bottom: 1px solid color-mix(in srgb, var(--toolbar-border) 80%, transparent);+ }+ .route-probe-copy { min-width: 0; }+ .route-probe-eyebrow {+ display: block;+ color: var(--backend-stroke);+ font-size: 0.48rem;+ font-weight: 800;+ letter-spacing: 0.15em;+ text-transform: uppercase;+ }+ .route-probe-title {+ display: block;+ margin-top: 0.14rem;+ overflow: hidden;+ color: var(--toolbar-text);+ font-size: 0.72rem;+ line-height: 1.25;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+ .route-probe-actions { display: flex; gap: 0.2rem; }+ .route-probe button {+ min-height: 1.55rem;+ padding: 0.25rem 0.42rem;+ border: 0;+ border-radius: 0.36rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ cursor: pointer;+ }+ .route-probe button:hover,+ .route-probe button:focus-visible { background: var(--toolbar-hover); }+ .route-probe button:focus-visible {+ outline: 2px solid var(--backend-stroke);+ outline-offset: 1px;+ }+ .route-probe-copy-link { color: var(--frontend-stroke) !important; }+ .route-probe-find { color: var(--backend-stroke) !important; }+ .route-probe-copy-link[hidden] { display: none; }+ .route-probe-find[hidden] { display: none; }+ .route-probe-path {+ display: flex;+ align-items: center;+ min-height: 2.2rem;+ padding: 0.42rem 0.58rem 0.24rem;+ overflow-x: auto;+ scrollbar-width: thin;+ white-space: nowrap;+ }+ .route-probe-node,+ .route-probe button.route-probe-node {+ flex: none;+ max-width: 9.5rem;+ overflow: hidden;+ min-height: 1.75rem !important;+ padding: 0.22rem 0.38rem;+ border: 1px solid color-mix(in srgb, var(--backend-stroke) 46%, var(--toolbar-border));+ border-radius: 999px;+ background: color-mix(in srgb, var(--backend-fill) 52%, transparent);color: var(--text);- border: 1px solid var(--toolbar-border);- padding: 0.5rem 1rem;- border-radius: 0.5rem;- font-family: inherit;- font-size: 0.75rem;- opacity: 0;- transition: opacity 0.2s, transform 0.2s;- z-index: 200;- pointer-events: none;- box-shadow: 0 4px 20px rgba(0,0,0,0.25);+ font-size: 0.56rem;+ font-weight: 700;+ text-overflow: ellipsis;+ white-space: nowrap;}- .archify-toast.show {+ .route-probe-node[data-endpoint="start"] {+ border-color: var(--frontend-stroke);+ color: var(--frontend-stroke);+ }+ .route-probe-node[data-endpoint="end"] {+ border-color: var(--security-stroke);+ color: var(--security-stroke);+ }+ .route-probe-node[data-route-journey-state="past"] { opacity: 0.66; }+ .route-probe-node[data-route-journey-state="future"] { opacity: 0.48; }+ .route-probe-node[aria-current="step"] {+ border-color: var(--backend-stroke);+ background: color-mix(in srgb, var(--backend-fill) 82%, var(--toolbar-menu-bg));+ color: var(--text);+ box-shadow: 0 0 0 1px color-mix(in srgb, var(--backend-stroke) 42%, transparent), 0 0 14px color-mix(in srgb, var(--backend-stroke) 34%, transparent);opacity: 1;- transform: translateX(-50%) translateY(0);}-- @media (max-width: 720px) {- body { padding: 1rem; }- .toolbar {- position: static;- justify-content: flex-end;- margin-bottom: 1rem;- }- .header { margin-bottom: 1.25rem; }- .header-row {- gap: 0.75rem;- align-items: flex-start;- }- h1 {- font-size: 1.25rem;- line-height: 1.25;- }- .subtitle {- margin-left: 0;- font-size: 0.8125rem;- line-height: 1.55;- }- .diagram-container {- padding: 0.75rem;- border-radius: 0.75rem;- }- .cards {- grid-template-columns: 1fr;- margin-top: 1rem;- }+ html[data-preset="blueprint"] .route-probe-node[aria-current="step"] {+ border-style: double;+ border-width: 3px;+ border-radius: 0.2rem;+ box-shadow: none;}+ .route-probe-arrow {+ flex: none;+ padding: 0 0.28rem;+ color: var(--text-faint);+ font-size: 0.65rem;+ }+ .route-probe-placeholder {+ color: var(--text-faint);+ font-size: 0.56rem;+ letter-spacing: 0.03em;+ }+ .route-probe-status {+ display: block;+ min-height: 1.45rem;+ padding: 0.08rem 0.58rem 0.44rem;+ color: var(--text-faint);+ font-size: 0.52rem;+ line-height: 1.35;+ }+ .route-journey-controls {+ display: grid;+ grid-template-columns: 2rem minmax(5.8rem, auto) 2rem minmax(4.8rem, auto);+ justify-content: start;+ gap: 0.22rem;+ padding: 0.08rem 0.58rem 0.28rem;+ }+ .route-journey-controls[hidden] { display: none; }+ .route-journey-controls button {+ min-height: 1.8rem;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 86%, transparent);+ background: color-mix(in srgb, var(--toolbar-bg) 72%, transparent);+ font-size: 0.54rem;+ font-weight: 700;+ }+ .route-journey-controls button:disabled {+ cursor: default;+ opacity: 0.34;+ }+ .route-journey-play { color: var(--backend-stroke) !important; }+ .route-journey-overview { color: var(--frontend-stroke) !important; }+ .route-journey-controls[data-playing="true"] .route-journey-play {+ border-color: color-mix(in srgb, var(--backend-stroke) 64%, var(--toolbar-border));+ background: color-mix(in srgb, var(--backend-fill) 62%, transparent);+ }+ .route-probe[data-state="error"] {+ border-color: color-mix(in srgb, var(--security-stroke) 72%, var(--toolbar-border));+ }+ .route-probe[data-state="error"] .route-probe-status { color: var(--security-stroke); }- /* ==========================================================- SVG SEMANTIC CLASSES — use these instead of inline fill/stroke- ========================================================== */- .c-grid { stroke: var(--grid); fill: none; }- .c-mask { fill: var(--mask); stroke: none; }-- .c-frontend { fill: var(--frontend-fill); stroke: var(--frontend-stroke); }- .c-backend { fill: var(--backend-fill); stroke: var(--backend-stroke); }- .c-database { fill: var(--database-fill); stroke: var(--database-stroke); }- .c-cloud { fill: var(--cloud-fill); stroke: var(--cloud-stroke); }- .c-security { fill: var(--security-fill); stroke: var(--security-stroke); }- .c-messagebus { fill: var(--messagebus-fill); stroke: var(--messagebus-stroke); }- .c-external { fill: var(--external-fill); stroke: var(--external-stroke); }-- /* Text helpers */- .t-primary { fill: var(--text); }- .t-muted { fill: var(--text-muted); }- .t-dim { fill: var(--text-dim); }- .t-frontend { fill: var(--frontend-stroke); }- .t-backend { fill: var(--backend-stroke); }- .t-database { fill: var(--database-stroke); }- .t-cloud { fill: var(--cloud-stroke); }- .t-security { fill: var(--security-stroke); }- .t-messagebus { fill: var(--messagebus-stroke); }- .t-external { fill: var(--external-stroke); }-- /* Arrows */- .a-default { stroke: var(--arrow); fill: none; }- .a-emphasis { stroke: var(--arrow-emphasis); fill: none; }- .a-security { stroke: var(--security-stroke); fill: none; stroke-dasharray: 5,5; }- .a-dashed { stroke: var(--database-stroke); fill: none; stroke-dasharray: 4,4; }-- /* Arrowhead markers reference these */- .m-default { fill: var(--arrow); }- .m-emphasis { fill: var(--arrow-emphasis); }- .m-security { fill: var(--security-stroke); }- .m-dashed { fill: var(--database-stroke); }-- /* Dashed boundary variants */- .c-security-group { fill: transparent; stroke: var(--security-stroke); stroke-dasharray: 4,4; }- .c-region { fill: rgba(251, 191, 36, 0.05); stroke: var(--cloud-stroke); stroke-dasharray: 8,4; }- .c-lane { fill: var(--lane-fill); stroke: var(--lane-stroke); stroke-dasharray: 6,6; }-- /* Optional trace animation, enabled only by meta.animation = "trace".- Static diagrams do not carry data-animation and render exactly as before. */- svg[data-animation="trace"] [data-animate="edge"] {- stroke-dasharray: 10 8;- stroke-dashoffset: 54;- animation: archify-edge-flow 2.4s linear infinite;- animation-delay: calc(var(--step, 0) * 160ms);+ .focus-chip {+ position: absolute;+ left: 1rem;+ top: 1rem;+ z-index: 12;+ display: block;+ width: min(22rem, calc(100% - 13rem));+ max-width: calc(100% - 13rem);+ overflow: hidden;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.85rem;+ background: var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);+ backdrop-filter: blur(16px);+ font-size: 0.6875rem;}- svg[data-animation="trace"] [data-animate="node"] {- transform-box: fill-box;- transform-origin: center;- animation: archify-node-pulse 3.6s ease-in-out infinite;- animation-delay: calc(var(--step, 0) * 160ms);+ .focus-chip[hidden] { display: none; }+ html[data-preset="blueprint"] .focus-chip { border-radius: 0.3rem; }+ .focus-chip button {+ flex: none;+ padding: 0.3rem 0.45rem;+ border-radius: 0.35rem;+ font-size: 0.625rem;}- @keyframes archify-edge-flow {- to { stroke-dashoffset: 0; }+ .relationship-lens-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 0.75rem;+ padding: 0.7rem 0.75rem 0.65rem;+ border-bottom: 1px solid var(--toolbar-border);+ background: linear-gradient(120deg, color-mix(in srgb, var(--frontend-fill) 34%, transparent), transparent 72%);}- @keyframes archify-node-pulse {- 0%, 72%, 100% { filter: none; stroke-width: 1.5; }- 18%, 36% {- filter: drop-shadow(0 0 8px var(--arrow-emphasis));- stroke-width: 2.4;- }+ .relationship-lens-copy { min-width: 0; }+ .relationship-lens-actions {+ display: flex;+ flex-direction: column;+ align-items: stretch;+ gap: 0.18rem;}- @media (prefers-reduced-motion: reduce) {- svg[data-animation="trace"] [data-animate] {- animation: none !important;- stroke-dashoffset: 0;- }+ .relationship-lens-actions button { white-space: nowrap; }+ .relationship-lens-actions #btn-focus-copy { color: var(--frontend-stroke); }+ .relationship-lens-actions #btn-focus-relations { display: none; }+ .relationship-lens-eyebrow {+ display: block;+ margin-bottom: 0.18rem;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.14em;+ text-transform: uppercase;}- </style>-</head>-<body>- <!-- Toolbar: theme toggle + export menu (present on every generated diagram)- Keyboard: T toggles theme, E opens export menu (when no input focused) -->- <div class="toolbar" role="toolbar" aria-label="Diagram actions">- <button id="btn-theme" type="button"- title="Toggle theme (T)"- aria-label="Toggle color theme"- aria-pressed="false">+ .relationship-lens-title {+ display: block;+ overflow: hidden;+ color: var(--text);+ font-size: 0.8rem;+ line-height: 1.35;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-detail {+ display: block;+ margin-top: 0.12rem;+ overflow: hidden;+ color: var(--text-muted);+ font-size: 0.625rem;+ line-height: 1.4;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-detail[hidden] { display: none; }+ .semantic-passport-meta {+ display: flex;+ flex-wrap: wrap;+ gap: 0.24rem;+ margin-top: 0.42rem;+ }+ .semantic-passport-meta span,+ .semantic-passport-meta code {+ max-width: 100%;+ overflow: hidden;+ padding: 0.14rem 0.34rem;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 82%, transparent);+ border-radius: 999px;+ background: color-mix(in srgb, var(--panel) 68%, transparent);+ color: var(--text-faint);+ font: inherit;+ font-size: 0.5rem;+ letter-spacing: 0.04em;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-meta [data-passport="kind"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 50%, var(--toolbar-border));+ color: var(--frontend-stroke);+ font-weight: 800;+ text-transform: uppercase;+ }+ .semantic-passport-meta [data-passport="tag"] { color: var(--cloud-stroke); }+ .semantic-passport-meta [hidden] { display: none; }+ html[data-preset="blueprint"] .semantic-passport-meta span,+ html[data-preset="blueprint"] .semantic-passport-meta code { border-radius: 0.1rem; }+ .relationship-lens-summary {+ display: block;+ margin-top: 0.12rem;+ color: var(--text-faint);+ font-size: 0.5625rem;+ }+ .relationship-lens-list {+ max-height: min(18rem, 46vh);+ overflow: auto;+ padding: 0.4rem;+ scrollbar-width: thin;+ scrollbar-color: var(--frontend-stroke) transparent;+ }+ .relationship-lens-list::-webkit-scrollbar { width: 4px; }+ .relationship-lens-list::-webkit-scrollbar-thumb {+ border-radius: 999px;+ background: color-mix(in srgb, var(--frontend-stroke) 68%, transparent);+ }+ .relationship-lens-group + .relationship-lens-group { margin-top: 0.35rem; }+ .relationship-lens-group-title {+ display: block;+ padding: 0.24rem 0.38rem 0.16rem;+ color: var(--text-faint);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ }+ .relationship-lens-row {+ display: grid;+ grid-template-columns: 2.1rem minmax(0, 1fr);+ gap: 0.06rem 0.45rem;+ width: 100%;+ padding: 0.45rem 0.5rem !important;+ text-align: left;+ }+ .relationship-lens-row:hover,+ .relationship-lens-row:focus-visible,+ .relationship-lens-row[data-preview-active="true"] {+ background: var(--toolbar-hover);+ box-shadow: inset 2px 0 0 var(--frontend-stroke);+ }+ .relationship-lens-row:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: -2px;+ }+ .relationship-lens-direction {+ grid-row: 1 / 3;+ align-self: center;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.08em;+ }+ .relationship-lens-row[data-direction="in"] .relationship-lens-direction { color: var(--database-stroke); }+ .relationship-lens-row[data-direction="loop"] .relationship-lens-direction { color: var(--security-stroke); }+ .relationship-lens-row strong {+ overflow: hidden;+ color: var(--text);+ font-size: 0.6875rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .relationship-lens-row small {+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5625rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .relationship-lens-empty {+ margin: 0;+ padding: 0.75rem;+ color: var(--text-faint);+ font-size: 0.625rem;+ text-align: center;+ }++ /* Diagram Guide keeps the artifact's growing reader vocabulary+ discoverable without widening the permanent control bar. It derives+ honest counts at runtime and delegates every action to an existing+ production interaction instead of creating a second command system. */+ .diagram-guide {+ position: absolute;+ top: 1rem;+ right: 1rem;+ z-index: 26;+ width: min(32rem, calc(100% - 2rem));+ max-height: min(42rem, calc(100% - 2rem));+ overflow: auto;+ border: 1px solid color-mix(in srgb, var(--cloud-stroke) 58%, var(--toolbar-border));+ border-radius: 0.82rem;+ background:+ linear-gradient(135deg, color-mix(in srgb, var(--cloud-fill) 32%, transparent), transparent 42%),+ var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 22px 64px rgba(0, 0, 0, 0.4);+ backdrop-filter: blur(18px);+ animation: archify-guide-in 180ms cubic-bezier(0.22, 1, 0.36, 1);+ }+ .diagram-guide[hidden] { display: none; }+ html[data-preset="blueprint"] .diagram-guide { border-radius: 0.28rem; }+ .diagram-guide-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 1rem;+ padding: 0.82rem 0.9rem 0.68rem;+ border-bottom: 1px solid var(--toolbar-border);+ }+ .diagram-guide-eyebrow {+ display: block;+ color: var(--cloud-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.16em;+ text-transform: uppercase;+ }+ .diagram-guide-title {+ display: block;+ margin-top: 0.16rem;+ color: var(--text);+ font-size: 0.86rem;+ letter-spacing: -0.02em;+ }+ .diagram-guide-close {+ width: 1.8rem;+ height: 1.8rem;+ border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 1rem;+ cursor: pointer;+ }+ .diagram-guide-close:hover,+ .diagram-guide-close:focus-visible { background: var(--toolbar-hover); }+ .diagram-guide-stats {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ margin: 0;+ padding: 0.54rem 0.9rem;+ border-bottom: 1px solid color-mix(in srgb, var(--toolbar-border) 74%, transparent);+ color: var(--text-faint);+ font-size: 0.56rem;+ letter-spacing: 0.025em;+ }+ .diagram-guide-stats::before {+ content: '';+ width: 0.42rem;+ height: 0.42rem;+ flex: none;+ border-radius: 50%;+ background: var(--backend-stroke);+ box-shadow: 0 0 10px color-mix(in srgb, var(--backend-stroke) 72%, transparent);+ }+ .diagram-guide-actions {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 0.38rem;+ padding: 0.62rem;+ }+ .diagram-guide-action {+ --guide-accent: var(--frontend-stroke);+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.55rem;+ min-height: 4.15rem;+ padding: 0.55rem 0.58rem;+ border: 1px solid color-mix(in srgb, var(--guide-accent) 22%, var(--toolbar-border));+ border-radius: 0.55rem;+ background: color-mix(in srgb, var(--panel) 78%, transparent);+ color: var(--toolbar-text);+ font: inherit;+ text-align: left;+ cursor: pointer;+ transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;+ }+ .diagram-guide-action[data-guide-action="route"] { --guide-accent: var(--backend-stroke); }+ .diagram-guide-action[data-guide-action="map"] { --guide-accent: var(--database-stroke); }+ .diagram-guide-action[data-guide-action="lens"] { --guide-accent: var(--messagebus-stroke); }+ .diagram-guide-action[data-guide-action="story"] { --guide-accent: var(--security-stroke); }+ .diagram-guide-action[data-guide-action="present"] {+ --guide-accent: var(--cloud-stroke);+ }+ .diagram-guide-action:hover,+ .diagram-guide-action:focus-visible {+ border-color: color-mix(in srgb, var(--guide-accent) 76%, var(--toolbar-border));+ background: color-mix(in srgb, var(--guide-accent) 9%, var(--panel));+ transform: translateY(-1px);+ }+ .diagram-guide-action:focus-visible,+ .diagram-guide-close:focus-visible {+ outline: 2px solid var(--cloud-stroke);+ outline-offset: 1px;+ }+ .diagram-guide-action:disabled {+ opacity: 0.42;+ cursor: default;+ transform: none;+ }+ .diagram-guide-index {+ display: grid;+ place-items: center;+ width: 1.65rem;+ height: 1.65rem;+ border: 1px solid color-mix(in srgb, var(--guide-accent) 64%, var(--toolbar-border));+ border-radius: 0.35rem;+ color: var(--guide-accent);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.06em;+ }+ .diagram-guide-action-copy { min-width: 0; }+ .diagram-guide-action strong {+ display: block;+ overflow: hidden;+ color: var(--text);+ font-size: 0.66rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .diagram-guide-action small {+ display: -webkit-box;+ margin-top: 0.18rem;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5rem;+ line-height: 1.35;+ -webkit-box-orient: vertical;+ -webkit-line-clamp: 2;+ }+ .diagram-guide kbd {+ align-self: start;+ min-width: 1.45rem;+ padding: 0.12rem 0.3rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.25rem;+ color: var(--text-faint);+ font: inherit;+ font-size: 0.5rem;+ text-align: center;+ }+ .diagram-guide-shortcuts {+ display: flex;+ flex-wrap: wrap;+ gap: 0.34rem 0.62rem;+ padding: 0.58rem 0.9rem 0.68rem;+ border-top: 1px solid var(--toolbar-border);+ color: var(--text-faint);+ font-size: 0.5rem;+ }+ .diagram-guide-shortcuts span {+ display: inline-flex;+ align-items: center;+ gap: 0.28rem;+ white-space: nowrap;+ }+ .diagram-guide-feedback {+ min-height: 1rem;+ margin: -0.18rem 0.9rem 0.62rem;+ color: var(--security-stroke);+ font-size: 0.5rem;+ }+ .diagram-guide-feedback:empty { display: none; }+ @keyframes archify-guide-in {+ from { opacity: 0; transform: translateY(-5px) scale(0.985); }+ to { opacity: 1; transform: translateY(0) scale(1); }+ }++ .node-finder {+ position: absolute;+ top: 1rem;+ left: 1rem;+ z-index: 24;+ width: min(22rem, calc(100% - 2rem));+ overflow: hidden;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.85rem;+ background: var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34);+ backdrop-filter: blur(16px);+ }+ .node-finder[hidden] { display: none; }+ .node-finder[data-context="route-source"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 68%, var(--toolbar-border));+ }+ .node-finder[data-context="route-target"] {+ border-color: color-mix(in srgb, var(--security-stroke) 68%, var(--toolbar-border));+ }+ html[data-preset="blueprint"] .node-finder { border-radius: 0.3rem; }+ .node-finder-head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 1rem;+ padding: 0.7rem 0.8rem 0.45rem;+ }+ .node-finder-head strong {+ color: var(--text);+ font-size: 0.6875rem;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ }+ .node-finder[data-context="route-source"] .node-finder-head strong { color: var(--frontend-stroke); }+ .node-finder[data-context="route-target"] .node-finder-head strong { color: var(--security-stroke); }+ .node-finder-close {+ width: 1.75rem;+ height: 1.75rem;+ border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 1rem;+ cursor: pointer;+ }+ .node-finder-close:hover,+ .node-finder-close:focus-visible { background: var(--toolbar-hover); }+ .node-finder-close:focus-visible,+ .node-finder-input:focus-visible,+ .node-finder-result:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: -2px;+ }+ .node-finder-search {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.55rem;+ margin: 0 0.55rem 0.55rem;+ padding: 0 0.7rem;+ min-height: 2.6rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.55rem;+ background: color-mix(in srgb, var(--panel) 78%, transparent);+ }+ html[data-preset="blueprint"] .node-finder-search { border-radius: 0.18rem; }+ .node-finder-search > span { color: var(--frontend-stroke); font-size: 0.875rem; }+ .node-finder-input {+ width: 100%;+ min-width: 0;+ border: 0;+ outline: 0;+ background: transparent;+ color: var(--text);+ font: inherit;+ font-size: 0.75rem;+ }+ .node-finder-input::placeholder { color: var(--text-faint); }+ .node-finder kbd {+ padding: 0.1rem 0.32rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.25rem;+ color: var(--text-faint);+ font: inherit;+ font-size: 0.5625rem;+ }+ .node-finder-results {+ display: grid;+ gap: 0.18rem;+ max-height: min(18rem, 48vh);+ margin: 0;+ padding: 0 0.55rem 0.55rem;+ overflow-y: auto;+ overscroll-behavior: contain;+ scrollbar-width: thin;+ }+ .node-finder-result {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ gap: 0.2rem 0.75rem;+ width: 100%;+ padding: 0.55rem 0.65rem;+ border: 0;+ border-radius: 0.45rem;+ background: transparent;+ color: var(--text);+ font: inherit;+ text-align: left;+ cursor: pointer;+ }+ html[data-preset="blueprint"] .node-finder-result { border-radius: 0.12rem; }+ .node-finder-result:hover,+ .node-finder-result:focus-visible { background: var(--toolbar-hover); }+ .node-finder-result strong {+ overflow: hidden;+ font-size: 0.75rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .node-finder-result small {+ grid-column: 1 / -1;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5625rem;+ letter-spacing: 0.03em;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .node-finder-result em {+ align-self: center;+ color: var(--frontend-stroke);+ font-size: 0.625rem;+ font-style: normal;+ }+ .node-finder[data-context^="route-"] .node-finder-result em {+ padding: 0.1rem 0.3rem;+ border: 1px solid color-mix(in srgb, currentColor 52%, transparent);+ border-radius: 999px;+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.05em;+ text-transform: uppercase;+ }+ .node-finder[data-context="route-target"] .node-finder-result em { color: var(--security-stroke); }+ .node-finder-empty {+ padding: 1.1rem 0.75rem 1.25rem;+ color: var(--text-faint);+ font-size: 0.6875rem;+ text-align: center;+ }+ .node-finder-status {+ padding: 0.5rem 0.8rem;+ border-top: 1px solid var(--toolbar-border);+ color: var(--text-faint);+ font-size: 0.5625rem;+ }++ .guided-views {+ display: grid;+ grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem auto;+ align-items: stretch;+ gap: 0.35rem;+ min-width: 0;+ margin: 0 0 0.75rem;+ padding: 0.35rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.85rem;+ background: var(--toolbar-bg);+ background: linear-gradient(120deg, var(--toolbar-bg), color-mix(in srgb, var(--toolbar-bg) 82%, var(--frontend-fill)));+ box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16);+ backdrop-filter: blur(12px);+ }+ .guided-views[hidden] { display: none; }++ html[data-preset="blueprint"] .guided-views {+ border-color: var(--panel-border);+ border-radius: 0.35rem;+ background:+ linear-gradient(90deg, color-mix(in srgb, var(--frontend-fill) 36%, transparent), transparent 24%),+ var(--toolbar-bg);+ box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);+ }+ html[data-preset="blueprint"] .guided-views button { border-radius: 0.2rem; }+ html[data-preset="blueprint"] .guided-view-progress { border-radius: 0; }+ html[data-preset="blueprint"] .guided-view-progress span { border-radius: 0; }+ .guided-views button {+ min-width: 0;+ padding: 0.45rem 0.6rem;+ border-radius: 0.55rem;+ font-size: 0.75rem;+ }+ .guided-views > #guided-view-prev,+ .guided-views > #guided-view-next { min-width: 2.75rem; min-height: 2.75rem; }+ .guided-views button:disabled { opacity: 0.3; cursor: default; }+ .guided-view-copy {+ min-width: 0;+ padding: 0.2rem 0.5rem;+ border-left: 1px solid var(--toolbar-border);+ overflow: hidden;+ }+ .guided-view-meta {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ min-height: 1rem;+ margin-bottom: 0.12rem;+ color: var(--frontend-stroke);+ font-size: 0.5625rem;+ font-weight: 700;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ }+ .guided-view-handoff {+ box-sizing: border-box;+ height: 1rem;+ min-width: 0;+ max-width: 15rem;+ overflow: hidden;+ padding: 0 0.38rem;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 46%, transparent);+ border-radius: 999px;+ color: var(--toolbar-text);+ background: color-mix(in srgb, var(--frontend-fill) 44%, transparent);+ font-size: 0.5rem;+ line-height: calc(1rem - 2px);+ letter-spacing: 0.06em;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .guided-view-handoff[hidden] { display: none; }+ html[data-preset="blueprint"] .guided-view-handoff { border-radius: 0.15rem; }+ .chapter-handoff-overlay { pointer-events: none; }+ .chapter-handoff-anchor {+ fill: color-mix(in srgb, var(--frontend-fill) 10%, transparent);+ stroke: var(--frontend-stroke);+ stroke-width: 2;+ stroke-dasharray: 4 4;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ animation: archify-chapter-anchor 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ svg[data-chapter-handoff] [data-node-id][data-chapter-role="stay"] { opacity: 1; }+ svg[data-chapter-handoff] [data-node-id][data-chapter-role="enter"] { opacity: 0.78; }+ svg[data-chapter-handoff] [data-node-id][data-chapter-role="leave"] { opacity: 0.26; }+ @keyframes archify-chapter-anchor {+ 0% { opacity: 0.35; stroke-dashoffset: 8; }+ 45% { opacity: 1; }+ 100% { opacity: 0.72; stroke-dashoffset: 0; }+ }+ .guided-view-progress {+ width: 3.5rem;+ height: 2px;+ overflow: hidden;+ border-radius: 999px;+ background: var(--toolbar-border);+ }+ .guided-view-progress span {+ display: block;+ width: 100%;+ height: 100%;+ border-radius: inherit;+ background: var(--frontend-stroke);+ transform: scaleX(0);+ transform-origin: left center;+ }+ .guided-view-copy strong,+ .guided-view-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+ .guided-view-copy strong { color: var(--toolbar-text); font-size: 0.75rem; line-height: 1.35; }+ .guided-view-copy small { margin-top: 0; color: var(--text-muted); font-size: 0.625rem; line-height: 1.35; }+ .guided-story-caption {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ gap: 0.12rem 0.55rem;+ align-items: center;+ min-width: 0;+ margin-top: 0.18rem;+ padding: 0.3rem 0.5rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 32%, var(--toolbar-border));+ border-radius: 0.58rem;+ background: color-mix(in srgb, var(--frontend-fill) 26%, transparent);+ animation: archify-story-caption-in 140ms cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ .guided-story-caption[hidden] { display: none; }+ .guided-story-caption-index {+ grid-row: 1 / span 2;+ align-self: stretch;+ display: inline-grid;+ min-width: 3.3rem;+ place-items: center;+ padding-right: 0.52rem;+ border-right: 1px solid color-mix(in srgb, var(--frontend-stroke) 28%, var(--toolbar-border));+ color: var(--frontend-stroke);+ font-size: 0.5625rem;+ font-weight: 800;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ }+ .guided-story-caption strong,+ .guided-story-caption small {+ display: block;+ min-width: 0;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .guided-story-caption strong { color: var(--toolbar-text); font-size: 0.6875rem; line-height: 1.3; }+ .guided-story-caption small { color: var(--text-muted); font-size: 0.5625rem; line-height: 1.35; }+ .guided-story-caption-next {+ grid-column: 3;+ grid-row: 1 / span 2;+ display: grid;+ min-width: 6.4rem;+ max-width: 9.5rem;+ align-self: stretch;+ align-content: center;+ padding-left: 0.58rem;+ border-left: 1px solid color-mix(in srgb, var(--frontend-stroke) 22%, var(--toolbar-border));+ }+ .guided-story-caption-next[hidden] { display: none; }+ .guided-story-caption-next small {+ color: color-mix(in srgb, var(--frontend-stroke) 72%, var(--text-muted));+ font-weight: 800;+ letter-spacing: 0.09em;+ text-transform: uppercase;+ }+ .guided-story-caption-next strong { color: var(--text-muted); font-weight: 700; }+ html[data-preset="blueprint"] .guided-story-caption { border-radius: 0.2rem; }+ .guided-views[data-story-beat] .guided-view-copy > #guided-view-label,+ .guided-views[data-story-beat] .guided-view-copy > #guided-view-note { display: none; }+ @keyframes archify-story-caption-in {+ from { opacity: 0; transform: translateY(3px); }+ to { opacity: 1; transform: translateY(0); }+ }+ .guided-view-trail {+ display: flex;+ align-items: center;+ gap: 0.28rem;+ min-width: 0;+ min-height: 1.7rem;+ margin-top: 0;+ padding: 0;+ overflow-x: auto;+ color: var(--text-faint);+ overscroll-behavior-x: contain;+ touch-action: pan-x;+ scrollbar-width: none;+ white-space: nowrap;+ }+ .guided-view-trail[hidden] { display: none; }+ .guided-view-trail::-webkit-scrollbar { display: none; }+ .guided-view-trail .guided-view-stop {+ appearance: none;+ box-sizing: border-box;+ display: inline-flex;+ flex: 0 0 auto;+ align-items: center;+ gap: 0.28rem;+ min-height: 1.5rem;+ padding: 0.1rem 0.3rem 0.1rem 0.18rem;+ border: 1px solid transparent;+ border-radius: 999px;+ background: transparent;+ color: var(--text-muted);+ cursor: pointer;+ font-family: inherit;+ font-size: 0.5625rem;+ font-weight: 650;+ letter-spacing: 0.02em;+ line-height: 1;+ transition: background 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;+ }+ .guided-view-stop:hover {+ border-color: color-mix(in srgb, var(--frontend-stroke) 36%, transparent);+ background: color-mix(in srgb, var(--frontend-fill) 34%, transparent);+ }+ .guided-view-stop:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .guided-view-stop:disabled { cursor: wait; }+ .guided-view-stop::before {+ display: inline-grid;+ width: 1rem;+ height: 1rem;+ place-items: center;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 54%, var(--toolbar-border));+ border-radius: 50%;+ background: color-mix(in srgb, var(--frontend-fill) 58%, var(--toolbar-bg));+ color: var(--frontend-stroke);+ content: attr(data-story-number);+ font-size: 0.5rem;+ line-height: 1;+ }+ .guided-view-stop + .guided-view-stop::after {+ order: -1;+ color: color-mix(in srgb, var(--frontend-stroke) 58%, var(--text-faint));+ content: '\00b7';+ font-size: 0.65rem;+ }+ .guided-view-stop[data-story-link="forward"]::after { content: '\2192'; }+ .guided-view-stop[data-story-link="reverse"]::after { content: '\2190'; }+ .guided-view-stop[data-story-link="multiple"]::after { content: '\21c4'; }+ .guided-view-stop[data-story-beat-state="pending"] { opacity: 0.38; }+ .guided-view-stop[data-story-beat-state="next"] {+ border-style: dashed;+ border-color: color-mix(in srgb, var(--frontend-stroke) 42%, var(--toolbar-border));+ color: color-mix(in srgb, var(--toolbar-text) 68%, var(--text-muted));+ opacity: 0.58;+ }+ .guided-view-stop[data-story-beat-state="past"] { color: var(--text-muted); opacity: 0.76; }+ .guided-view-stop[data-story-beat-state="active"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 72%, var(--toolbar-border));+ background: color-mix(in srgb, var(--frontend-fill) 42%, transparent);+ color: var(--toolbar-text);+ font-weight: 800;+ opacity: 1;+ }+ .guided-view-stop[data-story-beat-state="active"]::before {+ border-color: var(--frontend-stroke);+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 54%, transparent);+ }+ html[data-preset="blueprint"] .guided-view-stop,+ html[data-preset="blueprint"] .guided-view-stop::before { border-radius: 0.1rem; }+ html[data-preset="blueprint"] .guided-view-stop[data-story-beat-state="active"]::before { box-shadow: none; }+ .guided-view-actions { display: flex; align-items: stretch; gap: 0.2rem; }+ .guided-view-actions button { white-space: nowrap; }+ .guided-view-play {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 0.38rem;+ min-width: 6.25rem !important;+ color: var(--frontend-stroke) !important;+ font-size: 0.625rem !important;+ }+ .guided-view-play[aria-pressed="true"] { background: var(--toolbar-hover); }+ .guided-view-all { min-width: 3.25rem !important; color: var(--text-muted) !important; font-size: 0.625rem !important; }+ .guided-view-beat-link {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 0.3rem;+ min-width: 5.4rem !important;+ min-height: 1.5rem;+ color: var(--text-muted) !important;+ font-size: 0.5625rem !important;+ letter-spacing: 0.025em;+ transition: background 140ms ease, border-color 140ms ease, color 140ms ease;+ }+ .guided-view-beat-link:not(:disabled):hover {+ border-color: color-mix(in srgb, var(--frontend-stroke) 52%, var(--toolbar-border));+ color: var(--frontend-stroke) !important;+ }+ .guided-view-beat-link[data-copy-state="copied"] {+ border-color: color-mix(in srgb, var(--backend-stroke) 58%, var(--toolbar-border));+ background: color-mix(in srgb, var(--backend-fill) 46%, transparent);+ color: var(--backend-stroke) !important;+ }+ .guided-view-index {+ grid-column: 1 / -1;+ min-width: 0;+ padding: 0.28rem 0.12rem 0.08rem;+ overflow: hidden;+ border-top: 1px solid color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ }+ @media (min-width: 721px) {+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-index,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-beat-link,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-all,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-trail,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-copy > #guided-view-label,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-copy > #guided-view-note { display: none; }+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-story-caption { margin-top: 0.08rem; }+ }+ .guided-view-chapters {+ display: flex;+ gap: 0.28rem;+ min-width: 0;+ margin: 0;+ padding: 0.08rem 0.05rem 0.2rem;+ overflow-x: auto;+ list-style: none;+ scroll-padding-inline: 0.05rem;+ scroll-snap-type: x proximity;+ scrollbar-width: none;+ }+ .guided-view-chapters::-webkit-scrollbar { display: none; }+ .guided-view-chapters li {+ display: flex;+ flex: 1 1 0;+ min-width: 9.5rem;+ scroll-snap-align: center;+ }+ .guided-view-chapter {+ position: relative;+ display: grid !important;+ grid-template-columns: 1.55rem minmax(0, 1fr) auto;+ align-items: center;+ width: 100%;+ min-height: 2.75rem;+ padding: 0.36rem 0.48rem !important;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 86%, transparent) !important;+ border-radius: 0.48rem !important;+ background: color-mix(in srgb, var(--toolbar-bg) 88%, transparent) !important;+ color: var(--text-muted) !important;+ text-align: left;+ transition: background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;+ }+ .guided-view-chapter:hover {+ border-color: color-mix(in srgb, var(--frontend-stroke) 58%, var(--toolbar-border)) !important;+ background: color-mix(in srgb, var(--frontend-fill) 42%, var(--toolbar-bg)) !important;+ }+ .guided-view-chapter:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .guided-view-chapter-index {+ display: inline-grid;+ width: 1.32rem;+ height: 1.32rem;+ place-items: center;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 48%, var(--toolbar-border));+ border-radius: 50%;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.03em;+ }+ .guided-view-chapter-title {+ min-width: 0;+ overflow: hidden;+ color: var(--toolbar-text);+ font-size: 0.625rem;+ font-weight: 700;+ line-height: 1.3;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .guided-view-chapter-count {+ grid-column: 3;+ grid-row: 1;+ margin-left: 0.38rem;+ color: var(--text-faint);+ font-size: 0.5rem;+ font-style: normal;+ font-weight: 650;+ white-space: nowrap;+ }+ .guided-view-chapter-delta {+ display: inline-flex;+ grid-column: 3;+ grid-row: 1;+ align-items: center;+ gap: 0.22rem;+ margin-left: 0.38rem;+ color: var(--text-faint);+ font-size: 0.5rem;+ font-weight: 750;+ letter-spacing: 0.01em;+ white-space: nowrap;+ }+ .guided-view-chapter-delta[hidden] { display: none; }+ .guided-view-chapter-delta [data-delta-kind="stay"] { color: var(--text-muted); }+ .guided-view-chapter-delta [data-delta-kind="enter"] { color: var(--frontend-stroke); }+ .guided-view-chapter-delta [data-delta-kind="leave"] { color: var(--security-stroke); }+ .guided-view-chapter[data-preview-active="true"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 72%, var(--toolbar-border)) !important;+ background: color-mix(in srgb, var(--frontend-fill) 54%, var(--toolbar-bg)) !important;+ }+ .guided-view-chapter[data-chapter-position="current"] {+ border: 2px solid var(--frontend-stroke) !important;+ padding: calc(0.36rem - 1px) calc(0.48rem - 1px) !important;+ box-shadow: inset 3px 0 0 var(--frontend-stroke);+ color: var(--toolbar-text) !important;+ }+ .guided-view-chapter[data-chapter-position="current"] .guided-view-chapter-index {+ background: var(--frontend-stroke);+ color: var(--bg);+ }+ .guided-view-chapter[data-chapter-position="before"] {+ border-style: solid !important;+ opacity: 0.72;+ }+ .guided-view-chapter[data-chapter-position="after"] { border-style: dashed !important; }+ html[data-preset="signal-flow"] .guided-view-chapter[data-chapter-position="current"] {+ box-shadow: inset 3px 0 0 var(--frontend-stroke), 0 0 18px color-mix(in srgb, var(--frontend-stroke) 18%, transparent);+ }+ html[data-preset="blueprint"] .guided-view-chapter,+ html[data-preset="blueprint"] .guided-view-chapter-index { border-radius: 0.12rem !important; }++ /* Story Shelf — keep every authored chapter and the Play action visible,+ but do not spend a second row on unavailable director controls before+ the reader enters a chapter. Existing data-active-view state expands+ the full guided surface without a new toggle or stored preference. */+ .guided-views[data-active-view="all"] {+ grid-template-columns: minmax(11rem, .72fr) auto minmax(0, 2fr);+ align-items: center;+ padding: 0.28rem 0.35rem;+ }+ .guided-views[data-active-view="all"] > #guided-view-prev,+ .guided-views[data-active-view="all"] > #guided-view-next,+ .guided-views[data-active-view="all"] .guided-view-beat-link,+ .guided-views[data-active-view="all"] .guided-view-all { display: none; }+ .guided-views[data-active-view="all"] .guided-view-copy {+ grid-column: 1;+ grid-row: 1;+ padding: 0.1rem 0.55rem;+ }+ .guided-views[data-active-view="all"] .guided-view-copy > #guided-view-note { display: none; }+ .guided-views[data-active-view="all"] .guided-view-actions {+ display: block;+ grid-column: 2;+ grid-row: 1;+ }+ .guided-views[data-active-view="all"] .guided-view-play { min-height: 2.75rem; }+ .guided-views[data-active-view="all"] .guided-view-index {+ grid-column: 3;+ grid-row: 1;+ padding: 0 0.08rem 0 0.42rem;+ border-top: 0;+ border-left: 1px solid color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ }+ .guided-views[data-active-view="all"] .guided-view-chapters {+ gap: 0.3rem;+ padding: 0;+ }++ .cards {+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));+ gap: 1rem;+ margin-top: 2rem;+ }++ .card {+ background: var(--panel);+ border-radius: 0.75rem;+ border: 1px solid var(--panel-border);+ padding: 1.25rem;+ }++ html[data-preset="signal-flow"] .card {+ background: linear-gradient(145deg, rgba(10, 24, 43, 0.86), rgba(5, 12, 24, 0.92));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);+ }+ html[data-preset="signal-flow"][data-theme="light"] .card {+ background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(237, 246, 250, 0.9));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 12px 32px rgba(45, 78, 99, 0.08);+ }++ html[data-preset="blueprint"] .card {+ position: relative;+ border-color: var(--panel-border);+ border-radius: 0.3rem;+ background: var(--panel);+ box-shadow: none;+ }+ html[data-preset="blueprint"] .card::before {+ content: "";+ position: absolute;+ top: -1px;+ left: 1rem;+ width: 2.5rem;+ border-top: 2px solid var(--frontend-stroke);+ }++ .card-header {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ margin-bottom: 0.75rem;+ }++ .card-dot {+ width: 8px;+ height: 8px;+ border-radius: 50%;+ }++ .card-dot.cyan { background: var(--frontend-stroke); }+ .card-dot.emerald { background: var(--backend-stroke); }+ .card-dot.violet { background: var(--database-stroke); }+ .card-dot.amber { background: var(--cloud-stroke); }+ .card-dot.rose { background: var(--security-stroke); }+ .card-dot.orange { background: var(--messagebus-stroke); }+ .card-dot.slate { background: var(--external-stroke); }++ .card h3 { font-size: 0.875rem; font-weight: 600; color: var(--text); }++ .card ul {+ list-style: none;+ color: var(--text-muted);+ font-size: 0.75rem;+ }++ .card li { margin-bottom: 0.375rem; }++ .footer {+ text-align: center;+ margin-top: 1.5rem;+ color: var(--text-faint);+ font-size: 0.75rem;+ }++ .footer .artifact-start-link {+ color: var(--text-faint);+ text-decoration-color: color-mix(in srgb, var(--frontend-stroke) 48%, transparent);+ text-underline-offset: 0.22em;+ transition: color 0.15s ease, text-decoration-color 0.15s ease;+ }++ .footer .artifact-start-link:hover,+ .footer .artifact-start-link:focus-visible {+ color: var(--frontend-stroke);+ text-decoration-color: currentColor;+ }++ /* ==========================================================+ Print stylesheet — hide interactive controls, force light,+ drop the grid so the diagram doesn't waste ink, use landscape+ so wide diagrams fit, pack summary cards into 2 columns to+ avoid an orphan card on a trailing page.+ ========================================================== */+ @page { size: landscape; margin: 1.5cm; }++ @media print {+ /* Force the FULL light palette — including component fills/strokes and+ lane/arrow colors — so printing from dark theme doesn't put neon+ strokes and translucent dark fills on white paper. */+ :root, [data-theme="dark"], [data-theme="light"] {+ --bg: #ffffff;+ --grid: transparent;+ --panel: #ffffff;+ --panel-border: #e2e8f0;+ --text: #0f172a;+ --text-muted: #475569;+ --text-dim: #94a3b8;+ --text-faint: #64748b;+ --mask: #ffffff;+ --lane-fill: rgba(248, 250, 252, 0.65);+ --lane-stroke: #cbd5e1;+ --arrow: #94a3b8;+ --arrow-emphasis: #059669;+ --frontend-fill: rgba(34, 211, 238, 0.15);+ --frontend-stroke: #0891b2;+ --backend-fill: rgba(52, 211, 153, 0.18);+ --backend-stroke: #059669;+ --database-fill: rgba(167, 139, 250, 0.2);+ --database-stroke: #7c3aed;+ --cloud-fill: rgba(251, 191, 36, 0.18);+ --cloud-stroke: #d97706;+ --security-fill: rgba(251, 113, 133, 0.15);+ --security-stroke: #e11d48;+ --messagebus-fill: rgba(251, 146, 60, 0.15);+ --messagebus-stroke:#ea580c;+ --external-fill: rgba(148, 163, 184, 0.18);+ --external-stroke: #64748b;+ }+ body { background: #ffffff !important; padding: 0; }+ .container { max-width: none; }+ .toolbar, .diagram-nav, .focus-chip, .guided-views, .archify-toast, .no-print { display: none !important; }+ .chapter-handoff-overlay { display: none !important; }+ svg [data-node-id][data-chapter-role] { opacity: 1 !important; }+ svg[data-chapter-preview] [data-node-id],+ svg[data-chapter-preview] [data-edge-from] { opacity: 1 !important; filter: none !important; }+ .diagram-container, .card { box-shadow: none; border-color: #e2e8f0; }+ html[data-preset="signal-flow"] .diagram-container,+ html[data-preset="signal-flow"] .card { background: #ffffff; }+ .cards { grid-template-columns: 1fr 1fr; }+ /* Ensure elements break sensibly across pages */+ .card { break-inside: avoid; page-break-inside: avoid; }+ .diagram-container { break-inside: avoid; page-break-inside: avoid; }+ .diagram-container svg [data-detail] {+ opacity: 1 !important;+ pointer-events: auto !important;+ }+ .diagram-container svg [data-detail-anchor] { transform: none !important; }+ .diagram-container svg[data-lens-active] [data-node-id],+ .diagram-container svg[data-lens-active] [data-edge-from],+ .diagram-container svg[data-legend-preview-active] [data-node-id],+ .diagram-container svg[data-legend-preview-active] [data-edge-from] {+ opacity: 1 !important;+ filter: none !important;+ }+ [data-legend-bridge-runtime] { display: none !important; }+ .semantic-lens-overlay { display: none !important; }+ .relationship-hit-overlay { display: none !important; }+ .relationship-pulse-overlay { display: none !important; }+ .route-probe-overlay, .route-journey-overlay { display: none !important; }+ .story-trail-overlay,+ .story-carrier-overlay { display: none !important; }+ .diagram-container svg[data-focus-active] [data-node-id],+ .diagram-container svg[data-focus-active] [data-edge-from],+ .diagram-container svg[data-story-beat] [data-story-step],+ .diagram-container svg[data-story-beat] [data-edge-from][data-story-beat-step],+ .diagram-container svg[data-route-active] [data-node-id],+ .diagram-container svg[data-route-active] [data-edge-from] {+ opacity: 1 !important;+ filter: none !important;+ animation: none !important;+ }+ h1, .subtitle { color: #0f172a; }+ }++ /* ==========================================================+ TOOLBAR (theme toggle + export menu)+ ========================================================== */+ .toolbar {+ position: fixed;+ top: 1rem;+ right: 1rem;+ display: flex;+ gap: 0.5rem;+ z-index: 100;+ }+ .toolbar button {+ background: var(--toolbar-bg);+ color: var(--toolbar-text);+ border: 1px solid var(--toolbar-border);+ padding: 0.5rem 0.875rem;+ border-radius: 0.5rem;+ font-family: inherit;+ font-size: 0.75rem;+ font-weight: 500;+ cursor: pointer;+ backdrop-filter: blur(8px);+ transition: background 0.15s, border-color 0.15s;+ display: inline-flex;+ align-items: center;+ gap: 0.375rem;+ min-height: 2.75rem;+ }+ .toolbar button:hover {+ background: var(--toolbar-hover);+ border-color: var(--arrow);+ }+ .toolbar button:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 2px;+ }+ .toolbar #btn-motion[hidden] { display: none !important; }+ .toolbar #btn-motion { min-width: 4.4rem; }+ .toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }+ .motion-control-dot {+ width: 0.46rem;+ height: 0.46rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 50%;+ background: var(--frontend-stroke);+ box-shadow: 0 0 9px color-mix(in srgb, var(--frontend-stroke) 72%, transparent);+ }+ #btn-motion[aria-pressed="false"] .motion-control-dot {+ background: transparent;+ box-shadow: none;+ }+ .toolbar .export-wrap { position: relative; }+ .toolbar .export-menu {+ position: absolute;+ top: calc(100% + 0.375rem);+ right: 0;+ background: var(--toolbar-menu-bg);+ border: 1px solid var(--toolbar-border);+ border-radius: 0.5rem;+ padding: 0.375rem;+ min-width: 160px;+ display: none;+ flex-direction: column;+ box-shadow: 0 4px 20px rgba(0,0,0,0.25);+ }+ .toolbar .export-menu.open { display: flex; }+ .toolbar .export-menu button {+ background: transparent;+ border: 0;+ justify-content: space-between;+ width: 100%;+ text-align: left;+ padding: 0.5rem 0.75rem;+ }+ .toolbar .export-menu button:hover {+ background: var(--toolbar-hover);+ }+ .toolbar .export-menu .hint {+ color: var(--text-faint);+ font-size: 0.625rem;+ }+ .toolbar .export-menu hr {+ border: 0;+ border-top: 1px solid var(--toolbar-border);+ margin: 0.25rem 0.375rem;+ opacity: 0.5;+ }++ /* Toast — brief feedback for actions like "copied" */+ .archify-toast {+ position: fixed;+ top: 1rem;+ left: 50%;+ transform: translateX(-50%) translateY(-8px);+ background: var(--toolbar-menu-bg);+ color: var(--text);+ border: 1px solid var(--toolbar-border);+ padding: 0.5rem 1rem;+ border-radius: 0.5rem;+ font-family: inherit;+ font-size: 0.75rem;+ opacity: 0;+ transition: opacity 0.2s, transform 0.2s;+ z-index: 200;+ pointer-events: none;+ box-shadow: 0 4px 20px rgba(0,0,0,0.25);+ }+ .archify-toast.show {+ opacity: 1;+ transform: translateX(-50%) translateY(0);+ }++ @media (max-width: 720px) {+ body { padding: 1rem; }+ .toolbar {+ position: static;+ justify-content: flex-end;+ margin-bottom: 1rem;+ }+ .header { margin-bottom: 1.25rem; padding-right: 0; }+ html[data-preset="signal-flow"] .header,+ html[data-preset="blueprint"] .header { padding-right: 0; }+ .header-row {+ gap: 0.75rem;+ align-items: flex-start;+ }+ html[data-preset="signal-flow"] .header-row,+ html[data-preset="blueprint"] .header-row { flex-wrap: wrap; }+ html[data-preset="signal-flow"] .header-row::after {+ margin-left: 0;+ order: 3;+ }+ html[data-preset="blueprint"] .header-row::after {+ margin-left: 0;+ order: 3;+ }+ h1 {+ font-size: 1.25rem;+ line-height: 1.25;+ }+ .subtitle {+ margin-left: 0;+ font-size: 0.8125rem;+ line-height: 1.55;+ }+ .diagram-container {+ padding: 0.75rem;+ border-radius: 0.75rem;+ }+ html:not([data-embed="true"]) .diagram-container {+ padding: 0.75rem 0.75rem 4.25rem;+ }+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] {+ overflow-x: auto;+ overflow-y: hidden;+ overscroll-behavior-x: contain;+ scrollbar-width: thin;+ scroll-behavior: smooth;+ }+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] > svg {+ min-width: 720px;+ }+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .diagram-nav,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .overview-map,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .focus-chip,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .route-probe,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .semantic-lens,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .diagram-guide,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .node-finder {+ transform: translateX(var(--archify-scroll-x, 0px));+ }+ .diagram-nav { right: 0.5rem; bottom: 0.5rem; }+ .overview-map {+ right: 0.5rem;+ bottom: 3.7rem;+ width: min(10.25rem, calc(100% - 1rem));+ }+ .overview-map[data-docked="true"] {+ right: 0.5rem;+ top: var(--archify-radar-top, 0.5rem);+ bottom: auto;+ transform: none !important;+ }+ .overview-map[data-docked="true"][data-dock-side="left"] {+ right: auto;+ left: 0.5rem;+ }+ .overview-map-surface { height: 4rem; }+ .semantic-lens {+ right: 0.5rem;+ bottom: 3.7rem;+ width: calc(100% - 1rem);+ max-height: calc(100% - 4.2rem);+ }+ .semantic-lens[data-dock-side] { left: auto; right: 0.5rem; }+ .semantic-lens-kinds { max-height: min(12rem, 34vh); }+ .focus-chip {+ left: 0.5rem;+ top: 0.5rem;+ width: calc(100% - 1rem);+ max-width: none;+ }+ .relationship-lens-list { max-height: min(12rem, 38vh); }+ .relationship-lens-actions #btn-focus-relations { display: block; color: var(--database-stroke); }+ .focus-chip:not([data-relations-expanded="true"]) .relationship-lens-head { border-bottom-color: transparent; }+ .focus-chip:not([data-relations-expanded="true"]) .relationship-lens-list { display: none; }+ /* While a mobile reader previews one relationship, turn the full Lens+ into a compact peek card. This keeps the exact source and target on+ canvas instead of covering them with a long, scrollable list. */+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-list {+ max-height: none;+ padding: 0.35rem;+ overflow: hidden;+ }+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-group { margin: 0; }+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-group-title,+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-row:not([data-preview-active="true"]) {+ display: none;+ }+ .node-finder {+ top: 0.5rem;+ left: 0.5rem;+ width: min(22rem, calc(100% - 1rem));+ max-height: calc(100% - 1rem);+ }+ .diagram-guide {+ top: 0.5rem;+ right: 0.5rem;+ left: 0.5rem;+ width: auto;+ max-height: calc(100% - 1rem);+ }+ .diagram-guide-head { padding: 0.62rem 0.7rem 0.52rem; }+ .diagram-guide-stats { padding: 0.42rem 0.7rem; }+ .diagram-guide-actions {+ grid-template-columns: 1fr;+ gap: 0.28rem;+ padding: 0.42rem;+ }+ .diagram-guide-action {+ min-height: 3.1rem;+ padding: 0.42rem 0.48rem;+ }+ .diagram-guide-action small {+ display: block;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .diagram-guide-index {+ width: 1.5rem;+ height: 1.5rem;+ }+ .diagram-guide-shortcuts { padding: 0.46rem 0.7rem 0.52rem; }+ .diagram-guide-action[data-guide-action="present"] { grid-column: auto; }+ .route-probe[data-guide-open="true"] {+ visibility: hidden;+ pointer-events: none;+ }+ .node-finder-results { max-height: min(16rem, 38vh); }+ .route-probe {+ left: 0.5rem;+ bottom: 3.7rem;+ width: calc(100% - 1rem);+ min-width: 0;+ }+ .route-probe[data-route-dock="top"] {+ top: 0.5rem;+ bottom: auto;+ }+ .route-probe[data-finder-open="true"] {+ visibility: hidden;+ pointer-events: none;+ }+ .route-probe-head { padding: 0.45rem 0.48rem 0.38rem; }+ .route-probe-path { padding: 0.35rem 0.48rem 0.2rem; }+ .route-probe-node { min-height: 2.75rem !important; }+ .route-journey-controls {+ grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem minmax(0, 1fr);+ padding: 0.08rem 0.48rem 0.32rem;+ }+ .route-journey-controls button { min-height: 2.75rem; }+ .route-probe-status { padding: 0.05rem 0.48rem 0.38rem; }+ .route-probe-node { max-width: 7.5rem; }+ .guided-views {+ grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;+ gap: 0.2rem;+ padding: 0.25rem;+ }+ .guided-view-actions {+ grid-column: 1 / -1;+ display: grid;+ grid-template-columns: repeat(3, minmax(0, 1fr));+ }+ .guided-views > #guided-view-prev,+ .guided-views > #guided-view-next {+ align-self: center;+ height: 2.75rem;+ }+ .guided-view-play,+ .guided-view-all,+ .guided-view-beat-link { min-height: 2.75rem; }+ .guided-view-copy small { white-space: normal; }+ .guided-story-caption { padding: 0.32rem 0.45rem; }+ .guided-story-caption-index { min-width: 2.9rem; padding-right: 0.42rem; }+ .guided-story-caption strong,+ .guided-story-caption small { white-space: normal; }+ .guided-story-caption-next { display: none; }+ .guided-view-trail { min-height: 2rem; }+ .guided-view-trail .guided-view-stop {+ min-height: 2rem;+ padding: 0.22rem 0.42rem 0.22rem 0.28rem;+ }+ .guided-view-handoff { max-width: min(9rem, 32vw); }+ .guided-view-index { padding-top: 0.35rem; }+ .guided-view-chapters {+ gap: 0.35rem;+ scroll-padding-inline: 0.2rem;+ }+ .guided-view-chapters li {+ flex: 0 0 min(14rem, 78vw);+ min-width: 0;+ }+ .guided-view-chapter { min-height: 2.75rem; }+ .guided-views[data-active-view="all"] {+ grid-template-columns: minmax(0, 1fr) auto;+ gap: 0.2rem;+ padding: 0.25rem;+ }+ .guided-views[data-active-view="all"] .guided-view-copy {+ grid-column: 1;+ grid-row: 1;+ }+ .guided-views[data-active-view="all"] .guided-view-actions {+ grid-column: 2;+ grid-row: 1;+ }+ .guided-views[data-active-view="all"] .guided-view-play {+ min-width: 6rem !important;+ min-height: 2.75rem;+ }+ .guided-views[data-active-view="all"] .guided-view-index {+ grid-column: 1 / -1;+ grid-row: 2;+ padding: 0.3rem 0.08rem 0;+ border-top: 1px solid color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ border-left: 0;+ }+ html[data-embed="true"][data-share-playback="true"] .share-chapter-cue:not([hidden]),+ html[data-embed="true"][data-share-moment="true"] .share-chapter-cue:not([hidden]) {+ top: 0.5rem;+ grid-template-columns: auto minmax(0, 1fr);+ gap: 0.28rem 0.55rem;+ width: calc(100% - 1rem);+ min-height: 0;+ padding: 0.45rem 0.55rem 0.55rem;+ }+ html[data-embed="true"][data-share-playback="true"] .diagram-container {+ padding-top: 4.25rem;+ }+ html[data-embed="true"][data-share-moment="true"] .diagram-container {+ padding-top: 4.25rem;+ }+ .share-chapter-index {+ min-width: 4.4rem;+ padding-right: 0.5rem;+ }+ .share-chapter-copy small { font-size: 0.46rem; }+ .share-chapter-route {+ grid-column: 1 / -1;+ font-size: 0.5rem;+ text-align: left;+ }+ .cards {+ grid-template-columns: 1fr;+ margin-top: 1rem;+ }+ html[data-present="true"]:not([data-embed="true"]) body { padding: 0.5rem; }+ html[data-present="true"]:not([data-embed="true"]) .container {+ gap: 0.5rem;+ height: calc(100dvh - 1rem);+ }+ html[data-present="true"]:not([data-embed="true"]) .toolbar {+ position: fixed;+ top: 0.5rem;+ right: 0.5rem;+ margin: 0;+ gap: 0.25rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .toolbar button {+ min-height: 2.75rem;+ padding: 0.42rem 0.58rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .header {+ min-height: 2.25rem;+ padding: 3.5rem 0 0;+ }+ html[data-present="true"]:not([data-embed="true"]) .header-row {+ min-height: 2.25rem;+ margin: 0;+ align-items: center;+ flex-wrap: nowrap;+ }+ html[data-present="true"]:not([data-embed="true"]) .header-row::after,+ html[data-present="true"]:not([data-embed="true"]) .pulse-dot,+ html[data-present="true"]:not([data-embed="true"]) .subtitle { display: none; }+ html[data-present="true"]:not([data-embed="true"]) h1 {+ flex: 1 1 auto;+ min-width: 0;+ max-width: 100%;+ overflow: hidden;+ font-size: 0.875rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ html[data-present="true"]:not([data-embed="true"]) .guided-views {+ padding: 0.2rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .guided-view-copy small { display: none; }+ html[data-present="true"]:not([data-embed="true"]) .guided-story-caption small { display: block; }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container { padding: 0.5rem 0.5rem 3.75rem; }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] > svg {+ width: 720px;+ height: auto;+ min-width: 720px;+ }+ }++ @media (prefers-reduced-motion: reduce) {+ .guided-story-caption { animation: none !important; }+ }++ @media (max-width: 360px) {+ .toolbar { gap: 0.25rem; }+ .toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }+ .toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }+ #theme-label, #preset-label, #present-label { display: none; }+ .guided-view-handoff { max-width: 6.5rem; }+ }++ /* ==========================================================+ SVG SEMANTIC CLASSES — use these instead of inline fill/stroke+ ========================================================== */+ .c-grid { stroke: var(--grid); fill: none; }+ .c-mask { fill: var(--mask); stroke: none; }++ .c-frontend { fill: var(--frontend-fill); stroke: var(--frontend-stroke); }+ .c-backend { fill: var(--backend-fill); stroke: var(--backend-stroke); }+ .c-database { fill: var(--database-fill); stroke: var(--database-stroke); }+ .c-cloud { fill: var(--cloud-fill); stroke: var(--cloud-stroke); }+ .c-security { fill: var(--security-fill); stroke: var(--security-stroke); }+ .c-messagebus { fill: var(--messagebus-fill); stroke: var(--messagebus-stroke); }+ .c-external { fill: var(--external-fill); stroke: var(--external-stroke); }++ /* Text helpers */+ .t-primary { fill: var(--text); }+ .t-muted { fill: var(--text-muted); }+ .t-dim { fill: var(--text-dim); }+ .t-frontend { fill: var(--frontend-stroke); }+ .t-backend { fill: var(--backend-stroke); }+ .t-database { fill: var(--database-stroke); }+ .t-cloud { fill: var(--cloud-stroke); }+ .t-security { fill: var(--security-stroke); }+ .t-messagebus { fill: var(--messagebus-stroke); }+ .t-external { fill: var(--external-stroke); }++ /* Semantic Sigils are small authored role stamps, not icons from a brand+ pack and not viewer controls. Prefix selectors with svg so the canonical+ export's SVG-only stylesheet collector keeps them automatically. */+ svg .semantic-sigil {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ opacity: 0.76;+ pointer-events: none;+ }+ svg .semantic-sigil > * { vector-effect: non-scaling-stroke; }+ svg .semantic-sigil .sigil-fill { fill: currentColor; stroke: none; }+ svg .s-frontend { color: var(--frontend-stroke); }+ svg .s-backend { color: var(--backend-stroke); }+ svg .s-database { color: var(--database-stroke); }+ svg .s-cloud { color: var(--cloud-stroke); }+ svg .s-security { color: var(--security-stroke); }+ svg .s-messagebus { color: var(--messagebus-stroke); }+ svg .s-external { color: var(--external-stroke); }++ /* Reading Depth is a viewer-only level-of-detail layer. MAP preserves the+ authored structure and primary labels, READ restores relationship labels+ and node context, and FULL restores tags and fine annotations. Semantic+ intent can reveal the relevant detail without moving any geometry. */+ svg [data-detail] { transition: opacity 160ms ease; }+ svg [data-detail-anchor] {+ transform-box: fill-box;+ transform-origin: center;+ transition: transform 160ms ease;+ }+ .diagram-container[data-detail-level="map"] svg [data-detail="context"],+ .diagram-container[data-detail-level="map"] svg [data-detail="fine"],+ .diagram-container[data-detail-level="read"] svg [data-detail="fine"] {+ opacity: 0;+ pointer-events: none;+ }+ .diagram-container[data-detail-level="map"] svg [data-detail-anchor] {+ transform: translateY(8px);+ }++ /* Focus, lens, preview, route, and story states are stronger reader intent than+ the global zoom level. Reveal only their exact semantic matches. */+ svg[data-focus-active] [data-focus-match][data-detail],+ svg[data-focus-active] [data-focus-match] [data-detail],+ svg[data-lens-active] [data-lens-match][data-detail],+ svg[data-lens-active] [data-lens-match] [data-detail],+ svg[data-legend-preview-active] [data-legend-preview-match][data-detail],+ svg[data-legend-preview-active] [data-legend-preview-match] [data-detail],+ svg[data-intent-trace-active] [data-intent-trace-match][data-detail],+ svg[data-intent-trace-active] [data-intent-trace-match] [data-detail],+ svg[data-route-active] [data-route-match][data-detail],+ svg[data-route-active] [data-route-match] [data-detail],+ svg[data-story-active] [data-story-step][data-detail],+ svg[data-story-active] [data-story-step] [data-detail],+ svg[data-relationship-preview-active] [data-relationship-preview][data-detail],+ svg[data-relationship-preview-active] [data-relationship-preview] [data-detail],+ svg [data-node-id]:hover [data-detail],+ svg [data-node-id]:focus-visible [data-detail] {+ opacity: 1;+ pointer-events: auto;+ }+ svg[data-focus-active] [data-focus-match] [data-detail-anchor],+ svg[data-lens-active] [data-lens-match] [data-detail-anchor],+ svg[data-legend-preview-active] [data-legend-preview-match] [data-detail-anchor],+ svg[data-intent-trace-active] [data-intent-trace-match] [data-detail-anchor],+ svg[data-route-active] [data-route-match] [data-detail-anchor],+ svg[data-story-active] [data-story-step] [data-detail-anchor],+ svg [data-node-id]:hover [data-detail-anchor],+ svg [data-node-id]:focus-visible [data-detail-anchor] { transform: none; }++ /* Arrows */+ .a-default { stroke: var(--arrow); fill: none; }+ .a-emphasis { stroke: var(--arrow-emphasis); fill: none; }+ .a-security { stroke: var(--security-stroke); fill: none; stroke-dasharray: 5,5; }+ .a-dashed { stroke: var(--database-stroke); fill: none; stroke-dasharray: 4,4; }++ /* Arrowhead markers reference these */+ .m-default { fill: var(--arrow); }+ .m-emphasis { fill: var(--arrow-emphasis); }+ .m-security { fill: var(--security-stroke); }+ .m-dashed { fill: var(--database-stroke); }++ /* Stable semantic exploration hooks emitted by every renderer. */+ svg [data-node-id] {+ cursor: pointer;+ transition: opacity 0.18s ease, filter 0.18s ease;+ }+ svg [data-edge-from] { transition: opacity 0.18s ease, filter 0.18s ease; }+ svg [data-node-id]:hover,+ svg [data-node-id]:focus-visible {+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ outline: none;+ }+ svg [data-legend-kind][role="button"] { cursor: pointer; }+ svg [data-legend-kind]:focus { outline: none; }+ svg [data-legend-hit] {+ fill: transparent;+ stroke: transparent;+ stroke-width: 1.4;+ pointer-events: all;+ vector-effect: non-scaling-stroke;+ transition: stroke 150ms ease, stroke-width 150ms ease, filter 150ms ease;+ }+ svg [data-legend-count-badge] { pointer-events: none; }+ svg [data-legend-count-badge] rect {+ fill: var(--mask);+ stroke: var(--panel-border);+ stroke-width: 1;+ vector-effect: non-scaling-stroke;+ }+ svg [data-legend-count-badge] text {+ fill: var(--text-muted);+ font-size: 7px;+ font-weight: 700;+ text-anchor: middle;+ }+ svg [data-legend-kind][role="button"]:hover [data-legend-hit] {+ stroke: color-mix(in srgb, var(--database-stroke) 58%, transparent);+ }+ svg [data-legend-kind][role="button"]:focus-visible [data-legend-hit] {+ stroke: var(--frontend-stroke);+ stroke-width: 1.8;+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ svg [data-legend-kind][data-legend-selected] [data-legend-hit] {+ stroke: var(--database-stroke);+ stroke-width: 2.2;+ stroke-dasharray: 3 2;+ }+ svg [data-legend-kind][data-legend-selected] [data-legend-count-badge] rect {+ stroke: var(--database-stroke);+ stroke-width: 1.8;+ }+ svg [data-legend-kind][data-legend-zero] { opacity: 0.44; }+ svg[data-preset="signal-flow"] [data-legend-kind][data-legend-selected] [data-legend-hit] {+ filter: drop-shadow(0 0 4px var(--database-stroke));+ }+ svg[data-preset="blueprint"] [data-legend-hit],+ svg[data-preset="blueprint"] [data-legend-count-badge] rect { rx: 0; filter: none; }+ svg[data-legend-preview-active] [data-node-id],+ svg[data-legend-preview-active] [data-edge-from] { opacity: 0.11; }+ svg[data-legend-preview-active] [data-legend-preview-match] { opacity: 1; }+ svg[data-legend-preview-active] [data-legend-preview-peer] { opacity: 0.62; }+ svg[data-legend-preview-active] [data-legend-preview-selected] {+ filter: drop-shadow(0 0 8px var(--database-stroke));+ }+ svg[data-lens-active] [data-node-id],+ svg[data-lens-active] [data-edge-from] { opacity: 0.11; }+ svg[data-lens-active] [data-lens-match] { opacity: 1; }+ svg[data-lens-active] [data-lens-peer] { opacity: 0.62; }+ svg[data-lens-active] [data-lens-selected] {+ filter: drop-shadow(0 0 10px var(--database-stroke));+ }+ .semantic-lens-overlay { pointer-events: none; }+ .semantic-lens-flow {+ fill: none;+ stroke-width: 3.05;+ stroke-linecap: round;+ stroke-dasharray: 0.075 0.925;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0.9;+ animation: archify-semantic-lens-flow 1.35s linear 1 both;+ animation-delay: var(--lens-flow-delay, 0s);+ }+ .semantic-lens-flow[data-direction="out"],+ .semantic-lens-flow[data-direction="forward"] {+ stroke: var(--frontend-stroke);+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ .semantic-lens-flow[data-direction="in"],+ .semantic-lens-flow[data-direction="reverse"] {+ stroke: var(--database-stroke);+ filter: drop-shadow(0 0 3px var(--database-stroke));+ }+ .semantic-lens-flow[data-direction="within"] {+ stroke: var(--messagebus-stroke);+ filter: drop-shadow(0 0 3px var(--messagebus-stroke));+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow {+ stroke-width: 3.7;+ opacity: 1;+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="out"],+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="forward"] {+ filter: drop-shadow(0 0 6px var(--frontend-stroke));+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="in"],+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="reverse"] {+ filter: drop-shadow(0 0 6px var(--database-stroke));+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="within"] {+ filter: drop-shadow(0 0 6px var(--messagebus-stroke));+ }+ svg[data-preset="blueprint"] .semantic-lens-flow {+ stroke-width: 2.45;+ stroke-linecap: square;+ filter: none;+ opacity: 0.78;+ }+ html[data-embed="true"] .semantic-lens-overlay { display: none; }+ svg[data-focus-active] [data-node-id],+ svg[data-focus-active] [data-edge-from] { opacity: 0.13; }+ svg[data-focus-active] [data-focus-match] { opacity: 1; }+ svg[data-focus-active] [data-focus-selected] {+ filter: drop-shadow(0 0 10px var(--frontend-stroke));+ }++ /* Direct Relationship Explorer makes authored paths a real input surface+ without changing their visible stroke or canonical SVG. A transparent+ runtime rail supplies forgiving pointer geometry; the exact authored+ path and endpoints continue to carry every visible state. */+ .relationship-hit-overlay { pointer-events: none; }+ .relationship-hit-target { outline: none; }+ .relationship-hit-rail {+ fill: none;+ stroke: transparent;+ stroke-width: 24;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ pointer-events: stroke;+ cursor: pointer;+ }+ .relationship-focus-rail {+ fill: none;+ stroke: color-mix(in srgb, var(--frontend-stroke) 34%, transparent);+ stroke-width: 6;+ stroke-dasharray: 2 4;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ pointer-events: none;+ opacity: 0;+ }+ .relationship-hit-target:focus-visible .relationship-focus-rail {+ opacity: 1;+ }+ svg[data-preset="blueprint"] .relationship-hit-target:focus-visible .relationship-focus-rail {+ stroke-linecap: square;+ filter: none;+ }+ svg[data-relationship-direct-active] [data-node-id],+ svg[data-relationship-direct-active] [data-edge-from] { opacity: 0.16; }+ svg[data-relationship-direct-active] [data-relationship-preview],+ svg[data-relationship-direct-active] [data-relationship-preview-node] { opacity: 1; }+ svg[data-focus-active]:not([data-relationship-pin-active]) .relationship-hit-rail,+ svg[data-story-active] .relationship-hit-rail,+ svg[data-route-picking] .relationship-hit-rail,+ svg[data-route-active] .relationship-hit-rail,+ svg[data-lens-active] .relationship-hit-rail,+ svg[data-chapter-preview] .relationship-hit-rail { pointer-events: none; }+ html[data-embed="true"] .relationship-hit-overlay { display: none; }+ @media (hover: none), (pointer: coarse) {+ .relationship-hit-rail { stroke-width: 24; }+ }++ /* Relationship Preview is temporary exploration state layered on top of+ neighborhood focus. It changes emphasis only; exported geometry and the+ relationship's original solid/dashed visual language stay untouched. */+ svg[data-relationship-preview-active] [data-focus-match] { opacity: 0.18; }+ svg[data-relationship-preview-active] [data-relationship-preview],+ svg[data-relationship-preview-active] [data-relationship-preview-node] { opacity: 1; }+ svg[data-relationship-preview-active] [data-relationship-preview] {+ filter: drop-shadow(0 0 5px var(--arrow-emphasis));+ }+ svg[data-relationship-preview-active] [data-relationship-preview] path,+ svg[data-relationship-preview-active] path[data-relationship-preview],+ svg[data-relationship-preview-active] [data-relationship-preview] line,+ svg[data-relationship-preview-active] line[data-relationship-preview],+ svg[data-relationship-preview-active] [data-relationship-preview] polyline,+ svg[data-relationship-preview-active] polyline[data-relationship-preview] {+ stroke-width: 2.75;+ }+ svg[data-relationship-preview-active] [data-relationship-preview-source] {+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ }+ svg[data-relationship-preview-active] [data-relationship-preview-target] {+ filter: drop-shadow(0 0 7px var(--database-stroke));+ }+ .relationship-pulse-overlay { pointer-events: none; }+ .relationship-flow-pulse {+ fill: none;+ stroke: var(--arrow-emphasis);+ stroke-width: 3.35;+ stroke-linecap: round;+ stroke-dasharray: 0.085 0.915;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0;+ filter: drop-shadow(0 0 4px var(--arrow-emphasis));+ animation: archify-relationship-pulse 1.2s linear 1 both;+ }+ svg[data-preset="signal-flow"] .relationship-flow-pulse {+ stroke: var(--frontend-stroke);+ stroke-width: 3.85;+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ }+ svg[data-preset="blueprint"] .relationship-flow-pulse {+ stroke-width: 2.5;+ stroke-linecap: square;+ filter: none;+ }+ .semantic-flow-token {+ color: var(--frontend-stroke);+ opacity: 0;+ pointer-events: none;+ }+ .relationship-flow-token {+ animation: archify-relationship-token-life 1.2s linear 1 both;+ }+ .story-flow-token {+ animation: archify-relationship-token-life 0.78s linear 1 both;+ }+ .semantic-flow-token-halo {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.1;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ }+ .relationship-flow-token-shape {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-ink {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.05;+ stroke-linecap: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-dot { fill: currentColor; stroke: none; }+ .semantic-flow-token[data-token-kind="data"] { color: var(--database-stroke); }+ .semantic-flow-token[data-token-kind="event"] { color: var(--messagebus-stroke); }+ .semantic-flow-token[data-token-kind="security"] { color: var(--security-stroke); }+ .semantic-flow-token[data-token-kind="state"] { color: var(--cloud-stroke); }+ svg[data-preset="signal-flow"] .semantic-flow-token {+ filter: drop-shadow(0 0 5px currentColor);+ }+ svg[data-preset="blueprint"] .semantic-flow-token { filter: none; }+ html[data-embed="true"] .relationship-pulse-overlay { display: none; }++ /* Intent Trace is a temporary, pre-click exploration layer. Related+ topology stays readable while a short viewer-only signal runs over+ cloned edge geometry; the authored edge remains untouched underneath. */+ svg[data-intent-trace-active] [data-node-id],+ svg[data-intent-trace-active] [data-edge-from] { opacity: 0.2; }+ svg[data-intent-trace-active] [data-intent-trace-match] { opacity: 1; }+ svg[data-intent-trace-active] [data-intent-trace-selected] {+ filter: drop-shadow(0 0 10px var(--frontend-stroke));+ }+ .intent-trace-overlay { pointer-events: none; }+ .intent-trace-flow {+ fill: none;+ stroke-width: 3.1;+ stroke-linecap: round;+ stroke-dasharray: 0.1 0.9;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0.94;+ animation: archify-intent-trace-flow 1.15s linear 1 both;+ }+ .intent-trace-flow[data-direction="out"] {+ stroke: var(--frontend-stroke);+ filter: drop-shadow(0 0 4px var(--frontend-stroke));+ }+ .intent-trace-flow[data-direction="in"] {+ stroke: var(--database-stroke);+ filter: drop-shadow(0 0 4px var(--database-stroke));+ animation-direction: reverse;+ }+ .intent-trace-flow[data-direction="loop"] {+ stroke: var(--security-stroke);+ filter: drop-shadow(0 0 4px var(--security-stroke));+ }+ svg[data-preset="blueprint"] [data-intent-trace-selected],+ svg[data-preset="blueprint"] .intent-trace-flow {+ filter: none;+ stroke-linecap: square;+ }+ .intent-trace-status {+ 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;+ }++ /* Route Probe separates a durable two-point query from selection and+ one-hop hover. Only the chosen shortest directed path stays prominent;+ the traveling signal is cloned viewer geometry and never authored SVG. */+ svg[data-route-picking="target"] [data-node-id] { opacity: 0.24; }+ svg[data-route-picking="target"] [data-route-candidate],+ svg[data-route-picking="target"] [data-route-start] { opacity: 1; }+ svg[data-route-picking] [data-node-id] { cursor: crosshair; }+ svg[data-route-picking] [data-route-start] {+ filter: drop-shadow(0 0 10px var(--frontend-stroke));+ }+ svg[data-route-active] [data-node-id],+ svg[data-route-active] [data-edge-from] { opacity: 0.11; }+ svg[data-route-active] [data-route-match] { opacity: 1; }+ svg[data-route-active] [data-route-start] {+ filter: drop-shadow(0 0 11px var(--frontend-stroke));+ }+ svg[data-route-active] [data-route-end] {+ filter: drop-shadow(0 0 11px var(--security-stroke));+ }+ svg[data-route-active] [data-route-step]:not([data-route-start]):not([data-route-end]) {+ filter: drop-shadow(0 0 7px var(--backend-stroke));+ }+ svg[data-route-journey] [data-route-match][data-route-journey-state="past"] { opacity: 0.62; }+ svg[data-route-journey] [data-route-match][data-route-journey-state="future"] { opacity: 0.34; }+ svg[data-route-journey] [data-route-match][data-route-journey-state="current"] { opacity: 1; }+ svg[data-route-journey] [data-node-id][data-route-journey-current] {+ filter: drop-shadow(0 0 10px var(--backend-stroke));+ }+ svg[data-route-journey] [data-edge-from][data-route-journey-current] {+ opacity: 1;+ filter: drop-shadow(0 0 6px var(--backend-stroke));+ }+ .route-probe-overlay { pointer-events: none; }+ .route-journey-overlay { pointer-events: none; }+ .route-probe-flow {+ fill: none;+ stroke: var(--backend-stroke);+ stroke-width: 3.25;+ stroke-linecap: round;+ stroke-dasharray: 0.085 0.915;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ filter: drop-shadow(0 0 5px var(--backend-stroke));+ animation: archify-route-probe-flow 1.1s cubic-bezier(0.22, 1, 0.36, 1) 1 both;+ animation-delay: calc(var(--route-step, 0) * 0.16s);+ }+ .route-journey-flow {+ fill: none;+ stroke: var(--backend-stroke);+ stroke-width: 3.5;+ stroke-linecap: round;+ stroke-dasharray: 0.1 0.9;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0;+ filter: drop-shadow(0 0 6px var(--backend-stroke));+ animation: archify-route-journey-flow 780ms cubic-bezier(0.22, 1, 0.36, 1) 1 both;+ }+ svg[data-preset="blueprint"] [data-route-start],+ svg[data-preset="blueprint"] [data-route-end],+ svg[data-preset="blueprint"] [data-route-step],+ svg[data-preset="blueprint"] .route-probe-flow {+ filter: none;+ stroke-linecap: square;+ }+ svg[data-preset="blueprint"] .route-journey-flow {+ filter: none;+ stroke-linecap: square;+ }++ svg[data-preset="blueprint"] .c-grid {+ stroke-dasharray: 1 3;+ opacity: 0.78;+ }+ svg[data-preset="blueprint"] .c-region {+ fill: color-mix(in srgb, var(--cloud-fill) 58%, transparent);+ stroke-dasharray: 12 4 2 4;+ }+ svg[data-preset="blueprint"] .c-security-group,+ svg[data-preset="blueprint"] .c-lane { stroke-dasharray: 7 3; }+ svg[data-preset="blueprint"] [data-node-id]:hover,+ svg[data-preset="blueprint"] [data-node-id]:focus-visible {+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ svg[data-preset="blueprint"][data-focus-active] [data-focus-selected] {+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview],+ svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-source],+ svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-target] {+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }++ /* Story Trail is a viewer-only overlay derived from the ordered focus IDs+ of the active guided view. The authored edge stays underneath with its+ original color, dash pattern, marker, and geometry intact. */+ .story-trail-overlay { pointer-events: none; }+ .story-carrier-overlay { pointer-events: none; }+ .story-trail-flow {+ fill: none;+ stroke: var(--frontend-stroke);+ stroke-width: 2.8;+ stroke-linecap: round;+ vector-effect: non-scaling-stroke;+ opacity: 0.34;+ filter: drop-shadow(0 0 2px var(--frontend-stroke));+ }+ svg[data-story-beat] [data-story-step] {+ opacity: 0.22;+ filter: saturate(0.42);+ transition: opacity 180ms ease, filter 180ms ease;+ }+ svg[data-story-beat] [data-story-step][data-story-beat-state="past"] {+ opacity: 0.72;+ filter: saturate(0.82);+ }+ svg[data-story-beat] [data-story-step][data-story-beat-state="next"] {+ opacity: 0.5;+ filter: saturate(0.66);+ }+ svg[data-story-beat] [data-story-step][data-story-beat-state="active"] {+ opacity: 1;+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ animation: archify-story-beat-node 360ms cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ svg[data-story-beat] [data-edge-from][data-story-beat-step] {+ opacity: 0.16;+ transition: opacity 160ms ease;+ }+ svg[data-story-beat] [data-edge-from][data-story-beat-step][data-story-beat-state="past"] { opacity: 0.58; }+ svg[data-story-beat] [data-edge-from][data-story-beat-step][data-story-beat-state="next"] { opacity: 0.34; }+ svg[data-story-beat] [data-edge-from][data-story-beat-step][data-story-beat-state="active"] { opacity: 1; }+ svg[data-story-beat] .story-trail-flow { opacity: 0; transition: opacity 160ms ease; }+ svg[data-story-beat] .story-trail-flow[data-story-beat-state="past"] { opacity: 0.34; }+ svg[data-story-beat] .story-trail-flow[data-story-beat-state="next"] { opacity: 0.2; }+ svg[data-story-beat] .story-trail-flow[data-story-beat-state="active"] { opacity: 0.92; }+ svg[data-story-beat] .story-trail-flow[data-story-pulse="true"] {+ stroke-dasharray: 2 13;+ stroke-dashoffset: 30;+ opacity: 0.92;+ animation: archify-story-flow 0.78s linear 1 both;+ }+ svg[data-preset="blueprint"] .story-trail-flow {+ stroke-linecap: square;+ filter: none;+ opacity: 0.5;+ }+ svg[data-preset="blueprint"][data-story-beat] [data-story-step][data-story-beat-state="active"] {+ filter: none;+ animation: none;+ }++ /* Chapter Delta Preview is a static, pre-commit comparison between two+ chapter focus sets. Symbols in the rail carry the meaning without color;+ these SVG rules only make exact stable-ID membership easier to scan. */+ svg[data-chapter-preview] [data-node-id],+ svg[data-chapter-preview] [data-edge-from] {+ opacity: 0.1 !important;+ filter: none !important;+ transition: none !important;+ }+ svg[data-chapter-preview] .story-trail-overlay { opacity: 0.08 !important; }+ svg[data-chapter-preview] [data-node-id][data-chapter-preview-role="stay"] {+ opacity: 0.76 !important;+ filter: saturate(0.7) !important;+ }+ svg[data-chapter-preview] [data-node-id][data-chapter-preview-role="enter"] {+ opacity: 1 !important;+ filter: saturate(1.2) !important;+ }+ svg[data-chapter-preview] [data-node-id][data-chapter-preview-role="leave"] {+ opacity: 0.28 !important;+ filter: grayscale(0.72) !important;+ }+ svg[data-preset="blueprint"][data-chapter-preview] [data-node-id] { filter: none !important; }++ /* Dashed boundary variants */+ .c-security-group { fill: transparent; stroke: var(--security-stroke); stroke-dasharray: 4,4; }+ .c-region { fill: rgba(251, 191, 36, 0.05); stroke: var(--cloud-stroke); stroke-dasharray: 8,4; }+ .c-lane { fill: var(--lane-fill); stroke: var(--lane-stroke); stroke-dasharray: 6,6; }++ /* Optional trace animation, enabled only by meta.animation = "trace".+ The ordinary viewer performs one ambient pass and then restores the+ authored solid/security/async line language. WebM samples the same+ authored geometry into an explicit canvas timeline. */+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"] {+ animation: archify-edge-flow 2.4s linear 1;+ animation-delay: calc(var(--step, 0) * 160ms);+ }+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"] {+ transform-box: fill-box;+ transform-origin: center;+ animation: archify-node-pulse 3.6s ease-in-out 1;+ animation-delay: calc(var(--step, 0) * 160ms);+ }+ svg[data-preset="signal-flow"][data-animation="trace"] [data-animate="edge"] {+ stroke-linecap: round;+ filter: drop-shadow(0 0 3px var(--arrow-emphasis));+ animation-duration: 1.75s;+ }+ svg[data-preset="signal-flow"][data-animation="trace"] [data-animate="node"] {+ animation-duration: 3.1s;+ }+ svg[data-preset="blueprint"][data-animation="trace"] [data-animate="edge"] {+ stroke-linecap: square;+ filter: none;+ animation-duration: 2.15s;+ }+ svg[data-preset="blueprint"][data-animation="trace"] [data-animate="node"] {+ animation-name: archify-blueprint-node-pulse;+ animation-duration: 3.8s;+ }+ /* Embedded proofs are static until a named Story Trail chapter is played.+ This keeps proof grids calm and ensures ?play=1 stops all viewer motion+ after one 3.2 second chapter instead of leaving ambient trace loops on. */+ html[data-embed="true"] svg[data-animation="trace"] [data-animate],+ html[data-share-playback="true"] svg[data-animation="trace"] [data-animate] {+ animation: none !important;+ stroke-dashoffset: 0;+ }+ @keyframes archify-edge-flow {+ 0% { stroke-dasharray: 10 8; stroke-dashoffset: 54; opacity: 0.42; }+ 88% { stroke-dasharray: 10 8; stroke-dashoffset: 0; opacity: 1; }+ 99.9% { stroke-dasharray: 10 8; stroke-dashoffset: 0; opacity: 1; }+ 100% { stroke-dashoffset: 0; opacity: 1; }+ }+ @keyframes archify-node-pulse {+ 0%, 72%, 100% { filter: none; stroke-width: 1.5; }+ 18%, 36% {+ filter: drop-shadow(0 0 8px var(--arrow-emphasis));+ stroke-width: 2.4;+ }+ }+ @keyframes archify-blueprint-node-pulse {+ 0%, 72%, 100% { opacity: 1; filter: none; }+ 18%, 36% { opacity: 0.72; filter: drop-shadow(0 0 2px var(--frontend-stroke)); }+ }+ @keyframes archify-signal-scan {+ 0%, 18% { opacity: 1; transform: translateX(-70%); }+ 70% { opacity: 1; transform: translateX(70%); }+ 100% { opacity: 0; transform: translateX(70%); }+ }+ @keyframes archify-radar-live {+ 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--backend-stroke) 52%, transparent); }+ 55%, 100% { box-shadow: 0 0 0 0.32rem transparent; }+ }+ @keyframes archify-guided-progress {+ from { transform: scaleX(var(--guided-progress-start, 0)); }+ to { transform: scaleX(1); }+ }+ @keyframes archify-story-flow {+ to { stroke-dashoffset: 0; }+ }+ @keyframes archify-intent-trace-flow {+ 0% { opacity: 0.28; stroke-dashoffset: 0; }+ 12%, 78% { opacity: 0.94; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-route-probe-flow {+ 0% { stroke-dashoffset: 0; opacity: 0.96; }+ 78% { stroke-dashoffset: -1; opacity: 0.96; }+ 100% { stroke-dasharray: none; stroke-dashoffset: 0; opacity: 0.58; }+ }+ @keyframes archify-route-journey-flow {+ 0% { opacity: 0.16; stroke-dashoffset: 0; }+ 14%, 76% { opacity: 1; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-semantic-lens-flow {+ 0% { opacity: 0.2; stroke-dashoffset: 0; }+ 12%, 78% { opacity: 0.9; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-relationship-pulse {+ 0% { opacity: 0.18; stroke-dashoffset: 0; }+ 10%, 76% { opacity: 0.98; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-relationship-token-life {+ 0%, 7% { opacity: 0; }+ 13%, 82% { opacity: 1; }+ 100% { opacity: 0; }+ }+ @keyframes archify-story-beat-node {+ from { opacity: 0.48; filter: saturate(0.6); }+ 58% { opacity: 1; filter: drop-shadow(0 0 10px var(--frontend-stroke)); }+ to { opacity: 1; filter: drop-shadow(0 0 7px var(--frontend-stroke)); }+ }+ @keyframes archify-share-cue-enter {+ from { opacity: 0; transform: translate(-50%, -0.45rem); }+ to { opacity: 1; transform: translate(-50%, 0); }+ }+ @keyframes archify-share-cue-pulse {+ 0%, 100% { opacity: 1; transform: scale(1); }+ 50% { opacity: 0.48; transform: scale(0.78); }+ }+ @media (prefers-reduced-motion: reduce) {+ html[data-preset="signal-flow"] .diagram-container::before {+ animation: none !important;+ }+ .pulse-dot { animation: none !important; }+ svg[data-animation="trace"] [data-animate] {+ animation: none !important;+ stroke-dashoffset: 0;+ }+ .guided-view-progress span {+ animation: none !important;+ transform: scaleX(1) !important;+ }+ .story-trail-flow,+ .intent-trace-flow,+ .route-probe-flow,+ .semantic-lens,+ .diagram-guide,+ [data-story-step],+ .overview-map-live,+ .guided-view-stop,+ .share-chapter-cue,+ .chapter-handoff-anchor,+ .share-chapter-state::before,+ .share-chapter-progress span { animation: none !important; }+ .guided-view-chapter,+ svg[data-chapter-preview] [data-node-id],+ svg[data-chapter-preview] [data-edge-from] { transition: none !important; }+ svg[data-story-playing="true"] .story-trail-flow {+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.55;+ }+ .intent-trace-flow {+ animation: none !important;+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.72;+ }+ .route-probe-flow {+ animation: none !important;+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.78;+ }+ .route-journey-overlay,+ .story-carrier-overlay { display: none !important; }+ .semantic-lens-flow {+ animation: none !important;+ stroke-dasharray: none;+ stroke-width: 2.2;+ opacity: 0.34;+ filter: none;+ }+ .relationship-pulse-overlay { display: none !important; }+ .guided-view-chapter { transition: none !important; }+ svg [data-node-id], svg [data-edge-from], svg [data-detail], svg [data-detail-anchor], svg [data-legend-hit], svg { transition: none !important; }+ }+ </style>+</head>+<body>+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.+ Motion appears only for trace-enabled artifacts and has no shortcut;+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. -->+ <div class="toolbar" role="toolbar" aria-label="Diagram actions">+ <button id="btn-theme" type="button"+ title="Toggle theme (T)"+ aria-label="Toggle color theme"+ aria-pressed="false"><span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button>+ <button id="btn-motion" type="button" hidden+ title="Pause motion"+ aria-label="Pause motion"+ aria-pressed="true">+ <span class="motion-control-dot" aria-hidden="true"></span>+ <span id="motion-label">Live</span>+ </button>+ <button id="btn-present" type="button"+ title="Presentation stage (F)"+ aria-label="Enter presentation stage"+ aria-pressed="false">+ <span id="present-icon" aria-hidden="true">□</span>+ <span id="present-label">Present</span>+ </button><div class="export-wrap"><button id="btn-export" type="button"title="Export diagram (E)"@@ -516,733 +3795,7619 @@<button data-format="webp" type="button" role="menuitem" tabindex="-1">Download WebP</button><hr role="separator"><button data-format="svg" type="button" role="menuitem" tabindex="-1">Download SVG <span class="hint">vector</span></button>+ <button data-format="webm" type="button" role="menuitem" tabindex="-1">Download WebM <span class="hint">6s motion</span></button>+ </div>+ </div>+ </div>++ <div class="container">+ <!-- Header -->+ <div class="header">+ <div class="header-row">+ <div class="pulse-dot"></div>+ <h1>Maka</h1>+ </div>+ <p class="subtitle">Local-first desktop AI workbench — sessions, tools, permissions, recovery</p>+ </div>++ <script id="archify-guided-views-data" type="application/json">[]</script>+ <div class="guided-views no-print" id="guided-views" hidden aria-label="Guided diagram views">+ <button id="guided-view-prev" type="button" aria-label="Previous guided view" title="Previous guided view ([)">←</button>+ <div class="guided-view-copy">+ <div class="guided-view-meta">+ <span>Guided views</span>+ <span id="guided-view-count"></span>+ <span class="guided-view-progress" aria-hidden="true"><span id="guided-view-progress-bar"></span></span>+ <span class="guided-view-handoff" id="guided-view-handoff" hidden aria-hidden="true"></span>+ </div>+ <strong id="guided-view-label">Explore this system</strong>+ <small id="guided-view-note" aria-live="polite" aria-atomic="true">Step through curated paths without changing the source diagram.</small>+ <div class="guided-view-trail" id="guided-view-trail" hidden role="group" aria-label="Story trail"></div>+ <div class="guided-story-caption" id="guided-story-caption" hidden aria-live="polite" aria-atomic="true">+ <span class="guided-story-caption-index" id="guided-story-caption-index">Beat</span>+ <strong id="guided-story-caption-route"></strong>+ <small id="guided-story-caption-detail"></small>+ <span class="guided-story-caption-next" id="guided-story-caption-next" hidden aria-hidden="true">+ <small>Next</small>+ <strong id="guided-story-caption-next-label"></strong>+ </span>+ </div>+ </div>+ <button id="guided-view-next" type="button" aria-label="Next guided view" title="Next guided view (])">→</button>+ <div class="guided-view-actions">+ <button class="guided-view-play" id="guided-view-play" type="button" aria-label="Play guided story" aria-pressed="false" title="Play guided story (P)">+ <span id="guided-view-play-icon" aria-hidden="true">▶</span>+ <span id="guided-view-play-label">Play story</span>+ </button>+ <button class="guided-view-beat-link" id="guided-view-beat-link" type="button" aria-label="Select a Story Beat to copy its exact link" title="Select a Story Beat to copy its exact link" disabled>+ <span aria-hidden="true">#</span>+ <span id="guided-view-beat-link-label">Copy moment</span>+ </button>+ <button class="guided-view-all" id="guided-view-all" type="button" aria-label="Show entire diagram">Show all</button>+ </div>+ <nav class="guided-view-index" id="guided-view-index" aria-label="Story chapters">+ <ol class="guided-view-chapters" id="guided-view-chapters"></ol>+ </nav>+ </div>++ <!-- Main Diagram -->+ <div class="diagram-container" data-detail-level="map">+ <svg viewBox="0 0 1180 588" role="img" aria-labelledby="archify-diagram-title archify-diagram-description" data-preset="classic" data-quality-profile="standard" data-quality-gates="advisory">+ <title id="archify-diagram-title">Maka</title>+ <desc id="archify-diagram-description">Local-first desktop AI workbench — sessions, tools, permissions, recovery</desc>+ <!-- Definitions -->+ <defs>+ <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-default" />+ </marker>+ <marker id="arrowhead-emphasis" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-emphasis" />+ </marker>+ <marker id="arrowhead-security" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-security" />+ </marker>+ <marker id="arrowhead-dashed" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-dashed" />+ </marker>+ <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">+ <path d="M 40 0 L 0 0 0 40" class="c-grid" stroke-width="0.5"/>+ </pattern>+ </defs>++ <!-- Background Grid -->+ <rect width="100%" height="100%" fill="url(#grid)" />++ <!-- Boundaries (behind everything) -->+ <rect data-graph-role="structural-frame" data-composition-frame-kind="region" data-composition-frame-id="0" x="170" y="110" width="970" height="410" rx="12" class="c-region" stroke-width="1"/>+ <text x="178" y="128" class="t-cloud" font-size="9" font-weight="600">Electron app + packages/runtime</text>++ <rect data-graph-role="structural-frame" data-composition-frame-kind="security-group" data-composition-frame-id="1" x="550" y="110" width="400" height="410" rx="8" class="c-security-group" stroke-width="1"/>+ <text x="558" y="128" class="t-security" font-size="9" font-weight="600">trust boundary</text>++ <!-- Connection paths (before components for correct z-order) -->+ <path data-edge-from="user" data-edge-to="ui" data-edge-key="0" data-composition-points="160,330;200,330" d="M 160 330 L 200 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="ui" data-edge-to="main" data-edge-label="IPC" data-edge-key="1" data-composition-points="340,330;390,330" d="M 340 330 L 390 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="main" data-edge-to="session" data-edge-key="2" data-composition-points="530,330;580,330" d="M 530 330 L 580 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="session" data-edge-to="agentrun" data-edge-label="turn" data-edge-key="3" data-composition-points="730,330;780,330" d="M 730 330 L 780 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="agentrun" data-edge-to="model" data-edge-key="4" data-composition-points="920,330;970,330" d="M 920 330 L 970 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="model" data-edge-to="providers" data-edge-label="stream" data-edge-key="5" data-composition-points="1040,300;1040,200" d="M 1040 300 L 1040 200" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="bots" data-edge-to="session" data-edge-key="6" data-composition-points="655,200;655,300" d="M 655 200 L 655 300" class="a-dashed" stroke-width="1.5" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="agentrun" data-edge-to="permission" data-edge-key="7" data-composition-points="850,300;850,200" d="M 850 300 L 850 200" class="a-security" stroke-width="1.5" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="session" data-edge-to="storage" data-edge-key="8" data-composition-points="655,360;655,440" d="M 655 360 L 655 440" class="a-dashed" stroke-width="1.5" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="agentrun" data-edge-to="toolrt" data-edge-key="9" data-composition-points="850,360;850,440" d="M 850 360 L 850 440" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>+ <path data-edge-from="toolrt" data-edge-to="tools" data-edge-key="10" data-composition-points="920,470;970,470" d="M 920 470 L 970 470" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="toolrt" data-edge-to="permission" data-edge-key="11" data-composition-points="850,500;850,540;1160,540;1160,100;850,100;850,140" d="M 850 500 L 850 532 Q 850 540 858 540 L 1152 540 Q 1160 540 1160 532 L 1160 108 Q 1160 100 1152 100 L 858 100 Q 850 100 850 108 L 850 140" class="a-security" stroke-width="1.5" marker-end="url(#arrowhead-security)"/>++ <!-- Components -->+ <g id="node-user" data-node-id="user" data-node-label="You" tabindex="0" role="button" aria-label="Focus You, desktop user, Architecture component" aria-pressed="false" data-node-kind="external" data-node-sublabel="desktop user" data-node-context="Architecture component">+ <title>You · desktop user · Architecture component</title>+ <rect x="40" y="300" width="120" height="60" rx="6" class="c-mask"/>+ <rect x="40" y="300" width="120" height="60" rx="6" class="c-external" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="external" class="semantic-sigil s-external" transform="translate(46 306) scale(0.6875)">+ <rect x="2.5" y="5" width="8.5" height="8" rx="1.5"/>+ <path d="M8 2.5h5.5V8M13.5 2.5 7.5 8.5"/>+ </g>+ <text data-detail-anchor x="100" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">You</text>+ <text data-detail="context" x="100" y="344" class="t-muted" font-size="9" text-anchor="middle">desktop user</text>+ </g>++ <g id="node-ui" data-node-id="ui" data-node-label="Desktop UI" tabindex="0" role="button" aria-label="Focus Desktop UI, React renderer, Electron app + packages/runtime" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="React renderer" data-node-context="Electron app + packages/runtime">+ <title>Desktop UI · React renderer · Electron app + packages/runtime</title>+ <rect x="200" y="300" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="200" y="300" width="140" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(206 306) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g>+ <text data-detail-anchor x="270" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Desktop UI</text>+ <text data-detail="context" x="270" y="344" class="t-muted" font-size="9" text-anchor="middle">React renderer</text>+ </g>++ <g id="node-main" data-node-id="main" data-node-label="Main Process" tabindex="0" role="button" aria-label="Focus Main Process, Electron IPC, Electron app + packages/runtime" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Electron IPC" data-node-context="Electron app + packages/runtime">+ <title>Main Process · Electron IPC · Electron app + packages/runtime</title>+ <rect x="390" y="300" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="390" y="300" width="140" height="60" rx="6" class="c-backend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(396 306) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g>+ <text data-detail-anchor x="460" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Main Process</text>+ <text data-detail="context" x="460" y="344" class="t-muted" font-size="9" text-anchor="middle">Electron IPC</text>+ </g>++ <g id="node-session" data-node-id="session" data-node-label="SessionManager" tabindex="0" role="button" aria-label="Focus SessionManager, public runtime API, Electron app + packages/runtime" aria-pressed="false" data-node-kind="backend" data-node-sublabel="public runtime API" data-node-context="Electron app + packages/runtime">+ <title>SessionManager · public runtime API · Electron app + packages/runtime</title>+ <rect x="580" y="300" width="150" height="60" rx="6" class="c-mask"/>+ <rect x="580" y="300" width="150" height="60" rx="6" class="c-backend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(586 306) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g>+ <text data-detail-anchor x="655" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">SessionManager</text>+ <text data-detail="context" x="655" y="344" class="t-muted" font-size="9" text-anchor="middle">public runtime API</text>+ </g>++ <g id="node-agentrun" data-node-id="agentrun" data-node-label="AgentRun" tabindex="0" role="button" aria-label="Focus AgentRun, turn + recovery, Electron app + packages/runtime" aria-pressed="false" data-node-kind="backend" data-node-sublabel="turn + recovery" data-node-context="Electron app + packages/runtime">+ <title>AgentRun · turn + recovery · Electron app + packages/runtime</title>+ <rect x="780" y="300" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="780" y="300" width="140" height="60" rx="6" class="c-backend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(786 306) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g>+ <text data-detail-anchor x="850" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">AgentRun</text>+ <text data-detail="context" x="850" y="344" class="t-muted" font-size="9" text-anchor="middle">turn + recovery</text>+ </g>++ <g id="node-model" data-node-id="model" data-node-label="ModelAdapter" tabindex="0" role="button" aria-label="Focus ModelAdapter, stream + usage, Electron app + packages/runtime" aria-pressed="false" data-node-kind="backend" data-node-sublabel="stream + usage" data-node-context="Electron app + packages/runtime">+ <title>ModelAdapter · stream + usage · Electron app + packages/runtime</title>+ <rect x="970" y="300" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="970" y="300" width="140" height="60" rx="6" class="c-backend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(976 306) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g>+ <text data-detail-anchor x="1040" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">ModelAdapter</text>+ <text data-detail="context" x="1040" y="344" class="t-muted" font-size="9" text-anchor="middle">stream + usage</text>+ </g>++ <g id="node-providers" data-node-id="providers" data-node-label="Model Providers" tabindex="0" role="button" aria-label="Focus Model Providers, AI SDK / Ollama, Architecture component" aria-pressed="false" data-node-kind="cloud" data-node-sublabel="AI SDK / Ollama" data-node-tag="API keys local" data-node-context="Architecture component">+ <title>Model Providers · AI SDK / Ollama · Architecture component · API keys local</title>+ <rect x="970" y="140" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="970" y="140" width="140" height="60" rx="6" class="c-cloud" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(976 146) scale(0.6875)">+ <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>+ </g>+ <text data-detail-anchor x="1040" y="168" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Model Providers</text>+ <text data-detail="context" x="1040" y="184" class="t-muted" font-size="9" text-anchor="middle">AI SDK / Ollama</text>+ <text data-detail="fine" x="1040" y="192" class="t-cloud" font-size="7" text-anchor="middle">API keys local</text>+ </g>++ <g id="node-bots" data-node-id="bots" data-node-label="Bots & Gateway" tabindex="0" role="button" aria-label="Focus Bots & Gateway, Telegram · Feishu · HTTP, Architecture component" aria-pressed="false" data-node-kind="external" data-node-sublabel="Telegram · Feishu · HTTP" data-node-context="Architecture component">+ <title>Bots & Gateway · Telegram · Feishu · HTTP · Architecture component</title>+ <rect x="580" y="140" width="150" height="60" rx="6" class="c-mask"/>+ <rect x="580" y="140" width="150" height="60" rx="6" class="c-external" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="external" class="semantic-sigil s-external" transform="translate(586 146) scale(0.6875)">+ <rect x="2.5" y="5" width="8.5" height="8" rx="1.5"/>+ <path d="M8 2.5h5.5V8M13.5 2.5 7.5 8.5"/>+ </g>+ <text data-detail-anchor x="655" y="168" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Bots & Gateway</text>+ <text data-detail="context" x="655" y="184" class="t-muted" font-size="9" text-anchor="middle">Telegram · Feishu · HTTP</text>+ </g>++ <g id="node-permission" data-node-id="permission" data-node-label="Permission" tabindex="0" role="button" aria-label="Focus Permission, policy engine, Electron app + packages/runtime › trust boundary" aria-pressed="false" data-node-kind="security" data-node-sublabel="policy engine" data-node-tag="fail-closed" data-node-context="Electron app + packages/runtime › trust boundary">+ <title>Permission · policy engine · Electron app + packages/runtime › trust boundary · fail-closed</title>+ <rect x="780" y="140" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="780" y="140" width="140" height="60" rx="6" class="c-security" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(786 146) scale(0.6875)">+ <path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>+ <path d="m5.8 8 1.5 1.5 3-3"/>+ </g>+ <text data-detail-anchor x="850" y="168" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Permission</text>+ <text data-detail="context" x="850" y="184" class="t-muted" font-size="9" text-anchor="middle">policy engine</text>+ <text data-detail="fine" x="850" y="192" class="t-security" font-size="7" text-anchor="middle">fail-closed</text>+ </g>++ <g id="node-storage" data-node-id="storage" data-node-label="Local Storage" tabindex="0" role="button" aria-label="Focus Local Storage, userData JSONL, Electron app + packages/runtime › trust boundary" aria-pressed="false" data-node-kind="database" data-node-sublabel="userData JSONL" data-node-context="Electron app + packages/runtime › trust boundary">+ <title>Local Storage · userData JSONL · Electron app + packages/runtime › trust boundary</title>+ <rect x="580" y="440" width="150" height="60" rx="6" class="c-mask"/>+ <rect x="580" y="440" width="150" height="60" rx="6" class="c-database" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(586 446) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ </g>+ <text data-detail-anchor x="655" y="468" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Local Storage</text>+ <text data-detail="context" x="655" y="484" class="t-muted" font-size="9" text-anchor="middle">userData JSONL</text>+ </g>++ <g id="node-toolrt" data-node-id="toolrt" data-node-label="ToolRuntime" tabindex="0" role="button" aria-label="Focus ToolRuntime, validate · abort, Electron app + packages/runtime" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="validate · abort" data-node-context="Electron app + packages/runtime">+ <title>ToolRuntime · validate · abort · Electron app + packages/runtime</title>+ <rect x="780" y="440" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="780" y="440" width="140" height="60" rx="6" class="c-messagebus" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(786 446) scale(0.6875)">+ <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>+ <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>+ <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>+ <circle cx="7" cy="11.5" r="1" class="sigil-fill"/>+ </g>+ <text data-detail-anchor x="850" y="468" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">ToolRuntime</text>+ <text data-detail="context" x="850" y="484" class="t-muted" font-size="9" text-anchor="middle">validate · abort</text>+ </g>++ <g id="node-tools" data-node-id="tools" data-node-label="Local Tools" tabindex="0" role="button" aria-label="Focus Local Tools, Read · Write · Bash, Architecture component" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="Read · Write · Bash" data-node-context="Architecture component">+ <title>Local Tools · Read · Write · Bash · Architecture component</title>+ <rect x="970" y="440" width="140" height="60" rx="6" class="c-mask"/>+ <rect x="970" y="440" width="140" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(976 446) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g>+ <text data-detail-anchor x="1040" y="468" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Local Tools</text>+ <text data-detail="context" x="1040" y="484" class="t-muted" font-size="9" text-anchor="middle">Read · Write · Bash</text>+ </g>++ <!-- Connection labels -->++ <g data-detail="context" data-edge-from="ui" data-edge-to="main" data-edge-label="IPC" data-edge-key="1">+ <rect x="350" y="310" width="30" height="14" rx="3" class="c-mask"/>+ <text x="365" y="320" class="t-backend" font-size="8" text-anchor="middle">IPC</text>+ </g>++ <g data-detail="context" data-edge-from="session" data-edge-to="agentrun" data-edge-label="turn" data-edge-key="3">+ <rect x="740" y="310" width="30" height="14" rx="3" class="c-mask"/>+ <text x="755" y="320" class="t-backend" font-size="8" text-anchor="middle">turn</text>+ </g>++ <g data-detail="context" data-edge-from="model" data-edge-to="providers" data-edge-label="stream" data-edge-key="5">+ <rect x="1020.6" y="280" width="38.8" height="14" rx="3" class="c-mask"/>+ <text x="1040" y="290" class="t-backend" font-size="8" text-anchor="middle">stream</text>+ </g>++++++++ <!-- Legend -->+ <g data-legend-bridge>+ <text x="40" y="559" class="t-primary" font-size="9" font-weight="600">Legend</text>+ <g data-legend-kind="external">+ <rect x="40" y="564" width="14" height="9" rx="2" class="c-external" stroke-width="1"/>+ <text x="60" y="572" class="t-muted" font-size="8">External</text>+ </g>+ <g data-legend-kind="frontend">+ <rect x="144" y="564" width="14" height="9" rx="2" class="c-frontend" stroke-width="1"/>+ <text x="164" y="572" class="t-muted" font-size="8">Frontend</text>+ </g>+ <g data-legend-kind="backend">+ <rect x="248" y="564" width="14" height="9" rx="2" class="c-backend" stroke-width="1"/>+ <text x="268" y="572" class="t-muted" font-size="8">Backend</text>+ </g>+ <g data-legend-kind="cloud">+ <rect x="347" y="564" width="14" height="9" rx="2" class="c-cloud" stroke-width="1"/>+ <text x="367" y="572" class="t-muted" font-size="8">Cloud</text>+ </g>+ <g data-legend-kind="security">+ <rect x="436" y="564" width="14" height="9" rx="2" class="c-security" stroke-width="1"/>+ <text x="456" y="572" class="t-muted" font-size="8">Security</text>+ </g>+ <g data-legend-kind="database">+ <rect x="540" y="564" width="14" height="9" rx="2" class="c-database" stroke-width="1"/>+ <text x="560" y="572" class="t-muted" font-size="8">Database</text>+ </g>+ <g data-legend-kind="messagebus">+ <rect x="644" y="564" width="14" height="9" rx="2" class="c-messagebus" stroke-width="1"/>+ <text x="664" y="572" class="t-muted" font-size="8">Message bus</text>+ </g>+ </g>+ </svg>+ <p class="intent-trace-status no-print" id="intent-trace-status" role="status" aria-live="polite" aria-atomic="true"></p>+ <div class="share-chapter-cue no-print" id="share-chapter-cue" hidden role="status" aria-live="polite">+ <div class="share-chapter-index">+ <span class="share-chapter-state" id="share-chapter-state">Ready</span>+ <span class="share-chapter-count" id="share-chapter-count">Chapter 01 / 01</span>+ </div>+ <div class="share-chapter-copy">+ <strong id="share-chapter-label">Guided chapter</strong>+ <small id="share-chapter-note"></small>+ </div>+ <span class="share-chapter-route" id="share-chapter-route"></span>+ <span class="share-chapter-progress" aria-hidden="true"><span id="share-chapter-progress-bar"></span></span>+ </div>+ <div class="diagram-guide no-print" id="diagram-guide" hidden role="dialog" aria-modal="false" aria-labelledby="diagram-guide-title">+ <div class="diagram-guide-head">+ <span>+ <span class="diagram-guide-eyebrow">Diagram guide</span>+ <strong class="diagram-guide-title" id="diagram-guide-title">Explore this system</strong>+ </span>+ <button class="diagram-guide-close" id="diagram-guide-close" type="button" aria-label="Close diagram guide">×</button>+ </div>+ <p class="diagram-guide-stats" id="diagram-guide-stats">Inspecting compiled semantics</p>+ <div class="diagram-guide-actions" id="diagram-guide-actions" role="group" aria-label="Diagram exploration actions">+ <button class="diagram-guide-action" type="button" data-guide-action="find" aria-label="Find any node">+ <span class="diagram-guide-index" aria-hidden="true">01</span>+ <span class="diagram-guide-action-copy"><strong>Find any node</strong><small>Search labels, responsibilities, kinds, and stable IDs.</small></span>+ <kbd aria-hidden="true">/</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="route" aria-label="Trace a directed route">+ <span class="diagram-guide-index" aria-hidden="true">02</span>+ <span class="diagram-guide-action-copy"><strong>Trace a route</strong><small>Ask how two semantic nodes connect in authored direction.</small></span>+ <kbd aria-hidden="true">R</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="map" aria-label="See the whole system">+ <span class="diagram-guide-index" aria-hidden="true">03</span>+ <span class="diagram-guide-action-copy"><strong>See the whole system</strong><small>Open Semantic Radar with a live viewport and stable nodes.</small></span>+ <kbd aria-hidden="true">M</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="lens" aria-label="Compare semantic kinds">+ <span class="diagram-guide-index" aria-hidden="true">04</span>+ <span class="diagram-guide-action-copy"><strong>Compare semantic kinds</strong><small>Count roles, reveal their traffic, and compare direct authored links.</small></span>+ <kbd aria-hidden="true">L</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="story" aria-label="Play the guided story">+ <span class="diagram-guide-index" aria-hidden="true">05</span>+ <span class="diagram-guide-action-copy"><strong>Play the guided story</strong><small id="diagram-guide-story-copy">Walk the authored chapters and real relationships.</small></span>+ <kbd aria-hidden="true">P</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="present" aria-label="Enter presentation stage">+ <span class="diagram-guide-index" aria-hidden="true">06</span>+ <span class="diagram-guide-action-copy"><strong>Enter Presentation Stage</strong><small>Give the live diagram the viewport without changing export.</small></span>+ <kbd aria-hidden="true">F</kbd>+ </button>+ </div>+ <div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ </div>+ <p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p>+ </div>+ <div class="node-finder no-print" id="node-finder" hidden role="dialog" aria-modal="false" aria-labelledby="node-finder-title">+ <div class="node-finder-head">+ <strong id="node-finder-title">Find a node</strong>+ <button class="node-finder-close" id="node-finder-close" type="button" aria-label="Close node finder">×</button>+ </div>+ <div class="node-finder-search">+ <span aria-hidden="true">⌕</span>+ <input class="node-finder-input" id="node-finder-input" type="search" autocomplete="off" spellcheck="false" placeholder="Search labels or IDs" aria-describedby="node-finder-status">+ <kbd aria-hidden="true">/</kbd>+ </div>+ <div class="node-finder-results" id="node-finder-results" role="group" aria-label="Diagram nodes"></div>+ <p class="node-finder-empty" id="node-finder-empty" hidden>No matching nodes</p>+ <p class="node-finder-status" id="node-finder-status" aria-live="polite"></p>+ </div>+ <div class="focus-chip relationship-lens no-print" id="focus-chip" hidden role="region" aria-labelledby="relationship-lens-title">+ <div class="relationship-lens-head">+ <div class="relationship-lens-copy">+ <span class="relationship-lens-eyebrow">Semantic passport</span>+ <strong class="relationship-lens-title" id="relationship-lens-title"><span id="focus-label"></span></strong>+ <span class="semantic-passport-detail" id="focus-detail" hidden></span>+ <div class="semantic-passport-meta" id="focus-passport-meta" aria-label="Node metadata">+ <span id="focus-kind" data-passport="kind"></span>+ <span id="focus-context" data-passport="context" hidden></span>+ <span id="focus-tag" data-passport="tag" hidden></span>+ <code id="focus-id" data-passport="id"></code>+ </div>+ <span class="relationship-lens-summary" id="focus-summary" aria-live="polite"></span>+ </div>+ <div class="relationship-lens-actions">+ <button id="btn-focus-copy" type="button" aria-label="Copy link to focused node">Copy link</button>+ <button id="btn-focus-relations" type="button" aria-label="Show connected relationships" aria-expanded="false" aria-controls="relationship-lens-list">Relations</button>+ <button id="btn-focus-clear" type="button" aria-label="Clear focused node">Clear</button>+ </div>+ </div>+ <div class="relationship-lens-list" id="relationship-lens-list" aria-label="Connected relationships"></div>+ </div>+ <div class="route-probe no-print" id="route-probe" hidden role="region" aria-labelledby="route-probe-title" data-state="idle">+ <div class="route-probe-head">+ <span class="route-probe-copy">+ <span class="route-probe-eyebrow">Route probe</span>+ <strong class="route-probe-title" id="route-probe-title">Choose a start node</strong>+ </span>+ <span class="route-probe-actions">+ <button class="route-probe-find" id="route-probe-find" type="button" aria-label="Find a route start" data-node-finder-trigger>Find start</button>+ <button class="route-probe-copy-link" id="route-probe-copy" type="button" aria-label="Copy link to traced route" hidden>Copy link</button>+ <button id="route-probe-clear" type="button" aria-label="Clear route probe">Clear</button>+ </span>+ </div>+ <div class="route-probe-path" id="route-probe-path" aria-label="Traced route">+ <span class="route-probe-placeholder">Pick two semantic nodes on the diagram</span>+ </div>+ <div class="route-journey-controls" id="route-journey-controls" hidden role="group" aria-label="Route journey controls" data-playing="false">+ <button id="route-journey-prev" type="button" aria-label="Previous route position" title="Previous route position">←</button>+ <button class="route-journey-play" id="route-journey-play" type="button" aria-label="Play route journey" aria-pressed="false" title="Play route journey">+ <span id="route-journey-play-icon" aria-hidden="true">▶</span>+ <span id="route-journey-play-label">Journey</span>+ </button>+ <button id="route-journey-next" type="button" aria-label="Next route position" title="Next route position">→</button>+ <button class="route-journey-overview" id="route-journey-overview" type="button" aria-label="Show complete route overview" title="Show complete route overview">Overview</button>+ </div>+ <small class="route-probe-status" id="route-probe-status" aria-live="polite">Choose the source, then the destination. Direction matters.</small>+ </div>+ <div class="semantic-lens no-print" id="semantic-lens" hidden role="dialog" aria-modal="false" aria-labelledby="semantic-lens-title">+ <div class="semantic-lens-head">+ <span>+ <span class="semantic-lens-eyebrow">Semantic lens</span>+ <strong class="semantic-lens-title" id="semantic-lens-title">Compare system roles</strong>+ </span>+ <button class="semantic-lens-close" id="semantic-lens-close" type="button" aria-label="Close semantic lens">×</button>+ </div>+ <p class="semantic-lens-instruction">Choose up to two semantic kinds. One reveals its real traffic; two compare only direct authored relationships.</p>+ <div class="semantic-lens-kinds" id="semantic-lens-kinds" role="group" aria-label="Semantic kinds"></div>+ <p class="semantic-lens-status" id="semantic-lens-status" aria-live="polite">Choose a kind to inspect its nodes and touching relationships.</p>+ <div class="semantic-lens-actions">+ <button id="semantic-lens-copy" type="button" aria-label="Copy link to semantic lens" hidden>Copy link</button>+ <button id="semantic-lens-clear" type="button" aria-label="Clear semantic lens">Clear</button>+ </div>+ </div>+ <div class="overview-map no-print" id="overview-map" hidden role="region" aria-labelledby="overview-map-title">+ <div class="overview-map-head">+ <span class="overview-map-live" aria-hidden="true"></span>+ <span class="overview-map-copy">+ <strong id="overview-map-title">Semantic radar</strong>+ <small id="overview-map-status" aria-live="polite">Building overview</small>+ </span>+ <button class="overview-map-close" id="overview-map-close" type="button" aria-label="Close semantic radar">×</button>+ </div>+ <div class="overview-map-surface" id="overview-map-surface" tabindex="0" role="group" aria-label="Diagram overview. Click a node to focus it, or use arrow keys to pan."></div>+ <div class="overview-map-hint" aria-hidden="true"><span>Click node</span><span>Drag to pan</span></div>+ </div>+ <div class="diagram-nav no-print" role="toolbar" aria-label="Diagram view controls">+ <button id="btn-route-probe" type="button" aria-label="Trace a directed route" aria-pressed="false" aria-controls="route-probe" title="Trace route (R)">PATH</button>+ <button id="btn-overview-map" type="button" aria-label="Open semantic radar" aria-expanded="false" aria-controls="overview-map" title="Semantic radar (M)">MAP</button>+ <button id="btn-semantic-lens" type="button" aria-label="Open semantic lens" aria-haspopup="dialog" aria-expanded="false" aria-pressed="false" aria-controls="semantic-lens" title="Semantic lens (L)">LENS</button>+ <button id="btn-node-finder" type="button" aria-label="Find a node" aria-haspopup="dialog" aria-expanded="false" aria-controls="node-finder" title="Find a node (/)" data-node-finder-trigger>⌕</button>+ <button id="btn-diagram-guide" type="button" aria-label="Open diagram guide" aria-haspopup="dialog" aria-expanded="false" aria-controls="diagram-guide" title="Diagram guide (?)">?</button>+ <button data-view="out" type="button" aria-label="Zoom out" title="Zoom out (-)">−</button>+ <button data-view="reset" type="button" aria-label="Reset diagram view" title="Reset view (0)">100%</button>+ <button data-view="in" type="button" aria-label="Zoom in" title="Zoom in (+)">+</button>+ </div>+ </div>++ <!-- Info Cards -->+ <div class="cards">+ <div class="card">+ <div class="card-header">+ <div class="card-dot cyan"></div>+ <h3>Desktop surfaces</h3>+ </div>+ <ul>+ <li>• apps/desktop: renderer, preload, main process</li>+ <li>• Settings for models, bots, search, gateway, permissions</li>+ <li>• Bots and open gateway share SessionManager as the public API</li>+ </ul>+ </div>++ <div class="card">+ <div class="card-header">+ <div class="card-dot emerald"></div>+ <h3>Runtime kernel</h3>+ </div>+ <ul>+ <li>• SessionManager → AgentRun → AiSdkBackend</li>+ <li>• ModelAdapter normalizes provider streams and usage</li>+ <li>• ToolRuntime owns tool validation, abort, and telemetry</li>+ </ul>+ </div>++ <div class="card">+ <div class="card-header">+ <div class="card-dot rose"></div>+ <h3>Local & privacy</h3>+ </div>+ <ul>+ <li>• Sessions and credentials live under Electron userData</li>+ <li>• Write/Bash and risky ops go through the permission engine</li>+ <li>• Renderer never sees plaintext secrets — only masked status</li>+ </ul></div></div>++ <!-- Footer -->+ <p class="footer">+ Architecture diagram • Built with Archify<span class="no-print"> • <a class="artifact-start-link" href="https://tt-a1i.github.io/archify/start.html?type=architecture" target="_blank" rel="noopener noreferrer">Create yours ↗</a> • Hover to trace • <kbd>R</kbd> route • Click to focus • <kbd>+</kbd>/<kbd>−</kbd> zoom • <kbd>M</kbd> radar • <kbd>T</kbd> theme • <kbd>E</kbd> export</span>+ </p></div>- <div class="container">- <!-- Header -->- <div class="header">- <div class="header-row">- <div class="pulse-dot"></div>- <h1>Maka</h1>- </div>- <p class="subtitle">Local-first desktop AI workbench — sessions, tools, permissions, recovery</p>- </div>+ <script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();++ /* ============================================================+ Theme toggle — persists to localStorage, respects system pref+ ============================================================ */++ Archify.theme = (function () {+ var STORAGE_KEY = 'archify-theme';+ var html = document.documentElement;+ var btn = document.getElementById('btn-theme');+ var icon = document.getElementById('theme-icon');+ var label = document.getElementById('theme-label');++ // localStorage can throw (blocked cookies, sandboxed iframes); the whole+ // script element dies on an uncaught error, so guard every access.+ function readStored() {+ try { return localStorage.getItem(STORAGE_KEY); } catch (_) { return null; }+ }+ function writeStored(value) {+ try { localStorage.setItem(STORAGE_KEY, value); } catch (_) {}+ }+ function urlOverride() {+ // URL param wins (useful for deterministic screenshots / share links)+ try {+ var param = new URLSearchParams(window.location.search).get('theme');+ if (param === 'light' || param === 'dark') return param;+ } catch (_) {}+ return null;+ }++ function resolveInitial() {+ var fromUrl = urlOverride();+ if (fromUrl) return fromUrl;+ var saved = readStored();+ if (saved === 'light' || saved === 'dark') return saved;+ return window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';+ }++ function apply(theme) {+ html.setAttribute('data-theme', theme);+ icon.textContent = theme === 'dark' ? '\u263E' : '\u263C';+ label.textContent = theme === 'dark' ? 'Dark' : 'Light';+ btn.setAttribute('aria-pressed', theme === 'light' ? 'true' : 'false');+ }++ function toggle() {+ var next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';+ apply(next);+ writeStored(next);+ }++ apply(resolveInitial());+ btn.addEventListener('click', toggle);++ // Follow live OS theme changes while the user has no explicit preference.+ try {+ var media = window.matchMedia('(prefers-color-scheme: light)');+ var onChange = function (e) {+ var saved = readStored();+ if (urlOverride() || saved === 'light' || saved === 'dark') return;+ apply(e.matches ? 'light' : 'dark');+ };+ if (media.addEventListener) media.addEventListener('change', onChange);+ else if (media.addListener) media.addListener(onChange);+ } catch (_) {}++ return { toggle: toggle };+ })();++ /* ============================================================+ Export — PNG / JPEG / WebP / SVG / WebM and Copy PNG (clipboard)++ Raster exports are always rendered at 4x source resolution for+ maximum sharpness. The trick: we set the serialized SVG's+ `width`/`height` to viewBox * 4 so the browser rasterizes the+ vectors at that resolution natively. drawImage then draws at+ the image's natural size (no upscaling = no blur).++ JPEG/WebP paint the current theme's background explicitly since+ those formats have no alpha channel.+ ============================================================ */+ (function () {+ var RASTER_SCALE = 4;+ var MOTION_DURATION = 6000;+ var MOTION_FPS = 30;++ function diagramFilename() {+ var title = (document.title || 'diagram')+ .replace(/\s+Architecture(\s+Diagram)?$/i, '')+ .replace(/\s+Diagram$/i, '')+ .trim();+ return title.replace(/[^a-z0-9_\-]+/gi, '-')+ .toLowerCase()+ .replace(/^-+|-+$/g, '') || 'diagram';+ }++ function currentBg() {+ return getComputedStyle(document.body).backgroundColor || '#ffffff';+ }++ /**+ * Serialize the main SVG into a standalone document.+ *+ * Two modes:+ * - Default (opts.autoTheme=false) — locks the serialized SVG to the+ * viewer's current theme. Used by the raster pipeline+ * (PNG/JPEG/WebP/clipboard) because canvas rasterization needs+ * deterministic colors; a raster cannot react to+ * prefers-color-scheme after encoding.+ * - autoTheme=true — emits BOTH dark and light variable sets plus a+ * `@media (prefers-color-scheme)` rule so the resulting SVG+ * self-themes when embedded in GitHub READMEs or other hosts that+ * expose a color scheme. Used for "Download SVG".+ */+ function serializeSvg(scale, opts) {+ // scale: integer multiplier for intrinsic SVG pixel dimensions used by+ // the raster path. Defaults to 1 (natural size) for SVG download.+ scale = scale || 1;+ opts = opts || {};+ var autoTheme = opts.autoTheme === true;+ var svg = document.querySelector('.diagram-container svg');+ var clone = svg.cloneNode(true);++ // View transforms and neighborhood focus are HTML exploration state,+ // never part of a downloaded full-diagram artifact.+ clone.style.removeProperty('transform');+ clone.removeAttribute('data-view-scale');+ clone.removeAttribute('data-focus-active');+ clone.removeAttribute('data-lens-active');+ clone.removeAttribute('data-lens-flow-count');+ clone.removeAttribute('data-lens-flow-density');+ clone.removeAttribute('data-legend-preview-active');+ clone.removeAttribute('data-relationship-preview-active');+ clone.removeAttribute('data-relationship-direct-active');+ clone.removeAttribute('data-relationship-pin-active');+ clone.removeAttribute('data-intent-trace-active');+ clone.removeAttribute('data-route-picking');+ clone.removeAttribute('data-route-active');+ clone.removeAttribute('data-route-journey');+ clone.removeAttribute('data-story-active');+ clone.removeAttribute('data-story-playing');+ clone.removeAttribute('data-story-beat');+ clone.removeAttribute('data-story-next');+ clone.removeAttribute('data-story-follow');+ clone.removeAttribute('data-chapter-handoff');+ clone.removeAttribute('data-chapter-anchor');+ clone.removeAttribute('data-chapter-preview');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-handoff-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-role]'), function (el) {+ el.removeAttribute('data-chapter-role');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-preview-role]'), function (el) {+ el.removeAttribute('data-chapter-preview-role');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-intent-trace-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-route-probe-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-route-journey-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-semantic-lens-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-bridge-runtime]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-kind]'), function (el) {+ el.removeAttribute('data-legend-kind');+ el.removeAttribute('data-legend-count');+ el.removeAttribute('data-legend-zero');+ el.removeAttribute('data-legend-selected');+ el.removeAttribute('role');+ el.removeAttribute('tabindex');+ el.removeAttribute('aria-label');+ el.removeAttribute('aria-pressed');+ el.removeAttribute('aria-haspopup');+ el.removeAttribute('aria-controls');+ el.removeAttribute('aria-expanded');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-bridge]'), function (el) {+ el.removeAttribute('data-legend-bridge');+ el.removeAttribute('role');+ el.removeAttribute('aria-label');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-pulse-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-hit-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-story-step], [data-story-beat-state], [data-story-beat-step]'), function (el) {+ el.removeAttribute('data-story-step');+ el.removeAttribute('data-story-beat-state');+ el.removeAttribute('data-story-beat-step');+ el.style.removeProperty('--story-step');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-focus-match], [data-focus-selected]'), function (el) {+ el.removeAttribute('data-focus-match');+ el.removeAttribute('data-focus-selected');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-lens-match], [data-lens-selected], [data-lens-peer]'), function (el) {+ el.removeAttribute('data-lens-match');+ el.removeAttribute('data-lens-selected');+ el.removeAttribute('data-lens-peer');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer]'), function (el) {+ el.removeAttribute('data-legend-preview-match');+ el.removeAttribute('data-legend-preview-selected');+ el.removeAttribute('data-legend-preview-peer');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target]'), function (el) {+ el.removeAttribute('data-relationship-preview');+ el.removeAttribute('data-relationship-preview-node');+ el.removeAttribute('data-relationship-preview-source');+ el.removeAttribute('data-relationship-preview-target');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-intent-trace-match], [data-intent-trace-selected]'), function (el) {+ el.removeAttribute('data-intent-trace-match');+ el.removeAttribute('data-intent-trace-selected');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current]'), function (el) {+ el.removeAttribute('data-route-match');+ el.removeAttribute('data-route-start');+ el.removeAttribute('data-route-end');+ el.removeAttribute('data-route-step');+ el.removeAttribute('data-route-candidate');+ el.removeAttribute('data-route-journey-state');+ el.removeAttribute('data-route-journey-current');+ el.style.removeProperty('--route-step');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {+ el.removeAttribute('data-detail');+ el.removeAttribute('data-detail-anchor');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-node-id][aria-pressed]'), function (el) {+ el.setAttribute('aria-pressed', 'false');+ });+ var canonicalStateClean = !clone.hasAttribute('data-view-scale') &&+ !clone.hasAttribute('data-focus-active') &&+ !clone.hasAttribute('data-lens-active') &&+ !clone.hasAttribute('data-lens-flow-count') &&+ !clone.hasAttribute('data-lens-flow-density') &&+ !clone.hasAttribute('data-legend-preview-active') &&+ !clone.hasAttribute('data-relationship-preview-active') &&+ !clone.hasAttribute('data-relationship-direct-active') &&+ !clone.hasAttribute('data-intent-trace-active') &&+ !clone.hasAttribute('data-route-picking') &&+ !clone.hasAttribute('data-route-active') &&+ !clone.hasAttribute('data-route-journey') &&+ !clone.hasAttribute('data-story-active') &&+ !clone.hasAttribute('data-story-playing') &&+ !clone.hasAttribute('data-story-beat') &&+ !clone.hasAttribute('data-story-next') &&+ !clone.hasAttribute('data-story-follow') &&+ !clone.hasAttribute('data-chapter-handoff') &&+ !clone.hasAttribute('data-chapter-anchor') &&+ !clone.hasAttribute('data-chapter-preview') &&+ !clone.style.getPropertyValue('transform') &&+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-detail], [data-detail-anchor]').length === 0;++ var vb = svg.viewBox.baseVal;+ // Scale width/height so the browser rasterizes the vectors at target+ // resolution directly. viewBox stays unchanged so coordinates don't+ // shift. This is the key to sharp rasters — do NOT scale later via+ // canvas upscaling.+ clone.setAttribute('width', vb.width * scale);+ clone.setAttribute('height', vb.height * scale);+ clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');++ // Only the SVG-relevant rules: semantic classes, markers, and the+ // theme variable blocks. Toolbar/cards/print CSS can never apply+ // inside a standalone SVG and would only bloat the export.+ var hostStyle = (function () {+ var out = [];+ Array.prototype.forEach.call(document.styleSheets, function (sheet) {+ var rules;+ try { rules = sheet.cssRules; } catch (_) { return; } // cross-origin+ if (!rules) return;+ Array.prototype.forEach.call(rules, function (rule) {+ if (rule.type === 7 && /^archify-/.test(rule.name || '')) {+ out.push(rule.cssText);+ return;+ }+ if (rule.type !== 1) return; // plain style rules only+ var sel = rule.selectorText || '';+ if (/(^|,)\s*(svg|:root|\[data-theme|\[data-preset|\.c-|\.t-|\.a-|\.m-)/.test(sel)) {+ out.push(rule.cssText);+ }+ });+ });+ return out.join('\n');+ })();++ // Derive the variable list from the stylesheet so newly added theme+ // variables can never be missed by the export pipeline again+ // (--lane-fill/--lane-stroke once were).+ var varNames = (function () {+ var seen = {};+ var names = [];+ (hostStyle.match(/--[a-zA-Z0-9-]+(?=\s*:)/g) || []).forEach(function (n) {+ if (!seen[n]) { seen[n] = true; names.push(n); }+ });+ return names;+ })();++ // Resolve the full variable set for a given data-theme via an+ // off-DOM probe, independent of what the viewer is currently set to.+ function resolveVars(themeAttr) {+ var probe = document.createElement('div');+ probe.setAttribute('data-theme', themeAttr);+ probe.setAttribute('data-preset', document.documentElement.getAttribute('data-preset') || 'classic');+ probe.style.cssText = 'position:absolute;width:0;height:0;visibility:hidden;';+ document.body.appendChild(probe);+ try {+ var c = getComputedStyle(probe);+ return varNames.map(function (n) {+ return n + ': ' + c.getPropertyValue(n).trim() + ';';+ }).join(' ');+ } finally {+ document.body.removeChild(probe);+ }+ }++ // Prepend a local()-only @font-face block for each weight so that the+ // sandboxed image-rendering context used during PNG/JPEG/WebP export+ // can find JetBrains Mono if the user has it installed locally, and+ // falls through cleanly to the monospace stack otherwise. The usual+ // Google-Fonts <link> in the host document is unreachable from the+ // serialized SVG, so url()-sourced faces would just hang.+ var fontFallback = [400, 500, 600, 700].map(function (w) {+ return "@font-face { font-family: 'JetBrains Mono'; font-weight: " + w ++ "; src: local('JetBrains Mono'), local('JetBrainsMono-Regular'); }";+ }).join('\n');++ var style = document.createElementNS('http://www.w3.org/2000/svg', 'style');+ var bgRect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');+ bgRect.setAttribute('width', '100%');+ bgRect.setAttribute('height', '100%');++ if (autoTheme) {+ // Dual-theme SVG. Dark is the default (so hosts without+ // prefers-color-scheme still render), light swaps in via media+ // query, and svg[data-theme="..."] still lets downstream+ // consumers force a specific theme.+ var darkVars = resolveVars('dark');+ var lightVars = resolveVars('light');++ style.textContent =+ fontFallback + "\n" ++ "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" ++ hostStyle + "\n" ++ ":root, svg { " + darkVars + " }\n" ++ "@media (prefers-color-scheme: light) { :root, svg { " + lightVars + " } }\n" ++ "svg[data-theme=\"light\"] { " + lightVars + " }\n" ++ "svg[data-theme=\"dark\"] { " + darkVars + " }\n" ++ "rect.c-bg-rect { fill: var(--bg); }\n";++ // Don't lock the serialized SVG to the viewer's current theme.+ clone.removeAttribute('data-theme');+ // Background follows the CSS variable, not a fixed color, so it+ // swaps with the media query.+ bgRect.setAttribute('class', 'c-bg-rect');+ } else {+ // Raster path: lock to the viewer's current theme.+ var theme = document.documentElement.getAttribute('data-theme') || 'dark';+ var themeHost = document.querySelector('[data-theme="' + theme + '"]') || document.documentElement;+ var computed = getComputedStyle(themeHost);+ var vars = varNames.map(function (n) {+ return n + ': ' + computed.getPropertyValue(n).trim() + ';';+ }).join(' ');++ // IMPORTANT: inject the resolved variables AFTER hostStyle,+ // otherwise hostStyle's ":root, [data-theme=\"dark\"] { ... }" rule+ // overrides our chosen theme via later-in-cascade equal-specificity.+ // Keep this order.+ style.textContent =+ fontFallback + "\n" ++ "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" ++ hostStyle + "\n" ++ ":root, svg { " + vars + " }\n";++ bgRect.setAttribute('fill', computed.getPropertyValue('--bg').trim() || '#ffffff');+ }++ clone.insertBefore(style, clone.firstChild);+ clone.insertBefore(bgRect, style.nextSibling);++ return {+ svgString: new XMLSerializer().serializeToString(clone),+ width: vb.width * scale,+ height: vb.height * scale,+ canonicalStateClean: canonicalStateClean+ };+ }++ function download(blob, filename) {+ var url = URL.createObjectURL(blob);+ var a = document.createElement('a');+ a.href = url;+ a.download = filename;+ document.body.appendChild(a);+ a.click();+ a.remove();+ setTimeout(function () { URL.revokeObjectURL(url); }, 1000);+ }++ // Conservative upper bound on total canvas pixels. Older Safari on iOS+ // silently produces a blank canvas above ~16 Mpx; Chrome / Firefox /+ // desktop Safari are far higher but start failing on memory-constrained+ // devices. We pick the largest integer scale in {4,3,2,1} whose target+ // pixel count fits under this cap.+ var MAX_CANVAS_PIXELS = 16 * 1024 * 1024;++ function pickSafeScale(vbW, vbH) {+ for (var s = RASTER_SCALE; s >= 1; s--) {+ if (vbW * s * vbH * s <= MAX_CANVAS_PIXELS) return s;+ }+ return 1;+ }++ function rasterize(format) {+ // Serialize at a safe scale (RASTER_SCALE=4 by default, reduced if the+ // resulting canvas would exceed MAX_CANVAS_PIXELS). The SVG itself is+ // rasterized at target resolution natively; drawImage draws at natural+ // size — no upsampling blur.+ var svg = document.querySelector('.diagram-container svg');+ var vb = svg.viewBox.baseVal;+ var scale = pickSafeScale(vb.width, vb.height);+ var data = serializeSvg(scale);+ var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });+ var svgUrl = URL.createObjectURL(svgBlob);++ return new Promise(function (resolve, reject) {+ var img = new Image();+ img.onload = function () {+ var canvas = document.createElement('canvas');+ canvas.width = data.width;+ canvas.height = data.height;+ var ctx = canvas.getContext('2d');+ if (format === 'jpeg') {+ ctx.fillStyle = currentBg();+ ctx.fillRect(0, 0, canvas.width, canvas.height);+ }+ // Draw at natural size — SVG was already rasterized at target res.+ ctx.drawImage(img, 0, 0);+ URL.revokeObjectURL(svgUrl);+ var mime = format === 'jpeg' ? 'image/jpeg' :+ format === 'webp' ? 'image/webp' : 'image/png';+ var quality = format === 'png' ? undefined : 0.95;+ canvas.toBlob(function (blob) {+ if (!blob) reject(new Error('toBlob returned null for ' + format));+ else resolve(blob);+ }, mime, quality);+ };+ img.onerror = function (e) {+ URL.revokeObjectURL(svgUrl);+ reject(e);+ };+ img.src = svgUrl;+ });+ }++ function motionMimeType() {+ if (typeof MediaRecorder === 'undefined') return '';+ var candidates = [+ 'video/webm;codecs=vp9',+ 'video/webm;codecs=vp8',+ 'video/webm'+ ];+ for (var i = 0; i < candidates.length; i++) {+ if (!MediaRecorder.isTypeSupported || MediaRecorder.isTypeSupported(candidates[i])) return candidates[i];+ }+ return '';+ }++ function canRecordMotion() {+ var svg = document.querySelector('.diagram-container svg');+ return !!(svg && svg.getAttribute('data-animation') === 'trace' &&+ typeof MediaRecorder !== 'undefined' && motionMimeType() &&+ typeof HTMLCanvasElement !== 'undefined' &&+ typeof HTMLCanvasElement.prototype.captureStream === 'function');+ }++ // Record the live CSS animation without Puppeteer, ffmpeg, or a network+ // dependency. SVG files loaded through Image are commonly rasterized as+ // one cached bitmap, so repeatedly drawing that Image does not reliably+ // advance its CSS animation. Keep one crisp static SVG background, then+ // render an explicit time-varying signal scene over the real authored+ // relationship geometry on every captured canvas frame.+ function recordWebm(options) {+ options = options || {};+ if (!canRecordMotion()) {+ return Promise.reject(new Error('WebM motion export requires a trace animation and browser MediaRecorder support'));+ }+ var duration = Math.max(250, Number(options.duration) || MOTION_DURATION);+ var fps = Math.max(1, Number(options.fps) || MOTION_FPS);+ var svg = document.querySelector('.diagram-container svg');+ var vb = svg.viewBox.baseVal;+ var scale = Math.min(1, 1280 / vb.width);+ var data = serializeSvg(scale);+ var sourceUrl = URL.createObjectURL(new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' }));++ function createMotionScene(root) {+ var rootMatrix = root.getCTM ? root.getCTM() : null;++ function pointInRoot(element, point) {+ if (!rootMatrix || !element.getCTM || !point.matrixTransform) return { x: point.x, y: point.y };+ try {+ var elementMatrix = element.getCTM();+ if (!elementMatrix) return { x: point.x, y: point.y };+ var mapped = point.matrixTransform(rootMatrix.inverse().multiply(elementMatrix));+ return { x: mapped.x, y: mapped.y };+ } catch (_) {+ return { x: point.x, y: point.y };+ }+ }++ function samplesFor(element) {+ if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];+ var length;+ try { length = element.getTotalLength(); } catch (_) { return []; }+ if (!Number.isFinite(length) || length <= 0) return [];+ var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));+ var points = [];+ for (var i = 0; i <= count; i++) {+ points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));+ }+ return points;+ }++ function authoredStep(element, fallback) {+ var raw = element.style.getPropertyValue('--step') || getComputedStyle(element).getPropertyValue('--step');+ var value = Number(raw);+ return Number.isFinite(value) ? value : fallback;+ }++ var edges = Array.prototype.slice.call(root.querySelectorAll('[data-animate="edge"]')).map(function (element, index) {+ var computed = getComputedStyle(element);+ return {+ points: samplesFor(element),+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ width: Math.max(1.5, parseFloat(computed.strokeWidth) || 1.5),+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(function (edge) { return edge.points.length > 1; });++ var nodes = Array.prototype.slice.call(root.querySelectorAll('[data-node-id][data-animate="node"]')).map(function (element, index) {+ var box;+ try { box = element.getBBox(); } catch (_) { return null; }+ var painted = element.querySelector('[class*="c-"]') || element;+ var computed = getComputedStyle(painted);+ return {+ x: box.x,+ y: box.y,+ width: box.width,+ height: box.height,+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(Boolean);++ return { edges: edges, nodes: nodes, x: vb.x, y: vb.y, width: vb.width, height: vb.height };+ }++ function pointAlong(points, progress) {+ var scaled = Math.max(0, Math.min(1, progress)) * (points.length - 1);+ var index = Math.min(points.length - 2, Math.floor(scaled));+ var mix = scaled - index;+ return {+ x: points[index].x + (points[index + 1].x - points[index].x) * mix,+ y: points[index].y + (points[index + 1].y - points[index].y) * mix+ };+ }++ function roundedRectPath(ctx, x, y, width, height, radius) {+ var r = Math.max(0, Math.min(radius, width / 2, height / 2));+ ctx.beginPath();+ ctx.moveTo(x + r, y);+ ctx.lineTo(x + width - r, y);+ ctx.quadraticCurveTo(x + width, y, x + width, y + r);+ ctx.lineTo(x + width, y + height - r);+ ctx.quadraticCurveTo(x + width, y + height, x + width - r, y + height);+ ctx.lineTo(x + r, y + height);+ ctx.quadraticCurveTo(x, y + height, x, y + height - r);+ ctx.lineTo(x, y + r);+ ctx.quadraticCurveTo(x, y, x + r, y);+ ctx.closePath();+ }++ function drawMotionFrame(ctx, backgroundImage, motionScene, elapsed) {+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.drawImage(backgroundImage, 0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.save();+ ctx.scale(ctx.canvas.width / motionScene.width, ctx.canvas.height / motionScene.height);+ ctx.translate(-motionScene.x, -motionScene.y);++ motionScene.edges.forEach(function (edge) {+ var duration = 1.75;+ var progress = (elapsed - edge.delay) / duration;+ if (progress < 0 || progress > 1) return;+ var head = Math.max(0, Math.min(1, progress));+ var tail = Math.max(0, head - 0.24);+ var opacity = Math.sin(Math.PI * Math.min(1, progress));++ ctx.save();+ ctx.strokeStyle = edge.color;+ ctx.fillStyle = edge.color;+ ctx.lineCap = 'round';+ ctx.lineJoin = 'round';+ ctx.lineWidth = Math.max(3.2, edge.width * 2.2);+ ctx.globalAlpha = 0.42 + opacity * 0.5;+ ctx.shadowColor = edge.color;+ ctx.shadowBlur = 10;+ ctx.beginPath();+ for (var i = 0; i <= 14; i++) {+ var trailPoint = pointAlong(edge.points, tail + (head - tail) * i / 14);+ if (i === 0) ctx.moveTo(trailPoint.x, trailPoint.y);+ else ctx.lineTo(trailPoint.x, trailPoint.y);+ }+ ctx.stroke();++ var point = pointAlong(edge.points, head);+ ctx.globalAlpha = 0.95;+ ctx.beginPath();+ ctx.arc(point.x, point.y, 4.8, 0, Math.PI * 2);+ ctx.fill();+ ctx.restore();+ });++ motionScene.nodes.forEach(function (node) {+ var progress = (elapsed - node.delay) / 2.6;+ if (progress < 0 || progress > 1) return;+ var pulse = Math.sin(Math.PI * progress);+ if (pulse <= 0.02) return;+ ctx.save();+ ctx.strokeStyle = node.color;+ ctx.lineWidth = 1.4 + pulse * 1.8;+ ctx.globalAlpha = pulse * 0.5;+ ctx.shadowColor = node.color;+ ctx.shadowBlur = 12 * pulse;+ var inset = 2 + pulse * 3;+ roundedRectPath(ctx, node.x - inset, node.y - inset, node.width + inset * 2, node.height + inset * 2, 8);+ ctx.stroke();+ ctx.restore();+ });++ ctx.restore();+ }++ var motionScene = createMotionScene(svg);++ return new Promise(function (resolve, reject) {+ var backgroundImage = new Image();+ backgroundImage.onload = function () {+ var canvas = document.createElement('canvas');+ canvas.width = Math.max(2, Math.round(data.width / 2) * 2);+ canvas.height = Math.max(2, Math.round(data.height / 2) * 2);+ var ctx = canvas.getContext('2d');+ var stream = canvas.captureStream(fps);+ var mime = motionMimeType();+ var recorder;+ try {+ recorder = new MediaRecorder(stream, { mimeType: mime, videoBitsPerSecond: 6000000 });+ } catch (err) {+ URL.revokeObjectURL(sourceUrl);+ stream.getTracks().forEach(function (track) { track.stop(); });+ reject(err);+ return;+ }+ var chunks = [];+ var raf = 0;+ var stopped = false;+ var startedAt = performance.now();+ function cleanup() {+ if (stopped) return;+ stopped = true;+ cancelAnimationFrame(raf);+ URL.revokeObjectURL(sourceUrl);+ stream.getTracks().forEach(function (track) { track.stop(); });+ }+ function draw(now) {+ var elapsed = Math.max(0, ((Number(now) || performance.now()) - startedAt) / 1000);+ drawMotionFrame(ctx, backgroundImage, motionScene, elapsed);+ raf = requestAnimationFrame(draw);+ }+ recorder.ondataavailable = function (event) {+ if (event.data && event.data.size) chunks.push(event.data);+ };+ recorder.onerror = function (event) {+ cleanup();+ reject(event.error || new Error('MediaRecorder failed'));+ };+ recorder.onstop = function () {+ cleanup();+ var blob = new Blob(chunks, { type: recorder.mimeType || mime });+ if (!blob.size) reject(new Error('MediaRecorder produced an empty WebM'));+ else resolve(blob);+ };+ drawMotionFrame(ctx, backgroundImage, motionScene, 0);+ recorder.start(250);+ startedAt = performance.now();+ raf = requestAnimationFrame(draw);+ setTimeout(function () {+ if (recorder.state === 'inactive') return;+ // Chromium normally emits the final chunk during stop(), but+ // some embedded browser shells need an explicit encoder flush+ // first. Keep the short grace window bounded and harmless for+ // browsers that already delivered timeslice chunks.+ try { recorder.requestData(); } catch (_) {}+ setTimeout(function () {+ if (recorder.state !== 'inactive') recorder.stop();+ }, 120);+ }, duration);+ };+ backgroundImage.onerror = function () {+ URL.revokeObjectURL(sourceUrl);+ reject(new Error('SVG background could not be loaded for WebM export'));+ };+ backgroundImage.src = sourceUrl;+ });+ }++ var menu = document.getElementById('export-menu');+ var btn = document.getElementById('btn-export');+ var items = function () {+ return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));+ };++ // ---- Clipboard support ----------------------------------------------+ function canCopyImage() {+ return typeof ClipboardItem !== 'undefined' &&+ navigator.clipboard &&+ typeof navigator.clipboard.write === 'function';+ }++ // ---- Raster format detection ----------------------------------------+ // canvas.toBlob('image/webp') silently returns a PNG on browsers without+ // WebP encoding (older Safari), so detect explicitly.+ function supports(format) {+ if (format === 'svg' || format === 'png') return true;+ if (format === 'webm') return canRecordMotion();+ var mime = format === 'jpeg' ? 'image/jpeg' : 'image/webp';+ try {+ var c = document.createElement('canvas');+ c.width = c.height = 2;+ return c.toDataURL(mime).indexOf('data:' + mime) === 0;+ } catch (_) { return false; }+ }++ // Gray out unsupported items.+ items().forEach(function (it) {+ if (it.dataset.format && !supports(it.dataset.format)) {+ it.disabled = true;+ it.title = 'Not supported by this browser';+ it.style.opacity = '0.5';+ }+ if (it.dataset.action === 'copy' && !canCopyImage()) {+ it.disabled = true;+ it.title = 'Clipboard image write not supported by this browser';+ it.style.opacity = '0.5';+ }+ });++ // ---- Toast ----------------------------------------------------------+ // A live region only announces CHANGES to an existing node, so the toast+ // element is created once up front and updated in place.+ var toastEl = document.createElement('div');+ toastEl.className = 'archify-toast';+ toastEl.setAttribute('role', 'status');+ document.body.appendChild(toastEl);+ var toastTimer = null;++ function toast(msg) {+ toastEl.textContent = '';+ requestAnimationFrame(function () {+ toastEl.textContent = msg;+ toastEl.classList.add('show');+ });+ clearTimeout(toastTimer);+ toastTimer = setTimeout(function () { toastEl.classList.remove('show'); }, 1500);+ }++ function open(focusLast) {+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });+ menu.classList.add('open');+ btn.setAttribute('aria-expanded', 'true');+ var available = items().filter(function (i) { return !i.disabled; });+ var target = focusLast ? available[available.length - 1] : available[0];+ if (target) target.focus();+ }+ function close(focusTrigger) {+ menu.classList.remove('open');+ btn.setAttribute('aria-expanded', 'false');+ if (focusTrigger) btn.focus();+ }+ function isOpen() { return menu.classList.contains('open'); }++ btn.addEventListener('click', function (e) {+ e.stopPropagation();+ if (isOpen()) close(false);+ else open();+ });+ // APG menu-button pattern: ArrowDown/ArrowUp on the trigger opens the menu.+ btn.addEventListener('keydown', function (e) {+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {+ e.preventDefault();+ if (!isOpen()) open(e.key === 'ArrowUp');+ }+ });+ document.addEventListener('click', function (e) {+ if (!menu.contains(e.target) && e.target !== btn) close(false);+ });++ // Keyboard navigation inside the menu.+ // Menu items: Up/Down, Home/End.+ // Esc closes + returns focus to trigger; Tab closes.+ menu.addEventListener('keydown', function (e) {+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }+ if (e.key === 'Tab') { close(false); return; }++ var available = items().filter(function (i) { return !i.disabled; });+ var current = available.indexOf(document.activeElement);+ switch (e.key) {+ case 'ArrowDown':+ e.preventDefault();+ if (available.length) available[(current + 1 + available.length) % available.length].focus();+ break;+ case 'ArrowUp':+ e.preventDefault();+ if (available.length) available[(current - 1 + available.length) % available.length].focus();+ break;+ case 'Home':+ e.preventDefault();+ if (available[0]) available[0].focus();+ break;+ case 'End':+ e.preventDefault();+ if (available.length) available[available.length - 1].focus();+ break;+ }+ });++ function runExport(format) {+ var base = diagramFilename();+ close(true);+ document.documentElement.removeAttribute('data-last-export-error');+ document.documentElement.removeAttribute('data-last-export-error-format');+ if (format === 'webm') toast('Recording 6 seconds of motion…');+ return (format === 'svg'+ ? Promise.resolve(serializeSvg(1, { autoTheme: true })).then(function (d) {+ var blob = new Blob([d.svgString], { type: 'image/svg+xml;charset=utf-8' });+ recordExportReceipt('svg', blob, d.canonicalStateClean);+ download(blob, base + '.svg');+ })+ : format === 'webm'+ ? recordWebm().then(function (blob) {+ document.documentElement.setAttribute('data-last-motion-bytes', String(blob.size));+ recordExportReceipt('webm', blob, true);+ download(blob, base + '.webm');+ toast('Downloaded WebM');+ })+ : rasterize(format).then(function (blob) {+ recordExportReceipt(format, blob, true);+ download(blob, base + '.' + format);+ })+ ).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : format;+ document.documentElement.setAttribute('data-last-export-error-format', format);+ document.documentElement.setAttribute('data-last-export-error', message);+ if (format === 'webm' && /MediaRecorder|WebM motion export|empty WebM/i.test(message)) {+ var motionItem = menu.querySelector('button[data-format="webm"]');+ if (motionItem) {+ motionItem.disabled = true;+ motionItem.title = 'Motion capture unavailable in this browser';+ motionItem.style.opacity = '0.5';+ }+ toast('WebM unavailable in this browser');+ return;+ }+ alert('Export failed: ' + message);+ });+ }++ // A compact, machine-readable receipt for local QA and generated proof+ // galleries. It exposes no diagram contents, only the completed format,+ // byte count, and whether temporary viewer state was excluded.+ function recordExportReceipt(format, blob, canonical) {+ document.documentElement.setAttribute('data-last-export-format', format);+ document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));+ document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');+ }++ function runCopy() {+ close(true);+ if (!canCopyImage()) {+ alert('Clipboard image write not supported in this browser.');+ return;+ }+ // WebKit requires ClipboardItem to be constructed synchronously inside+ // the user gesture — pass the pending Promise<Blob> as the item value.+ // Browsers that reject promise values throw synchronously; fall back+ // to awaiting the blob first (works in Chromium/Firefox).+ var blobPromise = rasterize('png');+ var writePromise;+ try {+ writePromise = navigator.clipboard.write([new ClipboardItem({ 'image/png': blobPromise })]);+ } catch (_) {+ writePromise = blobPromise.then(function (blob) {+ return navigator.clipboard.write([new ClipboardItem({ 'image/png': blob })]);+ });+ }+ return writePromise.then(function () {+ toast('Copied PNG to clipboard');+ }).catch(function (err) {+ console.error(err);+ alert('Copy failed: ' + (err && err.message ? err.message : 'unknown'));+ });+ }++ menu.addEventListener('click', function (e) {+ var copyBtn = e.target.closest('button[data-action="copy"]');+ if (copyBtn && !copyBtn.disabled) { runCopy(); return; }++ var formatBtn = e.target.closest('button[data-format]');+ if (formatBtn && !formatBtn.disabled) { runExport(formatBtn.dataset.format); }+ });++ Archify.motion = { canRecord: canRecordMotion, recordWebm: recordWebm };+ Archify.exportMenu = { open: open, close: close, isOpen: isOpen, run: runExport };++ // Auto-open on page load for demo/screenshot purposes: ?openExport=1+ // Wait for fonts (so the menu doesn't flash before typography lands)+ // and paint before opening. Fallback timeout for browsers without the+ // Font Loading API.+ try {+ if (new URLSearchParams(window.location.search).get('openExport') === '1') {+ var openWhenReady = function () {+ requestAnimationFrame(function () { requestAnimationFrame(open); });+ };+ if (document.fonts && document.fonts.ready) {+ document.fonts.ready.then(openWhenReady);+ } else {+ setTimeout(openWhenReady, 200);+ }+ }+ } catch (_) {}+ })();++ /* ============================================================+ Motion Governor — one reader switch and one motion budget. Ambient+ trace yields to the strongest semantic owner; Still also parks bounded+ viewer signals without discarding their static meaning.+ ============================================================ */+ Archify.motionGovernor = (function () {+ var STORAGE_KEY = 'archify-motion';+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-motion');+ var label = document.getElementById('motion-label');+ var motionQuery = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;+ var capable = !!(svg && svg.getAttribute('data-animation') === 'trace');+ var readerPaused = false;+ var suspensions = Object.create(null);+ var explicitOwner = '';+ var owner = '';+ var ownerToken = 0;+ var ownerCleanup = null;+ var lastEffectivePaused = null;+ var ambientStarted = false;+ var ambientPending = new Set();++ function detachAmbientBoundary() {+ if (!svg) return;+ svg.removeEventListener('animationend', onAmbientBoundary, true);+ svg.removeEventListener('animationcancel', onAmbientBoundary, true);+ }+ function settleAmbient(reason) {+ if (!capable) return false;+ ambientStarted = true;+ ambientPending.clear();+ detachAmbientBoundary();+ html.setAttribute('data-ambient-motion', 'settled');+ html.setAttribute('data-ambient-settle-reason', reason || 'complete');+ return true;+ }+ function onAmbientBoundary(event) {+ if (!ambientPending.has(event.target)) return;+ ambientPending.delete(event.target);+ if (!ambientPending.size) settleAmbient('complete');+ }+ function startAmbient() {+ if (ambientStarted || !capable) return false;+ ambientStarted = true;+ ambientPending = new Set(Array.prototype.slice.call(svg.querySelectorAll('[data-animate="edge"], [data-animate="node"]')));+ if (!ambientPending.size) return settleAmbient('empty');+ svg.addEventListener('animationend', onAmbientBoundary, true);+ svg.addEventListener('animationcancel', onAmbientBoundary, true);+ html.setAttribute('data-ambient-motion', 'running');+ html.removeAttribute('data-ambient-settle-reason');+ return true;+ }++ function readStored() {+ try { return localStorage.getItem(STORAGE_KEY); } catch (_) { return null; }+ }+ function writeStored() {+ try {+ if (readerPaused) localStorage.setItem(STORAGE_KEY, 'still');+ else localStorage.removeItem(STORAGE_KEY);+ } catch (_) {}+ }+ function reducedMotion() {+ return !!(motionQuery && motionQuery.matches);+ }+ function hasSuspension() {+ return Object.keys(suspensions).length > 0;+ }+ function effectivePaused() {+ return readerPaused || reducedMotion() || hasSuspension();+ }+ function ownerLabel(value) {+ if (value === 'story') return 'the guided story';+ if (value === 'chapter') return 'the active chapter';+ if (value === 'chapter-preview') return 'the chapter delta preview';+ if (value === 'handoff') return 'the chapter handoff';+ if (value === 'route') return 'Route Probe';+ if (value === 'lens') return 'Semantic Lens';+ if (value === 'relationship') return 'Relationship Preview';+ if (value === 'intent') return 'Intent Trace';+ if (value === 'focus') return 'semantic focus';+ if (value === 'legend') return 'legend preview';+ return 'reader interaction';+ }+ function render() {+ if (!capable) return;+ var systemPaused = reducedMotion();+ var paused = effectivePaused();+ html.setAttribute('data-motion', paused ? 'still' : 'live');+ if (paused || owner || html.hasAttribute('data-embed') || html.hasAttribute('data-share-playback') || html.hasAttribute('data-document-hidden')) {+ settleAmbient('suppressed');+ } else if (!ambientStarted) {+ startAmbient();+ }+ btn.setAttribute('aria-pressed', paused ? 'false' : 'true');+ btn.disabled = systemPaused;+ label.textContent = paused ? 'Still' : 'Live';+ if (paused && lastEffectivePaused !== true && Archify.guidedViews && Archify.guidedViews.isPlaying()) {+ Archify.guidedViews.pause();+ }+ if (paused && lastEffectivePaused !== true && Archify.guidedViews && Archify.guidedViews.settleHandoff) {+ Archify.guidedViews.settleHandoff(systemPaused ? 'reduced-motion' : (hasSuspension() ? 'hidden' : 'still'));+ }+ if (paused && lastEffectivePaused !== true && Archify.routeProbe && Archify.routeProbe.isJourneyPlaying && Archify.routeProbe.isJourneyPlaying()) {+ Archify.routeProbe.pauseJourney({ preserveElapsed: true, reason: systemPaused ? 'reduced-motion' : (hasSuspension() ? 'hidden' : 'still') });+ }+ lastEffectivePaused = paused;+ if (Archify.routeProbe && typeof Archify.routeProbe.syncMotion === 'function') Archify.routeProbe.syncMotion();+ if (systemPaused) {+ btn.setAttribute('aria-label', 'Motion paused by reduced-motion preference');+ btn.title = 'Motion paused by reduced-motion preference';+ } else if (hasSuspension()) {+ btn.setAttribute('aria-label', 'Motion paused while this page is hidden');+ btn.title = 'Motion paused while this page is hidden';+ } else if (paused) {+ btn.setAttribute('aria-label', 'Resume motion');+ btn.title = 'Resume motion';+ } else if (owner) {+ btn.setAttribute('aria-label', 'Pause motion; currently yielding to ' + ownerLabel(owner));+ btn.title = 'Live preview enabled · yielding to ' + ownerLabel(owner);+ } else {+ btn.setAttribute('aria-label', 'Pause motion');+ btn.title = 'Pause motion';+ }+ }+ function setPaused(next, options) {+ options = options || {};+ readerPaused = !!next;+ if (options.persist !== false) writeStored();+ render();+ return readerPaused;+ }+ function publishOwner() {+ owner = explicitOwner || deriveOwner();+ if (owner) html.setAttribute('data-motion-owner', owner);+ else html.removeAttribute('data-motion-owner');+ render();+ return owner;+ }+ function deriveOwner() {+ if (!svg) return '';+ if (svg.hasAttribute('data-story-playing') || svg.hasAttribute('data-story-follow')) return 'story';+ if (svg.hasAttribute('data-story-active')) return 'chapter';+ if (svg.hasAttribute('data-route-picking') || svg.hasAttribute('data-route-active')) return 'route';+ if (svg.hasAttribute('data-lens-active')) return 'lens';+ if (svg.hasAttribute('data-relationship-preview-active')) return 'relationship';+ if (svg.hasAttribute('data-intent-trace-active')) return 'intent';+ if (svg.hasAttribute('data-focus-active')) return 'focus';+ if (svg.hasAttribute('data-legend-preview-active')) return 'legend';+ return '';+ }+ function clearClaim(preempted) {+ var cleanup = ownerCleanup;+ ownerCleanup = null;+ explicitOwner = '';+ if (preempted && cleanup) {+ try { cleanup(); } catch (_) {}+ }+ }+ function claim(next, cleanup) {+ if (!capable || !next) return 0;+ clearClaim(true);+ ownerToken += 1;+ explicitOwner = next;+ ownerCleanup = typeof cleanup === 'function' ? cleanup : null;+ publishOwner();+ return ownerToken;+ }+ function release(token) {+ if (!capable || token !== ownerToken || !explicitOwner) return false;+ clearClaim(false);+ ownerToken += 1;+ publishOwner();+ return true;+ }+ function suspend(reason) {+ var key = String(reason || 'runtime');+ var active = true;+ suspensions[key] = (suspensions[key] || 0) + 1;+ render();+ return function () {+ if (!active) return false;+ active = false;+ if (suspensions[key] > 1) suspensions[key] -= 1;+ else delete suspensions[key];+ render();+ return true;+ };+ }+ function syncVisibility() {+ if (document.hidden) {+ suspensions.visibility = true;+ html.setAttribute('data-document-hidden', 'true');+ } else {+ delete suspensions.visibility;+ html.removeAttribute('data-document-hidden');+ }+ render();+ }++ if (!capable) {+ btn.hidden = true;+ html.removeAttribute('data-motion-capable');+ html.removeAttribute('data-motion');+ html.removeAttribute('data-motion-owner');+ html.removeAttribute('data-ambient-motion');+ html.removeAttribute('data-ambient-settle-reason');+ return {+ capable: false,+ pause: function () { return false; },+ resume: function () { return false; },+ toggle: function () { return false; },+ setMode: function () { return 'still'; },+ mode: function () { return 'still'; },+ claim: function () { return 0; },+ release: function () { return false; },+ suspend: function () { return function () { return false; }; },+ isPaused: function () { return true; },+ owner: function () { return ''; }+ };+ }++ html.setAttribute('data-motion-capable', 'true');+ btn.hidden = false;+ readerPaused = readStored() === 'still';+ btn.addEventListener('click', function () { setPaused(!readerPaused); });+ if (motionQuery) {+ if (typeof motionQuery.addEventListener === 'function') motionQuery.addEventListener('change', render);+ else if (typeof motionQuery.addListener === 'function') motionQuery.addListener(render);+ }+ document.addEventListener('visibilitychange', syncVisibility);+ if (document.documentElement.getAttribute('data-embed') !== 'true' && typeof MutationObserver !== 'undefined' && typeof Node !== 'undefined' && svg instanceof Node) {+ var ownerObserver = new MutationObserver(function () { publishOwner(); });+ ownerObserver.observe(svg, {+ attributes: true,+ attributeFilter: [+ 'data-story-playing', 'data-story-follow', 'data-story-active', 'data-route-picking', 'data-route-active',+ 'data-lens-active', 'data-relationship-preview-active', 'data-intent-trace-active',+ 'data-focus-active', 'data-legend-preview-active'+ ]+ });+ }+ syncVisibility();+ publishOwner();+ render();++ return {+ capable: true,+ pause: function () { return setPaused(true); },+ resume: function () { return setPaused(false); },+ toggle: function () { return setPaused(!readerPaused); },+ setMode: function (next, options) {+ setPaused(next === 'still', options);+ return effectivePaused() ? 'still' : 'live';+ },+ mode: function () { return effectivePaused() ? 'still' : 'live'; },+ claim: claim,+ release: release,+ suspend: suspend,+ isPaused: effectivePaused,+ owner: function () { return owner; }+ };+ })();++ /* ============================================================+ Explore — stable-ID neighborhood focus + dependency-free pan/zoom.+ Renderer IDs become deep-linkable semantic hooks without turning the+ standalone artifact into a canvas editor.+ ============================================================ */+ Archify.focus = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector('svg');+ var chip = document.getElementById('focus-chip');+ var label = document.getElementById('focus-label');+ var detail = document.getElementById('focus-detail');+ var kind = document.getElementById('focus-kind');+ var context = document.getElementById('focus-context');+ var tag = document.getElementById('focus-tag');+ var semanticId = document.getElementById('focus-id');+ var summary = document.getElementById('focus-summary');+ var relationshipList = document.getElementById('relationship-lens-list');+ var copyBtn = document.getElementById('btn-focus-copy');+ var relationsBtn = document.getElementById('btn-focus-relations');+ var clearBtn = document.getElementById('btn-focus-clear');+ var activeIds = [];+ var hoveredRelationship = null;+ var focusedRelationship = null;+ var pinnedRelationship = null;+ var pinnedRelationshipKey = null;+ var activeRelationshipPreview = null;+ var relationshipHitOverlay = null;+ var relationshipHitTargets = [];+ var directPreviewTimer = null;+ var svgNamespace = 'http://www.w3.org/2000/svg';+ var reducedMotionQuery = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;+ var finePointerQuery = window.matchMedia ? window.matchMedia('(hover: hover) and (pointer: fine)') : null;++ function nodes() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ }+ function edges() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ }+ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') || (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '');+ }+ function setPassportValue(element, value) {+ var normalized = value == null ? '' : String(value).trim();+ element.textContent = normalized;+ element.hidden = !normalized;+ }+ function renderPassport(id, node) {+ setPassportValue(detail, node.getAttribute('data-node-sublabel'));+ setPassportValue(kind, node.getAttribute('data-node-kind') || 'node');+ setPassportValue(context, node.getAttribute('data-node-context'));+ setPassportValue(tag, node.getAttribute('data-node-tag'));+ semanticId.textContent = id;+ semanticId.hidden = false;+ }+ function relationshipsFor(id, byId) {+ var seen = {};+ var relationships = [];+ edges().forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (from !== id && to !== id) return;+ var edgeLabel = edge.getAttribute('data-edge-label') || '';+ var edgeKey = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + edgeLabel);+ var edgeId = edge.getAttribute('data-edge-id') || '';+ if (seen[edgeKey]) return;+ seen[edgeKey] = true;+ var direction = from === id && to === id ? 'loop' : (from === id ? 'out' : 'in');+ var neighborId = direction === 'in' ? from : to;+ var neighbor = byId[neighborId];+ relationships.push({+ key: edgeKey,+ id: edgeId,+ from: from,+ to: to,+ direction: direction,+ neighborId: neighborId,+ neighborLabel: neighbor ? nodeLabel(neighbor, neighborId) : neighborId,+ label: edgeLabel || (direction === 'loop' ? 'loops back' : direction === 'out' ? 'connects to' : 'connects from')+ });+ });+ return relationships;+ }+ function relationshipEdgeShapes(edge) {+ if (!edge) return [];+ if (/^(path|line|polyline)$/i.test(edge.tagName || '')) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function relationshipHitRecords() {+ var recordsByKey = {};+ var recordsById = {};+ var byId = {};+ nodes().forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ var records = [];+ edges().forEach(function (edge) {+ var shapes = relationshipEdgeShapes(edge);+ if (!shapes.length) return;+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var labelValue = edge.getAttribute('data-edge-label') || '';+ var edgeId = edge.getAttribute('data-edge-id') || '';+ var key = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + labelValue);+ var existing = recordsByKey[key];+ if (existing) {+ if (existing.from !== from || existing.to !== to || existing.labelValue !== labelValue || existing.id !== edgeId) {+ existing.invalid = true;+ return;+ }+ shapes.forEach(function (shape) {+ if (existing.shapes.indexOf(shape) === -1) existing.shapes.push(shape);+ });+ return;+ }+ var record = {+ key: key,+ id: edgeId,+ from: from,+ to: to,+ fromLabel: byId[from] ? nodeLabel(byId[from], from) : from,+ toLabel: byId[to] ? nodeLabel(byId[to], to) : to,+ labelValue: labelValue,+ label: labelValue || (from === to ? 'loops back' : 'connects to'),+ edge: edge,+ shapes: shapes,+ invalid: false+ };+ recordsByKey[key] = record;+ if (edgeId) {+ if (recordsById[edgeId]) {+ recordsById[edgeId].invalid = true;+ record.invalid = true;+ } else {+ recordsById[edgeId] = record;+ }+ }+ records.push(record);+ });+ return records.filter(function (record) { return !record.invalid && record.from && record.to; });+ }+ function relationshipRecordForKey(key) {+ return relationshipHitRecords().find(function (record) { return record.key === key; }) || null;+ }+ function pinnedRelationshipRecord() {+ return pinnedRelationshipKey ? relationshipRecordForKey(pinnedRelationshipKey) : null;+ }+ function renderRelationshipCopyAction() {+ var record = pinnedRelationshipRecord();+ if (record && record.id) {+ copyBtn.textContent = 'Copy relation';+ copyBtn.setAttribute('aria-label', 'Copy link to pinned relationship');+ } else if (pinnedRelationshipKey) {+ copyBtn.textContent = 'Copy node';+ copyBtn.setAttribute('aria-label', 'Copy link to source node');+ } else {+ copyBtn.textContent = 'Copy link';+ copyBtn.setAttribute('aria-label', 'Copy link to focused node');+ }+ }+ function relationshipHitGeometry(shape, className) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('filter');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('tabindex');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('aria-hidden');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.setAttribute('class', className || 'relationship-hit-rail');+ return clone;+ }+ function removeRelationshipPulse() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-relationship-pulse-overlay]'), function (element) {+ element.remove();+ });+ }+ function relationshipPulseGeometry(shape) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('transform');+ clone.removeAttribute('filter');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('tabindex');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-hidden');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-focus-match');+ clone.removeAttribute('data-relationship-preview');+ clone.setAttribute('class', 'relationship-flow-pulse');+ clone.setAttribute('pathLength', '1');+ return clone;+ }+ function relationshipTokenKind(edge) {+ var shapes = relationshipEdgeShapes(edge);+ var classEvidence = [edge.getAttribute('class') || ''].concat(shapes.map(function (shape) {+ return shape.getAttribute('class') || '';+ })).join(' ');+ var from = edge.getAttribute('data-edge-from') || '';+ var to = edge.getAttribute('data-edge-to') || '';+ var source = nodes().find(function (node) { return node.getAttribute('data-node-id') === from; });+ var target = nodes().find(function (node) { return node.getAttribute('data-node-id') === to; });+ var sourceKind = source ? source.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ var targetKind = target ? target.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ if (/\ba-security\b/.test(classEvidence) || sourceKind === 'security' || targetKind === 'security' || targetKind === 'failure') return 'security';+ if (/\ba-dashed\b/.test(classEvidence) || sourceKind === 'messagebus' || targetKind === 'messagebus') return 'event';+ if (sourceKind === 'database' || targetKind === 'database') return 'data';+ if (targetKind === 'waiting' || targetKind === 'success') return 'state';+ return 'call';+ }+ function relationshipTokenPath(shape) {+ if (!shape) return '';+ var tagName = String(shape.tagName || '').toLowerCase();+ if (tagName === 'path') return shape.getAttribute('d') || '';+ if (tagName === 'line') {+ return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') ++ ' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');+ }+ if (tagName === 'polyline' && shape.points && shape.points.numberOfItems > 1) {+ var commands = [];+ for (var i = 0; i < shape.points.numberOfItems; i += 1) {+ var point = shape.points.getItem(i);+ commands.push((i === 0 ? 'M ' : 'L ') + point.x + ' ' + point.y);+ }+ return commands.join(' ');+ }+ return '';+ }+ function relationshipTokenPart(tagName, className, attrs) {+ var part = document.createElementNS(svgNamespace, tagName);+ part.setAttribute('class', className);+ Object.keys(attrs || {}).forEach(function (name) { part.setAttribute(name, attrs[name]); });+ return part;+ }+ function relationshipTokenGeometry(shape, kind, key, options) {+ options = options || {};+ var pathData = relationshipTokenPath(shape);+ if (!pathData) return null;+ var token = document.createElementNS(svgNamespace, 'g');+ token.setAttribute('class', 'semantic-flow-token ' + (options.className || 'relationship-flow-token'));+ token.setAttribute('data-token-kind', kind);+ token.setAttribute('data-token-edge-key', key);+ token.setAttribute('aria-hidden', 'true');+ token.appendChild(relationshipTokenPart('circle', 'semantic-flow-token-halo', { cx: '0', cy: '0', r: '7' }));+ if (kind === 'data') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-5', y: '-4', width: '10', height: '8', rx: '2' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -2.8 -1.2 h 5.6 M -2.8 1.4 h 3.8' }));+ } else if (kind === 'event') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-7', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-2', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '3', y: '-3', width: '4', height: '6', rx: '1' }));+ } else if (kind === 'security') {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-shape', { d: 'M 0 -5 L 4 -3.4 V 0 c 0 3 -1.6 4.5 -4 5.5 C -2.4 4.5 -4 3 -4 0 v -3.4 Z' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'm -2 .2 1.4 1.4 L 2 -1.4' }));+ } else if (kind === 'state') {+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-shape', { cx: '0', cy: '0', r: '5' }));+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-dot', { cx: '0', cy: '0', r: '1.35' }));+ } else {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -5 -3 L -1 0 L -5 3 M 0 -3 L 4 0 L 0 3' }));+ }+ var motion = document.createElementNS(svgNamespace, 'animateMotion');+ motion.setAttribute('path', pathData);+ motion.setAttribute('dur', options.duration || '1.2s');+ motion.setAttribute('begin', '0s');+ motion.setAttribute('fill', 'freeze');+ motion.setAttribute('rotate', 'auto');+ motion.setAttribute('calcMode', 'spline');+ motion.setAttribute('keyTimes', '0;1');+ motion.setAttribute('keySplines', '.2 0 .2 1');+ token.appendChild(motion);+ return token;+ }+ function createSemanticFlowToken(edge, shape, options) {+ if (!edge || !shape) return null;+ var key = edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ return relationshipTokenGeometry(shape, relationshipTokenKind(edge), key, options);+ }+ Archify.flowTokens = {+ create: createSemanticFlowToken,+ kind: function (edge) { return relationshipTokenKind(edge); },+ path: relationshipTokenPath+ };+ function renderRelationshipPulse(key) {+ removeRelationshipPulse();+ if (!key || document.documentElement.getAttribute('data-embed') === 'true') return false;+ if (document.hidden || (Archify.motionGovernor && Archify.motionGovernor.isPaused())) return false;+ if (reducedMotionQuery && reducedMotionQuery.matches) return false;+ var matchingEdges = edges().filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ if (!matchingEdges.length) return false;+ var overlay = document.createElementNS(svgNamespace, 'g');+ overlay.setAttribute('class', 'relationship-pulse-overlay');+ overlay.setAttribute('data-relationship-pulse-overlay', '');+ overlay.setAttribute('data-relationship-pulse-key', key);+ overlay.setAttribute('aria-hidden', 'true');+ var tokenAdded = false;+ matchingEdges.forEach(function (edge) {+ var wrapper = document.createElementNS(svgNamespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ var shapes = relationshipEdgeShapes(edge);+ shapes.forEach(function (shape) {+ wrapper.appendChild(relationshipPulseGeometry(shape));+ });+ if (!tokenAdded && shapes.length) {+ var tokenKind = relationshipTokenKind(edge);+ var token = relationshipTokenGeometry(shapes[0], tokenKind, key);+ if (token) {+ wrapper.appendChild(token);+ overlay.setAttribute('data-relationship-token-kind', tokenKind);+ tokenAdded = true;+ }+ }+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ if (!overlay.childNodes.length) return false;+ var finishPulse = function () {+ if (overlay.parentNode) overlay.remove();+ };+ overlay.addEventListener('animationend', finishPulse, { once: true });+ overlay.addEventListener('animationcancel', finishPulse, { once: true });+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ return true;+ }+ function clearRelationshipPreview(options) {+ options = options || {};+ if (directPreviewTimer) window.clearTimeout(directPreviewTimer);+ directPreviewTimer = null;+ removeRelationshipPulse();+ activeRelationshipPreview = null;+ svg.removeAttribute('data-relationship-preview-active');+ svg.removeAttribute('data-relationship-direct-active');+ if (options.clearPin === true) {+ pinnedRelationship = null;+ pinnedRelationshipKey = null;+ svg.removeAttribute('data-relationship-pin-active');+ }+ chip.removeAttribute('data-relationship-previewing');+ edges().forEach(function (edge) { edge.removeAttribute('data-relationship-preview'); });+ nodes().forEach(function (node) {+ node.removeAttribute('data-relationship-preview-node');+ node.removeAttribute('data-relationship-preview-source');+ node.removeAttribute('data-relationship-preview-target');+ });+ Array.prototype.forEach.call(relationshipList.querySelectorAll('[data-preview-active]'), function (button) {+ button.removeAttribute('data-preview-active');+ });+ relationshipHitTargets.forEach(function (target) {+ target.setAttribute('aria-pressed', pinnedRelationshipKey && target.getAttribute('data-relationship-key') === pinnedRelationshipKey ? 'true' : 'false');+ target.removeAttribute('data-preview-active');+ });+ renderRelationshipCopyAction();+ requestLensPlacement();+ }+ function previewRelationship(button, options) {+ options = options || {};+ if (pinnedRelationshipKey && pinnedRelationship && button !== pinnedRelationship) return;+ clearRelationshipPreview();+ if (!button) return;+ var key = button.getAttribute('data-relationship-key');+ var from = button.getAttribute('data-relationship-from');+ var to = button.getAttribute('data-relationship-to');+ if (!key || !from || !to) return;+ svg.setAttribute('data-relationship-preview-active', key);+ if (options.direct === true) svg.setAttribute('data-relationship-direct-active', key);+ edges().forEach(function (edge) {+ if (edge.getAttribute('data-edge-key') === key) edge.setAttribute('data-relationship-preview', '');+ });+ nodes().forEach(function (node) {+ var id = node.getAttribute('data-node-id');+ if (id !== from && id !== to) return;+ node.setAttribute('data-relationship-preview-node', '');+ if (id === from) node.setAttribute('data-relationship-preview-source', '');+ if (id === to) node.setAttribute('data-relationship-preview-target', '');+ });+ button.setAttribute('data-preview-active', 'true');+ if (!chip.hidden && options.direct !== true) chip.setAttribute('data-relationship-previewing', 'true');+ activeRelationshipPreview = button;+ renderRelationshipPulse(key);+ requestLensPlacement();+ }+ function syncRelationshipPreview() {+ var next = pinnedRelationship || focusedRelationship || hoveredRelationship;+ if (next === activeRelationshipPreview) return;+ previewRelationship(next, { direct: !!(next && next.hasAttribute('data-relationship-hit-key')) });+ }+ function directRelationshipBlocked() {+ return html.getAttribute('data-embed') === 'true' ||+ html.getAttribute('data-guide-open') === 'true' ||+ container.classList.contains('is-panning') ||+ (activeIds.length > 0 && !pinnedRelationshipKey) ||+ svg.hasAttribute('data-story-active') ||+ svg.hasAttribute('data-route-picking') ||+ svg.hasAttribute('data-route-active') ||+ svg.hasAttribute('data-lens-active') ||+ svg.hasAttribute('data-chapter-preview');+ }+ function scheduleDirectRelationshipPreview(target) {+ if (directPreviewTimer) window.clearTimeout(directPreviewTimer);+ if (pinnedRelationshipKey) return;+ directPreviewTimer = window.setTimeout(function () {+ directPreviewTimer = null;+ if (pinnedRelationshipKey || hoveredRelationship !== target || directRelationshipBlocked()) return;+ previewRelationship(target, { direct: true });+ }, reducedMotionQuery && reducedMotionQuery.matches ? 0 : 90);+ }+ function relationshipHitTarget(key) {+ return relationshipHitTargets.find(function (target) {+ return target.getAttribute('data-relationship-key') === key;+ }) || null;+ }+ function revealPinnedRelationship(record) {+ function reveal() {+ if (!record || pinnedRelationshipKey !== record.key) return true;+ if (!Archify.view || typeof Archify.view.reveal !== 'function') return false;+ Archify.view.reveal([record.from, record.to], { reason: 'relationship-direct' });+ return true;+ }+ if (!reveal()) requestAnimationFrame(reveal);+ }+ function inspectRelationship(key, options) {+ options = options || {};+ if (html.getAttribute('data-embed') === 'true') return false;+ if (directPreviewTimer) window.clearTimeout(directPreviewTimer);+ directPreviewTimer = null;+ hoveredRelationship = null;+ focusedRelationship = null;+ if (pinnedRelationshipKey === key) {+ if (options.toggle === false) return true;+ clear({ updateUrl: options.updateUrl !== false });+ return true;+ }+ var record = relationshipRecordForKey(key);+ if (!record) return false;+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ set(record.from, { toggle: false, updateUrl: false });+ var row = Array.prototype.slice.call(relationshipList.querySelectorAll('[data-relationship-key]')).find(function (candidate) {+ return candidate.getAttribute('data-relationship-key') === key;+ });+ if (!row) return false;+ previewRelationship(row);+ pinnedRelationship = row;+ pinnedRelationshipKey = key;+ svg.setAttribute('data-relationship-pin-active', key);+ var target = relationshipHitTarget(key);+ if (target) target.setAttribute('aria-pressed', 'true');+ renderRelationshipCopyAction();+ summary.textContent = 'Pinned relationship · ' + record.fromLabel + ' → ' + record.toLabel + ' · ' + record.label;+ revealPinnedRelationship(record);+ if (options.updateUrl !== false && record.id) {+ try { history.replaceState(null, '', location.pathname + location.search + '#relation=' + encodeURIComponent(record.id)); } catch (_) {}+ }+ return true;+ }+ function inspectRelationshipById(id, options) {+ var record = relationshipHitRecords().find(function (item) { return item.id === id; });+ return record ? inspectRelationship(record.key, options) : false;+ }+ function installRelationshipHitTargets() {+ if (html.getAttribute('data-embed') === 'true') return 0;+ var records = relationshipHitRecords();+ if (!records.length) return 0;+ relationshipHitOverlay = document.createElementNS(svgNamespace, 'g');+ relationshipHitOverlay.setAttribute('class', 'relationship-hit-overlay');+ relationshipHitOverlay.setAttribute('data-relationship-hit-overlay', '');+ relationshipHitOverlay.setAttribute('role', 'group');+ relationshipHitOverlay.setAttribute('aria-label', 'Direct relationship explorer');+ var relationshipHelp = document.createElementNS(svgNamespace, 'desc');+ relationshipHelp.id = 'archify-relationship-help';+ relationshipHelp.textContent = 'Use arrow keys to explore relationships. Press Enter or Space to pin details; Escape clears.';+ relationshipHitOverlay.appendChild(relationshipHelp);+ records.forEach(function (record, index) {+ var target = document.createElementNS(svgNamespace, 'g');+ target.setAttribute('class', 'relationship-hit-target');+ target.setAttribute('data-relationship-hit-key', record.key);+ target.setAttribute('data-relationship-key', record.key);+ target.setAttribute('data-relationship-from', record.from);+ target.setAttribute('data-relationship-to', record.to);+ if (record.id) target.setAttribute('data-relationship-id', record.id);+ target.setAttribute('role', 'button');+ target.setAttribute('tabindex', index === 0 ? '0' : '-1');+ target.setAttribute('aria-pressed', 'false');+ target.setAttribute('aria-describedby', relationshipHelp.id);+ var description = 'Inspect relationship ' + (index + 1) + ' of ' + records.length + ': ' + record.fromLabel + ' to ' + record.toLabel + ', ' + record.label + '. Press Enter for details.';+ target.setAttribute('aria-label', description);+ var title = document.createElementNS(svgNamespace, 'title');+ title.textContent = record.fromLabel + ' \u2192 ' + record.toLabel + ' \u00b7 ' + record.label;+ target.appendChild(title);+ record.shapes.forEach(function (shape) {+ target.appendChild(relationshipHitGeometry(shape));+ target.appendChild(relationshipHitGeometry(shape, 'relationship-focus-rail'));+ });+ if (target.childNodes.length > 1) {+ relationshipHitTargets.push(target);+ relationshipHitOverlay.appendChild(target);+ }+ });+ if (!relationshipHitTargets.length) return 0;+ var firstNode = svg.querySelector('[data-node-id]');+ var nodeLayer = firstNode;+ while (nodeLayer && nodeLayer.parentNode && nodeLayer.parentNode !== svg) nodeLayer = nodeLayer.parentNode;+ if (nodeLayer && nodeLayer.parentNode === svg) svg.insertBefore(relationshipHitOverlay, nodeLayer);+ else svg.appendChild(relationshipHitOverlay);++ relationshipHitOverlay.addEventListener('pointerdown', function (event) {+ if (event.target.closest('[data-relationship-hit-key]')) event.stopPropagation();+ });+ relationshipHitOverlay.addEventListener('pointerover', function (event) {+ if (event.pointerType === 'touch') return;+ if (finePointerQuery && !finePointerQuery.matches) return;+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || directRelationshipBlocked() || pinnedRelationshipKey) return;+ if (event.relatedTarget && target.contains(event.relatedTarget)) return;+ hoveredRelationship = target;+ scheduleDirectRelationshipPreview(target);+ });+ relationshipHitOverlay.addEventListener('pointerout', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || (event.relatedTarget && target.contains(event.relatedTarget))) return;+ if (hoveredRelationship === target) hoveredRelationship = null;+ syncRelationshipPreview();+ });+ relationshipHitOverlay.addEventListener('focusin', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || directRelationshipBlocked()) return;+ focusedRelationship = target;+ if (!pinnedRelationshipKey) previewRelationship(target, { direct: true });+ });+ relationshipHitOverlay.addEventListener('focusout', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || (event.relatedTarget && target.contains(event.relatedTarget))) return;+ if (focusedRelationship === target) focusedRelationship = null;+ syncRelationshipPreview();+ });+ relationshipHitOverlay.addEventListener('click', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || directRelationshipBlocked()) return;+ event.preventDefault();+ event.stopPropagation();+ focusedRelationship = null;+ hoveredRelationship = null;+ inspectRelationship(target.getAttribute('data-relationship-key'));+ });+ relationshipHitOverlay.addEventListener('keydown', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target) return;+ if (event.key === 'Escape' && pinnedRelationshipKey) {+ event.preventDefault();+ clear({ updateUrl: false });+ return;+ }+ if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault();+ focusedRelationship = null;+ hoveredRelationship = null;+ inspectRelationship(target.getAttribute('data-relationship-key'));+ return;+ }+ if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft' && event.key !== 'ArrowDown' && event.key !== 'ArrowUp' && event.key !== 'Home' && event.key !== 'End') return;+ var index = relationshipHitTargets.indexOf(target);+ if (event.key === 'Home') index = 0;+ else if (event.key === 'End') index = relationshipHitTargets.length - 1;+ else if (event.key === 'ArrowRight' || event.key === 'ArrowDown') index = (index + 1) % relationshipHitTargets.length;+ else index = (index - 1 + relationshipHitTargets.length) % relationshipHitTargets.length;+ event.preventDefault();+ relationshipHitTargets.forEach(function (item, itemIndex) { item.setAttribute('tabindex', itemIndex === index ? '0' : '-1'); });+ try { relationshipHitTargets[index].focus({ preventScroll: true }); }+ catch (_) { try { relationshipHitTargets[index].focus(); } catch (_) {} }+ });+ return relationshipHitTargets.length;+ }+ function renderRelationshipLens(id, byId) {+ hoveredRelationship = null;+ focusedRelationship = null;+ clearRelationshipPreview({ clearPin: true });+ renderPassport(id, byId[id]);+ var relationships = relationshipsFor(id, byId);+ chip.removeAttribute('data-relations-expanded');+ relationsBtn.setAttribute('aria-expanded', 'false');+ relationsBtn.textContent = relationships.length + ' relation' + (relationships.length === 1 ? '' : 's');+ relationsBtn.setAttribute('aria-label', 'Show ' + relationships.length + ' connected relationship' + (relationships.length === 1 ? '' : 's'));+ var counts = { out: 0, in: 0, loop: 0 };+ relationships.forEach(function (relationship) { counts[relationship.direction] += 1; });+ summary.textContent = counts.out + ' outgoing · ' + counts.in + ' incoming' + (counts.loop ? ' · ' + counts.loop + ' loop' : '');+ relationshipList.textContent = '';+ if (!relationships.length) {+ var empty = document.createElement('p');+ empty.className = 'relationship-lens-empty';+ empty.textContent = 'No connected relationships';+ relationshipList.appendChild(empty);+ return;+ }++ [+ { id: 'out', label: 'Outgoing' },+ { id: 'in', label: 'Incoming' },+ { id: 'loop', label: 'Self loops' }+ ].forEach(function (group) {+ var items = relationships.filter(function (relationship) { return relationship.direction === group.id; });+ if (!items.length) return;+ var section = document.createElement('div');+ section.className = 'relationship-lens-group';+ var heading = document.createElement('span');+ heading.className = 'relationship-lens-group-title';+ heading.textContent = group.label + ' · ' + items.length;+ section.appendChild(heading);+ items.forEach(function (relationship) {+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'relationship-lens-row';+ button.setAttribute('data-direction', relationship.direction);+ button.setAttribute('data-relationship-target', relationship.neighborId);+ button.setAttribute('data-relationship-key', relationship.key);+ button.setAttribute('data-relationship-from', relationship.from);+ button.setAttribute('data-relationship-to', relationship.to);+ if (relationship.id) button.setAttribute('data-relationship-id', relationship.id);+ button.setAttribute('aria-label', group.label + ': ' + relationship.label + ', ' + relationship.neighborLabel);+ var direction = document.createElement('span');+ direction.className = 'relationship-lens-direction';+ direction.setAttribute('aria-hidden', 'true');+ direction.textContent = relationship.direction === 'out' ? 'OUT →' : relationship.direction === 'in' ? '← IN' : 'LOOP';+ var target = document.createElement('strong');+ target.textContent = relationship.neighborLabel;+ var relation = document.createElement('small');+ relation.textContent = relationship.label;+ button.appendChild(direction);+ button.appendChild(target);+ button.appendChild(relation);+ section.appendChild(button);+ });+ relationshipList.appendChild(section);+ });+ }+ var lensFrame = 0;+ function placeRelationshipLens() {+ lensFrame = 0;+ if (chip.hidden || activeIds.length !== 1) return;+ var node = svg.querySelector('[data-node-id="' + activeIds[0] + '"]');+ if (!node) return;+ var containerRect = container.getBoundingClientRect();+ var nodeRect = node.getBoundingClientRect();+ if (containerRect.bottom <= 0 || containerRect.top >= window.innerHeight) return;+ var padding = window.innerWidth <= 720 ? 8 : 16;+ var visibleTop = Math.max(padding, -containerRect.top + padding);+ var visibleBottom = Math.min(containerRect.height - padding, window.innerHeight - containerRect.top - padding);+ var maxTop = Math.max(padding, visibleBottom - chip.offsetHeight);+ var minTop = Math.min(visibleTop, maxTop);+ var nodeCenter = nodeRect.top - containerRect.top + nodeRect.height / 2;+ var mobile = window.innerWidth <= 720;+ var previewingOnMobile = mobile && chip.getAttribute('data-relationship-previewing') === 'true';+ var compactOnMobile = mobile && chip.getAttribute('data-relations-expanded') !== 'true';+ var preferred;+ if (compactOnMobile) {+ var nodeTop = nodeRect.top - containerRect.top;+ var nodeBottom = nodeRect.bottom - containerRect.top;+ var gap = 10;+ var above = nodeTop - chip.offsetHeight - gap;+ var below = nodeBottom + gap;+ if (above >= visibleTop) preferred = above;+ else if (below + chip.offsetHeight <= visibleBottom - 56) preferred = below;+ else preferred = nodeCenter < (visibleTop + visibleBottom) / 2+ ? Math.max(minTop, visibleBottom - chip.offsetHeight - 56)+ : visibleTop;+ } else if (previewingOnMobile) {+ var pinnedTop = visibleTop;+ var pinnedBottom = Math.max(minTop, visibleBottom - chip.offsetHeight - 56);+ preferred = nodeCenter < (visibleTop + visibleBottom) / 2 ? pinnedBottom : pinnedTop;+ } else {+ preferred = nodeCenter - chip.offsetHeight / 2;+ }+ var top = Math.max(minTop, Math.min(maxTop, preferred));+ chip.style.top = Math.round(top) + 'px';+ if (Archify.radar && typeof Archify.radar.sync === 'function') Archify.radar.sync();+ }+ function requestLensPlacement() {+ if (lensFrame) return;+ lensFrame = requestAnimationFrame(placeRelationshipLens);+ }+ function clear(options) {+ options = options || {};+ if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') {+ Archify.intentTrace.clear({ announce: false });+ }+ hoveredRelationship = null;+ focusedRelationship = null;+ clearRelationshipPreview({ clearPin: true });+ activeIds = [];+ svg.removeAttribute('data-focus-active');+ nodes().forEach(function (node) {+ node.removeAttribute('data-focus-match');+ node.removeAttribute('data-focus-selected');+ node.setAttribute('aria-pressed', 'false');+ });+ edges().forEach(function (edge) { edge.removeAttribute('data-focus-match'); });+ chip.hidden = true;+ label.textContent = '';+ detail.textContent = '';+ detail.hidden = true;+ kind.textContent = '';+ kind.hidden = true;+ context.textContent = '';+ context.hidden = true;+ tag.textContent = '';+ tag.hidden = true;+ semanticId.textContent = '';+ semanticId.hidden = true;+ summary.textContent = '';+ relationshipList.textContent = '';+ copyBtn.textContent = 'Copy link';+ copyBtn.setAttribute('aria-label', 'Copy link to focused node');+ relationsBtn.textContent = 'Relations';+ relationsBtn.setAttribute('aria-label', 'Show connected relationships');+ relationsBtn.setAttribute('aria-expanded', 'false');+ chip.removeAttribute('data-relations-expanded');+ chip.style.removeProperty('top');+ if (options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ if (options.updateUrl !== false) {+ try { history.replaceState(null, '', location.pathname + location.search); } catch (_) {}+ }+ }++ function setMany(ids, options) {+ options = options || {};+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.semanticLens && Archify.semanticLens.active()) {+ Archify.semanticLens.clear({ updateUrl: false, preserveView: true, closePanel: true });+ }+ if (options.preserveRoute !== true && Archify.routeProbe && typeof Archify.routeProbe.clear === 'function') {+ Archify.routeProbe.clear({ updateUrl: false, restoreFocus: false });+ }+ var nodeList = nodes();+ var byId = {};+ nodeList.forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ var normalized = [];+ (ids || []).forEach(function (id) {+ if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);+ });+ if (!normalized.length) return false;+ if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {+ clear();+ return true;+ }++ clear({ updateUrl: false, preserveView: true });+ activeIds = normalized;+ var selected = {};+ var related = {};+ var seenEdges = {};+ var matchedEdges = 0;+ normalized.forEach(function (id) { selected[id] = true; related[id] = true; });+ var selectionMode = options.mode === 'selection' || normalized.length > 1;++ edges().forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var match = selectionMode ? selected[from] && selected[to] : selected[from] || selected[to];+ if (!match) return;+ edge.setAttribute('data-focus-match', '');+ if (!selectionMode) { related[from] = true; related[to] = true; }+ var edgeKey = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + (edge.getAttribute('data-edge-label') || ''));+ if (!seenEdges[edgeKey]) { seenEdges[edgeKey] = true; matchedEdges += 1; }+ });+ nodeList.forEach(function (node) {+ var nodeId = node.getAttribute('data-node-id');+ if (related[nodeId]) node.setAttribute('data-focus-match', '');+ if (selected[nodeId]) {+ node.setAttribute('data-focus-selected', '');+ node.setAttribute('aria-pressed', 'true');+ }+ });+ svg.setAttribute('data-focus-active', normalized.join(' '));+ var defaultLabel = normalized.length === 1+ ? nodeLabel(byId[normalized[0]], normalized[0])+ : normalized.length + ' selected nodes';+ label.textContent = options.label || defaultLabel;+ chip.hidden = options.hideChip === true || normalized.length !== 1 || selectionMode;+ if (!chip.hidden) {+ renderRelationshipLens(normalized[0], byId);+ requestLensPlacement();+ }+ if (options.updateUrl !== false) {+ var key = options.urlKey || 'focus';+ var value = options.urlValue || normalized[0];+ try { history.replaceState(null, '', location.pathname + location.search + '#' + key + '=' + encodeURIComponent(value)); } catch (_) {}+ }+ return true;+ }++ function set(id, options) {+ options = options || {};+ options.mode = 'neighborhood';+ return setMany([id], options);+ }++ function fallbackCopy(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }++ function copyFocusLink() {+ if (activeIds.length !== 1) return Promise.resolve(false);+ var record = pinnedRelationshipRecord();+ var relationId = record && record.id;+ var value = location.href.replace(/#.*$/, '') + (relationId+ ? '#relation=' + encodeURIComponent(relationId)+ : '#focus=' + encodeURIComponent(activeIds[0]));+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })+ : Promise.resolve(fallbackCopy(value));+ return copy.then(function (copied) {+ copyBtn.textContent = copied ? 'Copied' : 'Copy failed';+ copyBtn.setAttribute('aria-label', copied+ ? (relationId ? 'Pinned relationship link copied' : 'Focused node link copied')+ : (relationId ? 'Could not copy pinned relationship link' : 'Could not copy focused node link'));+ window.setTimeout(function () {+ renderRelationshipCopyAction();+ }, 1600);+ return copied;+ });+ }++ svg.addEventListener('click', function (event) {+ if (container.getAttribute('data-just-panned') === 'true') return;+ var node = event.target.closest('[data-node-id]');+ if (node) {+ var id = node.getAttribute('data-node-id');+ set(id);+ if (activeIds.indexOf(id) !== -1 && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'focus' });+ }+ }+ else if (activeIds.length) clear();+ });+ svg.addEventListener('keydown', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || (event.key !== 'Enter' && event.key !== ' ')) return;+ event.preventDefault();+ var id = node.getAttribute('data-node-id');+ set(id);+ if (activeIds.indexOf(id) !== -1 && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'focus' });+ }+ });+ clearBtn.addEventListener('click', function () { clear(); });+ copyBtn.addEventListener('click', copyFocusLink);+ relationsBtn.addEventListener('click', function () {+ var expanded = chip.getAttribute('data-relations-expanded') === 'true';+ if (expanded) chip.removeAttribute('data-relations-expanded');+ else chip.setAttribute('data-relations-expanded', 'true');+ relationsBtn.setAttribute('aria-expanded', expanded ? 'false' : 'true');+ relationsBtn.setAttribute('aria-label', expanded ? 'Show connected relationships' : 'Hide connected relationships');+ requestLensPlacement();+ });+ relationshipList.addEventListener('click', function (event) {+ var button = event.target.closest('[data-relationship-target]');+ if (!button) return;+ var id = button.getAttribute('data-relationship-target');+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ set(id, { toggle: false });+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'relationship' });+ }+ var node = svg.querySelector('[data-node-id="' + id + '"]');+ if (node) {+ try { node.focus({ preventScroll: true }); } catch (_) { try { node.focus(); } catch (_) {} }+ }+ });+ relationshipList.addEventListener('pointerover', function (event) {+ if (event.pointerType === 'touch') return;+ if (finePointerQuery && !finePointerQuery.matches) return;+ var button = event.target.closest('[data-relationship-key]');+ if (!button || !relationshipList.contains(button)) return;+ if (event.relatedTarget && button.contains(event.relatedTarget)) return;+ hoveredRelationship = button;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('pointerout', function (event) {+ var button = event.target.closest('[data-relationship-key]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ if (hoveredRelationship === button) hoveredRelationship = null;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('focusin', function (event) {+ var button = event.target.closest('[data-relationship-key]');+ if (!button) return;+ focusedRelationship = button;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('focusout', function (event) {+ var button = event.target.closest('[data-relationship-key]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ if (focusedRelationship === button) focusedRelationship = null;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('keydown', function (event) {+ if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp' && event.key !== 'Home' && event.key !== 'End') return;+ var buttons = Array.prototype.slice.call(relationshipList.querySelectorAll('[data-relationship-target]'));+ if (!buttons.length) return;+ var index = buttons.indexOf(document.activeElement);+ if (event.key === 'Home') index = 0;+ else if (event.key === 'End') index = buttons.length - 1;+ else if (event.key === 'ArrowDown') index = Math.min(buttons.length - 1, Math.max(0, index + 1));+ else index = Math.max(0, index < 0 ? 0 : index - 1);+ event.preventDefault();+ buttons[index].focus();+ });+ window.addEventListener('scroll', requestLensPlacement, { passive: true });+ window.addEventListener('resize', requestLensPlacement);+ container.addEventListener('scroll', requestLensPlacement, { passive: true });+ document.addEventListener('visibilitychange', function () {+ if (document.hidden) removeRelationshipPulse();+ });+ function syncRelationshipMotionPreference(event) {+ if (event.matches) removeRelationshipPulse();+ }+ if (reducedMotionQuery) {+ if (typeof reducedMotionQuery.addEventListener === 'function') {+ reducedMotionQuery.addEventListener('change', syncRelationshipMotionPreference);+ } else if (typeof reducedMotionQuery.addListener === 'function') {+ reducedMotionQuery.addListener(syncRelationshipMotionPreference);+ }+ }++ installRelationshipHitTargets();++ function syncFocusFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var relation = params.get('relation');+ var initial = params.get('focus');+ if (relation) {+ if (html.getAttribute('data-embed') === 'true' ||+ !inspectRelationshipById(relation, { updateUrl: false, toggle: false })) clear({ updateUrl: false });+ }+ else if (initial) set(initial, { updateUrl: false, toggle: false });+ else if (!params.get('view')) clear({ updateUrl: false });+ } catch (_) {}+ }++ window.addEventListener('hashchange', syncFocusFromHash);+ syncFocusFromHash();++ return {+ set: set,+ setMany: setMany,+ clear: clear,+ copyLink: copyFocusLink,+ inspectRelationship: inspectRelationship,+ inspectRelationshipById: inspectRelationshipById,+ reposition: requestLensPlacement,+ relationship: function () {+ var record = pinnedRelationshipRecord();+ return record ? { id: record.id || null, key: record.key, from: record.from, to: record.to, label: record.label } : null;+ },+ active: function () { return activeIds.length === 0 ? null : (activeIds.length === 1 ? activeIds[0] : activeIds.slice()); }+ };+ })();++ /* ============================================================+ Intent Trace — temporary one-hop topology before durable focus.+ Fine-pointer hover and keyboard focus share the same stable-ID preview;+ touch continues directly to the existing click-to-focus contract.+ ============================================================ */+ Archify.intentTrace = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var status = document.getElementById('intent-trace-status');+ var namespace = 'http://www.w3.org/2000/svg';+ var activeId = null;+ var hoveredNode = null;+ var focusedNode = null;+ var enterTimer = null;++ function nodes() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ }+ function edges() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ }+ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];+ }+ function finePointer() {+ return !window.matchMedia || window.matchMedia('(hover: hover) and (pointer: fine)').matches;+ }+ function reducedMotion() {+ return !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);+ }+ function blocked() {+ return html.getAttribute('data-embed') === 'true' ||+ html.getAttribute('data-guide-open') === 'true' ||+ container.classList.contains('is-panning') ||+ svg.hasAttribute('data-lens-active') ||+ svg.hasAttribute('data-story-active') ||+ svg.hasAttribute('data-relationship-preview-active') ||+ !!(Archify.routeProbe && typeof Archify.routeProbe.active === 'function' && Archify.routeProbe.active()) ||+ !!(Archify.focus && typeof Archify.focus.active === 'function' && Archify.focus.active());+ }+ function edgeShapes(edge) {+ if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function removeOverlay() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-intent-trace-overlay]'), function (overlay) {+ overlay.remove();+ });+ }+ function clear(options) {+ options = options || {};+ if (enterTimer) window.clearTimeout(enterTimer);+ enterTimer = null;+ activeId = null;+ svg.removeAttribute('data-intent-trace-active');+ removeOverlay();+ nodes().forEach(function (node) {+ node.removeAttribute('data-intent-trace-match');+ node.removeAttribute('data-intent-trace-selected');+ });+ edges().forEach(function (edge) { edge.removeAttribute('data-intent-trace-match'); });+ if (options.announce !== false) status.textContent = '';+ }+ function traceGeometry(shape, direction) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-intent-trace-match');+ clone.removeAttribute('data-intent-trace-selected');+ clone.setAttribute('class', 'intent-trace-flow');+ clone.setAttribute('data-direction', direction);+ clone.setAttribute('pathLength', '1');+ return clone;+ }+ function show(id, options) {+ options = options || {};+ if (!id || blocked()) {+ clear({ announce: false });+ return false;+ }+ if (activeId === id) return true;+ clear({ announce: false });+ var nodeList = nodes();+ var edgeList = edges();+ var byId = {};+ nodeList.forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ var selected = byId[id];+ if (!selected) return false;++ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'intent-trace-overlay');+ overlay.setAttribute('data-intent-trace-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ var related = {};+ var seen = {};+ var counts = { out: 0, in: 0, loop: 0 };+ related[id] = true;++ edgeList.forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (from !== id && to !== id) return;+ var direction = from === id && to === id ? 'loop' : (from === id ? 'out' : 'in');+ var key = edge.getAttribute('data-edge-key') ||+ (from + '\u0000' + to + '\u0000' + (edge.getAttribute('data-edge-label') || ''));+ if (!seen[key]) {+ seen[key] = true;+ counts[direction] += 1;+ }+ related[from] = true;+ related[to] = true;+ edge.setAttribute('data-intent-trace-match', '');+ var wrapper = document.createElementNS(namespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ edgeShapes(edge).forEach(function (shape) {+ wrapper.appendChild(traceGeometry(shape, direction));+ });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });++ nodeList.forEach(function (node) {+ var nodeId = node.getAttribute('data-node-id');+ if (related[nodeId]) node.setAttribute('data-intent-trace-match', '');+ if (nodeId === id) node.setAttribute('data-intent-trace-selected', '');+ });+ if (overlay.childNodes.length) {+ var firstEdge = edgeList[0];+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstEdge && firstEdge.parentNode) firstEdge.parentNode.insertBefore(overlay, firstEdge);+ else if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ }+ activeId = id;+ svg.setAttribute('data-intent-trace-active', id);+ if (options.announce === true) {+ var total = counts.out + counts.in + counts.loop;+ status.textContent = nodeLabel(selected, id) + '. ' + counts.out + ' outgoing, ' ++ counts.in + ' incoming' + (counts.loop ? ', ' + counts.loop + ' self loop' : '') ++ '. ' + total + ' connection' + (total === 1 ? '' : 's') + '. Press Enter for details.';+ }+ return true;+ }+ function schedule(node) {+ if (enterTimer) window.clearTimeout(enterTimer);+ enterTimer = window.setTimeout(function () {+ enterTimer = null;+ if (hoveredNode === node) show(node.getAttribute('data-node-id'), { announce: false });+ }, reducedMotion() ? 0 : 90);+ }+ function sync() {+ var candidate = focusedNode || hoveredNode;+ if (!candidate) {+ clear();+ return;+ }+ show(candidate.getAttribute('data-node-id'), { announce: candidate === focusedNode });+ }++ svg.addEventListener('pointerover', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || !finePointer() || event.pointerType === 'touch') return;+ if (event.relatedTarget && node.contains(event.relatedTarget)) return;+ hoveredNode = node;+ schedule(node);+ });+ svg.addEventListener('pointerout', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || (event.relatedTarget && node.contains(event.relatedTarget))) return;+ if (hoveredNode === node) hoveredNode = null;+ sync();+ });+ svg.addEventListener('focusin', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node) return;+ focusedNode = node;+ show(node.getAttribute('data-node-id'), { announce: true });+ });+ svg.addEventListener('focusout', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || (event.relatedTarget && node.contains(event.relatedTarget))) return;+ if (focusedNode === node) focusedNode = null;+ sync();+ });+ container.addEventListener('pointerdown', function (event) {+ if (!event.target.closest('[data-node-id]')) clear({ announce: false });+ });+ window.addEventListener('blur', function () { clear({ announce: false }); });++ return {+ show: show,+ clear: clear,+ active: function () { return activeId; }+ };+ })();++ Archify.guidedViews = (function () {+ var data = document.getElementById('archify-guided-views-data');+ var panel = document.getElementById('guided-views');+ var prev = document.getElementById('guided-view-prev');+ var next = document.getElementById('guided-view-next');+ var all = document.getElementById('guided-view-all');+ var play = document.getElementById('guided-view-play');+ var playIcon = document.getElementById('guided-view-play-icon');+ var playLabel = document.getElementById('guided-view-play-label');+ var beatLink = document.getElementById('guided-view-beat-link');+ var beatLinkLabel = document.getElementById('guided-view-beat-link-label');+ var progressBar = document.getElementById('guided-view-progress-bar');+ var count = document.getElementById('guided-view-count');+ var handoffReceipt = document.getElementById('guided-view-handoff');+ var label = document.getElementById('guided-view-label');+ var note = document.getElementById('guided-view-note');+ var trail = document.getElementById('guided-view-trail');+ var storyCaption = document.getElementById('guided-story-caption');+ var storyCaptionIndex = document.getElementById('guided-story-caption-index');+ var storyCaptionRoute = document.getElementById('guided-story-caption-route');+ var storyCaptionDetail = document.getElementById('guided-story-caption-detail');+ var storyCaptionNext = document.getElementById('guided-story-caption-next');+ var storyCaptionNextLabel = document.getElementById('guided-story-caption-next-label');+ var chapterIndex = document.getElementById('guided-view-index');+ var chapterList = document.getElementById('guided-view-chapters');+ var shareCue = document.getElementById('share-chapter-cue');+ var shareCueState = document.getElementById('share-chapter-state');+ var shareCueCount = document.getElementById('share-chapter-count');+ var shareCueLabel = document.getElementById('share-chapter-label');+ var shareCueNote = document.getElementById('share-chapter-note');+ var shareCueRoute = document.getElementById('share-chapter-route');+ var shareCueProgress = document.getElementById('share-chapter-progress-bar');+ var svg = document.querySelector('.diagram-container svg');+ var views = [];+ var activeIndex = -1;+ var playing = false;+ var storyBeatTimer = null;+ var storyBeatIndex = -1;+ var storyBeatStartedAt = 0;+ var storyBeatElapsedMs = 0;+ var storyBeatDwellMs = 0;+ var storyPlaybackGeneration = 0;+ var storyFollowGeneration = 0;+ var storyPlaybackScope = 'story';+ var storyPlaybackComplete = false;+ var beatLinkFeedbackTimer = null;+ var momentRestoreGeneration = 0;+ var storySteps = [];+ var storyPulseOwnerToken = 0;+ var storyPulseGeneration = 0;+ var autoplayPending = false;+ var VIEW_INTERVAL_MS = 3200;+ var STORY_FOLLOW_MIN_DWELL_MS = 1100;+ var STORY_FOLLOW_DURATION_MS = 320;+ var chapterButtons = [];+ var handoffGeneration = 0;+ var currentHandoff = null;+ var previewGeneration = 0;+ var pointerPreviewIntent = null;+ var focusPreviewIntent = null;+ var activePreviewIndex = -1;+ var previewOwnerToken = 0;++ try { views = JSON.parse(data.textContent || '[]'); } catch (_) { views = []; }+ if (!views.length) return { count: 0, active: function () { return null; } };+ var canonicalNodeIds = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ canonicalNodeIds[node.getAttribute('data-node-id')] = true;+ });+ views.forEach(function (view) {+ var seen = {};+ view.focus = (view.focus || []).filter(function (id) {+ if (!canonicalNodeIds[id] || seen[id]) return false;+ seen[id] = true;+ return true;+ });+ });+ // Establish the compact cold state before exposing the panel so the+ // full Director cannot flash during first paint. Hash restoration runs+ // in the same task and replaces this state before paint when valid.+ panel.setAttribute('data-active-view', 'all');+ panel.hidden = false;+ panel.setAttribute('data-view-interval-ms', String(VIEW_INTERVAL_MS));+ panel.setAttribute('data-story-follow-min-dwell-ms', String(STORY_FOLLOW_MIN_DWELL_MS));+ buildChapterIndex();++ function reducedMotion() {+ return !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);+ }++ function findNode(id) {+ return Array.prototype.find.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ return node.getAttribute('data-node-id') === id;+ }) || null;+ }++ function chapterDelta(previous, destination) {+ var previousFocus = previous ? previous.focus : [];+ var destinationFocus = destination ? destination.focus : [];+ var previousIds = {};+ var destinationIds = {};+ previousFocus.forEach(function (id) { previousIds[id] = true; });+ destinationFocus.forEach(function (id) { destinationIds[id] = true; });+ return {+ stay: previousFocus.filter(function (id) { return destinationIds[id]; }),+ enter: destinationFocus.filter(function (id) { return !previousIds[id]; }),+ leave: previousFocus.filter(function (id) { return !destinationIds[id]; })+ };+ }++ function chapterAnchor(previous, destination, outgoingBeatIndex, delta) {+ if (!previous || !destination) return '';+ var stayIds = {};+ delta.stay.forEach(function (id) { stayIds[id] = true; });+ var activeBeat = outgoingBeatIndex >= 0 ? previous.focus[outgoingBeatIndex] : '';+ if (activeBeat && stayIds[activeBeat]) return activeBeat;+ for (var index = previous.focus.length - 1; index >= 0; index -= 1) {+ if (stayIds[previous.focus[index]]) return previous.focus[index];+ }+ return '';+ }++ function handoffMotionAllowed() {+ if (document.hidden || reducedMotion()) return false;+ if (document.documentElement.getAttribute('data-embed') === 'true') return false;+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ return !(Archify.motionGovernor && Archify.motionGovernor.capable && Archify.motionGovernor.isPaused());+ }++ function classifyHandoff(delta, anchor) {+ var roles = {};+ delta.stay.forEach(function (id) { roles[id] = 'stay'; });+ delta.enter.forEach(function (id) { roles[id] = 'enter'; });+ delta.leave.forEach(function (id) { roles[id] = 'leave'; });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ var id = node.getAttribute('data-node-id');+ var role = roles[id] || '';+ if (role) node.setAttribute('data-chapter-role', role);+ else node.removeAttribute('data-chapter-role');+ });+ svg.setAttribute('data-chapter-handoff', anchor ? 'anchor' : 'no-anchor');+ if (anchor) svg.setAttribute('data-chapter-anchor', anchor);+ else svg.removeAttribute('data-chapter-anchor');+ }++ function drawHandoffAnchor(id) {+ var node = findNode(id);+ if (!node) return null;+ var box;+ try { box = node.getBBox(); } catch (_) { return null; }+ var overlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ var ring = document.createElementNS('http://www.w3.org/2000/svg', 'rect');+ overlay.setAttribute('class', 'chapter-handoff-overlay');+ overlay.setAttribute('data-chapter-handoff-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ ring.setAttribute('class', 'chapter-handoff-anchor');+ ring.setAttribute('x', String(box.x - 8));+ ring.setAttribute('y', String(box.y - 8));+ ring.setAttribute('width', String(box.width + 16));+ ring.setAttribute('height', String(box.height + 16));+ ring.setAttribute('rx', '10');+ overlay.appendChild(ring);+ svg.appendChild(overlay);+ return overlay;+ }++ function clearHandoffPresentation() {+ svg.removeAttribute('data-chapter-handoff');+ svg.removeAttribute('data-chapter-anchor');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-chapter-handoff-overlay]'), function (overlay) { overlay.remove(); });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-chapter-role]'), function (node) { node.removeAttribute('data-chapter-role'); });+ if (handoffReceipt) {+ handoffReceipt.hidden = true;+ handoffReceipt.textContent = '';+ }+ }++ function completeHandoff(handoff, outcome) {+ if (!handoff || currentHandoff !== handoff) return false;+ if (handoff.holdTimer) clearTimeout(handoff.holdTimer);+ handoff.holdTimer = null;+ currentHandoff = null;+ clearHandoffPresentation();+ if (handoff.ownerToken && Archify.motionGovernor) Archify.motionGovernor.release(handoff.ownerToken);+ handoff.resolve({ id: handoff.id, state: outcome || 'complete', anchor: handoff.anchor || null });+ syncStoryControlsDisabled();+ syncChapterPreview();+ return true;+ }++ function settleHandoff(reason) {+ var handoff = currentHandoff;+ if (!handoff) return false;+ if (handoff.holdTimer) clearTimeout(handoff.holdTimer);+ handoff.holdTimer = null;+ if (handoff.camera && handoff.camera.cancel) handoff.camera.cancel(reason || 'settled', true);+ else if (Archify.view && Archify.view.reveal) Archify.view.reveal(handoff.focus, { instant: true, reason: reason || 'settled' });+ completeHandoff(handoff, reason || 'settled');+ return true;+ }++ function cancelHandoff(reason) {+ var handoff = currentHandoff;+ if (!handoff) return false;+ if (handoff.holdTimer) clearTimeout(handoff.holdTimer);+ handoff.holdTimer = null;+ if (handoff.camera && handoff.camera.cancel) handoff.camera.cancel(reason || 'manual', false);+ completeHandoff(handoff, reason || 'manual');+ return true;+ }++ function afterHandoff(callback) {+ if (!currentHandoff) { callback(); return; }+ currentHandoff.finished.then(callback);+ }++ function beginHandoff(previousIndex, nextIndex, previous, destination, outgoingBeatIndex, reason) {+ if (!Archify.view || !Archify.view.reveal) return null;+ if (!previous || previousIndex === nextIndex) {+ Archify.view.reveal(destination.focus, { reason: reason });+ return null;+ }+ var delta = chapterDelta(previous, destination);+ var anchor = chapterAnchor(previous, destination, outgoingBeatIndex, delta);+ if (!handoffMotionAllowed()) {+ Archify.view.reveal(destination.focus, { instant: true, reason: reason });+ return null;+ }+ var resolver;+ var handoff = {+ id: ++handoffGeneration,+ mode: anchor ? 'holding' : 'no-anchor',+ anchor: anchor,+ focus: destination.focus.slice(),+ holdTimer: null,+ camera: null,+ ownerToken: 0,+ finished: new Promise(function (resolve) { resolver = resolve; }),+ resolve: resolver+ };+ currentHandoff = handoff;+ classifyHandoff(delta, anchor);+ if (anchor) {+ drawHandoffAnchor(anchor);+ var node = findNode(anchor);+ var nodeLabel = node ? (node.getAttribute('data-node-label') || anchor) : anchor;+ handoffReceipt.textContent = (previousIndex + 1 < 10 ? '0' : '') + (previousIndex + 1) ++ ' \u2192 ' + (nextIndex + 1 < 10 ? '0' : '') + (nextIndex + 1) + ' \u00b7 via ' + nodeLabel;+ handoffReceipt.hidden = false;+ }+ if (Archify.motionGovernor) {+ handoff.ownerToken = Archify.motionGovernor.claim('handoff', function () {+ if (currentHandoff === handoff) settleHandoff('preempted');+ });+ }+ var startCamera = function () {+ if (currentHandoff !== handoff) return;+ handoff.holdTimer = null;+ handoff.mode = 'settling';+ svg.setAttribute('data-chapter-handoff', anchor ? 'settling' : 'no-anchor');+ handoff.camera = Archify.view.reveal(destination.focus, { reason: reason, duration: 420 });+ if (handoff.camera && handoff.camera.finished) {+ handoff.camera.finished.then(function (outcome) {+ if (currentHandoff === handoff) completeHandoff(handoff, outcome && outcome.state || 'complete');+ });+ } else {+ completeHandoff(handoff, 'complete');+ }+ };+ if (anchor) handoff.holdTimer = setTimeout(startCamera, 110);+ else startCamera();+ return handoff;+ }++ function centerChapterButton(button) {+ if (!button || !chapterList) return false;+ var target = Math.max(0, button.offsetLeft - (chapterList.clientWidth - button.offsetWidth) / 2);+ if (typeof chapterList.scrollTo === 'function') chapterList.scrollTo({ left: target, behavior: 'auto' });+ else chapterList.scrollLeft = target;+ return true;+ }++ function focusChapterButton(index) {+ if (!chapterButtons.length) return false;+ index = Math.max(0, Math.min(chapterButtons.length - 1, index));+ chapterButtons.forEach(function (button, buttonIndex) {+ button.setAttribute('tabindex', buttonIndex === index ? '0' : '-1');+ });+ chapterButtons[index].focus();+ centerChapterButton(chapterButtons[index]);+ return true;+ }++ function buildChapterIndex() {+ chapterButtons = [];+ chapterList.textContent = '';+ views.forEach(function (view, index) {+ var item = document.createElement('li');+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'guided-view-chapter';+ button.setAttribute('data-guided-view-id', view.id);+ button.setAttribute('aria-pressed', 'false');+ button.setAttribute('tabindex', index === 0 ? '0' : '-1');+ button.setAttribute('aria-label', 'Open chapter ' + (index + 1) + ' of ' + views.length + ': ' + view.label + ', ' + view.focus.length + ' stops');+ button.title = view.label + ' — ' + (view.note || view.focus.length + ' selected nodes');+ var position = document.createElement('span');+ position.className = 'guided-view-chapter-index';+ position.setAttribute('aria-hidden', 'true');+ position.textContent = (index + 1 < 10 ? '0' : '') + (index + 1);+ var title = document.createElement('span');+ title.className = 'guided-view-chapter-title';+ title.textContent = view.label;+ var stops = document.createElement('em');+ stops.className = 'guided-view-chapter-count';+ stops.textContent = view.focus.length + ' stop' + (view.focus.length === 1 ? '' : 's');+ var delta = document.createElement('span');+ delta.className = 'guided-view-chapter-delta';+ delta.hidden = true;+ delta.setAttribute('aria-hidden', 'true');+ ['stay', 'enter', 'leave'].forEach(function (kind) {+ var value = document.createElement('span');+ value.setAttribute('data-delta-kind', kind);+ delta.appendChild(value);+ });+ button.appendChild(position);+ button.appendChild(title);+ button.appendChild(stops);+ button.appendChild(delta);+ item.appendChild(button);+ chapterList.appendChild(item);+ chapterButtons.push(button);+ });+ }++ function syncChapterIndex() {+ chapterButtons.forEach(function (button, index) {+ var current = index === activeIndex;+ var stops = button.querySelector('.guided-view-chapter-count');+ var deltaLabel = button.querySelector('.guided-view-chapter-delta');+ var position = activeIndex < 0 ? 'available' : (current ? 'current' : (index < activeIndex ? 'before' : 'after'));+ button.setAttribute('data-chapter-position', position);+ button.setAttribute('aria-pressed', current ? 'true' : 'false');+ button.setAttribute('tabindex', current || (activeIndex < 0 && index === 0) ? '0' : '-1');+ if (current) {+ stops.hidden = false;+ deltaLabel.hidden = true;+ button.removeAttribute('data-chapter-delta');+ button.setAttribute('aria-label', 'Current chapter ' + (index + 1) + ' of ' + views.length + ': ' + views[index].label + ', ' + views[index].focus.length + ' stops');+ button.title = views[index].label + ' — current chapter, ' + views[index].focus.length + ' stops';+ } else {+ var delta = chapterDelta(activeIndex >= 0 ? views[activeIndex] : null, views[index]);+ var compact = '=' + delta.stay.length + ' +' + delta.enter.length + ' \u2212' + delta.leave.length;+ var expanded = delta.stay.length + ' stay, ' + delta.enter.length + ' enter, ' + delta.leave.length + ' leave';+ stops.hidden = true;+ deltaLabel.hidden = false;+ deltaLabel.querySelector('[data-delta-kind="stay"]').textContent = '=' + delta.stay.length;+ deltaLabel.querySelector('[data-delta-kind="enter"]').textContent = '+' + delta.enter.length;+ deltaLabel.querySelector('[data-delta-kind="leave"]').textContent = '\u2212' + delta.leave.length;+ button.setAttribute('data-chapter-delta', compact);+ button.setAttribute('aria-label', 'Open chapter ' + (index + 1) + ' of ' + views.length + ': ' + views[index].label + '. Chapter focus delta: ' + expanded);+ button.title = views[index].label + ' — ' + compact + ' chapter focus';+ }+ if (current) button.setAttribute('aria-current', 'step');+ else button.removeAttribute('aria-current');+ if (button.parentElement) button.parentElement.setAttribute('data-chapter-position', position);+ });+ if (activeIndex >= 0) centerChapterButton(chapterButtons[activeIndex]);+ }++ function chapterPreviewBlocked() {+ if (document.hidden || playing || currentHandoff) return true;+ if (document.documentElement.getAttribute('data-embed') === 'true') return true;+ if (window.matchMedia && window.matchMedia('print').matches) return true;+ if (svg.hasAttribute('data-route-picking') || svg.hasAttribute('data-route-active')) return true;+ if (svg.hasAttribute('data-lens-active') || svg.hasAttribute('data-legend-preview-active')) return true;+ if (svg.hasAttribute('data-relationship-preview-active') || svg.hasAttribute('data-intent-trace-active')) return true;+ return activeIndex < 0 && svg.hasAttribute('data-focus-active');+ }++ function clearChapterPreviewPresentation() {+ svg.removeAttribute('data-chapter-preview');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-chapter-preview-role]'), function (node) {+ node.removeAttribute('data-chapter-preview-role');+ });+ chapterButtons.forEach(function (button) { button.removeAttribute('data-preview-active'); });+ activePreviewIndex = -1;+ if (previewOwnerToken && Archify.motionGovernor) {+ var token = previewOwnerToken;+ previewOwnerToken = 0;+ Archify.motionGovernor.release(token);+ }+ }++ function clearChapterPreview(options) {+ options = options || {};+ previewGeneration += 1;+ if (options.clearIntents !== false) {+ pointerPreviewIntent = null;+ focusPreviewIntent = null;+ }+ clearChapterPreviewPresentation();+ return true;+ }++ function winningChapterPreviewIntent() {+ return [pointerPreviewIntent, focusPreviewIntent].filter(function (intent) {+ return intent && intent.index >= 0 && intent.index < views.length && intent.index !== activeIndex;+ }).sort(function (left, right) { return right.generation - left.generation; })[0] || null;+ }++ function showChapterPreview(index) {+ if (index < 0 || index >= views.length || index === activeIndex || chapterPreviewBlocked()) {+ clearChapterPreviewPresentation();+ return false;+ }+ if (activePreviewIndex === index && svg.getAttribute('data-chapter-preview') === views[index].id) return true;+ clearChapterPreviewPresentation();+ var delta = chapterDelta(activeIndex >= 0 ? views[activeIndex] : null, views[index]);+ var roles = {};+ delta.stay.forEach(function (id) { roles[id] = 'stay'; });+ delta.enter.forEach(function (id) { roles[id] = 'enter'; });+ delta.leave.forEach(function (id) { roles[id] = 'leave'; });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ var role = roles[node.getAttribute('data-node-id')];+ if (role) node.setAttribute('data-chapter-preview-role', role);+ });+ svg.setAttribute('data-chapter-preview', views[index].id);+ chapterButtons[index].setAttribute('data-preview-active', 'true');+ activePreviewIndex = index;+ if (Archify.motionGovernor && Archify.motionGovernor.capable) {+ previewOwnerToken = Archify.motionGovernor.claim('chapter-preview', function () {+ previewOwnerToken = 0;+ clearChapterPreviewPresentation();+ });+ }+ return true;+ }++ function syncChapterPreview() {+ var intent = winningChapterPreviewIntent();+ if (!intent || chapterPreviewBlocked()) {+ clearChapterPreviewPresentation();+ return false;+ }+ return showChapterPreview(intent.index);+ }++ function setChapterPreviewIntent(source, index) {+ var intent = { index: index, generation: ++previewGeneration };+ if (source === 'pointer') pointerPreviewIntent = intent;+ else focusPreviewIntent = intent;+ if (playing) pausePlayback();+ return syncChapterPreview();+ }++ function clearChapterPreviewIntent(source, index) {+ var intent = source === 'pointer' ? pointerPreviewIntent : focusPreviewIntent;+ if (intent && (typeof index !== 'number' || intent.index === index)) {+ if (source === 'pointer') pointerPreviewIntent = null;+ else focusPreviewIntent = null;+ previewGeneration += 1;+ }+ return syncChapterPreview();+ }++ function hoverCapable() {+ return !!(window.matchMedia && window.matchMedia('(hover: hover)').matches);+ }++ function sharePlaybackRequested() {+ try { return new URLSearchParams(location.search).get('play') === '1'; }+ catch (_) { return false; }+ }++ autoplayPending = sharePlaybackRequested();+ if (autoplayPending) {+ document.documentElement.setAttribute('data-share-playback', 'true');+ setAutoplayState('pending');+ }++ function setAutoplayState(state) {+ if (state) panel.setAttribute('data-autoplay', state);+ else panel.removeAttribute('data-autoplay');+ renderShareCue();+ }++ function shareCueStatus(state) {+ return {+ pending: 'Ready',+ playing: 'Playing',+ complete: 'Settled',+ interrupted: 'Paused',+ pinned: 'Pinned',+ 'reduced-motion': 'Still'+ }[state] || 'Ready';+ }++ function shareCueBeatCopy(state, view, stops) {+ var total = stops.length;+ var activeStop = storyBeatIndex >= 0 ? stops[storyBeatIndex] : null;+ if ((state === 'playing' || state === 'interrupted') && activeStop) {+ return 'Step ' + (storyBeatIndex + 1 < 10 ? '0' : '') + (storyBeatIndex + 1) + ' / ' ++ (total < 10 ? '0' : '') + total + ' · ' + activeStop.textContent;+ }+ if (state === 'pinned' && activeStop) {+ return storyBeatCopy(storySteps[storyBeatIndex], total);+ }+ if (state === 'reduced-motion' && activeStop && hashBeatMatchesCurrent()) {+ return 'Step ' + (storyBeatIndex + 1 < 10 ? '0' : '') + (storyBeatIndex + 1) + ' / ' ++ (total < 10 ? '0' : '') + total + ' · ' + activeStop.textContent + ' · Static moment';+ }+ if (state === 'complete') return total + ' steps complete · ' + (view.note || 'Path settled for reading.');+ if (state === 'reduced-motion') return total + ' steps · Static path';+ if (state === 'pending') return total + ' steps · Ready';+ return view.note || view.focus.length + ' selected nodes';+ }++ function renderShareCue() {+ if (!shareCue) return;+ var view = activeIndex >= 0 ? views[activeIndex] : null;+ var shareMode = document.documentElement.getAttribute('data-share-playback') === 'true';+ var embedMode = document.documentElement.getAttribute('data-embed') === 'true';+ var pinnedMode = !shareMode && embedMode && hashBeatMatchesCurrent();+ if (pinnedMode) document.documentElement.setAttribute('data-share-moment', 'true');+ else document.documentElement.removeAttribute('data-share-moment');+ shareCue.hidden = !(embedMode && view && (shareMode || pinnedMode));+ if (shareCue.hidden) return;+ var state = pinnedMode ? 'pinned' : (panel.getAttribute('data-autoplay') || 'pending');+ var stops = Array.prototype.slice.call(trail.querySelectorAll('[data-story-node]'));+ var route = stops.map(function (stop, index) {+ if (index === 0) return stop.textContent;+ var kind = stop.getAttribute('data-story-link');+ var separator = kind === 'forward' ? '\u2192' : (kind === 'reverse' ? '\u2190' : (kind === 'multiple' ? '\u21c4' : '\u00b7'));+ return separator + ' ' + stop.textContent;+ }).join(' ');+ var beatCopy = shareCueBeatCopy(state, view, stops);+ shareCue.setAttribute('data-state', state);+ shareCue.setAttribute('aria-live', state === 'playing' ? 'off' : 'polite');+ shareCueState.textContent = shareCueStatus(state);+ shareCueCount.textContent = 'Chapter ' + (activeIndex + 1 < 10 ? '0' : '') + (activeIndex + 1) + ' / ' + (views.length < 10 ? '0' : '') + views.length;+ shareCueLabel.textContent = view.label;+ shareCueNote.textContent = beatCopy;+ shareCueRoute.textContent = route;+ shareCue.setAttribute('aria-label', shareCueStatus(state) + ' chapter ' + (activeIndex + 1) + ' of ' + views.length + ': ' + view.label + '. ' + beatCopy + '. ' + route);+ }++ function setShareCueProgress(fraction) {+ if (!shareCueProgress) return;+ shareCueProgress.style.animation = 'none';+ shareCueProgress.style.setProperty('--guided-progress-start', String(Math.max(0, Math.min(1, fraction))));+ shareCueProgress.style.transform = 'scaleX(' + Math.max(0, Math.min(1, fraction)) + ')';+ }++ function startShareCueProgress(fraction, duration) {+ if (!shareCueProgress) return;+ setShareCueProgress(fraction || 0);+ void shareCueProgress.offsetWidth;+ shareCueProgress.style.animation = 'archify-guided-progress ' + Math.max(1, duration || VIEW_INTERVAL_MS) + 'ms linear forwards';+ }++ function storyNodeLabel(node, fallback) {+ if (!node) return fallback;+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '');+ }++ function storyEdgeKey(edge) {+ return edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ }++ function uniqueStoryEdges(edgeList) {+ var positions = {};+ var unique = [];+ edgeList.forEach(function (edge) {+ var key = storyEdgeKey(edge);+ if (!Object.prototype.hasOwnProperty.call(positions, key)) {+ positions[key] = unique.length;+ unique.push(edge);+ return;+ }+ var index = positions[key];+ if (!storyGeometry(unique[index]).length && storyGeometry(edge).length) unique[index] = edge;+ });+ return unique;+ }++ function storyStep(view, index, edgeList, byId) {+ var id = view.focus[index];+ var node = byId[id];+ var previousId = index > 0 ? view.focus[index - 1] : '';+ var forward = [];+ var reverse = [];+ if (previousId) {+ edgeList.forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (from === previousId && to === id) forward.push(edge);+ else if (from === id && to === previousId) reverse.push(edge);+ });+ }+ forward = uniqueStoryEdges(forward);+ reverse = uniqueStoryEdges(reverse);+ var edges = forward.concat(reverse).sort(function (left, right) {+ return edgeList.indexOf(left) - edgeList.indexOf(right);+ });+ var relation = index === 0 ? 'start' : (!edges.length ? 'group' : (+ edges.length === 1 && forward.length === 1 ? 'forward' :+ (edges.length === 1 && reverse.length === 1 ? 'reverse' : 'multiple')+ ));+ return {+ index: index,+ nodeId: id,+ nodeLabel: storyNodeLabel(byId[id], id),+ previousId: previousId,+ previousLabel: previousId ? storyNodeLabel(byId[previousId], previousId) : '',+ relation: relation,+ edges: edges,+ edgeKeys: edges.map(storyEdgeKey),+ edgeLabels: edges.map(function (edge) { return edge.getAttribute('data-edge-label') || ''; }).filter(function (value, edgeIndex, values) {+ return value && values.indexOf(value) === edgeIndex;+ }),+ responsibility: node ? (node.getAttribute('data-node-sublabel') || '') : '',+ context: node ? (node.getAttribute('data-node-context') || '') : ''+ };+ }++ function storyBeatCopy(step, total) {+ if (!step) return '';+ var position = (step.index + 1 < 10 ? '0' : '') + (step.index + 1);+ var countValue = (total < 10 ? '0' : '') + total;+ if (step.relation === 'start') return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.nodeLabel + ' \u00b7 starting point';+ if (step.relation === 'forward') return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.previousLabel + ' \u2192 ' + step.nodeLabel;+ if (step.relation === 'reverse') return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.nodeLabel + ' \u2192 ' + step.previousLabel + ' \u00b7 reverse authored link';+ if (step.relation === 'multiple') return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.previousLabel + ' \u21c4 ' + step.nodeLabel + ' \u00b7 ' + step.edges.length + ' authored links';+ return 'Beat ' + position + ' / ' + countValue + ' \u00b7 ' + step.previousLabel + ' \u00b7 ' + step.nodeLabel + ' \u00b7 grouped \u00b7 no direct link';+ }++ function storyBeatAria(step, total) {+ var prefix = 'Story beat ' + (step.index + 1) + ' of ' + total + ': ' + step.nodeLabel + '. ';+ if (step.relation === 'start') return prefix + 'Starting point.';+ if (step.relation === 'forward') return prefix + 'From ' + step.previousLabel + ' through one authored forward relationship.';+ if (step.relation === 'reverse') return prefix + 'From ' + step.previousLabel + '; the authored relationship points from ' + step.nodeLabel + ' to ' + step.previousLabel + '.';+ if (step.relation === 'multiple') return prefix + 'From ' + step.previousLabel + ' through ' + step.edges.length + ' authored relationships; shown without arbitrary motion.';+ return prefix + 'Grouped from ' + step.previousLabel + ' with no direct authored relationship.';+ }++ function storyCaptionRouteCopy(step) {+ if (step.relation === 'start') return step.nodeLabel + ' · Starting point';+ if (step.relation === 'reverse') return step.previousLabel + ' ← ' + step.nodeLabel;+ if (step.relation === 'multiple') return step.previousLabel + ' ⇄ ' + step.nodeLabel;+ if (step.relation === 'group') return step.previousLabel + ' · ' + step.nodeLabel;+ return step.previousLabel + ' → ' + step.nodeLabel;+ }++ function storyCaptionDetailCopy(step) {+ var facts = [];+ if (step.relation === 'group') facts.push('Grouped transition · no direct authored link');+ else if (step.edgeLabels.length) facts.push(step.edgeLabels.slice(0, 3).join(' + ') + (step.edgeLabels.length > 3 ? ' +' + (step.edgeLabels.length - 3) + ' more' : ''));+ else if (step.relation === 'reverse') facts.push('Reverse authored relationship');+ else if (step.relation === 'multiple') facts.push(step.edges.length + ' authored relationships');+ else if (step.relation !== 'start') facts.push('Authored relationship');+ if (step.relation === 'reverse') facts.push('authored direction: ' + step.nodeLabel + ' → ' + step.previousLabel);+ if (step.responsibility) facts.push(step.responsibility);+ if (step.context) facts.push(step.context);+ if (!facts.length) facts.push('Authored starting point');+ return facts.join(' · ');+ }++ function renderStoryCaption(step, total, nextStep) {+ if (!storyCaption) return;+ if (!step) {+ storyCaption.hidden = true;+ storyCaption.removeAttribute('data-story-caption');+ storyCaptionNext.hidden = true;+ storyCaptionNextLabel.textContent = '';+ return;+ }+ storyCaption.hidden = false;+ storyCaption.setAttribute('data-story-caption', step.relation);+ storyCaption.setAttribute('aria-live', playing ? 'off' : 'polite');+ storyCaptionIndex.textContent = (step.index + 1 < 10 ? '0' : '') + (step.index + 1) + ' / ' + (total < 10 ? '0' : '') + total;+ storyCaptionRoute.textContent = storyCaptionRouteCopy(step);+ storyCaptionDetail.textContent = storyCaptionDetailCopy(step);+ storyCaptionNext.hidden = !nextStep;+ storyCaptionNextLabel.textContent = nextStep+ ? ((nextStep.index + 1 < 10 ? '0' : '') + (nextStep.index + 1) + ' · ' + nextStep.nodeLabel)+ : '';+ storyCaption.style.animation = 'none';+ void storyCaption.offsetWidth;+ storyCaption.style.removeProperty('animation');+ }++ function storyMomentLink() {+ var view = activeIndex >= 0 ? views[activeIndex] : null;+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ if (!view || !step) return '';+ var url = new URL(location.href);+ url.searchParams.delete('play');+ url.hash = 'view=' + encodeURIComponent(view.id) + '&beat=' + encodeURIComponent(step.nodeId);+ return url.href;+ }++ function fallbackCopyStoryMoment(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }++ function resetBeatLinkFeedback() {+ if (beatLinkFeedbackTimer) clearTimeout(beatLinkFeedbackTimer);+ beatLinkFeedbackTimer = null;+ beatLink.removeAttribute('data-copy-state');+ beatLinkLabel.textContent = 'Copy moment';+ }++ function syncBeatLink() {+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ var available = !!(activeIndex >= 0 && step && !currentHandoff);+ beatLink.disabled = !available;+ if (!beatLink.hasAttribute('data-copy-state')) beatLinkLabel.textContent = 'Copy moment';+ var description = available+ ? 'Copy link to current story moment: Beat ' + (step.index + 1) + ' of ' + storySteps.length + ': ' + step.nodeLabel+ : 'Select a Story Beat to copy its exact link';+ beatLink.setAttribute('aria-label', description);+ beatLink.title = description;+ }++ function setBeatLinkFeedback(copied) {+ resetBeatLinkFeedback();+ beatLink.setAttribute('data-copy-state', copied ? 'copied' : 'failed');+ beatLinkLabel.textContent = copied ? 'Copied' : 'Copy failed';+ beatLink.setAttribute('aria-label', copied ? 'Moment link copied' : 'Could not copy story moment link');+ beatLinkFeedbackTimer = setTimeout(function () {+ resetBeatLinkFeedback();+ syncBeatLink();+ }, 1600);+ }++ function copyStoryMomentLink() {+ if (playing) pausePlayback();+ var value = storyMomentLink();+ if (!value) return Promise.resolve(false);+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopyStoryMoment(value); })+ : Promise.resolve(fallbackCopyStoryMoment(value));+ return copy.then(function (copied) {+ setBeatLinkFeedback(copied);+ return copied;+ });+ }++ function hashBeatMatchesCurrent() {+ var view = activeIndex >= 0 ? views[activeIndex] : null;+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ if (!view || !step) return false;+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ return params.get('view') === view.id && params.get('beat') === step.nodeId;+ } catch (_) { return false; }+ }++ function storyMotionAllowed() {+ if (document.hidden || reducedMotion()) return false;+ if (document.documentElement.getAttribute('data-motion') !== 'live') return false;+ if (document.documentElement.getAttribute('data-embed') === 'true' &&+ document.documentElement.getAttribute('data-share-playback') !== 'true') return false;+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ return !(Archify.motionGovernor && Archify.motionGovernor.isPaused());+ }++ function storyAutomaticPlaybackAllowed() {+ if (document.hidden || reducedMotion()) return false;+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ if (Archify.motionGovernor && Archify.motionGovernor.capable) return !Archify.motionGovernor.isPaused();+ return true;+ }++ function clearStoryPulse(options) {+ options = options || {};+ storyPulseGeneration += 1;+ Array.prototype.forEach.call(svg.querySelectorAll('.story-trail-flow[data-story-pulse]'), function (flow) {+ flow.removeAttribute('data-story-pulse');+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-carrier-overlay]'), function (overlay) {+ overlay.remove();+ });+ if (storyPulseOwnerToken && options.release !== false && Archify.motionGovernor) {+ var token = storyPulseOwnerToken;+ storyPulseOwnerToken = 0;+ Archify.motionGovernor.release(token);+ } else if (options.release === false) storyPulseOwnerToken = 0;+ }++ function pulseStoryStep(step) {+ clearStoryPulse();+ if (!step || (step.relation !== 'forward' && step.relation !== 'reverse') || step.edges.length !== 1 || !storyMotionAllowed()) return false;+ var flows = Array.prototype.slice.call(svg.querySelectorAll('.story-trail-flow[data-story-beat-step="' + step.index + '"]'));+ if (!flows.length) return false;+ var pulseGeneration = storyPulseGeneration;+ if (Archify.motionGovernor && Archify.motionGovernor.capable) {+ storyPulseOwnerToken = Archify.motionGovernor.claim('story', function () {+ clearStoryPulse({ release: false });+ });+ }+ flows.forEach(function (flow) { flow.setAttribute('data-story-pulse', 'true'); });+ if (Archify.flowTokens && typeof Archify.flowTokens.create === 'function') {+ var edge = step.edges[0];+ var shapes = storyGeometry(edge);+ var carrier = shapes.length ? Archify.flowTokens.create(edge, shapes[0], {+ className: 'story-flow-token',+ duration: '0.78s'+ }) : null;+ if (carrier) {+ var carrierOverlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ var carrierWrapper = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ carrierOverlay.setAttribute('class', 'story-carrier-overlay');+ carrierOverlay.setAttribute('data-story-carrier-overlay', '');+ carrierOverlay.setAttribute('aria-hidden', 'true');+ if (edge.hasAttribute('transform')) carrierWrapper.setAttribute('transform', edge.getAttribute('transform'));+ carrier.setAttribute('data-story-carrier-token', '');+ carrier.setAttribute('data-story-beat-step', String(step.index));+ carrierWrapper.appendChild(carrier);+ carrierOverlay.appendChild(carrierWrapper);+ var firstNode = svg.querySelector('[data-node-id]');+ while (firstNode && firstNode.parentNode !== svg) firstNode = firstNode.parentNode;+ if (firstNode) svg.insertBefore(carrierOverlay, firstNode);+ else svg.appendChild(carrierOverlay);+ }+ }+ void flows[0].getBoundingClientRect();+ flows[0].addEventListener('animationend', function () {+ if (pulseGeneration === storyPulseGeneration) clearStoryPulse();+ }, { once: true });+ return true;+ }++ function stopStoryBeatTimer(options) {+ options = options || {};+ storyPlaybackGeneration += 1;+ if (storyBeatTimer && options.preserveElapsed === true && storyBeatStartedAt) {+ storyBeatElapsedMs = Math.min(storyBeatDwellMs, storyBeatElapsedMs + Math.max(0, Date.now() - storyBeatStartedAt));+ }+ if (storyBeatTimer) clearTimeout(storyBeatTimer);+ storyBeatTimer = null;+ storyBeatStartedAt = 0;+ }++ function centerStoryStop(stop) {+ if (!stop || !trail) return false;+ var target = Math.max(0, stop.offsetLeft - (trail.clientWidth - stop.offsetWidth) / 2);+ trail.scrollLeft = target;+ return true;+ }++ function storyBeatDwell(total) {+ return Math.max(STORY_FOLLOW_MIN_DWELL_MS, VIEW_INTERVAL_MS / Math.max(1, total));+ }++ function clearStoryFollow() {+ storyFollowGeneration += 1;+ svg.removeAttribute('data-story-follow');+ panel.removeAttribute('data-story-follow');+ panel.removeAttribute('data-story-follow-node');+ }++ function storyFrameIds(step) {+ if (!step) return [];+ var ids = [];+ if (step.index > 0 && storySteps[step.index - 1]) ids.push(storySteps[step.index - 1].nodeId);+ ids.push(step.nodeId);+ if (step.index + 1 < storySteps.length) ids.push(storySteps[step.index + 1].nodeId);+ return ids;+ }++ function followStoryStep(step, options) {+ options = options || {};+ if (!step || document.hidden) return false;+ if (!Archify.view || typeof Archify.view.reveal !== 'function') {+ var deferredIndex = step.index;+ var deferredGeneration = ++storyFollowGeneration;+ requestAnimationFrame(function () {+ if (deferredGeneration !== storyFollowGeneration || storyBeatIndex !== deferredIndex) return;+ if (Archify.view && typeof Archify.view.reveal === 'function') followStoryStep(step, options);+ });+ return true;+ }+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ var embed = document.documentElement.getAttribute('data-embed') === 'true';+ var explicitEmbedPlayback = document.documentElement.getAttribute('data-share-playback') === 'true';+ if (embed && !explicitEmbedPlayback && options.linked !== true) return false;+ var ids = storyFrameIds(step);+ var generation = ++storyFollowGeneration;+ svg.setAttribute('data-story-follow', step.nodeId);+ panel.setAttribute('data-story-follow', 'moving');+ panel.setAttribute('data-story-follow-node', step.nodeId);+ var receipt = Archify.view.reveal(ids, {+ reason: options.manual === true ? 'story-beat' : 'story-follow',+ padding: 64,+ maxScale: 1.65,+ duration: STORY_FOLLOW_DURATION_MS,+ instant: options.instant === true || reducedMotion() || document.documentElement.getAttribute('data-motion') !== 'live'+ });+ if (receipt && receipt.finished && typeof receipt.finished.then === 'function') {+ receipt.finished.then(function (result) {+ if (generation !== storyFollowGeneration || storyBeatIndex !== step.index) return;+ svg.removeAttribute('data-story-follow');+ panel.setAttribute('data-story-follow', result && result.state === 'complete' ? 'settled' : 'interrupted');+ });+ } else if (generation === storyFollowGeneration) {+ panel.setAttribute('data-story-follow', 'settled');+ }+ return receipt;+ }++ function setStoryBeat(index, options) {+ options = options || {};+ var stops = Array.prototype.slice.call(trail.querySelectorAll('[data-story-node]'));+ if (!stops.length) return false;+ resetBeatLinkFeedback();+ storyBeatIndex = Math.max(0, Math.min(stops.length - 1, index));+ var nextStep = storyBeatIndex + 1 < storySteps.length ? storySteps[storyBeatIndex + 1] : null;+ svg.setAttribute('data-story-beat', (storyBeatIndex + 1) + '/' + stops.length);+ panel.setAttribute('data-story-beat', (storyBeatIndex + 1) + '/' + stops.length);+ if (nextStep) {+ svg.setAttribute('data-story-next', nextStep.nodeId);+ panel.setAttribute('data-story-next', nextStep.nodeId);+ } else {+ svg.removeAttribute('data-story-next');+ panel.removeAttribute('data-story-next');+ }+ function storyBeatState(step) {+ if (step < storyBeatIndex) return 'past';+ if (step === storyBeatIndex) return 'active';+ if (step === storyBeatIndex + 1) return 'next';+ return 'pending';+ }+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-step]'), function (node) {+ var step = Number(node.getAttribute('data-story-step'));+ node.setAttribute('data-story-beat-state', storyBeatState(step));+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-beat-step]'), function (edge) {+ var step = Number(edge.getAttribute('data-story-beat-step'));+ edge.setAttribute('data-story-beat-state', storyBeatState(step));+ });+ stops.forEach(function (stop, step) {+ stop.setAttribute('data-story-beat-state', storyBeatState(step));+ if (step === storyBeatIndex) stop.setAttribute('aria-current', 'step');+ else stop.removeAttribute('aria-current');+ });+ note.setAttribute('aria-live', 'off');+ note.textContent = storyBeatCopy(storySteps[storyBeatIndex], stops.length);+ renderStoryCaption(storySteps[storyBeatIndex], stops.length, nextStep);+ if (options.center === true) centerStoryStop(stops[storyBeatIndex]);+ if (options.pulse === true) pulseStoryStep(storySteps[storyBeatIndex]);+ else clearStoryPulse();+ if (options.follow === true) followStoryStep(storySteps[storyBeatIndex], {+ manual: options.manual === true,+ linked: options.linked === true,+ instant: options.followInstant === true+ });+ renderShareCue();+ syncBeatLink();+ return true;+ }++ function settleStoryBeats() {+ stopStoryBeatTimer();+ clearStoryPulse();+ clearStoryFollow();+ resetBeatLinkFeedback();+ storyBeatIndex = -1;+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = 0;+ svg.removeAttribute('data-story-beat');+ svg.removeAttribute('data-story-next');+ panel.removeAttribute('data-story-beat');+ panel.removeAttribute('data-story-next');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-beat-state]'), function (el) {+ el.removeAttribute('data-story-beat-state');+ });+ Array.prototype.forEach.call(trail.querySelectorAll('[data-story-beat-state]'), function (stop) {+ stop.removeAttribute('data-story-beat-state');+ stop.removeAttribute('aria-current');+ });+ note.setAttribute('aria-live', 'polite');+ if (activeIndex >= 0) note.textContent = views[activeIndex].note || views[activeIndex].focus.length + ' selected nodes';+ renderStoryCaption(null, 0);+ renderShareCue();+ syncBeatLink();+ }- <!-- Main Diagram -->- <div class="diagram-container">- <svg viewBox="0 0 1180 588" role="img" aria-label="Maka — Local-first desktop AI workbench — sessions, tools, permissions, recovery (architecture diagram)">- <!-- Definitions -->- <defs>- <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" class="m-default" />- </marker>- <marker id="arrowhead-emphasis" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" class="m-emphasis" />- </marker>- <marker id="arrowhead-security" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" class="m-security" />- </marker>- <marker id="arrowhead-dashed" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">- <polygon points="0 0, 10 3.5, 0 7" class="m-dashed" />- </marker>- <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">- <path d="M 40 0 L 0 0 0 40" class="c-grid" stroke-width="0.5"/>- </pattern>- </defs>+ function clearStoryTrail() {+ stopStoryBeatTimer();+ clearStoryPulse();+ clearStoryFollow();+ resetBeatLinkFeedback();+ storyBeatIndex = -1;+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = 0;+ storySteps = [];+ svg.removeAttribute('data-story-active');+ svg.removeAttribute('data-story-playing');+ svg.removeAttribute('data-story-beat');+ svg.removeAttribute('data-story-next');+ panel.removeAttribute('data-story-beat');+ panel.removeAttribute('data-story-next');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-overlay]'), function (overlay) {+ overlay.remove();+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-step], [data-story-beat-state]'), function (node) {+ node.removeAttribute('data-story-step');+ node.removeAttribute('data-story-beat-state');+ node.style.removeProperty('--story-step');+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-story-beat-step]'), function (edge) {+ edge.removeAttribute('data-story-beat-step');+ edge.removeAttribute('data-story-beat-state');+ });+ trail.textContent = '';+ trail.hidden = true;+ trail.removeAttribute('aria-label');+ renderStoryCaption(null, 0);+ syncBeatLink();+ }- <!-- Background Grid -->- <rect width="100%" height="100%" fill="url(#grid)" />+ function storyGeometry(edge) {+ if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }- <!-- Boundaries (behind everything) -->- <rect x="170" y="110" width="970" height="410" rx="12" class="c-region" stroke-width="1"/>- <text x="178" y="128" class="t-cloud" font-size="9" font-weight="600">Electron app + packages/runtime</text>+ function renderStoryTrail(view) {+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ clearStoryTrail();+ if (!view) return;- <rect x="550" y="110" width="400" height="410" rx="8" class="c-security-group" stroke-width="1"/>- <text x="558" y="128" class="t-security" font-size="9" font-weight="600">trust boundary</text>+ var nodeList = Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ var edgeList = Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ var byId = {};+ nodeList.forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ storySteps = view.focus.map(function (_, index) { return storyStep(view, index, edgeList, byId); });+ var labels = [];+ storySteps.forEach(function (step, index) {+ var id = step.nodeId;+ var node = byId[id];+ if (!node) return;+ node.setAttribute('data-story-step', String(index));+ node.style.setProperty('--story-step', String(index));+ var nodeLabel = step.nodeLabel;+ labels.push(nodeLabel);+ var stop = document.createElement('button');+ stop.type = 'button';+ stop.className = 'guided-view-stop';+ stop.setAttribute('data-story-node', id);+ stop.setAttribute('data-story-index', String(index));+ stop.setAttribute('data-story-relation', step.relation);+ stop.setAttribute('data-story-number', (index + 1 < 10 ? '0' : '') + (index + 1));+ if (index > 0) stop.setAttribute('data-story-link', step.relation);+ stop.style.setProperty('--story-step', String(index));+ stop.setAttribute('aria-label', storyBeatAria(step, storySteps.length));+ stop.title = storyBeatCopy(step, storySteps.length);+ stop.textContent = nodeLabel;+ trail.appendChild(stop);+ });+ trail.hidden = labels.length === 0;+ trail.setAttribute('aria-label', 'Story trail for ' + view.label + ': ' + labels.length + ' beats');+ trail.scrollLeft = 0;+ svg.setAttribute('data-story-active', view.id);- <!-- Connection paths (before components for correct z-order) -->- <path d="M 160 330 L 200 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 340 330 L 390 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 530 330 L 580 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 730 330 L 780 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 920 330 L 970 330" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 1040 300 L 1040 200" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 655 200 L 655 300" class="a-dashed" stroke-width="1.5" marker-end="url(#arrowhead-dashed)"/>- <path d="M 850 300 L 850 200" class="a-security" stroke-width="1.5" marker-end="url(#arrowhead-security)"/>- <path d="M 655 360 L 655 440" class="a-dashed" stroke-width="1.5" marker-end="url(#arrowhead-dashed)"/>- <path d="M 850 360 L 850 440" class="a-default" stroke-width="1.5" marker-end="url(#arrowhead)"/>- <path d="M 920 470 L 970 470" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path d="M 850 440 L 850 200" class="a-security" stroke-width="1.5" marker-end="url(#arrowhead-security)"/>+ var overlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ overlay.setAttribute('class', 'story-trail-overlay');+ overlay.setAttribute('data-story-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ var copied = 0;+ storySteps.forEach(function (step) {+ step.edges.forEach(function (edge) {+ var edgeBeat = step.index;+ edge.setAttribute('data-story-beat-step', String(edgeBeat));+ var wrapper = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ storyGeometry(edge).forEach(function (shape) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('role');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.setAttribute('class', 'story-trail-flow');+ clone.setAttribute('data-story-beat-step', String(edgeBeat));+ clone.style.setProperty('--story-step', String(edgeBeat));+ wrapper.appendChild(clone);+ copied += 1;+ });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ });+ if (copied) {+ var firstEdge = edgeList[0];+ if (firstEdge && firstEdge.parentNode) firstEdge.parentNode.insertBefore(overlay, firstEdge);+ else svg.insertBefore(overlay, svg.firstChild);+ }+ }- <!-- Components -->- <rect x="40" y="300" width="120" height="60" rx="6" class="c-mask"/>- <rect x="40" y="300" width="120" height="60" rx="6" class="c-external" stroke-width="1.5"/>- <text x="100" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">You</text>- <text x="100" y="344" class="t-muted" font-size="9" text-anchor="middle">desktop user</text>-- <rect x="200" y="300" width="140" height="60" rx="6" class="c-mask"/>- <rect x="200" y="300" width="140" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>- <text x="270" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Desktop UI</text>- <text x="270" y="344" class="t-muted" font-size="9" text-anchor="middle">React renderer</text>-- <rect x="390" y="300" width="140" height="60" rx="6" class="c-mask"/>- <rect x="390" y="300" width="140" height="60" rx="6" class="c-backend" stroke-width="1.5"/>- <text x="460" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Main Process</text>- <text x="460" y="344" class="t-muted" font-size="9" text-anchor="middle">Electron IPC</text>-- <rect x="580" y="300" width="150" height="60" rx="6" class="c-mask"/>- <rect x="580" y="300" width="150" height="60" rx="6" class="c-backend" stroke-width="1.5"/>- <text x="655" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">SessionManager</text>- <text x="655" y="344" class="t-muted" font-size="9" text-anchor="middle">public runtime API</text>-- <rect x="780" y="300" width="140" height="60" rx="6" class="c-mask"/>- <rect x="780" y="300" width="140" height="60" rx="6" class="c-backend" stroke-width="1.5"/>- <text x="850" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">AgentRun</text>- <text x="850" y="344" class="t-muted" font-size="9" text-anchor="middle">turn + recovery</text>-- <rect x="970" y="300" width="140" height="60" rx="6" class="c-mask"/>- <rect x="970" y="300" width="140" height="60" rx="6" class="c-backend" stroke-width="1.5"/>- <text x="1040" y="328" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">ModelAdapter</text>- <text x="1040" y="344" class="t-muted" font-size="9" text-anchor="middle">stream + usage</text>-- <rect x="970" y="140" width="140" height="60" rx="6" class="c-mask"/>- <rect x="970" y="140" width="140" height="60" rx="6" class="c-cloud" stroke-width="1.5"/>- <text x="1040" y="168" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Model Providers</text>- <text x="1040" y="184" class="t-muted" font-size="9" text-anchor="middle">AI SDK / Ollama</text>- <text x="1040" y="192" class="t-cloud" font-size="7" text-anchor="middle">API keys local</text>-- <rect x="580" y="140" width="150" height="60" rx="6" class="c-mask"/>- <rect x="580" y="140" width="150" height="60" rx="6" class="c-external" stroke-width="1.5"/>- <text x="655" y="168" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Bots & Gateway</text>- <text x="655" y="184" class="t-muted" font-size="9" text-anchor="middle">Telegram · Feishu · HTTP</text>-- <rect x="780" y="140" width="140" height="60" rx="6" class="c-mask"/>- <rect x="780" y="140" width="140" height="60" rx="6" class="c-security" stroke-width="1.5"/>- <text x="850" y="168" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Permission</text>- <text x="850" y="184" class="t-muted" font-size="9" text-anchor="middle">policy engine</text>- <text x="850" y="192" class="t-security" font-size="7" text-anchor="middle">fail-closed</text>-- <rect x="580" y="440" width="150" height="60" rx="6" class="c-mask"/>- <rect x="580" y="440" width="150" height="60" rx="6" class="c-database" stroke-width="1.5"/>- <text x="655" y="468" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Local Storage</text>- <text x="655" y="484" class="t-muted" font-size="9" text-anchor="middle">userData JSONL</text>-- <rect x="780" y="440" width="140" height="60" rx="6" class="c-mask"/>- <rect x="780" y="440" width="140" height="60" rx="6" class="c-messagebus" stroke-width="1.5"/>- <text x="850" y="468" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">ToolRuntime</text>- <text x="850" y="484" class="t-muted" font-size="9" text-anchor="middle">validate · abort</text>-- <rect x="970" y="440" width="140" height="60" rx="6" class="c-mask"/>- <rect x="970" y="440" width="140" height="60" rx="6" class="c-frontend" stroke-width="1.5"/>- <text x="1040" y="468" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Local Tools</text>- <text x="1040" y="484" class="t-muted" font-size="9" text-anchor="middle">Read · Write · Bash</text>+ function syncStoryPlayback() {+ var shouldPlay = playing && activeIndex >= 0;+ if (shouldPlay && svg.getAttribute('data-story-playing') !== 'true') svg.setAttribute('data-story-playing', 'true');+ else if (!shouldPlay && svg.hasAttribute('data-story-playing')) svg.removeAttribute('data-story-playing');+ }- <!-- Connection labels -->+ function resetProgress(fraction) {+ fraction = Math.max(0, Math.min(1, Number(fraction) || 0));+ progressBar.style.animation = 'none';+ progressBar.style.setProperty('--guided-progress-start', String(fraction));+ progressBar.style.transform = 'scaleX(' + fraction + ')';+ }++ function startProgress(fraction, duration) {+ resetProgress(fraction);+ void progressBar.offsetWidth;+ progressBar.style.animation = 'archify-guided-progress ' + Math.max(1, duration || VIEW_INTERVAL_MS) + 'ms linear forwards';+ }++ function currentStoryProgress() {+ var total = storySteps.length;+ if (!total || storyBeatIndex < 0) return 0;+ var elapsed = storyBeatElapsedMs;+ if (playing && storyBeatTimer && storyBeatStartedAt) elapsed += Math.max(0, Date.now() - storyBeatStartedAt);+ var dwell = storyBeatDwellMs || storyBeatDwell(total);+ return Math.max(0, Math.min(1, (storyBeatIndex + Math.min(1, elapsed / dwell)) / total));+ }++ function renderPlayback() {+ var automaticPlaybackAllowed = storyAutomaticPlaybackAllowed();+ panel.setAttribute('data-playing', playing ? 'true' : 'false');+ syncStoryPlayback();+ play.disabled = !playing && !automaticPlaybackAllowed;+ play.setAttribute('aria-pressed', playing ? 'true' : 'false');+ play.setAttribute('aria-label', playing ? 'Pause guided story' : (!automaticPlaybackAllowed ? 'Story playback unavailable while motion is Still' : (storyPlaybackComplete ? 'Replay guided story' : 'Play guided story')));+ play.title = playing ? 'Pause guided story (P)' : (!automaticPlaybackAllowed ? 'Switch motion to Live to play the guided story' : (storyPlaybackComplete ? 'Replay guided story (P)' : 'Play guided story (P)'));+ playIcon.textContent = playing ? '\u2016' : '\u25b6';+ playLabel.textContent = playing ? 'Pause' : (storyPlaybackComplete ? 'Replay story' : 'Play story');+ if (storyCaption && !storyCaption.hidden) storyCaption.setAttribute('aria-live', playing ? 'off' : 'polite');+ }++ function render() {+ var view = views[activeIndex];+ count.textContent = activeIndex < 0 ? '0 / ' + views.length : (activeIndex + 1) + ' / ' + views.length;+ label.textContent = view ? view.label : 'Explore this system';+ note.setAttribute('aria-live', storyBeatIndex >= 0 ? 'off' : 'polite');+ note.textContent = storyBeatIndex >= 0+ ? storyBeatCopy(storySteps[storyBeatIndex], storySteps.length)+ : (view ? (view.note || view.focus.length + ' selected nodes') : 'Step through curated paths without changing the source diagram.');+ prev.disabled = activeIndex < 0;+ next.disabled = activeIndex >= views.length - 1;+ all.disabled = activeIndex < 0;+ panel.setAttribute('data-active-view', view ? view.id : 'all');+ syncChapterIndex();+ renderShareCue();+ renderPlayback();+ syncBeatLink();+ }++ function pausePlayback(options) {+ options = options || {};+ var progress = options.complete === true ? 1 : currentStoryProgress();+ if (panel.getAttribute('data-autoplay') === 'playing') {+ setShareCueProgress(progress);+ setAutoplayState(options.complete === true ? 'complete' : 'interrupted');+ }+ stopStoryBeatTimer({ preserveElapsed: options.complete !== true });+ clearStoryPulse();+ clearStoryFollow();+ playing = false;+ storyPlaybackComplete = options.complete === true;+ resetProgress(progress);+ renderPlayback();+ renderShareCue();+ }- <rect x="350" y="310" width="30" height="14" rx="3" class="c-mask"/>- <text x="365" y="320" class="t-backend" font-size="8" text-anchor="middle">IPC</text>+ function finishStoryChapter() {+ if (!playing) return false;+ if (storyPlaybackScope === 'chapter') {+ pausePlayback({ complete: true });+ return true;+ }+ if (activeIndex < views.length - 1) {+ var destinationIndex = activeIndex + 1;+ activate(destinationIndex, { playback: true });+ afterHandoff(function () {+ if (!playing || activeIndex !== destinationIndex) return;+ storyBeatElapsedMs = 0;+ setStoryBeat(0, { pulse: true, follow: true });+ scheduleStoryPlayback();+ });+ return true;+ }+ pausePlayback({ complete: true });+ return true;+ }- <rect x="740" y="310" width="30" height="14" rx="3" class="c-mask"/>- <text x="755" y="320" class="t-backend" font-size="8" text-anchor="middle">turn</text>+ function scheduleStoryPlayback() {+ var total = storySteps.length;+ if (!playing || !total || reducedMotion()) {+ if (playing) pausePlayback();+ return false;+ }+ storyBeatDwellMs = storyBeatDwell(total);+ if (storyBeatIndex < 0) {+ storyBeatElapsedMs = 0;+ setStoryBeat(0, { pulse: true, follow: true });+ }+ storyBeatElapsedMs = Math.max(0, Math.min(storyBeatDwellMs, storyBeatElapsedMs));+ var remainingDwell = Math.max(1, storyBeatDwellMs - storyBeatElapsedMs);+ var progress = (storyBeatIndex + storyBeatElapsedMs / storyBeatDwellMs) / total;+ var remainingChapter = remainingDwell + Math.max(0, total - storyBeatIndex - 1) * storyBeatDwellMs;+ startProgress(progress, remainingChapter);+ if (panel.getAttribute('data-autoplay') === 'playing') startShareCueProgress(progress, remainingChapter);+ var generation = ++storyPlaybackGeneration;+ storyBeatStartedAt = Date.now();+ storyBeatTimer = setTimeout(function () {+ if (!playing || generation !== storyPlaybackGeneration) return;+ storyBeatTimer = null;+ storyBeatStartedAt = 0;+ storyBeatElapsedMs = 0;+ if (storyBeatIndex < total - 1) {+ setStoryBeat(storyBeatIndex + 1, { pulse: true, follow: true });+ scheduleStoryPlayback();+ } else finishStoryChapter();+ }, remainingDwell);+ return true;+ }- <rect x="1020.6" y="280" width="38.8" height="14" rx="3" class="c-mask"/>- <text x="1040" y="290" class="t-backend" font-size="8" text-anchor="middle">stream</text>+ function startPlayback() {+ if (!storyAutomaticPlaybackAllowed()) {+ renderPlayback();+ return false;+ }+ autoplayPending = false;+ setAutoplayState(null);+ setShareCueProgress(0);+ document.documentElement.removeAttribute('data-share-playback');+ storyPlaybackScope = 'story';+ if (storyPlaybackComplete) showAll({ updateUrl: false });+ storyPlaybackComplete = false;+ if (activeIndex < 0) activate(0, { playback: true });+ playing = true;+ renderPlayback();+ afterHandoff(function () {+ if (!playing) return;+ if (storyBeatIndex >= 0) followStoryStep(storySteps[storyBeatIndex]);+ scheduleStoryPlayback();+ });+ return true;+ }+ function startCurrentViewPlayback() {+ if (document.hidden) return false;+ autoplayPending = false;+ document.documentElement.setAttribute('data-share-playback', 'true');+ storyPlaybackScope = 'chapter';+ storyPlaybackComplete = false;+ if (activeIndex < 0) activate(0, { playback: true, updateUrl: false });+ if (!storyAutomaticPlaybackAllowed()) {+ var preserveMoment = hashBeatMatchesCurrent();+ setShareCueProgress(preserveMoment && storySteps.length ? (storyBeatIndex + 1) / storySteps.length : 1);+ setAutoplayState('reduced-motion');+ playing = false;+ if (preserveMoment) {+ clearStoryPulse();+ renderShareCue();+ } else settleStoryBeats();+ renderPlayback();+ return false;+ }+ playing = true;+ setAutoplayState('playing');+ renderPlayback();+ afterHandoff(function () {+ if (!playing) return;+ if (storyBeatIndex >= 0) followStoryStep(storySteps[storyBeatIndex]);+ scheduleStoryPlayback();+ });+ return true;+ }+ function maybeStartSharePlayback() {+ if (!autoplayPending || document.hidden) return false;+ return startCurrentViewPlayback();+ }+ function togglePlayback() {+ return playing ? (pausePlayback(), false) : startPlayback();+ }+ function syncStoryControlsDisabled() {+ Array.prototype.forEach.call(trail.querySelectorAll('[data-story-node]'), function (stop) {+ stop.disabled = !!currentHandoff;+ });+ syncBeatLink();+ }+ function selectStoryBeat(index) {+ if (currentHandoff || activeIndex < 0 || index < 0 || index >= storySteps.length) return false;+ momentRestoreGeneration += 1;+ clearChapterPreview({ clearIntents: true });+ if (playing) pausePlayback();+ else {+ stopStoryBeatTimer();+ clearStoryPulse();+ }+ storyPlaybackComplete = false;+ storyPlaybackScope = 'story';+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = storyBeatDwell(storySteps.length);+ var view = views[activeIndex];+ Archify.focus.setMany(view.focus, {+ toggle: false,+ updateUrl: false,+ mode: 'selection',+ label: view.label,+ hideChip: true+ });+ setStoryBeat(index, { manual: true, center: true, pulse: true, follow: true });+ resetProgress(index / storySteps.length);+ renderPlayback();+ return true;+ }+ function selectStoryBeatById(id, options) {+ options = options || {};+ var index = storySteps.findIndex(function (step) { return step.nodeId === id; });+ if (index < 0) return false;+ if (playing) pausePlayback();+ else {+ stopStoryBeatTimer();+ clearStoryPulse();+ }+ storyPlaybackComplete = false;+ storyPlaybackScope = 'story';+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = storyBeatDwell(storySteps.length);+ setStoryBeat(index, {+ manual: false,+ center: true,+ pulse: false,+ follow: options.follow === true,+ linked: options.linked === true,+ followInstant: options.followInstant === true+ });+ resetProgress(index / storySteps.length);+ renderPlayback();+ return true;+ }- <!-- Legend -->- <text x="40" y="559" class="t-primary" font-size="9" font-weight="600">Legend</text>- <rect x="40" y="564" width="14" height="9" rx="2" class="c-external" stroke-width="1"/>- <text x="60" y="572" class="t-muted" font-size="8">External</text>- <rect x="138" y="564" width="14" height="9" rx="2" class="c-frontend" stroke-width="1"/>- <text x="158" y="572" class="t-muted" font-size="8">Frontend</text>- <rect x="236" y="564" width="14" height="9" rx="2" class="c-backend" stroke-width="1"/>- <text x="256" y="572" class="t-muted" font-size="8">Backend</text>- <rect x="329" y="564" width="14" height="9" rx="2" class="c-cloud" stroke-width="1"/>- <text x="349" y="572" class="t-muted" font-size="8">Cloud</text>- <rect x="412" y="564" width="14" height="9" rx="2" class="c-security" stroke-width="1"/>- <text x="432" y="572" class="t-muted" font-size="8">Security</text>- <rect x="510" y="564" width="14" height="9" rx="2" class="c-database" stroke-width="1"/>- <text x="530" y="572" class="t-muted" font-size="8">Database</text>- <rect x="608" y="564" width="14" height="9" rx="2" class="c-messagebus" stroke-width="1"/>- <text x="628" y="572" class="t-muted" font-size="8">Message bus</text>- </svg>- </div>+ function updateUrl(view) {+ try {+ history.replaceState(null, '', location.pathname + location.search + (view ? '#view=' + encodeURIComponent(view.id) : ''));+ } catch (_) {}+ }- <!-- Info Cards -->- <div class="cards">- <div class="card">- <div class="card-header">- <div class="card-dot cyan"></div>- <h3>Desktop surfaces</h3>- </div>- <ul>- <li>• apps/desktop: renderer, preload, main process</li>- <li>• Settings for models, bots, search, gateway, permissions</li>- <li>• Bots and open gateway share SessionManager as the public API</li>- </ul>- </div>+ function showAll(options) {+ options = options || {};+ if (options.restore !== true) momentRestoreGeneration += 1;+ clearChapterPreview({ clearIntents: true });+ if (playing && options.playback !== true) pausePlayback();+ if (options.playback !== true) storyPlaybackComplete = false;+ cancelHandoff('overview');+ activeIndex = -1;+ renderStoryTrail(null);+ if (options.clearFocus !== false) Archify.focus.clear({ updateUrl: false });+ if (options.resetView !== false && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ render();+ if (options.updateUrl !== false) updateUrl(null);+ }- <div class="card">- <div class="card-header">- <div class="card-dot emerald"></div>- <h3>Runtime kernel</h3>- </div>- <ul>- <li>• SessionManager → AgentRun → AiSdkBackend</li>- <li>• ModelAdapter normalizes provider streams and usage</li>- <li>• ToolRuntime owns tool validation, abort, and telemetry</li>- </ul>- </div>+ function activate(index, options) {+ options = options || {};+ if (options.restore !== true) momentRestoreGeneration += 1;+ if (playing && options.playback !== true) pausePlayback();+ if (options.playback !== true) storyPlaybackComplete = false;+ if (index < 0) { showAll(options); return true; }+ if (index >= views.length) return false;+ clearChapterPreview({ clearIntents: true });+ var previousIndex = activeIndex;+ var previous = previousIndex >= 0 ? views[previousIndex] : null;+ var outgoingBeatIndex = storyBeatIndex;+ cancelHandoff('replaced');+ activeIndex = index;+ var view = views[index];+ Archify.focus.setMany(view.focus, {+ toggle: false,+ updateUrl: false,+ mode: 'selection',+ label: view.label,+ hideChip: true+ });+ renderStoryTrail(view);+ beginHandoff(previousIndex, index, previous, view, outgoingBeatIndex, options.playback === true ? 'playback' : 'guided');+ syncStoryControlsDisabled();+ render();+ if (options.updateUrl !== false) updateUrl(view);+ return true;+ }++ function activateById(id, options) {+ var index = views.findIndex(function (view) { return view.id === id; });+ return index >= 0 && activate(index, options);+ }++ prev.addEventListener('click', function () { activate(activeIndex - 1); });+ next.addEventListener('click', function () { activate(activeIndex + 1); });+ all.addEventListener('click', function () { showAll(); });+ play.addEventListener('click', togglePlayback);+ beatLink.addEventListener('click', copyStoryMomentLink);+ trail.addEventListener('focusin', function (event) {+ if (!event.target.closest('[data-story-node]')) return;+ if (playing) pausePlayback();+ });+ trail.addEventListener('click', function (event) {+ var stop = event.target.closest('[data-story-node]');+ if (!stop || stop.disabled) return;+ selectStoryBeat(Number(stop.getAttribute('data-story-index')));+ });+ trail.addEventListener('keydown', function (event) {+ if (event.key !== 'Enter' && event.key !== ' ') return;+ var stop = event.target.closest('[data-story-node]');+ if (!stop || stop.disabled) return;+ event.preventDefault();+ selectStoryBeat(Number(stop.getAttribute('data-story-index')));+ });+ chapterList.addEventListener('click', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button) return;+ activateById(button.getAttribute('data-guided-view-id'));+ });+ chapterList.addEventListener('pointerover', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button || !hoverCapable() || event.pointerType === 'touch') return;+ if (event.relatedTarget && button.contains(event.relatedTarget)) return;+ setChapterPreviewIntent('pointer', chapterButtons.indexOf(button));+ });+ chapterList.addEventListener('pointerout', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ clearChapterPreviewIntent('pointer', chapterButtons.indexOf(button));+ });+ chapterIndex.addEventListener('focusin', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button) return;+ setChapterPreviewIntent('focus', chapterButtons.indexOf(button));+ });+ chapterIndex.addEventListener('focusout', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ clearChapterPreviewIntent('focus', chapterButtons.indexOf(button));+ });+ chapterList.addEventListener('keydown', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ var index = chapterButtons.indexOf(button);+ if (index < 0) return;+ var target = null;+ if (event.key === 'ArrowRight') target = Math.min(chapterButtons.length - 1, index + 1);+ else if (event.key === 'ArrowLeft') target = Math.max(0, index - 1);+ else if (event.key === 'Home') target = 0;+ else if (event.key === 'End') target = chapterButtons.length - 1;+ if (target === null) return;+ event.preventDefault();+ focusChapterButton(target);+ });++ // A direct node exploration supersedes the curated view. Capture phase+ // releases the view before the focus explorer writes its own deep link.+ function releaseForNode(event) {+ if (activeIndex >= 0 && event.target.closest('[data-node-id]')) {+ pausePlayback();+ showAll({ clearFocus: false, updateUrl: false });+ }+ }+ svg.addEventListener('click', releaseForNode, true);+ svg.addEventListener('keydown', function (event) {+ if (event.key === 'Enter' || event.key === ' ') releaseForNode(event);+ }, true);++ document.addEventListener('keydown', function (event) {+ if (event.metaKey || event.ctrlKey || event.altKey) return;+ if (document.documentElement.getAttribute('data-guide-open') === 'true') return;+ var target = event.target;+ if (target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable)) return;+ if (event.key === ']') {+ event.preventDefault();+ if (activeIndex < views.length - 1) activate(activeIndex + 1);+ } else if (event.key === '[') {+ event.preventDefault();+ if (activeIndex >= 0) activate(activeIndex - 1);+ } else if (event.key.toLowerCase() === 'p') {+ event.preventDefault();+ togglePlayback();+ } else if (event.key === 'Escape' && activePreviewIndex >= 0) {+ event.preventDefault();+ event.stopImmediatePropagation();+ clearChapterPreview({ clearIntents: true });+ } else if (event.key === 'Escape' && activeIndex >= 0) {+ event.preventDefault();+ showAll();+ }+ }, true);++ function syncViewFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var initial = params.get('view');+ var requestedBeat = params.get('beat');+ var restoreGeneration = ++momentRestoreGeneration;+ if (initial) {+ var activated = activateById(initial, { updateUrl: false, restore: true });+ if (!activated) {+ showAll({ updateUrl: false, restore: true });+ return;+ }+ if (requestedBeat) afterHandoff(function () {+ if (restoreGeneration !== momentRestoreGeneration) return;+ var latest = new URLSearchParams(location.hash.replace(/^#/, ''));+ if (latest.get('view') !== initial || latest.get('beat') !== requestedBeat) return;+ if (activeIndex < 0 || views[activeIndex].id !== initial) return;+ selectStoryBeatById(requestedBeat, { linked: true, follow: true, followInstant: true });+ });+ } else if (params.get('focus') || params.get('relation')) {+ activeIndex = -1;+ render();+ } else {+ showAll({ updateUrl: false, restore: true });+ }+ } catch (_) { showAll({ updateUrl: false, restore: true }); }+ }++ window.addEventListener('hashchange', syncViewFromHash);+ document.addEventListener('visibilitychange', function () {+ if (document.hidden) {+ clearChapterPreview({ clearIntents: true });+ if (playing) pausePlayback();+ else clearStoryPulse();+ settleHandoff('hidden');+ }+ else if (!document.hidden) maybeStartSharePlayback();+ });+ if (window.matchMedia) {+ var guidedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');+ var onGuidedMotionChange = function () {+ if (guidedMotionQuery.matches) {+ if (playing) pausePlayback();+ else clearStoryPulse();+ settleHandoff('reduced-motion');+ }+ };+ if (typeof guidedMotionQuery.addEventListener === 'function') guidedMotionQuery.addEventListener('change', onGuidedMotionChange);+ else if (typeof guidedMotionQuery.addListener === 'function') guidedMotionQuery.addListener(onGuidedMotionChange);+ }+ if (document.documentElement.getAttribute('data-embed') !== 'true' && typeof MutationObserver !== 'undefined' && typeof Node !== 'undefined' && svg instanceof Node && document.documentElement instanceof Node) {+ var chapterPreviewOwnerObserver = new MutationObserver(syncChapterPreview);+ chapterPreviewOwnerObserver.observe(svg, {+ attributes: true,+ attributeFilter: [+ 'data-route-picking', 'data-route-active', 'data-lens-active',+ 'data-legend-preview-active', 'data-relationship-preview-active',+ 'data-intent-trace-active', 'data-focus-active'+ ]+ });+ var storyMotionObserver = new MutationObserver(function () {+ if (document.documentElement.getAttribute('data-motion') !== 'live') clearStoryPulse();+ renderPlayback();+ });+ storyMotionObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['data-motion'] });+ }+ window.addEventListener('beforeprint', function () {+ clearChapterPreview({ clearIntents: true });+ if (playing) pausePlayback();+ else clearStoryPulse();+ settleHandoff('print');+ });+ syncViewFromHash();+ if (autoplayPending) {+ requestAnimationFrame(function () {+ requestAnimationFrame(maybeStartSharePlayback);+ });+ }++ return {+ count: views.length,+ activate: activateById,+ showAll: showAll,+ play: startPlayback,+ playCurrent: startCurrentViewPlayback,+ pause: pausePlayback,+ beatLink: storyMomentLink,+ copyBeatLink: copyStoryMomentLink,+ cancelHandoff: cancelHandoff,+ settleHandoff: settleHandoff,+ clearPreview: function () { return clearChapterPreview({ clearIntents: true }); },+ isPlaying: function () { return playing; },+ handoff: function () {+ return currentHandoff ? { id: currentHandoff.id, mode: currentHandoff.mode, anchor: currentHandoff.anchor || null } : null;+ },+ active: function () { return activeIndex < 0 ? null : views[activeIndex].id; },+ preview: function () { return activePreviewIndex < 0 ? null : views[activePreviewIndex].id; },+ delta: function (id) {+ var index = views.findIndex(function (view) { return view.id === id; });+ if (index < 0) return null;+ var value = chapterDelta(activeIndex >= 0 ? views[activeIndex] : null, views[index]);+ return { stay: value.stay.slice(), enter: value.enter.slice(), leave: value.leave.slice() };+ },+ beat: function () {+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ return step ? {+ index: step.index,+ position: step.index + 1,+ total: storySteps.length,+ nodeId: step.nodeId,+ relation: step.relation,+ edgeKeys: step.edgeKeys.slice()+ } : null;+ },+ focus: function () { return activeIndex < 0 ? [] : views[activeIndex].focus.slice(); }+ };+ })();++ Archify.view = (function () {+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector('svg');+ var outBtn = container.querySelector('[data-view="out"]');+ var resetBtn = container.querySelector('[data-view="reset"]');+ var inBtn = container.querySelector('[data-view="in"]');+ var state = { scale: 1, x: 0, y: 0, mode: 'overview' };+ var drag = null;+ var cameraTimer = null;+ var cameraFrame = null;+ var cameraGeneration = 0;+ var cameraTransaction = null;+ var resizeFrame = 0;+ var autoScrollUntil = 0;++ var viewBox = svg.viewBox && svg.viewBox.baseVal;+ if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {+ container.setAttribute('data-wide-diagram', 'true');+ }++ function clamp() {+ var width = svg.clientWidth || 1;+ var height = svg.clientHeight || 1;+ state.x = Math.min(0, Math.max(width - width * state.scale, state.x));+ state.y = Math.min(0, Math.max(height - height * state.scale, state.y));+ }+ function reducedMotion() {+ return window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;+ }+ function contentMetrics() {+ if (!viewBox || viewBox.width <= 0 || viewBox.height <= 0) return null;+ var width = svg.clientWidth || 1;+ var height = svg.clientHeight || 1;+ var scale = Math.min(width / viewBox.width, height / viewBox.height);+ return {+ width: width,+ height: height,+ scale: scale,+ offsetX: (width - viewBox.width * scale) / 2,+ offsetY: (height - viewBox.height * scale) / 2+ };+ }+ function logicalViewport() {+ var metrics = contentMetrics();+ if (!metrics) return null;+ var x;+ var y;+ var width;+ var height;+ if (window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram')) {+ x = viewBox.x + container.scrollLeft / metrics.scale;+ y = viewBox.y;+ width = Math.min(viewBox.width, Math.max(1, container.clientWidth / metrics.scale));+ height = viewBox.height;+ } else {+ x = viewBox.x + ((-state.x / state.scale) - metrics.offsetX) / metrics.scale;+ y = viewBox.y + ((-state.y / state.scale) - metrics.offsetY) / metrics.scale;+ width = Math.min(viewBox.width, metrics.width / state.scale / metrics.scale);+ height = Math.min(viewBox.height, metrics.height / state.scale / metrics.scale);+ }+ width = Math.max(1, Math.min(viewBox.width, width));+ height = Math.max(1, Math.min(viewBox.height, height));+ x = Math.max(viewBox.x, Math.min(viewBox.x + viewBox.width - width, x));+ y = Math.max(viewBox.y, Math.min(viewBox.y + viewBox.height - height, y));+ return { x: x, y: y, width: width, height: height, scale: state.scale };+ }+ function detailLevel() {+ if (state.mode === 'semantic') return 'full';+ if (state.scale >= 1.75) return 'full';+ if (state.scale >= 1.25) return 'read';+ return 'map';+ }+ function renderControls() {+ var semantic = state.mode === 'semantic' && state.scale > 1.01;+ var detail = detailLevel();+ var percent = Math.round(state.scale * 100) + '%';+ var levelLabel = detail === 'map' ? 'MAP ' : detail === 'read' ? 'READ ' : 'FULL ';+ var detailHint = detail === 'map'+ ? 'Zoom in to reveal relationship labels and node context'+ : detail === 'read'+ ? 'Zoom in again to reveal tags and annotations'+ : 'Full diagram detail';+ resetBtn.textContent = (semantic ? 'AUTO ' : levelLabel) + percent;+ resetBtn.title = (semantic ? 'Semantic camera active · ' : '') + detailHint + ' · reset view (0)';+ resetBtn.setAttribute('aria-label', detailHint + '. Reset diagram view');+ resetBtn.setAttribute('data-detail-level', detail);+ container.setAttribute('data-detail-level', detail);+ container.setAttribute('data-camera-mode', state.mode);+ container.setAttribute('data-camera-indicator', semantic ? 'true' : 'false');+ }+ function apply() {+ clamp();+ svg.style.transform = 'translate(' + state.x + 'px,' + state.y + 'px) scale(' + state.scale + ')';+ renderControls();+ outBtn.disabled = state.scale <= 1;+ inBtn.disabled = state.scale >= 3;+ container.classList.toggle('is-pannable', state.scale > 1);+ svg.setAttribute('data-view-scale', String(state.scale));+ if (Archify.radar && typeof Archify.radar.sync === 'function') Archify.radar.sync();+ }+ function sampleRenderedState() {+ var transform = '';+ try { transform = getComputedStyle(svg).transform || ''; } catch (_) {}+ var match = transform.match(/^matrix\(([^)]+)\)$/);+ if (!match) return { scale: state.scale, x: state.x, y: state.y, mode: state.mode };+ var values = match[1].split(',').map(Number);+ if (values.length !== 6 || !values.every(Number.isFinite)) {+ return { scale: state.scale, x: state.x, y: state.y, mode: state.mode };+ }+ return { scale: values[0], x: values[4], y: values[5], mode: state.mode };+ }+ function finishCameraTransaction(transaction, outcome) {+ if (!transaction || transaction.settled) return false;+ transaction.settled = true;+ transaction.state = outcome || 'complete';+ if (transaction.frame) cancelAnimationFrame(transaction.frame);+ if (transaction.timer) clearTimeout(transaction.timer);+ transaction.frame = null;+ transaction.timer = null;+ if (cameraTransaction === transaction) cameraTransaction = null;+ cameraFrame = null;+ cameraTimer = null;+ container.classList.remove('is-camera-moving');+ container.classList.remove('is-camera-transaction');+ container.removeAttribute('data-camera-transaction');+ if (Archify.focus && Archify.focus.reposition) Archify.focus.reposition();+ transaction.resolve({ id: transaction.id, state: transaction.state });+ return true;+ }+ function cameraReceipt(target, options) {+ var resolver;+ var transaction = {+ id: ++cameraGeneration,+ state: 'running',+ target: target,+ settled: false,+ frame: null,+ timer: null,+ finished: new Promise(function (resolve) { resolver = resolve; }),+ resolve: resolver,+ cancel: function (reason, commitTarget) {+ if (transaction.settled) return false;+ if (commitTarget && transaction.target) {+ if (Object.prototype.hasOwnProperty.call(transaction.target, 'scrollLeft')) {+ container.scrollLeft = transaction.target.scrollLeft;+ } else {+ state = {+ scale: transaction.target.scale,+ x: transaction.target.x,+ y: transaction.target.y,+ mode: transaction.target.mode+ };+ apply();+ }+ }+ return finishCameraTransaction(transaction, reason || 'cancelled');+ }+ };+ return transaction;+ }+ function stopCameraMotion(reason, commitTarget) {+ if (cameraTransaction && !cameraTransaction.settled) {+ cameraTransaction.cancel(reason || 'cancelled', commitTarget === true);+ return;+ }+ if (cameraTimer) clearTimeout(cameraTimer);+ if (cameraFrame) cancelAnimationFrame(cameraFrame);+ cameraTimer = null;+ cameraFrame = null;+ container.classList.remove('is-camera-moving');+ container.classList.remove('is-camera-transaction');+ container.removeAttribute('data-camera-transaction');+ }+ function interruptCamera(reason) {+ if (Archify.guidedViews && Archify.guidedViews.cancelHandoff) {+ Archify.guidedViews.cancelHandoff(reason || 'manual');+ }+ var rendered = sampleRenderedState();+ stopCameraMotion(reason || 'manual', false);+ state = rendered;+ state.mode = 'manual';+ apply();+ renderControls();+ if (Archify.guidedViews && Archify.guidedViews.isPlaying && Archify.guidedViews.isPlaying()) {+ Archify.guidedViews.pause();+ }+ if (Archify.routeProbe && Archify.routeProbe.isJourneyPlaying && Archify.routeProbe.isJourneyPlaying()) {+ Archify.routeProbe.pauseJourney({ preserveElapsed: true, reason: reason || 'manual' });+ }+ }+ function zoom(next, options) {+ options = options || {};+ if (options.manual !== false) interruptCamera();+ var previous = state.scale;+ next = Math.max(1, Math.min(3, Math.round(next * 4) / 4));+ if (next === previous) return;+ var centerX = (svg.clientWidth || 1) / 2;+ var centerY = (svg.clientHeight || 1) / 2;+ var contentX = (centerX - state.x) / previous;+ var contentY = (centerY - state.y) / previous;+ state.scale = next;+ state.x = centerX - contentX * next;+ state.y = centerY - contentY * next;+ apply();+ }+ function reset(options) {+ options = options || {};+ if (options.automatic !== true) interruptCamera();+ else stopCameraMotion('reset', false);+ state = { scale: 1, x: 0, y: 0, mode: 'overview' };+ apply();+ }+ function centerAt(logicalX, logicalY, options) {+ options = options || {};+ logicalX = Number(logicalX);+ logicalY = Number(logicalY);+ var metrics = contentMetrics();+ if (!metrics || !Number.isFinite(logicalX) || !Number.isFinite(logicalY)) return false;+ interruptCamera();+ if (window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram')) {+ state.scale = 1;+ state.x = 0;+ state.y = 0;+ state.mode = 'manual';+ apply();+ var mobileTarget = (logicalX - viewBox.x) * metrics.scale - container.clientWidth / 2;+ mobileTarget = Math.max(0, Math.min(svg.clientWidth - container.clientWidth, mobileTarget));+ autoScrollUntil = Date.now() + 80;+ try { container.scrollTo({ left: mobileTarget, behavior: options.instant ? 'auto' : 'smooth' }); }+ catch (_) { container.scrollLeft = mobileTarget; }+ return true;+ }+ var minimumScale = Math.max(1, Math.min(3, Number(options.minimumScale) || 1));+ var requestedScale = Number(options.scale);+ state.scale = Math.max(minimumScale, Math.min(3, Number.isFinite(requestedScale) ? requestedScale : state.scale));+ var contentX = metrics.offsetX + (logicalX - viewBox.x) * metrics.scale;+ var contentY = metrics.offsetY + (logicalY - viewBox.y) * metrics.scale;+ state.x = metrics.width / 2 - contentX * state.scale;+ state.y = metrics.height / 2 - contentY * state.scale;+ state.mode = 'manual';+ apply();+ if (Archify.focus && Archify.focus.reposition) Archify.focus.reposition();+ return true;+ }+ function semanticIds(ids, includeNeighbors) {+ var seeds = {};+ var wanted = {};+ (ids || []).forEach(function (id) { seeds[id] = true; wanted[id] = true; });+ if (includeNeighbors) {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (seeds[from] || seeds[to]) { wanted[from] = true; wanted[to] = true; }+ });+ }+ return wanted;+ }+ function boxesFor(ids, includeNeighbors) {+ var wanted = semanticIds(ids, includeNeighbors);+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'))+ .filter(function (node) { return wanted[node.getAttribute('data-node-id')]; })+ .map(function (node) {+ try { return node.getBBox(); } catch (_) { return null; }+ })+ .filter(Boolean);+ }+ function frameDesktop(ids, options) {+ options = options || {};+ var boxes = boxesFor(ids, options.includeNeighbors === true);+ if (!boxes.length || !viewBox || viewBox.width <= 0 || viewBox.height <= 0) return false;+ var svgWidth = svg.clientWidth || 1;+ var svgHeight = svg.clientHeight || 1;+ var contentScale = Math.min(svgWidth / viewBox.width, svgHeight / viewBox.height);+ var contentOffsetX = (svgWidth - viewBox.width * contentScale) / 2;+ var contentOffsetY = (svgHeight - viewBox.height * contentScale) / 2;+ var minX = Math.min.apply(Math, boxes.map(function (box) { return box.x; }));+ var minY = Math.min.apply(Math, boxes.map(function (box) { return box.y; }));+ var maxX = Math.max.apply(Math, boxes.map(function (box) { return box.x + box.width; }));+ var maxY = Math.max.apply(Math, boxes.map(function (box) { return box.y + box.height; }));+ var bounds = {+ x: contentOffsetX + minX * contentScale,+ y: contentOffsetY + minY * contentScale,+ width: Math.max(1, (maxX - minX) * contentScale),+ height: Math.max(1, (maxY - minY) * contentScale)+ };+ var padding = options.padding || 48;+ var left = padding;+ var right = svgWidth - padding;+ var top = padding;+ var bottom = svgHeight - Math.max(padding, 72);+ var containerRect = container.getBoundingClientRect();+ var visibleTop = Math.max(0, -containerRect.top);+ var visibleBottom = Math.min(svgHeight, window.innerHeight - containerRect.top);+ if (visibleBottom - visibleTop >= 240) {+ top = Math.max(top, visibleTop + padding);+ bottom = Math.min(bottom, visibleBottom - Math.max(padding, 72));+ }+ var chip = document.getElementById('focus-chip');+ if (chip && !chip.hidden) {+ var lensEnd = chip.offsetLeft + chip.offsetWidth + 24 - (svg.offsetLeft || 0);+ left = Math.max(left, Math.min(svgWidth * 0.42, lensEnd));+ }+ var routeReceipt = document.getElementById('route-probe');+ if (routeReceipt && !routeReceipt.hidden && routeReceipt.hasAttribute('data-route-journey')) {+ var receiptTop = routeReceipt.offsetTop;+ var receiptBottom = receiptTop + routeReceipt.offsetHeight;+ if (receiptTop < svgHeight / 2) top = Math.max(top, receiptBottom + 24);+ else bottom = Math.min(bottom, receiptTop - 24);+ }+ if (right <= left || bottom <= top) return false;+ var maxScale = options.maxScale || (options.includeNeighbors ? 1.9 : 2.15);+ var targetScale = Math.min((right - left) / bounds.width, (bottom - top) / bounds.height) * 0.9;+ targetScale = Math.max(1, Math.min(maxScale, targetScale));+ if (targetScale < 1.08) targetScale = 1;+ var target = {+ scale: Math.round(targetScale * 100) / 100,+ x: 0,+ y: 0,+ mode: 'semantic'+ };+ target.x = (left + right) / 2 - (bounds.x + bounds.width / 2) * target.scale;+ target.y = (top + bottom) / 2 - (bounds.y + bounds.height / 2) * target.scale;+ var start = sampleRenderedState();+ stopCameraMotion('replaced', false);+ var transaction = cameraReceipt(target, options);+ cameraTransaction = transaction;+ var instant = options.instant === true || reducedMotion() || document.hidden;+ if (instant) {+ state = target;+ apply();+ finishCameraTransaction(transaction, reducedMotion() ? 'reduced-motion' : (document.hidden ? 'hidden' : 'complete'));+ return transaction;+ }+ var duration = Math.max(180, Math.min(520, Number(options.duration) || 420));+ var startedAt = 0;+ state = start;+ state.mode = 'semantic';+ apply();+ container.classList.add('is-camera-moving');+ container.classList.add('is-camera-transaction');+ container.setAttribute('data-camera-transaction', String(transaction.id));+ var step = function (timestamp) {+ if (cameraTransaction !== transaction || transaction.settled) return;+ if (!startedAt) startedAt = timestamp;+ var fraction = Math.max(0, Math.min(1, (timestamp - startedAt) / duration));+ var eased = 1 - Math.pow(1 - fraction, 3);+ state = {+ scale: start.scale + (target.scale - start.scale) * eased,+ x: start.x + (target.x - start.x) * eased,+ y: start.y + (target.y - start.y) * eased,+ mode: 'semantic'+ };+ apply();+ if (fraction < 1) {+ transaction.frame = requestAnimationFrame(step);+ cameraFrame = transaction.frame;+ } else {+ state = target;+ apply();+ finishCameraTransaction(transaction, 'complete');+ }+ };+ transaction.frame = requestAnimationFrame(step);+ cameraFrame = transaction.frame;+ return transaction;+ }+ function reveal(ids, options) {+ options = options || {};+ if (window.innerWidth > 720) return frameDesktop(ids, options);+ stopCameraMotion('replaced', false);+ state.scale = 1;+ state.x = 0;+ state.y = 0;+ state.mode = 'semantic';+ apply();+ if (!container.hasAttribute('data-wide-diagram')) {+ var contained = cameraReceipt({ scale: 1, x: 0, y: 0, mode: 'semantic' }, options);+ cameraTransaction = contained;+ finishCameraTransaction(contained, 'complete');+ return contained;+ }+ var boxes = boxesFor(ids, options.includeNeighbors === true);+ if (!boxes.length || !viewBox || viewBox.width <= 0) return false;+ var minX = Math.min.apply(Math, boxes.map(function (box) { return box.x; }));+ var maxX = Math.max.apply(Math, boxes.map(function (box) { return box.x + box.width; }));+ var center = ((minX + maxX) / 2 / viewBox.width) * (svg.clientWidth || 1);+ var target = Math.max(0, Math.min(svg.clientWidth - container.clientWidth, center - container.clientWidth / 2));+ var transaction = cameraReceipt({ scrollLeft: target }, options);+ cameraTransaction = transaction;+ var instant = options.instant === true || reducedMotion() || document.hidden;+ autoScrollUntil = Date.now() + (instant ? 50 : 470);+ try { container.scrollTo({ left: target, behavior: instant ? 'auto' : 'smooth' }); }+ catch (_) { container.scrollLeft = target; }+ if (instant) finishCameraTransaction(transaction, reducedMotion() ? 'reduced-motion' : (document.hidden ? 'hidden' : 'complete'));+ else {+ transaction.timer = setTimeout(function () { finishCameraTransaction(transaction, 'complete'); }, 460);+ cameraTimer = transaction.timer;+ container.classList.add('is-camera-moving');+ container.setAttribute('data-camera-transaction', String(transaction.id));+ }+ return transaction;+ }+ function syncSemantic() {+ var guided = Archify.guidedViews && typeof Archify.guidedViews.focus === 'function'+ ? Archify.guidedViews.focus() : [];+ if (guided && guided.length) return reveal(guided, { reason: 'guided-sync' });+ var active = Archify.focus && typeof Archify.focus.active === 'function' ? Archify.focus.active() : null;+ if (typeof active === 'string') return reveal([active], { includeNeighbors: true, reason: 'focus-sync' });+ if (Array.isArray(active) && active.length) return reveal(active, { reason: 'selection-sync' });+ return false;+ }+ function pinControls() {+ container.style.setProperty('--archify-scroll-x', container.scrollLeft + 'px');+ }+ function onScroll() {+ pinControls();+ if (Archify.radar && typeof Archify.radar.sync === 'function') Archify.radar.sync();+ if (window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram') && Date.now() > autoScrollUntil) {+ interruptCamera();+ }+ }+ function onPointerEnd(event) {+ if (!drag) return;+ var moved = drag.moved;+ drag = null;+ container.classList.remove('is-panning');+ try { container.releasePointerCapture(event.pointerId); } catch (_) {}+ if (moved) {+ container.setAttribute('data-just-panned', 'true');+ setTimeout(function () { container.removeAttribute('data-just-panned'); }, 80);+ }+ }++ inBtn.addEventListener('click', function () { zoom(state.scale + 0.25); });+ outBtn.addEventListener('click', function () { zoom(state.scale - 0.25); });+ resetBtn.addEventListener('click', reset);+ container.addEventListener('pointerdown', function (event) {+ if (state.scale <= 1 || event.button !== 0 || event.target.closest('.diagram-nav, .focus-chip, .node-finder, .diagram-guide, .overview-map, .route-probe, .semantic-lens') || event.target.closest('[data-node-id]') || event.target.closest('[data-relationship-hit-key]')) return;+ interruptCamera();+ drag = { startX: event.clientX, startY: event.clientY, x: state.x, y: state.y, moved: false };+ container.classList.add('is-panning');+ try { container.setPointerCapture(event.pointerId); } catch (_) {}+ });+ container.addEventListener('pointermove', function (event) {+ if (!drag) return;+ var dx = event.clientX - drag.startX;+ var dy = event.clientY - drag.startY;+ if (Math.abs(dx) + Math.abs(dy) > 3) drag.moved = true;+ state.x = drag.x + dx;+ state.y = drag.y + dy;+ apply();+ });+ container.addEventListener('pointerup', onPointerEnd);+ container.addEventListener('pointercancel', onPointerEnd);+ container.addEventListener('scroll', onScroll, { passive: true });+ window.addEventListener('resize', function () {+ if (resizeFrame) cancelAnimationFrame(resizeFrame);+ resizeFrame = requestAnimationFrame(function () {+ resizeFrame = 0;+ if (state.mode === 'semantic') syncSemantic();+ else apply();+ });+ });+ window.addEventListener('hashchange', function () { requestAnimationFrame(syncSemantic); });+ apply();+ pinControls();+ requestAnimationFrame(syncSemantic);++ return {+ zoomIn: function () { zoom(state.scale + 0.25); },+ zoomOut: function () { zoom(state.scale - 0.25); },+ reset: reset,+ reveal: reveal,+ centerAt: centerAt,+ logicalViewport: logicalViewport,+ sync: syncSemantic,+ state: function () { return { scale: state.scale, x: state.x, y: state.y, mode: state.mode }; }+ };+ })();++ /* ============================================================+ Semantic Radar — simplified semantic bounds + live viewport.+ The radar is built at runtime so the checked artifact still contains+ one canonical SVG block, and export serialization remains untouched.+ ============================================================ */+ Archify.radar = (function () {+ var container = document.querySelector('.diagram-container');+ var diagram = container.querySelector(':scope > svg');+ var panel = document.getElementById('overview-map');+ var surface = document.getElementById('overview-map-surface');+ var status = document.getElementById('overview-map-status');+ var trigger = document.getElementById('btn-overview-map');+ var closeBtn = document.getElementById('overview-map-close');+ var namespace = 'http://www.w3.org/2000/svg';+ var viewBox = diagram.viewBox && diagram.viewBox.baseVal;+ var mapSvg = document.createElementNS(namespace, 'svg');+ var nodeLayer = document.createElementNS(namespace, 'g');+ var viewport = document.createElementNS(namespace, 'rect');+ var nodes = [];+ var drag = null;+ var syncFrame = 0;++ mapSvg.setAttribute('role', 'group');+ mapSvg.setAttribute('aria-label', 'Semantic diagram radar nodes');+ mapSvg.setAttribute('preserveAspectRatio', 'xMidYMid meet');+ nodeLayer.setAttribute('class', 'overview-map-nodes');+ viewport.setAttribute('class', 'overview-map-viewport');+ viewport.setAttribute('rx', '3');+ viewport.setAttribute('ry', '3');+ mapSvg.appendChild(nodeLayer);+ mapSvg.appendChild(viewport);+ surface.appendChild(mapSvg);++ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];+ }+ function build() {+ if (!viewBox || viewBox.width <= 0 || viewBox.height <= 0) return false;+ mapSvg.setAttribute('viewBox', [viewBox.x, viewBox.y, viewBox.width, viewBox.height].join(' '));+ nodeLayer.textContent = '';+ nodes = [];+ Array.prototype.forEach.call(diagram.querySelectorAll('[data-node-id]'), function (node) {+ var box;+ try { box = node.getBBox(); } catch (_) { box = null; }+ if (!box || box.width <= 0 || box.height <= 0) return;+ var id = node.getAttribute('data-node-id');+ var rect = document.createElementNS(namespace, 'rect');+ rect.setAttribute('class', 'overview-map-node');+ rect.setAttribute('x', String(box.x));+ rect.setAttribute('y', String(box.y));+ rect.setAttribute('width', String(Math.max(3, box.width)));+ rect.setAttribute('height', String(Math.max(3, box.height)));+ rect.setAttribute('rx', String(Math.max(2, Math.min(8, Math.min(box.width, box.height) * 0.1))));+ rect.setAttribute('data-radar-node-id', id);+ rect.setAttribute('data-kind', node.getAttribute('data-node-kind') || 'neutral');+ rect.setAttribute('tabindex', '0');+ rect.setAttribute('role', 'button');+ rect.setAttribute('aria-label', 'Focus ' + nodeLabel(node, id) + ' from Semantic Radar');+ nodeLayer.appendChild(rect);+ nodes.push({ id: id, node: node, rect: rect });+ });+ status.textContent = nodes.length + ' nodes · full map';+ return true;+ }+ function updateDocking() {+ if (panel.hidden) return;+ var containerRect = container.getBoundingClientRect();+ var intersectsWindow = containerRect.bottom > 12 && containerRect.top < window.innerHeight - 12;+ if (!intersectsWindow) {+ panel.removeAttribute('data-docked');+ panel.removeAttribute('data-dock-side');+ panel.style.removeProperty('--archify-radar-right');+ panel.style.removeProperty('--archify-radar-left');+ panel.style.removeProperty('--archify-radar-top');+ return;+ }+ var active = diagram.querySelector('[data-focus-selected]');+ var activeRect = active ? active.getBoundingClientRect() : null;+ var dockLeft = !!(activeRect && activeRect.left + activeRect.width / 2 > window.innerWidth / 2);+ var right = Math.max(16, window.innerWidth - Math.min(containerRect.right - 16, window.innerWidth - 16));+ var left = Math.max(16, Math.min(containerRect.left + 16, window.innerWidth - panel.offsetWidth - 16));+ var topLimit = Math.max(16, containerRect.top + 16);+ var bottomLimit = Math.min(window.innerHeight - 16, containerRect.bottom - 16);+ var panelLeft = dockLeft ? left : window.innerWidth - right - panel.offsetWidth;+ var panelRight = panelLeft + panel.offsetWidth;+ var lens = document.getElementById('focus-chip');+ var lensRect = lens && !lens.hidden ? lens.getBoundingClientRect() : null;+ var blockers = [activeRect, lensRect].filter(function (rect) {+ return rect && rect.right > panelLeft && rect.left < panelRight;+ });+ var desiredTop = bottomLimit - panel.offsetHeight;+ var candidates = [desiredTop, topLimit];+ blockers.forEach(function (rect) {+ candidates.push(rect.top - 10 - panel.offsetHeight, rect.bottom + 10);+ });+ var valid = candidates.filter(function (candidate) {+ if (candidate < topLimit || candidate + panel.offsetHeight > bottomLimit) return false;+ return blockers.every(function (rect) {+ return candidate + panel.offsetHeight <= rect.top - 10 || candidate >= rect.bottom + 10;+ });+ });+ valid.sort(function (a, b) { return Math.abs(a - desiredTop) - Math.abs(b - desiredTop); });+ var top = valid.length ? valid[0] : Math.max(topLimit, desiredTop);+ top = Math.min(window.innerHeight - panel.offsetHeight - 16, top);+ panel.setAttribute('data-docked', 'true');+ panel.setAttribute('data-dock-side', dockLeft ? 'left' : 'right');+ panel.style.setProperty('--archify-radar-right', Math.round(right) + 'px');+ panel.style.setProperty('--archify-radar-left', Math.round(left) + 'px');+ panel.style.setProperty('--archify-radar-top', Math.round(Math.max(16, top)) + 'px');+ }+ function syncNow() {+ syncFrame = 0;+ if (panel.hidden || !Archify.view || typeof Archify.view.logicalViewport !== 'function') return;+ updateDocking();+ var visible = Archify.view.logicalViewport();+ if (!visible) return;+ viewport.setAttribute('x', String(visible.x));+ viewport.setAttribute('y', String(visible.y));+ viewport.setAttribute('width', String(visible.width));+ viewport.setAttribute('height', String(visible.height));+ var full = visible.width >= viewBox.width * 0.98 && visible.height >= viewBox.height * 0.98;+ var mobileWide = window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram');+ var viewportCopy = full+ ? 'full map'+ : (mobileWide ? Math.round(visible.width / viewBox.width * 100) + '% width' : Math.round(visible.scale * 100) + '% viewport');+ status.textContent = nodes.length + ' nodes · ' + viewportCopy;+ nodes.forEach(function (item) {+ var active = item.node.hasAttribute('data-focus-selected') ||+ item.node.getAttribute('data-story-beat-state') === 'active';+ if (active) item.rect.setAttribute('data-radar-active', 'true');+ else item.rect.removeAttribute('data-radar-active');+ });+ }+ function sync() {+ if (syncFrame) return;+ syncFrame = requestAnimationFrame(syncNow);+ }+ function setOpen(next, options) {+ options = options || {};+ next = Boolean(next);+ if (next && Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (next && Archify.semanticLens && Archify.semanticLens.isOpen()) {+ Archify.semanticLens.close({ restoreFocus: false });+ }+ panel.hidden = !next;+ trigger.setAttribute('aria-expanded', next ? 'true' : 'false');+ trigger.setAttribute('aria-label', next ? 'Close semantic radar' : 'Open semantic radar');+ if (next) {+ build();+ updateDocking();+ sync();+ if (options.focus === true) surface.focus();+ } else {+ panel.removeAttribute('data-docked');+ panel.removeAttribute('data-dock-side');+ panel.style.removeProperty('--archify-radar-right');+ panel.style.removeProperty('--archify-radar-left');+ panel.style.removeProperty('--archify-radar-top');+ if (options.restoreFocus === true) trigger.focus();+ }+ return next;+ }+ function toggle() { return setOpen(panel.hidden, { focus: false }); }+ function close(options) { return setOpen(false, options); }+ function bringNodeIntoWindow(node) {+ var delay = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : 540;+ window.setTimeout(function () {+ var rect = node.getBoundingClientRect();+ var safeTop = 64;+ var safeBottom = window.innerHeight - 64;+ if (rect.top >= safeTop && rect.bottom <= safeBottom) return;+ var top = Math.max(0, window.scrollY + rect.top + rect.height / 2 - window.innerHeight / 2);+ try { window.scrollTo({ top: top, behavior: delay ? 'smooth' : 'auto' }); }+ catch (_) { window.scrollTo(0, top); }+ }, delay);+ }+ function focusNode(id) {+ var main = diagram.querySelector('[data-node-id="' + id + '"]');+ if (!main) return false;+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.focus && typeof Archify.focus.set === 'function') {+ Archify.focus.set(id, { toggle: false });+ }+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'radar' });+ }+ bringNodeIntoWindow(main);+ try { main.focus({ preventScroll: true }); } catch (_) { try { main.focus(); } catch (_) {} }+ sync();+ return true;+ }+ function diagramPoint(event) {+ var matrix = mapSvg.getScreenCTM();+ if (!matrix) return null;+ var point = mapSvg.createSVGPoint();+ point.x = event.clientX;+ point.y = event.clientY;+ return point.matrixTransform(matrix.inverse());+ }+ function navigate(event) {+ var point = diagramPoint(event);+ if (!point || !Archify.view || typeof Archify.view.centerAt !== 'function') return;+ Archify.view.centerAt(point.x, point.y, { minimumScale: 1.5, instant: true });+ sync();+ }+ function endDrag(event) {+ if (!drag) return;+ drag = null;+ panel.removeAttribute('data-dragging');+ container.classList.remove('is-panning');+ try { surface.releasePointerCapture(event.pointerId); } catch (_) {}+ }- <div class="card">- <div class="card-header">- <div class="card-dot rose"></div>- <h3>Local & privacy</h3>- </div>- <ul>- <li>• Sessions and credentials live under Electron userData</li>- <li>• Write/Bash and risky ops go through the permission engine</li>- <li>• Renderer never sees plaintext secrets — only masked status</li>- </ul>- </div>- </div>+ trigger.addEventListener('click', toggle);+ closeBtn.addEventListener('click', function () { close({ restoreFocus: true }); });+ surface.addEventListener('pointerdown', function (event) {+ if (event.button !== 0 || event.target.closest('[data-radar-node-id]')) return;+ event.preventDefault();+ drag = { pointerId: event.pointerId };+ panel.setAttribute('data-dragging', 'true');+ container.classList.add('is-panning');+ try { surface.setPointerCapture(event.pointerId); } catch (_) {}+ navigate(event);+ });+ surface.addEventListener('pointermove', function (event) {+ if (!drag || drag.pointerId !== event.pointerId) return;+ navigate(event);+ });+ surface.addEventListener('pointerup', endDrag);+ surface.addEventListener('pointercancel', endDrag);+ surface.addEventListener('click', function (event) {+ var node = event.target.closest('[data-radar-node-id]');+ if (node) focusNode(node.getAttribute('data-radar-node-id'));+ });+ surface.addEventListener('keydown', function (event) {+ if (event.key === 'Escape') {+ event.preventDefault();+ event.stopPropagation();+ close({ restoreFocus: true });+ return;+ }+ var node = event.target.closest('[data-radar-node-id]');+ if (node && (event.key === 'Enter' || event.key === ' ')) {+ event.preventDefault();+ focusNode(node.getAttribute('data-radar-node-id'));+ return;+ }+ if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight' && event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return;+ var visible = Archify.view && Archify.view.logicalViewport ? Archify.view.logicalViewport() : null;+ if (!visible) return;+ event.preventDefault();+ var x = visible.x + visible.width / 2;+ var y = visible.y + visible.height / 2;+ var stepX = Math.max(12, visible.width * 0.24);+ var stepY = Math.max(12, visible.height * 0.24);+ if (event.key === 'ArrowLeft') x -= stepX;+ else if (event.key === 'ArrowRight') x += stepX;+ else if (event.key === 'ArrowUp') y -= stepY;+ else y += stepY;+ Archify.view.centerAt(x, y, { minimumScale: 1.5, instant: true });+ sync();+ });+ window.addEventListener('resize', sync);+ window.addEventListener('scroll', function () { updateDocking(); sync(); }, { passive: true });+ requestAnimationFrame(build);- <!-- Footer -->- <p class="footer">- Architecture diagram • Built with Archify<span class="no-print"> • Press <kbd>T</kbd> for theme and <kbd>E</kbd> for export</span>- </p>- </div>+ return {+ open: function () { return setOpen(true); },+ close: close,+ toggle: toggle,+ sync: sync,+ focus: focusNode,+ isOpen: function () { return !panel.hidden; },+ count: function () { return nodes.length; }+ };+ })();- <script>/* ============================================================- Theme toggle — persists to localStorage, respects system pref+ Presentation Stage — a shareable, viewport-filling live view.+ It changes only HTML layout and URL state; SVG semantics and export+ serialization remain untouched. Escape first clears an active guided+ view/focus, then exits the stage.============================================================ */- var Archify = {};-- Archify.theme = (function () {- var STORAGE_KEY = 'archify-theme';+ Archify.presentation = (function () {var html = document.documentElement;- var btn = document.getElementById('btn-theme');- var icon = document.getElementById('theme-icon');- var label = document.getElementById('theme-label');+ var btn = document.getElementById('btn-present');+ var icon = document.getElementById('present-icon');+ var label = document.getElementById('present-label');+ var previousScrollY = 0;- // localStorage can throw (blocked cookies, sandboxed iframes); the whole- // script element dies on an uncaught error, so guard every access.- function readStored() {- try { return localStorage.getItem(STORAGE_KEY); } catch (_) { return null; }- }- function writeStored(value) {- try { localStorage.setItem(STORAGE_KEY, value); } catch (_) {}- }- function urlOverride() {- // URL param wins (useful for deterministic screenshots / share links)+ function active() { return html.getAttribute('data-present') === 'true'; }++ function updateUrl(next) {try {- var param = new URLSearchParams(window.location.search).get('theme');- if (param === 'light' || param === 'dark') return param;+ var url = new URL(window.location.href);+ if (next) url.searchParams.set('present', '1');+ else url.searchParams.delete('present');+ history.replaceState(null, '', url.pathname + url.search + url.hash);} catch (_) {}- return null;}- function resolveInitial() {- var fromUrl = urlOverride();- if (fromUrl) return fromUrl;- var saved = readStored();- if (saved === 'light' || saved === 'dark') return saved;- return window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';+ function render(next) {+ btn.setAttribute('aria-pressed', next ? 'true' : 'false');+ btn.setAttribute('aria-label', next ? 'Exit presentation stage' : 'Enter presentation stage');+ btn.title = next ? 'Exit presentation stage (F or Escape)' : 'Presentation stage (F)';+ icon.textContent = next ? '\u00d7' : '\u25a1';+ label.textContent = next ? 'Exit' : 'Present';}- function apply(theme) {- html.setAttribute('data-theme', theme);- icon.textContent = theme === 'dark' ? '\u263E' : '\u263C';- label.textContent = theme === 'dark' ? 'Dark' : 'Light';- btn.setAttribute('aria-pressed', theme === 'light' ? 'true' : 'false');+ function setActive(next, options) {+ options = options || {};+ next = Boolean(next);+ if (next === active()) {+ render(next);+ return next;+ }+ if (next) {+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ previousScrollY = window.scrollY || 0;+ html.setAttribute('data-present', 'true');+ try { window.scrollTo(0, 0); } catch (_) {}+ } else {+ html.removeAttribute('data-present');+ }+ render(next);+ if (options.updateUrl !== false) updateUrl(next);+ requestAnimationFrame(function () {+ if (Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ requestAnimationFrame(function () {+ if (Archify.view && typeof Archify.view.sync === 'function') Archify.view.sync();+ });+ }+ if (!next && previousScrollY) {+ try { window.scrollTo(0, previousScrollY); } catch (_) {}+ }+ });+ return next;}- function toggle() {- var next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';- apply(next);- writeStored(next);- }+ function toggle() { return setActive(!active()); }- apply(resolveInitial());+ render(active());btn.addEventListener('click', toggle);- // Follow live OS theme changes while the user has no explicit preference.- try {- var media = window.matchMedia('(prefers-color-scheme: light)');- var onChange = function (e) {- var saved = readStored();- if (urlOverride() || saved === 'light' || saved === 'dark') return;- apply(e.matches ? 'light' : 'dark');- };- if (media.addEventListener) media.addEventListener('change', onChange);- else if (media.addListener) media.addListener(onChange);- } catch (_) {}-- return { toggle: toggle };+ return {+ enter: function () { return setActive(true); },+ exit: function () { return setActive(false); },+ toggle: toggle,+ active: active+ };})();/* ============================================================- Export — PNG / JPEG / WebP / SVG (download) and Copy PNG (clipboard)-- Raster exports are always rendered at 4x source resolution for- maximum sharpness. The trick: we set the serialized SVG's- `width`/`height` to viewBox * 4 so the browser rasterizes the- vectors at that resolution natively. drawImage then draws at- the image's natural size (no upscaling = no blur).-- JPEG/WebP paint the current theme's background explicitly since- those formats have no alpha channel.+ Node Finder — stable-ID search over the existing semantic SVG.+ Search never changes the IR or SVG geometry: selecting a result resets+ the viewport, releases a guided view, and delegates to semantic focus.============================================================ */- (function () {- var RASTER_SCALE = 4;-- function diagramFilename() {- var title = (document.title || 'diagram')- .replace(/\s+Architecture(\s+Diagram)?$/i, '')- .replace(/\s+Diagram$/i, '')- .trim();- return title.replace(/[^a-z0-9_\-]+/gi, '-')- .toLowerCase()- .replace(/^-+|-+$/g, '') || 'diagram';- }+ Archify.finder = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector('svg');+ var trigger = document.getElementById('btn-node-finder');+ var panel = document.getElementById('node-finder');+ var heading = document.getElementById('node-finder-title');+ var closeBtn = document.getElementById('node-finder-close');+ var input = document.getElementById('node-finder-input');+ var results = document.getElementById('node-finder-results');+ var empty = document.getElementById('node-finder-empty');+ var status = document.getElementById('node-finder-status');+ var visibleItems = [];- function currentBg() {- return getComputedStyle(document.body).backgroundColor || '#ffffff';+ function defaultContext() {+ return {+ kind: 'focus',+ title: 'Find a node',+ placeholder: 'Search labels or IDs',+ empty: 'No matching nodes',+ resultsLabel: 'Diagram nodes',+ availableNoun: 'nodes',+ allowedIds: null,+ badges: null+ };}- /**- * Serialize the main SVG into a standalone document.- *- * Two modes:- * - Default (opts.autoTheme=false) — locks the serialized SVG to the- * viewer's current theme. Used by the raster pipeline- * (PNG/JPEG/WebP/clipboard) because canvas rasterization needs- * deterministic colors; a raster cannot react to- * prefers-color-scheme after encoding.- * - autoTheme=true — emits BOTH dark and light variable sets plus a- * `@media (prefers-color-scheme)` rule so the resulting SVG- * self-themes when embedded in GitHub READMEs or other hosts that- * expose a color scheme. Used for "Download SVG".- */- function serializeSvg(scale, opts) {- // scale: integer multiplier for intrinsic SVG pixel dimensions used by- // the raster path. Defaults to 1 (natural size) for SVG download.- scale = scale || 1;- opts = opts || {};- var autoTheme = opts.autoTheme === true;-- var svg = document.querySelector('.diagram-container svg');- var clone = svg.cloneNode(true);-- var vb = svg.viewBox.baseVal;- // Scale width/height so the browser rasterizes the vectors at target- // resolution directly. viewBox stays unchanged so coordinates don't- // shift. This is the key to sharp rasters — do NOT scale later via- // canvas upscaling.- clone.setAttribute('width', vb.width * scale);- clone.setAttribute('height', vb.height * scale);- clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');-- // Only the SVG-relevant rules: semantic classes, markers, and the- // theme variable blocks. Toolbar/cards/print CSS can never apply- // inside a standalone SVG and would only bloat the export.- var hostStyle = (function () {- var out = [];- Array.prototype.forEach.call(document.styleSheets, function (sheet) {- var rules;- try { rules = sheet.cssRules; } catch (_) { return; } // cross-origin- if (!rules) return;- Array.prototype.forEach.call(rules, function (rule) {- if (rule.type !== 1) return; // plain style rules only- var sel = rule.selectorText || '';- if (/(^|,)\s*(svg|:root|\[data-theme|\.c-|\.t-|\.a-|\.m-)/.test(sel)) {- out.push(rule.cssText);- }- });- });- return out.join('\n');- })();+ var context = defaultContext();- // Derive the variable list from the stylesheet so newly added theme- // variables can never be missed by the export pipeline again- // (--lane-fill/--lane-stroke once were).- var varNames = (function () {- var seen = {};- var names = [];- (hostStyle.match(/--[a-zA-Z0-9-]+(?=\s*:)/g) || []).forEach(function (n) {- if (!seen[n]) { seen[n] = true; names.push(n); }- });- return names;- })();+ function semanticType(node) {+ var authored = node.getAttribute('data-node-kind');+ if (authored) return authored;+ var types = ['frontend', 'backend', 'database', 'cloud', 'security', 'messagebus', 'external'];+ return types.find(function (type) { return node.querySelector('.c-' + type); }) || 'node';+ }- // Resolve the full variable set for a given data-theme via an- // off-DOM probe, independent of what the viewer is currently set to.- function resolveVars(themeAttr) {- var probe = document.createElement('div');- probe.setAttribute('data-theme', themeAttr);- probe.style.cssText = 'position:absolute;width:0;height:0;visibility:hidden;';- document.body.appendChild(probe);- try {- var c = getComputedStyle(probe);- return varNames.map(function (n) {- return n + ': ' + c.getPropertyValue(n).trim() + ';';- }).join(' ');- } finally {- document.body.removeChild(probe);+ function connectionsFor(id) {+ var count = 0;+ var seen = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var key = from + '\u0000' + to;+ if ((from === id || to === id) && !seen[key]) {+ seen[key] = true;+ count += 1;}- }-- // Prepend a local()-only @font-face block for each weight so that the- // sandboxed image-rendering context used during PNG/JPEG/WebP export- // can find JetBrains Mono if the user has it installed locally, and- // falls through cleanly to the monospace stack otherwise. The usual- // Google-Fonts <link> in the host document is unreachable from the- // serialized SVG, so url()-sourced faces would just hang.- var fontFallback = [400, 500, 600, 700].map(function (w) {- return "@font-face { font-family: 'JetBrains Mono'; font-weight: " + w +- "; src: local('JetBrains Mono'), local('JetBrainsMono-Regular'); }";- }).join('\n');-- var style = document.createElementNS('http://www.w3.org/2000/svg', 'style');- var bgRect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');- bgRect.setAttribute('width', '100%');- bgRect.setAttribute('height', '100%');-- if (autoTheme) {- // Dual-theme SVG. Dark is the default (so hosts without- // prefers-color-scheme still render), light swaps in via media- // query, and svg[data-theme="..."] still lets downstream- // consumers force a specific theme.- var darkVars = resolveVars('dark');- var lightVars = resolveVars('light');-- style.textContent =- fontFallback + "\n" +- "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" +- hostStyle + "\n" +- ":root, svg { " + darkVars + " }\n" +- "@media (prefers-color-scheme: light) { :root, svg { " + lightVars + " } }\n" +- "svg[data-theme=\"light\"] { " + lightVars + " }\n" +- "svg[data-theme=\"dark\"] { " + darkVars + " }\n" +- "rect.c-bg-rect { fill: var(--bg); }\n";+ });+ return count;+ }- // Don't lock the serialized SVG to the viewer's current theme.- clone.removeAttribute('data-theme');- // Background follows the CSS variable, not a fixed color, so it- // swaps with the media query.- bgRect.setAttribute('class', 'c-bg-rect');- } else {- // Raster path: lock to the viewer's current theme.- var theme = document.documentElement.getAttribute('data-theme') || 'dark';- var themeHost = document.querySelector('[data-theme="' + theme + '"]') || document.documentElement;- var computed = getComputedStyle(themeHost);- var vars = varNames.map(function (n) {- return n + ': ' + computed.getPropertyValue(n).trim() + ';';- }).join(' ');+ var items = Array.prototype.map.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ var id = node.getAttribute('data-node-id');+ var label = node.getAttribute('data-node-label') || (node.getAttribute('aria-label') || id).replace(/^Focus\s+/, '');+ var text = (node.textContent || '').replace(/\s+/g, ' ').trim();+ var sublabel = node.getAttribute('data-node-sublabel') || '';+ var context = node.getAttribute('data-node-context') || '';+ var tag = node.getAttribute('data-node-tag') || '';+ var type = semanticType(node);+ return {+ id: id,+ label: label,+ type: type,+ sublabel: sublabel,+ context: context,+ tag: tag,+ links: connectionsFor(id),+ search: (id + ' ' + label + ' ' + type + ' ' + sublabel + ' ' + context + ' ' + tag + ' ' + text).toLowerCase(),+ node: node+ };+ });- // IMPORTANT: inject the resolved variables AFTER hostStyle,- // otherwise hostStyle's ":root, [data-theme=\"dark\"] { ... }" rule- // overrides our chosen theme via later-in-cascade equal-specificity.- // Keep this order.- style.textContent =- fontFallback + "\n" +- "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" +- hostStyle + "\n" +- ":root, svg { " + vars + " }\n";+ function resultButtons() {+ return Array.prototype.slice.call(results.querySelectorAll('.node-finder-result'));+ }- bgRect.setAttribute('fill', computed.getPropertyValue('--bg').trim() || '#ffffff');+ function resolveContext(options) {+ var requested = options && options.context ? options.context : null;+ if (!requested && Archify.routeProbe && typeof Archify.routeProbe.finderContext === 'function') {+ requested = Archify.routeProbe.finderContext();}+ if (!requested) return defaultContext();+ var resolved = defaultContext();+ Object.keys(requested).forEach(function (key) { resolved[key] = requested[key]; });+ return resolved;+ }- clone.insertBefore(style, clone.firstChild);- clone.insertBefore(bgRect, style.nextSibling);+ function availableItems() {+ if (!context.allowedIds) return items.slice();+ return items.filter(function (item) { return context.allowedIds.indexOf(item.id) !== -1; });+ }- return {- svgString: new XMLSerializer().serializeToString(clone),- width: vb.width * scale,- height: vb.height * scale- };+ function applyContext() {+ panel.setAttribute('data-context', context.kind);+ heading.textContent = context.title;+ input.placeholder = context.placeholder;+ empty.textContent = context.empty;+ results.setAttribute('aria-label', context.resultsLabel);}- function download(blob, filename) {- var url = URL.createObjectURL(blob);- var a = document.createElement('a');- a.href = url;- a.download = filename;- document.body.appendChild(a);- a.click();- a.remove();- setTimeout(function () { URL.revokeObjectURL(url); }, 1000);+ function select(id) {+ var item = items.find(function (candidate) { return candidate.id === id; });+ if (!item) return false;+ var routeSelection = context.kind === 'route-source' || context.kind === 'route-target';+ if (routeSelection) {+ if (!Archify.routeProbe || typeof Archify.routeProbe.choose !== 'function' || !Archify.routeProbe.choose(id)) return false;+ if (Archify.routeProbe.active() === 'target' && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'route-pick' });+ }+ close({ restoreFocus: false });+ try { item.node.focus({ preventScroll: true }); } catch (_) { try { item.node.focus(); } catch (_) {} }+ return true;+ }+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.view && typeof Archify.view.reset === 'function') Archify.view.reset({ automatic: true });+ Archify.focus.set(id, { toggle: false });+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'finder' });+ }+ close({ restoreFocus: false });+ try { item.node.focus({ preventScroll: true }); } catch (_) { try { item.node.focus(); } catch (_) {} }+ return true;}- // Conservative upper bound on total canvas pixels. Older Safari on iOS- // silently produces a blank canvas above ~16 Mpx; Chrome / Firefox /- // desktop Safari are far higher but start failing on memory-constrained- // devices. We pick the largest integer scale in {4,3,2,1} whose target- // pixel count fits under this cap.- var MAX_CANVAS_PIXELS = 16 * 1024 * 1024;+ function render(query) {+ query = (query || '').trim().toLowerCase();+ var available = availableItems();+ visibleItems = available.filter(function (item) { return !query || item.search.indexOf(query) !== -1; });+ results.textContent = '';+ visibleItems.forEach(function (item) {+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'node-finder-result';+ button.setAttribute('data-node-id', item.id);+ var badge = context.badges && context.badges[item.id] ? context.badges[item.id] : String(item.links);+ var action = context.kind === 'route-source'+ ? 'Choose ' + item.label + ' as route start'+ : context.kind === 'route-target'+ ? 'Choose ' + item.label + ' as route destination, ' + badge+ : 'Focus ' + item.label + ', ' + item.links + ' related connection' + (item.links === 1 ? '' : 's');+ button.setAttribute('aria-label', action);- function pickSafeScale(vbW, vbH) {- for (var s = RASTER_SCALE; s >= 1; s--) {- if (vbW * s * vbH * s <= MAX_CANVAS_PIXELS) return s;+ var name = document.createElement('strong');+ name.textContent = item.label;+ var links = document.createElement('em');+ links.textContent = badge;+ links.title = context.kind === 'focus'+ ? item.links + ' related connection' + (item.links === 1 ? '' : 's')+ : action;+ var meta = document.createElement('small');+ meta.textContent = [item.type, item.context, item.sublabel, item.tag, item.id].filter(Boolean).join(' \u00b7 ');+ button.appendChild(name);+ button.appendChild(links);+ button.appendChild(meta);+ button.addEventListener('click', function () { select(item.id); });+ results.appendChild(button);+ });+ empty.hidden = visibleItems.length !== 0;+ status.textContent = visibleItems.length + ' of ' + available.length + ' ' + context.availableNoun + (query ? ' match' : ' available');+ }++ function open(options) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);+ if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });+ context = resolveContext(options || {});+ applyContext();+ panel.hidden = false;+ trigger.setAttribute('aria-expanded', 'true');+ if (context.kind.indexOf('route-') === 0 && Archify.routeProbe && typeof Archify.routeProbe.finderOpening === 'function') {+ Archify.routeProbe.finderOpening();}- return 1;+ input.value = '';+ render('');+ requestAnimationFrame(function () { input.focus(); });+ return true;}- function rasterize(format) {- // Serialize at a safe scale (RASTER_SCALE=4 by default, reduced if the- // resulting canvas would exceed MAX_CANVAS_PIXELS). The SVG itself is- // rasterized at target resolution natively; drawImage draws at natural- // size — no upsampling blur.- var svg = document.querySelector('.diagram-container svg');- var vb = svg.viewBox.baseVal;- var scale = pickSafeScale(vb.width, vb.height);- var data = serializeSvg(scale);- var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });- var svgUrl = URL.createObjectURL(svgBlob);+ function close(options) {+ options = options || {};+ var routeContext = context.kind.indexOf('route-') === 0;+ panel.hidden = true;+ trigger.setAttribute('aria-expanded', 'false');+ input.value = '';+ if (routeContext && Archify.routeProbe && typeof Archify.routeProbe.finderClosed === 'function') {+ Archify.routeProbe.finderClosed({ restoreFocus: options.restoreFocus !== false });+ } else if (options.restoreFocus !== false) {+ trigger.focus();+ }+ }- return new Promise(function (resolve, reject) {- var img = new Image();- img.onload = function () {- var canvas = document.createElement('canvas');- canvas.width = data.width;- canvas.height = data.height;- var ctx = canvas.getContext('2d');- if (format === 'jpeg') {- ctx.fillStyle = currentBg();- ctx.fillRect(0, 0, canvas.width, canvas.height);- }- // Draw at natural size — SVG was already rasterized at target res.- ctx.drawImage(img, 0, 0);- URL.revokeObjectURL(svgUrl);- var mime = format === 'jpeg' ? 'image/jpeg' :- format === 'webp' ? 'image/webp' : 'image/png';- var quality = format === 'png' ? undefined : 0.95;- canvas.toBlob(function (blob) {- if (!blob) reject(new Error('toBlob returned null for ' + format));- else resolve(blob);- }, mime, quality);+ function toggle() { return panel.hidden ? open() : (close(), false); }++ trigger.addEventListener('click', toggle);+ closeBtn.addEventListener('click', function () { close(); });+ input.addEventListener('input', function () { render(input.value); });+ input.addEventListener('keydown', function (event) {+ var buttons = resultButtons();+ if (event.key === 'ArrowDown' && buttons.length) {+ event.preventDefault();+ buttons[0].focus();+ } else if (event.key === 'Enter' && visibleItems.length) {+ event.preventDefault();+ select(visibleItems[0].id);+ }+ });+ results.addEventListener('keydown', function (event) {+ var buttons = resultButtons();+ var index = buttons.indexOf(document.activeElement);+ if (index < 0 || !buttons.length) return;+ var next = null;+ if (event.key === 'ArrowDown') next = (index + 1) % buttons.length;+ else if (event.key === 'ArrowUp') next = (index - 1 + buttons.length) % buttons.length;+ else if (event.key === 'Home') next = 0;+ else if (event.key === 'End') next = buttons.length - 1;+ if (next !== null) {+ event.preventDefault();+ buttons[next].focus();+ }+ });+ panel.addEventListener('keydown', function (event) {+ if (event.key !== 'Escape') return;+ event.preventDefault();+ event.stopPropagation();+ close();+ });+ document.addEventListener('click', function (event) {+ if (!panel.hidden && !panel.contains(event.target) && !event.target.closest('[data-node-finder-trigger]')) close({ restoreFocus: false });+ });++ render('');+ return {+ open: open,+ close: close,+ toggle: toggle,+ select: select,+ isOpen: function () { return !panel.hidden; },+ context: function () { return context.kind; },+ count: items.length+ };+ })();++ /* ============================================================+ Route Probe — shortest directed path over compiled semantics.+ The graph is read from renderer-owned stable IDs and relationship+ endpoints. BFS order follows authored DOM edge order, so equal-length+ choices are deterministic without adding weights or a graph runtime.+ ============================================================ */+ Archify.routeProbe = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var trigger = document.getElementById('btn-route-probe');+ var panel = document.getElementById('route-probe');+ var title = document.getElementById('route-probe-title');+ var path = document.getElementById('route-probe-path');+ var status = document.getElementById('route-probe-status');+ var findBtn = document.getElementById('route-probe-find');+ var copyBtn = document.getElementById('route-probe-copy');+ var clearBtn = document.getElementById('route-probe-clear');+ var journeyControls = document.getElementById('route-journey-controls');+ var journeyPrevBtn = document.getElementById('route-journey-prev');+ var journeyPlayBtn = document.getElementById('route-journey-play');+ var journeyPlayIcon = document.getElementById('route-journey-play-icon');+ var journeyPlayLabel = document.getElementById('route-journey-play-label');+ var journeyNextBtn = document.getElementById('route-journey-next');+ var journeyOverviewBtn = document.getElementById('route-journey-overview');+ var namespace = 'http://www.w3.org/2000/svg';+ var mode = 'idle';+ var startId = null;+ var endId = null;+ var activeNodeIds = [];+ var activeEdges = [];+ var journeyIndex = -1;+ var journeyPlaying = false;+ var journeyComplete = false;+ var journeyGeneration = 0;+ var journeyTimer = null;+ var journeyStartedAt = 0;+ var journeyElapsedMs = 0;+ var journeyOwnerToken = 0;+ var JOURNEY_DWELL_MS = 1100;++ function nodes() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ }+ function edges() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ }+ function nodesById() {+ var out = {};+ nodes().forEach(function (node) { out[node.getAttribute('data-node-id')] = node; });+ return out;+ }+ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];+ }+ function edgeShapes(edge) {+ if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function removeOverlay() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-route-probe-overlay]'), function (overlay) {+ overlay.remove();+ });+ }+ function removeJourneyPulse(options) {+ options = options || {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-route-journey-overlay]'), function (overlay) {+ overlay.remove();+ });+ if (journeyOwnerToken && options.release !== false && Archify.motionGovernor) {+ var token = journeyOwnerToken;+ journeyOwnerToken = 0;+ Archify.motionGovernor.release(token);+ }+ }+ function stopJourneyTimer(options) {+ options = options || {};+ journeyGeneration += 1;+ if (journeyTimer) {+ if (options.preserveElapsed === true && journeyStartedAt) {+ journeyElapsedMs = Math.min(JOURNEY_DWELL_MS, journeyElapsedMs + Math.max(0, Date.now() - journeyStartedAt));+ }+ window.clearTimeout(journeyTimer);+ }+ journeyTimer = null;+ journeyStartedAt = 0;+ if (options.preserveElapsed !== true) journeyElapsedMs = 0;+ }+ function clearJourneyPresentation(options) {+ options = options || {};+ removeJourneyPulse();+ svg.removeAttribute('data-route-journey');+ panel.removeAttribute('data-route-journey');+ nodes().forEach(function (node) {+ node.removeAttribute('data-route-journey-state');+ node.removeAttribute('data-route-journey-current');+ });+ edges().forEach(function (edge) {+ edge.removeAttribute('data-route-journey-state');+ edge.removeAttribute('data-route-journey-current');+ });+ Array.prototype.forEach.call(path.querySelectorAll('[data-route-journey-index]'), function (button, index) {+ button.removeAttribute('data-route-journey-state');+ button.removeAttribute('aria-current');+ button.setAttribute('tabindex', index === 0 ? '0' : '-1');+ });+ if (options.keepControls !== true) journeyControls.hidden = true;+ journeyControls.setAttribute('data-playing', 'false');+ }+ function resetJourneyState() {+ stopJourneyTimer();+ journeyPlaying = false;+ journeyComplete = false;+ journeyIndex = -1;+ clearJourneyPresentation();+ }+ function cleanSvgState() {+ resetJourneyState();+ svg.removeAttribute('data-route-picking');+ svg.removeAttribute('data-route-active');+ removeOverlay();+ nodes().forEach(function (node) {+ node.removeAttribute('data-route-match');+ node.removeAttribute('data-route-start');+ node.removeAttribute('data-route-end');+ node.removeAttribute('data-route-step');+ node.removeAttribute('data-route-candidate');+ node.style.removeProperty('--route-step');+ });+ edges().forEach(function (edge) {+ edge.removeAttribute('data-route-match');+ edge.removeAttribute('data-route-step');+ edge.style.removeProperty('--route-step');+ });+ panel.removeAttribute('data-route-dock');+ }+ function replaceRouteHash(value) {+ try {+ history.replaceState(null, '', location.pathname + location.search + (value ? '#route=' + value : ''));+ } catch (_) {}+ }+ function renderPlaceholder(copy) {+ path.textContent = '';+ var placeholder = document.createElement('span');+ placeholder.className = 'route-probe-placeholder';+ placeholder.textContent = copy;+ path.appendChild(placeholder);+ }+ function renderPath(ids, options) {+ options = options || {};+ var byId = nodesById();+ path.textContent = '';+ ids.forEach(function (id, index) {+ if (index) {+ var arrow = document.createElement('span');+ arrow.className = 'route-probe-arrow';+ arrow.setAttribute('aria-hidden', 'true');+ arrow.textContent = '\u2192';+ path.appendChild(arrow);+ }+ var item = document.createElement(options.interactive === true ? 'button' : 'span');+ if (options.interactive === true) {+ item.type = 'button';+ item.setAttribute('data-route-journey-index', String(index));+ item.setAttribute('data-route-node-id', id);+ item.setAttribute('tabindex', index === 0 ? '0' : '-1');+ item.setAttribute('aria-label', 'Route position ' + (index + 1) + ' of ' + ids.length + ': ' + nodeLabel(byId[id], id));+ }+ item.className = 'route-probe-node';+ item.textContent = nodeLabel(byId[id], id);+ item.title = nodeLabel(byId[id], id) + ' · ' + id;+ if (index === 0) item.setAttribute('data-endpoint', 'start');+ if (index === ids.length - 1 && ids.length > 1) item.setAttribute('data-endpoint', 'end');+ path.appendChild(item);+ });+ }+ function setTrigger(active) {+ trigger.setAttribute('aria-pressed', active ? 'true' : 'false');+ trigger.setAttribute('aria-label', active ? 'Clear traced route' : 'Trace a directed route');+ }+ function clear(options) {+ options = options || {};+ var wasActive = mode !== 'idle';+ if (Archify.finder && Archify.finder.isOpen() && typeof Archify.finder.context === 'function' && Archify.finder.context().indexOf('route-') === 0) {+ Archify.finder.close({ restoreFocus: false });+ }+ mode = 'idle';+ startId = null;+ endId = null;+ activeNodeIds = [];+ activeEdges = [];+ cleanSvgState();+ panel.hidden = true;+ panel.setAttribute('data-state', 'idle');+ panel.removeAttribute('data-finder-open');+ title.textContent = 'Choose a start node';+ renderPlaceholder('Pick two semantic nodes on the diagram');+ status.textContent = 'Choose the source, then the destination. Direction matters.';+ findBtn.hidden = true;+ findBtn.textContent = 'Find start';+ findBtn.setAttribute('aria-label', 'Find a route start');+ copyBtn.hidden = true;+ copyBtn.textContent = 'Copy link';+ setTrigger(false);+ if (wasActive && options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ if (options.updateUrl !== false) replaceRouteHash('');+ if (options.restoreFocus === true) trigger.focus();+ }+ function outgoingByNode() {+ var byId = nodesById();+ var outgoing = {};+ edges().forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (!byId[from] || !byId[to] || from === to) return;+ if (!outgoing[from]) outgoing[from] = [];+ outgoing[from].push({ edge: edge, to: to });+ });+ return outgoing;+ }+ function reachableFrom(source) {+ var outgoing = outgoingByNode();+ var reached = {};+ var queue = [source];+ reached[source] = true;+ for (var cursor = 0; cursor < queue.length; cursor += 1) {+ var links = outgoing[queue[cursor]] || [];+ links.forEach(function (link) {+ if (reached[link.to]) return;+ reached[link.to] = true;+ queue.push(link.to);+ });+ }+ return reached;+ }+ function hopDistancesFrom(source) {+ var outgoing = outgoingByNode();+ var distances = {};+ var queue = [source];+ distances[source] = 0;+ for (var cursor = 0; cursor < queue.length; cursor += 1) {+ var links = outgoing[queue[cursor]] || [];+ links.forEach(function (link) {+ if (Object.prototype.hasOwnProperty.call(distances, link.to)) return;+ distances[link.to] = distances[queue[cursor]] + 1;+ queue.push(link.to);+ });+ }+ return distances;+ }+ function shortestDirectedPath(source, target) {+ if (source === target) return null;+ var outgoing = outgoingByNode();+ var previous = {};+ var queue = [source];+ previous[source] = null;+ for (var cursor = 0; cursor < queue.length && !Object.prototype.hasOwnProperty.call(previous, target); cursor += 1) {+ var links = outgoing[queue[cursor]] || [];+ links.some(function (link) {+ if (Object.prototype.hasOwnProperty.call(previous, link.to)) return false;+ previous[link.to] = { from: queue[cursor], edge: link.edge };+ queue.push(link.to);+ return link.to === target;+ });+ }+ if (!Object.prototype.hasOwnProperty.call(previous, target)) return null;+ var nodeIds = [target];+ var routeEdges = [];+ var current = target;+ while (current !== source) {+ var step = previous[current];+ if (!step) return null;+ routeEdges.unshift(step.edge);+ nodeIds.unshift(step.from);+ current = step.from;+ }+ return { nodes: nodeIds, edges: routeEdges };+ }+ function traceGeometry(shape, step) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-route-match');+ clone.removeAttribute('data-route-step');+ clone.setAttribute('class', 'route-probe-flow');+ clone.setAttribute('pathLength', '1');+ clone.style.setProperty('--route-step', String(step));+ return clone;+ }+ function renderOverlay(routeEdges) {+ removeOverlay();+ if (!routeEdges.length) return;+ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'route-probe-overlay');+ overlay.setAttribute('data-route-probe-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ routeEdges.forEach(function (edge, step) {+ var wrapper = document.createElementNS(namespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ edgeShapes(edge).forEach(function (shape) { wrapper.appendChild(traceGeometry(shape, step)); });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ }+ function journeyButtons() {+ return Array.prototype.slice.call(path.querySelectorAll('[data-route-journey-index]'));+ }+ function journeyMotionAllowed() {+ return html.getAttribute('data-embed') !== 'true' &&+ !document.hidden &&+ Archify.motionGovernor &&+ Archify.motionGovernor.capable === true &&+ !Archify.motionGovernor.isPaused();+ }+ function routeOverviewStatus() {+ return activeNodeIds.length + ' nodes · ' + activeEdges.length + ' directed hop' + (activeEdges.length === 1 ? '' : 's') + ' · shortest authored route';+ }+ function centerJourneyButton(button) {+ if (!button) return;+ var target = button.offsetLeft - Math.max(0, (path.clientWidth - button.offsetWidth) / 2);+ path.scrollLeft = Math.max(0, target);+ }+ function focusJourneyButton(index) {+ var buttons = journeyButtons();+ if (!buttons.length) return false;+ var next = Math.max(0, Math.min(buttons.length - 1, index));+ buttons.forEach(function (button, buttonIndex) {+ button.setAttribute('tabindex', buttonIndex === next ? '0' : '-1');+ });+ try { buttons[next].focus({ preventScroll: true }); } catch (_) { buttons[next].focus(); }+ centerJourneyButton(buttons[next]);+ return true;+ }+ function renderJourneyControls() {+ var hasRoute = mode === 'result' && activeNodeIds.length > 1;+ var canPlay = hasRoute && journeyMotionAllowed();+ journeyControls.hidden = !hasRoute;+ journeyControls.setAttribute('data-playing', journeyPlaying ? 'true' : 'false');+ journeyPrevBtn.disabled = !hasRoute || journeyIndex <= 0;+ journeyNextBtn.disabled = !hasRoute || journeyIndex >= activeNodeIds.length - 1;+ journeyOverviewBtn.disabled = !hasRoute || journeyIndex < 0;+ journeyPlayBtn.disabled = !canPlay;+ journeyPlayBtn.setAttribute('aria-pressed', journeyPlaying ? 'true' : 'false');+ if (journeyPlaying) {+ journeyPlayIcon.textContent = '\u275a\u275a';+ journeyPlayLabel.textContent = 'Pause';+ journeyPlayBtn.setAttribute('aria-label', 'Pause route journey');+ journeyPlayBtn.title = 'Pause route journey';+ } else if (journeyComplete || journeyIndex === activeNodeIds.length - 1) {+ journeyPlayIcon.textContent = '\u21bb';+ journeyPlayLabel.textContent = 'Replay';+ journeyPlayBtn.setAttribute('aria-label', 'Replay route journey');+ journeyPlayBtn.title = canPlay ? 'Replay route journey' : 'Automatic journey requires Live motion';+ } else {+ journeyPlayIcon.textContent = '\u25b6';+ journeyPlayLabel.textContent = 'Journey';+ journeyPlayBtn.setAttribute('aria-label', 'Play route journey');+ journeyPlayBtn.title = canPlay ? 'Play route journey' : 'Automatic journey requires Live motion';+ }+ }+ function journeyGeometry(shape) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-route-match');+ clone.removeAttribute('data-route-step');+ clone.removeAttribute('data-route-journey-state');+ clone.removeAttribute('data-route-journey-current');+ clone.setAttribute('class', 'route-journey-flow');+ clone.setAttribute('pathLength', '1');+ return clone;+ }+ function renderJourneyPulse(edge) {+ removeJourneyPulse();+ if (!edge || !journeyMotionAllowed()) return false;+ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'route-journey-overlay');+ overlay.setAttribute('data-route-journey-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ var wrapper = document.createElementNS(namespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ edgeShapes(edge).forEach(function (shape) { wrapper.appendChild(journeyGeometry(shape)); });+ if (!wrapper.childNodes.length) return false;+ overlay.appendChild(wrapper);+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ if (Archify.motionGovernor && Archify.motionGovernor.capable) {+ var token = 0;+ token = Archify.motionGovernor.claim('route', function () {+ if (journeyOwnerToken === token) journeyOwnerToken = 0;+ removeJourneyPulse({ release: false });+ });+ journeyOwnerToken = token;+ }+ overlay.addEventListener('animationend', function () {+ if (overlay.isConnected) removeJourneyPulse();+ }, { once: true });+ window.setTimeout(function () {+ if (overlay.isConnected) removeJourneyPulse();+ }, 860);+ return true;+ }+ function applyJourneyState(index, options) {+ options = options || {};+ if (mode !== 'result' || !activeNodeIds.length) return false;+ var byId = nodesById();+ journeyIndex = Math.max(0, Math.min(activeNodeIds.length - 1, index));+ removeJourneyPulse();+ svg.setAttribute('data-route-journey', (journeyIndex + 1) + '/' + activeNodeIds.length);+ panel.setAttribute('data-route-journey', String(journeyIndex));+ activeNodeIds.forEach(function (id, step) {+ var node = byId[id];+ if (!node) return;+ var state = step < journeyIndex ? 'past' : (step === journeyIndex ? 'current' : 'future');+ node.setAttribute('data-route-journey-state', state);+ if (step === journeyIndex) node.setAttribute('data-route-journey-current', '');+ else node.removeAttribute('data-route-journey-current');+ });+ activeEdges.forEach(function (edge, step) {+ var destination = step + 1;+ var state = destination < journeyIndex ? 'past' : (destination === journeyIndex ? 'current' : 'future');+ edge.setAttribute('data-route-journey-state', state);+ if (destination === journeyIndex) edge.setAttribute('data-route-journey-current', '');+ else edge.removeAttribute('data-route-journey-current');+ });+ var buttons = journeyButtons();+ buttons.forEach(function (button, step) {+ var state = step < journeyIndex ? 'past' : (step === journeyIndex ? 'current' : 'future');+ button.setAttribute('data-route-journey-state', state);+ button.setAttribute('tabindex', step === journeyIndex ? '0' : '-1');+ if (step === journeyIndex) button.setAttribute('aria-current', 'step');+ else button.removeAttribute('aria-current');+ });+ if (options.center !== false) centerJourneyButton(buttons[journeyIndex]);+ var phase = journeyPlaying ? 'Playing' : (journeyComplete ? 'Complete' : 'Inspecting');+ status.textContent = 'Step ' + (journeyIndex + 1) + ' of ' + activeNodeIds.length + ' · ' + phase + ' · ' + nodeLabel(byId[activeNodeIds[journeyIndex]], activeNodeIds[journeyIndex]);+ if (options.pulse === true && journeyIndex > 0) renderJourneyPulse(activeEdges[journeyIndex - 1]);+ if (options.reveal !== false && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal(activeNodeIds.slice(Math.max(0, journeyIndex - 1), Math.min(activeNodeIds.length, journeyIndex + 2)), {+ includeNeighbors: false,+ reason: 'route-journey',+ maxScale: 1.65,+ padding: 64,+ duration: 360,+ instant: !journeyMotionAllowed()+ });+ }+ renderJourneyControls();+ requestDocking();+ return true;+ }+ function pauseJourney(options) {+ options = options || {};+ if (!journeyPlaying && options.complete !== true) {+ renderJourneyControls();+ return false;+ }+ stopJourneyTimer({ preserveElapsed: options.complete !== true && options.preserveElapsed !== false });+ journeyPlaying = false;+ journeyComplete = options.complete === true;+ if (journeyComplete) journeyElapsedMs = 0;+ removeJourneyPulse();+ if (journeyIndex >= 0) applyJourneyState(journeyIndex, { center: false, pulse: false, reveal: false });+ else renderJourneyControls();+ return true;+ }+ function selectJourneyIndex(index) {+ if (mode !== 'result') return false;+ stopJourneyTimer();+ journeyPlaying = false;+ journeyComplete = false;+ return applyJourneyState(index, { pulse: true, reveal: true });+ }+ function showJourneyOverview(options) {+ options = options || {};+ if (mode !== 'result') return false;+ stopJourneyTimer();+ journeyPlaying = false;+ journeyComplete = false;+ journeyIndex = -1;+ clearJourneyPresentation({ keepControls: true });+ status.textContent = routeOverviewStatus();+ renderJourneyControls();+ if (options.reveal !== false && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal(activeNodeIds, { includeNeighbors: false, reason: 'route', instant: !journeyMotionAllowed() });+ }+ requestDocking();+ return true;+ }+ function scheduleJourney() {+ if (!journeyPlaying || !journeyMotionAllowed()) {+ pauseJourney({ preserveElapsed: true });+ return false;+ }+ var generation = ++journeyGeneration;+ var remaining = Math.max(0, JOURNEY_DWELL_MS - journeyElapsedMs);+ journeyStartedAt = Date.now();+ journeyTimer = window.setTimeout(function () {+ if (generation !== journeyGeneration || !journeyPlaying) return;+ journeyTimer = null;+ journeyStartedAt = 0;+ journeyElapsedMs = 0;+ if (journeyIndex >= activeNodeIds.length - 1) {+ pauseJourney({ complete: true, preserveElapsed: false });+ return;+ }+ applyJourneyState(journeyIndex + 1, { pulse: true, reveal: true });+ // Camera and motion-owner handoff are allowed to synchronously+ // settle the previous step. The new step always starts with a fresh+ // dwell; never carry cleanup time into the next scheduler lease.+ journeyElapsedMs = 0;+ journeyStartedAt = 0;+ scheduleJourney();+ }, remaining);+ return true;+ }+ function playJourney() {+ if (mode !== 'result' || activeNodeIds.length < 2 || !journeyMotionAllowed()) {+ renderJourneyControls();+ return false;+ }+ if (journeyPlaying) return true;+ if (journeyComplete || journeyIndex >= activeNodeIds.length - 1) {+ journeyIndex = -1;+ journeyElapsedMs = 0;+ journeyComplete = false;+ }+ journeyPlaying = true;+ if (journeyIndex < 0) applyJourneyState(0, { pulse: false, reveal: true });+ else applyJourneyState(journeyIndex, { center: false, pulse: false, reveal: false });+ scheduleJourney();+ return true;+ }+ function toggleJourney() {+ return journeyPlaying ? pauseJourney({ preserveElapsed: true }) : playJourney();+ }+ function previousJourney() {+ return selectJourneyIndex(Math.max(0, journeyIndex < 0 ? 0 : journeyIndex - 1));+ }+ function nextJourney() {+ return selectJourneyIndex(Math.min(activeNodeIds.length - 1, journeyIndex + 1));+ }+ function overlapArea(a, b) {+ var width = Math.max(0, Math.min(a.right, b.right) - Math.max(a.left, b.left));+ var height = Math.max(0, Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top));+ return width * height;+ }+ function updateDocking() {+ if (panel.hidden) {+ panel.removeAttribute('data-route-dock');+ return;+ }+ var containerRect = container.getBoundingClientRect();+ var width = panel.offsetWidth;+ var height = panel.offsetHeight;+ if (!width || !height) return;+ var currentRect = panel.getBoundingClientRect();+ var left = currentRect.left;+ var topCandidate = {+ left: left,+ right: left + width,+ top: containerRect.top + 8,+ bottom: containerRect.top + 8 + height+ };+ var nav = container.querySelector('.diagram-nav');+ var navRect = nav ? nav.getBoundingClientRect() : null;+ var bottom = navRect ? navRect.top - 9 : containerRect.bottom - 8;+ var bottomCandidate = {+ left: left,+ right: left + width,+ top: bottom - height,+ bottom: bottom+ };+ var byId = nodesById();+ var relevant = activeNodeIds.length ? activeNodeIds : (startId ? [startId] : []);+ var blockers = relevant.map(function (id) { return byId[id]; }).filter(Boolean).map(function (node) {+ return node.getBoundingClientRect();+ });+ function score(candidate) {+ var value = blockers.reduce(function (sum, rect) { return sum + overlapArea(candidate, rect); }, 0);+ if (navRect) value += overlapArea(candidate, navRect) * 4;+ if (candidate.top < containerRect.top || candidate.bottom > containerRect.bottom) value += 1000000;+ return value;+ }+ if (score(topCandidate) <= score(bottomCandidate)) panel.setAttribute('data-route-dock', 'top');+ else panel.setAttribute('data-route-dock', 'bottom');+ }+ function requestDocking() {+ requestAnimationFrame(updateDocking);+ window.setTimeout(updateDocking, 120);+ window.setTimeout(updateDocking, 560);+ }+ function chooseStart(id) {+ var byId = nodesById();+ if (!byId[id]) return false;+ cleanSvgState();+ startId = id;+ endId = null;+ mode = 'target';+ var reached = reachableFrom(id);+ byId[id].setAttribute('data-route-start', '');+ byId[id].setAttribute('data-route-match', '');+ Object.keys(reached).forEach(function (candidateId) {+ if (candidateId !== id && byId[candidateId]) byId[candidateId].setAttribute('data-route-candidate', '');+ });+ svg.setAttribute('data-route-picking', 'target');+ panel.setAttribute('data-state', 'target');+ title.textContent = 'Choose a destination from ' + nodeLabel(byId[id], id);+ renderPath([id]);+ var count = Math.max(0, Object.keys(reached).length - 1);+ status.textContent = count+ ? count + ' directed destination' + (count === 1 ? '' : 's') + ' available. Pick a highlighted node.'+ : 'No outgoing route starts here. Clear and choose another source.';+ findBtn.hidden = false;+ findBtn.textContent = 'Find target';+ findBtn.setAttribute('aria-label', 'Find a reachable route destination');+ requestDocking();+ return true;+ }+ function showResult(result, options) {+ options = options || {};+ var byId = nodesById();+ cleanSvgState();+ mode = 'result';+ startId = result.nodes[0];+ endId = result.nodes[result.nodes.length - 1];+ activeNodeIds = result.nodes.slice();+ activeEdges = result.edges.slice();+ result.nodes.forEach(function (id, step) {+ var node = byId[id];+ if (!node) return;+ node.setAttribute('data-route-match', '');+ node.setAttribute('data-route-step', String(step));+ node.style.setProperty('--route-step', String(step));+ if (step === 0) node.setAttribute('data-route-start', '');+ if (step === result.nodes.length - 1) node.setAttribute('data-route-end', '');+ });+ result.edges.forEach(function (edge, step) {+ edge.setAttribute('data-route-match', '');+ edge.setAttribute('data-route-step', String(step));+ edge.style.setProperty('--route-step', String(step));+ });+ svg.setAttribute('data-route-active', startId + '~' + endId);+ renderOverlay(result.edges);+ renderPath(result.nodes, { interactive: true });+ panel.setAttribute('data-state', 'result');+ panel.hidden = false;+ title.textContent = nodeLabel(byId[startId], startId) + ' to ' + nodeLabel(byId[endId], endId);+ findBtn.hidden = true;+ copyBtn.hidden = false;+ setTrigger(true);+ if (options.updateUrl !== false) {+ replaceRouteHash(encodeURIComponent(startId) + '~' + encodeURIComponent(endId));+ }+ showJourneyOverview({ reveal: false });+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal(result.nodes, { includeNeighbors: false, reason: 'route' });+ }+ return true;+ }+ function choose(id, options) {+ options = options || {};+ var byId = nodesById();+ if (!byId[id]) return false;+ if (mode === 'source') return chooseStart(id);+ if (mode !== 'target') return false;+ if (id === startId) {+ panel.setAttribute('data-state', 'error');+ title.textContent = 'Choose a different destination';+ status.textContent = 'A route needs two distinct semantic nodes.';+ return false;+ }+ var result = shortestDirectedPath(startId, id);+ if (!result) {+ panel.setAttribute('data-state', 'error');+ title.textContent = 'No directed route to ' + nodeLabel(byId[id], id);+ status.textContent = nodeLabel(byId[id], id) + ' is not reachable from ' + nodeLabel(byId[startId], startId) + '. Pick a highlighted destination.';+ return false;+ }+ return showResult(result, options);+ }+ function begin(options) {+ options = options || {};+ if (html.getAttribute('data-embed') === 'true') return false;+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.semanticLens && Archify.semanticLens.active()) {+ Archify.semanticLens.clear({ updateUrl: false, preserveView: true, closePanel: true });+ }+ var focused = options.source || (Archify.focus && typeof Archify.focus.active === 'function' ? Archify.focus.active() : null);+ if (Array.isArray(focused)) focused = null;+ clear({ updateUrl: false, preserveView: true, restoreFocus: false });+ if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') Archify.intentTrace.clear({ announce: false });+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.focus && typeof Archify.focus.clear === 'function') {+ Archify.focus.clear({ updateUrl: false, preserveView: true });+ }+ if (Archify.finder && Archify.finder.isOpen()) Archify.finder.close({ restoreFocus: false });+ if (Archify.radar && Archify.radar.isOpen()) Archify.radar.close({ restoreFocus: false });+ mode = 'source';+ panel.hidden = false;+ panel.setAttribute('data-state', 'source');+ svg.setAttribute('data-route-picking', 'source');+ title.textContent = 'Choose a start node';+ renderPlaceholder('Pick a semantic node on the diagram');+ status.textContent = 'Select the source. The next step will reveal only directed destinations.';+ findBtn.hidden = false;+ findBtn.textContent = 'Find start';+ findBtn.setAttribute('aria-label', 'Find a route start');+ copyBtn.hidden = true;+ setTrigger(true);+ if (focused && nodesById()[focused]) chooseStart(focused);+ if (options.focusNode === true && !focused) {+ var first = nodes()[0];+ if (first) {+ try { first.focus({ preventScroll: true }); } catch (_) { try { first.focus(); } catch (_) {} }+ }+ }+ return true;+ }+ function toggle(options) {+ if (mode !== 'idle') {+ clear({ restoreFocus: true });+ return false;+ }+ return begin(options);+ }+ function finderContext() {+ var byId = nodesById();+ if (mode === 'source') {+ var outgoing = outgoingByNode();+ var sourceIds = nodes().map(function (node) { return node.getAttribute('data-node-id'); }).filter(function (id) {+ return outgoing[id] && outgoing[id].length;+ });+ var sourceBadges = {};+ sourceIds.forEach(function (id) { sourceBadges[id] = 'start'; });+ return {+ kind: 'route-source',+ title: 'Choose route start',+ placeholder: 'Search route sources',+ empty: 'No matching route sources',+ resultsLabel: 'Nodes that can start a route',+ availableNoun: 'route sources',+ allowedIds: sourceIds,+ badges: sourceBadges};- img.onerror = function (e) {- URL.revokeObjectURL(svgUrl);- reject(e);+ }+ if (mode === 'target' && startId && byId[startId]) {+ var distances = hopDistancesFrom(startId);+ var targetIds = Object.keys(distances).filter(function (id) { return id !== startId && byId[id]; });+ var targetBadges = {};+ targetIds.forEach(function (id) {+ targetBadges[id] = distances[id] + ' hop' + (distances[id] === 1 ? '' : 's');+ });+ return {+ kind: 'route-target',+ title: 'Destination from ' + nodeLabel(byId[startId], startId),+ placeholder: 'Search reachable destinations',+ empty: 'No matching reachable destinations',+ resultsLabel: 'Reachable route destinations',+ availableNoun: 'reachable destinations',+ allowedIds: targetIds,+ badges: targetBadges};- img.src = svgUrl;+ }+ return null;+ }+ function finderOpening() {+ panel.setAttribute('data-finder-open', 'true');+ }+ function finderClosed(options) {+ options = options || {};+ panel.removeAttribute('data-finder-open');+ requestDocking();+ if (options.restoreFocus === true && !findBtn.hidden) findBtn.focus();+ }+ function openFinder() {+ var context = finderContext();+ if (!context || !Archify.finder) return false;+ return Archify.finder.open({ context: context });+ }+ function fallbackCopy(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }+ function copyLink() {+ if (mode !== 'result') return Promise.resolve(false);+ var value = location.href.replace(/#.*$/, '') + '#route=' + encodeURIComponent(startId) + '~' + encodeURIComponent(endId);+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })+ : Promise.resolve(fallbackCopy(value));+ return copy.then(function (copied) {+ copyBtn.textContent = copied ? 'Copied' : 'Copy failed';+ copyBtn.setAttribute('aria-label', copied ? 'Traced route link copied' : 'Could not copy traced route link');+ window.setTimeout(function () {+ copyBtn.textContent = 'Copy link';+ copyBtn.setAttribute('aria-label', 'Copy link to traced route');+ }, 1600);+ return copied;+ });+ }+ function interceptSelection(event) {+ if (mode !== 'source' && mode !== 'target') return;+ if (container.getAttribute('data-just-panned') === 'true') return;+ var node = event.target.closest('[data-node-id]');+ if (!node) return;+ if (event.type === 'keydown' && event.key !== 'Enter' && event.key !== ' ') return;+ event.preventDefault();+ event.stopImmediatePropagation();+ choose(node.getAttribute('data-node-id'));+ }+ function syncFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var route = params.get('route');+ if (!route) {+ if (mode !== 'idle') clear({ updateUrl: false, restoreFocus: false });+ return;+ }+ var parts = route.split('~');+ if (parts.length !== 2) return;+ var byId = nodesById();+ if (!byId[parts[0]] || !byId[parts[1]]) return;+ begin({ source: parts[0], focusNode: false });+ choose(parts[1], { updateUrl: false });+ } catch (_) {}+ }+ function escapeRoute(options) {+ options = options || {};+ if (journeyPlaying) {+ pauseJourney({ preserveElapsed: true });+ if (options.restoreFocus === true) journeyPlayBtn.focus();+ return 'paused';+ }+ if (journeyIndex >= 0) {+ showJourneyOverview({ reveal: true });+ if (options.restoreFocus === true) journeyOverviewBtn.focus();+ return 'overview';+ }+ clear({ restoreFocus: options.restoreFocus === true });+ return 'cleared';+ }+ function syncJourneyMotion() {+ if (journeyPlaying && !journeyMotionAllowed()) pauseJourney({ preserveElapsed: true });+ renderJourneyControls();+ return journeyMotionAllowed();+ }++ trigger.addEventListener('click', function () { toggle({ focusNode: false }); });+ findBtn.addEventListener('click', openFinder);+ clearBtn.addEventListener('click', function () { clear({ restoreFocus: true }); });+ copyBtn.addEventListener('click', copyLink);+ journeyPrevBtn.addEventListener('click', previousJourney);+ journeyPlayBtn.addEventListener('click', toggleJourney);+ journeyNextBtn.addEventListener('click', nextJourney);+ journeyOverviewBtn.addEventListener('click', function () { showJourneyOverview({ reveal: true }); });+ path.addEventListener('click', function (event) {+ var button = event.target.closest('[data-route-journey-index]');+ if (!button) return;+ selectJourneyIndex(Number(button.getAttribute('data-route-journey-index')));+ });+ path.addEventListener('focusin', function (event) {+ if (journeyPlaying && event.target.closest('[data-route-journey-index]')) pauseJourney({ preserveElapsed: true });+ });+ path.addEventListener('keydown', function (event) {+ var button = event.target.closest('[data-route-journey-index]');+ if (!button) return;+ var index = Number(button.getAttribute('data-route-journey-index'));+ var next = null;+ if (event.key === 'ArrowRight') next = Math.min(activeNodeIds.length - 1, index + 1);+ else if (event.key === 'ArrowLeft') next = Math.max(0, index - 1);+ else if (event.key === 'Home') next = 0;+ else if (event.key === 'End') next = activeNodeIds.length - 1;+ if (next !== null) {+ event.preventDefault();+ focusJourneyButton(next);+ return;+ }+ if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault();+ selectJourneyIndex(index);+ }+ });+ svg.addEventListener('click', interceptSelection, true);+ svg.addEventListener('keydown', interceptSelection, true);+ container.addEventListener('scroll', updateDocking, { passive: true });+ window.addEventListener('resize', requestDocking);+ window.addEventListener('beforeprint', function () {+ if (journeyPlaying) pauseJourney({ preserveElapsed: true, reason: 'print' });+ else removeJourneyPulse();+ });+ window.addEventListener('hashchange', function () { requestAnimationFrame(syncFromHash); });+ syncFromHash();++ return {+ begin: begin,+ choose: choose,+ clear: clear,+ toggle: toggle,+ escape: escapeRoute,+ copyLink: copyLink,+ playJourney: playJourney,+ pauseJourney: pauseJourney,+ showOverview: showJourneyOverview,+ selectJourneyIndex: selectJourneyIndex,+ syncMotion: syncJourneyMotion,+ isJourneyPlaying: function () { return journeyPlaying; },+ finderContext: finderContext,+ finderOpening: finderOpening,+ finderClosed: finderClosed,+ openFinder: openFinder,+ active: function () { return mode === 'idle' ? null : mode; },+ result: function () {+ return mode === 'result'+ ? { source: startId, target: endId, nodes: activeNodeIds.slice(), hops: activeEdges.length, journey: journeyIndex, playing: journeyPlaying }+ : null;+ }+ };+ })();++ /* ============================================================+ Semantic Lens — a counted, viewer-only legend over data-node-kind.+ One selected kind reveals every authored relationship touching it.+ Two selected kinds compare only direct cross-kind relationships while+ preserving the full diagram as a dimmed spatial reference.+ ============================================================ */+ Archify.semanticLens = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var trigger = document.getElementById('btn-semantic-lens');+ var panel = document.getElementById('semantic-lens');+ var closeBtn = document.getElementById('semantic-lens-close');+ var kindsRoot = document.getElementById('semantic-lens-kinds');+ var status = document.getElementById('semantic-lens-status');+ var copyBtn = document.getElementById('semantic-lens-copy');+ var clearBtn = document.getElementById('semantic-lens-clear');+ var legendBridge = svg.querySelector('[data-legend-bridge]');+ var legendEntries = [];+ var hoveredLegendEntry = null;+ var focusedLegendEntry = null;+ var activeLegendPreview = null;+ var lensOpener = trigger;+ var selectedKinds = [];+ var namespace = 'http://www.w3.org/2000/svg';+ var finePointerQuery = window.matchMedia ? window.matchMedia('(hover: hover) and (pointer: fine)') : null;+ var MAX_LENS_FLOW_EDGES = 24;++ function kindLabel(value) {+ return String(value || 'neutral')+ .replace(/messagebus/gi, 'message bus')+ .replace(/[-_]+/g, ' ')+ .replace(/\b\w/g, function (letter) { return letter.toUpperCase(); });+ }+ function nodesById() {+ var byId = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id][data-node-kind]'), function (node) {+ var id = node.getAttribute('data-node-id');+ if (id && !byId[id]) byId[id] = node;+ });+ return byId;+ }+ function collectKinds() {+ var kinds = {};+ var byId = nodesById();+ Object.keys(byId).forEach(function (id) {+ var node = byId[id];+ var value = node.getAttribute('data-node-kind') || 'neutral';+ var kind = kinds[value] || (kinds[value] = { id: value, label: kindLabel(value), nodes: [] });+ kind.nodes.push(node);+ });+ return Object.keys(kinds).map(function (key) { return kinds[key]; }).sort(function (a, b) {+ return b.nodes.length - a.nodes.length || a.label.localeCompare(b.label);+ });+ }+ function edgeGroups() {+ var groups = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var key = edge.getAttribute('data-edge-key') || [from, to, edge.getAttribute('data-edge-label') || ''].join('\u0000');+ if (!groups[key]) groups[key] = { key: key, from: from, to: to, members: [] };+ groups[key].members.push(edge);+ });+ return Object.keys(groups).map(function (key) { return groups[key]; });+ }+ function edgeShapes(edge) {+ if (!edge) return [];+ if (/^(path|line|polyline)$/i.test(edge.tagName || '')) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function legendSourceBounds(entry) {+ var bounds = null;+ Array.prototype.forEach.call(entry.children, function (child) {+ if (child.hasAttribute('data-legend-bridge-runtime')) return;+ var box;+ try { box = child.getBBox(); } catch (_) { return; }+ if (!box || !Number.isFinite(box.x) || !Number.isFinite(box.y)) return;+ var next = { left: box.x, top: box.y, right: box.x + box.width, bottom: box.y + box.height };+ if (!bounds) bounds = next;+ else {+ bounds.left = Math.min(bounds.left, next.left);+ bounds.top = Math.min(bounds.top, next.top);+ bounds.right = Math.max(bounds.right, next.right);+ bounds.bottom = Math.max(bounds.bottom, next.bottom);+ }+ });+ return bounds;+ }+ function layoutLegendEntry(entry) {+ var bounds = legendSourceBounds(entry);+ var hit = entry.querySelector('[data-legend-hit]');+ var badge = entry.querySelector('[data-legend-count-badge]');+ if (!bounds || !hit || !badge) return false;+ var count = entry.getAttribute('data-legend-count') || '0';+ var centerY = (bounds.top + bounds.bottom) / 2;+ var badgeWidth = Math.max(14, count.length * 5 + 8);+ var badgeX = bounds.right + 3;+ var hitX = bounds.left - 5;+ var hitRight = badgeX + badgeWidth + 4;+ hit.setAttribute('x', hitX.toFixed(2));+ hit.setAttribute('y', (centerY - 12).toFixed(2));+ hit.setAttribute('width', Math.max(24, hitRight - hitX).toFixed(2));+ hit.setAttribute('height', '24');+ hit.setAttribute('rx', '4');+ var badgeRect = badge.querySelector('rect');+ var badgeText = badge.querySelector('text');+ badgeRect.setAttribute('x', badgeX.toFixed(2));+ badgeRect.setAttribute('y', (centerY - 7).toFixed(2));+ badgeRect.setAttribute('width', badgeWidth.toFixed(2));+ badgeRect.setAttribute('height', '14');+ badgeRect.setAttribute('rx', '7');+ badgeText.setAttribute('x', (badgeX + badgeWidth / 2).toFixed(2));+ badgeText.setAttribute('y', (centerY + 2.5).toFixed(2));+ return true;+ }+ function layoutLegendBridge() {+ legendEntries.forEach(layoutLegendEntry);+ if (!legendBridge) return;+ Array.prototype.forEach.call(legendBridge.querySelectorAll('[data-legend-zero]'), layoutLegendEntry);+ }+ function decorateLegendBridge() {+ legendEntries = [];+ if (!legendBridge || html.getAttribute('data-embed') === 'true') return false;+ var facts = {};+ collectKinds().forEach(function (kind) { facts[kind.id] = kind; });+ Array.prototype.forEach.call(legendBridge.querySelectorAll('[data-legend-kind]'), function (entry) {+ var kind = entry.getAttribute('data-legend-kind');+ var fact = facts[kind];+ var count = fact ? fact.nodes.length : 0;+ entry.setAttribute('data-legend-count', String(count));+ var hit = document.createElementNS(namespace, 'rect');+ hit.setAttribute('data-legend-bridge-runtime', '');+ hit.setAttribute('data-legend-hit', '');+ hit.setAttribute('aria-hidden', 'true');+ entry.insertBefore(hit, entry.firstChild);+ var badge = document.createElementNS(namespace, 'g');+ badge.setAttribute('data-legend-bridge-runtime', '');+ badge.setAttribute('data-legend-count-badge', '');+ badge.setAttribute('aria-hidden', 'true');+ badge.appendChild(document.createElementNS(namespace, 'rect'));+ var countText = document.createElementNS(namespace, 'text');+ countText.textContent = String(count);+ badge.appendChild(countText);+ entry.appendChild(badge);+ if (!fact || !count) {+ entry.setAttribute('data-legend-zero', '');+ return;+ }+ entry.setAttribute('role', 'button');+ entry.setAttribute('tabindex', legendEntries.length ? '-1' : '0');+ entry.setAttribute('aria-label', 'Inspect ' + fact.label + ', ' + count + ' node' + (count === 1 ? '' : 's'));+ entry.setAttribute('aria-pressed', 'false');+ entry.setAttribute('aria-haspopup', 'dialog');+ entry.setAttribute('aria-controls', 'semantic-lens');+ entry.setAttribute('aria-expanded', 'false');+ legendEntries.push(entry);+ });+ if (!legendEntries.length) return false;+ legendBridge.setAttribute('role', legendEntries.length >= 3 ? 'toolbar' : 'group');+ legendBridge.setAttribute('aria-label', 'Semantic legend');+ syncLegendBridge();+ layoutLegendBridge();+ try {+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(layoutLegendBridge);+ } catch (_) {}+ return true;+ }+ function syncLegendBridge() {+ legendEntries.forEach(function (entry) {+ var selected = selectedKinds.indexOf(entry.getAttribute('data-legend-kind')) >= 0;+ entry.setAttribute('aria-pressed', selected ? 'true' : 'false');+ entry.setAttribute('aria-expanded', !panel.hidden && lensOpener === entry ? 'true' : 'false');+ if (selected) entry.setAttribute('data-legend-selected', '');+ else entry.removeAttribute('data-legend-selected');+ });+ }+ function clearLegendPreview() {+ activeLegendPreview = null;+ svg.removeAttribute('data-legend-preview-active');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer]'), function (element) {+ element.removeAttribute('data-legend-preview-match');+ element.removeAttribute('data-legend-preview-selected');+ element.removeAttribute('data-legend-preview-peer');+ });+ }+ function strongerLegendOwnerActive() {+ return selectedKinds.length > 0 || !panel.hidden || html.getAttribute('data-present') === 'true' ||+ svg.hasAttribute('data-focus-active') || svg.hasAttribute('data-intent-trace-active') ||+ svg.hasAttribute('data-route-picking') || svg.hasAttribute('data-route-active') ||+ svg.hasAttribute('data-story-active') || svg.hasAttribute('data-relationship-preview-active');+ }+ function previewLegendKind(entry) {+ clearLegendPreview();+ if (!entry || strongerLegendOwnerActive()) return false;+ var kind = entry.getAttribute('data-legend-kind');+ var byId = nodesById();+ var matches = Object.keys(byId).filter(function (id) {+ return (byId[id].getAttribute('data-node-kind') || 'neutral') === kind;+ });+ if (!matches.length) return false;+ var chosen = {};+ matches.forEach(function (id) {+ chosen[id] = true;+ byId[id].setAttribute('data-legend-preview-match', '');+ byId[id].setAttribute('data-legend-preview-selected', '');+ });+ edgeGroups().forEach(function (edge) {+ if (!chosen[edge.from] && !chosen[edge.to]) return;+ edge.members.forEach(function (member) { member.setAttribute('data-legend-preview-match', ''); });+ [edge.from, edge.to].forEach(function (id) {+ if (!byId[id] || chosen[id]) return;+ byId[id].setAttribute('data-legend-preview-match', '');+ byId[id].setAttribute('data-legend-preview-peer', '');+ });});+ svg.setAttribute('data-legend-preview-active', kind);+ activeLegendPreview = entry;+ return true;}-- var menu = document.getElementById('export-menu');- var btn = document.getElementById('btn-export');- var items = function () {- return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));- };-- // ---- Clipboard support ----------------------------------------------- function canCopyImage() {- return typeof ClipboardItem !== 'undefined' &&- navigator.clipboard &&- typeof navigator.clipboard.write === 'function';+ function syncLegendPreview() {+ var next = focusedLegendEntry || hoveredLegendEntry;+ if (next === activeLegendPreview) return;+ clearLegendPreview();+ if (next) previewLegendKind(next);}-- // ---- Raster format detection ----------------------------------------- // canvas.toBlob('image/webp') silently returns a PNG on browsers without- // WebP encoding (older Safari), so detect explicitly.- function supports(format) {- if (format === 'svg' || format === 'png') return true;- var mime = format === 'jpeg' ? 'image/jpeg' : 'image/webp';- try {- var c = document.createElement('canvas');- c.width = c.height = 2;- return c.toDataURL(mime).indexOf('data:' + mime) === 0;- } catch (_) { return false; }+ function activateLegendEntry(entry) {+ if (!entry || entry.getAttribute('role') !== 'button') return false;+ clearLegendPreview();+ select(entry.getAttribute('data-legend-kind'));+ return open({ opener: entry });}-- // Gray out unsupported items.- items().forEach(function (it) {- if (it.dataset.format && !supports(it.dataset.format)) {- it.disabled = true;- it.title = 'Not supported by this browser';- it.style.opacity = '0.5';+ function removeFlowOverlay() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-semantic-lens-overlay]'), function (element) {+ element.remove();+ });+ svg.removeAttribute('data-lens-flow-count');+ svg.removeAttribute('data-lens-flow-density');+ }+ function flowGeometry(shape, direction, step) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-hidden');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-lens-match');+ clone.setAttribute('class', 'semantic-lens-flow');+ clone.setAttribute('data-direction', direction);+ clone.setAttribute('pathLength', '1');+ clone.style.setProperty('--lens-flow-delay', (step * 0.08).toFixed(2) + 's');+ return clone;+ }+ function renderFlowOverlay(entries) {+ removeFlowOverlay();+ svg.setAttribute('data-lens-flow-count', String(entries.length));+ if (!entries.length || html.getAttribute('data-embed') === 'true') return false;+ if (entries.length > MAX_LENS_FLOW_EDGES) {+ svg.setAttribute('data-lens-flow-density', 'quiet');+ return false;}- if (it.dataset.action === 'copy' && !canCopyImage()) {- it.disabled = true;- it.title = 'Clipboard image write not supported by this browser';- it.style.opacity = '0.5';+ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'semantic-lens-overlay');+ overlay.setAttribute('data-semantic-lens-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ entries.forEach(function (entry, step) {+ var wrapper = document.createElementNS(namespace, 'g');+ if (entry.edge.members[0].hasAttribute('transform')) {+ wrapper.setAttribute('transform', entry.edge.members[0].getAttribute('transform'));+ }+ edgeShapes(entry.edge.members[0]).forEach(function (shape) {+ wrapper.appendChild(flowGeometry(shape, entry.direction, step));+ });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ if (!overlay.childNodes.length) return false;+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ return true;+ }+ function cleanSvgState() {+ removeFlowOverlay();+ svg.removeAttribute('data-lens-active');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-lens-match], [data-lens-selected], [data-lens-peer]'), function (element) {+ element.removeAttribute('data-lens-match');+ element.removeAttribute('data-lens-selected');+ element.removeAttribute('data-lens-peer');+ });+ }+ function renderKinds() {+ kindsRoot.textContent = '';+ collectKinds().forEach(function (kind) {+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'semantic-lens-kind';+ button.setAttribute('data-kind', kind.id);+ button.setAttribute('aria-pressed', selectedKinds.indexOf(kind.id) >= 0 ? 'true' : 'false');+ button.setAttribute('aria-label', kind.label + ', ' + kind.nodes.length + ' node' + (kind.nodes.length === 1 ? '' : 's'));+ button.disabled = selectedKinds.length >= 2 && selectedKinds.indexOf(kind.id) === -1;+ var swatch = document.createElement('span');+ swatch.className = 'semantic-lens-swatch';+ swatch.setAttribute('aria-hidden', 'true');+ var label = document.createElement('strong');+ label.textContent = kind.label;+ var count = document.createElement('em');+ count.textContent = String(kind.nodes.length);+ button.appendChild(swatch);+ button.appendChild(label);+ button.appendChild(count);+ kindsRoot.appendChild(button);+ });+ }+ function updateHash() {+ try {+ var hash = selectedKinds.length+ ? '#lens=' + selectedKinds.map(encodeURIComponent).join('~')+ : '';+ history.replaceState(null, '', location.pathname + location.search + hash);+ } catch (_) {}+ }+ function updateTrigger() {+ var active = selectedKinds.length > 0;+ trigger.setAttribute('aria-pressed', active ? 'true' : 'false');+ trigger.setAttribute('aria-label', active ? 'Open active semantic lens' : 'Open semantic lens');+ copyBtn.hidden = !active;+ syncLegendBridge();+ }+ function overlapArea(a, b) {+ var width = Math.max(0, Math.min(a.right, b.right) - Math.max(a.left, b.left));+ var height = Math.max(0, Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top));+ return width * height;+ }+ function dockPanel(byId) {+ panel.removeAttribute('data-dock-side');+ if (panel.hidden || !selectedKinds.length || window.innerWidth <= 720) return 'right';+ var panelRect = panel.getBoundingClientRect();+ var containerRect = container.getBoundingClientRect();+ if (!panelRect.width || !panelRect.height) return 'right';+ var selectedRects = Object.keys(byId).filter(function (id) {+ return selectedKinds.indexOf(byId[id].getAttribute('data-node-kind') || 'neutral') >= 0;+ }).map(function (id) { return byId[id].getBoundingClientRect(); });+ var top = panelRect.top;+ var width = panelRect.width;+ var leftCandidate = { left: containerRect.left + 16, right: containerRect.left + 16 + width, top: top, bottom: panelRect.bottom };+ var rightCandidate = { left: containerRect.right - 16 - width, right: containerRect.right - 16, top: top, bottom: panelRect.bottom };+ var leftScore = selectedRects.reduce(function (score, rect) { return score + overlapArea(leftCandidate, rect); }, 0);+ var rightScore = selectedRects.reduce(function (score, rect) { return score + overlapArea(rightCandidate, rect); }, 0);+ var side = leftScore < rightScore ? 'left' : 'right';+ panel.setAttribute('data-dock-side', side);+ return side;+ }+ function applySelection(options) {+ options = options || {};+ cleanSvgState();+ var byId = nodesById();+ var nodeKind = {};+ Object.keys(byId).forEach(function (id) { nodeKind[id] = byId[id].getAttribute('data-node-kind') || 'neutral'; });+ if (!selectedKinds.length) {+ status.textContent = 'Choose a kind to inspect its nodes and touching relationships.';+ updateTrigger();+ renderKinds();+ dockPanel(byId);+ if (options.updateUrl !== false) updateHash();+ return false;}- });- // ---- Toast ----------------------------------------------------------- // A live region only announces CHANGES to an existing node, so the toast- // element is created once up front and updated in place.- var toastEl = document.createElement('div');- toastEl.className = 'archify-toast';- toastEl.setAttribute('role', 'status');- document.body.appendChild(toastEl);- var toastTimer = null;+ var chosen = {};+ selectedKinds.forEach(function (kind) { chosen[kind] = true; });+ Object.keys(byId).forEach(function (id) {+ if (!chosen[nodeKind[id]]) return;+ byId[id].setAttribute('data-lens-match', '');+ byId[id].setAttribute('data-lens-selected', '');+ });- function toast(msg) {- toastEl.textContent = '';+ var touching = 0;+ var forward = 0;+ var reverse = 0;+ var crossKind = selectedKinds.length === 2;+ var matchedFlow = [];+ edgeGroups().forEach(function (edge) {+ var fromKind = nodeKind[edge.from];+ var toKind = nodeKind[edge.to];+ var match = false;+ if (crossKind) {+ if (fromKind === selectedKinds[0] && toKind === selectedKinds[1]) { match = true; forward += 1; }+ if (fromKind === selectedKinds[1] && toKind === selectedKinds[0]) { match = true; reverse += 1; }+ } else if (fromKind === selectedKinds[0] || toKind === selectedKinds[0]) {+ match = true;+ touching += 1;+ }+ if (!match) return;+ var direction = 'within';+ if (crossKind) {+ direction = fromKind === selectedKinds[0] ? 'forward' : 'reverse';+ } else {+ direction = fromKind === selectedKinds[0] && toKind !== selectedKinds[0] ? 'out'+ : (toKind === selectedKinds[0] && fromKind !== selectedKinds[0] ? 'in' : 'within');+ }+ matchedFlow.push({ edge: edge, direction: direction });+ edge.members.forEach(function (member) { member.setAttribute('data-lens-match', ''); });+ if (!crossKind) {+ [edge.from, edge.to].forEach(function (id) {+ if (!byId[id]) return;+ byId[id].setAttribute('data-lens-match', '');+ if (!chosen[nodeKind[id]]) byId[id].setAttribute('data-lens-peer', '');+ });+ }+ });++ svg.setAttribute('data-lens-active', selectedKinds.join(' '));+ renderFlowOverlay(matchedFlow);+ if (crossKind) {+ var total = forward + reverse;+ status.textContent = kindLabel(selectedKinds[0]) + ' → ' + kindLabel(selectedKinds[1]) + ': ' + forward + ' · ' ++ kindLabel(selectedKinds[1]) + ' → ' + kindLabel(selectedKinds[0]) + ': ' + reverse + ' · ' ++ total + ' direct relationship' + (total === 1 ? '' : 's');+ } else {+ var nodeCount = collectKinds().filter(function (kind) { return kind.id === selectedKinds[0]; })[0].nodes.length;+ status.textContent = nodeCount + ' ' + kindLabel(selectedKinds[0]) + ' node' + (nodeCount === 1 ? '' : 's') + ' · ' ++ touching + ' touching relationship' + (touching === 1 ? '' : 's') + ' · connected peers remain visible';+ }+ updateTrigger();+ renderKinds();+ dockPanel(byId);+ if (options.updateUrl !== false) updateHash();+ return true;+ }+ function prepareForLens() {+ clearLegendPreview();+ if (Archify.focus && typeof Archify.focus.clear === 'function') {+ Archify.focus.clear({ updateUrl: false, preserveView: true });+ }+ if (Archify.routeProbe && typeof Archify.routeProbe.clear === 'function') {+ Archify.routeProbe.clear({ updateUrl: false, restoreFocus: false });+ }+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') {+ Archify.intentTrace.clear({ announce: false });+ }+ }+ function select(kind, options) {+ options = options || {};+ clearLegendPreview();+ var exists = collectKinds().some(function (entry) { return entry.id === kind; });+ if (!exists) return false;+ var index = selectedKinds.indexOf(kind);+ if (index >= 0) selectedKinds.splice(index, 1);+ else {+ if (selectedKinds.length >= 2) return false;+ if (!selectedKinds.length) prepareForLens();+ selectedKinds.push(kind);+ }+ return applySelection(options);+ }+ function close(options) {+ options = options || {};+ panel.hidden = true;+ trigger.setAttribute('aria-expanded', 'false');+ updateTrigger();+ if (options.restoreFocus !== false && lensOpener && typeof lensOpener.focus === 'function') lensOpener.focus();+ return false;+ }+ function open(options) {+ options = options || {};+ if (html.getAttribute('data-embed') === 'true') return false;+ lensOpener = options.opener || trigger;+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);+ if (Archify.finder && Archify.finder.isOpen()) Archify.finder.close({ restoreFocus: false });+ if (Archify.radar && Archify.radar.isOpen()) Archify.radar.close({ restoreFocus: false });+ if (Archify.guide && Archify.guide.isOpen()) Archify.guide.close({ restoreFocus: false });+ renderKinds();+ panel.hidden = false;+ trigger.setAttribute('aria-expanded', 'true');+ updateTrigger();requestAnimationFrame(function () {- toastEl.textContent = msg;- toastEl.classList.add('show');+ dockPanel(nodesById());+ var activeButton = kindsRoot.querySelector('[aria-pressed="true"]');+ var firstButton = activeButton || kindsRoot.querySelector('button:not(:disabled)');+ if (firstButton) firstButton.focus();});- clearTimeout(toastTimer);- toastTimer = setTimeout(function () { toastEl.classList.remove('show'); }, 1500);+ return true;}-- function open(focusLast) {- menu.classList.add('open');- btn.setAttribute('aria-expanded', 'true');- var available = items().filter(function (i) { return !i.disabled; });- var target = focusLast ? available[available.length - 1] : available[0];- if (target) target.focus();+ function toggle() { return panel.hidden ? open({ opener: trigger }) : close(); }+ function clear(options) {+ options = options || {};+ selectedKinds = [];+ cleanSvgState();+ panel.removeAttribute('data-dock-side');+ updateTrigger();+ renderKinds();+ status.textContent = 'Choose a kind to inspect its nodes and touching relationships.';+ if (options.updateUrl !== false) updateHash();+ if (options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ if (options.closePanel === true) close({ restoreFocus: false });+ return false;}- function close(focusTrigger) {- menu.classList.remove('open');- btn.setAttribute('aria-expanded', 'false');- if (focusTrigger) btn.focus();+ function fallbackCopy(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }+ function copyLink() {+ if (!selectedKinds.length) return Promise.resolve(false);+ var value = location.href.replace(/#.*$/, '') + '#lens=' + selectedKinds.map(encodeURIComponent).join('~');+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })+ : Promise.resolve(fallbackCopy(value));+ return copy.then(function (copied) {+ copyBtn.textContent = copied ? 'Copied' : 'Copy failed';+ window.setTimeout(function () { copyBtn.textContent = 'Copy link'; }, 1600);+ return copied;+ });+ }+ function syncFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var value = params.get('lens');+ if (!value) {+ if (selectedKinds.length) clear({ updateUrl: false, preserveView: true });+ return;+ }+ var available = collectKinds().map(function (kind) { return kind.id; });+ var requested = value.split('~').filter(function (kind, index, list) {+ return available.indexOf(kind) >= 0 && list.indexOf(kind) === index;+ }).slice(0, 2);+ if (!requested.length) return;+ prepareForLens();+ selectedKinds = requested;+ applySelection({ updateUrl: false });+ } catch (_) {}}- function isOpen() { return menu.classList.contains('open'); }- btn.addEventListener('click', function (e) {- e.stopPropagation();- if (isOpen()) close(false);- else open();+ trigger.addEventListener('click', toggle);+ if (decorateLegendBridge()) {+ legendBridge.addEventListener('click', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (entry) activateLegendEntry(entry);+ });+ legendBridge.addEventListener('pointerover', function (event) {+ if (event.pointerType === 'touch' || (finePointerQuery && !finePointerQuery.matches)) return;+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry || (event.relatedTarget && entry.contains(event.relatedTarget))) return;+ hoveredLegendEntry = entry;+ syncLegendPreview();+ });+ legendBridge.addEventListener('pointerout', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry || (event.relatedTarget && entry.contains(event.relatedTarget))) return;+ if (hoveredLegendEntry === entry) hoveredLegendEntry = null;+ syncLegendPreview();+ });+ legendBridge.addEventListener('focusin', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry) return;+ focusedLegendEntry = entry;+ legendEntries.forEach(function (candidate) {+ candidate.setAttribute('tabindex', candidate === entry ? '0' : '-1');+ });+ syncLegendPreview();+ });+ legendBridge.addEventListener('focusout', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry || (event.relatedTarget && entry.contains(event.relatedTarget))) return;+ if (focusedLegendEntry === entry) focusedLegendEntry = null;+ syncLegendPreview();+ });+ legendBridge.addEventListener('keydown', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry) return;+ if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault();+ activateLegendEntry(entry);+ return;+ }+ var index = legendEntries.indexOf(entry);+ var next = null;+ if (event.key === 'ArrowRight') next = (index + 1) % legendEntries.length;+ else if (event.key === 'ArrowLeft') next = (index - 1 + legendEntries.length) % legendEntries.length;+ else if (event.key === 'Home') next = 0;+ else if (event.key === 'End') next = legendEntries.length - 1;+ if (next === null) return;+ event.preventDefault();+ legendEntries.forEach(function (candidate, candidateIndex) {+ candidate.setAttribute('tabindex', candidateIndex === next ? '0' : '-1');+ });+ legendEntries[next].focus();+ });+ }+ closeBtn.addEventListener('click', function () { close(); });+ clearBtn.addEventListener('click', function () { clear({ preserveView: true }); });+ copyBtn.addEventListener('click', copyLink);+ kindsRoot.addEventListener('click', function (event) {+ var button = event.target.closest('[data-kind]');+ if (!button || button.disabled) return;+ select(button.getAttribute('data-kind'));});- // APG menu-button pattern: ArrowDown/ArrowUp on the trigger opens the menu.- btn.addEventListener('keydown', function (e) {- if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {- e.preventDefault();- if (!isOpen()) open(e.key === 'ArrowUp');- }+ kindsRoot.addEventListener('keydown', function (event) {+ var buttons = Array.prototype.slice.call(kindsRoot.querySelectorAll('button:not(:disabled)'));+ var index = buttons.indexOf(document.activeElement);+ var next = null;+ if (index >= 0 && (event.key === 'ArrowRight' || event.key === 'ArrowDown')) next = (index + 1) % buttons.length;+ else if (index >= 0 && (event.key === 'ArrowLeft' || event.key === 'ArrowUp')) next = (index - 1 + buttons.length) % buttons.length;+ else if (event.key === 'Home' && buttons.length) next = 0;+ else if (event.key === 'End' && buttons.length) next = buttons.length - 1;+ if (next !== null) { event.preventDefault(); buttons[next].focus(); }});- document.addEventListener('click', function (e) {- if (!menu.contains(e.target) && e.target !== btn) close(false);+ panel.addEventListener('keydown', function (event) {+ if (event.key !== 'Escape') return;+ event.preventDefault();+ event.stopPropagation();+ close();+ });+ document.addEventListener('click', function (event) {+ var eventPath = typeof event.composedPath === 'function' ? event.composedPath() : [];+ var clickedInside = eventPath.indexOf(panel) >= 0 || panel.contains(event.target);+ var clickedLauncher = event.target === trigger || legendEntries.some(function (entry) {+ return event.target === entry || entry.contains(event.target);+ });+ if (!panel.hidden && !clickedInside && !clickedLauncher) close({ restoreFocus: false });+ });+ window.addEventListener('hashchange', syncFromHash);+ window.addEventListener('resize', function () {+ if (!panel.hidden && selectedKinds.length) dockPanel(nodesById());+ layoutLegendBridge();});+ renderKinds();+ syncFromHash();- // Keyboard navigation inside the menu.- // Menu items: Up/Down, Home/End.- // Esc closes + returns focus to trigger; Tab closes.- menu.addEventListener('keydown', function (e) {- if (e.key === 'Escape') { e.preventDefault(); close(true); return; }- if (e.key === 'Tab') { close(false); return; }+ return {+ open: open,+ close: close,+ toggle: toggle,+ clear: clear,+ clearPreview: clearLegendPreview,+ select: select,+ copyLink: copyLink,+ isOpen: function () { return !panel.hidden; },+ active: function () { return selectedKinds.length ? selectedKinds.slice() : null; },+ kinds: function () { return collectKinds().map(function (kind) { return { id: kind.id, count: kind.nodes.length }; }); }+ };+ })();- var available = items().filter(function (i) { return !i.disabled; });- var current = available.indexOf(document.activeElement);- switch (e.key) {- case 'ArrowDown':- e.preventDefault();- if (available.length) available[(current + 1 + available.length) % available.length].focus();- break;- case 'ArrowUp':- e.preventDefault();- if (available.length) available[(current - 1 + available.length) % available.length].focus();- break;- case 'Home':- e.preventDefault();- if (available[0]) available[0].focus();- break;- case 'End':- e.preventDefault();- if (available.length) available[available.length - 1].focus();- break;- }- });+ /* ============================================================+ Diagram Guide — a factual command deck over existing interactions.+ Counts come from compiled semantics; actions delegate to Finder, Route+ Probe, Semantic Radar, Semantic Lens, Story Trail, Presentation, theme, export, and+ camera without adding a second command implementation or SVG state.+ ============================================================ */+ Archify.guide = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var trigger = document.getElementById('btn-diagram-guide');+ var panel = document.getElementById('diagram-guide');+ var closeBtn = document.getElementById('diagram-guide-close');+ var stats = document.getElementById('diagram-guide-stats');+ var actions = document.getElementById('diagram-guide-actions');+ var feedback = document.getElementById('diagram-guide-feedback');+ var storyBtn = actions.querySelector('[data-guide-action="story"]');+ var storyCopy = document.getElementById('diagram-guide-story-copy');+ var routePanel = document.getElementById('route-probe');- function runExport(format) {- var base = diagramFilename();- close(true);- return (format === 'svg'- ? Promise.resolve(serializeSvg(1, { autoTheme: true })).then(function (d) {- download(new Blob([d.svgString], { type: 'image/svg+xml;charset=utf-8' }), base + '.svg');- })- : rasterize(format).then(function (blob) {- download(blob, base + '.' + format);- })- ).catch(function (err) {- console.error(err);- alert('Export failed: ' + (err && err.message ? err.message : format));+ function viewCount() {+ return Archify.guidedViews && Number(Archify.guidedViews.count) || 0;+ }+ function relationshipCount() {+ var seen = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var key = edge.getAttribute('data-edge-key') || [+ edge.getAttribute('data-edge-from'),+ edge.getAttribute('data-edge-to'),+ edge.getAttribute('data-edge-label') || ''+ ].join('\u0000');+ seen[key] = true;});+ return Object.keys(seen).length;}-- function runCopy() {- close(true);- if (!canCopyImage()) {- alert('Clipboard image write not supported in this browser.');- return;+ function renderFacts() {+ var nodes = svg.querySelectorAll('[data-node-id]').length;+ var relationships = relationshipCount();+ var views = viewCount();+ stats.textContent = nodes + ' semantic node' + (nodes === 1 ? '' : 's') + ' · ' ++ relationships + ' relationship' + (relationships === 1 ? '' : 's') + ' · ' ++ views + ' guided view' + (views === 1 ? '' : 's');+ storyBtn.disabled = views === 0;+ storyBtn.setAttribute('aria-disabled', views === 0 ? 'true' : 'false');+ storyCopy.textContent = views+ ? 'Walk ' + views + ' authored chapter' + (views === 1 ? '' : 's') + ' and their real relationships.'+ : 'No authored guided story in this diagram.';+ }+ function actionButtons() {+ return Array.prototype.slice.call(actions.querySelectorAll('.diagram-guide-action:not(:disabled)'));+ }+ function close(options) {+ options = options || {};+ panel.hidden = true;+ html.removeAttribute('data-guide-open');+ routePanel.removeAttribute('data-guide-open');+ trigger.setAttribute('aria-expanded', 'false');+ trigger.setAttribute('aria-label', 'Open diagram guide');+ feedback.textContent = '';+ if (options.restoreFocus !== false) trigger.focus();+ return false;+ }+ function open() {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);+ if (Archify.finder && Archify.finder.isOpen()) Archify.finder.close({ restoreFocus: false });+ if (Archify.radar && Archify.radar.isOpen()) Archify.radar.close({ restoreFocus: false });+ if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });+ if (Archify.guidedViews && Archify.guidedViews.isPlaying && Archify.guidedViews.isPlaying()) {+ Archify.guidedViews.pause();}- // WebKit requires ClipboardItem to be constructed synchronously inside- // the user gesture — pass the pending Promise<Blob> as the item value.- // Browsers that reject promise values throw synchronously; fall back- // to awaiting the blob first (works in Chromium/Firefox).- var blobPromise = rasterize('png');- var writePromise;- try {- writePromise = navigator.clipboard.write([new ClipboardItem({ 'image/png': blobPromise })]);- } catch (_) {- writePromise = blobPromise.then(function (blob) {- return navigator.clipboard.write([new ClipboardItem({ 'image/png': blob })]);- });+ if (Archify.routeProbe && Archify.routeProbe.isJourneyPlaying && Archify.routeProbe.isJourneyPlaying()) {+ Archify.routeProbe.pauseJourney({ preserveElapsed: true, reason: 'guide' });}- return writePromise.then(function () {- toast('Copied PNG to clipboard');- }).catch(function (err) {- console.error(err);- alert('Copy failed: ' + (err && err.message ? err.message : 'unknown'));+ renderFacts();+ panel.hidden = false;+ html.setAttribute('data-guide-open', 'true');+ routePanel.setAttribute('data-guide-open', 'true');+ trigger.setAttribute('aria-expanded', 'true');+ trigger.setAttribute('aria-label', 'Close diagram guide');+ feedback.textContent = '';+ requestAnimationFrame(function () {+ var first = actionButtons()[0];+ if (first) first.focus();});+ return true;+ }+ function toggle() { return panel.hidden ? open() : close(); }+ function execute(action) {+ feedback.textContent = '';+ if (action === 'story' && !viewCount()) {+ feedback.textContent = 'This diagram has no authored guided story.';+ return false;+ }+ close({ restoreFocus: false });+ if (action === 'find') return Archify.finder.open();+ if (action === 'route') return Archify.routeProbe.begin({ focusNode: true });+ if (action === 'map') return Archify.radar.open();+ if (action === 'lens') return Archify.semanticLens.open();+ if (action === 'story') return Archify.guidedViews.play();+ if (action === 'present') return Archify.presentation.enter();+ if (action === 'export') return Archify.exportMenu.open();+ if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();+ if (action === 'reset') return Archify.view.reset();+ if (action === 'zoom-in') return Archify.view.zoomIn();+ if (action === 'zoom-out') return Archify.view.zoomOut();+ return false;+ }+ function actionForKey(key) {+ return {+ '/': 'find',+ r: 'route',+ m: 'map',+ l: 'lens',+ p: 'story',+ f: 'present',+ e: 'export',+ t: 'theme',+ s: 'preset',+ '0': 'reset',+ '+': 'zoom-in',+ '=': 'zoom-in',+ '-': 'zoom-out'+ }[key] || null;}- menu.addEventListener('click', function (e) {- var copyBtn = e.target.closest('button[data-action="copy"]');- if (copyBtn && !copyBtn.disabled) { runCopy(); return; }-- var formatBtn = e.target.closest('button[data-format]');- if (formatBtn && !formatBtn.disabled) { runExport(formatBtn.dataset.format); }+ trigger.addEventListener('click', toggle);+ closeBtn.addEventListener('click', function () { close(); });+ actions.addEventListener('click', function (event) {+ var button = event.target.closest('[data-guide-action]');+ if (!button || button.disabled) return;+ event.stopPropagation();+ execute(button.getAttribute('data-guide-action'));+ });+ panel.addEventListener('keydown', function (event) {+ if (event.key === 'Escape' || event.key === '?') {+ event.preventDefault();+ event.stopPropagation();+ close();+ return;+ }+ var buttons = actionButtons();+ var index = buttons.indexOf(document.activeElement);+ var next = null;+ if (index >= 0 && event.key === 'ArrowRight') next = (index + 1) % buttons.length;+ else if (index >= 0 && event.key === 'ArrowDown') next = (index + 1) % buttons.length;+ else if (index >= 0 && event.key === 'ArrowLeft') next = (index - 1 + buttons.length) % buttons.length;+ else if (index >= 0 && event.key === 'ArrowUp') next = (index - 1 + buttons.length) % buttons.length;+ else if (event.key === 'Home' && buttons.length) next = 0;+ else if (event.key === 'End' && buttons.length) next = buttons.length - 1;+ if (next !== null) {+ event.preventDefault();+ event.stopPropagation();+ buttons[next].focus();+ return;+ }+ var action = actionForKey(event.key.length === 1 ? event.key.toLowerCase() : event.key);+ if (!action) return;+ event.preventDefault();+ event.stopPropagation();+ execute(action);+ });+ document.addEventListener('click', function (event) {+ if (!panel.hidden && !panel.contains(event.target) && event.target !== trigger) close({ restoreFocus: false });});- Archify.exportMenu = { open: open, close: close, isOpen: isOpen, run: runExport };-- // Auto-open on page load for demo/screenshot purposes: ?openExport=1- // Wait for fonts (so the menu doesn't flash before typography lands)- // and paint before opening. Fallback timeout for browsers without the- // Font Loading API.- try {- if (new URLSearchParams(window.location.search).get('openExport') === '1') {- var openWhenReady = function () {- requestAnimationFrame(function () { requestAnimationFrame(open); });+ renderFacts();+ return {+ open: open,+ close: close,+ toggle: toggle,+ execute: execute,+ isOpen: function () { return !panel.hidden; },+ facts: function () {+ return {+ nodes: svg.querySelectorAll('[data-node-id]').length,+ relationships: relationshipCount(),+ views: viewCount()};- if (document.fonts && document.fonts.ready) {- document.fonts.ready.then(openWhenReady);- } else {- setTimeout(openWhenReady, 200);- }}- } catch (_) {}+ };})();/* ============================================================Global keyboard shortcuts- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menu+ F -> toggle presentation stage+ M -> toggle Semantic Radar+ L -> toggle Semantic Lens+ R -> start/clear Route Probe+ / -> open node finder or the active route endpoint picker+ + / - -> zoom, 0 -> reset view+ Escape -> clear temporary trace/focus/view first, then exit presentationIgnored when focus is inside an input/textarea/contenteditable.============================================================ */document.addEventListener('keydown', function (e) {if (e.metaKey || e.ctrlKey || e.altKey) return;+ if (e.defaultPrevented) return;var t = e.target;if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;- if (e.key === 't' || e.key === 'T') {+ if (e.key === '?') {+ e.preventDefault();+ Archify.guide.toggle();+ } else if (e.key === '/') {+ e.preventDefault();+ Archify.finder.open();+ } else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();+ } else if (e.key === 'f' || e.key === 'F') {+ e.preventDefault();+ Archify.presentation.toggle();+ } else if (e.key === 'm' || e.key === 'M') {+ e.preventDefault();+ Archify.radar.toggle();+ } else if (e.key === 'l' || e.key === 'L') {+ e.preventDefault();+ Archify.semanticLens.toggle();+ } else if (e.key === 'r' || e.key === 'R') {+ e.preventDefault();+ Archify.routeProbe.toggle({ focusNode: true });+ } else if (e.key === '+' || e.key === '=') {+ e.preventDefault();+ Archify.view.zoomIn();+ } else if (e.key === '-') {+ e.preventDefault();+ Archify.view.zoomOut();+ } else if (e.key === '0') {+ e.preventDefault();+ Archify.view.reset();+ } else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {+ e.preventDefault();+ Archify.semanticLens.close({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.semanticLens.active()) {+ e.preventDefault();+ Archify.semanticLens.clear({ preserveView: true });+ } else if (e.key === 'Escape' && Archify.guide.isOpen()) {+ e.preventDefault();+ Archify.guide.close({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.radar.isOpen()) {+ e.preventDefault();+ Archify.radar.close({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.routeProbe.active()) {+ e.preventDefault();+ Archify.routeProbe.escape({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.intentTrace.active()) {+ e.preventDefault();+ Archify.intentTrace.clear();+ } else if (e.key === 'Escape' && Archify.focus.active()) {+ e.preventDefault();+ Archify.focus.clear();+ } else if (e.key === 'Escape' && Archify.presentation.active()) {+ e.preventDefault();+ Archify.presentation.exit();}});</script>diff --git a/examples/sequence-cache-miss-request.html b/examples/sequence-cache-miss-request.htmlindex 4da7ab5f..e47ebef4 100644--- a/examples/sequence-cache-miss-request.html+++ b/examples/sequence-cache-miss-request.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4135,7 +4161,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4287,10 +4313,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11181,6 +11251,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11196,6 +11267,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11262,9 +11334,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11288,6 +11361,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/examples/web-app-rendered.html b/examples/web-app-rendered.htmlindex 63e2d407..b64147bc 100644--- a/examples/web-app-rendered.html+++ b/examples/web-app-rendered.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4102,7 +4128,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4252,10 +4278,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11146,6 +11216,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11161,6 +11232,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11227,9 +11299,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11253,6 +11326,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/examples/web-app.html b/examples/web-app.htmlindex 63e2d407..b64147bc 100644--- a/examples/web-app.html+++ b/examples/web-app.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4102,7 +4128,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4252,10 +4278,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11146,6 +11216,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11161,6 +11232,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11227,9 +11299,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11253,6 +11326,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();diff --git a/examples/workflow-agent-tool-call-rendered.html b/examples/workflow-agent-tool-call-rendered.htmlindex 5636950a..75895bb0 100644--- a/examples/workflow-agent-tool-call-rendered.html+++ b/examples/workflow-agent-tool-call-rendered.html@@ -505,10 +505,10 @@.container { max-width: 1200px; margin: 0 auto; }- .header { margin-bottom: 2rem; padding-right: 23rem; }+ .header { margin-bottom: 2rem; padding-right: 29.5rem; }html[data-preset="signal-flow"] .header,- html[data-preset="blueprint"] .header { padding-right: 23rem; }+ html[data-preset="blueprint"] .header { padding-right: 29.5rem; }.header-row {display: flex;@@ -2541,6 +2541,26 @@.toolbar #btn-motion[hidden] { display: none !important; }.toolbar #btn-motion { min-width: 4.4rem; }.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }.motion-control-dot {width: 0.46rem;height: 0.46rem;@@ -2939,7 +2959,7 @@.toolbar { gap: 0.25rem; }.toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }.toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }- #theme-label, #present-label { display: none; }+ #theme-label, #preset-label, #present-label { display: none; }.guided-view-handoff { max-width: 6.5rem; }}@@ -3727,9 +3747,9 @@</style></head><body>- <!-- Toolbar: theme, trace motion, presentation stage, and export.+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.Motion appears only for trace-enabled artifacts and has no shortcut;- Keyboard: T toggles theme, F toggles the stage, E opens export. -->+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. --><div class="toolbar" role="toolbar" aria-label="Diagram actions"><button id="btn-theme" type="button"title="Toggle theme (T)"@@ -3738,6 +3758,12 @@<span id="theme-icon" aria-hidden="true">☾</span><span id="theme-label">Dark</span></button>+ <button id="btn-preset" type="button"+ title="Cycle visual style (S)"+ aria-label="Cycle visual style">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">Style</span>+ </button><button id="btn-motion" type="button" hiddentitle="Pause motion"aria-label="Pause motion"@@ -4161,7 +4187,7 @@</button></div><div class="diagram-guide-shortcuts" aria-label="Additional keyboard shortcuts">- <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span>+ <span><kbd>E</kbd> Export</span><span><kbd>T</kbd> Theme</span><span><kbd>S</kbd> Style</span><span><kbd>0</kbd> Reset</span><span><kbd>+</kbd> Zoom in</span><span><kbd>-</kbd> Zoom out</span><span><kbd>Esc</kbd> Close</span></div><p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p></div>@@ -4316,10 +4342,54 @@</div><script>+ var Archify = {};++ /* ============================================================+ Visual style try-on — one topology, three bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint'];+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ var next = nextAfter(preset);+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);+ btn.title = 'Cycle visual style (S)';+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ apply(authored);+ btn.addEventListener('click', cycle);+ return { cycle: cycle, apply: apply, current: current, authored: authored };+ })();+/* ============================================================Theme toggle — persists to localStorage, respects system pref============================================================ */- var Archify = {};Archify.theme = (function () {var STORAGE_KEY = 'archify-theme';@@ -11210,6 +11280,7 @@if (action === 'present') return Archify.presentation.enter();if (action === 'export') return Archify.exportMenu.open();if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();if (action === 'reset') return Archify.view.reset();if (action === 'zoom-in') return Archify.view.zoomIn();if (action === 'zoom-out') return Archify.view.zoomOut();@@ -11225,6 +11296,7 @@f: 'present',e: 'export',t: 'theme',+ s: 'preset','0': 'reset','+': 'zoom-in','=': 'zoom-in',@@ -11291,9 +11363,10 @@/* ============================================================Global keyboard shortcuts- ? -> open Diagram Guide- T -> toggle theme- E -> open export menu+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menuF -> toggle presentation stageM -> toggle Semantic RadarL -> toggle Semantic Lens@@ -11317,6 +11390,9 @@} else if (e.key === 't' || e.key === 'T') {e.preventDefault();Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();} else if (e.key === 'e' || e.key === 'E') {e.preventDefault();if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();