/* ==========================================================================
   MAB ERP — enhance.css
   Add-on animations + styles for the new sections (comparison, steps).
   Everything animated is gated behind `html.fx` (added by an inline script),
   and fully disabled under prefers-reduced-motion.
   ========================================================================== */

:root {
  --fx-blue: #1565d8;
  --fx-amber: #ffb81c;
  --fx-line: rgba(127, 127, 127, .28);
  --fx-soft: rgba(127, 127, 127, .07);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Headings changed from h4 → h3 for a valid outline: keep the same look */
.card h3, .iso-card h3 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 .5rem; font-weight: 700; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }

/* ---------- 1. Scroll progress bar ---------- */
.fx-progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 9999;
  transform-origin: 0 50%; transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--fx-blue), var(--fx-amber));
  pointer-events: none;
}

/* ---------- 2. Cursor spotlight on cards ---------- */
.fx .card, .fx .iso-card { position: relative; }
.fx .card::after, .fx .iso-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; opacity: 0; transition: opacity .35s ease;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
              rgba(255, 184, 28, .14), rgba(21, 101, 216, .06) 40%, transparent 65%);
}
.fx .card:hover::after, .fx .iso-card:hover::after { opacity: 1; }

/* ---------- 3. Floating hero tags ---------- */
@media (prefers-reduced-motion: no-preference) {
  .fx .hero-tags span { animation: fx-float 5s ease-in-out infinite; }
  .fx .hero-tags span:nth-child(2n) { animation-delay: -1.6s; }
  .fx .hero-tags span:nth-child(3n) { animation-delay: -3.2s; }
}
@keyframes fx-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }

/* ---------- 4. Dashboard: bars fill + 3D tilt ---------- */
.fx .bar i {
  transform-origin: 0 50%; transform: scaleX(0);
  transition: transform 1.4s cubic-bezier(.22, .8, .2, 1);
}
.fx .bar.fx-on i { transform: scaleX(1); }

.fx .panel {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .25s ease-out; will-change: transform;
}

/* ---------- 5. Parallax on lifecycle photos ---------- */
.fx .phase-media { overflow: hidden; }
.fx .phase-photo { scale: 1.12; translate: 0 var(--py, 0px); will-change: translate; }

/* ---------- 6. Floating CTA ---------- */
.fx-cta {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 900;
  opacity: 0; visibility: hidden; translate: 0 18px;
  transition: opacity .35s ease, translate .35s ease, visibility 0s linear .35s;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.fx-cta.show {
  opacity: 1; visibility: visible; translate: 0 0;
  transition-delay: 0s;
}

/* ---------- 7. Comparison table ---------- */
.fx-compare-wrap {
  overflow-x: auto; border: 1px solid var(--fx-line); border-radius: 18px;
  background: var(--fx-soft);
}
.fx-compare { width: 100%; min-width: 680px; border-collapse: collapse; text-align: left; }
.fx-compare th, .fx-compare td { padding: 1rem 1.1rem; border-bottom: 1px solid var(--fx-line); vertical-align: middle; }
.fx-compare thead th {
  font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85;
}
.fx-compare tbody th { font-weight: 600; }
.fx-compare tbody tr:last-child th, .fx-compare tbody tr:last-child td { border-bottom: 0; }
.fx-compare tbody tr { transition: background .2s ease; }
.fx-compare tbody tr:hover { background: var(--fx-soft); }
.fx-compare .is-mab {
  background: linear-gradient(180deg, rgba(21, 101, 216, .16), rgba(255, 184, 28, .08));
  font-weight: 600;
}
.fx-yes { color: #22c55e; font-weight: 700; }
.fx-part { color: #f59e0b; font-weight: 600; }
.fx-no { color: #ef4444; font-weight: 600; opacity: .9; }

/* ---------- 8. Getting-started steps ---------- */
.fx-steps {
  display: grid; gap: 1.25rem; list-style: none; padding: 0; margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.fx-step {
  position: relative; overflow: hidden; padding: 1.6rem 1.5rem 1.5rem;
  border: 1px solid var(--fx-line); border-radius: 18px; background: var(--fx-soft);
}
.fx-step::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--fx-blue), var(--fx-amber));
  transform-origin: 0 50%;
}
.fx-step h3 { margin: 0 0 .4rem; font-size: 1.15rem; }
.fx-step p { margin: 0; opacity: .85; }
.fx-step-n {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 1rem;
  border-radius: 50%; font-weight: 800; color: #0b1220;
  background: linear-gradient(135deg, var(--fx-amber), #ff9d00);
}
.fx .fx-step::before { transform: scaleX(0); transition: transform .9s cubic-bezier(.22, .8, .2, 1); }
.fx .fx-step-n { transform: scale(0); transition: transform .6s cubic-bezier(.34, 1.56, .64, 1); }
.fx .fx-steps.fx-on .fx-step::before { transform: scaleX(1); }
.fx .fx-steps.fx-on .fx-step-n { transform: scale(1); }
.fx .fx-step:nth-child(2)::before, .fx .fx-step:nth-child(2) .fx-step-n { transition-delay: .25s; }
.fx .fx-step:nth-child(3)::before, .fx .fx-step:nth-child(3) .fx-step-n { transition-delay: .5s; }

/* ---------- 9. FAQ: soft fade when opening ---------- */
.faq details[open] > p { animation: fx-fade .35s ease both; }
@keyframes fx-fade { from { opacity: 0; translate: 0 -6px; } to { opacity: 1; translate: 0 0; } }

/* ---------- 10. Sticky in-page navigation (scrollspy) ---------- */
html.fx { scroll-behavior: smooth; }
.pillar, #du-bordereau-a-la-facture, #coordination-projet, #questions-fonctionnalites, #open-source {
  scroll-margin-top: calc(var(--fx-sticky-top, 72px) + 64px);
}
.fx-jump {
  position: sticky; top: var(--fx-sticky-top, 72px); z-index: 50;
  background: rgba(127, 127, 127, .14);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  border-block: 1px solid var(--fx-line);
}
.fx-jump-in {
  display: flex; gap: .5rem; padding-block: .6rem;
  overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
}
.fx-jump-in::-webkit-scrollbar { display: none; }
.fx-jump a {
  flex: 0 0 auto; scroll-snap-align: start; white-space: nowrap;
  padding: .45rem .95rem; border-radius: 999px; font-size: .9rem; text-decoration: none;
  color: inherit; border: 1px solid transparent; opacity: .85;
  transition: background .25s ease, border-color .25s ease, opacity .25s ease;
}
.fx-jump a:hover { opacity: 1; border-color: var(--fx-line); }
.fx-jump a.is-active {
  opacity: 1; font-weight: 600; color: #0b1220;
  background: linear-gradient(135deg, var(--fx-amber), #ff9d00);
}

/* ---------- 11. Pillar heading: count pill + pulsing icon ring ---------- */
.fx-count {
  display: inline-block; vertical-align: middle; margin-left: .6rem;
  padding: .15rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  letter-spacing: .02em; border: 1px solid var(--fx-line); background: var(--fx-soft);
}
.fx .pillar-ico { position: relative; }
@media (prefers-reduced-motion: no-preference) {
  .fx .pillar-ico::after {
    content: ""; position: absolute; inset: -4px; border-radius: inherit; pointer-events: none;
    border: 2px solid var(--fx-amber); opacity: 0; animation: fx-ring 3.2s ease-out infinite;
  }
}
@keyframes fx-ring { 0% { transform: scale(.9); opacity: .6; } 100% { transform: scale(1.35); opacity: 0; } }

/* ---------- 12. Feature cards: icon draws itself + link ---------- */
.fx .feat .ico path {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.1s cubic-bezier(.22, .8, .2, 1) .15s;
}
.fx .feat.fx-on .ico path { stroke-dashoffset: 0; }
.fx-more {
  display: inline-block; margin-top: .75rem; font-size: .9rem; font-weight: 600;
  color: var(--fx-amber); text-decoration: none;
}
.fx-more:hover { text-decoration: underline; }

/* ---------- 13. Data-flow pipeline (BPU → facture) ---------- */
.fx-flow {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 2.2rem;
  grid-template-columns: 1fr; counter-reset: fxf;
}
.fx-flow-node {
  position: relative; padding: 2.6rem 1.4rem 1.4rem; border-radius: 18px;
  border: 1px solid var(--fx-line); background: var(--fx-soft);
  transition: opacity .6s ease, border-color .6s ease, background .6s ease, box-shadow .6s ease;
}
.fx-flow-node::before {
  counter-increment: fxf; content: counter(fxf, decimal-leading-zero);
  position: absolute; top: 1rem; left: 1.4rem; font-weight: 800; font-size: .85rem;
  letter-spacing: .08em; color: var(--fx-amber);
}
.fx-flow-node h3 { margin: 0 0 .4rem; font-size: 1.1rem; }
.fx-flow-node p { margin: 0; opacity: .85; }
.fx-flow-node:not(:last-child)::after {
  content: "↓"; position: absolute; left: 50%; bottom: -1.9rem; translate: -50% 0;
  font-size: 1.4rem; line-height: 1; color: var(--fx-line); transition: color .6s ease;
}
@media (min-width: 1000px) {
  .fx-flow { grid-template-columns: repeat(4, 1fr); gap: 2rem; }
  .fx-flow-node:not(:last-child)::after {
    content: "→"; left: auto; right: -1.5rem; bottom: auto; top: 50%; translate: 0 -50%;
  }
}
.fx .fx-flow-node { opacity: .5; }
.fx .fx-flow.fx-on .fx-flow-node {
  opacity: 1; border-color: rgba(255, 184, 28, .55);
  background: linear-gradient(180deg, rgba(21, 101, 216, .12), rgba(255, 184, 28, .06));
  box-shadow: 0 12px 34px rgba(0, 0, 0, .18);
}
.fx .fx-flow.fx-on .fx-flow-node::after { color: var(--fx-amber); }
.fx .fx-flow-node:nth-child(2), .fx .fx-flow-node:nth-child(2)::after { transition-delay: .45s; }
.fx .fx-flow-node:nth-child(3), .fx .fx-flow-node:nth-child(3)::after { transition-delay: .9s; }
.fx .fx-flow-node:nth-child(4) { transition-delay: 1.35s; }

/* ---------- Reduced motion: switch everything off ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx .bar i, .fx .fx-step::before, .fx .fx-step-n { transform: none !important; transition: none !important; }
  .fx .phase-photo { scale: 1; translate: none; }
  .fx .panel { transform: none; transition: none; }
  .faq details[open] > p { animation: none; }
  .fx-cta { transition: none; }
  html.fx { scroll-behavior: auto; }
  .fx .feat .ico path { stroke-dashoffset: 0; transition: none; }
  .fx .fx-flow-node { opacity: 1; transition: none; }
}

@media print { .fx-cta, .fx-progress { display: none !important; } }
