/* Diagram figures (app/diagrams.py). Colors come from the site tokens, so light and dark both work. */
.dg { margin: 22px 0 26px; padding: 18px 18px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.dg svg { display: block; width: 100%; height: auto; max-height: 520px; font-family: var(--font, system-ui, sans-serif); }
.dg figcaption { margin-top: 10px; font-size: var(--fs-xs); color: var(--muted); text-align: center; line-height: 1.5; }
.dg .dg-box  { fill: var(--surface-2, var(--bg)); stroke: var(--line-strong, var(--line)); stroke-width: 1.5; }
.dg .dg-fact { fill: color-mix(in srgb, var(--accent) 16%, var(--surface)); stroke: var(--accent); stroke-width: 1.8; }
.dg .dg-dim  { fill: color-mix(in srgb, #34d399 12%, var(--surface)); stroke: #34d399; stroke-width: 1.5; }
.dg .dg-hl   { fill: color-mix(in srgb, #f59e0b 16%, var(--surface)); stroke: #f59e0b; stroke-width: 1.5; }
.dg .dg-line { fill: none; stroke: var(--muted); stroke-width: 1.6; }
.dg .dg-arrow { fill: none; stroke: var(--accent); stroke-width: 2; marker-end: url(#dg-ah); }
.dg .dg-ahead { fill: var(--accent); }
.dg .dg-t  { fill: var(--ink); font-size: 14px; font-weight: 700; }
.dg .dg-tm { fill: var(--ink); font-size: 12.5px; }
.dg .dg-ts { fill: var(--muted); font-size: 11.5px; }
.dg .dg-mono { font-family: var(--mono, monospace); }
.dg .dg-acc { fill: var(--accent); } .dg .dg-ok { fill: #10b981; } .dg .dg-warn { fill: #f59e0b; } .dg .dg-bad { fill: #ef4444; }
.dg .dg-acc-s { stroke: var(--accent); } .dg .dg-ok-s { stroke: #10b981; } .dg .dg-bad-s { stroke: #ef4444; }
/* Added for the analyze diagrams: arrows, table headers, bold labels and dimmed rows. */
.dg .dg-flow { fill: none; stroke: var(--accent); stroke-width: 2; }
.dg .dg-th { fill: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.dg .dg-tb { fill: var(--ink); font-size: 12.5px; font-weight: 700; }
.dg .dg-panel { fill: var(--bg); stroke: var(--line); stroke-width: 1; }

/* ---- a11y: enlarge a diagram (a11y.js). Shown on phones, or when the text would draw under 11px. ---- */
.dg-enlarge { display: flex; align-items: center; gap: 6px; margin: 10px auto 0; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--accent-dark);
  font: 600 var(--fs-xs) var(--font); cursor: zoom-in; }
.dg-enlarge:hover { background: var(--accent-soft); }
.dg-enlarge[hidden] { display: none; }
.dgz { padding: 0; border: 0; border-radius: 14px; width: min(96vw, 1200px); height: min(90vh, 900px);
  max-width: none; max-height: none; margin: auto; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.dgz::backdrop { background: rgba(2, 6, 23, .72); }
.dgz-box { display: flex; flex-direction: column; height: 100%; }
.dgz-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--line); }
.dgz-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--fs-sm); font-weight: 700; color: var(--ink); }
.dgz-tools { display: flex; align-items: center; gap: 6px; }
.dgz-btn { min-width: 40px; min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--bg-soft); color: var(--ink); font: 600 var(--fs-sm) var(--font); cursor: pointer; }
.dgz-btn:disabled { opacity: .45; cursor: default; }
.dgz-level { min-width: 52px; text-align: center; font-size: var(--fs-xs); color: var(--muted); }
.dgz-scroll { flex: 1; min-height: 0; overflow: auto; padding: 16px; -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y pinch-zoom; overscroll-behavior: contain; }
.dgz-scroll svg { display: block; height: auto; max-height: none; max-width: none; }
.dgz-cap { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--muted); }
.dgz-cap:empty { display: none; }
html.dgz-open { overflow: hidden; }
