/* Material refinements for SV / Mega Evolution printings. The diffraction
   stack follows pokemon-cards-css (Simon Goellner, GPL-3.0; see NOTICE.md).
   Texture stays registered to the card; only the illumination moves. */

/* Double Rare: continuous illumination, with no repeating reflection bands.
   Preserve the SVG tile ratio: forcing 34% x 34% letterboxes its viewBox,
   producing horizontal gaps between rows of foil. */
body.fx-holo.fx-holo.fx-holo .tcg.foil-ex .foil {
  background-image: url("/assets/foil/ex-stars.svg"),
    linear-gradient(115deg, #e3a2c2 0%, #b7a7d9 22%, #93c6de 43%,
      #a2d4bd 65%, #dfcda0 83%, #e3a2c2 100%),
    radial-gradient(ellipse at var(--pointer-x) var(--pointer-y),
      #72818c 0%, #46515e 35%, #202936 68%, #111823 100%);
  background-size: 34% auto, 180% 180%, cover;
  background-position: center, var(--background-x) var(--background-y), center;
  background-repeat: repeat, no-repeat, no-repeat;
  background-blend-mode: screen, hue;
  mix-blend-mode: color-dodge;
  filter: brightness(.55) contrast(1.2) saturate(1.15);
  opacity: calc((.14 + var(--card-opacity) * .38) * var(--foil-strength,1));
}
body.fx-holo.fx-holo.fx-holo .tcg.foil-ex .foil::before {
  background: url("/assets/foil/ex-stars.svg") center / 34% auto;
  mix-blend-mode: screen;
  filter: brightness(.8);
  opacity: .35;
}
body.fx-holo.fx-holo.fx-holo .tcg.foil-ex .foil::after {
  background-image: var(--holo-glitter),
    radial-gradient(ellipse at var(--pointer-x) var(--pointer-y),#999 0%,#333 40%,#000 80%);
  background-size: 130px 130px, cover;
  background-position: center;
  background-blend-mode: multiply;
  mix-blend-mode: screen;
  filter: brightness(1.1) contrast(1.7);
  opacity: .32;
}

/* SIR: directional diffraction and fine surface grain. A dark trough between
   light bands preserves the painting's contrast instead of bleaching it. */
body.fx-holo.fx-holo.fx-holo .tcg.foil-sir .foil {
  background-image: var(--holo-embossed),
    repeating-linear-gradient(105deg, #ed879a 0%, #ecd693 12%, #88d6bc 24%,
      #83b4e7 36%, #be92df 48%, #ed879a 60%),
    repeating-linear-gradient(135deg, #101422 0%, #809795 9%, #dae9e4 12%,
      #809795 15%, #101422 26%),
    radial-gradient(ellipse at var(--pointer-x) var(--pointer-y), #bbb 0%, #666 38%, #171b27 95%);
  background-size: 65% 35%, 300% 300%, 350% 350%, cover;
  background-position: center, var(--background-x) var(--background-y),
    calc(100% - var(--background-x)) calc(100% - var(--background-y)), center;
  background-blend-mode: soft-light, color, luminosity;
  filter: brightness(0.65) contrast(1.7) saturate(1.3);
  mix-blend-mode: color-dodge;
}
body.fx-holo.fx-holo.fx-holo .tcg.foil-sir .foil::before {
  background-image: var(--holo-glitter),
    radial-gradient(ellipse at var(--pointer-x) var(--pointer-y), #ddd, #000 70%);
  background-size: 35% 35%, cover;
  background-position: center;
  background-blend-mode: multiply;
  mix-blend-mode: screen;
  filter: contrast(2.5) brightness(0.7);
  opacity: 0.35;
}
body.fx-holo.fx-holo.fx-holo .tcg.foil-sir .foil::after {
  background-image: linear-gradient(125deg, #000 15%, #799cb1 40%, #dad4ec 48%, #7299a4 56%, #000 80%);
  background-size: 300% 300%;
  background-position: calc(100% - var(--background-x)) calc(100% - var(--background-y));
  mix-blend-mode: screen;
  filter: none;
  opacity: 0.3;
}

/* Pearl and red lacquer need both light AND shadow. Brightening-only blend
   modes disappear on Reshiram's nearly white scan. */
body.fx-holo.fx-holo.fx-holo .tcg[data-finish="pearl"] .foil,
body.fx-holo.fx-holo.fx-holo .tcg[data-finish="ruby"] .foil {
  background-image: var(--holo-metal),
    linear-gradient(120deg, #303746 0%, #829092 27%, #dce0dc 40%,
      #fff 48%, #b9b9c4 55%, #788389 66%, #303746 100%);
  background-size: 35% 35%, 300% 300%;
  background-position: center, var(--background-x) var(--background-y);
  background-blend-mode: soft-light;
  mix-blend-mode: multiply;
  filter: contrast(1.15) brightness(1.15);
  opacity: calc((0.1 + var(--card-opacity) * 0.5) * var(--foil-strength, 1));
}
body.fx-holo.fx-holo.fx-holo .tcg[data-finish="pearl"] .foil::before,
body.fx-holo.fx-holo.fx-holo .tcg[data-finish="ruby"] .foil::before {
  background: linear-gradient(125deg, #9fa7b9, #e6d7ed, #c7e9e6, #e8dfcc, #a6b3c1);
  background-size: 250% 250%;
  background-position: calc(100% - var(--background-x)) var(--background-y);
  mix-blend-mode: color;
  filter: none;
  opacity: 0.35;
}
body.fx-holo.fx-holo.fx-holo .tcg[data-finish="pearl"] .foil::after,
body.fx-holo.fx-holo.fx-holo .tcg[data-finish="ruby"] .foil::after { background: none; }

body.fx-holo.fx-holo.fx-holo .tcg[data-finish="ruby"] .foil {
  mix-blend-mode: soft-light;
  filter: contrast(1.65) brightness(0.9);
  opacity: calc((0.14 + var(--card-opacity) * 0.72) * var(--foil-strength, 1));
}
body.fx-holo.fx-holo.fx-holo .tcg[data-finish="ruby"] .foil::before {
  background-image: linear-gradient(125deg, #59152b, #e03d24, #ffb85c, #f55631, #571325);
  mix-blend-mode: color;
  opacity: 0.45;
}

/* Smaller specular highlight; the rest of the card retains its printed ink. */
body.fx-holo.fx-holo.fx-holo .tcg.foil-ex .glare,
body.fx-holo.fx-holo.fx-holo .tcg.foil-sir .glare,
body.fx-holo.fx-holo.fx-holo .tcg[data-finish="ruby"] .glare,
body.fx-holo.fx-holo.fx-holo .tcg[data-finish="pearl"] .glare {
  background: radial-gradient(ellipse at var(--pointer-x) var(--pointer-y),
    #fff 0%, rgba(230,240,255,.65) 10%, rgba(180,200,225,.15) 30%, transparent 58%);
  mix-blend-mode: screen;
  filter: none;
  opacity: calc(var(--card-opacity) * (0.18 + var(--pointer-from-center) * 0.2));
}
body.fx-holo.fx-holo.fx-holo .tcg.foil-ex .glare::after,
body.fx-holo.fx-holo.fx-holo .tcg.foil-sir .glare::after,
body.fx-holo.fx-holo.fx-holo .tcg[data-finish="ruby"] .glare::after,
body.fx-holo.fx-holo.fx-holo .tcg[data-finish="pearl"] .glare::after { background: none; }

body.fx-holo.fx-holo.fx-holo .tcg.foil-ex:not(.lit):not(.settling) .foil {
  opacity: calc(.14 * var(--foil-strength,1));
}
body.fx-holo.fx-holo.fx-holo .tcg.foil-ex .glare {
  background: radial-gradient(ellipse at var(--pointer-x) var(--pointer-y),
    rgba(255,255,255,.22),rgba(200,228,255,.05) 36%,transparent 72%);
  mix-blend-mode: screen;
}
body.fx-holo.fx-holo.fx-holo .tcg.foil-ex .foil,
body.fx-holo.fx-holo.fx-holo .tcg.foil-ex .glare {
  -webkit-mask-image: none;
  mask-image: none;
  clip-path: none;
  border-radius: 4.55% / 3.25%;
}

/* Premium reverse foils: etched silver motifs, fixed to the print. */
body.fx-holo.fx-holo.fx-holo .tcg.foil-rev-pokeball,
body.fx-holo.fx-holo.fx-holo .tcg.foil-rev-masterball {
  --ball-etch: url("/assets/foil/pokeball-etch.svg");
  --ball-size: 22% auto;
  --ball-position: center;
  --ball-repeat: repeat;
}
body.fx-holo.fx-holo.fx-holo .tcg.foil-rev-masterball { --ball-etch: url("/assets/foil/masterball-etch.svg"); }
body.fx-holo.fx-holo.fx-holo .tcg[data-ball-layout="prismatic"] {
  --ball-size: 48% auto;
  --ball-position: 50% 78%;
  --ball-repeat: no-repeat;
}
body.fx-holo.fx-holo.fx-holo .tcg:is(.foil-rev-pokeball,.foil-rev-masterball) .foil {
  background-image: var(--holo-facet),
    linear-gradient(125deg,#91a9be,#dfc5d9 30%,#bccfb8 65%,#a8c4d4);
  background-size: 65% auto, 200% 200%;
  background-position: center, var(--background-x) var(--background-y);
  background-blend-mode: soft-light;
  mix-blend-mode: soft-light;
  filter: brightness(.8) contrast(1.3) saturate(.5);
  opacity: calc((.24 + var(--card-opacity) * .5) * var(--foil-strength,1));
}
body.fx-holo.fx-holo.fx-holo .tcg:is(.foil-rev-pokeball,.foil-rev-masterball) .foil::before {
  background-image: var(--ball-etch);
  background-size: var(--ball-size);
  background-position: var(--ball-position);
  background-repeat: var(--ball-repeat);
  mix-blend-mode: normal;
  opacity: .85;
}
body.fx-holo.fx-holo.fx-holo .tcg:is(.foil-rev-pokeball,.foil-rev-masterball) .foil::after {
  background-image: radial-gradient(ellipse at var(--pointer-x) var(--pointer-y),
    rgba(255,255,255,.48),rgba(210,235,255,.12) 40%,transparent 78%);
  background-size: cover;
  mix-blend-mode: screen;
  opacity: .6;
}
body.fx-holo.fx-holo.fx-holo .tcg:is(.foil-rev-pokeball,.foil-rev-masterball):not(.lit):not(.settling) .foil {
  opacity: calc(.24 * var(--foil-strength,1));
}
/* A premium ex printing has full artwork; there is no matte picture window. */
body.fx-holo.fx-holo.fx-holo .tcg[data-ball-layout="prismatic"].double-rare .foil {
  mask-image: none;
  -webkit-mask-image: none;
  border-radius: 4.55% / 3.25%;
}
