/*
 * Ten years at a glance (companies/keystats/_financials, LineChangeHelper):
 * the Overview's annual grid, its trend bars and its estimates.
 */
@layer components {
  /* Ten years at a glance (companies/keystats/_financials; tasks/redesign,
     D9): the group's name and the row's label pinned on the left — the
     group column a fixed width, so the label column knows where to stick —
     ten years, the Trend bars, then the estimates. Below 640px the group
     column gives way to a full-width row above each group. */
  .ten-years {
    padding-block-end: var(--space-sm);
  }

  .ten-years__table {
    --group-width: 6.5rem;
  }

  .ten-years__group-cell {
    inline-size: var(--group-width);
    min-inline-size: var(--group-width);
    max-inline-size: var(--group-width);

    @media (width < 640px) {
      display: none;
    }
  }

  .ten-years__label {
    @media (width >= 640px) {
      inset-inline-start: var(--group-width);
    }
  }

  /* Pinned cells take the paper and no edge shadow: the hairline rows run
     under them, and the shadow fell across a column of labels. */
  :is(.ten-years__group-cell, .ten-years__label).data-table__label--pinned-start {
    box-shadow: none;
  }

  .ten-years__group-row {
    display: none;

    @media (width < 640px) {
      display: table-row;
    }

    & > th {
      padding-block-start: var(--space-sm);
      color: var(--color-ink-muted);
      font-size: var(--text-caps);
      font-weight: var(--weight-medium);
      letter-spacing: var(--tracking-caps);
      text-align: start;
      text-transform: uppercase;
    }
  }

  .ten-years__trend {
    padding-inline: var(--space-sm);
  }

  /* The trailing twelve months after the newest year, ruled off from the
     fiscal years it is not one of, its quarter under "TTM". */
  .ten-years__ttm {
    border-inline-start: var(--rule-hairline);
    white-space: nowrap;
  }

  .ten-years__ttm-period {
    display: block;
    color: var(--color-ink-subtle);
    font-size: var(--text-meta-xs);
    font-weight: var(--weight-regular);
  }

  .ten-years__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2xs) var(--space-lg);

    & .table-legend {
      margin-block-start: var(--space-xs);
    }
  }

  /* The row naming the table's two halves, wide screens
     only — a phone keeps neither half — and the two summary columns. */
  .ten-years__column-groups {
    @media (width < 640px) {
      display: none;
    }

    & > td {
      border-block-end: 0;
    }
  }

  .ten-years__column-group {
    padding-block-end: var(--space-2xs);
    border-block-end: var(--rule-hairline);
    color: var(--color-ink-soft);
    font-size: var(--text-caps);
    font-weight: var(--weight-medium);
    letter-spacing: var(--tracking-caps);
    text-align: start;
    text-transform: uppercase;

    & .lock {
      margin-inline-start: var(--space-xs);
      letter-spacing: normal;
      text-transform: none;
    }
  }

  .ten-years__column-group--forecast {
    background-color: var(--color-forecast);
  }

  .ten-years__change {
    padding-inline-start: var(--space-md);
    text-align: end;
    white-space: nowrap;
  }

  .ten-years__not-meaningful {
    color: var(--color-ink-muted);
  }

  /* The card's one cell, over every line below the teaser: the card at its
     top, the forecast tint below it. Wide enough for the card whatever the
     figures beside it: a company with short ones would otherwise squeeze it
     into a column of words. */
  .ten-years__offer-cell {
    min-inline-size: 24rem;
    padding: var(--space-sm);
    font-style: normal;
    text-align: start;
    vertical-align: top;
    white-space: normal;
  }
}
