/* ==========================================================================
   holo-pikachu-rare.css — the 30th Celebration Pikachu Rare's foil
   (data-rarity="pikachu rare"), Lastpocket's own style on top of
   pokemon-cards-151. Owner's choice 2026-09-27: sketch 006 variant C, "except
   the pattern on the artwork maybe that should just be normal holo on the
   artwork". Design record: .planning/sketches/006-pikachu-rare-foil/.

   Loaded straight after holo-151.css by every section that loads it; the
   rules below tie with the library's on specificity and win by that order
   (`no-important`). Scoped to .lp-holo like the generated file.

   What the printed card has (our scan of 049/128, and malie's TCG Live
   export, where all 30 Pikachu Rares, me5-5 023..052, print foil type
   PIKACHU), and what each zone draws:

     art window   the library's RARE HOLO shine, exactly as a rare holo
                  draws it: holo-151.css re-emits regular-holo.css's three
                  shine rules under this rarity (RARITY_ALIASES in
                  apps/shop/scripts/lib/holo-css.mjs). This file only
                  confines that shine to the art window.
     emblem       the Pikachu-face "30" on the text box: cracked-ice shards,
                  olive to gold
     border       cracked-ice shards, light silver with blue and violet
     the rest     the library's reverse holo, reduced (owner: "a reverse
                  holo effect out side of the artwork")

   Where each zone is: the card's own malie mask (--mask, uploaded per card
   by shop-stock-images.mjs --holo) and three rects measured identical on
   all 30 masks, 2026-09-27:
     art window   x 8.2%..91.8%   y 10.1%..47.1%   -> size 83.6% 37%,     pos 50% 16.03%
     emblem       x 22.1%..77.4%  y 53.5%..82.4%   -> size 55.3% 28.9%,   pos 49.4% 75.25%
     frame inner  x 3.54%..95.91% y 2.73%..97.27%  -> size 92.37% 94.54%, pos 46.4% 50%
   A mask-position % puts that % of the layer on that % of the box, so an
   offset o for a layer of size s is o / (1 - s).

   One zone per element, because a mask also clips an element's pseudos.
   The tile and the quick view render all four of Card.svelte's layers for
   this reason (snippets/set-tile.liquid, snippets/quick-view.liquid):
     .card__shine    art window    rare holo            mask ∩ art rect
     .card__glitter  emblem        gold shards          mask ∩ mask ∩ emblem rect
     .card__glare2   border        silver shards        card − frame inner rect
     .card__glare    the rest      reverse holo         card − art rect
     .card__front::after art window  rare holo glare     art rect

   The emblem uses the mask twice: intersect multiplies alphas, so malie's
   not-foil grey (about 14%) squares to about 2% while full foil stays full.
   Once, the shards showed faintly across the whole text box.

   holo-shards.webp: a seeded, tileable cracked-ice texture generated by
   .planning/sketches/006-pikachu-rare-foil/make-shards.py (angular shards
   about 1% of the card wide, read off the scan); the library has no texture
   of that shape. Declared and read in this one file, so its relative url()
   resolves beside this file, in the theme's assets.
   ========================================================================== */

.lp-holo .card[data-rarity="pikachu rare"] {
  --pr-rect: linear-gradient(#fff, #fff);
  --pr-art-size: 83.6% 37%;
  --pr-art-pos: 50% 16.03%;
  --pr-emb-size: 55.3% 28.9%;
  --pr-emb-pos: 49.4% 75.25%;
  --pr-frame-size: 92.37% 94.54%;
  --pr-frame-pos: 46.4% 50%;

  --pr-shards: url(holo-shards.webp);
  /* the texture is 512px of shards ~8px across; at 96% of the card's width
     (60% x variant C's 1.6) a shard is ~1.5% of the card, C's size */
  --pr-shard-size: 96%;
  /* the emblem's own, finer shards: beside the scan at 2x (2026-09-27) the
     border's shard size read as blotches on the emblem, whose printed
     cracked ice is dense and fine, about 0.4% of the card per shard */
  --pr-emb-shard-size: 40%;
  /* how far the second shard sheet moves across a full tilt */
  --pr-shard-shift: 40px;

  /* variant C, as chosen */
  --pr-gold: 1;
  /* the scan's olive-gold: darker than the print's yellow, with bright gold
     flecks. Round 2's C (contrast .75, light .72) stayed mostly yellow with
     brown blobs; the owner: "doesnt look right on the 30 logo" */
  --pr-gold-contrast: 1.35;
  --pr-gold-light: .62;
  /* .85, turned down from 1 at the owner's request ("turn down the shards
     on the border a little") */
  --pr-silver: .85;
  --pr-silver-contrast: 1.35;
  --pr-silver-light: 1.04;
  /* the reverse holo at .6 of the library's strength: at full strength it
     washed this card's all-yellow body to near-white and the attack text
     went illegible */
  --pr-reverse: .6;
  --pr-reverse-brightness: .5;
}

/* ---- 1. art window: the library's rare holo, confined -------------------- */

/* The shine's look is the library's own (holo-151.css, the alias). This only
   replaces base.css's whole-card `mask-image: var(--mask)` with the mask cut
   to the art window. The shine's :before and :after are clipped with it. */
.lp-holo .card[data-rarity="pikachu rare"] .card__shine {
  -webkit-mask-image: var(--pr-rect), var(--mask);
  mask-image: var(--pr-rect), var(--mask);
  -webkit-mask-size: var(--pr-art-size), cover;
  mask-size: var(--pr-art-size), cover;
  -webkit-mask-position: var(--pr-art-pos), center;
  mask-position: var(--pr-art-pos), center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  mask-mode: luminance;
}

/* ---- 2. emblem: gold shards ---------------------------------------------- */

/* The shard texture twice, one sheet moved by the pointer, combined by
   difference: as the card tilts different shards flip between dark and
   bright, which is what foil does, while the mosaic itself stays put.
   Tinted gold with its range squeezed (contrast below 1) and darkened, so
   the face turns the scan's olive-gold and the shards vary within it.
   multiply, so the black ear tips stay black: hard-light lightened them in
   the sketch, and they are solid on the printed card. */
.lp-holo .card[data-rarity="pikachu rare"] .card__glitter {
  display: grid;
  background-image: var(--pr-shards), var(--pr-shards);
  background-size: var(--pr-emb-shard-size) auto;
  background-repeat: repeat;
  background-position:
    center,
    calc(50% + var(--pointer-from-left) * var(--pr-shard-shift) * .5)
    calc(50% + var(--pointer-from-top) * var(--pr-shard-shift) * .5);
  background-blend-mode: difference;
  filter: invert(1) sepia(1) saturate(2.8) hue-rotate(12deg) contrast(var(--pr-gold-contrast)) brightness(var(--pr-gold-light));
  mix-blend-mode: multiply;
  opacity: calc(var(--card-opacity) * var(--pr-gold));

  -webkit-mask-image: var(--pr-rect), var(--mask), var(--mask);
  mask-image: var(--pr-rect), var(--mask), var(--mask);
  -webkit-mask-size: var(--pr-emb-size), cover, cover;
  mask-size: var(--pr-emb-size), cover, cover;
  -webkit-mask-position: var(--pr-emb-pos), center, center;
  mask-position: var(--pr-emb-pos), center, center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-composite: source-in, source-in;
  mask-composite: intersect, intersect;
  mask-mode: luminance;
}

.lp-holo .card[data-rarity="pikachu rare"] .card__glitter:before,
.lp-holo .card[data-rarity="pikachu rare"] .card__glitter:after {
  content: none;
}

/* ---- 3. border: silver shards -------------------------------------------- */

/* The same shards, inverted (two sheets by difference are mostly dark, which
   read as black-and-white static beside the scan's light silver frame),
   tinted by a silver-blue-violet sweep that slides with the pointer, under
   hard-light. Cut by the frame's own geometry rather than the mask: the
   mask's not-foil grey carried the texture across the yellow body. */
.lp-holo .card[data-rarity="pikachu rare"] .card__glare2 {
  display: block;
  background-image:
    linear-gradient(115deg, #d9dee8, #8ea9dc, #b7a2e6, #eef1f6, #93b6de, #a99be0, #d9dee8),
    var(--pr-shards),
    var(--pr-shards);
  background-size: 300% 300%, var(--pr-shard-size) auto, var(--pr-shard-size) auto;
  background-repeat: no-repeat, repeat, repeat;
  background-position:
    var(--background-x) var(--background-y),
    center,
    calc(50% - var(--pointer-from-left) * var(--pr-shard-shift))
    calc(50% - var(--pointer-from-top) * var(--pr-shard-shift));
  background-blend-mode: overlay, difference;
  filter: invert(1) contrast(var(--pr-silver-contrast)) brightness(var(--pr-silver-light)) saturate(1.1);
  mix-blend-mode: hard-light;
  opacity: calc(var(--card-opacity) * var(--pr-silver));

  -webkit-mask-image: var(--pr-rect), var(--pr-rect);
  mask-image: var(--pr-rect), var(--pr-rect);
  -webkit-mask-size: 100% 100%, var(--pr-frame-size);
  mask-size: 100% 100%, var(--pr-frame-size);
  -webkit-mask-position: center, var(--pr-frame-pos);
  mask-position: center, var(--pr-frame-pos);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-composite: source-out;
  mask-composite: subtract;
  mask-mode: luminance;
}

/* ---- 1b. art window: the rare holo's glare ----------------------------- */

/* A rare holo's look is its shine AND its glare (regular-holo.css's
   .card__glare), and on a rare holo the glare covers the whole card. Here
   .card__glare carries the reverse holo outside the art, so the artwork had
   the shine alone and read as no holo at all (owner, 2026-09-27: "no
   standard holo on the artwork"). The rare holo's glare goes on
   .card__front's ::after instead, the one free box in Card.svelte's markup,
   confined to the art window: its gradient, blend and opacity verbatim.
   Measured held still beside a rare holo card: the art window's mean
   brightness 182 against the rare holo's 184. Blending in the glare's
   second gradient as well (one box, so by background-blend-mode) came out
   visibly weaker, so it is left out. */
.lp-holo .card[data-rarity="pikachu rare"] .card__front::after {
  content: "";
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: translateZ(1.41px);
  border-radius: var(--card-radius);
  background-image: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsla(0, 0%, 100%, 0.8) 10%, hsla(0, 0%, 100%, 0.65) 20%, hsla(0, 0%, 0%, .5) 120%);
  mix-blend-mode: overlay;
  opacity: calc(var(--card-opacity) * .8);

  -webkit-mask-image: var(--pr-rect);
  mask-image: var(--pr-rect);
  -webkit-mask-size: var(--pr-art-size);
  mask-size: var(--pr-art-size);
  -webkit-mask-position: var(--pr-art-pos);
  mask-position: var(--pr-art-pos);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  mask-mode: luminance;
}

/* ---- 4. everything outside the artwork: reverse holo --------------------- */

/* The library's reverse holo recipe (reverse-holo.css: the pointer radial,
   the -45deg sweep and the card's --foil layer, soft-light then difference,
   color-dodge onto the print), reduced by --pr-reverse, on .card__glare cut
   to the card minus the art window. Its :after is the reverse holo's own
   pointer glare, clipped the same way. */
.lp-holo .card[data-rarity="pikachu rare"] .card__glare {
  background-image:
    radial-gradient(circle at var(--pointer-x) var(--pointer-y), #fff 5%, #000 50%, #fff 80%),
    linear-gradient(-45deg, #000 15%, #fff, #000 85%),
    var(--foil);
  background-blend-mode: soft-light, difference;
  background-size: 120% 120%, 200% 200%, cover;
  background-position:
    center center,
    calc(100% * var(--pointer-from-left)) calc(100% * var(--pointer-from-top)),
    center center;
  filter: brightness(var(--pr-reverse-brightness)) contrast(1.5) saturate(1);
  mix-blend-mode: color-dodge;
  opacity: calc(((1.5 * var(--card-opacity)) - var(--pointer-from-center)) * var(--pr-reverse));

  -webkit-mask-image: var(--pr-rect), var(--pr-rect);
  mask-image: var(--pr-rect), var(--pr-rect);
  -webkit-mask-size: 100% 100%, var(--pr-art-size);
  mask-size: 100% 100%, var(--pr-art-size);
  -webkit-mask-position: center, var(--pr-art-pos);
  mask-position: center, var(--pr-art-pos);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-composite: source-out;
  mask-composite: subtract;
  mask-mode: luminance;
}

.lp-holo .card[data-rarity="pikachu rare"] .card__glare:after {
  content: "";
  opacity: calc(var(--card-opacity) * .6);
  background-image: radial-gradient(farthest-corner circle at var(--pointer-x) var(--pointer-y),
    hsl(0, 0%, 100%) 10%, hsla(0, 0%, 100%, 0.5) 20%, hsla(0, 0%, 0%, 0.5) 120%);
  filter: brightness(1) contrast(1.5);
  mix-blend-mode: overlay;
}
