/* ==========================================================================
   n3-pack.css — "Why us" booster pack · Nocturne III · component pk
   A sealed holo booster pack shakes on a lit table; open it and six cards fly out into the grid.

   Stacking (inside .pk-stage, which isolates):  table 0 · cards rising out of the pack 2 · pack layers 3 ·
   CTA 5 · cards in flight 6 · flash 7 · sparks 8.
   Nothing between .pk-stage and the pack layers / cards may create a stacking context (no transform,
   opacity, filter or z-index on .pk-field / .pk-ov / .pk-packs / .pk-pack / .pk-grid), so a card can rise out
   from behind the pack's front face.
   Pack internals are sized in "pack ems": .pk-pack { font-size: 1% of its width }.
   ========================================================================== */

.pk-stage {
  --pk-base: clamp(214px, 20vw, 292px);
  --pk-e: cubic-bezier(.2, .7, .2, 1);
  position: relative; isolation: isolate;
}
.pk-field { position: relative; overflow-x: clip; }   /* clip, not hidden: no scroll box, no stacking context */

/* ---------------------------------------------------------------- the six cards */
.pk-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.pk-card { position: relative; display: flex; min-width: 0; outline: none; transition: translate .45s var(--pk-e); }
.pk-card:focus-visible { outline: 2px solid #BFA9FF; outline-offset: 4px; border-radius: 2px; }
.pk-face { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 20px 22px 26px; }
.pk-cardtop {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font: 500 11px/1.2 var(--f-mono, monospace); letter-spacing: .14em; text-transform: uppercase; color: #6E6A80;
}
.pk-cat { display: inline-flex; align-items: center; gap: 9px; color: #2B2838; }
.pk-cat::before { content: ""; width: 6px; height: 6px; flex: none; background: var(--pk-acc, #FF2FBF); box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.pk-art {
  position: relative; margin-top: 16px; aspect-ratio: 4 / 3; overflow: hidden;
  background: radial-gradient(70% 46% at 50% 94%, rgba(126, 72, 236, .26), rgba(126, 72, 236, 0) 72%), #0B0A1C;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.pk-art::before {   /* a very faint pixel grid */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(196, 186, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(196, 186, 255, .05) 1px, transparent 1px);
  background-size: 12px 12px; background-position: center center;
  -webkit-mask-image: radial-gradient(90% 80% at 50% 50%, #000 30%, transparent 100%); mask-image: radial-gradient(90% 80% at 50% 50%, #000 30%, transparent 100%);
}
.pk-art::after {    /* corner ticks, HUD style */
  content: ""; position: absolute; inset: 10px; pointer-events: none; opacity: .5;
  background:
    linear-gradient(#8E86C8, #8E86C8) right top / 8px 1px no-repeat, linear-gradient(#8E86C8, #8E86C8) right top / 1px 8px no-repeat,
    linear-gradient(#8E86C8, #8E86C8) left bottom / 8px 1px no-repeat, linear-gradient(#8E86C8, #8E86C8) left bottom / 1px 8px no-repeat;
}
.pk-ico { position: absolute; left: 5%; top: 5%; width: 90%; height: 90%; }
.pk-title { margin: 20px 0 8px; font: 600 23px/1.15 var(--f-head, sans-serif); letter-spacing: -.038em; color: #141220; }
.pk-text { font: 400 15px/1.6 var(--f-body, sans-serif); color: #625E75; }
.pk-stage[data-pk="open"] .pk-card:hover { translate: 0 -4px; }

/* ---------------------------------------------------------------- stage + states */
.pk-ov {
  position: absolute; inset: 0; z-index: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px;
  pointer-events: none;
}
.pk-packs { position: relative; display: grid; place-items: center; }
.pk-table { position: absolute; inset: 0; pointer-events: none; --pk-tw: var(--pk-base); }
.pk-table > span { position: absolute; left: 50%; bottom: 0; display: block; pointer-events: none; }
.pk-floor {   /* a pixel floor in perspective, centred on the pack's base */
  width: calc(var(--pk-tw) * 2.6); height: calc(var(--pk-tw) * 1.8); margin: 0 0 calc(var(--pk-tw) * -.9) calc(var(--pk-tw) * -1.3);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' shape-rendering='crispEdges'%3E%3Crect width='2' height='2' fill='%23C4B6FF'/%3E%3C/svg%3E") center center / 20px 20px;
  opacity: .62; transform: perspective(560px) rotateX(71deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 0%, rgba(0, 0, 0, .7) 30%, rgba(0, 0, 0, .25) 58%, transparent 80%); mask-image: radial-gradient(closest-side, #000 0%, rgba(0, 0, 0, .7) 30%, rgba(0, 0, 0, .25) 58%, transparent 80%);
}
.pk-table > .pk-glow {   /* the soft violet glow around the pack */
  bottom: auto; top: 46%; width: calc(var(--pk-tw) * 3.6); height: calc(var(--pk-tw) * 3.2); margin: calc(var(--pk-tw) * -1.6) 0 0 calc(var(--pk-tw) * -1.8); border-radius: 50%;
  background:
    radial-gradient(closest-side, rgba(155, 82, 245, calc(.26 + var(--pk-c, 0) * .2)), rgba(155, 82, 245, .08) 55%, rgba(155, 82, 245, 0) 100%),
    radial-gradient(closest-side, rgba(255, 70, 190, calc(.06 + var(--pk-c, 0) * .18)), rgba(255, 70, 190, 0) 60%);
}
.pk-pool {    /* the pool of light the pack stands in */
  width: calc(var(--pk-tw) * 2.2); height: calc(var(--pk-tw) * .58); margin: 0 0 calc(var(--pk-tw) * -.29) calc(var(--pk-tw) * -1.1); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(176, 110, 255, calc(.3 + var(--pk-c, 0) * .3)), rgba(255, 80, 200, calc(.1 + var(--pk-c, 0) * .14)) 46%, rgba(120, 70, 230, 0) 100%);
}
.pk-ring {    /* a fine HUD ring on the floor, with four registration pixels */
  width: calc(var(--pk-tw) * 1.5); height: calc(var(--pk-tw) * .32); margin: 0 0 calc(var(--pk-tw) * -.16) calc(var(--pk-tw) * -.75); border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(196, 180, 255, calc(.16 + var(--pk-c, 0) * .3));
  background:
    linear-gradient(#45CAFF, #45CAFF) left 0 top 50% / 5px 5px no-repeat, linear-gradient(#FF2FBF, #FF2FBF) right 0 top 50% / 5px 5px no-repeat,
    linear-gradient(rgba(196, 180, 255, .5), rgba(196, 180, 255, .5)) 50% 0 / 3px 3px no-repeat, linear-gradient(rgba(196, 180, 255, .5), rgba(196, 180, 255, .5)) 50% 100% / 3px 3px no-repeat;
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 30%, transparent 40%, transparent 60%, #000 70%, #000 100%); mask-image: linear-gradient(90deg, #000 0, #000 30%, transparent 40%, transparent 60%, #000 70%, #000 100%);
}
.pk-after { display: flex; justify-content: center; padding-top: 36px; }
.pk-reseal {
  display: inline-flex; align-items: center; gap: 12px; padding: 11px 0 10px; border-bottom: 1px solid currentColor;
  font: 500 12px/1 var(--f-mono, monospace); letter-spacing: .03em; color: var(--muted, #A9A7C0); transition: color .25s, gap .3s var(--pk-e);
}
.pk-reseal::before { content: ""; width: 7px; height: 7px; background: currentColor; box-shadow: 9px 0 0 #FF2FBF; margin-right: 9px; }
.pk-reseal:hover { color: var(--fg, #F1F0FA); }
.pk-reseal:focus-visible { outline: 2px solid #BFA9FF; outline-offset: 4px; }

.pk-fx { position: absolute; left: 0; top: 0; z-index: 8; pointer-events: none; image-rendering: pixelated; }
.pk-flash {
  position: absolute; left: 0; top: 0; z-index: 7; width: 460px; height: 460px; margin: -230px 0 0 -230px; border-radius: 50%;
  pointer-events: none; opacity: 0; visibility: hidden;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .95), rgba(255, 214, 244, .55) 22%, rgba(214, 120, 255, .22) 50%, rgba(120, 90, 255, 0) 100%);
}

/* no JS: the cards are simply there */
.pk-stage:not([data-pk]) .pk-ov, .pk-stage:not([data-pk]) .pk-after, .pk-stage:not([data-pk]) .pk-fx, .pk-stage:not([data-pk]) .pk-flash { display: none; }
/* sealed: the grid keeps its height (no jump on open) but is not there yet */
.pk-stage[data-pk="sealed"] .pk-grid { visibility: hidden; }
.pk-stage[data-pk="sealed"] .pk-ico { display: none; }
.pk-stage[data-pk="opening"] .pk-card { visibility: hidden; }
.pk-stage[data-pk="open"] .pk-ov { display: none; }
.pk-stage:not([data-pk="open"]) .pk-after { visibility: hidden; }

/* ---------------------------------------------------------------- the pack */
.pk-pack {
  --pk-w: var(--pk-base);
  position: relative; display: block; width: var(--pk-w); padding: 0; font-size: calc(var(--pk-w) / 100);
  pointer-events: auto; cursor: pointer; touch-action: manipulation; text-align: left; color: #F4F2FF;
  -webkit-tap-highlight-color: transparent;
}
.pk-pack:focus-visible { outline: 2px solid #BFA9FF; outline-offset: 4px; border-radius: 3px; }
.pk-layer {
  position: absolute; inset: 0; z-index: 3; display: block; pointer-events: none;
  transform: perspective(1100px) translate3d(var(--pk-x, 0px), var(--pk-y, 0px), 0)
             translateY(50%) rotate(var(--pk-r, 0deg)) scale(var(--pk-sx, 1), var(--pk-sy, 1)) translateY(-50%)
             rotateX(var(--pk-rx, 0deg)) rotateY(var(--pk-ry, 0deg)) scale(var(--pk-s, 1));
  opacity: var(--pk-o, 1);
}
.pk-layer > * { position: absolute; display: block; }
.pk-shadow {
  position: absolute; left: 12%; right: 12%; bottom: -5em; height: 10em; z-index: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .86), rgba(4, 2, 16, .55) 48%, rgba(4, 2, 16, 0) 100%);
  transform: translateX(var(--pk-x, 0px)) scale(var(--pk-sh, 1)); opacity: var(--pk-o, 1);
}
.pk-sheen {   /* moving sheen under the pointer */
  inset: 0; pointer-events: none; mix-blend-mode: soft-light;
  background: linear-gradient(112deg, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, .85) 50%, rgba(255, 255, 255, 0) 62%) var(--pk-px, 50%) var(--pk-py, 50%) / 200% 200% no-repeat;
  opacity: calc(.08 + var(--pk-hov, 0) * .8);
}

/* ---------------------------------------------------------------- the holo booster */
.pk-holo { height: 146em; }
.pk-holo canvas { position: absolute; display: block; }
.pk-holo-tear { transform-origin: 100% 100%; }
.pk-holo-tear canvas { left: 0; top: 0; }
.pk-holo-perf {
  left: 2.6em; right: 2.6em; top: var(--pk-tear, 11em); height: 2px; margin-top: -1px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .82) 0 1.7em, rgba(255, 255, 255, 0) 1.7em 2.9em);
}
.pk-holo-label {
  left: 11em; right: 11em; top: calc(50% + 3em); translate: 0 -50%; isolation: isolate;
  display: flex; flex-direction: column; align-items: center; gap: 5.6em; padding: 8.4em 3em 8em; text-align: center;
  background: linear-gradient(135deg, rgba(166, 201, 255, .75), rgba(185, 155, 242, .45) 50%, rgba(241, 160, 209, .75));
  clip-path: polygon(5em 0, 100% 0, 100% calc(100% - 5em), calc(100% - 5em) 100%, 0 100%, 0 5em);
}
.pk-holo-label::before {
  content: ""; position: absolute; inset: 1px; z-index: -1;
  background: radial-gradient(120% 80% at 50% 0%, rgba(60, 40, 120, .55), rgba(60, 40, 120, 0) 70%), linear-gradient(180deg, rgba(19, 16, 44, .95), rgba(10, 8, 26, .96));
  clip-path: polygon(calc(5em - .6px) 0, 100% 0, 100% calc(100% - 5em + .6px), calc(100% - 5em + .6px) 100%, 0 100%, 0 calc(5em - .6px));
}
/* "Tap to open": a chunky, friendly pixel face (Pixelify Sans) with a hard 8-bit drop shadow,
   over four little mana cubes that hop in turn, each with a light pool that shrinks as it jumps */
.pk-holo-tap {
  font: 700 9.6em/1 "Pixelify Sans", "Geist Pixel", var(--f-mono, monospace); letter-spacing: .015em; white-space: nowrap; color: #FFFFFF;
  text-shadow: 0 .1em 0 #6A3BD6, 0 .1em .5em rgba(155, 72, 224, .55), 0 0 .6em rgba(185, 155, 242, .45);
}
.pk-holo-tap > span { display: inline-block; }
.pk-cubes { display: flex; justify-content: center; align-items: flex-end; gap: 2.8em; height: 4.6em; margin-bottom: 1.2em; }
.pk-cubes i {
  --c: #2F5BFF; --hi: #8FA6FF; --sh: #1B2E9C; --gl: rgba(47, 91, 255, .7);
  position: relative; display: block; width: 4.6em; height: 4.6em;
}
.pk-cubes i:nth-child(2) { --c: #9B48E0; --hi: #C38BF0; --sh: #5B2A93; --gl: rgba(155, 72, 224, .7); }
.pk-cubes i:nth-child(3) { --c: #FF2FBF; --hi: #FF8ADB; --sh: #A81C80; --gl: rgba(255, 47, 191, .7); }
.pk-cubes i:nth-child(4) { --c: #45CAFF; --hi: #A9E8FF; --sh: #1F6FB8; --gl: rgba(69, 202, 255, .7); }
.pk-cubes i::before {   /* the cube: a lit top and a shaded side make each pixel read as a tiny voxel */
  content: ""; position: absolute; inset: 0; z-index: 1; transform-origin: 50% 100%;
  background: var(--c); box-shadow: inset 0 .85em 0 var(--hi), inset -.85em 0 0 var(--sh), 0 0 1.6em -.3em var(--c);
}
.pk-cubes i::after {    /* its little pool of light on the label floor */
  content: ""; position: absolute; left: -.9em; right: -.9em; bottom: -1.5em; height: 1.7em;
  background: radial-gradient(closest-side, var(--gl), rgba(0, 0, 0, 0));
}
@media (prefers-reduced-motion: no-preference) {
  html:not(.af-paused) .pk-cubes i::before { animation: pk-hop 1.9s infinite both; animation-delay: calc(var(--i) * .13s); }
  html:not(.af-paused) .pk-cubes i::after { animation: pk-pool 1.9s infinite both; animation-delay: calc(var(--i) * .13s); }
  html:not(.af-paused) .pk-pack:is(:hover, :focus-visible) .pk-holo-tap > span { animation: pk-wave 1.5s steps(1, end) infinite; animation-delay: calc(var(--i) * .05s); }
}
@keyframes pk-hop {
  0%, 46%, 100% { transform: none; animation-timing-function: ease-in-out; }
  7%  { transform: scale(1.14, .82); animation-timing-function: cubic-bezier(.2, .8, .35, 1); }    /* crouch */
  20% { transform: translateY(-2.6em) scale(.9, 1.12); animation-timing-function: cubic-bezier(.6, 0, .85, .45); }  /* up, stretched */
  31% { transform: scale(1.16, .8); animation-timing-function: ease-out; }                           /* land, squashed */
  39% { transform: scale(.95, 1.06); animation-timing-function: ease-in-out; }                       /* settle */
}
@keyframes pk-pool {
  0%, 46%, 100% { transform: none; opacity: 1; animation-timing-function: ease-in-out; }
  7%  { transform: scaleX(1.12); opacity: 1; animation-timing-function: cubic-bezier(.2, .8, .35, 1); }
  20% { transform: scale(.5, .7); opacity: .45; animation-timing-function: cubic-bezier(.6, 0, .85, .45); }
  31% { transform: scaleX(1.2); opacity: 1; animation-timing-function: ease-out; }
}
@keyframes pk-wave {   /* 8-bit wave: whole steps only, so the pixel letters stay crisp */
  0%, 30%, 100% { transform: none; }
  8%  { transform: translateY(-.14em); }
  16% { transform: translateY(-.05em); }
}

/* ---------------------------------------------------------------- motion off */
.af-paused .pk-card, .af-paused .pk-reseal { transition: none; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1099.98px) {
  .pk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
}
@media (max-width: 639.98px) {
  .pk-stage { --pk-base: 200px; }
  .pk-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .pk-face { padding: 18px 18px 24px; }
  .pk-title { font-size: 22px; margin-top: 18px; }
  /* phones: no reserved height — the pack sits in flow, the cards replace it when it opens */
  .pk-ov { position: relative; inset: auto; padding: 46px 0 8px; gap: 46px; }
  .pk-stage:not(.pk-rev):not(.pk-pre) .pk-grid, .pk-stage:not(.pk-rev) .pk-after { display: none; }
  .pk-stage.pk-rev .pk-ov { display: none; }
  .pk-table { --pk-tw: calc(var(--pk-base) * .8); }
}
