/* Ancalagon — SVG diagram kit */
.diagram {
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background:
    linear-gradient(180deg, rgba(168,85,247,0.04), transparent),
    repeating-linear-gradient(0deg, rgba(192,132,252,0.04) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, rgba(192,132,252,0.04) 0 1px, transparent 1px 40px);
  padding: 32px 24px;
  margin: 40px 0;
  overflow: hidden;
}
.diagram-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 20px;
  display: flex; justify-content: space-between; align-items: center;
}
.diagram-title .meta { color: var(--purple-300); }
.diagram svg { width: 100%; height: auto; display: block; }

/* SVG text reset */
.diagram text {
  font-family: var(--font-mono);
  fill: var(--fg);
}

/* Node common */
.dg-node { fill: #14091f; stroke: rgba(192,132,252,0.35); stroke-width: 1.2; }
.dg-node-accent { fill: rgba(168,85,247,0.12); stroke: var(--purple-400); stroke-width: 1.4; }
.dg-node-hot { fill: rgba(217,70,239,0.14); stroke: var(--accent); stroke-width: 1.4; }
.dg-node-ok { fill: rgba(34,197,94,0.08); stroke: #22c55e; stroke-width: 1.2; }
.dg-node-warn { fill: rgba(251,191,36,0.08); stroke: #fbbf24; stroke-width: 1.2; }

.dg-label { font-size: 12px; fill: #f5f0ff; font-weight: 500; }
.dg-sub { font-size: 10px; fill: var(--purple-200); letter-spacing: 0.04em; }
.dg-tag { font-size: 9px; fill: var(--purple-300); letter-spacing: 0.12em; text-transform: uppercase; }
.dg-tiny { font-size: 9px; fill: var(--muted); }

/* Connectors */
.dg-line { stroke: rgba(192,132,252,0.4); stroke-width: 1.2; fill: none; }
.dg-line-hot { stroke: var(--accent); stroke-width: 1.4; fill: none; }
.dg-line-ok { stroke: #22c55e; stroke-width: 1.2; fill: none; stroke-dasharray: 3 3; }
.dg-line-dash { stroke: rgba(192,132,252,0.3); stroke-width: 1.1; fill: none; stroke-dasharray: 4 4; }

/* Animation */
@keyframes flow {
  to { stroke-dashoffset: -20; }
}
.dg-flow {
  stroke: var(--purple-300);
  stroke-width: 1.4;
  fill: none;
  stroke-dasharray: 6 6;
  animation: flow 1.2s linear infinite;
}
.dg-flow-hot {
  stroke: var(--accent);
  stroke-width: 1.6;
  fill: none;
  stroke-dasharray: 6 6;
  animation: flow 0.9s linear infinite;
}

/* Pulse dot */
@keyframes pulseDot { 0%,100% { r: 3; opacity:1 } 50% { r: 5; opacity: 0.55 } }
.dg-pulse { fill: var(--accent); animation: pulseDot 1.8s ease-in-out infinite; }
.dg-pulse-ok { fill: #22c55e; animation: pulseDot 2.2s ease-in-out infinite; }

.diagram-caption {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--fg-3);
  margin-top: 16px;
  padding-top: 14px; border-top: 1px dashed var(--line);
  display: flex; gap: 18px; flex-wrap: wrap;
}
.diagram-caption .chip { display: inline-flex; align-items: center; gap: 6px; }
.diagram-caption .sq { width: 10px; height: 10px; border-radius: 2px; display: inline-block; border: 1px solid; }
.sq-p { border-color: var(--purple-400); background: rgba(168,85,247,0.18); }
.sq-h { border-color: var(--accent); background: rgba(217,70,239,0.18); }
.sq-o { border-color: #22c55e; background: rgba(34,197,94,0.12); }

/* Compact inline diagram (for homepage) */
.diag-inline { border: 1px solid var(--line); border-radius: var(--r-3); padding: 24px; background: linear-gradient(180deg, rgba(168,85,247,0.03), transparent); }
