.isotype-chart {
  margin: 0;
  padding-block: 0.5rem;
  min-width: 0;
}

.isotype-chart__item + .isotype-chart__item {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);
}

.isotype-chart__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

.isotype-chart__name {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.isotype-chart__name::before {
  content: "";
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--isotype-color);
  flex: 0 0 auto;
}

.isotype-chart__value {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  white-space: nowrap;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.isotype-chart__amount,
.isotype-chart__unit {
  font-size: inherit;
  font-weight: inherit;
}

.isotype-chart__amount {
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.isotype-chart--spacious .isotype-chart__value {
  padding: 0.65rem 0.95rem;
  border: 1px solid color-mix(in srgb, var(--isotype-color) 24%, transparent);
  border-radius: 0.85rem;
  background: color-mix(in srgb, var(--isotype-color) 8%, transparent);
}

.isotype-chart__people {
  display: grid;
  grid-template-columns: repeat(auto-fill, 36px);
  row-gap: 12px;
}

.isotype-chart__people svg {
  justify-self: center;
  transition: opacity 160ms ease;
}

.isotype-chart__people .isotype-chart__person--muted {
  opacity: 0.12;
}

.isotype-chart__plot {
  display: none;
  width: 100%;
  overflow: hidden;
}

.isotype-chart__canvas--ready > .isotype-chart__plot {
  display: block;
}

.isotype-chart__canvas--ready > .isotype-chart__people {
  display: none;
}

.isotype-chart--compact .isotype-chart__people {
  grid-template-columns: repeat(auto-fill, 32px);
  row-gap: 10px;
}

.isotype-chart--compact .isotype-chart__people svg {
  width: 22px;
  height: 44px;
}

.isotype-chart__categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.isotype-chart__category {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
  border-radius: 0.85rem;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.isotype-chart__category::before {
  content: "";
  position: absolute;
  inset-inline-start: -1px;
  inset-block: 1rem;
  width: 3px;
  border-radius: 3px;
  background: var(--isotype-color);
}

.isotype-chart__category:disabled {
  cursor: default;
  opacity: 1;
}

.isotype-chart__category:not(:disabled):hover {
  border-color: var(--isotype-color);
  background: color-mix(in srgb, var(--isotype-color) 5%, transparent);
}

.isotype-chart__category[aria-pressed="true"] {
  border-color: var(--isotype-color);
  background: color-mix(in srgb, var(--isotype-color) 10%, transparent);
}

.isotype-chart__category:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.isotype-chart__category-name {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
}

.isotype-chart--compact .isotype-chart__value {
  font-size: 2rem;
  font-weight: 300;
}

.isotype-chart__legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.25rem;
  font-size: 0.9rem;
}

.isotype-chart__legend svg {
  flex: 0 0 auto;
}

@media (prefers-reduced-motion: reduce) {
  .isotype-chart__people svg,
  .isotype-chart__category {
    transition: none;
  }
}
