/* ═══════════════════════════════════════════════════════════════════════════
   PRC Foil Adapter — bridges pokemon-cards-css onto .karte-item structure
   Mirrors the Admin Menu's <PokemonRarityCard> component:
     .card.interactive
       .card__translater
         .card__rotator
           .card__front  ← contains the artwork <img>
           .card__shine  ← foil overlay (mix-blend-mode: color-dodge against front)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── 1. Neutralize the library's aspect-ratio (0.718) on EVERY PRC element ─── */
/* The library forces aspect-ratio on .card, .card__rotator, and ALL descendants
   (.card__rotator > *). On a 5:7 .karte-item, that shrinks the rendered card. */
.karte-item .prc-overlay,
.karte-item .prc-overlay * {
  aspect-ratio: auto !important;
}

/* ─── 2. Overlay positioning: cover the whole .karte-item ─── */
.karte-item .prc-overlay.card {
  position: absolute !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  z-index: 6;
  pointer-events: none;
  /* Idle state defaults — initCardFoil() overrides via setProperty on hover */
  --pointer-x: 50%;
  --pointer-y: 50%;
  --background-x: 50%;
  --background-y: 50%;
  --pointer-from-left: 0.5;
  --pointer-from-top: 0.5;
  --pointer-from-center: 0.5;
  --card-opacity: 0;
  --card-scale: 1;
  --translate-x: 0px;
  --translate-y: 0px;
  --rotate-x: 0deg;
  --rotate-y: 0deg;
}

/* ─── 3. translater/rotator: fill the .prc-overlay exactly ─── */
.karte-item .prc-overlay.card .card__translater,
.karte-item .prc-overlay.card .card__rotator {
  position: absolute !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
}

/* ─── 4. Grid children (front + shine) — override library's `width:100%` rule that
       only sets width, leaving height to be derived from aspect-ratio ─── */
.karte-item .prc-overlay.card .card__rotator > *,
.karte-item .prc-overlay .card__front,
.karte-item .prc-overlay .card__shine {
  width: 100% !important;
  height: 100% !important;
  /* keep grid-area: 1/1 so front+shine overlap exactly (library default) */
}

/* ─── 5. .card__front contains the artwork — visible & transparent bg ─── */
.karte-item .prc-overlay .card__front {
  visibility: visible !important;
  background: transparent !important;
  overflow: hidden;
}

/* The artwork image inside .card__front (default: cover the front) */
.karte-item .prc-overlay .card__front .prc-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}

/* Pixel-Art-Detection auto-applies the .pixel-art class via JS */
.karte-item .prc-overlay .card__front .prc-art.pixel-art {
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  padding: 6px;
}

/* ─── 6. Suppress library's hover-shadow on the rotator ─── */
.karte-item .prc-overlay.card .card__rotator,
.karte-item .prc-overlay.card.active .card__rotator,
.karte-item .prc-overlay.card .card__rotator:focus {
  box-shadow: none !important;
}

/* ─── 7. Hide the original .karte-art image (we render it inside .card__front now) ─── */
.karte-item[data-foil^="prc-"] .karte-art .karte-img {
  visibility: hidden;
}

/* ─── 8. Suppress default .foil-layer rainbow gradient on PRC cards ─── */
.karte-item[data-foil^="prc-"] > .foil-layer,
.karte-item[data-foil^="prc-"] > .foil-layer-b,
.karte-item[data-foil^="prc-"] > .foil-layer-c,
.karte-item[data-foil^="prc-"] > .foil-shine,
.karte-item[data-foil^="prc-"] > .foil-sparkles {
  display: none;
}

/* ─── 9. Lift .karte-bottom + tooltip above the PRC overlay ─── */
.karte-item[data-foil^="prc-"] .karte-bottom {
  position: relative;
  z-index: 10;
}
.karte-item[data-foil^="prc-"] .karte-tooltip {
  z-index: 30;
}

/* ─── 10. Disable Pokemon-card-window clip-path / mask-image on free-form sprites ───
   The library's holo/reverse-holo/vstar/etc. effects use `clip-path: var(--clip)` to
   restrict the shine to the artwork "window" of an actual Pokemon card layout.
   Our cards are free-form sprites, so let the effect cover the whole card area. */
.karte-item .prc-overlay .card__shine,
.karte-item .prc-overlay .card__shine::before,
.karte-item .prc-overlay .card__shine::after,
.karte-item .prc-overlay .card__glare,
.karte-item .prc-overlay .card__glare::before,
.karte-item .prc-overlay .card__glare::after {
  clip-path: none !important;
  -webkit-clip-path: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}
