/* The portrait layout represents a 20 ft by 44 ft pickleball court. */
.court-art {
  display: grid;
  place-items: center;
  position: relative;
  min-height: 570px;
  background: #163d2d;
  border-radius: 24px;
  overflow: hidden;
}

.court-art::before { content: none; }

.pickleball-court {
  position: relative;
  z-index: 1;
  height: 500px;
  aspect-ratio: 20 / 44;
  box-sizing: border-box;
  overflow: hidden;
  border: 4px solid #f1f5e9;
  background: #2a6849;
  box-shadow: 0 22px 36px rgba(0, 0, 0, .18);
}

.pickleball-court > div { position: absolute; }

.kitchen-zone {
  inset: 34.0909% 0;
  background: #3e805b;
}

.kitchen-line,
.service-centerline { background: #f1f5e9; }

.kitchen-line {
  left: 0;
  right: 0;
  height: 3px;
  transform: translateY(-50%);
}

.kitchen-line.top { top: 34.0909%; }
.kitchen-line.bottom { top: 65.9091%; }

.service-centerline {
  left: 50%;
  width: 3px;
  transform: translateX(-50%);
}

.service-centerline.top { top: 0; height: 34.0909%; }
.service-centerline.bottom { bottom: 0; height: 34.0909%; }

.net-line {
  left: -4px;
  right: -4px;
  top: 50%;
  height: 5px;
  transform: translateY(-50%);
  background: #d9f265;
  box-shadow: 0 3px 0 rgba(16, 32, 25, .4);
}

/* Animated Pickleball Rally Container */
.pickleball-court .court-ball {
  position: absolute;
  z-index: 10;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
  pointer-events: none;
  animation: pickleballRally 11.5s cubic-bezier(0.42, 0, 0.58, 1) infinite;
}

/* The Single 3D Ball */
.pickleball-court .court-ball::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #eeff82 28%, #d7fa55 60%, #9cb81f 100%);
  box-shadow:
    inset -2px -2px 4px rgba(18, 48, 28, 0.4),
    inset 1.5px 1.5px 3px rgba(255, 255, 255, 0.85);
  animation: ballBounceHeight 11.5s cubic-bezier(0.38, 0, 0.62, 1) infinite;
}

/* Ground Shadow (Soft, stays anchored directly under the ball) */
.pickleball-court .court-ball::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 7px;
  left: 3px;
  bottom: -3px;
  border-radius: 50%;
  background: rgba(10, 28, 18, 0.35);
  filter: blur(1.5px);
  animation: ballShadowPulse 11.5s cubic-bezier(0.38, 0, 0.62, 1) infinite;
}

/* 4-Shot Rally Trajectory */
@keyframes pickleballRally {
  /* Shot 1: Deep Crosscourt Drive from Bottom-Right to Top-Left */
  0% {
    left: 76%;
    top: 86%;
  }
  25% {
    left: 24%;
    top: 17%;
  }
  /* Shot 2: Return Drive Down-the-Line to Bottom-Left */
  50% {
    left: 25%;
    top: 84%;
  }
  /* Shot 3: Soft Dink into Top-Right Kitchen */
  75% {
    left: 72%;
    top: 40%;
  }
  /* Shot 4: Crosscourt Counter back to Bottom-Right */
  100% {
    left: 76%;
    top: 86%;
  }
}

/* Vertical Arc (Subtle, natural height above ground & bounce impact) */
@keyframes ballBounceHeight {
  /* Contact 1 (Bottom Right Baseline) */
  0% {
    transform: translateY(0) scale(1.08, 0.92);
  }
  3% {
    transform: translateY(-2px) scale(0.98, 1.02);
  }
  12.5% {
    transform: translateY(-14px) scale(1.14);
  }
  22% {
    transform: translateY(-2px) scale(0.99, 1.01);
  }

  /* Contact 2 (Top Left Service Box) */
  25% {
    transform: translateY(0) scale(1.08, 0.92);
  }
  28% {
    transform: translateY(-2px) scale(0.98, 1.02);
  }
  37.5% {
    transform: translateY(-13px) scale(1.12);
  }
  47% {
    transform: translateY(-2px) scale(0.99, 1.01);
  }

  /* Contact 3 (Bottom Left Baseline) */
  50% {
    transform: translateY(0) scale(1.08, 0.92);
  }
  53% {
    transform: translateY(-2px) scale(0.98, 1.02);
  }
  62.5% {
    transform: translateY(-9px) scale(1.08);
  }
  72% {
    transform: translateY(-2px) scale(0.99, 1.01);
  }

  /* Contact 4 (Top Right Kitchen) */
  75% {
    transform: translateY(0) scale(1.06, 0.94);
  }
  78% {
    transform: translateY(-2px) scale(0.98, 1.02);
  }
  87.5% {
    transform: translateY(-12px) scale(1.11);
  }
  97% {
    transform: translateY(-2px) scale(0.99, 1.01);
  }

  /* Loop Reset */
  100% {
    transform: translateY(0) scale(1.08, 0.92);
  }
}

/* Floor Shadow Pulse */
@keyframes ballShadowPulse {
  /* Bounce Ground Contacts */
  0%, 25%, 50%, 75%, 100% {
    transform: scale(1.12, 0.9);
    opacity: 0.42;
    filter: blur(1.2px);
  }
  /* Airborne Peaks */
  12.5%, 37.5%, 62.5%, 87.5% {
    transform: scale(0.72);
    opacity: 0.18;
    filter: blur(3px);
  }
}

@media (max-width: 900px) {
  .court-art { display: grid; min-height: 390px; }
  .pickleball-court { height: 340px; }
  .pickleball-court .court-ball { width: 18px; height: 18px; margin-left: -9px; margin-top: -9px; }
  .pickleball-court .court-ball::after { width: 14px; height: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .pickleball-court .court-ball,
  .pickleball-court .court-ball::before,
  .pickleball-court .court-ball::after {
    animation: none !important;
  }
  .pickleball-court .court-ball {
    left: 72%;
    top: 40%;
  }
}
