:root {
  color-scheme: light;
  --bg: #f4f6f4;
  --ink: #202727;
  --muted: #66726f;
  --panel: #fbfaf7;
  --panel-strong: #ffffff;
  --line: #d2dcd7;
  --accent: #1d7378;
  --accent-2: #cf5d45;
  --blue: #336fb1;
  --green: #18805f;
  --amber: #b87a22;
  --violet: #8b6fc3;
  --representation-single: var(--blue);
  --representation-pair: var(--violet);
  --representation-coordinates: var(--green);
  --representation-frames: var(--amber);
  --copy: #40504d;
  --copy-soft: #5a6763;
  --copy-strong: #34423f;
  --surface-link: rgba(255, 255, 255, 0.66);
  --surface-link-hover: #ffffff;
  --surface-card: rgba(255, 255, 255, 0.72);
  --surface-card-hover: #ffffff;
  --surface-control: rgba(255, 255, 255, 0.9);
  --surface-popover: rgba(255, 255, 255, 0.97);
  --surface-chip: rgba(255, 255, 255, 0.7);
  --surface-node: rgba(255, 255, 255, 0.9);
  --surface-node-hover: #ffffff;
  --surface-tensor: rgba(255, 255, 255, 0.72);
  --surface-tensor-label: rgba(255, 255, 255, 0.85);
  --canvas-bg: linear-gradient(180deg, #f7f7fa 0%, #f7f4ef 56%, #eef6f4 100%);
  --lane-line: rgba(50, 63, 59, 0.08);
  --lane-label-line: rgba(95, 108, 103, 0.18);
  --chip-line: rgba(111, 122, 118, 0.16);
  --edge-default: rgba(92, 150, 152, 0.78);
  --edge-conditioning: rgba(139, 111, 195, 0.78);
  --edge-skip: rgba(207, 93, 69, 0.75);
  --edge-label: #6d7a76;
  --edge-label-stroke: rgba(255, 255, 255, 0.86);
  --glyph-border-base: #ffffff;
  --tensor-volume-stack: rgba(255, 255, 255, 0.94);
  --shadow: 0 18px 50px rgba(31, 37, 35, 0.14);
  --shadow-soft: 0 10px 28px rgba(43, 51, 48, 0.07);
  --node-shadow: 0 14px 34px rgba(35, 43, 40, 0.1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1112;
  --ink: #e8eeee;
  --muted: #96a8a5;
  --panel: #121a1c;
  --panel-strong: #1a2427;
  --line: #2b3b3e;
  --accent: #4fc3c7;
  --accent-2: #f08a70;
  --blue: #78aef0;
  --green: #63d19d;
  --amber: #e9b85f;
  --violet: #b6a0f2;
  --copy: #c7d3d0;
  --copy-soft: #a8b8b5;
  --copy-strong: #dde7e5;
  --surface-link: rgba(24, 34, 37, 0.82);
  --surface-link-hover: rgba(32, 47, 50, 0.98);
  --surface-card: rgba(20, 30, 33, 0.84);
  --surface-card-hover: rgba(28, 42, 45, 0.98);
  --surface-control: rgba(19, 29, 32, 0.9);
  --surface-popover: rgba(20, 30, 33, 0.97);
  --surface-chip: rgba(25, 37, 40, 0.76);
  --surface-node: rgba(21, 32, 35, 0.92);
  --surface-node-hover: rgba(31, 47, 50, 0.98);
  --surface-tensor: rgba(22, 34, 37, 0.78);
  --surface-tensor-label: rgba(8, 14, 16, 0.86);
  --canvas-bg: linear-gradient(180deg, #10161a 0%, #151c1f 56%, #0f1b1d 100%);
  --lane-line: rgba(190, 211, 207, 0.12);
  --lane-label-line: rgba(190, 211, 207, 0.18);
  --chip-line: rgba(190, 211, 207, 0.17);
  --edge-default: rgba(79, 195, 199, 0.78);
  --edge-conditioning: rgba(182, 160, 242, 0.78);
  --edge-skip: rgba(240, 138, 112, 0.76);
  --edge-label: #c5d5d1;
  --edge-label-stroke: rgba(8, 13, 14, 0.88);
  --glyph-border-base: #0d1517;
  --tensor-volume-stack: rgba(10, 16, 18, 0.95);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.24);
  --node-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
}

/* Warm, paper-led palette derived from ramith.fyi's Tufte surface, ink,
   green interaction color, yellow annotations, and scholarly blue figures. */
:root[data-theme="ramith"] {
  color-scheme: light;
  --bg: #fffff8;
  --ink: #111111;
  --muted: #6d695f;
  --panel: #faf7ec;
  --panel-strong: #fffef8;
  --line: #d9d2bd;
  --accent: #2e7247;
  --accent-2: #9a650f;
  --blue: #2f6f91;
  --green: #2e7247;
  --amber: #9a650f;
  --violet: #765a9b;
  --representation-single: var(--blue);
  --representation-pair: var(--violet);
  --representation-coordinates: var(--green);
  --representation-frames: var(--amber);
  --copy: #36352f;
  --copy-soft: #5e5b52;
  --copy-strong: #272620;
  --surface-link: rgba(255, 255, 248, 0.7);
  --surface-link-hover: #fffef8;
  --surface-card: rgba(255, 254, 248, 0.76);
  --surface-card-hover: #fffef8;
  --surface-control: rgba(255, 254, 248, 0.92);
  --surface-popover: rgba(255, 254, 248, 0.98);
  --surface-chip: rgba(250, 247, 236, 0.84);
  --surface-node: rgba(255, 254, 248, 0.94);
  --surface-node-hover: #fffef8;
  --surface-tensor: rgba(255, 254, 248, 0.8);
  --surface-tensor-label: rgba(255, 254, 248, 0.9);
  --canvas-bg: linear-gradient(180deg, #fffef8 0%, #faf7ed 58%, #f3f7ef 100%);
  --lane-line: rgba(73, 66, 49, 0.09);
  --lane-label-line: rgba(93, 86, 68, 0.19);
  --chip-line: rgba(105, 97, 78, 0.18);
  --edge-default: rgba(46, 114, 71, 0.8);
  --edge-conditioning: rgba(118, 90, 155, 0.8);
  --edge-skip: rgba(173, 77, 55, 0.76);
  --edge-label: #69655a;
  --edge-label-stroke: rgba(255, 254, 248, 0.92);
  --glyph-border-base: #fffef8;
  --tensor-volume-stack: rgba(255, 254, 248, 0.96);
  --shadow: 0 18px 50px rgba(61, 52, 31, 0.13);
  --shadow-soft: 0 9px 26px rgba(61, 52, 31, 0.08);
  --node-shadow: 0 13px 32px rgba(61, 52, 31, 0.11);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="ramith"] {
    color-scheme: dark;
    --bg: #151515;
    --ink: #f1eee2;
    --muted: #aaa69a;
    --panel: #1b1b18;
    --panel-strong: #24231e;
    --line: #403d34;
    --accent: #66bb6a;
    --accent-2: #e0ad4f;
    --blue: #79aac5;
    --green: #66bb6a;
    --amber: #e0ad4f;
    --violet: #b49bd2;
    --copy: #d7d3c7;
    --copy-soft: #b7b2a7;
    --copy-strong: #e8e4d8;
    --surface-link: rgba(31, 31, 27, 0.82);
    --surface-link-hover: rgba(42, 41, 35, 0.98);
    --surface-card: rgba(28, 28, 24, 0.88);
    --surface-card-hover: rgba(40, 39, 33, 0.98);
    --surface-control: rgba(30, 30, 26, 0.94);
    --surface-popover: rgba(30, 30, 26, 0.98);
    --surface-chip: rgba(38, 37, 31, 0.84);
    --surface-node: rgba(31, 31, 27, 0.94);
    --surface-node-hover: rgba(44, 43, 36, 0.99);
    --surface-tensor: rgba(34, 34, 29, 0.84);
    --surface-tensor-label: rgba(18, 18, 16, 0.9);
    --canvas-bg: linear-gradient(180deg, #181816 0%, #1d1c18 58%, #172019 100%);
    --lane-line: rgba(226, 220, 201, 0.11);
    --lane-label-line: rgba(226, 220, 201, 0.18);
    --chip-line: rgba(226, 220, 201, 0.17);
    --edge-default: rgba(102, 187, 106, 0.82);
    --edge-conditioning: rgba(180, 155, 210, 0.82);
    --edge-skip: rgba(226, 126, 101, 0.8);
    --edge-label: #d5d0c3;
    --edge-label-stroke: rgba(19, 19, 16, 0.92);
    --glyph-border-base: #171714;
    --tensor-volume-stack: rgba(17, 17, 15, 0.96);
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.48);
    --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.28);
    --node-shadow: 0 14px 34px rgba(0, 0, 0, 0.36);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body.renderer-page {
  min-height: 100svh;
  overflow: hidden;
}

button {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2.2rem, 4vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 9px;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  margin: 18px 0 8px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing-shell {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.landing-header {
  max-width: 900px;
  margin-bottom: 24px;
}

.landing-header p:not(.eyebrow) {
  max-width: 76ch;
  color: var(--copy);
  font-size: 1.1rem;
  line-height: 1.5;
}

.note-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.story-home-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-link);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-decoration: none;
}

.story-home-link:hover {
  border-color: var(--accent);
  background: var(--surface-link-hover);
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 16px;
}

.story-card,
.landing-notes {
  display: block;
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-card);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
}

.story-card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--surface-card-hover);
}

.story-status,
.story-meta {
  display: inline-flex;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.story-card h2 {
  margin: 8px 0;
}

.story-card p:not(.eyebrow) {
  color: var(--copy);
  line-height: 1.45;
}

.landing-notes {
  min-height: 0;
  margin-top: 22px;
}

/* Registry-driven architecture directory */

.directory-shell {
  width: min(1540px, calc(100vw - 40px));
  padding-top: 20px;
}

.directory-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(32px, 6vw, 96px);
  align-items: end;
  padding: clamp(24px, 4vw, 54px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 88% 12%, color-mix(in srgb, var(--violet) 16%, transparent), transparent 28%),
    radial-gradient(circle at 8% 100%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 31%),
    var(--surface-card);
  box-shadow: var(--shadow-soft);
}

.directory-hero-copy {
  max-width: 920px;
}

.directory-hero-aside {
  display: grid;
  gap: 14px;
  justify-items: end;
}

.directory-hero h1 {
  max-width: 12ch;
  margin-bottom: 16px;
}

.directory-hero-copy > p:not(.eyebrow) {
  max-width: 76ch;
  margin-bottom: 0;
  color: var(--copy);
  font-size: clamp(1rem, 1.35vw, 1.18rem);
  line-height: 1.55;
}

.directory-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  min-width: min(430px, 38vw);
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-card) 82%, transparent);
  backdrop-filter: blur(12px);
}

.directory-summary > div {
  padding: 16px 18px;
}

.directory-summary > div + div {
  border-left: 1px solid var(--line);
}

.directory-summary dt {
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
}

.directory-summary dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.directory-section {
  padding: clamp(32px, 5vw, 66px) 0 18px;
}

.directory-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: end;
}

.directory-section-heading h2,
.directory-reference h2,
.directory-resources h2 {
  margin-bottom: 6px;
}

.directory-section-heading > div > p:not(.eyebrow),
.directory-reference > div > p:not(.eyebrow) {
  max-width: 72ch;
  margin-bottom: 0;
  color: var(--copy-soft);
  line-height: 1.45;
}

.directory-search {
  display: grid;
  width: min(380px, 100%);
  gap: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.directory-search input {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: var(--surface-control);
  color: var(--ink);
  font: 650 0.88rem/1.2 var(--sans, ui-sans-serif, system-ui, sans-serif);
  text-transform: none;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--ink) 5%, transparent);
}

.directory-search input:focus {
  border-color: color-mix(in srgb, var(--accent) 64%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.directory-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-height: 48px;
  margin: 18px 0;
}

.directory-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.directory-filter {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-chip);
  color: var(--copy);
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
}

.directory-filter:hover,
.directory-filter:focus-visible,
.directory-filter.is-active {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: color-mix(in srgb, var(--accent) 11%, var(--surface-card));
  color: var(--accent);
}

.directory-result-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.architecture-directory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.directory-card {
  display: flex;
  min-width: 0;
  min-height: 520px;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-card);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease;
}

.directory-card:hover,
.directory-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  outline: none;
  background: var(--surface-card-hover);
  box-shadow: 0 18px 42px color-mix(in srgb, var(--ink) 12%, transparent);
  transform: translateY(-3px);
}

.directory-card-preview {
  height: 154px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--canvas-bg);
}

.directory-preview-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.directory-preview-edge {
  fill: none;
  stroke: var(--edge-default);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  opacity: 0.66;
}

.directory-preview-edge.is-conditioning {
  stroke: var(--edge-conditioning);
  stroke-dasharray: 4 5;
}

.directory-preview-node {
  stroke: color-mix(in srgb, var(--accent) 35%, var(--line));
  stroke-width: 1.5;
}

.directory-preview-node.is-module {
  fill: color-mix(in srgb, var(--surface-node) 86%, var(--accent) 14%);
}

.directory-preview-node.is-value {
  fill: color-mix(in srgb, var(--surface-tensor) 80%, var(--accent-2) 20%);
}

.directory-preview-node.is-drillable {
  stroke: var(--accent);
  stroke-width: 3;
}

.directory-card-body {
  display: flex;
  flex: 1;
  min-width: 0;
  padding: 19px;
  flex-direction: column;
}

.directory-card-kicker {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 9px;
}

.directory-family,
.directory-depth {
  color: var(--accent);
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.directory-depth {
  color: var(--muted);
  white-space: nowrap;
}

.directory-card-title {
  margin: 0 0 9px;
  color: var(--ink);
  font-size: clamp(1.25rem, 1.55vw, 1.55rem);
  line-height: 1.08;
  letter-spacing: -0.018em;
  text-transform: none;
}

.directory-card-summary {
  min-height: 5.6em;
  margin-bottom: 14px;
  color: var(--copy);
  font-size: 0.88rem;
  line-height: 1.43;
}

.directory-task-list {
  display: flex;
  min-height: 56px;
  margin: 0 0 16px;
  padding: 0;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
  list-style: none;
}

.directory-task {
  align-self: flex-start;
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--violet) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--violet) 7%, var(--surface-chip));
  color: color-mix(in srgb, var(--violet) 84%, var(--ink));
  font-size: 0.67rem;
  font-weight: 800;
}

.directory-task.is-muted {
  color: var(--muted);
}

.directory-route-label {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.directory-root-route {
  display: flex;
  min-height: 48px;
  margin-bottom: 17px;
  gap: 6px;
  align-items: center;
}

.directory-route-unit {
  min-width: 0;
  padding: 6px 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-chip);
  color: var(--copy-strong);
  font-size: 0.67rem;
  font-weight: 800;
  text-overflow: ellipsis;
}

.directory-route-arrow {
  flex: none;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 900;
}

.directory-card-footer {
  display: flex;
  margin-top: auto;
  padding-top: 13px;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  border-top: 1px solid var(--line);
}

.directory-card-stat {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.directory-card-open {
  width: 100%;
  margin-top: 5px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
}

.directory-loading,
.directory-empty,
.directory-error {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}

.directory-empty {
  margin: 0;
}

.directory-reference {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(520px, 1.3fr);
  gap: clamp(26px, 5vw, 70px);
  align-items: center;
  margin-top: 46px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 4%, var(--surface-card));
}

.reference-directory-grid {
  display: grid;
}

.directory-card.is-reference {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(230px, 0.82fr) minmax(330px, 1.18fr);
}

.directory-card.is-reference .directory-card-preview {
  height: 100%;
  min-height: 300px;
  border-right: 1px solid var(--line);
  border-bottom: 0;
}

.directory-card.is-reference .directory-card-summary {
  min-height: 0;
}

.directory-card.is-reference .directory-task-list {
  min-height: 0;
}

.directory-resources {
  display: grid;
  grid-template-columns: 1.15fr repeat(4, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-card);
}

.directory-resources > div {
  padding: 8px 10px;
}

.directory-resources a {
  display: flex;
  min-height: 88px;
  padding: 12px;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-link);
  color: inherit;
  text-decoration: none;
}

.directory-resources a:hover,
.directory-resources a:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  outline: none;
  background: var(--surface-link-hover);
}

.directory-resources a span {
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
}

.directory-resources a small {
  color: var(--copy-soft);
  font-size: 0.69rem;
  line-height: 1.35;
}

@media (max-width: 1120px) {
  .directory-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .directory-summary {
    width: min(620px, 100%);
    min-width: 0;
  }

  .directory-hero-aside {
    width: min(620px, 100%);
    justify-items: start;
  }

  .architecture-directory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .directory-section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .directory-search {
    width: min(520px, 100%);
  }

  .directory-reference {
    grid-template-columns: 1fr;
  }

  .directory-resources {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .directory-resources > div {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .directory-shell {
    width: min(100% - 24px, 1540px);
    padding-top: 12px;
  }

  .directory-hero {
    padding: 24px 18px;
  }

  .directory-summary {
    grid-template-columns: 1fr;
  }

  .directory-summary > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .directory-section-heading,
  .directory-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .directory-search {
    width: 100%;
  }

  .directory-result-count {
    align-self: flex-end;
  }

  .architecture-directory-grid,
  .directory-resources {
    grid-template-columns: 1fr;
  }

  .directory-card {
    min-height: 0;
  }

  .directory-card-summary,
  .directory-task-list {
    min-height: 0;
  }

  .directory-reference {
    padding: 22px 14px;
  }

  .directory-card.is-reference {
    display: flex;
  }

  .directory-card.is-reference .directory-card-preview {
    min-height: 154px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

/* The published landing page is intentionally just a registry-backed list.
   Architecture detail and language documentation belong behind the links. */
.directory-page {
  min-height: 100svh;
}

.directory-shell {
  width: min(760px, calc(100vw - 32px));
  padding: clamp(48px, 10vh, 112px) 0 64px;
}

.directory-header {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: start;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.directory-header h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 6vw, 3.25rem);
  letter-spacing: -0.035em;
}

.directory-header > div > p:not(.eyebrow) {
  margin: 0;
  color: var(--copy-soft);
  font-size: 0.98rem;
}

.architecture-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.architecture-list-item {
  border-bottom: 1px solid var(--line);
}

.architecture-list-link {
  display: flex;
  min-height: 76px;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 18px 4px;
  color: inherit;
  text-decoration: none;
  transition: color 120ms ease, padding 120ms ease;
}

.architecture-list-link:hover,
.architecture-list-link:focus-visible {
  padding-right: 0;
  padding-left: 8px;
  outline: none;
  color: var(--accent);
}

.architecture-list-name {
  font-size: clamp(1.02rem, 2.4vw, 1.22rem);
  font-weight: 780;
  line-height: 1.25;
}

.architecture-list-action {
  flex: none;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 850;
}

.directory-page .directory-loading,
.directory-page .directory-empty,
.directory-page .directory-error {
  margin: 24px 0 0;
  padding: 18px 4px;
  border: 0;
  color: var(--muted);
  text-align: left;
}

@media (max-width: 600px) {
  .directory-shell {
    width: min(100% - 28px, 760px);
    padding-top: 36px;
  }

  .directory-header {
    gap: 18px;
    align-items: end;
  }

  .directory-header > div > p:not(.eyebrow) {
    max-width: 28ch;
  }

  .directory-header .theme-switcher-label {
    width: 108px;
  }
}

.renderer-shell {
  display: flex;
  flex-direction: column;
  height: 100svh;
  width: min(calc(100vw - 24px), 1880px);
  margin: 0 auto;
  padding: 10px 0 12px;
}

.renderer-header {
  flex: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 10px;
}

.renderer-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.renderer-library-link {
  flex: none;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-link);
  color: var(--copy-soft);
  font-size: 0.72rem;
  font-weight: 800;
  text-decoration: none;
}

.renderer-library-link:hover,
.renderer-library-link:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: var(--surface-link-hover);
  color: var(--accent);
}

.renderer-toolbar {
  display: flex;
  flex: none;
  align-items: end;
  gap: 8px;
}

.arch-switcher-label,
.theme-switcher-label {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.renderer-header .eyebrow {
  margin-bottom: 2px;
}

.renderer-header h1 {
  margin-bottom: 2px;
  font-size: 1.4rem;
  line-height: 1.1;
}

.renderer-header p:not(.eyebrow) {
  max-width: 78ch;
  margin-bottom: 0;
  color: var(--copy-soft);
  font-size: 0.8rem;
  line-height: 1.35;
}

.renderer-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(340px, 25vw, 400px);
  gap: 12px;
}

.canvas-workspace {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.canvas-workspace > .architecture-canvas {
  flex: 1;
}

.comparison-workspace[hidden] {
  display: none;
}

.renderer-page.is-comparing {
  overflow: auto;
}

.renderer-page.is-comparing .renderer-shell {
  height: auto;
  min-height: 100svh;
}

.renderer-page.is-comparing .renderer-grid {
  flex: none;
  min-height: 0;
  align-items: start;
}

.renderer-page.is-comparing .canvas-workspace {
  gap: 10px;
}

.renderer-page.is-comparing #architectureCanvas,
.comparison-canvas {
  flex: none;
  height: clamp(500px, 62svh, 780px);
}

.comparison-workspace {
  display: grid;
  min-width: 0;
  gap: 9px;
}

.comparison-band {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(260px, 0.8fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-control);
  box-shadow: var(--shadow-soft);
}

.comparison-band-heading,
.comparison-band-heading h2,
.comparison-band-heading p,
.comparison-subjects,
.comparison-subjects dd {
  margin: 0;
}

.comparison-band-heading {
  min-width: 0;
}

.comparison-band-heading .eyebrow {
  margin-bottom: 2px;
}

.comparison-band-heading h2 {
  font-size: 0.94rem;
  line-height: 1.25;
}

.comparison-band-heading > p:last-child {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  color: var(--copy-soft);
  font-size: 0.72rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.comparison-subjects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.comparison-subjects > div {
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-card);
}

.comparison-subjects dt {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.comparison-subjects dd {
  overflow: hidden;
  color: var(--copy-strong);
  font-size: 0.75rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comparison-group-summary {
  grid-column: 1 / 3;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.comparison-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-chip);
  color: var(--copy-soft);
  font-size: 0.64rem;
  font-weight: 800;
}

.comparison-group-chip b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.comparison-actions {
  grid-column: 3;
  grid-row: 1 / 3;
  display: flex;
  align-self: stretch;
  align-items: center;
  gap: 5px;
}

.comparison-actions > button,
.comparison-mobile-switch button,
.focus-compare {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-card);
  color: var(--copy-soft);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 850;
}

.comparison-actions > button:hover,
.comparison-actions > button:focus-visible,
.comparison-mobile-switch button:hover,
.comparison-mobile-switch button:focus-visible,
.focus-compare:hover,
.focus-compare:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  color: var(--accent);
}

.comparison-mobile-switch {
  display: none;
}

.comparison-canvas {
  --board-inset-top: 64px;
}

.comparison-surface-label {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 30;
  display: flex;
  max-width: calc(100% - 28px);
  align-items: baseline;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-control);
  box-shadow: var(--shadow-soft);
}

.comparison-surface-label span {
  flex: none;
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.comparison-surface-label strong {
  overflow: hidden;
  color: var(--copy-strong);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comparison-aligned {
  --comparison-color: #64736f;
  outline: 2px solid color-mix(in srgb, var(--comparison-color) 70%, transparent);
  outline-offset: 3px;
}

.comparison-aligned.comparison-equivalent {
  --comparison-color: #16805f;
}

.comparison-aligned.comparison-analogous {
  --comparison-color: #526d87;
}

.comparison-aligned.comparison-changed {
  --comparison-color: #b06f18;
}

.comparison-aligned.comparison-primary_only,
.comparison-aligned.comparison-counterpart_only {
  --comparison-color: #9a526f;
  outline-style: dashed;
}

.comparison-match-badge {
  position: absolute;
  top: -11px;
  left: -11px;
  z-index: 8;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 2px solid var(--surface-control);
  border-radius: 50%;
  background: var(--comparison-color);
  color: white;
  box-shadow: 0 3px 9px color-mix(in srgb, var(--ink) 18%, transparent);
  font-size: 0.62rem;
  font-weight: 950;
  line-height: 1;
}

.comparison-edge-marker {
  fill: var(--edge-default);
}

.comparison-edge-marker.flow-family-single {
  fill: var(--representation-single);
}

.comparison-edge-marker.flow-family-pair {
  fill: var(--representation-pair);
}

.comparison-edge-marker.flow-family-coordinates {
  fill: var(--representation-coordinates);
}

.comparison-edge-marker.flow-family-frames {
  fill: var(--representation-frames);
}

.comparison-edge-marker.flow-family-conditioning {
  fill: var(--edge-conditioning);
}

.comparison-edge-hit:focus {
  stroke: color-mix(in srgb, var(--accent) 22%, transparent);
}

.renderer-page.is-comparing .focus-panel {
  position: sticky;
  top: 10px;
  height: calc(100svh - 22px);
}

.architecture-canvas {
  --board-inset-x: 32px;
  --board-inset-right: var(--board-inset-x);
  --board-inset-top: 76px;
  --board-inset-bottom: 74px;
  --board-layer-guides: 0;
  --board-layer-regions: 1;
  --board-layer-representation-lanes: 2;
  --board-layer-wires: 3;
  --board-layer-nodes: 4;
  --board-layer-reference-panels: 8;
  position: relative;
  isolation: isolate;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--canvas-bg);
  cursor: grab;
  touch-action: none;
  min-height: 0;
}

.architecture-canvas.has-reference-panels {
  --board-inset-right: clamp(330px, 30vw, 400px);
}

.architecture-canvas.is-panning {
  cursor: grabbing;
  user-select: none;
}

.renderer-startup-error {
  position: absolute;
  z-index: 20;
  top: 50%;
  left: 50%;
  width: min(440px, calc(100% - 40px));
  padding: 24px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, -50%);
}

.renderer-startup-error[hidden] {
  display: none;
}

.renderer-startup-error h2,
.renderer-startup-error p {
  margin: 0 0 12px;
}

.renderer-startup-error code {
  display: block;
  max-height: 96px;
  margin: 0 0 16px;
  overflow: auto;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.renderer-startup-error button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font: inherit;
  font-weight: 700;
}

.module-layer {
  position: absolute;
  inset: var(--board-inset-top) var(--board-inset-right) var(--board-inset-bottom) var(--board-inset-x);
  z-index: var(--board-layer-nodes);
  display: grid;
  grid-template-columns: repeat(var(--board-columns, 5), minmax(var(--board-min-col, 164px), 1fr));
  grid-template-rows: repeat(var(--board-rows, 4), minmax(112px, 1fr));
  column-gap: var(--board-col-gap, clamp(28px, 3vw, 48px));
  row-gap: var(--board-row-gap, 18px);
  justify-items: center;
  align-items: center;
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: none;
}

.board-region {
  position: absolute;
  z-index: 0;
  box-sizing: border-box;
  pointer-events: none;
}

.board-region-layer {
  position: absolute;
  inset: var(--board-inset-top) var(--board-inset-right) var(--board-inset-bottom) var(--board-inset-x);
  z-index: var(--board-layer-regions);
  overflow: visible;
  pointer-events: none;
  transform-origin: 0 0;
  will-change: transform;
}

.visual-segment-region {
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 15px;
  background: color-mix(in srgb, var(--accent) 2.5%, transparent);
}

.visual-segment-header {
  position: absolute;
  top: 3px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100% - 24px);
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--copy-soft);
  box-shadow: 0 3px 9px rgba(31, 37, 35, 0.05);
  font-size: 0.69rem;
  font-weight: 850;
  letter-spacing: 0.035em;
  line-height: 1;
  white-space: nowrap;
}

.visual-segment-order {
  flex: none;
  padding: 3px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.visual-segment-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.repeat-region {
  border: 2px dashed var(--line);
  border: 2px dashed color-mix(in srgb, var(--accent) 50%, var(--line));
  border-radius: 14px;
  background: transparent;
  background: color-mix(in srgb, var(--accent) 3%, transparent);
}

.repeat-region-header {
  position: absolute;
  top: -15px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100% - 28px);
  padding: 3px 7px;
  border: 1px solid var(--line);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 7px;
  background: var(--panel);
  color: var(--copy-soft);
  box-shadow: 0 3px 10px rgba(31, 37, 35, 0.05);
  font-size: 0.69rem;
  font-weight: 850;
  letter-spacing: 0.045em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.repeat-region-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.repeat-region-count {
  flex: none;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--surface-chip);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  color: var(--accent);
  font-weight: 900;
  letter-spacing: 0.02em;
}

.edge-layer {
  position: absolute;
  inset: var(--board-inset-top) var(--board-inset-right) var(--board-inset-bottom) var(--board-inset-x);
  z-index: var(--board-layer-wires);
  width: calc(100% - var(--board-inset-x) - var(--board-inset-right));
  height: calc(100% - var(--board-inset-top) - var(--board-inset-bottom));
  overflow: visible;
  pointer-events: none;
  transform-origin: 0 0;
  will-change: transform;
}

.scale-lane-layer {
  position: absolute;
  inset: var(--board-inset-top) 0 var(--board-inset-bottom);
  z-index: var(--board-layer-guides);
  pointer-events: none;
}

.scale-lane-layer[hidden] {
  display: none;
}

.representation-lane-layer {
  position: absolute;
  inset: var(--board-inset-top) var(--board-inset-right) var(--board-inset-bottom) var(--board-inset-x);
  z-index: var(--board-layer-representation-lanes);
  display: grid;
  grid-template-columns: repeat(var(--board-columns, 5), minmax(var(--board-min-col, 164px), 1fr));
  grid-template-rows: repeat(var(--board-rows, 4), minmax(112px, 1fr));
  column-gap: var(--board-col-gap, clamp(28px, 3vw, 48px));
  row-gap: var(--board-row-gap, 18px);
  justify-items: center;
  align-items: center;
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: none;
}

.reference-panel-layer {
  position: absolute;
  z-index: var(--board-layer-reference-panels);
  top: var(--board-inset-top);
  right: 18px;
  bottom: var(--board-inset-bottom);
  width: min(350px, calc(var(--board-inset-right) - 42px));
  overflow: auto;
  overscroll-behavior: contain;
  pointer-events: auto;
  touch-action: auto;
}

.reference-panel-layer[hidden] {
  display: none;
}

.reference-panel {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 96%, var(--accent) 4%);
  box-shadow: var(--shadow-lg);
}

.reference-panel + .reference-panel {
  margin-top: 12px;
}

.reference-panel-heading {
  display: grid;
  gap: 3px;
}

.reference-panel-eyebrow {
  color: var(--accent);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reference-panel-heading strong {
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.2;
}

.reference-panel-image-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 7px;
  background: #fff;
  cursor: zoom-in;
  appearance: none;
}

.reference-panel-image-button:hover {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
}

.reference-panel-image-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.reference-panel-image-button img {
  display: block;
  width: 100%;
  height: auto;
}

.reference-panel-zoom-cue {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-strong) 94%, transparent);
  color: var(--accent);
  box-shadow: var(--shadow-soft);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.reference-panel-zoom-cue .arch-drill-icon {
  width: 14px;
  height: 14px;
}

.reference-panel-caption,
.reference-panel-license {
  margin: 0;
  color: var(--copy-soft);
  font-size: 0.72rem;
  line-height: 1.45;
}

.reference-panel-citation {
  display: -webkit-box;
  overflow: hidden;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 750;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.reference-panel-license {
  font-size: 0.64rem;
}

.reference-figure-dialog {
  width: min(1180px, calc(100vw - 36px));
  height: min(900px, calc(100svh - 36px));
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-popover);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

.reference-figure-dialog::backdrop {
  background: color-mix(in srgb, var(--ink) 58%, transparent);
}

.reference-figure-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
}

.reference-figure-header,
.reference-figure-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-color: var(--line);
  background: var(--panel);
}

.reference-figure-header {
  border-bottom: 1px solid var(--line);
}

.reference-figure-header .eyebrow,
.reference-figure-header h2,
.reference-figure-copy p,
.reference-figure-copy small {
  margin: 0;
}

.reference-figure-header h2 {
  font-size: 1rem;
}

.reference-figure-close {
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-control);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
}

.reference-figure-viewport {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--line) 24%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--line) 24%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--line) 24%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--line) 24%, transparent) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  cursor: zoom-in;
  touch-action: none;
}

.reference-figure-viewport.is-zoomed {
  cursor: grab;
}

.reference-figure-viewport.is-panning {
  cursor: grabbing;
  user-select: none;
}

.reference-figure-viewport:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.reference-figure-viewport img {
  display: block;
  max-width: none;
  height: auto;
  margin: 24px auto;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.reference-figure-footer {
  align-items: end;
  border-top: 1px solid var(--line);
}

.reference-figure-copy {
  display: grid;
  gap: 4px;
  max-width: 760px;
  color: var(--copy-soft);
  font-size: 0.72rem;
  line-height: 1.35;
}

.reference-figure-copy a {
  color: var(--accent);
  font-weight: 800;
}

.reference-figure-controls {
  display: inline-flex;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-control);
}

.reference-figure-controls button {
  min-width: 40px;
  min-height: 34px;
  padding: 5px 10px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 850;
}

.reference-figure-controls button:last-child {
  border-right: 0;
}

.reference-figure-controls button:hover,
.reference-figure-close:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.module-layer.is-content-row-grid,
.representation-lane-layer.is-content-row-grid {
  row-gap: 0;
}

.scale-lane {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--lane-line);
}

.scale-lane span {
  position: absolute;
  left: 20px;
  top: 10px;
  padding: 4px 9px;
  border: 1px solid var(--lane-label-line);
  border-radius: 8px;
  background: var(--surface-chip);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.representation-lane {
  --representation-lane-color: var(--accent);
  position: relative;
  z-index: 0;
  align-self: stretch;
  justify-self: stretch;
  min-width: 0;
  min-height: 0;
  margin: -5px -8px;
  border-block: 1px solid color-mix(in srgb, var(--representation-lane-color) 20%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--representation-lane-color) 4%, transparent);
  pointer-events: none;
}

.representation-lane-single {
  --representation-lane-color: var(--representation-single);
}

.representation-lane-pair {
  --representation-lane-color: var(--representation-pair);
}

.representation-lane-coordinates {
  --representation-lane-color: var(--representation-coordinates);
}

.representation-lane-frames {
  --representation-lane-color: var(--representation-frames);
}

.representation-lane-label {
  position: absolute;
  top: 7px;
  left: 10px;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--representation-lane-color) 28%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--representation-lane-color) 8%, var(--surface-chip));
  color: var(--representation-lane-color);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.045em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.arch-node,
.arch-rep {
  position: relative;
  z-index: 4;
  align-self: center;
  justify-self: center;
  width: min(100%, 260px);
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--surface-node);
  color: var(--ink);
  box-shadow: var(--node-shadow);
  text-align: left;
  pointer-events: auto;
}

.arch-node {
  cursor: default;
}

.arch-node-main {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: inherit;
}

.arch-node-main:focus-visible,
.arch-node-drill:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 42%, transparent);
  outline-offset: 2px;
}

.arch-node:hover,
.arch-node.is-focused {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: var(--surface-node-hover);
}

.arch-node.is-expandable {
  border-inline-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  border-bottom-color: color-mix(in srgb, var(--accent) 28%, var(--line));
}

.arch-drill-cue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-chip));
  color: var(--accent);
}

.arch-drill-icon {
  width: 17px;
  height: 17px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.arch-node .arch-drill-cue {
  display: flex;
  margin: 10px 0 0 auto;
}

.arch-node-drill {
  cursor: zoom-in;
}

.arch-op-node .arch-node-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.arch-node:focus-visible,
.mini-summary.is-drilldown:focus-visible,
.architecture-canvas:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 58%, transparent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  .arch-node.is-expandable,
  .mini-summary.is-drilldown,
  .arch-drill-icon {
    transition:
      border-color 120ms ease,
      background-color 120ms ease,
      transform 120ms ease;
  }

  .arch-node.is-expandable:hover .arch-drill-icon,
  .arch-node.is-expandable:focus-within .arch-drill-icon,
  .semantic-trace-drill:hover .arch-drill-icon,
  .semantic-trace-drill:focus-visible .arch-drill-icon {
    transform: scale(1.08);
  }
}

.arch-node strong,
.arch-rep strong {
  display: block;
  margin: 5px 0 4px;
  font-size: 1rem;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.arch-role,
.arch-spec,
.arch-rep em {
  display: block;
  color: var(--copy-soft);
  font-size: 0.82rem;
  line-height: 1.3;
}

.arch-spec,
.arch-rep code {
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.arch-kind,
.arch-repeat,
.arch-rep > span,
.arch-badges i {
  display: inline-flex;
  align-items: center;
  padding: 3px 6px;
  border: 1px solid var(--chip-line);
  border-radius: 7px;
  background: var(--surface-chip);
  color: var(--muted);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.arch-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.arch-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.arch-node.scale-item,
.arch-rep.scale-item {
  border-top-color: var(--accent);
}

.arch-node.scale-item_pair,
.arch-rep.scale-item_pair {
  border-top-color: var(--violet);
}

.arch-node.scale-group,
.arch-rep.scale-group {
  border-top-color: var(--accent-2);
}

.arch-node.scale-output,
.arch-rep.scale-output {
  border-top-color: var(--green);
}

.arch-node.flow-family-single,
.arch-node.flow-family-pair,
.arch-node.flow-family-coordinates,
.arch-node.flow-family-frames {
  --node-flow-color: var(--accent);
  border-top-color: var(--node-flow-color);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--node-flow-color) 8%, var(--surface-node)) 0%,
      var(--surface-node) 52%
    );
}

.arch-node.flow-family-single {
  --node-flow-color: var(--representation-single);
}

.arch-node.flow-family-pair {
  --node-flow-color: var(--representation-pair);
}

.arch-node.flow-family-coordinates {
  --node-flow-color: var(--representation-coordinates);
}

.arch-node.flow-family-frames {
  --node-flow-color: var(--representation-frames);
}

.arch-node[class*="flow-family-"] .arch-kind,
.arch-node[class*="flow-family-"] .arch-badges i:first-child {
  border-color: color-mix(in srgb, var(--node-flow-color, var(--accent)) 32%, var(--line));
  background: color-mix(in srgb, var(--node-flow-color, var(--accent)) 9%, var(--surface-chip));
  color: var(--node-flow-color, var(--accent));
}

.arch-node.scale-abstract {
  width: min(100%, 360px);
  min-height: 150px;
  padding: 20px;
}

.arch-node.prominence-primary.treatment-block {
  width: 300px;
  max-width: calc(100vw - 64px);
}

.treatment-compact,
.density-compact {
  min-height: 92px;
  padding: 12px;
}

.treatment-chip,
.density-micro {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-height: 54px;
  width: max-content;
  max-width: 170px;
  padding: 9px 11px;
  box-shadow: none;
}

.treatment-chip strong,
.density-micro strong {
  margin: 3px 0 0;
  font-size: 0.9rem;
}

.arch-chip-meta {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.arch-edge {
  fill: none;
  stroke: var(--edge-default);
  stroke-width: 3;
  stroke-dasharray: 8 8;
}

.arch-edge-annotations {
  pointer-events: none;
}

.arch-edge.is-connectivity-input,
.arch-edge.is-connectivity-output {
  opacity: 1;
  stroke-width: 4.5;
  filter: drop-shadow(0 0 3px color-mix(in srgb, currentColor 35%, transparent));
}

.arch-edge.is-connectivity-muted {
  opacity: 0.14;
}

.arch-edge-label.is-connectivity-muted,
.arch-edge-badge.is-connectivity-muted {
  opacity: 0.18;
}

.arch-edge-label.is-connectivity-input,
.arch-edge-label.is-connectivity-output,
.arch-edge-badge.is-connectivity-input,
.arch-edge-badge.is-connectivity-output {
  opacity: 1;
}

.arch-node.is-connectivity-muted,
.arch-rep.is-connectivity-muted {
  opacity: 0.2;
  filter: saturate(0.45);
}

.arch-node.is-connectivity-focus,
.arch-rep.is-connectivity-focus {
  border-color: color-mix(in srgb, var(--accent) 66%, var(--line));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent),
    var(--node-shadow);
}

.arch-node.is-connectivity-source,
.arch-node.is-connectivity-target,
.arch-rep.is-connectivity-source,
.arch-rep.is-connectivity-target {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--accent) 14%, transparent),
    var(--node-shadow);
}

@media (prefers-reduced-motion: no-preference) {
  .arch-edge,
  .arch-edge-label,
  .arch-edge-badge,
  .arch-node,
  .arch-rep {
    transition:
      opacity 120ms ease,
      filter 120ms ease,
      stroke-width 120ms ease,
      border-color 120ms ease,
      box-shadow 120ms ease;
  }
}

.arch-edge.is-conditioning {
  stroke: var(--edge-conditioning);
  stroke-dasharray: 3 6;
}

.arch-edge.flow-family-single:not(.is-skip) {
  stroke: var(--representation-single);
}

.arch-edge.flow-family-pair:not(.is-skip) {
  stroke: var(--representation-pair);
}

.arch-edge.flow-family-coordinates:not(.is-skip) {
  stroke: var(--representation-coordinates);
}

.arch-edge.flow-family-frames:not(.is-skip) {
  stroke: var(--representation-frames);
}

.arch-edge.is-skip {
  stroke: var(--edge-skip);
  stroke-dasharray: 14 5 2 5;
}

.arch-edge-label {
  fill: var(--edge-label);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-anchor: middle;
  text-transform: uppercase;
  paint-order: stroke;
  stroke: var(--edge-label-stroke);
  stroke-width: 5px;
}

.arch-edge-label.flow-family-single,
.arch-edge-badge.flow-family-single {
  fill: var(--representation-single);
}

.arch-edge-label.flow-family-pair,
.arch-edge-badge.flow-family-pair {
  fill: var(--representation-pair);
}

.arch-edge-label.flow-family-coordinates,
.arch-edge-badge.flow-family-coordinates {
  fill: var(--representation-coordinates);
}

.arch-edge-label.flow-family-frames,
.arch-edge-badge.flow-family-frames {
  fill: var(--representation-frames);
}

.edge-marker-default {
  fill: var(--edge-default);
}

.edge-marker-conditioning {
  fill: var(--edge-conditioning);
}

.edge-marker-single {
  fill: var(--representation-single);
}

.edge-marker-pair {
  fill: var(--representation-pair);
}

.edge-marker-coordinates {
  fill: var(--representation-coordinates);
}

.edge-marker-frames {
  fill: var(--representation-frames);
}

.edge-marker-skip {
  fill: var(--edge-skip);
}

.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 24;
  pointer-events: stroke;
  cursor: pointer;
}

.edge-hit:focus {
  outline: none;
}

.edge-hit:focus-visible {
  stroke: color-mix(in srgb, var(--accent) 32%, transparent);
}

.canvas-controls {
  position: absolute;
  z-index: 30;
  display: flex;
  gap: 6px;
}

.canvas-controls {
  left: 14px;
  bottom: 14px;
}

.canvas-controls button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-control);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.canvas-controls button {
  min-width: 30px;
  padding: 4px 8px;
}

.focus-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-card);
  box-shadow: var(--shadow-soft);
}

.focus-panel-header {
  flex: none;
  display: flex;
  width: auto;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-control);
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.focus-panel-header .eyebrow {
  margin-bottom: 1px;
  font-size: 0.64rem;
}

.focus-panel-header h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.15;
}

.focus-header-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
}

.focus-reset,
.focus-question {
  flex: none;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-card);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 800;
}

.focus-question {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-size: 0.68rem;
  line-height: 1.1;
}

.focus-question > span:first-child {
  font-size: 0.9rem;
}

.focus-reset:hover,
.focus-reset:focus-visible,
.focus-question:hover,
.focus-question:focus-visible,
.focus-question[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.architecture-question-menu {
  position: fixed;
  z-index: 100;
  display: grid;
  width: min(330px, calc(100vw - 16px));
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 10px;
  background: var(--surface-control);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--ink) 20%, transparent);
}

.architecture-question-menu[hidden],
.architecture-copy-status[hidden],
.architecture-copy-fallback[hidden] {
  display: none;
}

.architecture-question-menu-heading {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.architecture-question-menu-heading span {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.architecture-question-menu-heading code {
  overflow: hidden;
  color: var(--copy-strong);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.architecture-question-menu > button {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.architecture-question-menu > button:last-child {
  border-bottom: 0;
}

.architecture-question-menu > button:hover,
.architecture-question-menu > button:focus-visible {
  outline: none;
  background: var(--surface-link-hover);
}

.architecture-question-menu > button:focus-visible {
  box-shadow: inset 3px 0 0 var(--accent);
}

.architecture-question-menu > button strong {
  font-size: 0.82rem;
}

.architecture-question-menu > button small {
  color: var(--copy-soft);
  font-size: 0.7rem;
  line-height: 1.35;
}

.architecture-copy-status {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 102;
  max-width: min(420px, calc(100vw - 32px));
  margin: 0;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--line));
  border-radius: 8px;
  background: var(--surface-control);
  box-shadow: var(--shadow-soft);
  color: var(--copy-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.architecture-copy-status.is-error {
  border-color: color-mix(in srgb, #b33838 45%, var(--line));
  color: #b33838;
}

.architecture-copy-fallback {
  position: fixed;
  inset: 0;
  z-index: 101;
  display: grid;
  place-items: center;
  padding: 18px;
  background: color-mix(in srgb, var(--ink) 26%, transparent);
  backdrop-filter: blur(3px);
}

.architecture-copy-fallback > div {
  display: grid;
  width: min(760px, 100%);
  max-height: min(680px, calc(100vh - 36px));
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-control);
  box-shadow: 0 24px 70px color-mix(in srgb, var(--ink) 28%, transparent);
}

.architecture-copy-fallback h2,
.architecture-copy-fallback p {
  margin: 0;
}

.architecture-copy-fallback p {
  color: var(--copy-soft);
  font-size: 0.82rem;
}

.architecture-copy-fallback textarea {
  width: 100%;
  min-height: min(420px, 55vh);
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-card);
  color: var(--copy-strong);
  font: 0.72rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.architecture-copy-fallback button {
  justify-self: end;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-card);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.architecture-copy-proxy {
  position: fixed;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.focus-body {
  min-width: 0;
  padding: 0 14px 14px;
  columns: auto;
}

.focus-panel-pages {
  flex: 1;
  display: block;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.focus-page-section {
  min-width: 0;
}

.focus-trace-section {
  border-top: 1px solid var(--line);
}

.focus-page-heading {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  min-height: 38px;
  padding: 9px 14px 7px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-control) 94%, transparent);
  backdrop-filter: blur(8px);
}

.focus-page-heading h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#semanticTraceCount:not(:empty) {
  min-width: 17px;
  padding: 1px 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-chip));
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.semantic-trace-body {
  min-width: 0;
  padding: 12px 14px 14px;
}

.semantic-trace-heading {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
}

.semantic-trace-scroll {
  min-width: 0;
  overflow: visible;
}

.semantic-trace-heading strong {
  color: var(--ink);
  font-size: 0.84rem;
}

.semantic-trace-heading span,
.semantic-trace-empty,
.semantic-trace-status {
  color: var(--copy-soft);
  font-size: 0.72rem;
  line-height: 1.35;
}

.semantic-trace-status {
  box-sizing: border-box;
  height: 4.35em;
  margin: 9px 0 0;
  padding: 6px 8px;
  overflow-y: auto;
  border-top: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  background: color-mix(in srgb, var(--surface-control) 76%, transparent);
}

.semantic-trace-status:empty {
  border-color: transparent;
  background: transparent;
}

.semantic-trace-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: semantic-trace-line;
}

.semantic-trace-line {
  position: relative;
  display: grid;
  grid-template-columns: 3ch minmax(0, 1fr);
  gap: 6px;
  padding: 7px 8px 7px 5px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--copy);
  cursor: default;
  counter-increment: semantic-trace-line;
}

.semantic-trace-phase {
  display: grid;
  gap: 2px;
  margin: 8px 0 2px;
  padding: 7px 8px;
  border-top: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  color: var(--copy-soft);
}

.semantic-trace-phase:first-child {
  margin-top: 0;
}

.semantic-trace-phase strong {
  color: var(--accent);
  font-size: 0.68rem;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.semantic-trace-phase span {
  font-size: 0.68rem;
  line-height: 1.35;
}

.semantic-trace-line::before {
  content: counter(semantic-trace-line);
  padding-top: 1px;
  color: var(--muted);
  font: 0.64rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: right;
}

.semantic-trace-line:hover,
.semantic-trace-line:focus-visible,
.semantic-trace-line.is-trace-transient {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
  background: color-mix(in srgb, var(--accent) 5%, var(--surface-card));
  outline: none;
}

.semantic-trace-line.is-trace-selected {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-card));
  box-shadow: inset 3px 0 0 var(--accent);
}

.semantic-trace-code {
  min-width: 0;
  color: inherit;
  font: 0.76rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-ligatures: none;
  overflow-wrap: normal;
  tab-size: 2;
  word-break: normal;
  white-space: pre-wrap;
}

.semantic-code-expression {
  display: block;
  min-width: 0;
  padding-inline-start: 1.35em;
  text-indent: -1.35em;
}

.semantic-code-atom {
  white-space: nowrap;
}

.semantic-code-comment {
  display: block;
  margin-top: 3px;
  padding-inline-start: 1.35em;
  color: var(--copy-soft);
  font-size: 0.92em;
  line-height: 1.4;
  text-indent: 0;
  white-space: normal;
}

.semantic-code-comment-prefix {
  color: color-mix(in srgb, var(--accent) 72%, var(--copy-soft));
  font-weight: 850;
}

.semantic-code-comment-word {
  white-space: nowrap;
}

.semantic-token {
  display: inline;
  margin: -2px;
  padding: 2px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  line-height: inherit;
  text-align: inherit;
}

.semantic-token[data-access="write"] {
  color: color-mix(in srgb, var(--violet) 74%, var(--ink));
}

.semantic-token-math {
  position: relative;
  display: inline;
  font-family: "STIX Two Math", "Cambria Math", Georgia, serif;
}

.semantic-token-math-fallback {
  display: inline;
}

.semantic-token-math-fallback i {
  font-family: inherit;
  font-style: italic;
}

.semantic-token-math-fallback sub {
  margin-left: 0.03em;
  font-size: 0.72em;
  line-height: 0;
}

.semantic-token-math-source {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.semantic-trace-body.has-mathjax .semantic-token-math-fallback {
  display: none;
}

.semantic-trace-body.has-mathjax .semantic-token-math-source,
.semantic-token-math-source mjx-container {
  position: static;
  display: inline !important;
  width: auto;
  height: auto;
  margin: 0 !important;
  overflow: visible;
  clip-path: none;
  pointer-events: none;
  white-space: normal;
}

.semantic-token:hover,
.semantic-token:focus-visible,
.semantic-token.is-trace-transient {
  outline: none;
  background: color-mix(in srgb, currentColor 13%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, currentColor 28%, transparent);
}

.semantic-token.is-trace-selected {
  background: color-mix(in srgb, currentColor 18%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 36%, transparent);
}

.semantic-token.is-semantic-boundary::after {
  content: "·";
  margin-left: 1px;
  color: var(--muted);
}

.semantic-token.is-semantic-unavailable {
  color: var(--copy-soft);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.semantic-trace-label {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.3;
}

.semantic-trace-drill {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-chip));
  color: var(--accent);
  cursor: zoom-in;
}

.semantic-trace-drill .arch-drill-icon {
  width: 14px;
  height: 14px;
}

.semantic-trace-drill:hover,
.semantic-trace-drill:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.focus-body .focus-section > h3:first-child {
  margin-top: 0;
}

.focus-body .focus-dl,
.focus-body .mini-summary,
.focus-body .zoom-note,
.focus-body .internal-unit,
.focus-body .evidence-list,
.focus-body li {
  break-inside: avoid;
}

.focus-section > p {
  color: var(--copy);
  font-size: 0.92rem;
  line-height: 1.45;
}

.summary-grid {
  display: grid;
  gap: 10px;
}

.mini-summary,
.internal-unit {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-card);
  color: inherit;
  text-align: left;
}

.mini-summary span,
.internal-unit span,
.evidence-badge {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mini-summary strong,
.internal-unit strong {
  display: block;
  margin: 3px 0;
}

.mini-summary em {
  display: block;
  color: var(--copy-soft);
  font-size: 0.8rem;
  font-style: normal;
}

.mini-summary.is-drilldown {
  cursor: zoom-in;
}

.mini-summary.is-drilldown:hover,
.mini-summary.is-drilldown:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: var(--surface-card-hover);
}

.mini-summary.is-drilldown .arch-drill-cue {
  display: flex;
  width: max-content;
  margin: 8px 0 0 auto;
  color: var(--accent);
}

.focus-dl {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 7px 10px;
  margin: 0;
}

.focus-dl dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.focus-dl dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.representation-field-section {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.representation-field-section h3,
.representation-field-legend {
  margin: 0;
}

.representation-field-legend {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.representation-field-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.representation-field-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
  line-height: 1.35;
}

.representation-field-table th,
.representation-field-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.representation-field-table thead th {
  background: var(--surface-chip);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.representation-field-table thead th:first-child,
.representation-field-table tbody th {
  width: 43%;
}

.representation-field-table tbody tr:last-child > * {
  border-bottom: 0;
}

.representation-field-table tbody th strong,
.representation-field-table td > span,
.representation-field-table td > small {
  display: block;
}

.representation-field-names {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
}

.representation-field-names code {
  padding: 2px 4px;
  border-radius: 4px;
  background: var(--surface-chip);
  color: var(--copy-soft);
  font-size: 0.62rem;
  overflow-wrap: anywhere;
}

.representation-field-shape {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.representation-field-shape i {
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.representation-field-table td > small {
  margin-top: 6px;
  color: var(--muted);
}

.claim-list,
.math-list,
.pseudo-lines {
  margin: 0;
  padding-left: 20px;
}

.claim-list li,
.math-list li,
.pseudo-lines li {
  margin-bottom: 8px;
  color: var(--copy);
  line-height: 1.42;
}

.math-list code,
.pseudo-lines code {
  display: block;
  overflow-wrap: anywhere;
}

.pseudo-lines span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.standard-block-instance {
  display: grid;
  gap: 9px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.standard-block-instance-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.standard-block-instance-meta span {
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-card));
  color: var(--copy-strong);
  font-size: 0.69rem;
  font-weight: 850;
  text-transform: uppercase;
}

.standard-block-code {
  margin: 0;
  padding: 10px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-card);
  white-space: pre-wrap;
}

.math-step {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.internal-stack,
.evidence-list,
.focus-links {
  display: grid;
  gap: 9px;
}

.citation-list {
  display: grid;
  gap: 7px;
}

.citation-entry {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-card);
}

.citation-entry a,
.citation-entry strong {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
}

.citation-entry a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.citation-entry cite,
.citation-entry p,
.citation-locator,
.citation-role {
  margin: 0;
  color: var(--copy-soft);
  font-size: 0.72rem;
  font-style: normal;
  line-height: 1.35;
}

.citation-role {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.citation-locator {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.focus-links a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.focus-links a:hover {
  text-decoration: underline;
}

.zoom-note,
.warning-note {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--violet) 30%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--violet) 12%, transparent);
}

.warning-note {
  border-color: color-mix(in srgb, var(--accent-2) 32%, transparent);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
}

.pair-block {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  margin: 10px 0 14px;
}

.pair-matrix {
  min-height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-card);
  color: var(--copy-strong);
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.pair-plus,
.pair-arrow {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

/* DiT / multi-architecture additions */

.arch-node.scale-spatial,
.arch-rep.scale-spatial {
  border-top-color: var(--accent-2);
}

.arch-node.scale-token,
.arch-rep.scale-token {
  border-top-color: var(--accent);
}

.arch-node.scale-sample,
.arch-rep.scale-sample {
  border-top-color: var(--violet);
}

/* Payload family is more specific than a module's coarse scale. */
.arch-node.flow-family-single,
.arch-node.flow-family-pair,
.arch-node.flow-family-coordinates,
.arch-node.flow-family-frames {
  border-top-color: var(--node-flow-color);
}

.arch-edge.is-contracted {
  stroke-dasharray: 2 7;
  opacity: 0.92;
}

.arch-edge-badge {
  fill: var(--violet);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-anchor: middle;
  text-transform: uppercase;
  paint-order: stroke;
  stroke: var(--edge-label-stroke);
  stroke-width: 4px;
}

.connection-chain {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.connection-chain strong {
  display: block;
  margin: 0;
  font-size: 0.72rem;
}

.connection-chain p {
  margin: 2px 0 0;
  color: var(--copy);
  font-size: 0.8rem;
  line-height: 1.35;
}

.connection-standard-blocks {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.connection-standard-blocks h3 {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.connection-standard-blocks .math-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
}

.connection-standard-blocks .math-list li {
  margin-bottom: 0;
  font-size: 0.76rem;
  line-height: 1.45;
}

.connection-standard-blocks .math-list code {
  margin-top: 3px;
  font-size: 0.72rem;
  line-height: 1.35;
}

.connection-standard-blocks .math-step {
  font-size: 0.86rem;
  line-height: 1.45;
  text-transform: none;
}

.connection-standard-blocks .math-step *,
.connection-standard-blocks mjx-container,
.connection-standard-blocks mjx-container * {
  letter-spacing: 0;
  line-height: normal;
  text-transform: none;
}

.arch-switcher,
.theme-switcher {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-control);
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
}

.theme-switcher {
  min-width: 124px;
}

.arch-switcher:focus-visible,
.theme-switcher:focus-visible {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 24%, transparent);
  outline-offset: 1px;
}

/* Representation nodes: the node IS the value shape. Generic tensors retain
   their rank glyphs; coordinates and rigid frames use semantic geometry
   illustrations. All ranks put the symbol above the box; non-scalars put
   dimensions inside it. */

.arch-rep {
  --glyph-color: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: auto;
  min-height: 0;
  padding: 6px 10px;
  border: none;
  border-radius: 0;
  background: color-mix(in srgb, var(--surface-tensor) 72%, transparent);
  box-shadow: none;
  text-align: center;
  cursor: pointer;
  font: inherit;
}

.tensor-cells {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tensor-geometry {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.arch-rep:hover,
.arch-rep:focus-visible,
.arch-rep.is-focused {
  background: var(--surface-node-hover);
  outline: 3px solid color-mix(in srgb, var(--glyph-color) 30%, transparent);
}

.arch-rep.has-field-table::after {
  content: attr(data-field-count) " fields";
  position: absolute;
  top: -9px;
  right: -8px;
  z-index: 3;
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--glyph-color) 38%, var(--line));
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--glyph-color);
  box-shadow: var(--shadow-soft);
  font-family: system-ui, sans-serif;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.035em;
  line-height: 1;
  text-transform: uppercase;
}

.arch-rep.scale-item,
.arch-rep.scale-token {
  --glyph-color: var(--accent);
}

.arch-rep.scale-item_pair,
.arch-rep.scale-sample {
  --glyph-color: var(--violet);
}

.arch-rep.scale-group,
.arch-rep.scale-spatial {
  --glyph-color: var(--accent-2);
}

.arch-rep.scale-output {
  --glyph-color: var(--green);
}

.arch-rep.tensor-single {
  --glyph-color: var(--representation-single);
}

.arch-rep.tensor-pair {
  --glyph-color: var(--representation-pair);
}

.arch-rep.tensor-coordinates {
  --glyph-color: var(--representation-coordinates);
}

.arch-rep.tensor-frames {
  --glyph-color: var(--representation-frames);
}

.arch-rep.tensor-dictionary {
  --glyph-color: var(--violet);
  width: 176px;
  height: 126px;
}

.arch-rep.tensor-dictionary .tensor-box {
  width: 148px;
  height: 68px;
  border-radius: 8px;
}

.dictionary-glyph-row {
  fill: var(--copy-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 7px;
  font-weight: 700;
}

.dictionary-glyph-brace {
  fill: var(--glyph-color);
  font-family: "STIX Two Math", "Cambria Math", Georgia, serif;
  font-size: 36px;
  font-weight: 600;
}

.arch-rep.tensor-scalar {
  width: 96px;
  height: 106px;
  gap: 3px;
  padding: 4px;
}

.arch-rep.tensor-scalar .tensor-box {
  width: 40px;
  height: 40px;
}

.arch-rep.tensor-scalar .tensor-symbol {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tensor-box {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1.5px solid color-mix(in srgb, var(--glyph-color) 58%, var(--glyph-border-base));
  background: var(--surface-tensor);
}

.arch-rep.tensor-vector {
  width: 154px;
  height: 96px;
}

.arch-rep.tensor-vector .tensor-box {
  width: 132px;
  height: 24px;
}

.arch-rep.tensor-single {
  width: 164px;
  height: 96px;
}

.arch-rep.tensor-single .tensor-box {
  width: 142px;
  height: 16px;
  border-radius: 999px;
}

.arch-rep.tensor-single .tensor-dims {
  padding: 1px 6px;
  background: color-mix(in srgb, var(--surface-tensor-label) 86%, transparent);
  color: var(--ink);
  font-size: 0.64rem;
  line-height: 1;
}

.arch-rep.tensor-matrix {
  width: 128px;
  height: 142px;
}

.arch-rep.tensor-matrix .tensor-box {
  width: 104px;
  height: 72px;
}

.arch-rep.tensor-pair {
  width: 112px;
  height: 154px;
}

.arch-rep.tensor-pair .tensor-box {
  width: 86px;
  height: 86px;
}

.arch-rep.tensor-volume {
  width: 136px;
  height: 146px;
  margin-top: 10px;
  margin-right: 8px;
}

.arch-rep.tensor-volume .tensor-box {
  width: 104px;
  height: 70px;
  box-shadow:
    7px -7px 0 -1.5px var(--tensor-volume-stack),
    7px -7px 0 0 var(--glyph-color);
}

.arch-rep.tensor-coordinates {
  width: 140px;
  height: 146px;
}

.arch-rep.tensor-coordinates .tensor-box {
  width: 112px;
  height: 76px;
  border-radius: 16px;
}

.arch-rep.tensor-frames {
  width: 144px;
  height: 150px;
}

.arch-rep.tensor-frames .tensor-box {
  width: 116px;
  height: 80px;
  border-radius: 10px;
}

.arch-rep.tensor-coordinates .tensor-dims,
.arch-rep.tensor-frames .tensor-dims {
  position: absolute;
  left: 50%;
  bottom: 5px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.geometry-point {
  fill: color-mix(in srgb, var(--glyph-color) 78%, var(--surface-tensor));
  stroke: var(--glyph-color);
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
}

.geometry-point-muted,
.geometry-frame-muted {
  opacity: 0.52;
}

.geometry-origin {
  fill: var(--glyph-color);
  stroke: var(--surface-tensor);
  stroke-width: 1.2px;
  vector-effect: non-scaling-stroke;
}

.geometry-axis {
  fill: none;
  stroke-width: 2px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.tensor-geometry .axis-x {
  stroke: var(--accent-2);
}

.tensor-geometry .axis-y {
  stroke: var(--green);
}

.tensor-geometry .axis-z {
  stroke: var(--blue);
}

.geometry-axis-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 7px;
  font-weight: 800;
}

.axis-x-label {
  fill: var(--accent-2);
}

.axis-y-label {
  fill: var(--green);
}

.axis-z-label {
  fill: var(--blue);
}

.arch-rep .tensor-symbol {
  position: relative;
  z-index: 2;
  display: block;
  max-width: 100%;
  margin: 0;
  padding: 1px 6px;
  background: var(--surface-tensor-label);
  border-radius: 3px;
  font-family: "STIX Two Math", "Cambria Math", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.arch-rep .tensor-dims {
  position: relative;
  z-index: 2;
  padding: 1px 5px;
  background: var(--surface-tensor-label);
  border-radius: 3px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.1;
}

.arch-rep .tensor-meaning {
  display: -webkit-box;
  width: 100%;
  max-height: 2.4em;
  padding: 0 2px;
  border: 0;
  background: transparent;
  overflow: hidden;
  color: var(--copy-soft);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-transform: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* ELK automatic layout mode: absolute positions from the layout engine.
   The grid col/row placement remains the fallback when ELK is unavailable. */

.module-layer.is-elk-layout {
  display: block;
  inset: auto;
  left: var(--board-inset-x);
  top: var(--board-inset-top);
}

.module-layer.is-elk-layout.is-layouting {
  opacity: 0;
}

.module-layer.is-elk-layout .arch-node,
.module-layer.is-elk-layout .arch-rep {
  position: absolute;
  margin: 0;
}

.representation-lane-layer.is-elk-layout .representation-lane {
  display: none;
}

.architecture-canvas.is-elk-layout .scale-lane-layer {
  display: none;
}

/* Semantic-zoom board transitions: dive into a module, emerge back out */

.architecture-canvas.is-board-transition .module-layer,
.architecture-canvas.is-board-transition .board-region-layer,
.architecture-canvas.is-board-transition .representation-lane-layer,
.architecture-canvas.is-board-transition .edge-layer,
.architecture-canvas.is-board-transition .reference-panel-layer {
  transition:
    transform var(--board-transition-ms, 200ms) cubic-bezier(0.33, 0, 0.2, 1),
    opacity var(--board-transition-ms, 200ms) ease;
}

.architecture-canvas.is-board-fading .module-layer,
.architecture-canvas.is-board-fading .board-region-layer,
.architecture-canvas.is-board-fading .representation-lane-layer,
.architecture-canvas.is-board-fading .edge-layer,
.architecture-canvas.is-board-fading .reference-panel-layer {
  opacity: 0;
}

/* Contracted-edge hover: mini chain canvas instead of a wall of text */

.connection-chain-canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin: 9px 0 2px;
}

.chain-chip {
  max-width: 190px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-control);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chain-chip.is-module {
  border-top: 3px solid var(--accent);
}

.chain-chip.is-rep {
  border-radius: 0;
  font-family: "STIX Two Math", "Cambria Math", Georgia, serif;
  font-style: italic;
}

.chain-chip.is-op {
  border-color: var(--violet);
}

.chain-chip.is-hidden-hop {
  background: color-mix(in srgb, var(--violet) 13%, transparent);
}

.chain-arrow {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  line-height: 1;
}

.chain-arrow em {
  max-width: 150px;
  margin-bottom: 0;
  font-size: 0.6rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chain-hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
}

/* Operator nodes: elementwise ops render as circuit-style circles */

.arch-op-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: auto;
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.arch-op-node .op-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface-control);
  box-shadow: var(--node-shadow);
  color: var(--accent);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
}

.arch-op-node:hover .op-circle,
.arch-op-node.is-focused .op-circle {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border-color: var(--accent);
}

.arch-op-node .op-label {
  color: var(--muted);
  font-family: "STIX Two Math", "Cambria Math", Georgia, serif;
  font-style: italic;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.arch-op-node.scale-sample .op-circle {
  border-color: var(--violet);
  color: var(--violet);
}

/* Chain endpoints are visible on the board; ghost them so hidden steps pop */

.chain-chip.is-endpoint {
  border: 1.5px dashed color-mix(in srgb, var(--muted) 56%, transparent);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.chain-chip.is-endpoint.is-module {
  border-top: 1.5px dashed color-mix(in srgb, var(--muted) 56%, transparent);
}

.chain-chip.is-hidden-hop {
  box-shadow: 0 3px 10px color-mix(in srgb, var(--violet) 22%, transparent);
}

/* Compact/micro cards: prose lives in the inspector, not on the card */

.arch-node.treatment-compact,
.arch-node.density-compact {
  min-height: 0;
  width: auto;
  max-width: 100%;
}

.treatment-chip strong,
.density-micro strong {
  font-size: 0.8rem;
  line-height: 1.15;
  overflow-wrap: normal;
  white-space: nowrap;
}

.arch-edge-label {
  stroke-width: 7px;
}

/* The audience workspace has one navigation surface. Semantic depth lives in
   this breadcrumb; geometric magnification stays in the canvas controls. */

.board-navigation {
  position: absolute;
  top: 14px;
  right: 14px;
  left: 14px;
  z-index: 36;
  display: flex;
  min-width: 0;
  min-height: 46px;
  align-items: center;
  gap: 7px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 10px;
  background: var(--surface-popover);
  box-shadow: var(--shadow-soft);
}

.board-back {
  display: inline-flex;
  min-width: 40px;
  min-height: 36px;
  max-width: 220px;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  overflow: hidden;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 850;
}

.board-back[hidden] {
  display: none;
}

.board-back-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-breadcrumbs {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
}

.board-breadcrumb {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
}

.board-breadcrumb + .board-breadcrumb::before {
  content: "›";
  flex: none;
  color: var(--muted);
  font-weight: 900;
}

.board-breadcrumb button,
.board-breadcrumb span {
  display: block;
  min-width: 0;
  max-width: 260px;
  padding: 7px 8px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--copy-soft);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-breadcrumb button {
  cursor: pointer;
}

.board-breadcrumb button:hover,
.board-breadcrumb button:focus-visible,
.board-back:hover,
.board-back:focus-visible {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}

.board-breadcrumb.is-current {
  flex: 1;
}

.board-breadcrumb.is-current span {
  color: var(--ink);
  font-weight: 900;
}

.board-depth {
  flex: none;
  padding: 6px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  color: var(--accent);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  white-space: nowrap;
}

.board-copy-link {
  display: inline-flex;
  flex: none;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.board-copy-link svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.board-copy-link:hover,
.board-copy-link:focus-visible {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.board-breadcrumb button:focus-visible,
.board-back:focus-visible,
.board-copy-link:focus-visible,
.renderer-page .canvas-controls button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset: 1px;
}

.canvas-tooltip {
  position: fixed;
  z-index: 90;
  width: min(330px, calc(100vw - 16px));
  max-height: min(420px, 70vh);
  padding: 12px;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 10px;
  background: var(--surface-popover);
  box-shadow: 0 16px 42px color-mix(in srgb, var(--ink) 17%, transparent);
  pointer-events: none;
}

.canvas-tooltip[hidden] {
  display: none;
}

.model-map {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 35;
  display: grid;
  width: min(330px, calc(100% - 28px));
  gap: 6px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 8px;
  background: var(--surface-popover);
  box-shadow: var(--shadow-soft);
  cursor: default;
  pointer-events: auto;
  transition: opacity 120ms ease;
}

.model-map.is-empty {
  visibility: hidden;
  opacity: 0;
}

.model-map.is-collapsed {
  width: auto;
  min-width: 132px;
  gap: 0;
}

.model-map-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.57rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  line-height: 1.2;
  text-transform: uppercase;
}

.model-map-heading-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.model-map-body {
  display: grid;
  gap: 6px;
}

.model-map-body[hidden] {
  display: none;
}

.model-map-collapse {
  display: inline-grid;
  width: 22px;
  height: 22px;
  padding: 0;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-card) 76%, transparent);
  color: var(--accent);
  font: 900 0.82rem/1 var(--sans);
  cursor: pointer;
}

.model-map-collapse:hover,
.model-map-collapse:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-card));
  color: var(--ink);
}

.model-map-view-toggle {
  display: inline-flex;
  padding: 2px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-card) 76%, transparent);
}

.model-map-view-toggle[hidden] {
  display: none;
}

.model-map-view-toggle button {
  padding: 3px 7px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  letter-spacing: 0.025em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
}

.model-map-view-toggle button:hover,
.model-map-view-toggle button:focus-visible {
  color: var(--ink);
}

.model-map-view-toggle button.is-selected {
  background: color-mix(in srgb, var(--accent) 15%, var(--surface-card));
  color: var(--accent);
}

.model-map-context {
  min-width: 0;
  overflow: hidden;
  color: var(--accent);
  letter-spacing: 0.02em;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-map-board {
  display: block;
  width: 100%;
  height: 96px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--canvas-bg);
}

.model-map-edge {
  fill: none;
  stroke: var(--edge-default);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.3px;
}

.model-map-edges {
  opacity: 0.52;
}

.model-map-edge.tone-conditioning {
  stroke: var(--edge-conditioning);
  stroke-dasharray: 4 3;
}

.model-map-edge.tone-skip {
  stroke: var(--edge-skip);
  stroke-dasharray: 8 3 1 3;
}

.model-map-edge.flow-family-single:not(.tone-skip) {
  stroke: var(--representation-single);
}

.model-map-edge.flow-family-pair:not(.tone-skip) {
  stroke: var(--representation-pair);
}

.model-map-edge.flow-family-coordinates:not(.tone-skip) {
  stroke: var(--representation-coordinates);
}

.model-map-edge.flow-family-frames:not(.tone-skip) {
  stroke: var(--representation-frames);
}

.model-map-edge.is-contracted {
  stroke-dasharray: 5 3;
}

.model-map-arrow.tone-default {
  fill: var(--edge-default);
}

.model-map-arrow.tone-conditioning {
  fill: var(--edge-conditioning);
}

.model-map-arrow.tone-skip {
  fill: var(--edge-skip);
}

.model-map-arrow.flow-family-single {
  fill: var(--representation-single);
}

.model-map-arrow.flow-family-pair {
  fill: var(--representation-pair);
}

.model-map-arrow.flow-family-coordinates {
  fill: var(--representation-coordinates);
}

.model-map-arrow.flow-family-frames {
  fill: var(--representation-frames);
}

.model-map-node {
  --model-map-node-accent: var(--accent);
  opacity: 0.72;
}

.model-map-node.scale-item_pair,
.model-map-node.scale-sample {
  --model-map-node-accent: var(--violet);
}

.model-map-node.scale-group,
.model-map-node.scale-spatial {
  --model-map-node-accent: var(--accent-2);
}

.model-map-node.scale-output {
  --model-map-node-accent: var(--green);
}

.model-map-node.is-single {
  --model-map-node-accent: var(--representation-single);
}

.model-map-node.is-pair {
  --model-map-node-accent: var(--representation-pair);
}

.model-map-node.is-coordinates {
  --model-map-node-accent: var(--representation-coordinates);
}

.model-map-node.is-frames {
  --model-map-node-accent: var(--representation-frames);
}

.model-map-node.is-dictionary {
  --model-map-node-accent: var(--violet);
}

.model-map-node.flow-family-single {
  --model-map-node-accent: var(--representation-single);
}

.model-map-node.flow-family-pair {
  --model-map-node-accent: var(--representation-pair);
}

.model-map-node.flow-family-coordinates {
  --model-map-node-accent: var(--representation-coordinates);
}

.model-map-node.flow-family-frames {
  --model-map-node-accent: var(--representation-frames);
}

.model-map-nodes.has-current .model-map-node:not(.is-current) {
  opacity: 0.3;
}

.model-map-shape {
  fill: color-mix(in srgb, var(--surface-node) 92%, var(--model-map-node-accent));
  stroke: color-mix(in srgb, var(--model-map-node-accent) 52%, var(--line));
  stroke-width: 1.35px;
}

.model-map-module-accent {
  fill: var(--model-map-node-accent);
  opacity: 0.85;
}

.model-map-tensor-front {
  fill: color-mix(in srgb, var(--surface-tensor) 80%, var(--model-map-node-accent));
}

.model-map-tensor-back {
  fill: color-mix(in srgb, var(--surface-card) 88%, var(--model-map-node-accent));
  opacity: 0.78;
}

.model-map-tensor-grid {
  stroke: color-mix(in srgb, var(--model-map-node-accent) 46%, var(--surface-card));
  stroke-width: 0.75px;
  opacity: 0.66;
}

.model-map-dictionary-row {
  stroke: color-mix(in srgb, var(--model-map-node-accent) 58%, var(--surface-card));
  stroke-width: 2px;
  stroke-linecap: round;
  opacity: 0.78;
}

.model-map-coordinate-point {
  fill: var(--model-map-node-accent);
  stroke: color-mix(in srgb, var(--surface-tensor) 78%, var(--model-map-node-accent));
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}

.model-map-coordinate-point.is-muted,
.model-map-geometry-origin.is-muted,
.model-map-geometry-axis.is-muted {
  opacity: 0.48;
}

.model-map-geometry-origin {
  fill: var(--model-map-node-accent);
  stroke: var(--surface-tensor);
  stroke-width: 0.9px;
  vector-effect: non-scaling-stroke;
}

.model-map-geometry-axis {
  stroke-width: 1.35px;
  stroke-linecap: round;
}

.model-map-geometry-axis.axis-x {
  stroke: var(--accent-2);
}

.model-map-geometry-axis.axis-y {
  stroke: var(--green);
}

.model-map-geometry-axis.axis-z {
  stroke: var(--blue);
}

.model-map-operation-shape {
  fill: color-mix(in srgb, var(--surface-card) 76%, var(--model-map-node-accent));
  stroke-width: 2px;
}

.model-map-current-halo {
  visibility: hidden;
  fill: color-mix(in srgb, var(--accent) 13%, transparent);
  stroke: var(--accent);
  stroke-width: 2.5px;
}

.model-map-node.is-current {
  opacity: 1;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 40%, transparent));
}

.model-map-node.is-current .model-map-current-halo {
  visibility: visible;
}

.model-map-node.is-current .model-map-shape {
  fill: color-mix(in srgb, var(--accent) 22%, var(--surface-node));
  stroke: var(--accent);
  stroke-width: 2px;
}

.model-map-node.is-current .model-map-module-accent {
  fill: var(--accent);
  opacity: 1;
}

.model-map-a11y {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.renderer-page .canvas-controls {
  bottom: 14px;
  z-index: 35;
  align-items: stretch;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-control);
  box-shadow: var(--shadow-soft);
}

.renderer-page .canvas-controls button {
  min-width: 38px;
  min-height: 38px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
}

.renderer-page .canvas-controls button:hover {
  background: color-mix(in srgb, var(--accent) 11%, transparent);
}

.renderer-page .canvas-controls .canvas-zoom-value {
  min-width: 54px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.renderer-page .canvas-controls .canvas-fit-button {
  border-left: 1px solid var(--line);
  border-radius: 0 5px 5px 0;
  color: var(--accent);
}

.focus-panel > [hidden],
.focus-panel-pages > [hidden] {
  display: none;
}

.focus-header-actions > [hidden] {
  display: none;
}

.renderer-page .focus-panel {
  position: relative;
  z-index: 2;
  background: var(--surface-popover);
  box-shadow: var(--shadow-soft);
  transition:
    background-color 120ms ease,
    box-shadow 120ms ease;
}

.renderer-page .focus-body {
  min-height: 0;
}

.renderer-page .focus-panel:not(.is-selected) .focus-body {
  color: var(--copy-soft);
}

.renderer-page .focus-panel:not(.is-selected) .focus-takeaway > p:first-child {
  margin-bottom: 10px;
  color: var(--copy);
  font-size: 0.88rem;
  line-height: 1.4;
}

.renderer-page .focus-panel.is-selected {
  box-shadow:
    inset 4px 0 0 var(--accent),
    var(--shadow-soft);
}

.focus-guidance {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted) !important;
  font-size: 0.76rem !important;
}

.arch-edge.is-selected {
  stroke: var(--accent);
  stroke-width: 3px;
}

.arch-edge-label.is-selected,
.arch-edge-badge.is-selected {
  fill: var(--accent);
  font-weight: 900;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--accent);
  font-weight: 900;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .architecture-canvas.has-reference-panels {
    --board-inset-right: clamp(280px, 34vw, 340px);
  }

  .model-map {
    display: none;
  }

  .renderer-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .comparison-band {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .comparison-subjects,
  .comparison-group-summary {
    grid-column: 1;
  }

  .comparison-actions {
    grid-column: 2;
  }

  .renderer-page.is-comparing .focus-panel {
    position: relative;
    top: auto;
    height: min(38svh, 330px);
  }

  .renderer-page .focus-panel {
    flex-direction: row;
    height: min(38svh, 330px);
  }

  .focus-panel-header {
    width: 230px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .focus-panel-pages {
    min-width: 0;
  }

  .renderer-page .focus-panel:not(.is-selected) .focus-takeaway > p:first-child {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .renderer-page .focus-panel:not(.is-selected) .focus-takeaway ul,
  .renderer-page .focus-panel:not(.is-selected) .focus-guidance {
    display: none;
  }
}

@media (max-width: 680px) {
  .architecture-canvas.has-reference-panels {
    --board-inset-right: var(--board-inset-x);
  }

  .reference-panel-layer {
    top: calc(var(--board-inset-top) + 6px);
    right: 12px;
    bottom: auto;
    width: min(230px, calc(100% - 24px));
    max-height: min(58%, 360px);
  }

  .reference-panel-caption {
    display: none;
  }

  .reference-figure-dialog {
    width: calc(100vw - 12px);
    height: calc(100svh - 12px);
  }

  .reference-figure-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
  }

  .reference-figure-copy p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .reference-figure-controls {
    align-self: end;
  }

  .renderer-shell {
    width: calc(100vw - 12px);
    padding: 6px 0;
  }

  .renderer-page.is-comparing .renderer-shell {
    width: calc(100vw - 12px);
  }

  .comparison-band {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .comparison-band-heading,
  .comparison-subjects,
  .comparison-group-summary,
  .comparison-actions {
    grid-column: 1;
    grid-row: auto;
  }

  .comparison-subjects {
    grid-template-columns: 1fr 1fr;
  }

  .comparison-actions {
    flex-wrap: wrap;
  }

  .comparison-mobile-switch {
    display: inline-flex;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-chip);
  }

  .comparison-mobile-switch button {
    min-width: 36px;
    min-height: 30px;
    padding: 3px 8px;
    border: 0;
    background: transparent;
  }

  .comparison-mobile-switch button[aria-pressed="true"] {
    background: var(--surface-control);
    color: var(--accent);
    box-shadow: var(--shadow-soft);
  }

  .renderer-page.is-comparing #architectureCanvas,
  .comparison-canvas {
    height: 64svh;
    min-height: 440px;
  }

  .renderer-page.is-comparing[data-comparison-mobile-side="primary"] .comparison-canvas {
    display: none;
  }

  .renderer-page.is-comparing[data-comparison-mobile-side="counterpart"] #architectureCanvas {
    display: none;
  }

  .renderer-page.is-comparing .focus-panel {
    height: min(42svh, 340px);
  }

  .renderer-header {
    display: grid;
    gap: 7px;
    margin-bottom: 7px;
  }

  .renderer-identity {
    gap: 8px;
  }

  .renderer-library-link {
    padding: 6px 8px;
    font-size: 0.66rem;
  }

  .renderer-header h1 {
    font-size: 1.08rem;
  }

  .renderer-header p:not(.eyebrow) {
    display: none;
  }

  .renderer-toolbar {
    width: 100%;
    align-items: end;
    flex-wrap: wrap;
  }

  .arch-switcher-label {
    flex: 1;
  }

  .arch-switcher,
  .theme-switcher {
    width: 100%;
    min-height: 36px;
  }

  .theme-switcher-label {
    width: min(130px, 28vw);
  }

  .renderer-page .architecture-canvas {
    --board-inset-x: 20px;
    --board-inset-top: 72px;
    --board-inset-bottom: 68px;
  }

  .renderer-page .focus-panel {
    flex-direction: column;
    height: min(42svh, 340px);
  }

  .focus-panel-header {
    width: auto;
    padding: 9px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .focus-body {
    padding: 0 10px 10px;
  }

  .semantic-trace-body {
    padding: 10px;
  }

  .focus-page-heading {
    padding-inline: 10px;
  }

  .board-navigation {
    top: 10px;
    right: 10px;
    left: 10px;
  }

  .board-back-label {
    max-width: 82px;
  }

  .board-breadcrumb button,
  .board-breadcrumb span {
    max-width: 170px;
  }

  .board-depth {
    padding-inline: 7px;
  }

  .board-copy-link {
    min-width: 34px;
    justify-content: center;
    padding-inline: 7px;
  }

  .board-copy-link-label {
    display: none;
  }

  .renderer-page .canvas-controls {
    bottom: 10px;
    left: 10px;
  }
}
