/* D, Flow: the three diagram pages (Desk, $CONFIDENTIAL, Portfolio). Each page is one diagram of money crossing the seal
   between Public (steel ground, anyone can read it) and Private (coral ground, sealed). Lines carry the money and its
   figure; stations carry the rule. From the approved design (ui-upgrade/variations/final/assets/flow.css), scoped to
   main.flow so the other pages keep direction A's tile wall. Tokens are system.css's; the few the diagrams add are here. */

.flow {
  --steel-dim: #3d4c58; /* a public line that hasn't carried anything yet */
  --coral-dim: #6b3226;
  --ch-up: var(--candle-up);
  --ch-down: var(--candle-down);
  --ch-downline: var(--candle-down-line);
  --ch-grid: #1b1b22;
  --gut: clamp(16px, calc(4.6px + 2.73vw), 44px);
  --maxw: 1352px;
  display: block;
  color: var(--paper2);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
}
.flow .wrap { width: 100%; max-width: calc(var(--maxw) + 2 * var(--gut)); margin: 0 auto; padding: 0 var(--gut); }
.flow .num { font-variant-numeric: tabular-nums; }
.flow .mono { font-family: var(--mono); font-size: inherit; letter-spacing: -0.02em; }

/* ---------- buttons: plain bars ---------- */
.flow .btn { --bg: var(--tile3); --fg: var(--paper); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-bar); background: var(--bg); color: var(--fg); font: 500 14px / 1 var(--f); letter-spacing: -0.01em; white-space: nowrap; transition: background var(--t1) var(--ease), transform var(--t1) var(--ease); }
.flow .btn:active { transform: translateY(1px); }
.flow .btn.paper { --bg: var(--paper); --fg: var(--on-paper); }
.flow .btn.paper:hover { --bg: #fff; }
.flow .btn.priv { --bg: var(--coral); --fg: var(--on-coral); }
.flow .btn.priv:hover { --bg: var(--coral-hi); }
.flow .btn.dark:hover { --bg: #26262e; }
.flow .btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.flow .btn[disabled] { opacity: 0.5; cursor: default; transform: none; }

/* ---------- page head: a title, one line, and the diagram does the rest ---------- */
.fl-head { padding: 34px 0 26px; }
.fl-head .wrap { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px 40px; flex-wrap: wrap; }
.fl-head h1 { color: var(--paper); font: 600 clamp(32px, calc(25px + 1.6vw), 48px) / 1 var(--f); letter-spacing: -0.04em; }
.fl-head p { margin-top: 12px; max-width: 60ch; color: var(--paper2); font-size: 16px; }
.fl-head .acts { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- the two grounds, named in place, sentence case, in their own colour ---------- */
.flow .gname, .flow .bname { display: flex; align-items: baseline; gap: 8px; font: 500 13px / 1.3 var(--f); }
.flow .gname.pub, .flow .bname.pub { color: var(--steel); }
.flow .gname.priv, .flow .bname.priv { color: var(--coral); }
.flow .gname em, .flow .bname em { font-style: normal; color: var(--label); font-weight: 400; }

/* ---------- diagram text ---------- */
.flow .st-name { color: var(--paper); font: 580 16px / 1.2 var(--f); letter-spacing: -0.02em; }
.flow .st-rule { color: var(--label); font-size: 13px; line-height: 1.35; }
.flow .fig { color: var(--paper); font: 560 28px / 1 var(--f); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.flow .fig small { font-size: 0.5em; font-weight: 500; letter-spacing: -0.01em; color: var(--paper2); margin-left: 0.25em; }
.flow .on-line { font: 500 14px / 1.25 var(--f); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.flow .on-line b { font-weight: 600; }
.flow .on-line.pub { color: var(--steel); }
.flow .on-line.priv { color: var(--coral); }
.flow .on-line.yet { color: var(--label); }
.flow .on-line > span { display: block; color: var(--label); font-weight: 400; }
@media (max-width: 600px) { .flow .on-line { white-space: normal; } }

/* a diagram's stage: the wrap's content box, which every position and wire is measured against */
.flow .stage { position: relative; height: 100%; }
.flow .item { position: relative; }
.flow .band { display: none; }

/* SVG lines: colour means one thing. Coral is a private leg, steel a public one, a dashed line hasn't happened yet. */
.flow svg.wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.flow .w { fill: none; stroke-width: 2; stroke-linecap: square; }
.flow .w.pub { stroke: var(--steel); }
.flow .w.priv { stroke: var(--coral); }
.flow .w.yet { stroke: var(--steel-dim); stroke-dasharray: 5 6; }
.flow .w.seal { stroke: var(--bar); }
.flow .ah.pub { fill: var(--steel); }
.flow .ah.priv { fill: var(--coral); }
.flow .ah.yet { fill: var(--steel-dim); }

/* draw-in: the final state is the default; motion only adds the way there, once a page load */
.flow .anim .w.draw { stroke-dasharray: var(--len) var(--len); stroke-dashoffset: var(--len); }
.flow .anim .w.draw.in { stroke-dashoffset: 0; transition: stroke-dashoffset var(--dur, 700ms) var(--ease) var(--delay, 0ms); }
.flow .anim .rise { opacity: 0; transform: translateY(8px); }
.flow .anim .rise.in { opacity: 1; transform: none; transition: opacity var(--t2) var(--ease) var(--delay, 0ms), transform var(--t2) var(--ease) var(--delay, 0ms); }

/* ---------- coins: round marks on these pages ---------- */
.flow .ci { width: 22px; height: 22px; border-radius: 50%; flex: none; background: var(--tile3); object-fit: cover; }
.flow .ci.sm { width: 18px; height: 18px; border-radius: 50%; }
.flow .ci.lg { width: 40px; height: 40px; border-radius: 50%; }
.flow span.ci { display: inline-grid; place-items: center; color: var(--paper); font: 600 11px / 1 var(--f); }
.flow span.ci svg.sol { width: 62%; height: 62%; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .flow .btn { transition: none; }
}
