/**
 * Measurements table (sections/product-size-table.liquid).
 *
 * A real <table>, because this is tabular data and the browser already knows
 * how to keep a column aligned and how to read a cell back with its headers.
 */
.section-size-table {
  margin-top: var(--space-9);
}

.size-table__heading {
  margin: 0 0 var(--space-5);
  color: var(--color-muted);
}

/* ------------------------------------------------------------------ */
/* Unit switcher                                                        */
/* ------------------------------------------------------------------ */
/* Values are converted in the browser from the stored figure, never stored
   three times: a stored inch value can disagree with its millimetre value,
   a derived one cannot. Same reasoning as the dimension cards. */
.size-units {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.size-units[hidden] {
  display: none;
}

.size-units__label {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* A segmented control, not three loose buttons: these are alternatives, and
   sharing one border says so before any of them is read. */
.size-units__buttons {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
}

.size-units__button {
  padding: 4px var(--space-4);
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

@media screen and (prefers-reduced-motion: no-preference) {
  .size-units__button {
    transition: background-color 180ms ease, color 180ms ease;
  }
}

.size-units__button:hover {
  color: var(--color-ink);
}

.size-units__button.is-active {
  background-color: var(--color-ink);
  color: var(--color-bg);
}

.size-units__button:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* The scroller, not the table, owns the overflow. A sleeve chart is five
   columns wide and a phone is not, so it has to move sideways rather than
   squeeze every column to illegibility - and the page itself must never
   scroll horizontally because of it. */
.size-table__scroll {
  overflow-x: auto;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-m);
  /* Momentum on iOS, and a focus ring that is visible when the region takes
     keyboard focus - which it must, being scrollable. */
  -webkit-overflow-scrolling: touch;
}

.size-table__scroll:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.size-table {
  width: 100%;
  border-collapse: collapse;
  /* Numbers in a measurements table are compared down the column, so they
     have to sit under one another exactly. */
  font-variant-numeric: tabular-nums;
}

.size-table th,
.size-table td {
  padding: var(--space-3) var(--space-4);
  text-align: start;
  white-space: nowrap;
}

.size-table thead th {
  position: sticky;
  top: 0;
  background-color: color-mix(in srgb, var(--color-line) 35%, var(--color-bg));
  color: var(--color-muted);
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.size-table tbody tr + tr th,
.size-table tbody tr + tr td {
  border-top: 1px solid var(--color-line);
}

/* The row header stays put while the numbers scroll under the thumb -
   without it a visitor two columns in has no idea which size they are
   reading, which is the failure that makes wide tables useless on a phone. */
.size-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  background-color: var(--color-bg);
  font-weight: 600;
}

.size-table tbody td {
  color: var(--color-ink);
}

.size-table__note {
  max-width: 62ch;
  margin: var(--space-4) 0 0;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.6;
}
