/*
* Table theme
*
*/

@use '../table-mixins.scss' as table-mixins;

.dnb-table {
  text-align: left;

  // Variants
  &,
  &__th--emphasis {
    --table-th-text-color: var(--theme-color-black-80, currentColor);
    --table-th-font-weight: var(--font-weight-medium);
    --table-th-font-size: var(--font-size-basis);
  }
  &__th--subtle {
    --table-th-text-color: var(--token-color-text-neutral-alternative);
    --table-th-font-weight: var(--font-weight-regular);
    --table-th-font-size: var(--font-size-small);

    &#{&} {
      padding-top: 1.5rem;
      padding-bottom: 0.5rem;
    }
  }

  // Header
  &__th,
  & thead th {
    // spacing
    padding: 2rem 1rem 1rem;

    // typography
    font-weight: var(--table-th-font-weight);
    color: var(--table-th-text-color);
    font-size: var(--table-th-font-size);
    line-height: var(--line-height-basis);
    vertical-align: bottom;

    .dnb-table__size--medium & {
      // spacing
      padding: 1.375rem 1rem 0.875rem;

      // typography
      font-size: var(--font-size-small);
      line-height: var(--line-height-small);

      .dnb-button__text {
        line-height: inherit;
      }
    }

    .dnb-table__size--small & {
      // spacing
      padding: 1.25rem 1rem 0.5rem;

      // typography
      font-size: var(--font-size-small);
      line-height: var(--line-height-small);
    }
  }

  // body data
  /* stylelint-disable */
  &__td,
  & tbody &__th,
  & tbody td,
  & tbody th {
    // spacing
    padding: 1rem;

    // typography
    color: var(--theme-color-black-80, currentColor);
    font-size: var(--font-size-basis);
    line-height: var(--line-height-basis);
    vertical-align: baseline;
  }

  & tbody &__th,
  & tbody th {
    // spacing
    padding: 1rem;

    // typography
    vertical-align: baseline;
  }

  tbody &__th,
  tbody &__td,
  tbody th,
  tbody td {
    .dnb-table__size--medium & {
      // spacing
      padding: 0.875rem 1rem;

      // typography
      font-size: var(--font-size-small);
      line-height: var(--line-height-small);
    }

    .dnb-table__size--small & {
      // spacing
      padding: 0.625rem 1rem;

      // typography
      font-size: var(--font-size-small);
      line-height: var(--line-height-small);
    }
  }
  /* stylelint-enable */

  // bottom border
  &:not(&--outline):not(&--no-border) > tbody {
    position: relative;

    @include table-mixins.tableBorder() {
      border-bottom: var(--table-border);
    }
  }
}
