:root {
  --table-font-size: 0.75rem;
  --table-cell-padding-block: 0.3rem;
  --table-cell-padding-inline: 0.4rem;
  --table-cell-padding: var(--table-cell-padding-block)
    var(--table-cell-padding-inline);
  --table-cell-header-padding-block: 0.15rem;
  --table-border: 1px solid var(--md-typeset-table-color);
}

.md-typeset table:not([class]) {
  font-size: var(--table-font-size);
}

.md-typeset table:not([class]) th,
.md-typeset table:not([class]) td {
  padding: var(--table-cell-padding-block) var(--table-cell-padding-inline);
}

.md-typeset table:not([class]) td {
  border-block-start: var(--table-border);
}

.custom-table.md-typeset__table-bordered
  .md-typeset__table
  th:not(:first-child),
.custom-table.md-typeset__table-bordered
  .md-typeset__table
  td:not(:first-child) {
  border-inline-start: var(--table-border);
}

.custom-table.md-typeset__table-bordered .md-typeset__table th:not(.header) {
  border-block-start: var(--table-border);
}

.custom-table .md-typeset__table table td {
  padding: var(--table-cell-padding);
}

.custom-table .md-typeset__table table td.align-center,
.custom-table .md-typeset__table table th.align-center {
  text-align: center;
}

.custom-table .md-typeset__table table td.align-start,
.custom-table .md-typeset__table table th.align-start {
  text-align: start;
}

.custom-table .md-typeset__table table td.align-end,
.custom-table .md-typeset__table table th.align-end {
  text-align: end;
}

.custom-table .md-typeset__table table tr:has(.header) {
  background: var(--color-gray-200);
}

.custom-table .md-typeset__table table td.header {
  padding: var(--table-cell-header-padding-block);
  font-size: 1.1em;
  font-weight: 700;
}

.custom-table .md-typeset__table table td.header:has(a),
.custom-table .md-typeset__table table th.header-cell:has(a) {
  padding: 0;
}

.custom-table .md-typeset__table table td.header a {
  display: block;
  block-size: 100%;
  inline-size: 100%;
  padding: var(--table-cell-header-padding-block)
    var(--table-cell-padding-inline);
}

.custom-table .md-typeset__table table th.header-cell a {
  display: block;
  block-size: 100%;
  inline-size: 100%;
  padding: var(--table-cell-padding);
}

.custom-table .md-typeset__table table .nowrap {
  white-space: nowrap;
}

.custom-table .md-typeset__table table tr:has(a:target) {
  background: var(--color-primary-bg);
}

.custom-table .md-typeset__table tr:has(td.header) + tr > td {
  border-top: 0;
}

.custom-table-footnotes {
  margin-block-start: -1em;
  font-size: 0.8em;
}

.custom-table-footnotes ul {
  margin-block: 0;
}

.custom-table-footnotes ul li {
  margin-block-end: 0;
}

.custom-table.md-typeset__table-bordered
  .md-typeset__table
  table
  thead:first-child
  tr:first-child
  th,
.custom-table.md-typeset__table-bordered
  .md-typeset__table
  table
  thead:first-child
  tr:first-child
  td,
.custom-table.md-typeset__table-bordered
  .md-typeset__table
  table
  tbody:first-child
  tr:first-child
  th,
.custom-table.md-typeset__table-bordered
  .md-typeset__table
  table
  tbody:first-child
  tr:first-child
  td {
  border-block-start: 0;
}
