/**
 * RS Cricket Institute - Interactive Cricket Player Character Animation
 * Features:
 * - Animated cricket fielder running across the field
 * - Bends down and fields/picks up the cricket ball
 * - Locks on and throws the ball directly towards the user's mouse cursor
 * - 3D parabolic ball flight, realistic bounce physics, and continuous loop
 * - Only ONE single cricket ball (#rsGlobalInteractiveBall) active on the site
 *
 * @package rscricket
 */

/* ========================================================
   1. OVERLAY CANVAS & CONTAINER
   ======================================================== */
.rs-cricketer-field-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9998;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ========================================================
   2. CRICKET PLAYER CHARACTER
   ======================================================== */
.rs-cricketer-character {
  position: absolute;
  top: 0;
  left: 0;
  width: 84px;
  height: 126px;
  will-change: transform;
  pointer-events: auto !important;
  cursor: pointer !important;
  transform-origin: 42px 118px; /* Origin at ground between feet */
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.28));
  transition: filter 0.25s ease;
  outline: none;
}

.rs-cricketer-character:hover,
.rs-cricketer-character:focus-visible {
  filter: drop-shadow(0 8px 18px rgba(222, 170, 47, 0.6));
}

body.cursor-bat-active .rs-cricketer-character,
body.cursor-bat-active .rs-cricketer-character * {
  cursor: pointer !important;
}

.rs-cricketer-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  display: block;
}

/* Ground Shadows */
.rs-cricketer-shadow {
  transform-origin: 42px 118px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

/* Articulated Body Groups */
.cricketer-torso-wrap {
  transform-origin: 42px 68px;
  will-change: transform;
}

.cricketer-head-wrap {
  transform-origin: 42px 38px;
  will-change: transform;
}

.cricketer-left-arm {
  transform-origin: 32px 48px;
  will-change: transform;
}

.cricketer-right-arm {
  transform-origin: 52px 48px;
  will-change: transform;
}

.cricketer-left-leg {
  transform-origin: 35px 75px;
  will-change: transform;
}

.cricketer-right-leg {
  transform-origin: 49px 75px;
  will-change: transform;
}

/* Ball in Hand (held by player) */
.cricketer-held-ball {
  transform-origin: center center;
  transition: opacity 0.1s ease;
}

/* ========================================================
   3. DUST & TURF PARTICLES (ON RUN & IMPACT)
   ======================================================== */
.rs-cricket-dust-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(222, 170, 47, 0.75) 0%, rgba(184, 134, 11, 0) 70%);
  pointer-events: none;
  will-change: transform, opacity;
  animation: rsDustFadeOut 0.45s ease-out forwards;
}

@keyframes rsDustFadeOut {
  0% {
    transform: scale(0.6) translateY(0);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.6) translateY(-14px);
    opacity: 0;
  }
}

/* ========================================================
   4. RESPONSIVE ADJUSTMENTS
   ======================================================== */
@media (max-width: 768px) {
  .rs-cricketer-character {
    width: 68px;
    height: 102px;
    transform-origin: 34px 96px;
  }
}
