/* ============================================================================
   HBA-CPQ | cpq-app/public/css/moves.css
   Material 3 Expressive Spring Tokens (Spatial vs. Effects), Living Anti-
   Spinner Shimmer, 5-Tier Optical Haptics, Rolling Numeric Ticker & Chip
   Spring Utilities. Strictly <= 500 lines.
   ============================================================================ */

:root {
  /* M3 Expressive Spatial Springs (position, scale, shape morph — natural overshoot) */
  --spring-spatial-fast: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-spatial-default: cubic-bezier(0.30, 1.32, 0.40, 1);
  --spring-spatial-slow: cubic-bezier(0.26, 1.16, 0.38, 1);
  --spring-spatial: cubic-bezier(0.3, 1.32, 0.4, 1);
  --spring-micro: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* M3 Expressive Effects Springs (opacity, color, blur, sheet glide — zero overshoot) */
  --spring-effects-fast: cubic-bezier(0.22, 1, 0.36, 1);
  --spring-effects-default: cubic-bezier(0.20, 0.90, 0.30, 1);
  --spring-effects: cubic-bezier(0.2, 0.9, 0.3, 1);
}

/* Compositor-only living shimmer skeleton (translate3d on ::after, zero repaint) */
.hba-shimmer,
.skel i {
  position: relative;
  overflow: hidden;
  background: var(--hba-surface-alt, #eef1f5);
}
.hba-shimmer::after,
.skel i::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--hba-surface-page, #ffffff) 74%, transparent) 50%,
    transparent 100%
  );
  transform: translate3d(-100%, 0, 0);
  animation: hba-shimmer-wave 1.35s var(--spring-effects) infinite;
}

@keyframes hba-shimmer-wave {
  0% { transform: translate3d(-100%, 0, 0); }
  100% { transform: translate3d(100%, 0, 0); }
}

/* Living 3-dot wave pulse for async buttons (anti-spinner standard) */
.hba-wave-dots { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.hba-wave-dots i {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor; display: inline-block;
  animation: hba-wave-dot 920ms var(--spring-effects) infinite;
}
.hba-wave-dots i:nth-child(2) { animation-delay: 140ms; }
.hba-wave-dots i:nth-child(3) { animation-delay: 280ms; }

@keyframes hba-wave-dot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.45; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* Optical recoil ring for motorless/iOS devices on error haptic */
[data-err-recoil='true'] {
  animation: hba-err-recoil 220ms var(--spring-effects-fast);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hba-status-danger, #c8102e) 32%, transparent) !important;
}
@keyframes hba-err-recoil {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Optical detent & celebrate pulses for motorless/iOS devices */
[data-haptic-detent='true'] {
  animation: hba-detent-pop 140ms var(--spring-spatial-fast);
}
@keyframes hba-detent-pop {
  0% { transform: scale(0.96); }
  60% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

[data-haptic-celebrate='true'] {
  animation: hba-celebrate-pop 340ms var(--spring-spatial-fast);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--hba-status-success, #00702f) 32%, transparent) !important;
}
@keyframes hba-celebrate-pop {
  0% { transform: scale(0.96); }
  45% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* Staggered card reveal (capped at 6 cards x 32ms = 192ms max delay) */
.hba-card-stagger {
  animation: hba-card-rise 240ms var(--spring-effects-fast) calc(min(var(--ci, 0), 6) * 32ms) both;
}
@keyframes hba-card-rise {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* Optical confirmation ring pulse for motorless/iOS devices on confirm/success haptic */
[data-haptic-confirm='true'] {
  animation: hba-confirm-pulse 180ms var(--spring-effects-fast);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hba-status-success, #00702f) 28%, transparent) !important;
}
@keyframes hba-confirm-pulse {
  0% { transform: scale(0.985); }
  50% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

/* Rolling numeric ticker for filter counts & steppers */
.hba-roll-slot {
  display: inline-flex; align-items: baseline; overflow: hidden;
  font-variant-numeric: tabular-nums lining-nums; vertical-align: baseline;
}
.hba-roll-up { display: inline-block; animation: hba-roll-up-kf 140ms var(--spring-effects-fast) both; }
.hba-roll-down { display: inline-block; animation: hba-roll-down-kf 140ms var(--spring-effects-fast) both; }
@keyframes hba-roll-up-kf {
  from { opacity: 0.35; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes hba-roll-down-kf {
  from { opacity: 0.35; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tactile spring chip utility */
.hba-chip-spring {
  transition: transform 150ms var(--spring-spatial-fast), background-color 140ms ease, border-color 140ms ease, opacity 140ms ease;
}
.hba-chip-spring:active:not(:disabled) { transform: scale(0.95); }

/* Universal tactile button micro-press fallback */
.hba-pressable {
  transition: transform 160ms var(--spring-spatial-fast), background-color 140ms ease, opacity 140ms ease;
}
.hba-pressable:active:not(:disabled) { transform: scale(0.96); }

@media (prefers-reduced-motion: reduce) {
  .hba-shimmer::after,
  .skel i::after,
  .hba-wave-dots i,
  .hba-card-stagger,
  .hba-roll-up,
  .hba-roll-down,
  [data-err-recoil='true'],
  [data-haptic-confirm='true'],
  [data-haptic-detent='true'],
  [data-haptic-celebrate='true'] {
    animation: none;
  }
  .hba-pressable:active:not(:disabled),
  .hba-chip-spring:active:not(:disabled) {
    transform: none;
  }
}