/* Workouts: each body part's sets this week, then a card per body part whose exercises open to a chart and
   calendar */
.week-sets {
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
}

.week-sets tr:last-child td {
  padding-bottom: 0;
}

/* The thin line between the overview (the week's table and the Exercise habit's year) and the body parts */
main > hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 32px 0;
}

.workouts-controls,
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.workouts-controls {
  margin-bottom: 16px;
}

.workouts-controls p,
.card-head h3 {
  margin: 0;
}

.workouts-controls .tools,
.workouts-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workouts-controls .tools {
  gap: 16px;
  margin-left: auto;
}

.workouts-controls label {
  color: var(--muted);
}

.workout-group {
  --columns: 1rem minmax(0, 1fr) 9rem 7rem 7rem;
}

.group-calendar {
  margin: 12px 0 8px;
}

.workout-group .columns,
.exercise > summary {
  display: grid;
  grid-template-columns: var(--columns);
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
}

.workout-group .columns {
  color: var(--muted);
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--line);
}

.exercise {
  border-bottom: 1px solid var(--line);
}

.exercise:last-child {
  border-bottom: 0;
}

/* Undo style.css's details summary rule, which is for the micronutrients toggle. */
.exercise > summary {
  margin: 0;
  font-size: inherit;
  list-style: none;
}

.exercise > summary::-webkit-details-marker {
  display: none;
}

.exercise > summary::before {
  content: "›";
  justify-self: center;
  color: var(--muted);
  transition: transform 0.15s;
}

.exercise[open] > summary::before {
  transform: rotate(90deg);
}

.exercise > summary:hover .name {
  color: var(--accent);
}

/* Marks bodyweight exercises, whose weights are added to bodyweight. */
.exercise .tag {
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

/* Its three spans are columns of the summary grid; on phones they go under the name. */
.exercise .stats {
  display: contents;
}

.exercise :is(.stats, .week) {
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.exercise .label {
  display: none;
}

.exercise-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px 24px;
  padding: 0 0 16px 28px;
}

@media (max-width: 40rem) {
  .workout-group {
    --columns: 1rem minmax(0, 1fr);
  }

  .workout-group .columns {
    display: none;
  }

  .exercise > summary {
    gap: 2px 12px;
  }

  /* Under the name: "4 sets in the past 7 days", then "Trained Oct 15 · PR Oct 7". */
  .exercise .stats {
    display: block;
    grid-column: 2;
  }

  .exercise .week {
    display: block;
  }

  .exercise .stats > :last-child::before {
    content: " · ";
  }

  .exercise .label {
    display: inline;
  }

  .exercise-body {
    grid-template-columns: 1fr;
    padding-left: 0;
  }
}
