.gait-study-table {
  --gait-ink: #203449;
  --gait-blue: #0b4679;
  --gait-line: #d7e3ef;
  --gait-tint: #f3f7fc;
  --gait-radius: 0.875rem;
  container: gait-study-table / inline-size;
  margin-block: 1rem 2rem;
}

.gait-study-table table {
  inline-size: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--gait-ink);
  font-size: 1rem;
  line-height: 1.4;
}

.gait-study-table caption {
  caption-side: top;
  padding: 0 0 0.625rem;
  color: var(--gait-blue);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: start;
}

.gait-study-table th,
.gait-study-table td {
  padding: 0.75rem 0.875rem;
  vertical-align: top;
  text-align: start;
  overflow-wrap: anywhere;
}

.gait-study-table thead th {
  background-color: var(--gait-blue);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  text-wrap: balance;
}

.gait-study-table thead th:first-child {
  border-start-start-radius: var(--gait-radius);
}

.gait-study-table thead th:last-child {
  border-start-end-radius: var(--gait-radius);
}

.gait-study-table tbody th,
.gait-study-table tbody td {
  border-block-end: 1px solid var(--gait-line);
  border-inline-end: 1px solid var(--gait-line);
  background-color: #fff;
  font-variant-numeric: tabular-nums;
}

.gait-study-table tbody tr:nth-child(even) > * {
  background-color: var(--gait-tint);
}

.gait-study-table tbody th {
  border-inline-start: 1px solid var(--gait-line);
  color: var(--gait-blue);
  font-weight: 700;
}

.gait-study-table__label {
  display: none;
}

@container gait-study-table (inline-size > 39rem) {
  .gait-study-table tbody tr:last-child th {
    border-end-start-radius: var(--gait-radius);
  }

  .gait-study-table tbody tr:last-child td:last-child {
    border-end-end-radius: var(--gait-radius);
  }
}

@container gait-study-table (inline-size <= 39rem) {
  .gait-study-table table,
  .gait-study-table caption,
  .gait-study-table tbody {
    display: block;
  }

  .gait-study-table thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
  }

  .gait-study-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-block-end: 0.75rem;
    border: 1px solid var(--gait-line);
    border-radius: var(--gait-radius);
    overflow: hidden;
  }

  .gait-study-table tbody th,
  .gait-study-table td:last-child:nth-child(4) {
    grid-column: 1 / -1;
  }

  .gait-study-table tbody tr > th {
    border: 0;
    border-block-end: 1px solid var(--gait-line);
    border-radius: 0;
    background-color: var(--gait-tint);
  }

  .gait-study-table tbody tr > td {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.375rem;
    border: 0;
    border-radius: 0;
    background-color: #fff;
  }

  .gait-study-table tbody td:nth-child(3) {
    border-inline-start: 1px solid var(--gait-line);
  }

  .gait-study-table tbody td:nth-child(4) {
    border-block-start: 1px solid var(--gait-line);
  }

  .gait-study-table__label {
    display: block;
    color: var(--gait-blue);
    font-size: 0.8125rem;
    font-weight: 600;
  }
}

@container gait-study-table (inline-size < 17rem) {
  .gait-study-table tbody tr {
    grid-template-columns: minmax(0, 1fr);
  }

  .gait-study-table tbody td:nth-child(n+3) {
    border-inline-start: 0;
    border-block-start: 1px solid var(--gait-line);
  }
}

@media (forced-colors: active) {
  .gait-study-table thead th {
    border-block-end: 1px solid CanvasText;
  }
}
