/**
 * @file table_cell.css
 * @component Table Cell (Internal)
 * @description Native cell geometry in fixed pixels, and text sized in em from
 * the Table's 16px type base; section, density, hover and row alignment come
 * from the enclosing Table's and Row's public state.
 *
 * @section Public custom properties
 * None.
 *
 * @section Private custom properties
 * None.
 */
:where([data-component-id="marsal_sdc:table_cell"]) {
  padding-block: 12px;
  padding-inline: 16px;
  vertical-align: top;
  overflow-wrap: anywhere;
  border-block-start: 1px solid var(--marsal-color-angellHallAsh-200);
  color: var(--marsal-color-textPrimary);
  background: transparent;
  font-family: var(--marsal-fontFamily-body-standard);
  font-size: 1em;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  text-align: start;
}

/* A row's alignment applies to its cells; a cell's own alignment wins below. */
:where([data-component-id="marsal_sdc:table_row"][data-alignment="start"]) > :where([data-component-id="marsal_sdc:table_cell"]) {
  text-align: start;
}

:where([data-component-id="marsal_sdc:table_row"][data-alignment="center"]) > :where([data-component-id="marsal_sdc:table_cell"]) {
  text-align: center;
}

:where([data-component-id="marsal_sdc:table_row"][data-alignment="end"]) > :where([data-component-id="marsal_sdc:table_cell"]) {
  text-align: end;
}

:where([data-component-id="marsal_sdc:table_cell"][data-alignment="start"]) {
  text-align: start;
}

:where([data-component-id="marsal_sdc:table_cell"][data-alignment="center"]) {
  text-align: center;
}

:where([data-component-id="marsal_sdc:table_cell"][data-alignment="end"]) {
  text-align: end;
}

/*
 * @todo WORKAROUND: behavioursoe base.css:631-633 th { text-align: left }
 * outranks zero-specificity alignment; delete when the theme is fixed.
 * Header cells inside a Table restate the alignment at one class of weight:
 * the default first, then the Row's alignment, then the cell's own, which
 * therefore wins as it does above.
 */
:where([data-component-id="marsal_sdc:table"]) > .marsal-table__table > * > :where([data-component-id="marsal_sdc:table_row"]) > th:where([data-component-id="marsal_sdc:table_cell"]) {
  text-align: start;
}

:where([data-component-id="marsal_sdc:table"]) > .marsal-table__table > * > :where([data-component-id="marsal_sdc:table_row"][data-alignment="center"]) > th:where([data-component-id="marsal_sdc:table_cell"]) {
  text-align: center;
}

:where([data-component-id="marsal_sdc:table"]) > .marsal-table__table > * > :where([data-component-id="marsal_sdc:table_row"][data-alignment="end"]) > th:where([data-component-id="marsal_sdc:table_cell"]) {
  text-align: end;
}

:where([data-component-id="marsal_sdc:table"]) > .marsal-table__table > * > :where([data-component-id="marsal_sdc:table_row"]) > th:where([data-component-id="marsal_sdc:table_cell"][data-alignment="start"]) {
  text-align: start;
}

:where([data-component-id="marsal_sdc:table"]) > .marsal-table__table > * > :where([data-component-id="marsal_sdc:table_row"]) > th:where([data-component-id="marsal_sdc:table_cell"][data-alignment="center"]) {
  text-align: center;
}

:where([data-component-id="marsal_sdc:table"]) > .marsal-table__table > * > :where([data-component-id="marsal_sdc:table_row"]) > th:where([data-component-id="marsal_sdc:table_cell"][data-alignment="end"]) {
  text-align: end;
}

:where([data-component-id="marsal_sdc:table_cell"][data-numeric="true"]) {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

:where([data-component-id="marsal_sdc:table_cell"]) {
  /* Formatted text, such as a text field's paragraph, sits flush with the cell padding. */
  & > :first-child {
    margin-block-start: 0;
  }

  & > :last-child {
    margin-block-end: 0;
  }
}

:where([data-component-id="marsal_sdc:table"]) > .marsal-table__table {
  /* Column headings are the cells of a Table's thead rows. */
  & > thead > :where([data-component-id="marsal_sdc:table_row"]) > :where([data-component-id="marsal_sdc:table_cell"]) {
    background: var(--marsal-color-arboretumBlue);
    color: var(--marsal-color-textOnBrand);
    font-family: var(--marsal-fontFamily-label-small);
    font-size: 0.8667em;
    font-weight: 700;
    letter-spacing: 0.075em;
    text-transform: uppercase;
  }

  /*
   * Totals are the cells of a Table's tfoot rows; their header cells read
   * uppercase. The band is a fixed light surface in both themes, so its text
   * and rule use the fixed light-theme atoms rather than the theme-aware ones.
   */
  & > tfoot > :where([data-component-id="marsal_sdc:table_row"]) > :where([data-component-id="marsal_sdc:table_cell"]) {
    background: var(--marsal-color-arboretumBlue-100);
    color: var(--marsal-color-pumaBlack);
    font-family: var(--marsal-fontFamily-label-standard);
    font-weight: 700;
    border-block-end: 3px solid var(--marsal-color-blue);

    &[scope] {
      text-transform: uppercase;
    }
  }
}

/* Density comes from the Table; standard is the base above. */
:where([data-component-id="marsal_sdc:table"][data-density="compact"]) > .marsal-table__table > * > :where([data-component-id="marsal_sdc:table_row"]) > :where([data-component-id="marsal_sdc:table_cell"]) {
  padding-block: 6px;
  padding-inline: 8px;
}

:where([data-component-id="marsal_sdc:table"][data-density="spacious"]) > .marsal-table__table > * > :where([data-component-id="marsal_sdc:table_row"]) > :where([data-component-id="marsal_sdc:table_cell"]) {
  padding-block: 16px;
  padding-inline: 24px;
}

/* The hovered body row reads in brand blue, weighted without reflow. */
@media (hover: hover) {
  :where([data-component-id="marsal_sdc:table"]) > .marsal-table__table > tbody > :where([data-component-id="marsal_sdc:table_row"]:hover) > :where([data-component-id="marsal_sdc:table_cell"]) {
    color: var(--marsal-color-textBrand);
    text-shadow: 0.02em 0 currentColor, -0.02em 0 currentColor;
  }
}

@media screen and (max-width: 28rem) {
  :where([data-component-id="marsal_sdc:table"]:not([data-density="compact"])) > .marsal-table__table > * > :where([data-component-id="marsal_sdc:table_row"]) > :where([data-component-id="marsal_sdc:table_cell"]) {
    padding-inline: 9px;
  }
}
