/*
 * Gutenberg / article tables.
 *
 * Bootstrap reboot zeroes table borders and padding; its visual rules only
 * apply to table.table. Posts output <figure class="wp-block-table"><table>
 * with no class, so they look unstyled. Reuse the .table tokens from theme.css.
 * Frontend only (enqueued from wp_enqueue_scripts).
 */

.wp-block-table {
  overflow-x: auto;
  max-width: 100%;
}

.article table,
.wp-block-table table {
  --bs-table-color: var(--bs-body-color);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--bs-border-color);
  --bs-table-accent-bg: transparent;
  --bs-table-striped-color: var(--bs-body-color);
  --bs-table-striped-bg: rgba(83, 47, 255, 0.035);
  width: 100%;
  margin-bottom: 1rem;
  color: var(--bs-table-color);
  vertical-align: top;
  border-color: var(--bs-table-border-color);
}

.article table > :not(caption) > * > *,
.wp-block-table table > :not(caption) > * > * {
  padding: 0.5rem 0.75rem;
  background-color: var(--bs-table-bg);
  border-bottom-width: var(--bs-border-width);
  box-shadow: inset 0 0 0 9999px var(--bs-table-accent-bg);
}

.article table > thead,
.wp-block-table table > thead {
  vertical-align: bottom;
}

.article table > thead th,
.wp-block-table table > thead th {
  font-weight: 600;
}

/* Subtle .table-striped equivalent. Skip tables that already opt into
   Bootstrap's .table class so existing markup (STT / internships / etc.)
   keeps the striping the author chose. */
.article table:not(.table) > tbody > tr:nth-of-type(odd) > *,
.wp-block-table table:not(.table) > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: var(--bs-table-striped-bg);
  color: var(--bs-table-striped-color);
}
