/* La carte de fidélité (option Fidélité, 09/11/2026). Mouvement du labo (labo-animations/fidelite.html), couleurs du thème.
   Brillance fixe (arête, ombre douce) ; un seul éclat bref, quand la récompense est prête ; rien en « réduire les animations ». */
.fid-btn { position: relative; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
.header__inner .fid-btn { margin-left: auto; }
.header__inner .hdr-fav:not([hidden]) ~ .fid-btn { margin-left: 0; }
.fid-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fid-btn__pt { position: absolute; top: 7px; right: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
.fid-btn__pt[hidden] { display: none; }
.fid-btn--flotte { position: fixed; top: calc(76px + env(safe-area-inset-top)); right: 14px; z-index: 35; width: 44px; height: 44px; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, .38); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.style-drop .fid-btn, .style-maison .fid-btn { color: #fff; }
.style-maison .fid-btn { color: #C9A35A; }

html.fid-ouverte, html.fid-ouverte body { overflow: hidden; }
.fid { position: fixed; inset: 0; z-index: 75; background: var(--bg); color: var(--ink); overflow: hidden; perspective: 1100px; perspective-origin: 50% 20%;
  padding-top: env(safe-area-inset-top); opacity: 0; transition: opacity .3s ease; touch-action: pan-y; overscroll-behavior: none;
  --vole: cubic-bezier(.6, .02, .2, 1); --doux: cubic-bezier(.22, 1, .36, 1); }
.fid.is-open { opacity: 1; }
.fid[hidden] { display: none; }
.fid__haut { position: absolute; left: 0; right: 0; top: calc(10px + env(safe-area-inset-top)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 12px; z-index: 12; font-family: var(--font-ui); font-size: 16px; text-align: center; }
.fid__x { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); border: 0; cursor: pointer; }
.fid__x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* Les cartes */
.fid-carte { position: absolute; left: 0; top: 0; border-radius: 22px; overflow: hidden; will-change: transform; color: var(--accent-ink); background: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 18px 40px rgba(0, 0, 0, .28); cursor: pointer; font-family: var(--font-ui); }
.fid-carte--dos1 { background: var(--accent2); }
.fid-carte--dos2 { background: var(--ink); }
.fid.anime .fid-carte { transition: transform .8s var(--vole), opacity .6s ease, width .8s var(--vole), height .8s var(--vole), filter .6s; }
.fid.suit .fid-carte { transition: none !important; }
.fid-carte__motif { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .5s; }
.fid[data-mode="ouvert"] .fid-carte--face .fid-carte__motif { opacity: .55; }
.fid-carte__vert { position: absolute; right: 14px; bottom: 16px; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 9px; letter-spacing: .16em; font-weight: 700; opacity: .9; transition: opacity .25s; }
.fid-carte__vert b { display: block; font-size: 17px; letter-spacing: .08em; margin-left: 2px; }
.fid[data-mode="ouvert"] .fid-carte__vert { opacity: 0; }
.fid-carte__infos { position: absolute; inset: 0; padding: 16px 20px; display: flex; flex-direction: column; opacity: 0; transition: opacity .35s; }
.fid[data-mode="ouvert"] .fid-carte__infos { opacity: 1; transition-delay: .35s; }
.fid-carte__nom { font-family: var(--font-title); text-transform: var(--title-case); font-size: 17px; line-height: 1.1; letter-spacing: -.01em; }
.fid-carte__lib { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; opacity: .78; margin-top: 3px; }
.fid-carte__val { font-size: 38px; font-weight: 700; letter-spacing: -.03em; margin-top: auto; line-height: 1; font-variant-numeric: tabular-nums; }
.fid-carte__val small { font-size: 17px; font-weight: 600; opacity: .75; margin-left: 5px; }
.fid-carte__dots { display: grid; grid-template-columns: repeat(var(--n, 10), 1fr); gap: 6px; margin: 12px 0 30px; max-width: min(290px, 66%); }
.fid-carte__dots i { aspect-ratio: 1; border-radius: 50%; border: 2px solid currentColor; opacity: .45; }
.fid-carte__dots i.on { background: currentColor; opacity: 1; }
.fid-carte__barre { height: 8px; border-radius: 99px; background: color-mix(in srgb, currentColor 22%, transparent); margin: 14px 0 32px; overflow: hidden; }
.fid-carte__barre i { display: block; height: 100%; width: 0; border-radius: 99px; background: currentColor; transition: width 1s var(--doux) .5s; }
.fid-carte__num { position: absolute; left: 20px; bottom: 14px; font-size: 11px; letter-spacing: .16em; opacity: .85; }
/* L'éclat : une seule fois, quand la récompense est prête. Jamais en boucle. */
.fid-carte__eclat { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%); transform: translateX(-120%); }
.fid-carte.eclat .fid-carte__eclat { animation: fid-eclat 1s ease-out 1; }
@keyframes fid-eclat { to { transform: translateX(120%); } }

.fid__sous { position: absolute; left: 20px; right: 20px; font-family: var(--font-ui); font-size: 14px; text-align: center; color: var(--muted); opacity: 0; transition: opacity .4s; z-index: 6; }
.fid__sous b { color: var(--ink); }
.fid__sous { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fid__acts button.is-pret { background: var(--accent); color: var(--accent-ink); }
.fid__acts { position: absolute; left: 0; right: 0; display: flex; justify-content: center; gap: 10px; padding: 0 16px; opacity: 0; transform: translateY(10px); transition: opacity .4s, transform .6s var(--doux); z-index: 6; }
.fid__acts button { display: flex; align-items: center; gap: 8px; font: 700 14px var(--font-ui); color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); border: 0; border-radius: 999px; padding: 11px 16px; cursor: pointer; touch-action: manipulation; }
.fid__acts svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.fid[data-mode="ouvert"] .fid__sous, .fid[data-mode="ouvert"] .fid__acts { opacity: 1; transform: none; transition-delay: .4s; }

.fid__feuille { position: absolute; left: 8px; right: 8px; bottom: 0; max-width: 464px; margin: 0 auto; background: var(--surface); color: var(--ink); border-radius: 28px 28px 0 0;
  transform: translateY(105%); transition: transform .75s var(--doux), top .8s var(--vole); z-index: 7; display: flex; flex-direction: column; box-shadow: 0 -8px 30px rgba(0, 0, 0, .08); font-family: var(--font-ui); }
.fid[data-mode="ouvert"] .fid__feuille { transform: none; transition-delay: .18s, 0s; }
.fid.suit .fid__feuille { transition: none !important; }
.fid__poignee { width: 38px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 15%, transparent); margin: 10px auto 0; }
.fid__feuille h3 { font-family: var(--font-ui); font-size: 17px; font-weight: 800; padding: 14px 20px 4px; margin: 0; }
.fid__liste { flex: 1; overflow: auto; padding: 0 20px calc(40px + env(safe-area-inset-bottom)); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.fid__liste::-webkit-scrollbar { display: none; }
.fid-ev { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.fid-ev__ic { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-size: 18px; flex: none; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.fid-ev__t { flex: 1; font-size: 14px; font-weight: 700; }
.fid-ev__t small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.fid-ev__m { font-size: 15px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.fid-ev__m.plus { color: #1AA35A; }
.fid-ev--att .fid-ev__ic { background: color-mix(in srgb, var(--ink) 7%, var(--surface)); }
.fid__vide { color: var(--muted); font-size: 14px; line-height: 1.5; padding: 10px 0; }

.fid__code { position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-end; background: rgba(0, 0, 0, .5); animation: fid-fond .2s ease; }
.fid__code[hidden] { display: none; }
.fid__code > div { width: 100%; max-width: 480px; margin: 0 auto; background: var(--surface); color: var(--ink); border-radius: 28px 28px 0 0; padding: 26px 22px calc(22px + env(safe-area-inset-bottom)); text-align: center; animation: fid-monte .35s cubic-bezier(.22, 1, .36, 1); font-family: var(--font-ui); }
.fid__code span { font-size: 14px; color: var(--muted); font-weight: 600; }
.fid__code b { display: block; font-size: 46px; letter-spacing: .2em; margin: 12px 0 8px; padding-left: .2em; font-variant-numeric: tabular-nums; }
.fid__code small { display: block; font-size: 13px; color: var(--muted); margin-bottom: 20px; }
@keyframes fid-fond { from { background: transparent; } }
@keyframes fid-monte { from { transform: translateY(100%); } }

/* Dans le panier : ce que la commande rapporte. */
.fid-gain { display: grid; grid-template-columns: 22px 1fr; column-gap: 10px; align-items: center; margin: 12px 0; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--ink); font-size: 14px; font-weight: 700; }
.fid-gain svg { width: 22px; height: 22px; grid-row: span 2; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }
.fid-gain small { font-size: 12px; font-weight: 500; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { .fid, .fid *, .fid-gain { transition-duration: .01ms !important; animation: none !important; } }

/* le petit message (« Comment ça marche ») passe au-dessus de la carte */
html.fid-ouverte .toast { z-index: 90; bottom: calc(24px + env(safe-area-inset-bottom)); }
.fid__apercu { font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent); border-radius: 99px; padding: 5px 8px; }
.fid__haut > span { justify-self: end; }

/* Les paliers sur la carte : le tampon qui ouvre une récompense est marqué d'un anneau. */
.fid-carte__dots i.palier { box-shadow: 0 0 0 2px currentColor; opacity: .8; }
.fid-carte__dots i.palier.on { opacity: 1; }
.fid:not(.is-open) { pointer-events: none; }   /* pendant le fondu de fermeture, le toucher passe à la page */
