/* GPL-3.0: TreeT integration of Simon Goellner's Pokémon Cards CSS.
   Family styles below are unchanged upstream sources; see vendor/poke-holo/SOURCE.md.
   Keep material effects inside the existing rounded front face, not on the rotor. */
@import './vendor/poke-holo/v-full-art.css';
@import './vendor/poke-holo/rainbow-alt.css';
@import './vendor/poke-holo/v-star.css';
@import './vendor/poke-holo/secret-rare.css';
@import './vendor/poke-holo/trainer-gallery-holo.css';

#tilt-card[data-holo-style] {
  --card-radius: 4.55% / 3.5%;
  --sunpillar-1: hsl(2, 100%, 73%);
  --sunpillar-2: hsl(53, 100%, 69%);
  --sunpillar-3: hsl(93, 100%, 69%);
  --sunpillar-4: hsl(176, 100%, 76%);
  --sunpillar-5: hsl(228, 100%, 74%);
  --sunpillar-6: hsl(283, 100%, 73%);
  --sunpillar-clr-1: var(--sunpillar-1);
  --sunpillar-clr-2: var(--sunpillar-2);
  --sunpillar-clr-3: var(--sunpillar-3);
  --sunpillar-clr-4: var(--sunpillar-4);
  --sunpillar-clr-5: var(--sunpillar-5);
  --sunpillar-clr-6: var(--sunpillar-6);
  --space: 5%;
  --angle: 133deg;
  --imgsize: cover;
  --glittersize: 25%;
  --clip-borders: inset(2.8% 4% round 2.55% / 1.5%);
  --pointer-x: 50%;
  --pointer-y: 50%;
  --pointer-from-center: 0;
  --pointer-from-left: .5;
  --pointer-from-top: .5;
  --card-opacity: .2;
}
/* Replace the old coating, rather than stacking two different renderers. */
#tilt-card[data-holo-style] > .layer { display: none !important; }
.card__shine, .card__etch, .card__glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  overflow: hidden;
  transition: none;
}
.card__etch { display: none; }
.card__shine {
  display: grid;
  z-index: 3;
  background: transparent;
  background-size: cover;
  background-position: center;
  filter: brightness(.85) contrast(2.75) saturate(.65);
  mix-blend-mode: color-dodge;
  opacity: var(--card-opacity);
}
.card__shine::before, .card__shine::after {
  grid-area: 1 / 1;
  border-radius: inherit;
  --sunpillar-clr-1: var(--sunpillar-5);
  --sunpillar-clr-2: var(--sunpillar-6);
  --sunpillar-clr-3: var(--sunpillar-1);
  --sunpillar-clr-4: var(--sunpillar-2);
  --sunpillar-clr-5: var(--sunpillar-3);
  --sunpillar-clr-6: var(--sunpillar-4);
}
.card__shine::after {
  --sunpillar-clr-1: var(--sunpillar-6);
  --sunpillar-clr-2: var(--sunpillar-1);
  --sunpillar-clr-3: var(--sunpillar-2);
  --sunpillar-clr-4: var(--sunpillar-3);
  --sunpillar-clr-5: var(--sunpillar-4);
  --sunpillar-clr-6: var(--sunpillar-5);
}
.card__glare {
  z-index: 4;
  background-image: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y), #fffc 10%, #ffffffa6 20%, #0008 90%);
  opacity: var(--card-opacity);
  mix-blend-mode: overlay;
}
/* The supplied white plates are luminance maps (opaque black means no foil).
   Clip the completed shine once; masking each nested layer would square its falloff. */
#tilt-card[data-holo-style] > .card__shine {
  -webkit-mask-image: var(--mask);
  mask-image: var(--mask);
  mask-mode: luminance;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}
#tilt-card[data-holo-style] > .card__shine::before,
#tilt-card[data-holo-style] > .card__shine::after {
  -webkit-mask-image: none !important;
  mask-image: none !important;
}
/* Our VMAX etches are opaque black/white relief maps. Inside the reference
   shine they inherited its darkening filter and opacity (only .048 at rest).
   Composite the real relief directly over the artwork, below the glare. */
#tilt-card[data-holo-style="vmax-alt"] > .card__shine::before { content: none; }
#tilt-card[data-holo-style="vmax-alt"] > .card__etch {
  display: block;
  z-index: 3;
  /* Relief covers the Pokémon as well: the colour-foil white plate would
     incorrectly erase its etched silhouette. The etch itself excludes ink. */
  -webkit-mask-image: var(--foil);
  mask-image: var(--foil);
  mask-mode: luminance;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  background-image: radial-gradient(ellipse at var(--pointer-x) var(--pointer-y), #fff 0%, #d7e4f5 25%, #404b60 65%, #101826 100%);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  mix-blend-mode: hard-light;
  opacity: calc(.22 + var(--pointer-from-center) * .24);
}
/* The reference predates SV ex SIR. Use its full-art optics with each card's
   actual etched pattern, calibrated for the silver frame and brighter artwork. */
#tilt-card[data-holo-style="ex-special"] > .card__shine {
  filter: brightness(calc(var(--pointer-from-center) * .35 + .45)) contrast(1.5) saturate(1.65);
}
#tilt-card[data-holo-style="ex-special"] > .card__glare { opacity: calc(var(--card-opacity) * .5); }
@media (prefers-reduced-motion: reduce) {
  .card__shine, .card__etch, .card__glare, .card__shine::before, .card__shine::after { transition: none; animation: none; }
}
