/* ============================================================================
   pack-open-pro.css — "Rip pack v4 PRO" (LAB ONLY for now: loaded by pack-lab.html, not by index.html).
   The opening is still NeonPackOpening (pack-open-neon.js / .css) with `pick`; when it gets the prop
   `fx` its root carries `.np-pro` and a director from pack-vfx.js paints light and particles on two
   canvases. This file is the other half: the CHOREOGRAPHY that changes (the pack's punch, the strip,
   the deal, the lift of a card that turns) and the DOM effects that step aside for the GPU ones.
   Durations keep the `calc(Xms * var(--np-k))` rule so the lab's speed slider scales them.
   ============================================================================ */

/* the two canvases of pack-vfx.js: under the pack and the cards / over them (and under the close button) */
.np-vfx { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.np-vfx-back { z-index: 0; }
.np-vfx-front { z-index: 40; }

/* DOM effects replaced by GPU ones: the flat white veils, the css ring, the css streaks and speed lines,
   the svg rays of the charge, the dom burst of the reveal, the hanging stars, the counter stars */
.np-pro .np-flash, .np-pro .np-burst, .np-pro .np-streaks, .np-pro .np-haze, .np-pro .np-laser-sparks,
.np-pro .np-lines, .np-pro .np-flare, .np-pro .np-climax-flash, .np-pro .np-energy-flash,
.np-pro .np-float-stars, .np-pro .np-burst-layer, .np-pro .np-coll-pop { display: none !important; }

/* ───────── the sealed pack: a glint crosses the wrapper now and then ─────────
   Masked by the pack art itself, so it only shines on the foil. It blends with the pack's own layers
   (the pseudo element lives inside `.np-pack`, which is its own group). Only while it rests. */
.np-pro .np-pack::after {
  content: ''; position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.10) 45%, rgba(255, 255, 255, 0.62) 50%, rgba(255, 255, 255, 0.10) 55%, transparent 60%) no-repeat;
  background-size: 260% 100%; background-position: 130% 0;
  -webkit-mask: var(--pack-src) center / 100% 100% no-repeat; mask: var(--pack-src) center / 100% 100% no-repeat;
  mix-blend-mode: screen; transition: opacity calc(160ms * var(--np-k)) ease;
}
.np-pro.np-ph-shelf .np-pack::after { opacity: 1; animation: npProSheen calc(3.8s * var(--np-k)) cubic-bezier(0.4, 0, 0.2, 1) calc(0.8s * var(--np-k)) infinite; }
@keyframes npProSheen { 0% { background-position: 130% 0; } 34%, 100% { background-position: -40% 0; } }

/* ───────── the pop: the pack takes the hit (squash, stretch, settle) on top of the camera move ─────────
   `scale` is its own property, so it composes with the `transform` transition of the phase (zoom + drop).
   The pack still goes STRAIGHT: no tilt. */
.np-pro.np-ph-pop .np-pack {
  animation: npProPunch calc(600ms * var(--np-k)) linear both;
  transition-timing-function: cubic-bezier(0.16, 1.12, 0.3, 1);
}
@keyframes npProPunch {
  0%   { scale: 1 1; }
  8%   { scale: 1.09 0.91; }
  24%  { scale: 0.95 1.075; }
  46%  { scale: 1.028 0.978; }
  70%  { scale: 0.994 1.007; }
  100% { scale: 1 1; }
}
/* the strip is FLICKED away: fast out of the hand, tumbling, gone before it lands */
.np-pro.np-ph-pop .np-strip { animation: npProStrip calc(560ms * var(--np-k)) cubic-bezier(0.2, 0.55, 0.45, 1) forwards; transform-origin: 72% 6%; }
@keyframes npProStrip {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(58%, -230%) rotate(74deg); opacity: 0; }
}

/* ───────── the deal: the five cards fly out of the light at the centre to their slots ─────────
   `--pdx / --pdy / --pdr` (from the slot to the centre of the screen, and a fan angle) are written by the
   director when the grid mounts. `backwards`, never `both`: once dealt the card must obey its normal rules
   again (gather / fly to the counter, the hover). */
.np-pro.np-pick .np-done-card:not(.gathering):not(.flying) {
  animation: npProDeal calc(560ms * var(--np-k)) calc((70ms + var(--i) * 85ms) * var(--np-k)) cubic-bezier(0.2, 0.8, 0.25, 1) backwards;
}
@keyframes npProDeal {
  0%   { transform: translate(var(--pdx, 0px), var(--pdy, 60px)) scale(0.5) rotate(var(--pdr, 0deg)); opacity: 0; }
  10%  { opacity: 1; }
  72%  { transform: translate(0, -1.5%) scale(1.045) rotate(0deg); }
  88%  { transform: translate(0, 0.6%) scale(0.99); }
  100% { transform: none; opacity: 1; }
}
.np-pro.np-pick .np-done h3 { animation: npProTitle calc(520ms * var(--np-k)) calc(640ms * var(--np-k)) cubic-bezier(0.34, 1.56, 0.64, 1) backwards; }
@keyframes npProTitle { from { transform: translateY(14px) scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
/* face down, they breathe (each one a beat apart); the rare-or-better ones keep their blue light on top */
.np-pro .np-pk-spread .np-done-card.np-pk-down .np-pk-back {
  animation: npProIdle calc(3.2s * var(--np-k)) ease-in-out calc(var(--i) * -0.55s) infinite alternate;
}
.np-pro .np-pk-spread .np-done-card.np-pk-down .np-pk-lit .np-pk-back {
  animation: npHalo calc(1.6s * var(--np-k)) ease-in-out infinite alternate,
             npProIdle calc(3.2s * var(--np-k)) ease-in-out calc(var(--i) * -0.55s) infinite alternate;
}
@keyframes npProIdle { from { translate: 0 0; } to { translate: 0 -5px; } }

/* ───────── a card turned in place: it LIFTS off the table while it turns, and lands ───────── */
.np-pro .np-pk.up:not(.inst) { animation: npProLift calc(500ms * var(--np-k)) cubic-bezier(0.2, 0.7, 0.3, 1) backwards; }
@keyframes npProLift {
  0%   { transform: none; }
  32%  { transform: translateY(-6%) scale(1.1); }
  68%  { transform: translateY(-1%) scale(1.035); }
  85%  { transform: scale(0.985); }
  100% { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .np-pro.np-ph-pop .np-pack, .np-pro .np-pk.up:not(.inst), .np-pro .np-pk-spread .np-done-card.np-pk-down .np-pk-back { animation: none; }
  .np-pro.np-ph-shelf .np-pack::after { animation: none; opacity: 0; }
}
