/* ==========================================================================
   Hexmodal KPI Counters — module.css
   Scoped under .hxkpi. Tokens match the install map, platform demo and
   3D product carousel (Red Hat Display, Hexmodal blue, liquid glass).
   ========================================================================== */
.hxkpi {
  --hxk-accent: #4253F1;
  --hxk-font: inherit;
  --hxk-ink: #121212;
  --hxk-ink-2: #3F403C;
  --hxk-ink-3: #6E6E6E;
  --hxk-hairline: rgba(18, 18, 18, 0.08);
  --hxk-accent-soft: rgba(66, 83, 241, 0.14);
  --hxk-radius: 28px;
  --hxk-radius-pill: 999px;
  --hxk-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --hxk-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --hxk-gutter: clamp(16px, 4vw, 48px);
  --hxk-section-y: clamp(32px, 5vw, 72px);
  --hxk-max: 1180px;
  --hxk-fs-title: clamp(26px, 3vw, 42px);
  --hxk-fs-sub: clamp(15px, 1.2vw, 18px);

  position: relative;
  padding: var(--hxk-section-y) var(--hxk-gutter);
  font-family: var(--hxk-font);
  color: var(--hxk-ink-2);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@supports (color: color-mix(in srgb, red, blue)) {
  .hxkpi { --hxk-accent-soft: color-mix(in srgb, var(--hxk-accent) 14%, transparent); }
}
.hxkpi *, .hxkpi *::before, .hxkpi *::after { box-sizing: border-box; }
.hxkpi__inner { max-width: var(--hxk-max); margin: 0 auto; }

/* ---------- Header ---------- */
.hxkpi__head { max-width: 720px; margin: 0 auto clamp(28px, 4vw, 48px); text-align: center; }
.hxkpi__title { margin: 0; font-family: inherit; font-weight: 700; font-size: var(--hxk-fs-title); line-height: 1.1; letter-spacing: -0.02em; color: var(--hxk-ink); text-wrap: balance; }
.hxkpi__sub { max-width: 560px; margin: 12px auto 0; font-size: var(--hxk-fs-sub); line-height: 1.5; color: var(--hxk-ink-2); text-wrap: balance; }
.hxkpi__sub > :first-child { margin-top: 0; }
.hxkpi__sub > :last-child { margin-bottom: 0; }
.hxkpi__sub p:empty { display: none; }

/* ---------- Stage: soft color behind the glass so it has something to refract ---------- */
.hxkpi__stage { position: relative; }
.hxkpi { overflow-x: clip; }
.hxkpi__orbs { position: absolute; inset: -12% 0; z-index: 0; pointer-events: none; }
.hxkpi__orbs span {
  position: absolute; top: 18%; width: 30%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, var(--hxk-accent) 0%, rgba(66, 83, 241, 0) 68%);
  opacity: 0.26; filter: blur(30px);
  animation: hxk-drift 18s ease-in-out infinite alternate;
}
.hxkpi__orbs span:nth-child(1) { left: 4%; }
.hxkpi__orbs span:nth-child(2) { left: 36%; top: 30%; opacity: 0.18; animation-duration: 22s; animation-delay: -6s; background: radial-gradient(circle at 50% 50%, #7FD3FF 0%, rgba(127, 211, 255, 0) 68%); }
.hxkpi__orbs span:nth-child(3) { left: 68%; animation-duration: 20s; animation-delay: -11s; }
@keyframes hxk-drift {
  0% { transform: translate3d(-6%, -4%, 0) scale(1); }
  100% { transform: translate3d(8%, 6%, 0) scale(1.12); }
}

/* ---------- Grid ---------- */
.hxkpi__grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px);
  margin: 0; padding: 0; list-style: none;
}
.hxkpi__grid > li::before { content: none; }

/* ---------- Liquid glass card ---------- */
.hxkpi__card {
  container-type: inline-size;
  position: relative; isolation: isolate;
  display: flex; flex-direction: column;
  margin: 0; padding: clamp(22px, 2.4vw, 32px);
  border-radius: 30px;
  /* Same surface as the customer results card above it */
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 255, 0.88) 55%, rgba(238, 242, 255, 0.84) 100%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  backdrop-filter: blur(26px) saturate(180%);
  box-shadow:
    inset 0 1px 0 #fff,
    inset 0 0 0 1px rgba(255, 255, 255, 0.7),
    0 2px 4px rgba(4, 14, 40, 0.12),
    0 40px 90px -38px rgba(2, 10, 30, 0.7);
  text-align: left;
}
/* Refracted rim */
.hxkpi__card::before {
  content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; padding: 1.2px; pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.2) 26%, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.25) 74%, rgba(255, 255, 255, 0.9) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
/* Specular sheen */
.hxkpi__card::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(90% 60% at 18% 0%, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0) 60%);
  opacity: 0.7;
}

.hxkpi__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: clamp(18px, 2.4vw, 28px); }
.hxkpi__icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  color: var(--hxk-accent);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.5));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 1), inset 0 -6px 12px -8px rgba(66, 83, 241, 0.3), 0 0 0 0.5px rgba(18, 18, 18, 0.06), 0 8px 18px -10px var(--hxk-accent);
}
.hxkpi__live {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px 6px 9px;
  border-radius: var(--hxk-radius-pill);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.9), 0 0 0 0.5px rgba(18, 18, 18, 0.06);
  font-size: 12px; font-weight: 600; line-height: 1; color: var(--hxk-ink-2);
}
.hxkpi__live i { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--hxk-accent); }
.hxkpi__live i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--hxk-accent); animation: hxk-ping 2.2s var(--hxk-ease-out) infinite; }
@keyframes hxk-ping { 0% { transform: scale(1); opacity: 0.5; } 80%, 100% { transform: scale(3); opacity: 0; } }

/* ---------- The number ---------- */
.hxkpi__value {
  display: flex; align-items: baseline; flex-wrap: nowrap;
  margin: 0; white-space: nowrap;
  font-family: inherit; font-weight: 700; line-height: 1.1; letter-spacing: -0.025em;
  font-size: clamp(30px, 3.6vw, 52px);
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  color: var(--hxk-ink);
}
@container (min-width: 1px) {
  .hxkpi__value { font-size: clamp(30px, 14cqi, 60px); }
}
.hxkpi__affix { font-weight: 600; color: var(--hxk-ink); }
.hxkpi__affix--pre { margin-right: 0.04em; font-size: 0.78em; align-self: flex-start; padding-top: 0.12em; }
.hxkpi__affix--suf { margin-left: 0.2em; font-size: 0.42em; letter-spacing: 0; color: var(--hxk-ink-2); }
.hxkpi__odo { display: inline-flex; align-items: flex-start; }

/* Odometer columns (built by JavaScript) */
.hxk-col {
  position: relative; display: inline-block; height: 1.1em; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 86%, transparent 100%);
  transition: color 900ms var(--hxk-ease-out);
}
.hxk-strip { display: block; will-change: transform; }
.hxk-strip span { display: block; height: 1.1em; text-align: center; }
.hxk-sep { display: inline-block; height: 1.1em; }
.hxk-col.is-tick {
  color: var(--hxk-accent);
  transition-duration: 160ms;
}

.hxkpi__label { margin: 14px 0 0; font-size: 16px; font-weight: 600; line-height: 1.35; letter-spacing: -0.005em; color: var(--hxk-ink); }
.hxkpi__caption { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--hxk-ink-2); }
.hxkpi__note { margin: clamp(18px, 2.4vw, 28px) 0 0; text-align: center; font-size: 12px; line-height: 1.5; color: var(--hxk-ink-3); }

/* ---------- Entrance: cards lift in once, numbers roll up from zero ---------- */
.hxkpi--js .hxkpi__card { transition: opacity 800ms var(--hxk-ease-out), transform 900ms var(--hxk-ease-out); transition-delay: calc(var(--i, 0) * 110ms); }
.hxkpi--js:not(.is-in) .hxkpi__card { opacity: 0; transform: translate3d(0, 22px, 0) scale(0.98); }

/* ---------- Tablet + phone: one column ---------- */
@media (max-width: 899px) {
  .hxkpi__grid { grid-template-columns: 1fr; max-width: 520px; margin: 0 auto; gap: 16px; }
  .hxkpi__top { margin-bottom: 16px; }
}
@media (max-width: 480px) {
  .hxkpi__card { padding: 22px 20px; border-radius: 24px; }
  .hxkpi__icon { width: 40px; height: 40px; }
}

/* ---------- Text color field (headings on a dark background) ---------- */
.hxkpi.hxkpi--text .hxkpi__head, .hxkpi.hxkpi--text .hxkpi__note { --hxk-ink: var(--hxk-text); --hxk-ink-2: var(--hxk-text); --hxk-ink-3: var(--hxk-text); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .hxkpi *, .hxkpi *::before, .hxkpi *::after { animation: none !important; transition-duration: 1ms !important; transition-delay: 0ms !important; }
  .hxkpi--js:not(.is-in) .hxkpi__card { opacity: 1; transform: none; }
}
