/**
 * MPISD - Table Block
 * blocks/table/style.css
 * Per-column sizes, and the subsite fit and row cards; the table design lives in global.css.
 */

/* A percentage needs a real table box, so the scroll wrapper takes over the sideways scrolling */
.mpisd-table--fill .mpisd-table-scroll {
  width: calc(100% + 40px);
}

.mpisd-table--fill .mpisd-table__table {
  display: table;
  width: 100%;
  max-width: none;
}

.mpisd-table__cell--sized {
  width: var(--mpisd-table-col-width, auto);
}

/* Not every browser applies min-width to a table cell; an empty block that wide holds the column open */
.mpisd-table__cell--sized::before {
  content: "";
  display: block;
  width: var(--mpisd-table-col-min-width, 0);
}

/* Subsites: the table fits the content width; narrower cells and header text that wraps between words */
.mpisd-subsite .mpisd-table-scroll {
  width: calc(100% + 40px);
}

.mpisd-subsite .mpisd-table__table {
  display: table;
  max-width: 100%;
}

.mpisd-subsite .mpisd-table__table:not(.mpisd-table-reset) thead th {
  white-space: normal;
}

@media (min-width: 1200px) {
  .mpisd-subsite .mpisd-table__table th,
  .mpisd-subsite .mpisd-table__table td {
    padding-right: var(--space-20);
    padding-left: var(--space-20);
  }
}

/* Set by script.js when whole words don't fit: first tighter cells, then rows as cards. Words never split. */
.mpisd-subsite .mpisd-table-scroll--compact .mpisd-table__table th,
.mpisd-subsite .mpisd-table-scroll--compact .mpisd-table__table td {
  padding-right: var(--space-sm);
  padding-left: var(--space-sm);
}

.mpisd-subsite .mpisd-table-scroll--stack .mpisd-table__table,
.mpisd-subsite .mpisd-table-scroll--stack .mpisd-table__table tbody,
.mpisd-subsite .mpisd-table-scroll--stack .mpisd-table__table tr,
.mpisd-subsite .mpisd-table-scroll--stack .mpisd-table__table td {
  display: block;
  width: 100%;
}

.mpisd-subsite .mpisd-table-scroll--stack .mpisd-table__table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.mpisd-subsite .mpisd-table-scroll--stack .mpisd-table__table tbody td {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-20);
}

.mpisd-subsite .mpisd-table-scroll--stack .mpisd-table__table tbody td:not([data-label]) {
  grid-template-columns: minmax(0, 1fr);
}

.mpisd-subsite .mpisd-table-scroll--stack .mpisd-table__table tbody td:first-child {
  padding-top: var(--space-20);
}

.mpisd-subsite .mpisd-table-scroll--stack .mpisd-table__table tbody td:last-child {
  padding-bottom: var(--space-20);
}

.mpisd-subsite .mpisd-table-scroll--stack .mpisd-table__table tbody td:empty {
  display: none;
}

.mpisd-subsite .mpisd-table-scroll--stack .mpisd-table__table tbody td::before {
  display: none;
}

.mpisd-subsite .mpisd-table-scroll--stack .mpisd-table__table tbody td[data-label]::before {
  content: attr(data-label);
  display: block;
  width: auto;
  font-family: var(--font-secondary);
  font-weight: var(--fw-bold);
}
