/* ===== Stats Bar Section ===== */

/* --- Base (Mobile) --- */
.stats-bar {
  position: relative;
  padding: clamp(2rem, 4vw, 3rem) 0;
  background: var(--az-dark-2);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
}

/* Layer-line texture */
.stats-bar__lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 2px,
    rgba(244, 131, 46, 0.015) 2px,
    rgba(244, 131, 46, 0.015) 3px
  );
}

/* Warm orange glow behind center */
.stats-bar::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 120px;
  background: radial-gradient(ellipse, rgba(244, 131, 46, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

.stats-bar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.5rem 0;
  position: relative;
  z-index: 2;
}

.stats-bar__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem clamp(1rem, 3vw, 2.5rem);
  min-width: 120px;
}

.stats-bar__number {
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 3vw + 0.5rem, 2.4rem);
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  line-height: 1;
  position: relative;
  /* G-code glow */
  text-shadow: 0 0 20px rgba(244, 131, 46, 0.15);
}

.stats-bar__suffix {
  font-size: 0.6em;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
}

.stats-bar__label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

/* Vertical divider between stats */
.stats-bar__divider {
  width: 1px;
  height: 32px;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--az-orange-glow),
    transparent
  );
  flex-shrink: 0;
}

/* G-code cursor blink on the number during animation */
.stats-bar__number .gcode-cursor {
  display: inline-block;
  width: 2px;
  height: 0.85em;
  background: var(--az-orange);
  margin-left: 2px;
  vertical-align: middle;
  animation: gcodeBlink 0.4s step-end infinite;
  box-shadow: 0 0 8px rgba(244, 131, 46, 0.6);
}

@keyframes gcodeBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* --- Tablet (768px+) --- */
@media (min-width: 768px) {
  .stats-bar__inner {
    flex-wrap: nowrap;
    gap: 0;
  }

  .stats-bar__stat {
    flex: 1;
    padding: 0.5rem 1.5rem;
  }
}

/* --- Desktop (1024px+) --- */
@media (min-width: 1024px) {
  .stats-bar {
    padding: 3rem 0;
  }

  .stats-bar__stat {
    padding: 0.5rem 2.5rem;
  }
}

/* Mobile: stack 2x2 */
@media (max-width: 767px) {
  .stats-bar__inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.2rem 0;
    justify-items: center;
    align-items: center;
  }

  .stats-bar__divider:nth-of-type(2) {
    display: none;
  }

  .stats-bar__divider {
    width: 1px;
    height: 28px;
  }

  @media (max-width: 420px) {
    .stats-bar__inner {
      grid-template-columns: 1fr;
      gap: 1.5rem;
    }

    .stats-bar__divider {
      width: 40px;
      height: 1px;
      background: linear-gradient(
        to right,
        transparent,
        var(--az-orange-glow),
        transparent
      );
    }
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gcode-cursor {
    display: none !important;
  }
}
