/* Stats Block Styles
 * Uses DigiCert design system tokens from styles/tokens.css
 */

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-l) var(--space-xl);
  padding: var(--space-l) 0;

  --stats-value-max-size: 4rem; /* 64px - stats-specific max per Figma spec */
  --stats-highlight-max-size: 1.5rem; /* 24px */

  /* Fixed typography on mobile using design tokens */
  --stats-value-size: var(--heading-font-size-xxl);
  --stats-label-size: var(--body-font-size-xs);
  --stats-highlight-size: 1.25rem; /* 20px */
}

/* Tablet+: fluid typography and wider gaps */
@media (width >= 600px) {
  .stats {
    gap: var(--space-xl);
    padding: var(--space-xl) 0;

    --stats-value-size: clamp(var(--heading-font-size-xxl), 5vw + 1rem, var(--stats-value-max-size));
    --stats-label-size: clamp(var(--body-font-size-xs), 1vw + 0.5rem, var(--body-font-size-s));
    --stats-highlight-size: clamp(1.25rem, 1.5vw + 0.5rem, var(--stats-highlight-max-size));
  }
}

.stats > ul {
  display: contents;
  list-style: none;
  margin: 0;
  padding: 0;
}

.stats .stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1 1 auto;
}

/* Stat value - the big number */
.stats .stat-value {
  font-family: var(--body-font-family);
  font-size: var(--stats-value-size);
  font-weight: 700;
  line-height: var(--line-height-tight);
  margin: 0 0 var(--space-xs);
  color: var(--digicert-blue);
  white-space: nowrap;
}

/* Stat label - descriptive text below the value */
.stats .stat-label {
  font-family: var(--body-font-family);
  font-size: var(--stats-label-size);
  font-weight: 400;
  color: var(--digicert-neutral-800);
  margin: 0 0 var(--space-xs);
}

/* Stat highlight - bold emphasis text */
.stats .stat-highlight {
  font-family: var(--heading-font-family);
  font-size: var(--stats-highlight-size);
  font-weight: 700;
  color: var(--digicert-black);
  margin: 0;
}

/* Left aligned */
.stats.left-stats .stat {
  align-items: flex-start;
  text-align: left;
}

/* Bordered - cards with borders */
.stats.bordered-stats .stat {
  padding: var(--space-xl) var(--space-l);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-l);
  background: var(--surface-color);
}

/* Cards - with shadows */
.stats.cards-stats .stat {
  padding: var(--space-xl);
  border-radius: var(--border-radius-l);
  background: var(--surface-color);
  box-shadow: var(--shadow-md);
}

/* Large - bigger numbers (scaled up from default) */
.stats.large-stats {
  --stats-value-size: var(--heading-font-size-xxl);
  --stats-label-size: var(--body-font-size-s);
  --stats-highlight-size: var(--stats-highlight-max-size);
}

@media (width >= 600px) {
  .stats.large-stats {
    --stats-value-size: clamp(var(--heading-font-size-xl), 6vw + 1.5rem, var(--heading-font-size-xxl));
    --stats-label-size: clamp(var(--body-font-size-s), 1vw + 0.5rem, var(--body-font-size-m));
    --stats-highlight-size: clamp(var(--stats-highlight-max-size), 2vw + 0.5rem, 1.75rem);
  }
}

/* Small - stepped down from default */
.stats.small-stats {
  --stats-value-size: var(--heading-font-size-l);
  --stats-label-size: var(--body-font-size-xs);
  --stats-highlight-size: 1rem; /* 16px */
}

@media (width >= 600px) {
  .stats.small-stats {
    --stats-value-size: clamp(var(--heading-font-size-l), 4vw + 0.75rem, var(--heading-font-size-xl));
    --stats-label-size: var(--body-font-size-xs);
    --stats-highlight-size: clamp(1rem, 1vw + 0.5rem, 1.25rem);
  }
}

/* ==========================================================================
   Column Variants (Mobile-first)
   Uses flexbox with controlled widths for natural orphan centering.
   Orphan rows (fewer items than columns) stay close together and centered.
   ========================================================================== */

/* Two Columns - always 2 columns at all viewport sizes */
.stats.two-columns-stats .stat {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: calc(50% - var(--space-xl));
  max-width: 24rem;
}

/* Three Columns - 2 on mobile, 3 on tablet+ */
.stats.three-columns-stats .stat {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: calc(50% - var(--space-xl));
  max-width: 20rem;
}

@media (width >= 600px) {
  .stats.three-columns-stats .stat {
    width: calc(33.333% - var(--space-xl));
    max-width: 18rem;
  }
}

/* Four Columns - 2 on mobile, 4 on tablet+ */
.stats.four-columns-stats .stat {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: calc(50% - var(--space-xl));
  max-width: 18rem;
}

@media (width >= 600px) {
  .stats.four-columns-stats .stat {
    width: calc(25% - var(--space-xl));
    max-width: 16rem;
  }
}
