# Coffee loyalty stamp card

> A kraft café card with eight slots: each tap presses an ink stamp and the last one unlocks a free coffee.

- Category: [Cards](https://library.aimran.es/components/cards)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-card-coffee-stamps
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Loyalty cards still live in wallets because stamping them feels good. This one keeps the kraft paper, dashed circles and rubber stamps, built with layered gradients and inline SVG cups. Each press drops a stamp with a slight random angle and a squash, and a live counter reads the progress. It suits cafés, bakeries, gyms and app rewards.

The main color is the stamp ink and the button, the second color the card stock. Change the café name and the reward line, or reduce the slots for shorter programs.

## Code

### HTML

```html
<article class="uvq07-stp"><header><div><p class="k">Loyalty card</p><h3>Tostadero Nube</h3></div><span class="lg" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5"/></svg></span></header><ol aria-label="Stamps"><li class="on" style="--r:-12deg"><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5"/></svg></span></li><li class="on" style="--r:8deg"><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5"/></svg></span></li><li class="on" style="--r:-4deg"><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5"/></svg></span></li><li class="on" style="--r:14deg"><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5"/></svg></span></li><li class="on" style="--r:-9deg"><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5"/></svg></span></li><li style="--r:5deg"><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5"/></svg></span></li><li style="--r:-15deg"><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5"/></svg></span></li><li data-g="" style="--r:10deg"><em>Free</em><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="9" width="16" height="11" rx="1.5"/><path d="M3 9h18M12 9v11M12 9c-1.5-4-6-4-5-1.5S12 9 12 9zm0 0c1.5-4 6-4 5-1.5S12 9 12 9z"/></svg></span></li></ol><div class="ft"><p class="ct" aria-live="polite"><b>5</b> of 8 stamps</p><button type="button" data-a="Stamp" data-b="Start over">Stamp</button></div><p class="fr">Your next coffee is free</p></article>
```

### CSS

```css
.uvq07-stp {
  --c1: #b5452f;
  --c2: #ead9bd;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq07-stp {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 17em;
  padding: 1.2em;
  border-radius: .8em;
  color: #3b2a1d;
  background: radial-gradient(rgba(90,60,30,.13) .6px,transparent 1px) 0 0/5px 5px,radial-gradient(rgba(255,255,255,.35) .6px,transparent 1px) 2px 3px/7px 7px,linear-gradient(160deg,color-mix(in srgb,var(--c2) 80%,#fff),var(--c2));
  box-shadow: 0 1.2em 2em -1.2em rgba(60,40,20,.55),inset 0 0 0 1px rgba(59,42,29,.12);
}

.uvq07-stp header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .6em;
}

.uvq07-stp .k {
  margin: 0;
  font-size: .62em;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .7;
}

.uvq07-stp h3 {
  margin: .2em 0 0;
  font: 700 1.3em/1.1 "Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;
  letter-spacing: -.01em;
}

.uvq07-stp .lg {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.4em;
  height: 2.4em;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: .75;
}

.uvq07-stp .lg svg {
  width: 1.3em;
  height: 1.3em;
}

.uvq07-stp ol {
  list-style: none;
  margin: 1.1em 0 .9em;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: .6em;
}

.uvq07-stp li {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px dashed rgba(59,42,29,.35);
}

.uvq07-stp li em {
  position: absolute;
  font-size: .52em;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .55;
  transition: opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-stp li.on em {
  opacity: 0;
}

.uvq07-stp li>span {
  display: grid;
  place-items: center;
  width: 88%;
  aspect-ratio: 1;
  border-radius: 50%;
  color: var(--c1);
  border: .15em solid currentColor;
  box-shadow: inset 0 0 0 .14em color-mix(in srgb,var(--c2) 60%,transparent),0 0 0 .08em color-mix(in srgb,var(--c1) 30%,transparent);
  transform: rotate(var(--r)) scale(.4);
  opacity: 0;
  mix-blend-mode: multiply;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-stp li svg {
  width: 56%;
  height: 56%;
}

.uvq07-stp li.on>span {
  opacity: .88;
  transform: rotate(var(--r));
}

.uvq07-stp li.new>span {
  animation: uvq07-stp calc(0.45s / var(--k)) cubic-bezier(.2,.9,.3,1.2);
}

.uvq07-stp .ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6em;
}

.uvq07-stp .ct {
  margin: 0;
  font-size: .82em;
}

.uvq07-stp .ct b {
  font-size: 1.3em;
  font-variant-numeric: tabular-nums;
}

.uvq07-stp button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: .6em 1.1em;
  border-radius: .5em;
  font-size: .88em;
  font-weight: 700;
  color: #fff;
  background: var(--c1);
  box-shadow: 0 .25em 0 color-mix(in srgb,var(--c1) 60%,#000);
  transition: transform calc(0.12s / var(--k)) cubic-bezier(.25,.1,.25,1),box-shadow calc(0.12s / var(--k)) cubic-bezier(.25,.1,.25,1),filter calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-stp button:hover {
  filter: brightness(1.08);
}

.uvq07-stp button:active {
  transform: translateY(.2em);
  box-shadow: 0 .05em 0 color-mix(in srgb,var(--c1) 60%,#000);
}

.uvq07-stp button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-stp .fr {
  display: none;
  margin: .9em 0 0;
  padding: .5em .7em;
  border-radius: .4em;
  font-size: .8em;
  font-weight: 700;
  text-align: center;
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 12%,transparent);
}

.uvq07-stp.full .fr {
  display: block;
  animation: uvq07-stp-f calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

@keyframes uvq07-stp {
  0% {
    opacity: 0;
    transform: rotate(var(--r)) scale(2.2);
  }
  55% {
    opacity: 1;
    transform: rotate(var(--r)) scale(.9);
  }
  100% {
    transform: rotate(var(--r)) scale(1);
  }
}

@keyframes uvq07-stp-f {
  from {
    opacity: 0;
    transform: scale(.9);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq07-stp,.uvq07-stp *,.uvq07-stp *::before,.uvq07-stp *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
```

### JavaScript

```js
document.querySelectorAll(".uvq07-stp").forEach(el => {
  const li=[...el.querySelectorAll("li")],n=el.querySelector(".ct b"),b=el.querySelector("button");let k=5;
const draw=()=>{li.forEach((x,i)=>x.classList.toggle("on",i<k));n.textContent=String(k);el.classList.toggle("full",k===li.length);b.textContent=k===li.length?b.dataset.b:b.dataset.a};
b.addEventListener("click",()=>{if(k===li.length){k=0;li.forEach(x=>x.classList.remove("new"));draw();return}const x=li[k];k++;draw();x.classList.remove("new");void x.offsetWidth;x.classList.add("new")})
});
```

### React

```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq07-stp {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 17em;
  padding: 1.2em;
  border-radius: .8em;
  color: #3b2a1d;
  background: radial-gradient(rgba(90,60,30,.13) .6px,transparent 1px) 0 0/5px 5px,radial-gradient(rgba(255,255,255,.35) .6px,transparent 1px) 2px 3px/7px 7px,linear-gradient(160deg,color-mix(in srgb,var(--c2) 80%,#fff),var(--c2));
  box-shadow: 0 1.2em 2em -1.2em rgba(60,40,20,.55),inset 0 0 0 1px rgba(59,42,29,.12);
}

.uvq07-stp header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .6em;
}

.uvq07-stp .k {
  margin: 0;
  font-size: .62em;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .7;
}

.uvq07-stp h3 {
  margin: .2em 0 0;
  font: 700 1.3em/1.1 "Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;
  letter-spacing: -.01em;
}

.uvq07-stp .lg {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.4em;
  height: 2.4em;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: .75;
}

.uvq07-stp .lg svg {
  width: 1.3em;
  height: 1.3em;
}

.uvq07-stp ol {
  list-style: none;
  margin: 1.1em 0 .9em;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: .6em;
}

.uvq07-stp li {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px dashed rgba(59,42,29,.35);
}

.uvq07-stp li em {
  position: absolute;
  font-size: .52em;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .55;
  transition: opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-stp li.on em {
  opacity: 0;
}

.uvq07-stp li>span {
  display: grid;
  place-items: center;
  width: 88%;
  aspect-ratio: 1;
  border-radius: 50%;
  color: var(--c1);
  border: .15em solid currentColor;
  box-shadow: inset 0 0 0 .14em color-mix(in srgb,var(--c2) 60%,transparent),0 0 0 .08em color-mix(in srgb,var(--c1) 30%,transparent);
  transform: rotate(var(--r)) scale(.4);
  opacity: 0;
  mix-blend-mode: multiply;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-stp li svg {
  width: 56%;
  height: 56%;
}

.uvq07-stp li.on>span {
  opacity: .88;
  transform: rotate(var(--r));
}

.uvq07-stp li.new>span {
  animation: uvq07-stp calc(0.45s / var(--k)) cubic-bezier(.2,.9,.3,1.2);
}

.uvq07-stp .ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6em;
}

.uvq07-stp .ct {
  margin: 0;
  font-size: .82em;
}

.uvq07-stp .ct b {
  font-size: 1.3em;
  font-variant-numeric: tabular-nums;
}

.uvq07-stp button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: .6em 1.1em;
  border-radius: .5em;
  font-size: .88em;
  font-weight: 700;
  color: #fff;
  background: var(--c1);
  box-shadow: 0 .25em 0 color-mix(in srgb,var(--c1) 60%,#000);
  transition: transform calc(0.12s / var(--k)) cubic-bezier(.25,.1,.25,1),box-shadow calc(0.12s / var(--k)) cubic-bezier(.25,.1,.25,1),filter calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-stp button:hover {
  filter: brightness(1.08);
}

.uvq07-stp button:active {
  transform: translateY(.2em);
  box-shadow: 0 .05em 0 color-mix(in srgb,var(--c1) 60%,#000);
}

.uvq07-stp button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-stp .fr {
  display: none;
  margin: .9em 0 0;
  padding: .5em .7em;
  border-radius: .4em;
  font-size: .8em;
  font-weight: 700;
  text-align: center;
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 12%,transparent);
}

.uvq07-stp.full .fr {
  display: block;
  animation: uvq07-stp-f calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

@keyframes uvq07-stp {
  0% {
    opacity: 0;
    transform: rotate(var(--r)) scale(2.2);
  }
  55% {
    opacity: 1;
    transform: rotate(var(--r)) scale(.9);
  }
  100% {
    transform: rotate(var(--r)) scale(1);
  }
}

@keyframes uvq07-stp-f {
  from {
    opacity: 0;
    transform: scale(.9);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq07-stp,.uvq07-stp *,.uvq07-stp *::before,.uvq07-stp *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const li=[...el.querySelectorAll("li")],n=el.querySelector(".ct b"),b=el.querySelector("button");let k=5;
const draw=()=>{li.forEach((x,i)=>x.classList.toggle("on",i<k));n.textContent=String(k);el.classList.toggle("full",k===li.length);b.textContent=k===li.length?b.dataset.b:b.dataset.a};
b.addEventListener("click",()=>{if(k===li.length){k=0;li.forEach(x=>x.classList.remove("new"));draw();return}const x=li[k];k++;draw();x.classList.remove("new");void x.offsetWidth;x.classList.add("new")})
}

export default function CardCoffeeStamps() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#b5452f",
          "--c2": "#ead9bd",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <article className="uvq07-stp"><header><div><p className="k">Loyalty card</p><h3>Tostadero Nube</h3></div><span className="lg" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></header><ol aria-label="Stamps"><li className="on" style={{ "--r": "-12deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li className="on" style={{ "--r": "8deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li className="on" style={{ "--r": "-4deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li className="on" style={{ "--r": "14deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li className="on" style={{ "--r": "-9deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li style={{ "--r": "5deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li style={{ "--r": "-15deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li data-g="" style={{ "--r": "10deg" } as CSSProperties}><em>Free</em><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><rect x="4" y="9" width="16" height="11" rx="1.5" /><path d="M3 9h18M12 9v11M12 9c-1.5-4-6-4-5-1.5S12 9 12 9zm0 0c1.5-4 6-4 5-1.5S12 9 12 9z" /></svg></span></li></ol><div className="ft"><p className="ct" aria-live="polite"><b>5</b> of 8 stamps</p><button type="button" data-a="Stamp" data-b="Start over">Stamp</button></div><p className="fr">Your next coffee is free</p></article>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Coffee loyalty stamp card” block (Cards) from AIMRAN Library to my project.

## What it is
A kraft café card with eight slots: each tap presses an ink stamp and the last one unlocks a free coffee.

## Chosen settings
- Main color: #b5452f
- Secondary color: #ead9bd
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Tostadero Nube"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq07-stp {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 17em;
  padding: 1.2em;
  border-radius: .8em;
  color: #3b2a1d;
  background: radial-gradient(rgba(90,60,30,.13) .6px,transparent 1px) 0 0/5px 5px,radial-gradient(rgba(255,255,255,.35) .6px,transparent 1px) 2px 3px/7px 7px,linear-gradient(160deg,color-mix(in srgb,var(--c2) 80%,#fff),var(--c2));
  box-shadow: 0 1.2em 2em -1.2em rgba(60,40,20,.55),inset 0 0 0 1px rgba(59,42,29,.12);
}

.uvq07-stp header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .6em;
}

.uvq07-stp .k {
  margin: 0;
  font-size: .62em;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .7;
}

.uvq07-stp h3 {
  margin: .2em 0 0;
  font: 700 1.3em/1.1 "Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;
  letter-spacing: -.01em;
}

.uvq07-stp .lg {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.4em;
  height: 2.4em;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: .75;
}

.uvq07-stp .lg svg {
  width: 1.3em;
  height: 1.3em;
}

.uvq07-stp ol {
  list-style: none;
  margin: 1.1em 0 .9em;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: .6em;
}

.uvq07-stp li {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px dashed rgba(59,42,29,.35);
}

.uvq07-stp li em {
  position: absolute;
  font-size: .52em;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .55;
  transition: opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-stp li.on em {
  opacity: 0;
}

.uvq07-stp li>span {
  display: grid;
  place-items: center;
  width: 88%;
  aspect-ratio: 1;
  border-radius: 50%;
  color: var(--c1);
  border: .15em solid currentColor;
  box-shadow: inset 0 0 0 .14em color-mix(in srgb,var(--c2) 60%,transparent),0 0 0 .08em color-mix(in srgb,var(--c1) 30%,transparent);
  transform: rotate(var(--r)) scale(.4);
  opacity: 0;
  mix-blend-mode: multiply;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-stp li svg {
  width: 56%;
  height: 56%;
}

.uvq07-stp li.on>span {
  opacity: .88;
  transform: rotate(var(--r));
}

.uvq07-stp li.new>span {
  animation: uvq07-stp calc(0.45s / var(--k)) cubic-bezier(.2,.9,.3,1.2);
}

.uvq07-stp .ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6em;
}

.uvq07-stp .ct {
  margin: 0;
  font-size: .82em;
}

.uvq07-stp .ct b {
  font-size: 1.3em;
  font-variant-numeric: tabular-nums;
}

.uvq07-stp button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: .6em 1.1em;
  border-radius: .5em;
  font-size: .88em;
  font-weight: 700;
  color: #fff;
  background: var(--c1);
  box-shadow: 0 .25em 0 color-mix(in srgb,var(--c1) 60%,#000);
  transition: transform calc(0.12s / var(--k)) cubic-bezier(.25,.1,.25,1),box-shadow calc(0.12s / var(--k)) cubic-bezier(.25,.1,.25,1),filter calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-stp button:hover {
  filter: brightness(1.08);
}

.uvq07-stp button:active {
  transform: translateY(.2em);
  box-shadow: 0 .05em 0 color-mix(in srgb,var(--c1) 60%,#000);
}

.uvq07-stp button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-stp .fr {
  display: none;
  margin: .9em 0 0;
  padding: .5em .7em;
  border-radius: .4em;
  font-size: .8em;
  font-weight: 700;
  text-align: center;
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 12%,transparent);
}

.uvq07-stp.full .fr {
  display: block;
  animation: uvq07-stp-f calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

@keyframes uvq07-stp {
  0% {
    opacity: 0;
    transform: rotate(var(--r)) scale(2.2);
  }
  55% {
    opacity: 1;
    transform: rotate(var(--r)) scale(.9);
  }
  100% {
    transform: rotate(var(--r)) scale(1);
  }
}

@keyframes uvq07-stp-f {
  from {
    opacity: 0;
    transform: scale(.9);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq07-stp,.uvq07-stp *,.uvq07-stp *::before,.uvq07-stp *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const li=[...el.querySelectorAll("li")],n=el.querySelector(".ct b"),b=el.querySelector("button");let k=5;
const draw=()=>{li.forEach((x,i)=>x.classList.toggle("on",i<k));n.textContent=String(k);el.classList.toggle("full",k===li.length);b.textContent=k===li.length?b.dataset.b:b.dataset.a};
b.addEventListener("click",()=>{if(k===li.length){k=0;li.forEach(x=>x.classList.remove("new"));draw();return}const x=li[k];k++;draw();x.classList.remove("new");void x.offsetWidth;x.classList.add("new")})
}

export default function CardCoffeeStamps() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#b5452f",
          "--c2": "#ead9bd",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <article className="uvq07-stp"><header><div><p className="k">Loyalty card</p><h3>Tostadero Nube</h3></div><span className="lg" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></header><ol aria-label="Stamps"><li className="on" style={{ "--r": "-12deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li className="on" style={{ "--r": "8deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li className="on" style={{ "--r": "-4deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li className="on" style={{ "--r": "14deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li className="on" style={{ "--r": "-9deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li style={{ "--r": "5deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li style={{ "--r": "-15deg" } as CSSProperties}><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 9h11v5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5zM16 11h1.5a2.5 2.5 0 0 1 0 5H16M8.5 3.5c0 1 1 1.5 1 2.5M12 3.5c0 1 1 1.5 1 2.5" /></svg></span></li><li data-g="" style={{ "--r": "10deg" } as CSSProperties}><em>Free</em><span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><rect x="4" y="9" width="16" height="11" rx="1.5" /><path d="M3 9h18M12 9v11M12 9c-1.5-4-6-4-5-1.5S12 9 12 9zm0 0c1.5-4 6-4 5-1.5S12 9 12 9z" /></svg></span></li></ol><div className="ft"><p className="ct" aria-live="polite"><b>5</b> of 8 stamps</p><button type="button" data-a="Stamp" data-b="Start over">Stamp</button></div><p className="fr">Your next coffee is free</p></article>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
