/* ============================================================================
   THE CARD
   ----------------------------------------------------------------------------
   One object, used in three places: turning in 3D on the stage, sitting on a
   phone screen in the setup steps, and previewing live inside the studio.

   It is driven entirely by four custom properties, so the studio can restyle
   it by writing four strings and nothing else has to know:

       --c1 --c2 --c3   the three gradient stops
       --on             the colour everything printed on it takes

   A skin is therefore just a named set of those four. Adding one is four
   lines, and the studio's swatches are the same four lines read back out.

   What makes it read as a physical card rather than a rounded div:
     · a bloom placed OFF-CENTRE, so the light has a direction
     · a grain layer, drawn by the browser from an SVG turbulence filter —
       no file, no weight, and it stays sharp at any size
     · a bright hairline along the top edge and a dark one along the bottom,
       which is what an extruded plastic edge actually does to light
   ========================================================================== */

.lc{
  --c1:#2B1263; --c2:#6432C8; --c3:#1A0B40; --on:#fff; --stamp:#2B1263;
  position:relative;width:100%;aspect-ratio:1.586/1;border-radius:5.4% / 8.6%;
  background:linear-gradient(145deg,var(--c1) 0%,var(--c2) 52%,var(--c3) 100%);
  color:var(--on);overflow:hidden;isolation:isolate;
  display:flex;flex-direction:column;justify-content:space-between;
  padding:6.2% 6.4%;
  font-family:var(--font,'Figtree',sans-serif);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.34),
    inset 0 -1px 0 rgba(0,0,0,.30),
    inset 0 0 0 1px rgba(255,255,255,.09);
}

/* The bloom. Off-centre, oversized, and soft enough that you read it as a
   light source rather than a shape. */
.lc:before{content:'';position:absolute;z-index:0;
  top:-42%;left:-16%;width:92%;height:168%;border-radius:50%;
  background:radial-gradient(closest-side,rgba(255,255,255,.40),rgba(255,255,255,0) 72%);
  pointer-events:none}

/* The grain. feTurbulence at a high frequency, screened back almost to
   nothing — enough to kill the plastic flatness of a CSS gradient. */
.lc:after{content:'';position:absolute;inset:0;z-index:1;pointer-events:none;
  opacity:.26;mix-blend-mode:overlay;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.52'/%3E%3C/svg%3E");
  background-size:160px 160px}

.lc > *{position:relative;z-index:2}

/* ── What is printed on it ───────────────────────────────────────────── */
.lc-top{display:flex;align-items:center;gap:3.4%;min-height:0}
.lc-mark{width:10.4%;aspect-ratio:1;border-radius:28%;flex-shrink:0;
  background:color-mix(in srgb,var(--on) 94%,transparent);
  color:var(--c2);display:flex;align-items:center;justify-content:center;
  font-size:4.2cqw;font-weight:700;letter-spacing:-.04em;overflow:hidden}
.lc-mark img{width:68%;height:68%;object-fit:contain}
/* The mark is a raised chip, lit the same way as the coins. */
.lc-mark{box-shadow:0 .6cqw 1.2cqw -.3cqw rgba(0,0,0,.42),
  inset 0 .25cqw 0 rgba(255,255,255,.65),inset 0 -.3cqw .4cqw rgba(0,0,0,.10)}
.lc-name{text-shadow:0 .18cqw .5cqw rgba(0,0,0,.26)}
.lc-name{font-size:5.2cqw;font-weight:600;letter-spacing:-.03em;line-height:1.1;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lc-kicker{margin-left:auto;font-size:2.5cqw;font-weight:600;letter-spacing:.2em;
  text-transform:uppercase;opacity:.62;white-space:nowrap}

.lc-reward{font-size:3.2cqw;line-height:1.3;opacity:.8;max-width:78%;font-weight:450}
.lc-reward b{font-weight:600;opacity:1}

/* ── The stamp row ───────────────────────────────────────────────────── */
/* Ten stamps, five to a row — the shape almost every Malaysian shop already
   prints. Five across instead of ten makes each circle nearly twice the
   width it would otherwise be, which is the only way the stamp icon is
   legible at card size. */
/* Ten stamps, five to a row, spanning the card's full measure and starting
   at the same left edge as the name and the reward line above them.

   Five circles across a card this shape cannot be both modest and edge to
   edge: 1fr columns fill the measure exactly, but they also force the stamp
   to a fifth of the card. So the tracks are sized and the row starts at the
   left, stopping a little short — on the same logic as the reward line
   above it, which also runs to a measure rather than to the edge.

   The gap is set against the circle, not left over from it. 3.5 against 14
   is a quarter, which reads as a row of stamps rather than ten unrelated
   rings; the version before this had it at nearly two thirds, because the
   gap was whatever remained once the circle had been shrunk.

   14 and 3.5 together come to a hair under the full measure — about 15px
   short on the studio card — so the row reads as filling the width while
   still stopping, like the reward line, before the edge. */
.lc-slots{display:grid;grid-template-columns:repeat(5,16cqw);gap:4cqw;
  justify-content:start}
.lc-slot{position:relative;aspect-ratio:1;border-radius:50%;
  border:1.5px solid color-mix(in srgb,var(--on) 30%,transparent);
  display:flex;align-items:center;justify-content:center;
  color:color-mix(in srgb,var(--on) 28%,transparent);font-size:7cqw;
  /* An empty slot is a WELL pressed into the card: darker than the surface,
     shadowed along its top lip and catching a little light along the bottom
     one. A ring drawn on the surface says "a circle is printed here"; a well
     says "something goes in this". */
  background:color-mix(in srgb,#000 12%,transparent);
  box-shadow:inset 0 .55cqw .9cqw rgba(0,0,0,.30),inset 0 -.22cqw 0 rgba(255,255,255,.13);
  transition:background-color .35s,color .35s,border-color .35s,box-shadow .35s}

/* The filled state is one rule for all twenty skins, and it is why --stamp
   exists. The circle fills with the card's own ink (white on a dark skin,
   dark on a pale one) and the icon takes --stamp, which every skin declares
   as the colour that reads ON that fill. Deriving the icon colour from a
   gradient stop instead — which is what this did — produced pale-on-pale
   icons the moment a skin's mid stop was light.

   A filled slot is a COIN sitting in the well: lit along its top edge,
   shaded along its bottom, and casting a shadow onto the card. That shadow
   reads --c-tx/--c-ty, which the 3D rig sets as the card tilts, so on a
   tilting card the coins' shadows lean the other way — the detail that makes
   them read as raised rather than printed. On a card that is not in a rig
   both are 0 and the shadow simply falls straight down. */
.lc-slot.on{border-color:transparent;color:var(--stamp);
  background:linear-gradient(155deg,var(--on),color-mix(in srgb,var(--on) 84%,#000));
  box-shadow:
    inset 0 .32cqw .18cqw rgba(255,255,255,.5),
    inset 0 -.5cqw .7cqw rgba(0,0,0,.17),
    calc(var(--c-tx,0) * -.9cqw) calc(1cqw - var(--c-ty,0) * .7cqw) 1.5cqw -.35cqw rgba(0,0,0,.5),
    0 .22cqw .4cqw rgba(0,0,0,.24)}
.lc-slot i{line-height:0}
/* The one that is about to be filled — a quiet invitation, not a blinker. */
.lc-slot.next{border-color:color-mix(in srgb,var(--on) 78%,transparent);
  box-shadow:inset 0 .55cqw .9cqw rgba(0,0,0,.30),inset 0 -.22cqw 0 rgba(255,255,255,.13),
             0 0 0 2.5px color-mix(in srgb,var(--on) 13%,transparent)}

/* ── A milestone ─────────────────────────────────────────────────────────
   A slot that pays something when it is reached. Empty, it is drawn dashed
   with a small gift in it, so a customer can see from the start that the
   middle of the card is worth getting to. Filled, it keeps a gold pip on its
   shoulder: the stamp is a stamp like any other, and the pip is the receipt
   for the reward that came with it. */
.lc-slot.ms:not(.on){border-style:dashed;
  border-color:color-mix(in srgb,var(--on) 60%,transparent);
  color:color-mix(in srgb,var(--on) 66%,transparent)}
.lc-slot.ms:not(.on) i{font-size:.74em}
.lc-slot.ms.on:before{content:'';position:absolute;top:-5%;right:-5%;width:31%;height:31%;
  border-radius:50%;background:linear-gradient(135deg,#FFEFB5,#D9A93A);
  box-shadow:0 .3cqw .6cqw rgba(0,0,0,.4),inset 0 .15cqw 0 rgba(255,255,255,.75)}

/* ── Standing ────────────────────────────────────────────────────────────
   Silver and Gold replace the small "LOYALTY" kicker with a metal chip. The
   metal is its own gradient rather than a tint of the card, deliberately: it
   has to read as the same Silver on a violet card and a peach one, because
   it is the customer's standing and not part of the shop's branding. */
.lc-tier{display:inline-flex;align-items:center;gap:1.1cqw;opacity:1;
  padding:.85cqw 2.3cqw .85cqw 1.8cqw;border-radius:99cqw;
  font-size:2.45cqw;font-weight:700;letter-spacing:.14em}
.lc-tier i{font-size:3.3cqw;line-height:0}
.lc-tier[data-tier="silver"]{color:#272B33;
  background:linear-gradient(135deg,#F6F7F9,#BCC1CA 42%,#ECEEF1 58%,#9DA3AE);
  box-shadow:inset 0 .2cqw 0 rgba(255,255,255,.85),0 .5cqw 1.1cqw -.2cqw rgba(0,0,0,.42)}
.lc-tier[data-tier="gold"]{color:#473205;
  background:linear-gradient(135deg,#FFF3C9,#E3B94C 42%,#FFEBAD 58%,#B98A2C);
  box-shadow:inset 0 .2cqw 0 rgba(255,255,255,.85),0 .5cqw 1.1cqw -.2cqw rgba(0,0,0,.42)}

/* A stamp landing. It comes down from above the card, over-large and turned,
   hits, compresses, and settles — and pushes a ring out of the well as it
   does. This is the one moment in the product where overshoot is earned:
   something was pressed onto the card. It lives here rather than in a script
   so it plays the same on the landing page, in the shop's screens and on the
   customer's own card, and so nothing has to run a frame loop for it. */
.lc-slot.just{z-index:3;animation:lcStamp .72s cubic-bezier(.2,1.35,.35,1) both}
.lc-slot.just:after{content:'';position:absolute;inset:0;border-radius:50%;pointer-events:none;
  border:.5cqw solid var(--on);opacity:0;
  animation:lcRing .8s .2s cubic-bezier(.2,.7,.3,1) both}
@keyframes lcStamp{
  0%  {transform:scale(2.4) rotate(-16deg);opacity:0}
  38% {transform:scale(.88) rotate(2deg);opacity:1}
  60% {transform:scale(1.07) rotate(0)}
  100%{transform:scale(1)}}
@keyframes lcRing{from{transform:scale(1);opacity:.7}to{transform:scale(2.3);opacity:0}}

@supports not (color:color-mix(in srgb,red,blue)){
  .lc-mark{background:rgba(255,255,255,.94)}
  .lc-slot{border-color:rgba(255,255,255,.38);color:rgba(255,255,255,.3)}
}

/* Container queries drive every size above, so one card scales from a swatch
   to a hero without a single media query. */
.lc{container-type:inline-size}

/* ── Skins ───────────────────────────────────────────────────────────────
   Three stops, an ink, and a stamp colour. Twenty of them, laid out five to
   a row in the studio so the grid closes cleanly instead of leaving one
   swatch stranded on a line of its own.

   --on    what everything printed on the card takes, AND what a filled
           stamp circle fills with
   --stamp what the stamp icon takes once it is sitting on that fill, so it
           is the inverse of --on and is chosen, never derived

   Fourteen dark, six pale. The pale ones invert on both counts: their ink
   goes dark, which means their filled circles go dark too, which means the
   stamp inside has to go white. */

/* Dark */
.lc[data-skin="violet"]  {--c1:#3C1A8C;--c2:#6432C8;--c3:#200C52;--on:#fff;--stamp:#2B1263}
.lc[data-skin="indigo"]  {--c1:#3B3A9E;--c2:#26247A;--c3:#121042;--on:#fff;--stamp:#1B1A58}
.lc[data-skin="midnight"]{--c1:#2B3C74;--c2:#16224A;--c3:#080E24;--on:#fff;--stamp:#16224A}
.lc[data-skin="ocean"]   {--c1:#1E6E8C;--c2:#0F4A61;--c3:#06242F;--on:#fff;--stamp:#0F4A61}
.lc[data-skin="teal"]    {--c1:#1C7A6E;--c2:#0E5248;--c3:#052723;--on:#fff;--stamp:#0E5248}
.lc[data-skin="forest"]  {--c1:#2F6B52;--c2:#1C4634;--c3:#0E2619;--on:#fff;--stamp:#1C4634}
.lc[data-skin="moss"]    {--c1:#5E7A3A;--c2:#3F5522;--c3:#1E290F;--on:#fff;--stamp:#3F5522}
.lc[data-skin="ember"]   {--c1:#FF8A4C;--c2:#FF6432;--c3:#B9330E;--on:#fff;--stamp:#B9330E}
.lc[data-skin="clay"]    {--c1:#C98A5A;--c2:#A06E28;--c3:#5E3C12;--on:#fff;--stamp:#5E3C12}
.lc[data-skin="cocoa"]   {--c1:#7A5240;--c2:#523324;--c3:#26150E;--on:#fff;--stamp:#523324}
.lc[data-skin="wine"]    {--c1:#8E2F4A;--c2:#5E1A2E;--c3:#2C0A15;--on:#fff;--stamp:#5E1A2E}
.lc[data-skin="rose"]    {--c1:#D97A92;--c2:#B0455F;--c3:#5E1C2C;--on:#fff;--stamp:#8E2F45}
.lc[data-skin="ink"]     {--c1:#2A2140;--c2:#171026;--c3:#0C0718;--on:#fff;--stamp:#171026}
.lc[data-skin="charcoal"]{--c1:#4A4A52;--c2:#2C2C33;--c3:#14141A;--on:#fff;--stamp:#2C2C33}

/* Pale */
.lc[data-skin="peach"]   {--c1:#FFE2C2;--c2:#F7C891;--c3:#E0A258;--on:#4A2B08;--stamp:#FFF6EA}
.lc[data-skin="lilac"]   {--c1:#F3EAFF;--c2:#DEC7FF;--c3:#B695E8;--on:#2B1263;--stamp:#F6F0FF}
.lc[data-skin="pearl"]   {--c1:#FFFFFF;--c2:#F1EDE4;--c3:#D8D0C0;--on:#241A3A;--stamp:#FFFFFF}
.lc[data-skin="sand"]    {--c1:#F4EFE6;--c2:#E2D6C0;--c3:#BFAE90;--on:#3A2A12;--stamp:#FBF7F0}
.lc[data-skin="sky"]     {--c1:#E4F1FB;--c2:#C3DFF5;--c3:#93BFE0;--on:#10324A;--stamp:#F2F9FF}
.lc[data-skin="mint"]    {--c1:#E4F6EC;--c2:#C2E8D2;--c3:#94CFAF;--on:#0E3A24;--stamp:#F2FBF6}

/* The pale skins need their light handled the other way round: the bloom
   becomes a soft shadow, and the extruded edge reverses. */
.lc[data-skin="peach"]:before,.lc[data-skin="lilac"]:before,
.lc[data-skin="pearl"]:before,.lc[data-skin="sand"]:before,
.lc[data-skin="sky"]:before,.lc[data-skin="mint"]:before{
  background:radial-gradient(closest-side,rgba(0,0,0,.09),rgba(0,0,0,0) 72%)}
.lc[data-skin="peach"],.lc[data-skin="lilac"],
.lc[data-skin="pearl"],.lc[data-skin="sand"],
.lc[data-skin="sky"],.lc[data-skin="mint"]{
  box-shadow:inset 0 1px 0 rgba(255,255,255,.9),inset 0 -1px 0 rgba(0,0,0,.12),
             inset 0 0 0 1px rgba(0,0,0,.05)}
.lc[data-skin="peach"] .lc-mark,.lc[data-skin="lilac"] .lc-mark,
.lc[data-skin="pearl"] .lc-mark,.lc[data-skin="sand"] .lc-mark,
.lc[data-skin="sky"] .lc-mark,.lc[data-skin="mint"] .lc-mark{
  background:var(--on);color:var(--c1)}
/* On a pale card the name is dark ink, and dark ink does not cast a shadow
   onto the surface it is printed on — it sits in it, with light on its lower
   edge. */
.lc[data-skin="peach"] .lc-name,.lc[data-skin="lilac"] .lc-name,
.lc[data-skin="pearl"] .lc-name,.lc[data-skin="sand"] .lc-name,
.lc[data-skin="sky"] .lc-name,.lc[data-skin="mint"] .lc-name{
  text-shadow:0 .14cqw 0 rgba(255,255,255,.55)}

/* ============================================================================
   THE 3D RIG
   ----------------------------------------------------------------------------
   A card that turns has to do four things at once or it reads as a div with
   a transform on it:

     1. Both faces have to exist. A back that is just the front mirrored is
        the single clearest tell, so the back carries the QR and the terms —
        which is what the back of a real loyalty card carries.
     2. It has to have an EDGE. Two faces on one plane vanish when the card
        is side-on, which no object does. The faces sit a few pixels apart
        with a stack of slabs between them, the colour of the white core a
        printed plastic card really has.
     3. The light has to move. A highlight that stays put while the geometry
        rotates is what gives it away.
     4. The shadow has to foreshorten. A card edge-on casts almost nothing.

   HOW THE LIGHT IS KEPT HONEST
   Everything below is derived, in CSS, from five numbers on the stage:

       --c-flip   which face is up, as an angle (0 front, 180 back)
       --c-rx     lean toward or away from you
       --c-ry     lean left or right
       --c-tx     the same lean as a plain number, -1 … 1
       --c-ty

   The geometry, the glare, the foil, the coins' shadows and the contact
   shadow are all expressions of those five. They used to be set one at a
   time by a script on a 33ms timer, which meant each consumer of the card
   had its own copy of the lighting maths and they could drift apart. Now a
   script only ever writes the five numbers — or nothing at all, when the
   idle sway below is doing it — and nothing in here needs a frame loop.

   They are registered with @property so they TRANSITION: an unregistered
   custom property is a string, and a string cannot be half way between two
   values. Without the registration the card would snap from one lean to the
   next, and the idle sway would not animate at all.

   Where sin() and cos() are not supported the declarations that use them
   are dropped at parse time and the plain ones above each of them stand: a
   card that still turns and leans, lit from one fixed direction.
   ========================================================================== */
@property --c-flip{syntax:'<angle>';inherits:true;initial-value:0deg}
@property --c-rx  {syntax:'<angle>';inherits:true;initial-value:0deg}
@property --c-ry  {syntax:'<angle>';inherits:true;initial-value:0deg}
@property --c-tx  {syntax:'<number>';inherits:true;initial-value:0}
@property --c-ty  {syntax:'<number>';inherits:true;initial-value:0}

/* The stage. The five numbers live HERE, not on the rig, because the contact
   shadow is the rig's sibling and has to read them too. */
.stage3d,.cardstage{--c-flip:0deg;--c-rx:0deg;--c-ry:0deg;--c-tx:0;--c-ty:0;
  transition:--c-rx .3s cubic-bezier(.2,.8,.2,1),--c-ry .3s cubic-bezier(.2,.8,.2,1),
             --c-tx .3s cubic-bezier(.2,.8,.2,1),--c-ty .3s cubic-bezier(.2,.8,.2,1)}
.stage3d{perspective:1400px;perspective-origin:50% 44%}
/* A stage whose turn is a transition rather than a spring. The app drives
   --c-flip frame by frame from a spring so a turn can be caught half way and
   reversed; the landing page has nothing to interrupt and lets CSS do it. */
.stage3d.flips{cursor:pointer;-webkit-tap-highlight-color:transparent;
  transition:--c-rx .3s cubic-bezier(.2,.8,.2,1),--c-ry .3s cubic-bezier(.2,.8,.2,1),
             --c-tx .3s cubic-bezier(.2,.8,.2,1),--c-ty .3s cubic-bezier(.2,.8,.2,1),
             --c-flip 1s cubic-bezier(.3,.75,.25,1)}

/* Alive: a slow sway while nobody is touching it, so the edge, the light and
   the coins' shadows are all visibly doing something. It starts and ends at
   rest, which is what lets a hand take over and give it back without a
   jump. The app's is half the size — there it is somebody's own card, and a
   card that swings about is harder to read. */
.stage3d.alive{animation:cardIdle 10s ease-in-out infinite}
.cardstage.alive{animation:cardIdleSoft 9s ease-in-out infinite}
@keyframes cardIdle{
  0%,100%{--c-ry:0deg;--c-rx:0deg;--c-tx:0;--c-ty:0}
  25%{--c-ry:-15deg;--c-rx:5deg;--c-tx:-.55;--c-ty:.3}
  75%{--c-ry:15deg;--c-rx:-4deg;--c-tx:.55;--c-ty:-.25}}
@keyframes cardIdleSoft{
  0%,100%{--c-ry:0deg;--c-rx:0deg;--c-tx:0;--c-ty:0}
  25%{--c-ry:-6deg;--c-rx:2.5deg;--c-tx:-.3;--c-ty:.2}
  75%{--c-ry:6deg;--c-rx:-2deg;--c-tx:.3;--c-ty:-.15}}
/* Under a hand. The sway stops and the five numbers are the pointer's. */
.stage3d.held,.cardstage.held{animation:none}

.card3d{--thick:6px;position:relative;width:100%;aspect-ratio:1.586/1;
  transform-style:preserve-3d;will-change:transform;
  transform:rotateX(var(--c-rx)) rotateY(calc(var(--c-flip) + var(--c-ry)))}
/* The cast shadow goes on the FACES, not on the rig. A filter or a shadow on
   the rig itself would give it its own containing block and flatten the 3D
   transform of everything inside it. */
.card3d .face{position:absolute;inset:0;backface-visibility:hidden;
  -webkit-backface-visibility:hidden;border-radius:5.4% / 8.6%;
  box-shadow:0 44px 72px -30px rgba(0,0,0,.65)}
.card3d .face.front{transform:translateZ(calc(var(--thick) / 2))}
.card3d .face.back{transform:rotateY(180deg) translateZ(calc(var(--thick) / 2))}

/* The core. Five slabs between the faces: seen face-on they are hidden
   behind whichever face is up, and as the card turns their edges are what
   you see. Ivory, because that is the colour of the PVC a card is printed
   onto — a dark card with a dark edge reads as a shape, a dark card with a
   pale edge reads as a printed object. */
.card3d .slab{position:absolute;inset:0;border-radius:5.4% / 8.6%;pointer-events:none;
  transform:translateZ(var(--z,0px));
  background:linear-gradient(180deg,#F4EFE7,#CFC6B8)}

/* ── The light ───────────────────────────────────────────────────────────
   One element inside each face. It is hidden on a card that is not in a rig:
   a highlight that cannot move is the exact tell this exists to avoid.

   The glare is a soft pool whose position is the sine of the card's yaw, so
   it slides across the face as the card leans and runs off the edge as it
   turns over. The back face sees the same light from the other side, so its
   sine is negated — a card whose two faces were lit identically would be lit
   from inside. */
.lc-light{display:none}
.card3d .lc-light{display:block;position:absolute;inset:0;z-index:4;pointer-events:none;
  overflow:hidden;border-radius:inherit;
  background:radial-gradient(75% 110% at 26% 30%,rgba(255,255,255,.26),rgba(255,255,255,.06) 40%,rgba(255,255,255,0) 64%);
  background:radial-gradient(75% 110% at calc(26% - sin(calc(var(--c-flip) + var(--c-ry))) * 95%) calc(30% - var(--c-ty) * 26%),
    rgba(255,255,255,.30),rgba(255,255,255,.07) 40%,rgba(255,255,255,0) 64%)}
.card3d .face.back .lc-light{
  background:radial-gradient(75% 110% at calc(26% + sin(calc(var(--c-flip) + var(--c-ry))) * 95%) calc(30% - var(--c-ty) * 26%),
    rgba(255,255,255,.30),rgba(255,255,255,.07) 40%,rgba(255,255,255,0) 64%)}

/* The foil. A band of iridescence that is almost absent with the card flat
   and comes up as it leans — its opacity is the square of the lean — which
   is how a hologram behaves: you find it by tilting. It is deliberately a
   band and not a rainbow wash; the wash is what a sticker does. */
.card3d .lc-light:after{content:'';position:absolute;inset:-60% -80%;
  background:linear-gradient(105deg,transparent 31%,
    hsl(275 95% 78% / .5) 41%,hsl(190 95% 72% / .46) 48%,
    hsl(48 100% 74% / .5) 55%,hsl(330 95% 76% / .46) 62%,transparent 72%);
  mix-blend-mode:color-dodge;opacity:.08;
  opacity:calc(.05 + (var(--c-tx) * var(--c-tx) + var(--c-ty) * var(--c-ty)) * .27);
  transform:translate3d(calc(sin(calc(var(--c-flip) + var(--c-ry))) * -55%),calc(var(--c-ty) * 8%),0)}
/* color-dodge against a pale surface burns out to white, so the pale skins
   take the foil as a tint instead. */
.lc[data-skin="peach"] .lc-light:after,.lc[data-skin="lilac"] .lc-light:after,
.lc[data-skin="pearl"] .lc-light:after,.lc[data-skin="sand"] .lc-light:after,
.lc[data-skin="sky"] .lc-light:after,.lc[data-skin="mint"] .lc-light:after{
  mix-blend-mode:multiply;filter:saturate(.7)}

/* Depth inside the face. What is printed on the card shifts a little against
   the card as it leans, the stamps most and the name least, so the layers
   separate. It is a 2D shift driven by the lean rather than real translateZ:
   the face clips its contents, and a clipping box flattens 3D. */
.card3d .lc-top{transform:translate3d(calc(var(--c-tx) * -.6cqw),calc(var(--c-ty) * -.5cqw),0)}
.card3d .lc-reward{transform:translate3d(calc(var(--c-tx) * -.9cqw),calc(var(--c-ty) * -.7cqw),0)}
.card3d .lc-slots{transform:translate3d(calc(var(--c-tx) * -1.5cqw),calc(var(--c-ty) * -1.1cqw),0)}

/* A stamp landing knocks the whole card back a hair. `scale` and `translate`
   rather than `transform`, which belongs to the five numbers and would
   otherwise be overwritten for the length of the animation. */
.card3d.hit{animation:cardHit .56s .2s cubic-bezier(.2,.8,.2,1)}
@keyframes cardHit{28%{scale:.972;translate:0 .7%}}

/* The contact shadow, squashed and faded by the same yaw — cos² of it, which
   is 1 face-on and 0 edge-on whichever face is up — and nudged the way the
   card leans. */
.card3d-shadow{position:absolute;left:8%;right:8%;bottom:-9%;height:16%;
  background:radial-gradient(closest-side,rgba(25,14,46,.38),rgba(25,14,46,0) 76%);
  filter:blur(10px);will-change:transform,opacity;z-index:-1;
  opacity:.9;
  opacity:calc(.25 + cos(calc(var(--c-flip) + var(--c-ry))) * cos(calc(var(--c-flip) + var(--c-ry))) * .7);
  transform:translate3d(calc(var(--c-tx) * -5%),0,0)
            scaleX(calc(.38 + cos(calc(var(--c-flip) + var(--c-ry))) * cos(calc(var(--c-flip) + var(--c-ry))) * .62))}

@media (prefers-reduced-motion:reduce){
  .stage3d.alive,.cardstage.alive{animation:none}
  .lc-slot.just,.lc-slot.just:after,.card3d.hit{animation:none}
  .lc-slot.just:after{display:none}
}

/* ── The back ────────────────────────────────────────────────────────────
   What the back of a loyalty card is actually for: who it belongs to, which
   shop and which branch honours it, and the code the counter scans. It is
   plainer than the front on purpose — the front sells, the back is read at
   the till.

   No magstripe. A stripe says "swipe me", and nothing about this card is
   swiped; it was decoration pretending to be an affordance. */
.lc-back{display:grid;grid-template-columns:1fr auto;gap:5%;
  align-items:start;height:100%}
.lc-b-who{display:flex;flex-direction:column;gap:3.4cqw;min-width:0}
.lc-b-field{min-width:0}
.lc-b-field b{display:block;font-size:2.6cqw;font-weight:600;letter-spacing:.17em;
  text-transform:uppercase;opacity:.56;margin-bottom:.9cqw}
.lc-b-field span{display:block;font-size:4cqw;font-weight:500;letter-spacing:-.02em;
  line-height:1.15;overflow-wrap:anywhere}
/* The shop's name is the one thing on this side that has to be readable
   across a counter, so it is the only thing set larger than its label. */
.lc-b-field.lead span{font-size:4.9cqw;font-weight:600;letter-spacing:-.028em}
.lc-b-field.sm span{font-size:3.4cqw;font-weight:450;opacity:.84}
/* THE QUIET ZONE IS NOT PADDING, IT IS PART OF THE CODE.
   A QR needs four clear modules of white around it or a scanner has nothing to
   lock onto. qrcodejs draws none, so this plate's padding IS that margin, and
   it has to be ≥ 4/37 of the code's own width — about 8.9% of the plate once
   you solve for it. It was 1.4cqw against a 23cqw code: 2.2 modules, barely
   half of what the standard asks for.

   The card is also the wrong place to scan from. A customer's phone showing a
   37-module code at 88px is a third of a millimetre per module, which a staff
   phone held over it will often fail to read — so tapping it opens the
   full-screen version, which is the one actually meant to be scanned. */
.lc-qr{width:32cqw;aspect-ratio:1;border-radius:2.4cqw;background:#fff;padding:3cqw;
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
  cursor:pointer;-webkit-tap-highlight-color:transparent}
.lc-qr svg,.lc-qr canvas,.lc-qr img{
  width:100%!important;height:100%!important;display:block;border-radius:1px}
/* qrcodejs draws the code twice — a canvas and an <img> of the same thing, so
   that one works wherever the other does not. Both are left in place and one
   is simply hidden, because which of the two is the live one differs by
   browser and picking the wrong one leaves an empty white square. */
.lc-qr canvas + img{display:none}
.lc-fine{grid-column:1/-1;align-self:end;font-size:2.4cqw;line-height:1.45;
  opacity:.52;font-weight:450;margin:0}

/* On a pale skin the QR tile would be white on near-white, so it gets the
   card's own ink as a hairline to sit in. */
.lc[data-skin="peach"] .lc-qr,.lc[data-skin="lilac"] .lc-qr,
.lc[data-skin="pearl"] .lc-qr,.lc[data-skin="sand"] .lc-qr,
.lc[data-skin="sky"] .lc-qr,.lc[data-skin="mint"] .lc-qr{
  box-shadow:0 0 0 1px color-mix(in srgb,var(--on) 22%,transparent)}

/* The next empty circle is a target when the shop is looking at the card.
   Never on the customer's own copy — see the onSlot option in app.js. */
.lc-slot.tappable{cursor:pointer;-webkit-tap-highlight-color:transparent;
  transition:transform 110ms ease-out,background-color 110ms ease-out}
.lc-slot.tappable:hover{background:color-mix(in srgb,var(--on) 16%,transparent)}
.lc-slot.tappable:active{transform:scale(.92)}
.lc-slot.tappable:focus-visible{outline:2px solid var(--on);outline-offset:3px}
