.stats__grid {
  --stats-cols: 4;
  display: grid;
  grid-template-columns: repeat(var(--stats-cols), 1fr);

  container-type: inline-size;
}

.stats__grid.stats__grid::before,
.stats__grid.stats__grid::after {
  content: none;
}

.stats__item {
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  row-gap: 0;
  padding: 0 var(--spacing-lg);
  text-align: center;
}

.stats__item:not(:first-child) {
  border-left: 1px solid var(--on-dark-rule);
}

.stats__value {
  align-self: end;
  margin: 0 0 var(--spacing-xs);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1;

  font-size: clamp(1.75rem, 1rem + 2vw, 3rem);
  font-size: min(
    clamp(1.75rem, 1rem + 2vw, 3rem),
    calc((100cqi / var(--stats-cols) - 2 * var(--spacing-lg)) * 0.16)
  );
  color: var(--accent);
}

.stats__label {
  align-self: start;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--white);
}

.stats__grid--icon .stats__item {
  position: relative;
  grid-row: span 3;
  padding-right: var(--spacing-sm);
  align-items: start;
  justify-items: start;
  text-align: left;
  border-left: none;
}

.stats__grid--icon .stats__item:not(:first-child)::before {
  content: "";
  position: absolute;
  left: 0;
  top: var(--spacing-lg);
  bottom: 0;
  border-left: 1px solid var(--on-dark-rule);
}

.stats__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: var(--spacing-sm);
  border-radius: 6px;
  background: var(--brand);
  color: var(--white);
}

.stats__icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.stats__grid--icon .stats__value {
  align-self: start;
  margin-bottom: var(--spacing-xs);
  font-family: var(--font-body);
  font-weight: 600;
  line-height: 1.2;
  font-size: clamp(1.125rem, 0.7rem + 0.8vw, 1.375rem);
  color: var(--white);
}

.stats__grid--icon .stats__label {
  font-weight: 400;
  font-size: 0.9375rem;
  line-height: 1.5;
  letter-spacing: 0.05em;
  text-transform: none;
  color: var(--white);
  opacity: 0.7;
}

@media (max-width: 767px) {
  .stats__grid {
    --stats-cols: 2;
  }

  .stats__item:nth-child(-n + 2) {
    padding-bottom: var(--spacing-lg);
  }

  .stats__item:nth-child(odd) {
    border-left: none;
  }

  .stats__grid--icon .stats__item:nth-child(odd)::before {
    display: none;
  }

  .stats__item:nth-child(n + 3) {
    border-top: 1px solid var(--on-dark-rule);
    padding-top: var(--spacing-lg);
  }
}

@media (max-width: 599px) {
  .stats__grid {
    --stats-cols: 1;
  }

  .stats__item:nth-child(n + 3) {
    border-top: none;
  }

  .stats__item {
    padding: 0 var(--spacing-sm);
  }

  .stats__item:nth-child(n + 3) {
    padding-top: 0;
    padding-bottom: var(--spacing-lg);
  }

  .stats__grid--icon .stats__item:not(:first-child)::before {
    content: none;
  }

  .stats__item:not(:first-child) {
    border-left: none;
  }
}
