/* ============================================
   ALGORIS IT — stats.css
   Chiffres clés. Compteurs animés. Épuré.
   ============================================ */


/* ─── Section ─── */

.stats {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3xl) var(--space-xl);
  position: relative;
  overflow: hidden;
}

/* Ligne bleue décorative centré en haut */
.stats::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
  pointer-events: none;
}


/* ─── Grid 4 colonnes ─── */

.stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  max-width: var(--container-max);
  margin: 0 auto;
  position: relative;
}

/* Séparateurs verticaux entre les items */
.stat-item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 15%;
  height: 70%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--border), transparent);
}


/* ─── Animation d'entrée stat items ─── */

.stat-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  border-radius: var(--radius-md);

  /* État initial invisible */
  opacity: 0;
  transform: translateY(30px);

  /* Fallback CSS si JS ne tourne pas */
  animation: revealFallback 0.6s ease 2s both;
}

.stat-item.stat--visible {
  opacity: 1;
  transform: translateY(0);
  animation: none;
  transition:
    opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    background var(--transition-base);
}

.stat-item.stat--visible:nth-child(1) { transition-delay: 0s; }
.stat-item.stat--visible:nth-child(2) { transition-delay: 0.12s; }
.stat-item.stat--visible:nth-child(3) { transition-delay: 0.24s; }
.stat-item.stat--visible:nth-child(4) { transition-delay: 0.36s; }

.stat-item:hover { background: var(--bg-card); }


/* ─── Chiffre ─── */

.stat-item__number {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 0;
}

/* Préfixe et suffixe gérés par animations.js — pas de pseudo-éléments CSS */

.counter__prefix,
.counter__suffix {
  font-size: 0.48em;
  font-weight: 700;
  color: var(--accent);
  align-self: flex-end;
  padding-bottom: 0.2em;
  line-height: 1;
}

.counter__prefix {
  align-self: flex-start;
  padding-top: 0.3em;
  padding-bottom: 0;
  margin-right: 2px;
}

.counter__suffix {
  margin-left: 2px;
}


/* ─── Label ─── */

.stat-item__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.4;
}


/* ─── Light mode ─── */

:root[data-theme="light"] .stats {
  background: var(--bg-secondary);
}

:root[data-theme="light"] .stat-item:hover {
  background: var(--bg-card);
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}


/* ─── Responsive ─── */

@media (max-width: 900px) {
  .stats__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-item:nth-child(2)::after {
    display: none;
  }

  .stat-item:nth-child(odd):not(:last-child)::after {
    display: block;
  }

  .stat-item:nth-child(even)::after {
    display: none;
  }
}

@media (max-width: 500px) {
  .stats {
    padding: var(--space-2xl) var(--space-md);
  }

  .stats__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    justify-items: center;
  }

  .stat-item {
    padding: var(--space-md) var(--space-sm);
  }

  .stat-item::after {
    display: none;
  }

  .stat-item__number {
    font-size: 2rem;
    justify-content: center;
  }

  .stat-item__label {
    font-size: 0.62rem;
    letter-spacing: 0.1em;
  }
}