/* ═══════════════════════════════════════════════════════════════════════
   Cartes de formation « Affiche d'abord » — voir assets/js/formation-cards.js.
   Chargé juste après style.css : les styles propres à chaque page passent
   après, à spécificité égale. Mouvement : transform / opacity ; survols par
   calques d'opacité.
   ═══════════════════════════════════════════════════════════════════════ */
.fo-grid {
  --fo-ink: #F5F3FF;
  --fo-mut: rgba(221, 214, 254, .66);
  --fo-acc: #A78BFA;
  --fo-hi: #C4B5FD;
  --fo-deep: #7C3AED;
  --fo-free: #34d399;
  --fo-l1: #34d399; --fo-l2: #fbbf24; --fo-l3: #fb923c;
  --fo-mono: 'JetBrains Mono', ui-monospace, monospace;
  display: grid; gap: 1.5rem; margin-top: 2rem;
}
/* 4, 3 puis 2 colonnes : 12 formations par page remplissent chaque rangée */
.fo-grid:not(.fo-reco) { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem 1.25rem; }
.fo-card { position: relative; min-width: 0; }
.fo-r { height: 100%; }
.fo-card svg { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fo-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Un seul lien par carte : le titre, étendu à toute la carte */
.fo-link { color: inherit; text-decoration: none; }
.fo-link::after { content: ''; position: absolute; inset: 0; z-index: 2; border-radius: inherit; cursor: pointer; }
.fo-link:focus-visible { outline: none; }
.fo-link:focus-visible::after { outline: 2px solid var(--fo-hi); outline-offset: 3px; }

.fo-title { margin: 0; font-family: var(--font-title); font-weight: 700; line-height: 1.18; letter-spacing: -.01em; color: var(--fo-ink); text-wrap: balance; }
.fo-kick { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .55rem; margin: 0; font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.fo-cat { color: var(--fo-acc); }
.fo-lvl { padding: .14rem .48rem; border-radius: 50px; letter-spacing: .02em; text-transform: none; font-size: .66rem; }
.fo-lvl.lv-1 { background: rgba(52, 211, 153, .12); color: var(--fo-l1); border: 1px solid rgba(52, 211, 153, .24); }
.fo-lvl.lv-2 { background: rgba(251, 191, 36, .12); color: var(--fo-l2); border: 1px solid rgba(251, 191, 36, .26); }
.fo-lvl.lv-3 { background: rgba(251, 113, 94, .12); color: var(--fo-l3); border: 1px solid rgba(251, 113, 94, .26); }
.fo-why { padding: .14rem .48rem; border-radius: 4px; background: rgba(139, 92, 246, .22); color: var(--fo-hi); letter-spacing: .04em; }
.fo-meta { display: flex; flex-wrap: wrap; gap: .3rem .85rem; margin: 0; font-size: .74rem; color: var(--fo-mut); }
.fo-meta span { display: inline-flex; align-items: center; gap: .32rem; white-space: nowrap; }
.fo-meta svg { font-size: .82rem; color: var(--fo-acc); }
.fo-lab { font: 500 .6rem/1 var(--fo-mono); letter-spacing: .13em; text-transform: uppercase; color: var(--fo-acc); }
.fo-outline { margin: 0; padding: 0; list-style: none; counter-reset: foo; display: grid; gap: .3rem; }
.fo-outline li { counter-increment: foo; display: flex; gap: .55rem; font-size: .78rem; line-height: 1.35; color: #E4DEFC; }
.fo-outline li::before { content: counter(foo, decimal-leading-zero); font: 500 .66rem/1.6 var(--fo-mono); color: var(--fo-acc); }

.fo-foot { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: auto; }
.fo-price { font-family: var(--font-title); font-weight: 700; font-size: 1.12rem; color: #fff; font-variant-numeric: tabular-nums; }
.fo-price.is-free { color: var(--fo-free); }
.fo-was { margin-left: .4rem; font-size: .76rem; color: var(--text-dim, #71717a); }
.fo-state { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 600; }
.fo-state svg { font-size: .9rem; }
.fo-state.is-prog { color: var(--fo-hi); flex-direction: column-reverse; align-items: stretch; gap: 5px; white-space: nowrap; }
.fo-state.is-prog .fo-bar { width: auto; }
.fo-state.is-done { color: #6ee7b7; flex-wrap: wrap; row-gap: 1px; }
.fo-state.is-done .fo-dim { flex-basis: 100%; padding-left: 1.35rem; font-size: .74rem; }
.fo-state.is-enr { color: var(--fo-ink); }
.fo-state.is-enr svg { fill: currentColor; stroke: none; }
.fo-narrow { display: none; }
.fo-dim { font-weight: 500; color: var(--fo-mut); }
.fo-bar { display: inline-block; width: 64px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.fo-bar b { display: block; height: 100%; background: linear-gradient(90deg, var(--fo-deep), var(--fo-hi)); transform-origin: 0 50%; }

.fo-badges { position: absolute; top: 12px; left: 12px; z-index: 3; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.fo-badge { display: inline-flex; align-items: center; gap: .32rem; padding: .32rem .55rem; border-radius: 6px; font-size: .66rem; font-weight: 700; letter-spacing: .03em;
  color: var(--fo-ink); background: rgba(10, 8, 20, .8); border: 1px solid rgba(255, 255, 255, .14); }
.fo-badge svg { font-size: .78rem; }
.fo-badge.is-pack { background: linear-gradient(135deg, rgba(124, 58, 237, .95), rgba(91, 33, 182, .95)); border-color: rgba(196, 181, 253, .45); }
.fo-badge.is-done { background: rgba(6, 78, 59, .85); color: #a7f3d0; border-color: rgba(110, 231, 183, .4); }
.fo-badge.is-prog { background: rgba(46, 16, 101, .88); color: var(--fo-hi); border-color: rgba(196, 181, 253, .4); }
.fo-badge.is-free { background: rgba(6, 78, 59, .85); color: #a7f3d0; border-color: rgba(52, 211, 153, .45); }

/* Favori : la logique de la page (toggleFav) réécrit le glyphe ; il reste masqué, l'icône est dessinée ici */
.fo-card .fo-fav {
  position: absolute; top: 10px; right: 10px; z-index: 4; width: 40px; height: 40px; border-radius: 50%;
  font-size: 0; color: #EDE9FE; background: rgba(10, 8, 20, .66); border: 1px solid rgba(255, 255, 255, .16);
  display: grid; place-items: center; cursor: pointer; transition: transform .18s, background-color .18s;
}
.fo-card .fo-fav::before {
  content: ''; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.fo-card .fo-fav.active { color: #fb7185; background: rgba(76, 5, 25, .72); border-color: rgba(251, 113, 133, .45); }
.fo-card .fo-fav.active::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z'/%3E%3C/svg%3E");
}
.fo-card .fo-fav:hover { transform: scale(1.06); background-color: rgba(46, 16, 101, .8); }
.fo-card .fo-fav:focus-visible { outline: 2px solid var(--fo-hi); outline-offset: 2px; }

/* Changement de filtre : la grille reste, atténuée */
.fo-grid > .fo-card { transition: opacity .2s; }
.fo-busy > .fo-card { opacity: .45; }
.fo-leaving { will-change: transform, opacity; }

/* ── L'affiche ─────────────────────────────────────────────────────── */
.fa { border-radius: 18px; }
.fa .fo-t {
  position: relative; overflow: hidden; border-radius: 18px; aspect-ratio: 1055 / 1491; background: #110d1f;
  transition: transform .55s cubic-bezier(.2, .8, .2, 1);
}
.fa .fo-t::after { content: ''; position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(196, 181, 253, .16), inset 0 1px 0 rgba(255, 255, 255, .14); }
.fa.is-tilt .fo-t { transition: transform .12s linear; }
.fa-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.fa-img.is-empty { display: grid; place-items: start center; padding-top: 30%; color: rgba(255, 255, 255, .18); font-size: 2.5rem; }
.fa-scrim { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(9, 7, 18, 0) 36%, rgba(9, 7, 18, .7) 52%, rgba(11, 8, 22, .95) 68%, #0b0916 100%); }
.fa-scrim::after { content: ''; position: absolute; inset: 0; background: rgba(9, 7, 18, .62); opacity: 0; transition: opacity .3s; }
.fa-sheen { position: absolute; top: -20%; bottom: -20%; left: -60%; right: -60%; z-index: 2; pointer-events: none; opacity: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .1) 47%, rgba(237, 233, 254, .22) 50%, rgba(255, 255, 255, .08) 53%, transparent 60%);
  transition: opacity .35s, transform .12s linear; }
.fa.is-tilt .fa-sheen { opacity: 1; }
.fa-panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; display: flex; flex-direction: column; gap: 7px; padding: 14px 15px 15px;
  background: linear-gradient(180deg, rgba(76, 29, 149, 0), rgba(76, 29, 149, .2)); border-top: 1px solid rgba(196, 181, 253, .1); }
.fa .fo-title { font-size: 1.02rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Programme : posé au-dessus du panneau, sur l'affiche assombrie */
.fa-more { position: absolute; left: 10px; right: 10px; bottom: calc(100% + 8px); display: grid; gap: 8px; padding: 12px 13px;
  border-radius: 12px; background: rgba(17, 12, 34, .93); border: 1px solid rgba(196, 181, 253, .24);
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .9); opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .3s cubic-bezier(.2, .8, .2, 1); pointer-events: none; }
/* une ligne par module : la boîte tient toujours sous les badges, quelle que soit la largeur */
.fa-more, .fa-more .fo-outline { grid-template-columns: minmax(0, 1fr); }
.fa-more .fo-outline li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fo-go { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--fo-hi);
  background: rgba(139, 92, 246, .2); border: 1px solid rgba(196, 181, 253, .3); transition: transform .25s; }
.fo-go svg { font-size: 15px; }
@media (hover: hover) and (pointer: fine) {
  .fa:hover .fa-more { opacity: 1; transform: none; }
  .fa:hover .fa-scrim::after { opacity: 1; }
  .fa:hover .fo-go { transform: translateX(3px); }
}
.fa:focus-within .fa-more { opacity: 1; transform: none; }
.fa:focus-within .fa-scrim::after { opacity: 1; }

/* Squelettes : même géométrie que les cartes ; reflet par translation */
.fo-skel { position: relative; overflow: hidden; aspect-ratio: 1055 / 1491; border-radius: 18px; background: #131118; border: 1px solid rgba(255, 255, 255, .06); }
.fo-skel i { position: absolute; display: block; border-radius: 4px; background: rgba(255, 255, 255, .07); }
.fo-skel i:nth-child(1) { left: 15px; bottom: 112px; width: 46%; height: 10px; }
.fo-skel i:nth-child(2) { left: 15px; bottom: 84px; width: 78%; height: 16px; }
.fo-skel i:nth-child(3) { left: 15px; bottom: 58px; width: 60%; height: 10px; }
.fo-skel i:nth-child(4) { left: 15px; bottom: 18px; width: 30%; height: 18px; }
.fo-skel::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(167, 139, 250, .09) 50%, transparent 70%);
  transform: translateX(-100%); animation: foShim 1.4s linear infinite; }
@keyframes foShim { to { transform: translateX(100%); } }

/* Aucun résultat, pagination (catalogue) */
#formations-empty { margin-top: 2rem; padding: 3rem 1.5rem; border-radius: 16px; border: 1px dashed rgba(167, 139, 250, .3);
  background: radial-gradient(60% 80% at 50% 0%, rgba(139, 92, 246, .1), transparent 70%); }
#formations-empty h3 { font-family: var(--font-title); font-size: 1.35rem; }
#formations-pagination .pagination .btn { min-height: 40px; }

/* ── « Vous pourriez aussi aimer » (fiche) : la grille de la page garde ses colonnes ── */
.fo-reco > .fo-card { animation: foIn .42s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: var(--d, 0ms); scroll-snap-align: start; }
@keyframes foIn { from { opacity: 0; transform: translateY(12px); } }
.fo-reco .fa .fo-meta span:nth-child(n+3) { display: none; }
.fo-reco .reco-skel { min-height: 0; aspect-ratio: 1055 / 1491; border-radius: 18px; }

/* ── Haut de fiche : titre à gauche, affiche à droite ──────────────── */
.fdx { --fx-hi: #C4B5FD; --fx-acc: #A78BFA; --fx-mono: 'JetBrains Mono', ui-monospace, monospace;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2.5rem; align-items: center; }
.fdx-main { min-width: 0; }
.fdx svg { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fdx-aside { width: 300px; }
.fdx-aside[hidden] { display: none; }
/* Ligne d'infos : icônes au lieu des emoji */
.fdx-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .32rem .7rem; border-radius: 50px; font-size: .8rem;
  color: #DDD6FE; background: rgba(139, 92, 246, .1); border: 1px solid rgba(167, 139, 250, .22); }
.fdx-chip svg { color: var(--fx-acc); font-size: .9rem; }
.fdx-chip[hidden] { display: none; }
.fdx #f-level:not(:empty) { display: inline-flex; align-items: center; padding: .32rem .7rem; border-radius: 50px; font-size: .8rem; color: #DDD6FE; border: 1px solid rgba(167, 139, 250, .22); }
.fdx-lab { font: 500 .6rem/1 var(--fx-mono); letter-spacing: .13em; text-transform: uppercase; color: var(--fx-acc); }
.fdx-prog { display: grid; grid-template-columns: auto 1fr auto; gap: .45rem .8rem; align-items: center; margin-top: 14px; padding: 12px 14px;
  border-radius: 10px; background: rgba(46, 16, 101, .35); border: 1px solid rgba(196, 181, 253, .25); }
.fdx-bar { height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.fdx-bar b { display: block; height: 100%; background: linear-gradient(90deg, #7C3AED, var(--fx-hi)); transform-origin: 0 50%; }
.fdx-progv { font-size: .8rem; font-weight: 600; color: var(--fx-hi); font-variant-numeric: tabular-nums; }
.fdx-poster { margin: 0; }
.fdx-pt { position: relative; overflow: hidden; border-radius: 16px; aspect-ratio: 1055 / 1491; background: #110d1f;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .95), 0 0 0 1px rgba(196, 181, 253, .18); transition: transform .55s cubic-bezier(.2, .8, .2, 1); }
.fdx-poster.is-tilt .fdx-pt { transition: transform .12s linear; }
.fdx-img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.fdx-sheen { position: absolute; top: -20%; bottom: -20%; left: -60%; right: -60%; pointer-events: none; opacity: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .1) 47%, rgba(237, 233, 254, .22) 50%, rgba(255, 255, 255, .08) 53%, transparent 60%);
  transition: opacity .35s, transform .12s linear; }
.fdx-poster.is-tilt .fdx-sheen { opacity: 1; }
.fdx-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.fdx-tags span { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: #DDD6FE; }
.fdx-tags svg { color: var(--fx-acc); }

/* ── Tablette et mobile ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .fo-grid:not(.fo-reco) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .fdx { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .fdx-aside { width: auto; max-width: 260px; }
}
@media (max-width: 760px) {
  .fo-grid:not(.fo-reco) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .fo-grid { margin-top: 1.25rem; }
  .fo-grid:not(.fo-reco) { gap: 12px; }
  .fa, .fa .fo-t, .fo-skel { border-radius: 14px; }
  .fa-panel { gap: 5px; padding: 10px 11px 11px; }
  .fa .fo-title { font-size: .9rem; }
  .fa .fo-meta span:nth-child(n+2) { display: none; }
  .fa .fo-cat { display: none; }
  .fa .fo-go, .fa-more, .fa .fo-wide { display: none; }
  .fa .fo-narrow { display: inline; }
  .fa .fo-price { font-size: 1rem; }
  .fa .fo-was { display: none; }
  .fa .fo-badges { top: 8px; left: 8px; }
  .fa .fo-fav { top: 6px; right: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .fo-skel::after { animation: none; }
  .fa .fo-t, .fa-sheen, .fa-more, .fo-go, .fdx-pt, .fdx-sheen { transition: none; }
  .fo-reco > .fo-card { animation: none; }
}
