/* Trois formules en paquet de cartes, aux couleurs de l'atelier (palette de da.css).
   Le dialogue et le voile sont déplacés dans <body> par formules.js. */
.fm, .fm-sheet, .fm-veil {
  --fm-bg: var(--carton);
  --fm-card: var(--papier);
  --fm-line: var(--filet);
  --fm-accent: var(--rose);       /* prix, publication, bouton */
  --fm-mark: var(--encre);        /* contour de la carte recommandée, badge, clé, puces */
  --fm-fg: var(--encre);
  --fm-muted: var(--graphite);
  --fm-on-accent: var(--papier);  /* texte sur le rose et sur l'encre */
  --fm-display: var(--titre);
  --fm-body: var(--texte);
}
.fm { background: var(--fm-bg); color: var(--fm-fg); font-family: var(--fm-body); padding: 24px 16px 32px; }
.fm *, .fm-sheet * { box-sizing: border-box; }
.fm-wrap { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 899px) { .fm-wrap { min-height: calc(100svh - 56px); } }

.fm-head { display: grid; gap: 6px; max-width: 720px; }
.fm-eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: var(--fm-muted); }
.fm-title { margin: 0; font-family: var(--fm-display); font-stretch: 62%; font-weight: 800; text-transform: uppercase; font-size: clamp(2.05rem, 8.6vw, 3.8rem); line-height: .93; letter-spacing: .01em; text-wrap: balance; color: var(--fm-fg); }
.fm-lede { margin: 4px 0 0; font-size: 17px; line-height: 1.5; color: var(--fm-muted); max-width: 60ch; }

/* Le paquet */
.fm-deck { flex: 1; display: grid; align-content: center; perspective: 1000px; }
.fm-tier { position: relative; display: grid; }
.fm-tier + .fm-tier { margin-top: -10px; }
.fm-tier:nth-child(1) { --r: -1.4deg; --d: .05s; z-index: 1; }
.fm-tier:nth-child(2) { --r: .9deg;  --d: .15s; z-index: 3; }
.fm-tier:nth-child(3) { --r: -.7deg; --d: .25s; z-index: 2; }

.fm-card {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--fm-line); cursor: pointer; text-align: left;
  font: inherit; color: inherit;
  position: relative; overflow: hidden;
  background: var(--fm-card);
  padding: 15px 16px 14px;
  display: grid; gap: 7px; width: 100%;
  box-shadow: 0 18px 40px -24px color-mix(in srgb, var(--encre) 45%, transparent);
  rotate: var(--r, 0deg);
  transition: scale .35s cubic-bezier(.2,.8,.2,1), border-color .3s, opacity .25s;
  -webkit-tap-highlight-color: transparent;
}
.fm-deck.fm-wait .fm-card { opacity: 0; }
.fm-deck.fm-in .fm-card {
  animation: fm-deal .7s cubic-bezier(.2,.8,.2,1) backwards, fm-float 6s ease-in-out infinite;
  animation-delay: var(--d, 0s), calc(var(--d, 0s) + .7s);
}
.fm-reco .fm-card {
  border: 2px solid var(--fm-mark);
  box-shadow: 0 22px 50px -26px color-mix(in srgb, var(--encre) 55%, transparent);
}
.fm-card:active { scale: .98; }
.fm-card:focus-visible { outline: 2px solid var(--fm-mark); outline-offset: 3px; }
.fm-card.fm-lifted { opacity: 0; }

@keyframes fm-deal { from { translate: 0 60px; opacity: 0; } to { translate: 0 0; opacity: 1; } }
@keyframes fm-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
@keyframes fm-sheen { 0% { translate: -120% 0; } 22%, 100% { translate: 120% 0; } }

.fm-reco .fm-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, color-mix(in srgb, var(--encre) 6%, transparent) 50%, transparent 65%);
  translate: -120% 0;
  animation: fm-sheen 7s ease-in-out 1.6s infinite;
}
.fm-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--rose) 9%, transparent), transparent 60%);
  transition: opacity .3s;
}
.fm-card:hover::before { opacity: 1; }

.fm-badge { position: absolute; top: 0; right: 0; background: var(--fm-mark); color: var(--fm-on-accent); font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; padding: 4px 9px; }
.fm-row1 { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.fm-reco .fm-name { padding-top: 6px; }
.fm-name { font-family: var(--fm-display); font-stretch: 62%; font-weight: 800; text-transform: uppercase; font-size: 2.05rem; line-height: .93; letter-spacing: .01em; color: var(--fm-fg); }
.fm-price, .fm-s-price { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.fm-from, .fm-ht { font-size: 12px; color: var(--fm-muted); }
.fm-amount { font-family: var(--fm-display); font-stretch: 62%; font-weight: 800; font-size: 1.85rem; line-height: .93; color: var(--fm-accent); letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.fm-promise { font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--fm-fg); }
.fm-row3 { display: flex; align-items: center; gap: 10px; }
.fm-dur { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--fm-muted); white-space: nowrap; }
.fm-plus { width: 22px; height: 22px; flex: none; border: 1px solid var(--fm-mark); display: grid; place-items: center; color: var(--fm-mark); }

/* Réglette des six mois : hachures graphite = création, rose = publication, losange encre = la clé */
.fm-ruler { flex: 1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.fm-ruler i { display: block; height: 5px; background: color-mix(in srgb, var(--encre) 10%, transparent); position: relative; }
.fm-ruler i.b { background: repeating-linear-gradient(135deg, var(--graphite) 0 2px, transparent 2px 5px); }
.fm-ruler i.p { background: var(--fm-accent); }
.fm-ruler i.k::after { content: ""; position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; background: var(--fm-card); border: 2px solid var(--fm-mark); rotate: 45deg; }

.fm-notes { display: grid; gap: 6px; font-size: 14px; line-height: 1.5; color: var(--fm-muted); }
.fm-notes p { margin: 0; }
.fm-notes p:not(:last-child) { color: var(--fm-fg); }

/* Desktop : la main de cartes */
@media (min-width: 900px) {
  .fm { padding: 96px 48px; }
  .fm-wrap { gap: 40px; }
  .fm-deck { grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: center; padding-block: 20px; }
  .fm-tier + .fm-tier { margin-top: 0; }
  .fm-tier:nth-child(1) { --r: -3.5deg; }
  .fm-tier:nth-child(2) { --r: 0deg; }
  .fm-tier:nth-child(3) { --r: 3.5deg; }
  .fm-card { padding: 26px 24px 22px; gap: 14px; transform: rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)); transition: transform .2s ease-out, scale .35s cubic-bezier(.2,.8,.2,1), border-color .3s, opacity .25s; }
  .fm-reco .fm-card { scale: 1.04; }
  .fm-tier:hover { z-index: 4; }
  .fm-card:hover { scale: 1.06; border-color: var(--fm-mark); }
  .fm-name { font-size: 2.6rem; }
  .fm-amount { font-size: 2.2rem; }
  .fm-promise { font-size: 16px; min-height: 2.7em; }
  .fm-row1 { flex-direction: column; gap: 10px; }
  .fm-ruler i { height: 7px; }
}

/* La carte ouverte */
.fm-veil[hidden], .fm-sheet[hidden], .fm-detail[hidden] { display: none !important; }
.fm-veil { position: fixed; inset: 0; z-index: 9000; background: color-mix(in srgb, var(--salle) 72%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .35s; }
.fm-veil.fm-on { opacity: 1; }
.fm-sheet {
  position: fixed; z-index: 9001;
  inset: calc(env(safe-area-inset-top, 0px) + 12px) 12px calc(env(safe-area-inset-bottom, 0px) + 12px) 12px;
  margin: auto;
  width: min(560px, calc(100% - 24px));
  max-height: min(820px, calc(100% - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  height: fit-content;
  background: var(--fm-card); color: var(--fm-fg); font-family: var(--fm-body);
  border: 1px solid var(--fm-line);
  box-shadow: 0 40px 90px -30px color-mix(in srgb, var(--salle) 80%, transparent);
  display: flex; flex-direction: column;
  transform-origin: top left;
}
.fm-s-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px 0; }
.fm-s-count { font-size: 12px; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; color: var(--fm-muted); }
.fm-close { appearance: none; background: none; border: 1px solid var(--fm-line); color: var(--fm-fg); width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; }
.fm-close:focus-visible, .fm-navbtn:focus-visible, .fm-cta:focus-visible { outline: 2px solid var(--fm-mark); outline-offset: 2px; }
.fm-s-body { overflow-y: auto; overscroll-behavior: contain; padding: 6px 20px 18px; display: grid; gap: 16px; min-height: 0; transition: opacity .25s; }
.fm-s-name { margin: 0; font-family: var(--fm-display); font-stretch: 62%; font-weight: 800; text-transform: uppercase; font-size: clamp(2.8rem, 12vw, 3.6rem); line-height: .93; letter-spacing: .01em; }
.fm-s-promise { margin: 0; font-size: 1.15rem; font-weight: 600; line-height: 1.35; text-wrap: balance; }
.fm-s-ruler .fm-ruler i { height: 8px; }
.fm-legend { display: flex; justify-content: space-between; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--fm-muted); margin-top: 7px; }
.fm-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fm-facts li { display: flex; gap: 10px; align-items: baseline; font-size: 17px; }
.fm-facts li::before { content: ""; width: 6px; height: 6px; flex: none; background: var(--fm-mark); rotate: 45deg; translate: 0 -2px; }
.fm-s-price { gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--fm-line); padding-top: 14px; }
.fm-s-price .fm-amount { font-size: 2.6rem; }
.fm-s-price .fm-from, .fm-s-price .fm-ht { font-size: 14px; }
.fm-s-text { margin: 0; color: var(--fm-fg); font-size: 17px; line-height: 1.5; }
.fm-s-who { margin: 0; color: var(--fm-muted); font-size: 17px; line-height: 1.5; }
.fm-s-who b { color: var(--fm-fg); font-weight: 700; }
.fm-cta { display: flex; justify-content: center; align-items: center; background: var(--fm-accent); color: var(--fm-on-accent); text-decoration: none; font-weight: 700; font-size: 15px; letter-spacing: .06em; min-height: 52px; padding: 12px 18px; border-radius: 0; }
.fm-s-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--fm-line); padding: 10px 12px; }
.fm-navbtn { appearance: none; background: none; border: none; color: var(--fm-fg); cursor: pointer; font: 600 13px/1 var(--fm-body); letter-spacing: .08em; text-transform: uppercase; min-height: 44px; padding: 0 8px; display: flex; align-items: center; gap: 8px; }
.fm-navbtn[disabled] { opacity: .25; cursor: default; }
.fm-dots { display: flex; gap: 6px; }
.fm-dots i { width: 6px; height: 6px; background: var(--fm-line); rotate: 45deg; }
.fm-dots i.fm-on { background: var(--fm-mark); }

/* Stylo rouge : le prix de l'Ouverture entouré à main levée, une fois les cartes distribuées */
.fm-reco .fm-amount { position: relative; display: inline-block; }
.fm-reco .fm-card .fm-ht { margin-left: 12px; }  /* laisse passer le trait entre le prix et la mention HT */
.fm-stylo { position: absolute; left: -15%; top: -28%; width: 128%; height: 176%; overflow: visible; pointer-events: none; }
.fm-stylo path { fill: none; stroke: var(--rose); stroke-width: 2.4; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.fm-deck.fm-in .fm-reco .fm-stylo path { animation: fm-stylo .9s cubic-bezier(.45,.05,.35,1) 1.05s forwards; }
@keyframes fm-stylo { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .fm-deck.fm-in .fm-card, .fm-reco .fm-card::after { animation: none; }
  .fm-deck.fm-in .fm-reco .fm-stylo path, .fm-stylo path { animation: none; stroke-dashoffset: 0; }
  .fm-card, .fm-veil, .fm-s-body { transition: none; }
}
