/* Transparency Index: "How the scores are spread" (markup generated by tools/ti/render-ti-table.py) */
.ti-spread { padding: 0 0 3.5rem; }
.ti-spread-h { font-size: var(--fs-xl); margin: 0 0 .5rem; color: var(--text-primary); }
.ti-spread-intro { max-width: 760px; margin: 0 0 1.5rem; font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.55; }
.ti-spread-intro a, .ti-fig figcaption a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.ti-spread-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; }
.ti-fig { margin: 0; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 20px 22px 8px; min-width: 0; }
.ti-fig-h { font-size: var(--fs-md); margin: 0 0 12px; color: var(--text-primary); }
.ti-fig figcaption { margin: 12px 0; font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.55; }

/* score histogram: band colours, counts as text */
.ti-dist-svg { display: block; width: 100%; height: auto; max-height: 280px; }
.ti-dist-base { stroke: var(--border-medium); stroke-width: 1; }
.ti-dist-n { fill: var(--text-primary); font: 600 13px var(--font-body, inherit); }
.ti-dist-x { fill: var(--text-secondary); font: 13px var(--font-body, inherit); }
.ti-band--excellent { fill: var(--band-excellent); background: var(--band-excellent); }
.ti-band--good { fill: var(--band-good); background: var(--band-good); }
.ti-band--mixed { fill: var(--band-mixed); background: var(--band-mixed); }
.ti-band--poor { fill: var(--band-poor); background: var(--band-poor); }
.ti-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 0; font-size: var(--fs-xs); color: var(--text-secondary); }
.ti-legend li { display: inline-flex; align-items: center; gap: 6px; }
.ti-key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ti-spread-data > summary { padding: 12px 0; font-size: var(--fs-sm); color: var(--link); }
.ti-spread-tbl { border-collapse: collapse; font-size: var(--fs-sm); margin: 0 0 12px; }
.ti-spread-tbl th, .ti-spread-tbl td { padding: 4px 18px 4px 0; text-align: left; color: var(--text-secondary); font-weight: 400; border-bottom: 1px solid var(--border-subtle); }
.ti-spread-tbl thead th, .ti-spread-tbl tfoot th, .ti-spread-tbl tfoot td { color: var(--text-primary); font-weight: 600; }
.ti-spread-tbl td:nth-child(2) { font-variant-numeric: tabular-nums; }

/* marker grid: a real table; cell shade = share of all firms (one hue, darker = more firms), number always printed */
.ti-hm-wrap { overflow-x: auto; }
.ti-hm-wrap:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.ti-hm { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; font-variant-numeric: tabular-nums; }
.ti-hm th { font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); text-align: center; padding: 0 2px 6px; vertical-align: bottom; line-height: 1.3; }
.ti-hm thead th:first-child { text-align: left; width: 31%; }
.ti-hm tbody th { text-align: left; vertical-align: middle; padding: 4px 8px 4px 0; }
.ti-hm-name { display: block; font-size: var(--fs-sm); color: var(--text-primary); font-weight: 600; }
.ti-hm-max { display: block; font-size: var(--fs-xs); color: var(--text-tertiary, var(--text-secondary)); font-weight: 400; }
.ti-hm td { text-align: center; padding: 6px 2px; border-radius: 6px; line-height: 1.2; }
/* linear: 0 firms = surface, all firms = 60% data colour (keeps white numbers above 4.5:1 contrast) */
.ti-hm-cell { background: color-mix(in srgb, var(--data) calc(var(--s) * 60%), var(--bg-elevated, #1c2230)); }
.ti-hm-cell--na { background: transparent; border: 1px dashed var(--border-medium); }
.ti-hm-avg { background: transparent; border: 1px solid var(--border-subtle); }
.ti-hm-n { display: block; font-size: var(--fs-sm); font-weight: 700; color: var(--text-primary); }
.ti-hm-pts { display: block; font-size: var(--fs-xs); color: var(--text-primary); white-space: nowrap; }
.ti-hm-avg .ti-hm-pts { color: var(--text-secondary); white-space: normal; }

@media (max-width: 960px) {
  .ti-spread-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .ti-fig { padding: 16px 12px 4px; }
  .ti-dist-n, .ti-dist-x { font-size: 20px; }
  .ti-hm { border-spacing: 2px; }
  .ti-hm thead th:first-child { width: 27%; }
  .ti-hm-name { font-size: var(--fs-xs); }
  .ti-hm-u { display: none; }
  .ti-hm th, .ti-hm-pts { font-size: .6875rem; }
  .ti-hm thead th:last-child { width: 15%; }
  /* the top score stays readable by screen readers; on phones the full-marks column shows the same thing */
  .ti-hm-avg .ti-hm-pts { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
