/* ╔══════════════════════════════════════════════════════════════════╗
   ║  FACE DE CARTE — copie de la section cartes du Dashboard          ║
   ║  Source : apps/dashboard/src/components/admin/cards/CardFace.tsx  ║
   ║           apps/dashboard/src/app/legday.css (§ face de carte)     ║
   ║  La géométrie est en unités de conteneur (400 px = 100 cqw) : la  ║
   ║  carte garde ses proportions (ratio 1,586:1) quelle que soit la   ║
   ║  largeur de son parent, exactement comme dans le Dashboard.       ║
   ║  Aucune valeur n'a été « adaptée » : les dégradés navy et teal,   ║
   ║  les rayons, l'ombre et les assets sont ceux du Dashboard.        ║
   ╚══════════════════════════════════════════════════════════════════╝ */

.ct-faces {
  /* Jetons du Dashboard, repris tels quels pour que la copie soit fidèle. */
  --r-md: 20px;
  --r-pill: 999px;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;
  --lg-ease: cubic-bezier(.2, .8, .2, 1);
  --legday-shadow-callout-dark:
    0 16px 40px -16px rgba(15, 18, 48, .35),
    inset 0 1px 0 rgba(255, 255, 255, .14);
  display: grid;
  /* Une colonne, large de 400 px au plus — la largeur de référence du
     Dashboard. Elle est déclarée ici et non déduite du contenu : la face se
     dimensionne en unités de conteneur, donc un parent « à la largeur du
     contenu » l'écraserait à quelques pixels. */
  grid-template-columns: minmax(0, min(400px, 100%));
  justify-items: stretch;
  gap: 22px;
}

.ct-face {
  display: grid;
  gap: 12px;
  justify-items: center;
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  border-radius: 28px;
  transition: transform .2s var(--lg-ease);
}
.ct-face:active { transform: scale(.988); }
.ct-face:focus-visible { outline: 2px solid var(--c-signature, #8ea9ff); outline-offset: 6px; }

/* ══════════════════════════════════════════════════════════════════
   .cf — la face de carte du Dashboard, au caractère près
   ══════════════════════════════════════════════════════════════════ */
.cf-wrap { container-type: inline-size; width: min(400px, 100%); }
.cf {
  --cf-bg: linear-gradient(158deg, #356E9C 0%, #2A5B84 55%, #22496A 100%);
  --cf-soft: rgba(230,240,255,.62); --cf-bloom: 170,205,240; --cf-glow: rgba(34,73,106,.62);
  position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  aspect-ratio: 1.586 / 1; padding: 6cqw; border-radius: var(--r-md); color: #f5f9ff; background: var(--cf-bg);
  box-shadow: 0 22px 44px -20px var(--cf-glow), var(--legday-shadow-callout-dark); transition: filter 320ms ease;
}
.cf::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(120% 90% at 6% 0%, rgba(var(--cf-bloom),.34) 0%, transparent 56%), linear-gradient(115deg, transparent 38%, rgba(255,255,255,.07) 50%, transparent 62%); }
.cf::after { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(90% 70% at 100% 100%, rgba(0,0,0,.22) 0%, transparent 60%); }
.cf--teal { --cf-bg: linear-gradient(158deg, #1B4C46 0%, #123531 55%, #0B2723 100%); --cf-soft: rgba(224,255,247,.55); --cf-bloom: 98,184,176; --cf-glow: rgba(11,39,35,.6); }
.cf--brick { --cf-bg: linear-gradient(158deg, #A04841 0%, #8E3B36 55%, #73302C 100%); --cf-soft: rgba(255,236,232,.62); --cf-bloom: 240,160,148; --cf-glow: rgba(115,48,44,.55); }
.cf[data-status="frozen"] { filter: saturate(.45) brightness(.96); }
.cf[data-status="expired"], .cf[data-status="cancelled"] { filter: grayscale(.9) brightness(.9); }
.cf-top { display: flex; align-items: flex-start; justify-content: space-between; }
.cf-kind { color: var(--cf-soft); font-size: 2.5cqw; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.cf-brand { font-size: 4cqw; font-weight: 800; letter-spacing: -.02em; line-height: 1; opacity: .86; }
.cf-flag { padding: .7cqw 2.4cqw; border-radius: var(--r-pill); background: rgba(255,255,255,.2); font-size: 2.4cqw; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.cf-mid { display: flex; align-items: center; justify-content: space-between; }
.cf-chip { width: 11.5cqw; height: auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.cf-num { display: flex; align-items: baseline; min-height: 6.6cqw; font-family: var(--f-mono); font-size: 5.4cqw; font-weight: 600; letter-spacing: .04em; line-height: 1; text-shadow: 0 1px 1px rgba(0,0,0,.28); white-space: nowrap; }
.cf-ch { display: inline-block; animation: cf-in 300ms var(--lg-ease) both; animation-delay: calc(var(--i, 0) * 16ms); }
.cf-sp { display: inline-block; width: .6em; }
.cf-foot { display: flex; align-items: flex-end; gap: 4cqw; }
.cf-cell { display: grid; gap: .8cqw; min-width: 0; }
.cf-cell--grow { flex: 1; }
.cf-lbl { color: var(--cf-soft); font-size: 2.2cqw; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.cf-val { overflow: hidden; font-size: 3.5cqw; font-weight: 700; letter-spacing: .02em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.cf-val--mono { font-family: var(--f-mono); letter-spacing: .04em; }
.cf-net { flex: 0 0 auto; align-self: flex-end; }
.cf-net--visa { font-size: 5.4cqw; font-style: italic; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.cf-net--cb { padding: .8cqw 2.2cqw; border-radius: var(--r-pill); background: rgba(255,255,255,.2); font-size: 3.4cqw; font-weight: 800; letter-spacing: .06em; line-height: 1.2; }
.cf-net--mc { width: 10cqw; height: auto; }
.cf-timer { position: absolute; right: 0; bottom: 0; left: 0; height: 4px; background: rgba(255,255,255,.14); }
.cf-timer i { display: block; height: 100%; border-radius: var(--r-pill); background: rgba(255,255,255,.7); transition: width 260ms linear; }

/* ── Givre / fonte ─────────────────────────────────────────────────
   L'image de carte reste intacte : le givre est une couche indépendante,
   sans interaction, qui se dépose puis se retire. Le bleu glacé reprend
   la famille signature sans ajouter de couleur étrangère au système. */
.cf-frost {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 95% at 10% 4%, rgba(228, 247, 255, .52) 0%, rgba(190, 226, 255, .2) 34%, transparent 64%),
    radial-gradient(82% 72% at 92% 92%, rgba(164, 210, 255, .28) 0%, transparent 60%),
    linear-gradient(145deg, rgba(255, 255, 255, .18), transparent 44%);
  mix-blend-mode: screen;
}
.cf[data-status="frozen"] .cf-frost { opacity: .5; }
.cf[data-status="frozen"] .cf-frost::before { opacity: .5; transform: scale(1.02) rotate(-3deg); }
.cf[data-status="frozen"] .cf-frost::after { opacity: .28; }
.cf-frost::before,
.cf-frost::after {
  content: "";
  position: absolute;
  inset: -12%;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}
.cf-frost::before {
  background:
    repeating-conic-gradient(from 208deg at 18% 28%, transparent 0deg 7deg, rgba(232, 249, 255, .4) 8deg 8.8deg, transparent 9.8deg 22deg),
    repeating-conic-gradient(from 28deg at 78% 72%, transparent 0deg 10deg, rgba(207, 238, 255, .3) 11deg 11.8deg, transparent 13deg 28deg),
    radial-gradient(circle at 18% 28%, rgba(255, 255, 255, .9) 0 1px, transparent 2px),
    radial-gradient(circle at 78% 72%, rgba(255, 255, 255, .72) 0 1px, transparent 2px);
  background-size: 100% 100%, 100% 100%, 38px 34px, 52px 46px;
  transform: scale(1.14) rotate(-9deg);
}
.cf-frost::after {
  background:
    linear-gradient(118deg, transparent 0 42%, rgba(255, 255, 255, .46) 43% 43.4%, transparent 44.4% 100%),
    linear-gradient(64deg, transparent 0 62%, rgba(216, 241, 255, .3) 63% 63.5%, transparent 64.5% 100%),
    radial-gradient(circle at 28% 62%, rgba(255, 255, 255, .92) 0 1.2px, transparent 2.2px),
    radial-gradient(circle at 66% 32%, rgba(255, 255, 255, .76) 0 1px, transparent 2px);
  background-size: 100% 100%, 100% 100%, 74px 58px, 96px 72px;
}
.ct-face.is-freezing .cf { animation: cf-freeze 980ms var(--lg-ease) both; }
.ct-face.is-thawing .cf { animation: cf-thaw 900ms var(--lg-ease) both; }
.ct-face.is-freezing .cf-ch,
.ct-face.is-thawing .cf-ch { animation: none; }
html.vtex-freeze-pending .cf-ch { animation: none; }
.ct-face.is-freezing .cf-frost { animation: cf-frost-in 980ms var(--lg-ease) both; }
.ct-face.is-thawing .cf-frost { animation: cf-frost-out 900ms var(--lg-ease) both; }
.ct-face.is-freezing .cf-frost::before { animation: cf-crystal-in 980ms var(--lg-ease) both; }
.ct-face.is-thawing .cf-frost::before { animation: cf-crystal-out 900ms var(--lg-ease) both; }
.ct-face.is-freezing .cf-frost::after { animation: cf-shard-in 980ms var(--lg-ease) both; }
.ct-face.is-thawing .cf-frost::after { animation: cf-shard-out 900ms var(--lg-ease) both; }
@keyframes cf-freeze {
  0% { filter: none; transform: scale(1); }
  16% { filter: brightness(1.12) saturate(.92); transform: scale(1.012); }
  54% { filter: saturate(.32) brightness(.84) contrast(1.07); transform: scale(.994); }
  100% { filter: saturate(.45) brightness(.96); transform: scale(1); }
}
@keyframes cf-thaw {
  0% { filter: saturate(.45) brightness(.96); transform: scale(1); }
  42% { filter: saturate(1.18) brightness(1.1); transform: scale(1.006); }
  100% { filter: none; transform: scale(1); }
}
@keyframes cf-frost-in {
  0% { opacity: 0; }
  20% { opacity: .96; }
  58% { opacity: .72; }
  100% { opacity: .5; }
}
@keyframes cf-frost-out {
  0% { opacity: .5; }
  28% { opacity: .88; }
  100% { opacity: 0; }
}
@keyframes cf-crystal-in {
  0% { opacity: 0; transform: scale(1.16) rotate(-9deg); }
  34% { opacity: .92; transform: scale(1.05) rotate(-6deg); }
  100% { opacity: .56; transform: scale(1.02) rotate(-3deg); }
}
@keyframes cf-crystal-out {
  0% { opacity: .56; transform: scale(1.02) rotate(-3deg); }
  24% { opacity: .8; transform: scale(1.03) rotate(-4deg); }
  100% { opacity: 0; transform: scale(1.1) rotate(-8deg); }
}
@keyframes cf-shard-in {
  0% { opacity: 0; transform: translateX(-5%); }
  30% { opacity: .82; transform: translateX(0); }
  100% { opacity: .34; transform: none; }
}
@keyframes cf-shard-out {
  0% { opacity: .34; }
  22% { opacity: .66; }
  100% { opacity: 0; transform: translateX(4%); }
}
@keyframes cf-in { from { opacity: 0; transform: translateY(.4em); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
@media (prefers-reduced-motion: reduce) {
  .cf-ch { animation: none; }
  .cf-timer i { transition: none; }
  .ct-face.is-freezing .cf,
  .ct-face.is-thawing .cf,
  .ct-face.is-freezing .cf-frost,
  .ct-face.is-thawing .cf-frost,
  .ct-face.is-freezing .cf-frost::before,
  .ct-face.is-thawing .cf-frost::before,
  .ct-face.is-freezing .cf-frost::after,
  .ct-face.is-thawing .cf-frost::after { animation: none; }
}

/* ══════════════════════════════════════════════════════════════════
   La légende : ce que la face ne dit pas — le solde et l'état
   ══════════════════════════════════════════════════════════════════ */
.ct-face-legend {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  width: min(400px, 100%);
  padding: 0 4px;
}
.ct-face-name {
  overflow: hidden;
  color: var(--c-t1, #eef1fb);
  font-size: 14px;
  font-weight: 660;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ct-face-amount {
  flex: 0 0 auto;
  color: var(--c-t1, #eef1fb);
  font-family: var(--f-mono);
  font-size: 14px;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
}
.ct-face-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(400px, 100%);
  padding: 0 4px;
}
.ct-face-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--c-t3, #8d96b6);
  font-size: 12px;
  font-weight: 560;
}
.ct-face-state i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-positive, #5FB03E);
}
.ct-face[data-frozen="true"] .ct-face-state i { background: var(--c-orange, #E85820); }
.ct-face[data-active="true"] .ct-face-name { color: #fff; }
.ct-face[data-active="true"] .ct-face-amount { color: #fff; }
/* La sélection se lit sur la carte elle-même : un anneau, pas un trait sous
   la légende — un trait se confondrait avec un séparateur de liste. */
.ct-face[data-active="true"] .cf {
  box-shadow: 0 0 0 1px rgba(142, 169, 255, .38),
              0 0 0 9px rgba(142, 169, 255, .07),
              0 22px 44px -20px var(--cf-glow),
              var(--legday-shadow-callout-dark);
}

/* Le révélateur : quand le numéro complet est affiché, la face le dit. */
.cf[data-revealed="false"] .cf-num { color: rgba(245, 249, 255, .92); }
