/*
 * A table of figures tinted by how each moved (HeatTableHelper): square tiles
 * of the treemap's ramp, the figure over its change. A cell with no change to
 * give is the bare paper.
 *
 *   .heat-table               the table
 *   .heat-table__label        a row's name, at the left
 *   .heat-table__cell         a tile, and its step
 *   .heat-table__legend       the scale, under the table
 */
@layer components {
  .heat-table {
    /* The spacing runs round the outside too; drawn back over the edges. */
    inline-size: calc(100% + 4px);
    margin-inline: -2px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 2px;
    font-family: var(--font-data);

    & th {
      /* Headings side by side in the narrow columns stay apart. */
      padding: var(--space-3xs) 3px;
      color: var(--color-ink-muted);
      font-size: var(--text-table-head);
      font-weight: var(--weight-regular);
      line-height: var(--leading-table-head);
      text-align: center;
      vertical-align: middle;
    }

    & .heat-table__label {
      inline-size: 3.75rem;
      padding-inline: 0;
      color: var(--color-ink);
      font-size: var(--text-ui-sm);
      text-align: start;
      white-space: nowrap;
    }

    & tr.is-latest .heat-table__label {
      font-weight: var(--weight-semibold);
    }
  }

  .heat-table__cell {
    padding: var(--space-2xs) 0;
    text-align: center;
  }

  .heat-table__figure,
  .heat-table__change {
    display: block;
  }

  .heat-table__figure {
    font-size: var(--text-data);
    font-weight: var(--weight-semibold);
    line-height: 1.25;
  }

  .heat-table__change {
    font-size: var(--text-meta-xs);
    line-height: 1.25;
  }

  .heat-table__cell--gain-3 { background-color: var(--color-ramp-gain-3); color: var(--color-ramp-gain-3-ink); }
  .heat-table__cell--gain-2 { background-color: var(--color-ramp-gain-2); color: var(--color-ramp-gain-2-ink); }
  .heat-table__cell--gain-1 { background-color: var(--color-ramp-gain-1); color: var(--color-ramp-gain-1-ink); }
  .heat-table__cell--loss-1 { background-color: var(--color-ramp-loss-1); color: var(--color-ramp-loss-1-ink); }
  .heat-table__cell--loss-2 { background-color: var(--color-ramp-loss-2); color: var(--color-ramp-loss-2-ink); }
  .heat-table__cell--loss-3 { background-color: var(--color-ramp-loss-3); color: var(--color-ramp-loss-3-ink); }

  .heat-table__legend {
    max-inline-size: 14rem;
    margin-block-start: var(--space-xs);
    margin-inline-start: auto;
  }
}
