/*
 * Diamond & Pearl generation (2007-2011): Shining Pokémon, Rotom, Arceus AR, Shiny Legendaries, Alph Lithograph.
 *
 * Draws: dp-shining (`foil-holo dp-shining`: shiny-colour art with the reverse-sheet mirror foil), dp-rotom (`foil-holo dp-rotom`:
 * cracked-ice reverse over the whole card but the art), dp-ar (`foil-holo dp-ar`: Arceus AR1-AR9, an art holo that is not the
 * reverse), dp-shiny-legend (`foil-holo dp-shiny-legend`: Call of Legends SL1-SL11, cosmos-type art holo, silver border) and
 * dp-alph (`foil-holo dp-alph`: the Alph Lithograph's stone slab, textured; the holo is DISPUTED, see js/dp-foil.js).
 *
 * Classes come from dpPattern() in js/dp-foil.js; `era-dp` marks every Diamond & Pearl generation
 * print (js/foil-maps.js): dp1-dp7, pl1-pl4, hgss1-hgss4, col1, the dpp and hsp promos, POP 6-9 and the
 * Trainer Kits. Finish owners: the DP finish agents. The rarity words, frames and what the generation printed
 * are in js/dp-foil.js and /mnt/project-files/every-era/dp/SCAFFOLD-NOTES.md (research:
 * /mnt/project-files/every-era/dp/research/ and /mnt/project-files/every-era/hgss/research/, section 3 of
 * dp-pack-structure.md, hgss-pack-structure.md and pl-pack-structure.md has the finish vocabulary in plain words).
 * TCG Live has NO per-card foil maps for this generation (probed 2026-10-01), so the masks are drawn:
 * dpMap() in js/dp-foil.js hands the window masks of dp.css (assets/foil/dp-win/) to Rotom, Shining, AR and SL.
 * Reference note: .claude/skills/card-textures/reference/dp-secret.md. Follow SKILL.md: realism first, no outline or box-shadow on `.tcg`, cap any
 * colour dodge with a closing contrast(0.8), no black speckle, no hairline gratings, no foil over text, and run
 * foil_coverage.mjs plus a WebKit render at phone size before merging.
 *
 * Specificity: repeat `era-dp` five times in every selector, like sm.css
 * (body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-holo .foil),
 * so the rule beats the shared sheets; a resting card paints `.foil` alone.
 * Bump this sheet's ?v= tag in index.html on every change.
 */

/* ---- What is drawn here, and what is dp.css's -----------------------------------------------
   dp.css (family h1) owns the cosmos on the art window (`dp-holo`), the drawn window masks (assets/foil/dp-win/, handed over
   as `--foil-map` by dpMap()) and the Mirror reverse (`dp-rev`). This sheet sits on top of them:
   - dp-rotom: cracked ice over everything but the art window.
   - dp-shining: the Mirror's stripes on the Shining Pokemon (a `foil-holo` print, not a reverse, so dp.css's reverse rule
     does not reach it: the same recipe, keyed on dp-shining).
   - dp-ar (`foil-holo dp-holo dp-ar`): dp.css's cosmos plus a sheen over the body for the Arceus ripple rings.
   - dp-shiny-legend (`foil-holo dp-holo dp-shiny-legend`): dp.css's cosmos plus glitter on the silver border.
   - dp-alph: the stone's own relief, no holo.
   - dp-secret (`foil-holo dp-holo dp-secret`): nothing of its own; the secrets are dp.css's cosmos on their frame's window. */

/* "Everything but the art window": the scan's alpha minus the frame's window (--foil-map, set by dpMap()), the yellow border
   left plain by the clip. */
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp:is(.dp-shining, .dp-rotom) :is(.foil, .glare) {
  -webkit-mask-image: var(--art), var(--foil-map);
  mask-image: var(--art), var(--foil-map);
  -webkit-mask-composite: source-out;
  mask-composite: subtract;
  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;
  clip-path: inset(1.5% 2.1% 1.4% 2.1%);
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp:is(.dp-shining, .dp-rotom, .dp-alph) .foil::before,
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp:is(.dp-shining, .dp-rotom, .dp-alph) .foil::after {
  background-image: none;
  background-size: auto;
  background-position: center;
  background-repeat: repeat;
  background-blend-mode: normal;
  mix-blend-mode: normal;
  filter: none;
  -webkit-mask-image: none;
  mask-image: none;
  clip-path: none;
  border-radius: 0;
  opacity: 1;
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp:is(.dp-shining, .dp-rotom, .dp-alph, .dp-ar, .dp-shiny-legend) .glare::after {
  background: none;
  -webkit-mask-image: none;
  mask-image: none;
  mix-blend-mode: normal;
  filter: none;
  opacity: 1;
}

/* ---- Rotom RT1-RT6 (Rising Rivals): cracked ice ----------------------------------
   Photos (Fan RT1, Wash RT5, Mow RT4, Heat RT; two channels): flat angular shards, 6 to 12 per cent of the
   card's width, over the whole card except the art window and the yellow border: name bar, text box, footer. Most
   shards are only a little lighter than the print, a few flash bright and, tipped, a saturated colour. The art is
   plain. Two copies of the shard tile (assets/foil/dp-cracked-ice-v1.webp, scripts/make_dp_cracked_ice.py) slide
   against each other under a wide rainbow, colour-dodged onto the print, so black ink stays black. The Scrydex
   scan already carries the shards it was photographed with; this lights them. */
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-rotom {
  --dp-ice: url("/assets/foil/dp-cracked-ice-v1.webp");
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-rotom .foil {
  background-image: var(--dp-ice), var(--dp-ice), linear-gradient(115deg, var(--dp-spectrum));
  background-position:
    calc(var(--background-x) * 0.6) calc(var(--background-y) * 0.6),
    calc(100% - var(--background-x) * 0.8) calc(100% - var(--background-y) * 0.5),
    clamp(0%, calc(((50% - var(--background-x)) * 1.4) + 50%), 100%) clamp(0%, calc(((50% - var(--background-y)) * 0.9) + 50%), 100%);
  background-size: 130% auto, 95% auto, 300% 300%;
  background-repeat: repeat, repeat, no-repeat;
  background-blend-mode: multiply, screen, normal;
  filter: brightness(0.5) contrast(1.5) saturate(1.7) contrast(0.8);
  mix-blend-mode: color-dodge;
  opacity: calc((0.42 + var(--card-opacity) * 0.58) * var(--foil-strength, 1));
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-rotom:not(.lit):not(.settling) .foil {
  filter: brightness(0.85) contrast(1.2) saturate(0.7) contrast(0.8);
  opacity: calc(0.24 * var(--foil-strength, 1));
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-rotom .foil::before {
  background-image: var(--dp-flecks);
  background-size: 70% auto;
  background-position: var(--seed-pos);
  mix-blend-mode: screen;
  filter: brightness(1.3) contrast(1.6);
  opacity: calc(0.2 + var(--pointer-from-center) * 0.25);
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-rotom .glare {
  background-image: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsl(180, 100%, 95%) 5%, hsla(0, 0%, 39%, 0.25) 55%, hsla(0, 0%, 0%, 0.3) 110%);
  mix-blend-mode: overlay;
  filter: brightness(0.8) contrast(1.5);
  opacity: calc(var(--card-opacity) * 0.4);
}

/* ---- Shining Pokemon SH1-SH12: the Mirror reverse on shiny art -------------------------------
   Photos (Drifloon SH1, Duskull SH2, Yanma SH9, Ponyta SH11; Pokemon Holo and Card Spinner): the card is an ordinary
   reverse holo: border plain, name bar, text box and footer one smooth mirror throwing vertical spectrum stripes
   that slide as it tips, the art window plain and carrying the shiny colours. dp.css's Mirror recipe (family h1, its
   `.dp-rev` rule) is repeated here keyed on dp-shining; keep the two in step. */
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-shining .foil {
  background-image:
    radial-gradient(ellipse 46% 140% at var(--pointer-x) 52%, hsla(0, 0%, 100%, 0) 0%, hsla(0, 0%, 100%, 0.35) 55%, hsla(0, 0%, 100%, 0.72) 100%),
    repeating-linear-gradient(90deg, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 72%) 1.6%, hsl(0, 0%, 96%) 3.3%, hsl(0, 0%, 80%) 5%, hsl(0, 0%, 100%) 7.4%),
    repeating-linear-gradient(90deg, hsl(268, 90%, 80%) 0%, hsl(222, 100%, 78%) 2.4%, hsl(186, 100%, 76%) 4.8%, hsl(132, 85%, 74%) 7.2%,
      hsl(58, 100%, 74%) 9.6%, hsl(24, 100%, 76%) 12%, hsl(350, 90%, 78%) 14.4%, hsl(268, 90%, 80%) 16.8%);
  background-size: 100% 100%, 300% 100%, 300% 100%;
  background-position:
    center,
    clamp(0%, calc(((50% - var(--background-x)) * 0.45) + 50%), 100%) 0%,
    clamp(0%, calc(((50% - var(--background-x)) * 0.95) + 50%), 100%) 0%;
  background-repeat: no-repeat, repeat-y, repeat-y;
  background-blend-mode: normal, multiply, normal;
  filter: brightness(1.12) saturate(1.2);
  mix-blend-mode: multiply;
  opacity: calc((0.62 + var(--card-opacity) * 0.38) * var(--foil-strength, 1));
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-shining:not(.lit):not(.settling) .foil {
  opacity: calc(0.42 * var(--foil-strength, 1));
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-shining .glare {
  background-image: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsla(0, 0%, 100%, 0.6) 8%, hsla(0, 0%, 100%, 0.4) 24%, hsla(0, 0%, 0%, 0.2) 90%);
  mix-blend-mode: overlay;
  opacity: calc(var(--card-opacity) * 0.4);
}

/* ---- Arceus AR1-AR9 (Platinum: Arceus) ------------------------------------------------
   Photos (AR1, AR2, AR4, AR5: Pokemon Holo): cosmos in the art window (dp.css's, through `dp-holo`), and over the body (text
   box, dex strip, footer) broad concentric ripple rings, pale and glassy, centred low and right, that catch the light as
   the card tips. The Scrydex scans of these cards already carry the rings (they are photographed foil): drawing them
   again doubled them into dark bands, so the recipe only lights the body with a soft wide sheen band that the baked
   rings ride, and leaves the pattern itself to the scan. */
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-ar .glare {
  background-image: none;
  clip-path: none;
  -webkit-mask-image: var(--art), var(--foil-map);
  mask-image: var(--art), var(--foil-map);
  -webkit-mask-composite: source-out;
  mask-composite: subtract;
  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;
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-ar .glare::after {
  background-image: linear-gradient(112deg, transparent 20%, hsla(195, 85%, 90%, 0.85) 38%, hsla(300, 70%, 92%, 0.6) 48%,
    hsla(60, 85%, 88%, 0.7) 58%, transparent 76%);
  background-size: 260% 100%;
  background-position: calc(100% * var(--pointer-from-left)) 50%;
  background-repeat: no-repeat;
  mix-blend-mode: screen;
  opacity: calc(0.1 + var(--card-opacity) * 0.3);
}

/* ---- Shiny Legendaries SL1-SL11 (Call of Legends): silver border ------------------
   Photos (Entei SL3, Ho-Oh SL5, Rayquaza SL10, Raikou SL9): the cosmos art window (dp.css's, `dp-holo`), and an outer
   border of silver foil that glitters with fine pinpoints when tipped. The border is printed silver on the scan; the
   light adds only flecks on it (screened, so never dark). HeartGold & SoulSilver frame. */
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-shiny-legend .glare {
  /* multiply, not overlay: the scan's border is cream, and a cream border cannot be lit brighter. A cool grey ramp (floor 80%,
     brightest at the pointer) turns it silver. The flecks (glitter-fine.webp is white specks on black) are screened onto the ramp
     inside the same background, so a fleck lifts it to white and black never reaches the card (the tile on its own, multiplied,
     blacks the border out). */
  background-image: var(--dp-flecks), radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsl(210, 10%, 94%) 0%, hsl(212, 10%, 86%) 40%, hsl(214, 12%, 80%) 100%);
  background-size: 55% auto, 100% 100%;
  background-position: var(--seed-pos), center;
  background-repeat: repeat, no-repeat;
  background-blend-mode: screen, normal;
  mix-blend-mode: multiply;
  filter: none;
  opacity: calc(var(--card-opacity) * 0.95);
  clip-path: none;
  -webkit-mask-image: var(--art), linear-gradient(#000, #000);
  mask-image: var(--art), linear-gradient(#000, #000);
  -webkit-mask-composite: source-out;
  mask-composite: subtract;
  mask-mode: alpha, alpha;
  -webkit-mask-size: contain, 92.6% 94.6%;
  mask-size: contain, 92.6% 94.6%;
  -webkit-mask-position: center, 50% 50%;
  mask-position: center, 50% 50%;
  -webkit-mask-repeat: no-repeat, no-repeat;
  mask-repeat: no-repeat, no-repeat;
}
/* The window of an Arceus AR and a Shiny Legendary: this card's glare is cut to the body or the border, so the window lost
   the hot spot a plain Rare Holo's glare gives it (about 14 levels at 30:25). Put a pointer pool back on `.foil` and light the
   cosmos dots harder; measured about +25 to +32 levels at 30:25, the plain Rare Holo's +28 to +32. */
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp:is(.dp-ar, .dp-shiny-legend) .foil {
  background-image:
    radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
      hsla(180, 100%, 92%, 0.22) 0%, hsla(200, 90%, 75%, 0.1) 34%, hsla(220, 80%, 60%, 0) 70%),
    linear-gradient(115deg, hsla(168, 100%, 62%, 0.1), hsla(236, 95%, 70%, 0.09) 28%, hsla(318, 95%, 68%, 0.1) 54%,
      hsla(46, 100%, 62%, 0.08) 78%, hsla(168, 100%, 62%, 0.1));
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp:is(.dp-ar, .dp-shiny-legend):is(.lit, .settling) .foil::before {
  filter: brightness(1.6) saturate(1.3);
  opacity: calc(0.55 + var(--card-opacity) * 0.45);
}

/* ---- Alph Lithograph ONE-FOUR (HGSS): a stone slab, textured, NOT a rainbow holo ----------
   Decided from photos (sleeved ONE in two lights, 909yoshi's review; the four Lithographs on a mat, The Avalon
   Legacy; a graded ONE, zekrom7): the face is a matte sand-yellow relief, no rainbow, no cosmos dots at any tilt;
   under a lamp the grain of the stone catches light as fine sparkle over the WHOLE card and a broad warm hot
   spot sits on the sleeve. Text sources split (Elite Fourum: "textured but non-holo"; Collector's Cache lists the
   print as Regular; Collexy: cosmos holo; pkmn.gg and TCGplayer: Holofoil, which is most likely a database
   default), the photos side with Elite Fourum. So: raking light on the stone's own relief (the scan's greyscale,
   contrast-boosted, soft-lit near the pointer), a sparse screened grain, a warm glare. No hue anywhere. */
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-alph :is(.foil, .glare) {
  clip-path: none;
  -webkit-mask-image: var(--art);
  mask-image: var(--art);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-alph .foil {
  background-image: var(--art);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  filter: grayscale(1) contrast(2.2) brightness(1.15);
  mix-blend-mode: soft-light;
  opacity: calc((0.18 + var(--card-opacity) * 0.5) * var(--foil-strength, 1));
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-alph:not(.lit):not(.settling) .foil {
  filter: grayscale(1) contrast(1.6) brightness(1.1);
  opacity: calc(0.12 * var(--foil-strength, 1));
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-alph .foil::before {
  background-image: var(--dp-flecks), radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y), #fff 0%, #666 45%, #111 100%);
  background-size: 45% auto, 100% 100%;
  background-position: var(--seed-pos), center;
  background-blend-mode: multiply, normal;
  mix-blend-mode: screen;
  filter: brightness(1.1) contrast(1.4) sepia(0.5);
  opacity: calc(0.16 + var(--pointer-from-center) * 0.1);
}
body.fx-holo.fx-holo.fx-holo .tcg.era-dp.era-dp.era-dp.era-dp.era-dp.dp-alph .glare {
  background-image: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsla(40, 100%, 96%, 0.6) 8%, hsla(40, 60%, 70%, 0.3) 40%, hsla(0, 0%, 40%, 0.12) 100%);
  mix-blend-mode: overlay;
  opacity: calc(var(--card-opacity) * 0.4);
}
