/* Explore and the Flow chart. Only the tokens DESIGN.md defines in tach.css. */

/* The question. */
/* The question sits on a grid, so its controls line up at any width. */
.ask { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); align-items: end; gap: var(--s3) var(--s4); margin-top: var(--s4); padding: var(--s3) var(--s4); background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card); }
.ask label { display: flex; flex-direction: column; gap: 5px; color: var(--text-muted); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; min-width: 0; }
.ask select, .ask input[type=text] { width: 100%; min-width: 0; }
.ask .filter-add { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(8rem, 13rem) minmax(8rem, 16rem) auto; justify-content: start; align-items: end; gap: var(--s3) var(--s4); }
.chips { margin: var(--s3) 0 0; color: var(--text-muted); font-size: 0.8125rem; }
.chip { color: var(--text); }
.chip a { color: var(--text-muted); margin-left: var(--s1); }
.quiet { color: var(--text-dim); }
.kindword { color: var(--text-muted); font: 400 0.8125rem/1.45 var(--font-sans); }

/* The Answer: a wide table may scroll sideways inside its own frame. */
.frame { overflow-x: auto; }
/* The table is as wide as its columns need, never squeezed until a name
   breaks letter by letter; the frame scrolls instead. */
.ledger.answer { width: max-content; min-width: 100%; }
.ledger.answer td.desc, .ledger.answer th { white-space: nowrap; overflow-wrap: normal; }
.ledger.answer th a { color: inherit; text-decoration: none; }
.ledger.answer th a:hover { text-decoration: underline; }
.ledger.answer th[aria-sort] { color: var(--text); }
.ledger.answer td.desc a { text-decoration: none; }
.ledger.answer td.desc a:hover { text-decoration: underline; }
.ledger.answer td.desc { padding-right: var(--s4); }
.ledger.answer td.fig.quiet { color: var(--text-dim); }
.ledger.answer .k-notional, .ledger.answer .k-list { color: var(--text-muted); }
.ledger.views td.fig { width: 1%; }
.ledger.views form { margin: 0; }
.save { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s3); margin-top: var(--s4); }
.save label { display: flex; flex-direction: column; gap: var(--s1); color: var(--text-muted); font-size: 0.8125rem; }
.save label.check { flex-direction: row; align-items: center; gap: var(--s2); padding-bottom: var(--s2); }

/* Bars: money in its kind's weight, categories in the series colours. */
.xbars { display: block; width: 100%; max-width: 820px; height: auto; overflow: visible; }
.xbars .axis { stroke: var(--border); stroke-width: 1; }
.xbars text { fill: var(--text-dim); font: 400 10px var(--font-mono); }
.xbars text.rowlabel { fill: var(--text-muted); font: 400 11px var(--font-sans); }
.xbars rect.none, .legend .key.none { fill: url(#hatch); }
.xbars rect.s-ink.solid { fill: var(--text-dim); }
.xbars rect.s-ink.outline { fill: none; stroke: var(--text); stroke-width: 1; }
.xbars rect.s-ink.dotted { fill: url(#dots); }
.s1 { --c: var(--chart-1); } .s2 { --c: var(--chart-2); } .s3 { --c: var(--chart-3); }
.s4 { --c: var(--chart-4); } .s5 { --c: var(--chart-5); } .s6 { --c: var(--chart-6); } .s0 { --c: var(--text-dim); }
.xbars rect.solid:not(.s-ink) { fill: var(--c); }
.xbars rect.outline:not(.s-ink) { fill: none; stroke: var(--c); stroke-width: 1.5; }
.xbars rect.dotted:not(.s-ink) { fill: none; stroke: var(--c); stroke-width: 1.5; stroke-dasharray: 1 2; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin: var(--s3) 0 0; padding: 0; list-style: none; color: var(--text-muted); font-size: 0.8125rem; }
.legend .key { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.legend .key.solid { background: var(--c); }
.legend .key.outline { border: 1.5px solid var(--c); }
.legend .key.dotted { border: 1.5px dotted var(--c); }

/* The Flow chart. */
.flow { margin: 0; overflow-x: auto; }
.flow-chart { display: block; width: 100%; min-width: 720px; height: auto; overflow: visible; }
.flow-chart text { font: 500 11px var(--font-sans); fill: var(--text); paint-order: stroke; stroke: var(--bg-surface); stroke-width: 4px; stroke-linejoin: round; }
.flow-chart text.ff { fill: var(--text-muted); font-family: var(--font-mono); font-size: 10px; }
/* Ribbons carry their kind's colour as a quiet tint: cyan for metered usage
   Tach estimated, emerald for value used under a Seat. The tint is solid,
   so where two ribbons cross one passes over the other and neither muddies. */
.flow-chart path.r-estimated { fill: color-mix(in srgb, var(--cyan) 46%, var(--bg-surface)); }
.flow-chart path.r-notional, .flow-chart path.r-list { fill: color-mix(in srgb, var(--emerald) 24%, var(--bg-surface)); }
.flow-chart path.r-unobserved { fill: url(#hatch-red); }
/* A hairline of the panel's colour round each ribbon keeps two that cross
   apart. Pointing at a ribbon, or at a node, quiets every ribbon that does
   not pass through it; a node on the left stands for everything paid for
   that way, end to end. A column holds at most nine nodes. */
.flow-chart path { stroke: var(--bg-surface); stroke-width: 1px; }
.flow-chart path.r-unobserved { stroke: none; }
.flow-chart:has(path:hover) path:not(:hover),
.flow-chart:has(.nd.m0:hover) path:not(.m0),
.flow-chart:has(.nd.m1:hover) path:not(.m1),
.flow-chart:has(.nd.m2:hover) path:not(.m2),
.flow-chart:has(.nd.m3:hover) path:not(.m3),
.flow-chart:has(.nd.m4:hover) path:not(.m4),
.flow-chart:has(.nd.m5:hover) path:not(.m5),
.flow-chart:has(.nd.m6:hover) path:not(.m6),
.flow-chart:has(.nd.m7:hover) path:not(.m7),
.flow-chart:has(.nd.m8:hover) path:not(.m8),
.flow-chart:has(.nd.w0:hover) path:not(.w0),
.flow-chart:has(.nd.w1:hover) path:not(.w1),
.flow-chart:has(.nd.w2:hover) path:not(.w2),
.flow-chart:has(.nd.w3:hover) path:not(.w3),
.flow-chart:has(.nd.w4:hover) path:not(.w4),
.flow-chart:has(.nd.w5:hover) path:not(.w5),
.flow-chart:has(.nd.w6:hover) path:not(.w6),
.flow-chart:has(.nd.w7:hover) path:not(.w7),
.flow-chart:has(.nd.w8:hover) path:not(.w8),
.flow-chart:has(.nd.k-estimated:hover) path:not(.r-estimated),
.flow-chart:has(.nd.k-notional:hover) path:not(.r-notional),
.flow-chart:has(.nd.k-list:hover) path:not(.r-list),
.flow-chart:has(.nd.k-unobserved:hover) path:not(.r-unobserved) { opacity: 0.12; }
.flow-chart path.r-estimated:hover { fill: color-mix(in srgb, var(--cyan) 72%, var(--bg-surface)); }
.flow-chart path.r-notional:hover, .flow-chart path.r-list:hover { fill: color-mix(in srgb, var(--emerald) 46%, var(--bg-surface)); }
.flow-chart rect.n-estimated { fill: var(--cyan); }
.flow-chart rect.n-notional, .flow-chart rect.n-list { fill: url(#dots); stroke: var(--emerald); stroke-width: 1; }
.flow-chart rect.n-unobserved { fill: url(#hatch-red); stroke: var(--rose); stroke-width: 1; }
.flow-chart rect.n-mid { fill: var(--text-dim); }

/* The text alternative is always there for a screen reader; on a phone it
   is what everyone sees, as stacked rows. */
.sr, .flow-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.flow-rows tr.lead-note { display: none; }
/* Where the chart would have to scroll sideways it gives way to its list. */
@media (max-width: 47.5rem) {
  .flow-chart { display: none; }
  .flow-text { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; }
  /* The sentence that sums the chart up leads the list, which holds the
     largest paths only. */
  .chart-note { display: none; }
  .flow-rows tr.rest { display: none; }
  .flow-rows tr.lead-note { display: grid; color: var(--text-muted); font-size: 0.8125rem; }
  /* Paid for one way throughout: the sentence says so once, and each line
     leads with its model. */
  .flow-rows.one-source tr:not(.sub) td:nth-child(1) { display: none; }
  .flow-rows.one-source td:nth-child(2) { color: var(--text); font-size: inherit; padding-left: 0; }
  .flow-rows.one-source td:nth-child(3) { padding-left: 0; }
  .flow-rows thead { display: none; }
  .flow-rows tr { display: grid; grid-template-columns: 1fr auto; border-top: 1px solid var(--border); padding: var(--s2) 0; }
  .flow-rows td { border-top: 0; padding: 0; }
  .flow-rows td:nth-child(2), .flow-rows td:nth-child(3) { grid-column: 1; color: var(--text-muted); font-size: 0.8125rem; padding-left: var(--s6); }
  .flow-rows td:nth-child(4) { grid-column: 2; grid-row: 1; }
}
@media (max-width: 30rem) {
  .save label { width: 100%; }
  .save input[type=text] { width: 100%; }
  .ask .filter-add { grid-template-columns: 1fr 1fr auto; }
}

@media print {
  .ask, .save, .chips a, .views form { display: none; }
  .flow-chart { display: none; }
  .flow-text { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; }
}

/* A stack by kind of money takes each kind's own weight. */
.xbars rect.k-billed, .xbars rect.k-seats { fill: var(--text); }
.xbars rect.k-estimated { fill: none; stroke: var(--text); stroke-width: 1; }
.xbars rect.k-notional, .xbars rect.k-list { fill: url(#dots); stroke: var(--text); stroke-width: 0.75; stroke-dasharray: 1 2; }
.xbars rect.k-unpriced { fill: url(#hatch); stroke: var(--amber); stroke-width: 0.75; }
.legend .key.sw { border-width: 1px; }
