/* Animated flow diagram (inline SVG in posts).
   Loaded only on articles that set "Stylesheet: nono-oauth-diagram.css". */
.flow-diagram {
    --flow-green: #15803d;
    --flow-amber: #b45309;
    --flow-chip-text: #ffffff;
    margin: 1.75rem 0;
    border: 1px solid var(--border);
    background: var(--surface);
}

[data-theme="dark"] .flow-diagram {
    --flow-green: #4ade80;
    --flow-amber: #fbbf24;
    --flow-chip-text: #0b1020;
}

.flow-diagram svg {
    display: block;
    width: 100%;
    height: auto;
    font-family: var(--font);
}

.flow-diagram .fd-mobile { display: none; }

@media (max-width: 575.98px) {
    .flow-diagram .fd-desktop { display: none; }
    .flow-diagram .fd-mobile { display: block; }
}

.flow-diagram .fd-zone { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 9 7; }
.flow-diagram .fd-box { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.flow-diagram .fd-agent { stroke: var(--accent); }
.flow-diagram .fd-trusted { stroke: var(--flow-green); }
.flow-diagram .fd-store { fill: var(--code-bg); }
.flow-diagram .fd-flash { fill: var(--flow-green); opacity: 0; }

.flow-diagram .fd-zone-label { font-size: 20px; font-weight: 700; letter-spacing: 0.04em; text-anchor: middle; }
.flow-diagram .fd-step { font-size: 20px; font-weight: 700; fill: var(--text); text-anchor: middle; }
.flow-diagram .fd-title { font-size: 20px; font-weight: 700; fill: var(--text); text-anchor: middle; }
.flow-diagram .fd-sub { font-size: 16px; fill: var(--muted); text-anchor: middle; }
.flow-diagram .fd-note { font-size: 17px; fill: var(--text); text-anchor: middle; }
.flow-diagram .fd-label { font-size: 16px; text-anchor: middle; }

.flow-diagram .fd-blue { fill: var(--accent); }
.flow-diagram .fd-green { fill: var(--flow-green); }
.flow-diagram .fd-amber { fill: var(--flow-amber); }

.flow-diagram .fd-line { fill: none; stroke-width: 2.5; }
.flow-diagram .fd-line.k { stroke: var(--muted); }
.flow-diagram .fd-line.g { stroke: var(--flow-green); }
.flow-diagram .fd-line.a { stroke: var(--flow-amber); }
.flow-diagram .fd-head-k { fill: var(--muted); }
.flow-diagram .fd-head-g { fill: var(--flow-green); }
.flow-diagram .fd-head-a { fill: var(--flow-amber); }

.flow-diagram .fd-life { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 6; }
.flow-diagram .fd-bg { fill: var(--surface); }

.flow-diagram .fd-chip rect { fill: var(--text); }
.flow-diagram .fd-chip text { font-family: var(--mono); font-size: 12px; text-anchor: middle; fill: var(--bg); }
.flow-diagram .fd-chip.g rect { fill: var(--flow-green); }
.flow-diagram .fd-chip.a rect { fill: var(--flow-amber); }
.flow-diagram .fd-chip.g text,
.flow-diagram .fd-chip.a text { fill: var(--flow-chip-text); }

/* Portrait layout for small screens */
.flow-diagram .fd-mobile .fd-zone-label { font-size: 14px; }
.flow-diagram .fd-mobile .fd-step { font-size: 16px; }
.flow-diagram .fd-mobile .fd-title { font-size: 15px; }
.flow-diagram .fd-mobile .fd-sub { font-size: 12px; }
.flow-diagram .fd-mobile .fd-note { font-size: 13px; }
.flow-diagram .fd-mobile .fd-label { font-size: 13px; }
.flow-diagram .fd-mobile .fd-chip text { font-size: 11px; }

/* Blocked request (scoped credential) and typed command */
.flow-diagram { --flow-red: #b91c1c; }
[data-theme="dark"] .flow-diagram { --flow-red: #f87171; }
.flow-diagram .fd-red { fill: var(--flow-red); }
.flow-diagram .fd-bad { stroke: var(--flow-red); }
.flow-diagram .fd-flash.r { fill: var(--flow-red); }
.flow-diagram .fd-line.r { stroke: var(--flow-red); stroke-dasharray: 6 5; }
.flow-diagram .fd-head-r { fill: var(--flow-red); }
.flow-diagram .fd-x { font-size: 34px; font-weight: 700; text-anchor: middle; fill: var(--flow-red); }
.flow-diagram .fd-term { fill: var(--code-bg); stroke: var(--border); stroke-width: 1.5; }
.flow-diagram .fd-type { font-family: var(--mono); font-size: 16px; fill: var(--text); }
.flow-diagram .fd-mobile .fd-x { font-size: 24px; }
.flow-diagram .fd-mobile .fd-type { font-size: 13px; }
