/* ============================================================
   Blackjack Strategy Trainer — Table Feel Enhancements v2
   Pure motion/feel polish. No color, font, or layout changes.
   ============================================================ */

/* ---------- 1. Face-up cards deal in (initial two cards) ----------
   .playing-card mounts fresh per card, so entrance animations fire.
   Targets only the initial deal — hit cards (.hit-deal) and recap
   cards (.card-flat) keep their existing behavior. */
.playing-card:not(.hit-deal):not(.card-flat) {
  animation: cardDealIn 0.55s cubic-bezier(0.22, 1.2, 0.36, 1) backwards;
  /* stagger matches the existing --deal-i convention */
  animation-delay: calc(var(--deal-i, 0) * 0.12s);
}

@keyframes cardDealIn {
  0% {
    opacity: 0;
    transform: translateY(-90px) rotate(-12deg) scale(0.85);
  }
  60% {
    opacity: 1;
    transform: translateY(6px) rotate(2deg) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(var(--tilt, 0deg)) scale(1);
  }
}

/* ---------- 2. Hole-card reveal: real 3D flip ----------
   The holeReveal keyframe shipped as an empty stub. This gives the
   dealer hole card a proper flip when it turns over. */
@keyframes holeReveal {
  0%   { transform: perspective(600px) rotateY(0deg) scale(1); }
  45%  { transform: perspective(600px) rotateY(90deg) scale(1.06); }
  55%  { transform: perspective(600px) rotateY(90deg) scale(1.06); }
  100% { transform: perspective(600px) rotateY(0deg) scale(1); }
}

.hand-fan .playing-card.hole-flip {
  animation: holeReveal 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

/* ---------- 3. Tactile buttons ----------
   Physical press feel on every table action button. */
.table-actions button {
  transition: transform 0.08s ease-out, filter 0.12s ease-out, box-shadow 0.12s ease-out;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.table-actions button:active:not(:disabled) {
  transform: scale(0.93);
  filter: brightness(1.18);
}

.table-actions button:not(:disabled):hover {
  filter: brightness(1.08);
}

.table-actions button:disabled {
  transition: opacity 0.2s ease-out, filter 0.2s ease-out;
}

/* ---------- 4. Chips: weight on tap ----------
   Betting chips dip when pressed, settle when released. */
.table-chips .chip {
  transition: transform 0.1s ease-out, filter 0.12s ease-out;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.table-chips .chip:active {
  transform: translateY(3px) scale(0.94);
  filter: brightness(1.25);
}

/* ---------- 5. Result panel: softer landing ----------
   Ease the existing pop with a slight overshoot settle. */
.result-pop {
  animation: resultSettle 0.42s cubic-bezier(0.22, 1.25, 0.36, 1) backwards;
}

@keyframes resultSettle {
  0%   { opacity: 0; transform: translateY(18px) scale(0.94); }
  60%  { opacity: 1; transform: translateY(-3px) scale(1.012); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 6. Card hover lift (player cards) ----------
   Subtle lift on the player's cards — desktop/trackpad only,
   never interferes with touch. */
@media (hover: hover) and (pointer: fine) {
  .seat-live .hand-fan .playing-card {
    transition: translate 0.16s ease-out, box-shadow 0.16s ease-out;
  }
  .seat-live .hand-fan .playing-card:hover {
    translate: 0 -8px;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45);
  }
}

/* ---------- 7. Smoother seat transitions ----------
   Active seat ring fades instead of snapping. */
.seat {
  transition: box-shadow 0.25s ease-out, border-color 0.25s ease-out;
}

/* ---------- 8. Reduced motion: respect the user ----------
   All enhancement animations collapse to instant under
   prefers-reduced-motion. */
@media (prefers-reduced-motion: reduce) {
  .playing-card:not(.hit-deal):not(.card-flat),
  .hand-fan .playing-card.hole-flip,
  .result-pop {
    animation-duration: 0.01s !important;
    animation-delay: 0s !important;
  }
  .table-actions button,
  .table-chips .chip,
  .seat {
    transition-duration: 0.01s !important;
  }
}
