/*
 * Rates set against each other as bars (/styleguide#comparison-bars): a row
 * each, its label, a bar and its figure, every row on one grid so the bars
 * start together. A bar's length comes from the markup (`--share`, its rate
 * over the longest); a negative rate has no bar, and its figure says it.
 *
 * The rows are in the muted ink; the lead row — the one the others are read
 * against — in ink with its figure in the semibold, and an outlined row is a
 * reference beside them, as an industry's rate is. `--compact` is the
 * sidebar's narrower column.
 *
 * The valuation page's headline (companies/valuations/_headline), the
 * Overview's Valuation and Growth cards (companies/keystats/_valuation,
 * companies/keystats/_growth).
 */
@layer components {
  .comparison-bars {
    display: grid;
    grid-template-columns: minmax(0, 12rem) minmax(0, 1fr) 4.5rem;
    gap: var(--space-xs) var(--space-md);
    align-items: center;
    max-inline-size: 44rem;
    padding-block-start: var(--space-xs);
  }

  .comparison-bars--compact {
    grid-template-columns: minmax(0, 8rem) minmax(0, 1fr) 3.5rem;
  }

  .comparison-bars__row {
    display: contents;
  }

  .comparison-bars__bar {
    block-size: 0.875rem;
    inline-size: calc(var(--share, 0) * 100%);
    background: var(--color-ink-subtle);
  }

  .comparison-bars__row--lead .comparison-bars__bar {
    background: var(--color-ink);
  }

  .comparison-bars__row--outline .comparison-bars__bar {
    box-sizing: border-box;
    border: var(--rule-width-strong) solid var(--color-ink);
    background: transparent;
  }

  .comparison-bars__figure {
    text-align: end;
  }

  .comparison-bars__row--lead .comparison-bars__figure {
    font-weight: var(--weight-semibold);
  }
}
