.rh-history {
  container-name: rhythm-history;
  container-type: inline-size;
  --rh-padding: clamp(15px, 2vw, 24px);
}

.rh-history > .panel-head {
  padding-inline: var(--rh-padding);
}

.rh-navigation,
.rh-scale,
.rh-key {
  display: inline-flex;
  align-items: center;
}

.rh-navigation {
  gap: 5px;
}

.rh-navigation > span {
  margin-right: 6px;
  font-size: .78rem;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.rh-navigation .icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.rh-navigation .icon-btn:disabled {
  opacity: .36;
}

.rh-months {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 2.35cqw, 30px);
  padding: 21px var(--rh-padding) 20px;
}

.rh-month {
  min-width: 0;
}

.rh-month h3 {
  margin: 0 0 11px;
  font-weight: 550;
  font-size: .87rem;
  letter-spacing: -.015em;
  color: #e1e4d9;
}

.rh-days,
.rh-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.rh-weekdays {
  margin-bottom: 5px;
  color: #9ca196;
  font-size: .72rem;
  text-align: center;
}

.rh-day {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  border-radius: 22%;
  color: var(--rh-figure);
  font-size: .75rem;
  line-height: 1;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  background: var(--rh-colour);
  transition: box-shadow .13s, transform .13s;
}

.rh-level-0 { --rh-colour: #2e312c; --rh-figure: #b6bdaf; }
.rh-level-1 { --rh-colour: #42533c; --rh-figure: #e1e9d8; }
.rh-level-2 { --rh-colour: #667f51; --rh-figure: #f3f7ed; }
.rh-level-3 { --rh-colour: #9db77b; --rh-figure: #26321c; }
.rh-level-4 { --rh-colour: #cde9a3; --rh-figure: #28341c; }
.rh-future {
  --rh-colour: repeating-linear-gradient(135deg, #242622, #242622 3px, #31342d 3px, #31342d 4px);
  --rh-figure: #a4aa9b;
}

.rh-day[aria-current="date"] {
  outline: 1.5px solid var(--purple);
  outline-offset: 1px;
  font-weight: 700;
}

.rh-day:hover:not(:disabled),
.rh-day:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid #e7d8f8;
  outline-offset: 1px;
  transform: translateY(-1px);
}

.rh-legend {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 14px;
  padding: 12px var(--rh-padding) 15px;
  border-top: 1px solid var(--line);
  color: #aeb3a8;
  font-size: .75rem;
}

.rh-scale {
  gap: 11px;
  flex-wrap: wrap;
}

.rh-key {
  gap: 5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rh-key i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--rh-colour);
}

@container rhythm-history (max-width: 765px) {
  .rh-months { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 21px 24px; }
  .rh-days, .rh-weekdays { gap: 4px; }
}

@container rhythm-history (max-width: 435px) {
  .rh-months { gap: 18px 13px; padding: 17px 12px; }
  .rh-days, .rh-weekdays { gap: 2px; }
  .rh-navigation > span { margin-right: 1px; }
  .rh-navigation { gap: 3px; }
  .rh-day { font-size: .7rem; }
  .rh-weekdays { font-size: .66rem; }
  .rh-scale { gap: 8px; }
  .rh-legend { padding-inline: 12px; }
}
