/* Fidelite : la carte et ses tampons. Charge uniquement par fidelity.php, apres annex.css (memes variables --an-*).
   Aucune mecanique nouvelle : N tampons = N passages ; le dernier porte le cadeau (la recompense). La carte prend la couleur secondaire du restaurant
   (celle de son en-tete de menu) et ses tampons la couleur principale, calculees pour rester lisibles (annex_theme_tokens). */
.an-lcard {
  --lc-r: 26px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  gap: 20px;
  padding: 26px 22px 22px;
  margin: 0;
  border-radius: var(--lc-r);
  background: var(--an-card);
  color: var(--an-card-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .10), 0 12px 24px -20px rgba(0, 0, 0, .42);
}
/* Filet intérieur, comme le cadre d'une carte imprimee */
.an-lcard::before {
  content: "";
  position: absolute;
  inset: 9px;
  z-index: -1;
  border: 1px solid var(--an-card-line);
  border-radius: calc(var(--lc-r) - 9px);
  pointer-events: none;
}
.an-lcard.is-ready::before { border-color: var(--an-card-accent); }
.an-lcard.is-off { filter: grayscale(.9); opacity: .6; }

.an-lcard__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.an-lcard__kind { display: block; font-size: .875rem; font-weight: 600; color: var(--an-card-muted); }
.an-lcard__resto { display: block; margin-top: 4px; font-weight: 700; font-size: 1.2rem; line-height: 1.15; overflow-wrap: anywhere; }
.an-lcard__score { flex: none; font-weight: 700; font-size: 2.9rem; line-height: .95; color: var(--an-card-accent); font-variant-numeric: lining-nums tabular-nums; }
.an-lcard__score small { font-size: 1.1rem; color: var(--an-card-muted); letter-spacing: 0; }
[dir="rtl"] .an-lcard__score { direction: ltr; }

.an-lcard__goal { display: grid; gap: 2px; }
.an-lcard__reward { margin: 0; font-weight: 700; font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2rem); line-height: 1.1; letter-spacing: -.02em; overflow-wrap: anywhere; text-wrap: balance; }
.an-lcard__after { font-size: .9375rem; color: var(--an-card-muted); }

.an-stamps { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 12px; margin: 0; }
.an-stamp {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--an-card-text) 36%, transparent);
  color: var(--an-card-muted);
  font-size: .8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.an-stamp > span { display: grid; place-items: center; grid-area: 1 / 1; }
.an-stamp svg { width: 1.3rem; height: 1.3rem; }
.an-stamp .ck, .an-stamp .gift { display: none; }
/* Passage valide : disque plein et petit anneau interieur, comme une empreinte de tampon (legere inclinaison differente a chaque fois) */
.an-stamp.fill { background: var(--an-card-accent); border-color: var(--an-card-accent); color: var(--an-card); }
.an-stamp.fill::after { content: ""; position: absolute; inset: 17%; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--an-card) 45%, transparent); }
.an-stamp.fill .n { display: none; }
.an-stamp.fill .ck { display: grid; }
.an-stamp.fill .ck svg { stroke-width: 2.4; }
.an-stamp.fill:nth-child(3n + 1) .ck { transform: rotate(-7deg); }
.an-stamp.fill:nth-child(3n + 2) .ck { transform: rotate(5deg); }
/* Dernier tampon : le cadeau */
.an-stamp--goal { border-width: 2px; border-color: var(--an-card-accent); color: var(--an-card-accent); }
.an-stamp--goal .n { display: none; }
.an-stamp--goal .gift { display: grid; }
.an-stamp--goal .gift svg { width: 1.55rem; height: 1.55rem; }
.an-stamp--goal.fill { color: var(--an-card); }
.an-stamp--goal.fill .ck { display: none; }
.an-stamp--goal.fill .gift { display: grid; }

.an-lcard__status { display: flex; align-items: center; gap: 10px; margin: 0; font-size: .9375rem; font-weight: 650; }
.an-lcard__status svg { width: 18px; height: 18px; flex: none; color: var(--an-card-accent); }
.an-lcard.is-ready .an-lcard__status { color: var(--an-card-accent); }
.an-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Action principale et informations sous la carte */
.an-below { display: grid; gap: 14px; margin-top: 20px; }
.an-facts { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: .9375rem; color: var(--an-muted); }
.an-facts span { display: inline-block; }

/* QR : tuile blanche, marge de securite de 4 modules (generee avec le QR), contraste maximal */
.an-qr { display: grid; justify-items: center; gap: 14px; text-align: center; }
.an-qr .an-h2 { margin: 0; }
.an-qr__tile { width: min(100%, 236px); aspect-ratio: 1; padding: 6px; border-radius: 14px; background: #fff; display: grid; place-items: center; }
.an-qr__tile svg { display: block; width: 100%; height: 100%; }
.an-qr code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .9375rem; letter-spacing: .06em; color: var(--an-s-text); overflow-wrap: anywhere; }
.an-qr__fallback { font-size: .9375rem; color: var(--an-s-muted); }

@media (min-width: 720px) {
  .an-lcard { padding: 30px 30px 26px; }
}
@media (prefers-reduced-motion: no-preference) {
  .an-stamp { transition: background-color 260ms cubic-bezier(.23, 1, .32, 1), border-color 260ms cubic-bezier(.23, 1, .32, 1); }
}

/* Detail de carte : ligne de perforation et deux encoches entre la recompense et les tampons, comme sur une carte a tamponner */
.an-lcard__perf { position: relative; display: block; height: 0; margin: 2px -22px; border-top: 1.5px dashed var(--an-card-line); }
.an-lcard__perf::before, .an-lcard__perf::after { content: ""; position: absolute; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--an-bg); }
.an-lcard__perf::before { inset-inline-start: -11px; }
.an-lcard__perf::after { inset-inline-end: -11px; }
@media (min-width: 720px) { .an-lcard__perf { margin-inline: -30px; } }

/* Parcours : la carte puis la creation de la carte (ou le QR), alignes sur la meme grille ; plus de boite autour du QR ni de lien isole en bas de page */
.an-form__head { display: grid; gap: 4px; }
.an-form__head .an-h2 { margin: 0; }
.an-qr { display: grid; justify-items: start; gap: 12px; text-align: start; }
.an-qr__tile { width: min(100%, 220px); }
@media (min-width: 900px) { .an-split > div:last-child { padding-top: 6px; } }
