.arch-wrap {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  padding: clamp(1.25rem, 4vw, 2.5rem);
  overflow-x: auto;
}

.arch-diagram {
  min-width: 720px;
}

.arch-node {
  fill: var(--bg-surface-2);
  stroke: var(--border-strong);
  stroke-width: 1;
}

.arch-node--core {
  stroke: var(--accent-violet);
}

/* Node labels are rendered as HTML inside <foreignObject> so long
   translations wrap naturally instead of overflowing the SVG box. */
.arch-node-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
  padding: 4px 10px;
  box-sizing: border-box;
}

.arch-node-title {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.25;
}

.arch-node-sub {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.3;
}

.arch-line {
  stroke: var(--border-strong);
  stroke-width: 1.25;
  fill: none;
}

.arch-line--live {
  stroke: url(#segGradient);
  stroke-dasharray: 4 4;
  animation: dash-flow 1.6s linear infinite;
}

@keyframes dash-flow {
  to {
    stroke-dashoffset: -16;
  }
}

.arch-port {
  font-family: var(--font-mono);
  fill: var(--accent-cyan);
  font-size: 11px;
}

/* Endpoint legend below the diagram */
.arch-legend {
  margin-top: 1.5rem;
}

.arch-legend-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
}

.arch-legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem 1.75rem;
}

.arch-legend-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.arch-legend-key {
  color: var(--accent-cyan);
  font-size: 0.78rem;
  word-break: break-word;
}

.arch-legend-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}
