/* Canvas calling system diagram. Black/white with restrained teal. No gradients. */
:root {
  color-scheme: light;
  --ink: #1c2330;
  --muted: #5d6b7e;
  --line: #d9dee6;
  --paper: #ffffff;
  --wash: #f4f6f8;
  --teal: #0e6b62;
  --teal-soft: #e6f2f0;
  --focus: #0e6b62;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
button {
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
}
button:hover { background: var(--wash); }
button:disabled { opacity: 0.45; cursor: default; }
button:focus-visible, a:focus-visible, svg:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
a { color: var(--teal); text-underline-offset: 3px; }
.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  padding: 12px;
  background: #fff;
  z-index: 30;
}
.skip-link:focus { top: 10px; }
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  min-height: 60px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  flex-wrap: wrap;
}
.wordmark {
  text-decoration: none;
  color: var(--ink);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.08em;
  line-height: 1;
}
.wordmark span { color: var(--teal); }
.lab-title { font-size: 15px; font-weight: 600; margin: 0; }
.surface-nav { display: flex; gap: 4px; }
.surface-nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 7px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.surface-nav a:hover { background: var(--wash); }
.surface-nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--wash);
  font-weight: 600;
}
.document-meta { margin-left: auto; font-size: 11px; color: var(--muted); max-width: 260px; }
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  background: #fff;
}
.crumbs button {
  border-color: transparent;
  background: transparent;
  color: var(--teal);
  padding: 6px 8px;
}
.crumbs button:disabled { color: var(--ink); font-weight: 600; }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: calc(100dvh - 160px);
}
.canvas-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 480px;
}
.stage-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 0;
}
.stage-heading h2 { font-size: 20px; margin: 0; letter-spacing: -0.02em; }
.chapter-note { font-size: 12px; color: var(--muted); margin: 4px 0 0; max-width: 60ch; }
.controls { display: flex; gap: 6px; flex-wrap: wrap; flex: none; }
.controls button { font-size: 13px; }
.zoom-readout { font-size: 11px; color: var(--muted); margin: 6px 20px 0; }
.stage {
  position: relative;
  flex: 1;
  min-height: 320px;
  margin: 8px 20px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
#diagram { position:absolute; inset:0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#diagram:active { cursor: grabbing; }
.canvas-hint {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
  margin: 0;
}
.practice-note { font-size: 11px; color: var(--muted); margin: 8px 20px 16px; }
/* SVG graph */
.node { cursor: pointer; }
.node-box { fill: #fff; stroke: #9aa7b8; stroke-width: 1.5; }
.node-title { font-size: 15px; font-weight: 600; fill: var(--ink); }
.node-sub { font-size: 11.5px; fill: var(--muted); }
.node-drill { font-size: 11px; font-weight: 600; fill: var(--teal); }
.node:hover .node-box, .node:focus-visible .node-box { stroke: var(--teal); stroke-width: 3; }
.node.selected .node-box { stroke: var(--teal); stroke-width: 3; fill: var(--teal-soft); }
.edge-line { fill: none; stroke: #7c8a9d; stroke-width: 1.6; }
.edge-label {
  font-size: 12px;
  fill: #465364;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 6px;
  stroke-linejoin: round;
}
/* Inspector */
.inspector {
  border-left: 1px solid var(--line);
  padding: 18px;
  background: #fff;
  overflow: auto;
}
.inspector-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.inspector-heading h2 { font-size: 15px; margin: 0; }
#inspector-toggle { border-color: transparent; font-size: 13px; }
.kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 14px 0 4px;
}
#inspector-name { font-size: 19px; margin: 0 0 6px; letter-spacing: -0.02em; }
.inspector p { font-size: 13px; color: var(--muted); }
.inspector h4 { font-size: 12px; margin: 16px 0 6px; }
.inspector ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.inspector ul a { font-size: 12px; font-family: monospace; overflow-wrap: anywhere; }
#inspector-links button { text-align: left; font-size: 12px; width: 100%; }
.selection-actions { display: flex; gap: 6px; margin-top: 16px; }
.selection-actions button { flex: 1; font-size: 13px; background: var(--teal); border-color: var(--teal); color: #fff; }
.selection-actions button:hover { background: #0a544d; }
/* Text alternative */
#text-alternative {
  border-top: 1px solid var(--line);
  padding: 24px 20px 48px;
  max-width: 80ch;
}
#text-alternative h2 { font-size: 18px; }
#text-alternative h3 { font-size: 14px; margin-top: 20px; }
#text-alternative li { font-size: 13px; margin-bottom: 6px; }
@media (max-width: 900px) {
  .workspace { display: block; }
  .canvas-workspace { min-height: 0; }
  .stage { min-height: min(65dvh, 620px); }
  .inspector {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: 52dvh;
  }
  .document-meta { display: none; }
}
@media (max-width: 560px) {
  .stage-heading { flex-direction: column; }
  .stage { margin: 8px 12px 0; }
  .zoom-readout, .practice-note { margin-left: 12px; margin-right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@media(max-width:560px){.edge-label{display:none}.canvas-hint{font-size:9px;top:auto;bottom:6px;right:6px;background:#ffffffed;padding:3px}.node-sub{font-size:11px}}
