/* Orbit in numbers (views/numbers.js): the headline tiles, each breakdown as a table with a bar
   under each share, the charts of the years with their table, and the citation. The tables are
   what a screen reader reads; the bars only show the share beside them. */

.numbers-page .n-body { display: grid; gap: var(--space-6); }
/* A grid's children would otherwise be at least as wide as their widest content (the section bar's
   row of links, a table), which would widen the whole page on a phone. */
.numbers-page .n-body > * { min-width: 0; }
.numbers-page .n-body > .section-nav { margin-bottom: calc(-1 * var(--space-2)); }
.numbers-page .card + .card { margin-top: 0; } /* the grid's gap spaces them */
.numbers-page .n-section > .section-head { align-items: center; }
.numbers-page .n-section > .section-head h2 { flex: 1 1 18rem; }
.numbers-page .n-about { margin: 0 0 var(--space-4); color: var(--ink-2); }
.numbers-page .n-source { margin: var(--space-4) 0 0; font-size: var(--step--1); }
.numbers-page .n-notes { margin: var(--space-3) 0 0; padding-left: 1.2em; font-size: var(--step--1); color: var(--ink-2); }
.numbers-page .n-notes li + li { margin-top: var(--space-1); }

/* The headline figures. */
.numbers-page .n-headline > h2 { margin: 0 0 var(--space-4); }
.numbers-page .n-tiles { margin-bottom: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(min(176px, 100%), 1fr)); }
@media (max-width: 640px) { .numbers-page .n-tiles { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: var(--space-3); } }
.numbers-page .n-tile-asof { display: block; margin-top: var(--space-2); color: var(--ink-2); font-size: var(--step--2); font-weight: 600; }
.numbers-page .n-guides { margin: var(--space-4) 0 0; font-size: var(--step--1); color: var(--ink-2); }
.numbers-page .n-guides a { display: inline-block; padding: 3px 0; }
.numbers-page .n-asof { margin: 0; font-size: var(--step--1); color: var(--ink-2); }
.numbers-page .n-sources { list-style: none; margin: var(--space-2) 0 var(--space-4); padding: 0; font-size: var(--step--1); color: var(--ink-2); }
.numbers-page .n-sources li { max-width: var(--measure); }
.numbers-page .n-sources li + li { margin-top: var(--space-1); }
.numbers-page .n-sources strong { color: var(--ink); font-weight: 650; }
.numbers-page .n-fold { max-width: 52rem; }
.numbers-page .n-cannot { margin: 0; padding-left: 1.2em; }
.numbers-page .n-cannot li { max-width: var(--measure); }
.numbers-page .n-cannot li + li { margin-top: var(--space-2); }

/* A breakdown's table: the row's name in ink at reading size, with its share drawn under it. */
.numbers-page .n-table-box { container-type: inline-size; }
.numbers-table { font-variant-numeric: tabular-nums; }
.numbers-table th[scope="row"] { min-width: 11rem; white-space: normal; color: var(--ink); font-size: var(--step--1); font-weight: 600; }
.numbers-table td.wrap { min-width: 12rem; color: var(--ink-2); }
.numbers-table tfoot th, .numbers-table tfoot td { border-top: 1px solid var(--border); border-bottom: 0; font-weight: 700; color: var(--ink); background: var(--surface-2); }
.n-bar { display: block; height: 6px; margin-top: 6px; max-width: 16rem; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
.n-bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--series-1); } /* its width: barWidth in the view */
.n-csv { white-space: nowrap; }

/* In a narrow column each row becomes one labelled block (as table.stackable in app.css does, with
   the total line too); keepTableSemantics keeps it a table to screen readers. */
@container (max-width: 640px) {
  table.numbers-table, table.numbers-table > tbody, table.numbers-table > tfoot, table.numbers-table tr, table.numbers-table th, table.numbers-table td { display: block; }
  table.numbers-table > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.numbers-table tr { padding: var(--space-3); border-bottom: 1px solid var(--hairline); }
  table.numbers-table > tbody > tr:last-child { border-bottom: 0; }
  table.numbers-table th, table.numbers-table td { min-width: 0; padding: 1px 0; border: 0; white-space: normal; text-align: left; }
  table.numbers-table th[scope="row"] { padding: 2px 0 6px; font-size: var(--step-0); }
  table.numbers-table td.wrap { margin-bottom: var(--space-2); }
  table.numbers-table td.wrap[data-label]::before { content: attr(data-label) ": "; content: attr(data-label) ": " / ""; color: var(--ink-2); font-size: var(--step--2); font-weight: 600; }
  /* The figures of a row side by side, each under its short heading. */
  table.numbers-table td.r { display: inline-block; vertical-align: top; margin-right: var(--space-5); text-align: left; font-weight: 650; color: var(--ink); }
  table.numbers-table td.r[data-label]::before { content: attr(data-label); content: attr(data-label) / ""; display: block; color: var(--ink-2); font-size: var(--step--2); font-weight: 600; }
  table.numbers-table td:empty { display: none; }
  table.numbers-table > tfoot > tr { border-top: 1px solid var(--border); background: var(--surface-2); }
  table.numbers-table tfoot th, table.numbers-table tfoot td { border: 0; background: none; }
}

/* The years: two charts side by side where there is room, then the whole table one press away. */
.numbers-page .n-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(26rem, 100%), 1fr)); gap: var(--space-6); margin-bottom: var(--space-4); }
.numbers-page .n-chart { min-width: 0; }
.numbers-page .n-chart-heading { margin: 0 0 var(--space-2); font-size: var(--step-0); }
.numbers-page .n-chart figcaption { margin-top: var(--space-2); font-size: var(--step--1); color: var(--ink-2); max-width: var(--measure); }
.numbers-page .n-year-table .table-wrap { margin-top: var(--space-3); max-height: 70vh; overflow-y: auto; }
.numbers-page .n-wide thead th { position: sticky; top: 0; z-index: 1; min-width: 6.5rem; white-space: normal; vertical-align: bottom; }
.numbers-page .n-wide th[scope="row"] { min-width: 7rem; }

/* How to cite this. */
.numbers-page .n-citation {
  max-width: none; margin: var(--space-4) 0; padding: var(--space-4) var(--space-5);
  border-left: 3px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: var(--step-0); line-height: var(--leading-body); overflow-wrap: anywhere;
}
.numbers-page .n-cite-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); }
.numbers-page .n-cite-actions .btn { min-height: 44px; }

@media (max-width: 640px) {
  .numbers-page .n-body { gap: var(--space-5); }
  .numbers-page .n-citation { padding: var(--space-3) var(--space-4); }
}
