/*
 * Holo family xy-secret-gold: XY gold secret rares: the gold Items of Primal Clash, Roaring Skies and Ancient Origins and
 * the gold Mega EX secrets of Flashfire, Furious Fists and Phantom Forces.
 *
 * Cards: the faces js/fam/xy-secret-gold.js claims; it adds `fam-xy-secret-gold` and `xsg-item` or `xsg-mega` 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-gold.(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, base and maps sheets set on each layer used here is reset first.
 * Research, photos and reviews: /mnt/project-files/holo-remaster/xy-secret-gold/ (refs/SOURCES.md has the photos).
 * Written 2026-10-02 for Noah's secret rare remake ("most have really shitty texture and i dont like the overuse of
 * the rainbow glare as most cards dont really have that rainbow glare").
 *
 * What the real cards do (photos: eBay listings and YouTube clips in refs/, notes in
 * .claude/skills/card-textures/reference/fam-xy-secret-gold.md):
 *   - GOLD ITEMS: a gold-engraved card. The gold goes from dark ochre to bright yellow-white with the tilt and the
 *     engraved lines (guilloche in the border, rules in the header, rings in the Poke Ball watermark) flash; it never
 *     turns rainbow. Colour is ONE narrow pastel stripe (cyan, pink, yellow) that slides across only where TCG Live's
 *     foil map is white (the TRAINER header, the ITEM badge, the object, the watermark ring, the blue footer bar).
 *     The white text box stays plain.
 *   - GOLD MEGA SECRETS: dark gold with bright yellow-white glints on the gold frames and lightning, a fine pebbled
 *     grain, and ONE tall saturated vertical band (green, cyan, blue, violet) that crosses the card as it turns.
 *
 * Layers, all in the scan's own gold (no rainbow wash):
 *   `.foil`          hard-light, always painted: a lamp ramp centred on the pointer (neutral at the pointer, multiplies the
 *                    scan to 83% luminance at the far corner; it never lifts, because hard-light above 50% screens and
 *                    screen turns the blacks of a dark scan milky), cut to the art and the shared text-safe map so the
 *                    white text box is not greyed. Multiply works on mid-light gold where colour-dodge and screen cannot.
 *   `.foil::before`  the engraved lines (Items: the ridge crests of TCG Live's own etch, the Megas: an etch drawn from the
 *                    card's scan) lit by the lamp and by a band of light that slides with the tilt: bright at the
 *                    pointer, gone at the far side. Painted at rest too, so the card reads as metal untouched.
 *   `.glare`         a soft warm overlay hot spot (lit only; overlay scales with the local colour, so black ink stays black).
 *   `.cure`          the one stripe (lit only), hard-light, its mask the foil map so colour lands only where the real card has it.
 */

/* ---- Shared values ------------------------------------------------------------------------------------- */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold {
  --xsg-lift: var(--foil-strength, 1);
  /* the lamp ramp (hard-light: above 50% screens, below 50% multiplies 2x): neutral at the pointer, 83% luminance at the far corner */
  --xsg-ramp: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsl(46, 12%, 50%) 0%, hsl(45, 12%, 50%) 14%, hsl(44, 12%, 47%) 38%, hsl(40, 12%, 43.5%) 68%, hsl(36, 14%, 40%) 100%);
  /* the engraved lines catch it: warm white at the pointer, gone at the far side (the ramp alone darkens, never the lines) */
  --xsg-lamp: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsla(52, 100%, 98%, 1) 0%, hsla(50, 100%, 91%, 0.92) 14%, hsla(48, 95%, 82%, 0.64) 34%, hsla(46, 90%, 72%, 0.3) 60%,
    hsla(45, 85%, 64%, 0.08) 85%, hsla(45, 85%, 64%, 0) 100%);
  /* and a band of light that slides with the tilt: the lines flash as it passes over them */
  --xsg-bx: calc(50% + (var(--pointer-x) - 50%) * 0.9);
  --xsg-band: linear-gradient(112deg, hsla(50, 100%, 96%, 0) calc(var(--xsg-bx) - 15%), hsla(50, 100%, 96%, 0.6) var(--xsg-bx),
    hsla(50, 100%, 96%, 0) calc(var(--xsg-bx) + 15%));
  /* the Megas' band and lines off their foil map: low, or the pointer frosts a dark Pokémon (M Gengar, review 1) */
  --xsg-floor: linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25));
  --xsg-floor-lo: linear-gradient(rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.12));
  --xsg-sx: calc(50% + (var(--pointer-x) - 50%) * 0.4);
}

/* ---- `.foil`: the lamp ramp, hard-light, cut to the art and the text-safe map ------------------------------ */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.has-foil-map .foil {
  background-image: var(--xsg-ramp);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-blend-mode: normal;
  mix-blend-mode: hard-light;
  filter: none;
  clip-path: none;
  border-radius: 0;
  -webkit-mask-image: var(--art), var(--xsg-safe);
  -webkit-mask-composite: source-in, source-over;
  mask-image: var(--art), var(--xsg-safe);
  mask-composite: intersect, add;
  mask-mode: alpha, alpha;
  -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: calc((0.88 + var(--card-opacity) * 0.12) * var(--foil-strength, 1));
}

/* ---- `.foil::before`: the engraved lines under the lamp (rest and lit) ------------------------------------- */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.has-foil-map .foil::before {
  display: block;
  background-image: var(--xsg-lamp), var(--xsg-band);
  background-size: 100% 100%, 100% 100%;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-blend-mode: normal;
  mix-blend-mode: normal;
  filter: none;
  clip-path: none;
  border-radius: 0;
  -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: calc(0.55 + var(--card-opacity) * 0.45);
}
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.has-foil-map:not(.lit):not(.settling) .foil::before {
  opacity: 0.8;
}
/* nothing else of the era's is painted here */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.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-gold.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.has-foil-map .glare::after {
  background-image: none;
  background-blend-mode: normal;
  mix-blend-mode: normal;
  filter: none;
  clip-path: none;
  border-radius: 0;
  -webkit-mask-image: none;
  mask-image: none;
  opacity: 1;
}

/* ---- `.glare`: a soft warm hot spot, overlay, never a dark side -------------------------------------------- */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.has-foil-map .glare {
  background-image: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsla(48, 100%, 94%, 0.55) 0%, hsla(46, 100%, 84%, 0.24) 24%, hsla(46, 100%, 74%, 0) 55%);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-blend-mode: normal;
  mix-blend-mode: overlay;
  filter: none;
  clip-path: none;
  border-radius: 0;
  -webkit-mask-image: var(--art), var(--xsg-safe);
  -webkit-mask-composite: source-in, source-over;
  mask-image: var(--art), var(--xsg-safe);
  mask-composite: intersect, add;
  mask-mode: alpha, alpha;
  -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: calc(var(--card-opacity) * var(--xsg-lift));
}

/* the Megas' Pokémon are inked dark or cool over the gold: a softer, warmer spot keeps them deep-coloured */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.xsg-mega.has-foil-map .glare {
  background-image: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsla(46, 100%, 80%, 0.32) 0%, hsla(46, 100%, 74%, 0.14) 24%, hsla(46, 100%, 70%, 0) 55%);
}

/* ---- Gold Items: ridge lines everywhere, one narrow pastel stripe on the foil map only --------------------- */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.xsg-item.has-foil-map .foil::before {
  -webkit-mask-image: var(--xsg-lines);
  mask-image: var(--xsg-lines);
  mask-mode: alpha;
}
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.xsg-item.has-foil-map .cure {
  z-index: 3;
  --xsg-stripe: linear-gradient(90deg,
    hsla(188, 95%, 55%, 0) calc(var(--xsg-sx) - 19%), hsl(188, 95%, 56%) calc(var(--xsg-sx) - 10%),
    hsl(325, 95%, 63%) var(--xsg-sx), hsl(52, 100%, 56%) calc(var(--xsg-sx) + 10%),
    hsla(52, 100%, 56%, 0) calc(var(--xsg-sx) + 19%));
  background-image: var(--xsg-stripe);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-blend-mode: normal;
  mix-blend-mode: hard-light;
  filter: none;
  clip-path: none;
  border-radius: 0;
  -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;
  mask-mode: alpha, alpha;
  -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: calc(var(--card-opacity) * 0.7 * var(--xsg-lift));
}

/* ---- Gold Mega secrets: the drawn grain on the gold frames, one tall saturated band ------------------------ */
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.xsg-mega.has-foil-map .foil::before {
  -webkit-mask-image: var(--xsg-lines), var(--foil-map), var(--xsg-floor-lo);
  -webkit-mask-composite: source-in, source-over, source-over;
  mask-image: var(--xsg-lines), var(--foil-map), var(--xsg-floor-lo);
  mask-composite: intersect, add, add;
  mask-mode: alpha, alpha, alpha;
}
body.fx-holo.fx-holo.fx-holo .tcg.era-xy.era-xy.era-xy.era-xy.era-xy.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.fam-xy-secret-gold.xsg-mega.has-foil-map .cure {
  z-index: 3;
  --xsg-stripe: linear-gradient(90deg,
    hsla(120, 80%, 52%, 0) calc(var(--xsg-sx) - 15%), hsl(120, 80%, 52%) calc(var(--xsg-sx) - 9%),
    hsl(175, 90%, 55%) calc(var(--xsg-sx) - 3%), hsl(220, 95%, 62%) calc(var(--xsg-sx) + 4%),
    hsl(280, 85%, 64%) calc(var(--xsg-sx) + 10%), hsla(280, 85%, 64%, 0) calc(var(--xsg-sx) + 15%));
  background-image: var(--xsg-stripe);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-blend-mode: normal;
  mix-blend-mode: hard-light;
  filter: none;
  clip-path: none;
  border-radius: 0;
  -webkit-mask-image: var(--art), var(--xsg-safe), var(--foil-map), var(--xsg-floor);
  -webkit-mask-composite: source-in, source-in, source-over, source-over;
  mask-image: var(--art), var(--xsg-safe), var(--foil-map), var(--xsg-floor);
  mask-composite: intersect, intersect, add, add;
  mask-mode: alpha, alpha, alpha, alpha;
  -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;
  opacity: calc(var(--card-opacity) * 0.8 * var(--xsg-lift));
}
