/* Données › Flux IFC (Sankey). Colours: the categorical --viz-* tokens for families, severity
   tokens ONLY for the verdict column of the quality view (tokens.css). Labels are measured by
   the layout, so the drawing is never cut: it scales down to its card or scrolls inside it. */
.sankey-block { display: grid; gap: var(--s-3); min-width: 0; }
.shell[data-layout="document"] .panel .sankey-block { max-width: none; }
.sankey-head { align-items: start; }
.sankey-controls { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.sankey-select { width: auto; min-width: 190px; height: var(--control-h); padding: 0 var(--s-2); border-radius: 6px; background: var(--bg-1); cursor: pointer; }
.sankey-select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.sankey-notes { display: grid; gap: var(--s-1); }
.sankey-notes .panel-note { margin: 0; }
.sankey-figure { min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--card-line, var(--line)); border-radius: var(--r-2); background: var(--bg-1); }
.sankey-svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }

.fx-t-root { --fx: var(--viz-root); }
.fx-t-storey { --fx: var(--text-3); }
.fx-t-structure, .fx-t-classified { --fx: var(--viz-structure); }
.fx-t-architecture { --fx: var(--viz-architecture); }
.fx-t-mep { --fx: var(--viz-mep); }
.fx-t-furniture { --fx: var(--viz-furniture); }
.fx-t-site { --fx: var(--viz-site); }
.fx-t-proxy { --fx: var(--viz-proxy); }
.fx-t-other, .fx-t-unclassified { --fx: var(--viz-other); }
.fx-t-blocking { --fx: var(--sev-blocking); }
.fx-t-review { --fx: var(--sev-review); }
.fx-t-ok { --fx: var(--ok); }

.sankey-node { cursor: pointer; outline: none; }
.sankey-bar { fill: var(--fx); transition: opacity var(--dur-1) var(--ease); }
.sankey-hit { fill: transparent; }
.sankey-node:hover .sankey-bar { opacity: 0.8; }
.sankey-node:focus-visible .sankey-hit { stroke: var(--focus); stroke-width: 2; rx: 4; }
.sankey-label {
  font-family: var(--font-ui); font-size: 12px; font-weight: var(--w-medium); fill: var(--text-1);
  paint-order: stroke; stroke: var(--bg-1); stroke-width: 3px; stroke-linejoin: round; pointer-events: none;
  /* Proportional digits: the layout measured those advances (text-measure.js); tabular figures are wider. */
  font-variant-numeric: normal;
}
.sankey-link { fill: none; stroke: var(--fx); stroke-opacity: 0.32; transition: stroke-opacity var(--dur-2) var(--ease); }
.sankey-link:hover { stroke-opacity: 0.6; }

.sankey-legend { display: flex; gap: var(--s-2) var(--s-4); flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.sankey-legend-item { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--t-caption); }
.fx-dot { width: 10px; height: 10px; flex: none; border-radius: 3px; background: var(--fx); }

/* The table: always in the page (screen readers), shown on demand on a desktop. */
.sankey-table { width: 100%; border-collapse: collapse; font-size: var(--t-caption); color: var(--text-1); }
.sankey-table caption { text-align: start; padding: 0 0 var(--s-1); color: var(--text-2); font-weight: var(--w-semibold); }
.sankey-table th, .sankey-table td { text-align: start; padding: 6px var(--s-2); border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: break-word; hyphens: auto; }
.sankey-table th { color: var(--text-2); font-weight: var(--w-semibold); }
.sankey-table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sankey-table .mono { font-family: var(--font-mono); color: var(--text-2); }
.sankey-table .link-button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-align: start; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.sankey-table .link-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sankey-table:not([data-visible]) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.sankey-block.sankey-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 55;
  margin: 0;
  padding: var(--s-6);
  border-radius: 0;
  background: var(--bg-1);
  overflow: auto;
}
.sankey-block.sankey-fullscreen .sankey-svg { max-height: calc(100vh - 220px); width: auto; }

/* Phone: the drawing would shrink below a readable size — the table IS the presentation. */
@media (max-width: 640px) {
  .sankey-head { flex-direction: column; align-items: stretch; }
  .sankey-controls { flex-direction: column; align-items: stretch; }
  .sankey-select { width: 100%; min-width: 0; }
  .sankey-fullscreen-action, .sankey-table-action, .sankey-figure, .sankey-legend { display: none; }
  .sankey-table .col-class { display: none; }
  .sankey-table:not([data-visible]) { position: static; width: 100%; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; }
}
