/* The methods page, "How we compare products" (0.14.0): its one table, of four kinds of page.
   Tokens from site.css only; no raw colours, no shadows, no motion. See design-system/buildbatch/pages/job-and-comparison-pages.md.

   Phone first. Each row is a block: the kind of page as its heading, then its two cells, each with its own label, so
   nothing is squeezed into a 100px column and the page never scrolls sideways. From 40rem the same markup is a table of
   three columns. The roles on the elements keep the table's meaning for a screen reader while the display changes. */

.methods-table,
.methods-table tbody,
.methods-table tr,
.methods-table th,
.methods-table td {
  display: block;
}

.methods-table {
  margin: var(--space-md) 0 0;
  overflow-wrap: break-word;
}

.methods-table caption {
  display: block;
  padding-bottom: var(--space-sm);
  color: var(--color-muted-foreground);
  font-size: var(--text-sm);
  text-align: left;
}

/* The column headings are repeated by each cell's own label on a phone, so they are hidden from sight but still read. */
.methods-table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.methods-table tr {
  padding: var(--space-md) 0;
  border-top: var(--border-thin) solid var(--color-border);
}

.methods-table tbody tr:last-child {
  border-bottom: var(--border-thin) solid var(--color-border);
}

.methods-table th,
.methods-table td {
  padding: 0;
}

.methods-table tbody th {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  text-align: left;
}

.methods-table td {
  margin-top: var(--space-sm);
}

/* The second content line gives the label empty alternative text where it is understood, so a screen reader does not read it twice. */
.methods-table td::before {
  content: attr(data-label);
  content: attr(data-label) / "";
  display: block;
  color: var(--color-muted-foreground);
  font-size: var(--text-sm);
  font-weight: 600;
}

@media (min-width: 40rem) {
  .methods-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
  }

  .methods-table caption {
    display: table-caption;
  }

  .methods-table thead {
    position: static;
    display: table-header-group;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip-path: none;
    white-space: normal;
  }

  .methods-table tbody {
    display: table-row-group;
  }

  .methods-table tr {
    display: table-row;
    padding: 0;
    border: 0;
  }

  .methods-table th,
  .methods-table td {
    display: table-cell;
    margin: 0;
    padding: var(--space-smd) var(--space-md) var(--space-smd) 0;
    border-top: var(--border-thin) solid var(--color-border);
    text-align: left;
    vertical-align: top;
  }

  .methods-table thead th {
    border-top: 0;
    border-bottom: var(--border-thin) solid var(--color-control-border);
    color: var(--color-muted-foreground);
    font-size: var(--text-sm);
    font-weight: 600;
  }

  .methods-table tbody th {
    width: 9rem;
  }

  .methods-table tbody tr:last-child {
    border-bottom: 0;
  }

  .methods-table tbody tr:last-child th,
  .methods-table tbody tr:last-child td {
    border-bottom: var(--border-thin) solid var(--color-border);
  }

  .methods-table td::before {
    content: none;
  }
}
