/* HoloVault sample engine: holo card layers. World styles size and frame .holo; this file paints the foil.
   Cheap on purpose: gradients, opacity and blend modes on card-sized boxes only, no filters, no full-screen layers. */

.holo {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 50%;
  --posx: 50%;
  --posy: 50%;
  --hyp: 0;
  --pa: 0;
  position: relative;
  aspect-ratio: 63 / 88;
  border-radius: 4.6% / 3.3%;
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  will-change: transform;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  isolation: isolate;
  overflow: hidden;
  /* Depth follows the tilt: the shadow falls away from the raised edge. */
  --sx: 0px;
  --sy: 10px;
  box-shadow:
    var(--sx) var(--sy) 24px -8px rgb(0 0 0 / 0.45),
    0 2px 4px rgb(0 0 0 / 0.25);
}

.holo__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  pointer-events: none;
}

.holo__foil,
.holo__glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

/* Glare: every card catches the light, foil or not. */
.holo__glare {
  mix-blend-mode: overlay;
  opacity: calc(0.15 + var(--pa) * 0.75);
  background: radial-gradient(
    farthest-corner circle at var(--mx) var(--my),
    rgb(255 255 255 / 0.85) 8%,
    rgb(255 255 255 / 0.35) 24%,
    rgb(0 0 0 / 0.45) 90%
  );
}

.holo__foil {
  opacity: 0;
  mix-blend-mode: color-dodge;
  background-size: 260% 260%;
  background-position: var(--posx) var(--posy);
}

/* Rare holo: diagonal rainbow bands that slide with the angle. */
.holo[data-foil='holo'] .holo__foil {
  opacity: calc(0.18 + var(--pa) * 0.5);
  background-image: repeating-linear-gradient(
    115deg,
    hsl(2 90% 62%) 0%,
    hsl(48 95% 60%) 4%,
    hsl(110 80% 58%) 8%,
    hsl(186 90% 60%) 12%,
    hsl(232 85% 66%) 16%,
    hsl(290 80% 64%) 20%,
    hsl(2 90% 62%) 24%
  );
}

/* Reverse holo: the whole card shimmers in a softer, wider sweep. */
.holo[data-foil='reverse'] .holo__foil {
  opacity: calc(0.12 + var(--pa) * 0.35);
  background-image: linear-gradient(
    120deg,
    transparent 25%,
    hsl(190 90% 70% / 0.9) 42%,
    hsl(300 80% 75% / 0.9) 50%,
    hsl(48 95% 70% / 0.9) 58%,
    transparent 75%
  );
}

/* Secret and illustration rares: rainbow plus sparkle grain. */
.holo[data-foil='secret'] .holo__foil {
  opacity: calc(0.22 + var(--pa) * 0.55);
  background-image:
    var(--glitter),
    repeating-linear-gradient(
      125deg,
      hsl(330 90% 66%) 0%,
      hsl(40 95% 62%) 5%,
      hsl(150 80% 58%) 10%,
      hsl(210 90% 64%) 15%,
      hsl(275 85% 66%) 20%,
      hsl(330 90% 66%) 25%
    );
  background-size: 160px 160px, 240% 240%;
  background-position: calc(var(--posx) * 2) calc(var(--posy) * 2), var(--posx) var(--posy);
}

/* Magic foil: oil-slick sheen across the whole card. */
.holo[data-foil='foil'] .holo__foil {
  opacity: calc(0.2 + var(--pa) * 0.45);
  background-image: linear-gradient(
    105deg,
    hsl(320 70% 60%) 0%,
    hsl(200 80% 60%) 18%,
    hsl(90 70% 58%) 34%,
    hsl(45 90% 60%) 50%,
    hsl(320 70% 60%) 66%,
    hsl(200 80% 60%) 82%,
    hsl(90 70% 58%) 100%
  );
}

@media (prefers-reduced-motion: reduce) {
  .holo {
    transform: none;
  }
  .holo__foil {
    opacity: 0.25 !important;
  }
}
