/**
 * @license EUPL-1.2
 * Copyright (c) 2021 Robbert Broersma
 */

@import "../mixin";

/* stylelint-disable selector-class-pattern */

@mixin utrecht-html-table {
  table {
    @include utrecht-table;
    @include utrecht-table--distanced;
  }

  caption {
    @include utrecht-table__caption;
  }

  thead {
    @include utrecht-table__header;
  }

  tbody {
    @include utrecht-table__body;
  }

  th {
    @include utrecht-table__header-cell;
  }

  th,
  td {
    @include utrecht-table__cell;
  }

  td:first-child,
  th:first-child {
    @include utrecht-table__cell--first;
  }

  td:last-child,
  th:last-child {
    @include utrecht-table__cell--last;
  }

  thead tr:last-child th {
    @include utrecht-table__cell--last-header-row;
  }

  thead > tr > th.numeric,
  tfoot > tr > th.numeric,
  th[scope="column"].numeric {
    @include utrecht-table__cell--numeric-column;
  }

  td.numeric {
    @include utrecht-table__cell--numeric-column;
    @include utrecht-table__cell--numeric-data;
  }

  table.alternate-row-color {
    & > tr:nth-child(even) > td,
    & > tr:nth-child(even) > th {
      @include utrecht-table__row--alternate-even;
    }

    & > tr:nth-child(odd) > td,
    & > tr:nth-child(odd) > th {
      @include utrecht-table__row--alternate-odd;
    }

    & > tbody > tr:nth-child(even) > td,
    & > tbody > tr:nth-child(even) > th {
      @include utrecht-table__row--alternate-even;
    }

    & > tbody > tr:nth-child(odd) > td,
    & > tbody > tr:nth-child(odd) > th {
      @include utrecht-table__row--alternate-odd;
    }
  }
}
