/* Sankey module presentation. Card 12. Role tokens only.
 *
 * All colour for the module lives here rather than in index.js. A raw colour in
 * a stylesheet is caught by tools/check-assets.py; a raw colour in JavaScript is
 * caught by nothing. Keeping it here puts the module under a guard that already
 * exists. */

.ct-sankey { margin: 0; }
.ct-sankey__svg { width: 100%; height: auto; display: block; }

.ct-sankey__link { fill: none; opacity: .45; }
.ct-sankey__link:hover { opacity: .7; }

/* Six slots, assigned by node position. These distinguish flows visually and
 * carry NO meaning on their own — every node renders its label beside it, and
 * every flow's <title> names its endpoints. See the module README. */
.ct-sankey__rect--0, .ct-sankey__link--0 { fill: var(--ct-accent-primary);   stroke: var(--ct-accent-primary); }
.ct-sankey__rect--1, .ct-sankey__link--1 { fill: var(--ct-accent-secondary); stroke: var(--ct-accent-secondary); }
.ct-sankey__rect--2, .ct-sankey__link--2 { fill: var(--ct-accent-positive);  stroke: var(--ct-accent-positive); }
.ct-sankey__rect--3, .ct-sankey__link--3 { fill: var(--ct-text-muted);       stroke: var(--ct-text-muted); }
.ct-sankey__rect--4, .ct-sankey__link--4 { fill: var(--ct-text-strong);      stroke: var(--ct-text-strong); }
.ct-sankey__rect--5, .ct-sankey__link--5 { fill: var(--ct-text);             stroke: var(--ct-text); }

.ct-sankey__label {
  font-family: var(--ct-font-text);
  font-size: var(--ct-size-meta);
  fill: var(--ct-text);
  /* Labels for right-hand nodes sit over their incoming flow, and a flow can be
   * any of the six colour slots — including the two dark ones, where dark label
   * text would be unreadable. The halo makes the label legible over every slot
   * without changing the palette or moving the labels off the chart.
   *
   * This matters more here than it would elsewhere: the label is not decoration.
   * Colour never carries meaning alone in this module, so an illegible label
   * does not degrade the chart, it removes the only thing carrying the meaning. */
  paint-order: stroke;
  stroke: var(--ct-surface-raised);
  stroke-width: 3px;
  stroke-linejoin: round;
}

/* Visually hidden, still read. Not display:none — that removes it from the
 * accessibility tree, which would delete the only equivalent the chart has. */
.ct-sankey__table {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
