/*
 * Holo family xy-secret-shiny: XY shiny secret EX with the gold border: Ancient Origins, BREAKthrough, BREAKpoint, Fates Collide and Steam Siege.
 *
 * Cards: the faces js/fam/xy-secret-shiny.js claims (xy7-96..98 Primal Kyogre, Primal Groudon, M Rayquaza; xy8-163/164 Mewtwo;
 * xy9-123 Gyarados; xy10-125 Alakazam; xy11-115 Volcanion; xy11-116 Gardevoir); it adds `fam-xy-secret-shiny` to them and
 * every rule below is scoped to it.
 * Specificity: body.fx-holo.fx-holo.fx-holo .tcg.era-xy.(x5).fam-xy-secret-shiny.(x4) beats the era sheets (this sheet loads
 * after them); keep the era's :not(.lit):not(.settling) when overriding a rest-state rule. Every paint property the era
 * and the shared sheets set on the layers used here is reset first (SKILL.md "Old recipes leak into new ones").
 * Research, photos and reviews: /mnt/project-files/holo-remaster/xy-secret-shiny/ (refs/SOURCES.md, REPORT.md);
 * note: .claude/skills/card-textures/reference/fam-xy-secret-shiny.md.
 *
 * What the real cards do (photos and tilt clips of the real prints, refs/SOURCES.md):
 *   - They are ENGRAVED ("textured holofoil"). Fine raised ridges run along the drawing edge to edge: rungs across the gold
 *     border, wavy streaks in the art, rings round the type symbol (TCG Live's etch map is that engraving, ridge pitch about
 *     5.6 px at 733 px wide). The ridges are what catches the light: thin bright white-gold lines on the art that flash and go
 *     dark as the card turns, brightest near the lamp, the colours of the art still readable between them. The Pokemon's body
 *     is flat matte ink (TCG Live's foil map holds it at nothing); on the three Ancient Origins shinies the dark art is foil too.
 *   - The gold border is bright satin gold with the ridges across it, flaring to white-gold at the lamp.
 *   - Rainbow is NOT a wash. Under a lamp the real cards show one or two narrow vertical spectral beams (about a tenth of the
 *     card wide) that slide across as the card turns, coloured lines inside the beam; between them the card is gold, white
 *     and its own colours. So the rainbow here is one narrow beam, cut to the ridges, and nothing else is spectral.
 *
 * How it is built: the LINES are the Live etch turned inside out (the grooves lit: mask = scan x foil map x (1 - etch), via
 * `exclude` against a solid layer), on `.foil` and on `.cure`; their pseudo layers are cut by that mask too, so each one only
 * has to say WHERE and HOW BRIGHT:
 *   .foil           screen   the engraving: the lines in white-gold, faint at rest, a lamp patch round the pointer when held
 *   .foil::before   (lit)    the lines that run at 0 degrees, flashing for a lamp above or below the card (weight map dir-a)
 *   .foil::after    (lit)    the lines at 60 degrees (dir-b), flashing for a lamp off along their normal
 *   .cure           screen   (lit) a hot spot of white on the lines right under the pointer
 *   .cure::before   (lit)    the one narrow rainbow beam, on the lines
 *   .cure::after    (lit)    the lines at 120 degrees (dir-c)
 *   .glare          multiply (lit) the metal darkens away from the lamp (floor 84% on every channel), so it is not one flat yellow
 * The three weight maps are smooth (the etch's ridge direction at each point, scripts/fam/xy-secret-shiny/make_dir_maps.py).
 * No colour-dodge anywhere (a dodge on gold or on black ink is what washed these cards out); nothing darkens in specks.
 */

/* ---- Shared values ------------------------------------------------------------------------------------- */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny {
  --xyss-lift: var(--foil-strength, 1);
  /* the lamp's offset from the card's centre, -0.5 .. 0.5 */
  --xyss-dx: calc(var(--pointer-from-left) - 0.5);
  --xyss-dy: calc(var(--pointer-from-top) - 0.5);
  /* a ridge throws light at the eye when the lamp is off to one side of it: |lamp offset . ridge normal|, 0 .. 1.
     ridges at 0 deg (normal 0,1), at 60 deg (normal -0.866,0.5), at 120 deg (normal 0.866,0.5) */
  --xyss-fa: max(calc(var(--xyss-dy) * 2), calc(var(--xyss-dy) * -2));
  --xyss-fb: max(calc(var(--xyss-dx) * -1.732 + var(--xyss-dy)), calc(var(--xyss-dx) * 1.732 - var(--xyss-dy)));
  --xyss-fc: max(calc(var(--xyss-dx) * 1.732 + var(--xyss-dy)), calc(var(--xyss-dx) * -1.732 - var(--xyss-dy)));
  /* the narrow beam sits on the far side of the card from the lamp (a diffraction beam is not where the glare is, so white
     lines never wash it out) and drifts 0.7 of the pointer's travel the other way: one spectrum passes a point per sweep */
  --xyss-bx: calc(50% + (50% - var(--pointer-x)) * 0.7);
  /* white-gold on the lines. The engraving at rest (a soft glow in the middle, nobody holds the lamp), and the lamp's patch
     round the pointer, which fades in with --card-opacity on top of it: rest and held are one continuous picture */
  --xyss-rest: radial-gradient(farthest-corner circle at 50% 42%,
    hsla(48, 100%, 92%, 0.62) 0%, hsla(45, 95%, 78%, 0.42) 48%, hsla(42, 90%, 66%, 0.3) 100%);
  --xyss-patch: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsla(50, 100%, 95%, calc(var(--card-opacity) * 0.34)) 0%, hsla(46, 100%, 84%, calc(var(--card-opacity) * 0.22)) 22%,
    hsla(43, 95%, 70%, calc(var(--card-opacity) * 0.07)) 58%, hsla(42, 90%, 64%, 0) 100%);
  /* the flash that sits on top of it, on the lines that run across from the lamp */
  --xyss-flash: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsla(50, 100%, 99%, 0.88) 0%, hsla(48, 100%, 93%, 0.62) 9%, hsla(45, 100%, 82%, 0.3) 26%, hsla(43, 95%, 70%, 0.08) 56%, hsla(43, 95%, 70%, 0.02) 100%);
  /* the beam's spectrum: one narrow band across the card (about a seventh wide, a tenth where it is brightest), drawn twice on the lines for depth */
  --xyss-beam: linear-gradient(90deg,
    hsla(320, 100%, 70%, 0) calc(var(--xyss-bx) - 6.5%), hsla(320, 100%, 70%, 0.6) calc(var(--xyss-bx) - 4.6%),
    hsla(5, 100%, 64%, 0.9) calc(var(--xyss-bx) - 2.7%), hsla(48, 100%, 60%, 0.95) calc(var(--xyss-bx) - 0.9%),
    hsla(135, 100%, 56%, 0.96) calc(var(--xyss-bx) + 0.8%), hsla(185, 100%, 60%, 0.95) calc(var(--xyss-bx) + 2.6%),
    hsla(225, 100%, 72%, 0.9) calc(var(--xyss-bx) + 4.4%), hsla(280, 100%, 74%, 0.55) calc(var(--xyss-bx) + 6%),
    hsla(280, 100%, 74%, 0) calc(var(--xyss-bx) + 7.5%));
}

/* ---- Reset: what base, maps, rarities, realism, sv-fullart and xy-fullart put on these layers --------------- */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .foil,
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .cure {
  background-image: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-blend-mode: normal;
  mix-blend-mode: screen;
  filter: none;
  clip-path: none;
  border-radius: 0;
  -webkit-mask-image: none;
  mask-image: none;
  mask-mode: alpha;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  opacity: 1;
}
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .foil::before,
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .foil::after,
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .cure::before,
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .cure::after,
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .glare::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: none;
  background-image: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-blend-mode: normal;
  mix-blend-mode: normal;
  filter: none;
  clip-path: none;
  border-radius: 0;
  -webkit-mask-image: none;
  mask-image: none;
  mask-mode: alpha;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  opacity: 0;
}
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .glare {
  background-image: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-blend-mode: normal;
  mix-blend-mode: multiply;
  filter: none;
  clip-path: none;
  border-radius: 0;
  opacity: 0;
}

/* ---- The engraving: the Live etch's grooves lit white-gold, at rest and held ------------------------------- */
/* mask: the scan, the card's Live foil map (the Pokemon's body and the lettering stay matte), then 1 - etch (a solid layer
   `exclude`d against the etch), so the paint lands on the lines and not on the smooth ground between them */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .foil,
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .cure {
  -webkit-mask-image: var(--art), var(--foil-map), linear-gradient(#000, #000), var(--xyss-etch);
  -webkit-mask-composite: source-in, source-in, xor, source-over;
  mask-image: var(--art), var(--foil-map), linear-gradient(#000, #000), var(--xyss-etch);
  mask-composite: intersect, intersect, exclude, add;
  -webkit-mask-size: contain, 100% 100%, 100% 100%, 100% 100%;
  mask-size: contain, 100% 100%, 100% 100%, 100% 100%;
  -webkit-mask-position: center, center, center, center;
  mask-position: center, center, center, center;
  -webkit-mask-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  mask-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
}
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .foil {
  background-image: var(--xyss-patch), var(--xyss-rest);
  mix-blend-mode: screen;
  opacity: min(1, calc((0.9 + var(--card-opacity) * 0.1) * var(--foil-strength, 1)));
}
/* at rest the era's own rest rule sets the opacity (specificity 15): the same value this sheet gives with --card-opacity 0 */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map:not(.lit):not(.settling) .foil {
  opacity: min(1, calc(0.9 * var(--foil-strength, 1)));
}
/* the three Ancient Origins shinies (xy-shiny) are foil under dark ink: Live's map holds their black ability bar, rule
   headings and bodies at 0.85-0.91, and screen lifted that ink milky wherever a line fell (bar contrast 9-10:1 down to
   3-4:1, review 1). Overlay keeps black black and still lights the lines on the gold and the mid tones */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.xy-shiny.has-foil-map .foil {
  mix-blend-mode: overlay;
}

/* lines at 0 and at 60 degrees, lit while the card is held (each flashes for a lamp off along its normal) */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .foil::before {
  background-image: var(--xyss-flash);
  -webkit-mask-image: var(--xyss-dir-a);
  mask-image: var(--xyss-dir-a);
  opacity: calc((0.2 + var(--xyss-fa) * 0.8) * var(--card-opacity) * var(--xyss-lift));
}
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .foil::after {
  background-image: var(--xyss-flash);
  -webkit-mask-image: var(--xyss-dir-b);
  mask-image: var(--xyss-dir-b);
  opacity: calc((0.2 + var(--xyss-fb) * 0.8) * var(--card-opacity) * var(--xyss-lift));
}

/* ---- The hot spot, the rainbow beam, the third direction (`.cure`, module `cure: true`) -------------------- */
/* the cure span exists while the card is held; it has the same line mask as `.foil` */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .cure {
  z-index: 3;
  background-image: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsla(0, 0%, 100%, 0.75) 0%, hsla(50, 100%, 94%, 0.4) 5%, hsla(48, 100%, 88%, 0) 20%);
  mix-blend-mode: screen;
  opacity: min(1, calc(var(--card-opacity) * var(--foil-strength, 1)));
}
/* the one narrow beam (about a seventh of the card across), on the lines */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .cure::before {
  background-image: var(--xyss-beam), var(--xyss-beam);
  opacity: var(--card-opacity);
}
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .cure::after {
  background-image: var(--xyss-flash);
  -webkit-mask-image: var(--xyss-dir-c);
  mask-image: var(--xyss-dir-c);
  opacity: calc((0.2 + var(--xyss-fc) * 0.8) * var(--card-opacity) * var(--xyss-lift));
}

/* ---- The metal: gold darkens away from the lamp (multiply, every channel stays above 84%), only where the foil is -- */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.fam-xy-secret-shiny.has-foil-map .glare {
  background-image: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsl(0, 0%, 100%) 0%, hsl(44, 28%, 93%) 38%, hsl(40, 28%, 88%) 100%);
  mix-blend-mode: multiply;
  -webkit-mask-image: var(--art), var(--foil-map);
  -webkit-mask-composite: source-in, source-over;
  mask-image: var(--art), var(--foil-map);
  mask-composite: intersect, add;
  -webkit-mask-size: contain, 100% 100%;
  mask-size: contain, 100% 100%;
  -webkit-mask-position: center, center;
  mask-position: center, center;
  -webkit-mask-repeat: no-repeat, no-repeat;
  mask-repeat: no-repeat, no-repeat;
  opacity: var(--card-opacity);
}
