/* =========================================================
   STATS BAND
   -----------------------------------------------------------
   Design direction: "flight path" stats.
   - .stats-eyebrow gives the section a name, same pattern used
     elsewhere on the site (Case Studies, Process) for rhythm.
   - First stat (.stat-item--lead) is visually senior: bigger
     number, indigo accent, sets up "here's the headline result,
     here's the proof underneath."
   - .stat-rule is a 2px line that fills left-to-right when the
     item scrolls into view — ties to the brand's "performance /
     momentum" story instead of sitting static.
   - Label is placed ABOVE the number, styled as a small tag with
     a leading dash — this single structural inversion is what
     separates it from the generic centered number-over-caption
     template.
   ========================================================= */

.stats {
  background-color: var(--color-primary-black);
  /* Subtle directional grid instead of a dot-matrix texture —
     reads as a measurement/coordinate plane rather than stock
     "premium dark section" noise. */
  background-image: linear-gradient(90deg, color-mix(in srgb, var(--color-white) 5%, transparent) 1px, transparent 1px);
  background-size: 120px 100%;
  border-top: 1px solid var(--color-menu-divider);
  border-bottom: 1px solid var(--color-menu-divider);
}

.stats-eyebrow {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 40px 0;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary-orange);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 1400px;
  margin: 0 auto;
}

.stat-item {
  position: relative;
  padding: 32px 40px 48px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 168px;

  /* Reveal-on-scroll state, toggled via .is-visible in JS */
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 480ms ease-out, transform 480ms ease-out;
}
.stat-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .stat-item { transition: none; opacity: 1; transform: none; }
}

.stat-item:not(:last-child) {
  border-right: 1px solid var(--color-menu-divider);
}

/* ---- Progress rule: sits above the label, fills on reveal ---- */
.stat-rule {
  width: 100%;
  height: 2px;
  margin-bottom: 24px;
  background-color: color-mix(in srgb, var(--color-white) 12%, transparent);
  position: relative;
  overflow: hidden;
}
.stat-rule::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 0;
  background-color: var(--color-primary-orange);
  transition: width 900ms cubic-bezier(0.16, 1, 0.3, 1) 120ms;
}
.stat-item.is-visible .stat-rule::after { width: 100%; }
@media (prefers-reduced-motion: reduce) {
  .stat-rule::after { transition: none; width: 100%; }
}

/* Lead stat gets the indigo accent instead of orange, marking it
   as the "headline" figure rather than just first-in-sequence. */
.stat-item--lead .stat-rule { background-color: color-mix(in srgb, var(--color-primary-orange) 25%, transparent); }
.stat-item--lead .stat-rule::after { background-color: var(--color-primary-indigo); }

/* ---- Label: small eyebrow tag ABOVE the number ---- */
.stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-menu-muted);
  margin: 0 0 14px;
  order: -1; /* visually first, markup order kept logical for SEO/SR */
}
.stat-label::before {
  content: '';
  width: 12px;
  height: 1px;
  background-color: currentColor;
  opacity: 0.5;
  flex-shrink: 0;
}

/* ---- Number ---- */
.stat-number {
  font-weight: 600;
  font-size: clamp(32px, 3.2vw, 48px);
  line-height: 1;
  color: var(--color-neutral-canvas);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-item--lead .stat-number {
  font-size: clamp(40px, 4.4vw, 64px);
  color: var(--color-white);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .stat-item:nth-child(1),
  .stat-item:nth-child(2) {
    border-bottom: 1px solid var(--color-menu-divider);
  }
  .stat-item:nth-child(even) { border-right: none; }
  .stat-item:nth-child(3),
  .stat-item:nth-child(4) { padding-top: 40px; }

  /* On a 2-col layout the lead stat no longer needs a scale jump —
     keeps the grid visually balanced at tablet width. */
  .stat-item--lead .stat-number { font-size: clamp(36px, 6vw, 48px); }
}

@media (max-width: 640px) {
  .stats-eyebrow { padding: 32px 20px 0; }
  .stats-grid { grid-template-rows: 2fr; }

  .stat-item {
    padding: 28px 20px 32px;
    border-right: none !important;
    border-bottom: 1px solid var(--color-menu-divider);
    min-height: 0;
  }
  .stat-item:last-child { border-bottom: none; }
  .stat-item:nth-child(3),
  .stat-item:nth-child(4) { padding-top: 28px; }

  .stat-item--lead .stat-number { font-size: 40px; }
  .stat-number { font-size: 32px; }
}
