/*
 * The balance sheet's two columns (BalanceColumnsHelper), inside the
 * statement picture.
 */
@layer components {
  /* The balance sheet's two columns (BalanceColumnsHelper): what it owns
     against what funds it, side by side and standing on one line, each
     block as tall as its share of the taller column's total (`--share`),
     each column as tall as its total's share of that (`--fill`). Beside
     the trend they stretch to its height, so the two end level; alone,
     on a narrow card, they are about a fifth of the screen. A block too small for its figure and
     name keeps room for both, so the smallest parts are drawn a little
     larger than their share. */
  .balance-columns {
    display: grid;
    grid-template-rows: auto minmax(clamp(8.5rem, 18svh, 20rem), 1fr) auto;
    gap: var(--space-sm);
    margin: 0;
  }

  .balance-columns__caption,
  .balance-columns__note {
    color: var(--color-ink-subtle);
    font-size: var(--text-meta);
    line-height: var(--leading-meta);
  }

  .balance-columns__note {
    padding-block-start: var(--space-xs);
    border-block-start: var(--rule-hairline);
  }

  .balance-columns__pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-md);
  }

  .balance-columns__side {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: var(--space-2xs);
  }

  .balance-columns__heading {
    text-align: center;
  }

  /* The room a column stands in; the column takes its share of it from the
     foot up. */
  .balance-columns__frame {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-block-size: 0;
  }

  .balance-columns__stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    block-size: calc(var(--fill) * 100%);
  }

  .balance-columns__block {
    display: flex;
    flex: var(--share) 1 0;
    flex-direction: column;
    justify-content: center;
    min-block-size: 2.75rem;
    padding: var(--space-2xs) var(--space-xs);
    color: var(--color-ink);
  }

  .balance-columns__block--long-term { background: var(--color-ramp-gain-1); }

  .balance-columns__block--short-term { background: var(--color-ramp-gain-2); }

  .balance-columns__block--equity { background: var(--color-mask); }

  .balance-columns__block--liabilities { background: var(--color-warn-tint); }

  .balance-columns__block--cash {
    background: var(--color-ramp-gain-3);
    color: var(--color-ramp-gain-3-ink);
  }

  .balance-columns__block--debt {
    background: var(--color-ramp-loss-2);
    color: var(--color-ramp-loss-2-ink);
  }

  .balance-columns__figure {
    font-size: var(--text-ui);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-ui);
  }

  .balance-columns__name {
    font-size: var(--text-meta);
    line-height: var(--leading-meta);
  }
}
