/*
 * The price chart (frames/companies/chart, the stock-chart controller): its
 * range and interval switches, its layers and the canvas Highcharts draws on.
 * The alert drawer reaches it by this class too.
 */
@layer components {
  /* Highcharts sizes a chart from its container when it is given no height,
     and the `stock-chart` controller draws into a div of its own inside the
     canvas, which has to fill it. The interval menu sits above the canvas
     inside the same height, so the placeholder's height still holds. */
  .company-chart {
    container: company-chart / inline-size;
    display: flex;
    flex-direction: column;
    block-size: var(--company-chart-height);
  }

  /* Two rows over the chart: the candle widths on the left and the spans on
     the right, every one a button, wrapping under each other where the
     chart is too narrow for both; then, under a hairline, what the chart
     flags. The buttons sit tighter than a segmented control's own gap, so
     eleven of them fit a phone in two lines. */
  .company-chart__head {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0 var(--space-lg);

    & .segmented {
      gap: 0 var(--space-sm);
    }
  }

  .company-chart__ranges {
    justify-content: flex-end;
  }

  .company-chart__intervals {
    flex: none;
  }

  .company-chart__layers {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 var(--space-sm);
    margin-block-end: var(--space-xs);
    border-block-start: var(--rule-hairline);

    & .segmented {
      gap: 0 var(--space-sm);
    }
  }

  .company-chart__canvas {
    flex: 1;
    min-block-size: 0;

    & > div {
      block-size: 100%;
    }
  }
}
