/* ==========================================================
   Animation « Outil de test et de suivi Factur-X »
   Livrée le 2026-10-07 ; retokenisée le 2026-11-07 sur la direction F « Ardoise ».
   Suit le thème du site (clair / sombre) par les jetons globaux.
   ========================================================== */

.fx {
  --fx-dur: 7s;
  --fx-bg: var(--bg, #EEF1F5);
  --fx-surface: var(--surface, #FFFFFF);
  --fx-ink: var(--ink, #0F1726);
  --fx-ink-2: var(--muted, #4A5870);
  --fx-line: var(--line, #D5DCE6);
  --fx-accent: var(--accent, #2A4F8A);
  --fx-accent-soft: color-mix(in srgb, var(--accent, #2A4F8A) 14%, var(--surface, #FFFFFF));
  --fx-ok: #1F7A56;
  --fx-ok-soft: #DDF2E7;
  --fx-err: #B42318;
  --fx-err-soft: #FCEBE9;
  --fx-display: var(--font-display, system-ui, sans-serif);
  --fx-body: var(--font-body, system-ui, sans-serif);
  --fx-mono: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);

  font-family: var(--fx-body);
  color: var(--fx-ink);
  background: var(--fx-bg);
  padding: clamp(16px, 3vw, 32px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .fx { --fx-ok: #5CC894; --fx-ok-soft: #173A2C; --fx-err: #FF8F80; --fx-err-soft: #3B1F23; }
}
:root[data-theme="dark"] .fx { --fx-ok: #5CC894; --fx-ok-soft: #173A2C; --fx-err: #FF8F80; --fx-err-soft: #3B1F23; }

.fx *, .fx *::before, .fx *::after { box-sizing: border-box; }

/* ---------- En-tête ---------- */
.fx__head h4 {
  font-family: var(--fx-display);
  font-weight: 500;
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  letter-spacing: -.02em;
  line-height: 1.2;
  margin: 0 0 6px;
}
.fx__head p { margin: 0; color: var(--fx-ink-2); max-width: 62ch; line-height: 1.5; }

/* ---------- Grille ---------- */
.fx__body { display: grid; gap: 16px; margin-top: 20px; }
@media (min-width: 820px) { .fx__body { grid-template-columns: 230px 1fr; gap: 20px; } }

/* ---------- Onglets ---------- */
.fx__tabs {
  list-style: none; margin: 0; padding: 0 0 4px;
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
}
@media (min-width: 820px) { .fx__tabs { flex-direction: column; overflow: visible; padding: 0; } }
.fx__tabs li { scroll-snap-align: start; flex: 0 0 auto; }

.fx__tab {
  position: relative; display: block; width: 100%;
  font: inherit; text-align: left; cursor: pointer;
  background: transparent; color: var(--fx-ink-2);
  border: 1px solid var(--fx-line); border-radius: 6px;
  padding: 9px 12px 13px; white-space: nowrap;
  transition: border-color .2s, background-color .2s, color .2s;
}
@media (min-width: 820px) { .fx__tab { white-space: normal; } }
.fx__tab strong { display: block; font-weight: 500; font-size: .95rem; }
.fx__tab small { display: none; font-size: .82rem; margin-top: 2px; }
@media (min-width: 820px) { .fx__tab small { display: block; } }
.fx__tab:hover { color: var(--fx-ink); }
.fx__tab[aria-selected="true"] { color: var(--fx-ink); background: var(--fx-surface); border-color: var(--fx-accent); }
.fx__tab:focus-visible { outline: 2px solid var(--fx-accent); outline-offset: 2px; }

.fx__bar {
  position: absolute; left: 12px; right: 12px; bottom: 5px; height: 2px;
  background: var(--fx-line); border-radius: 2px; overflow: hidden; opacity: 0;
}
.fx__fill { display: block; height: 100%; background: var(--fx-accent); transform: scaleX(0); transform-origin: left; }
.fx.is-animated .fx__tab[aria-selected="true"] .fx__bar { opacity: 1; }
.fx.is-animated .fx__tab.is-run .fx__fill { animation: fx-progress var(--fx-dur) linear forwards; }

/* ---------- Écran ---------- */
.fx__screen {
  position: relative;
  background: var(--fx-surface);
  border: 1px solid var(--fx-line);
  border-radius: 6px;
  padding: clamp(16px, 2.5vw, 28px);
  min-height: 380px;
}
.fx__note {
  position: absolute; top: 10px; right: 14px;
  font-size: .75rem; color: var(--fx-ink-2);
}
.fx-panel { display: flex; flex-direction: column; gap: 16px; height: 100%; }
.fx-panel[hidden] { display: none; }
.fx:not(.is-js) .fx-panel + .fx-panel { margin-top: 28px; padding-top: 28px; border-top: 1px dashed var(--fx-line); }
.fx-stage { flex: 1; display: grid; place-items: center; min-height: 260px; padding-top: 12px; }
.fx-cap {
  margin: 0; padding-top: 12px; border-top: 1px solid var(--fx-line);
  color: var(--fx-ink-2); font-size: .95rem; line-height: 1.5;
}
.fx-mono { font-family: var(--fx-mono); font-size: .8rem; }

/* ---------- Moteur d'animation générique ---------- */
.fx.is-animated .fx-panel.is-active .a {
  animation: fx-in .5s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--d, 0) * 1s);
}
.fx.is-animated .fx-panel.is-active .a.pop { animation-name: fx-pop; animation-duration: .45s; }
.fx.is-animated .fx-panel.is-active .g {
  animation: fx-grow .5s ease-out both;
  animation-delay: calc(var(--d, 0) * 1s);
}
.fx.is-paused .fx-panel *, .fx.is-paused .fx__fill { animation-play-state: paused !important; }

@keyframes fx-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fx-pop { 0% { opacity: 0; transform: scale(.4); } 70% { opacity: 1; transform: scale(1.15); } 100% { opacity: 1; transform: scale(1); } }
@keyframes fx-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fx-growy { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes fx-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fx-flow { to { background-position: 16px 0; } }
@keyframes fx-flowy { to { background-position: 0 16px; } }
@keyframes fx-type { from { width: 0; } }
@keyframes fx-caret { 50% { border-right-color: transparent; } }
@keyframes fx-draw { from { stroke-dashoffset: 260; } to { stroke-dashoffset: 0; } }
@keyframes fx-ring { from { transform: scale(1); opacity: .55; } to { transform: scale(2.4); opacity: 0; } }
@keyframes fx-scan { from { top: 0; opacity: .6; } 90% { opacity: .6; } to { top: 100%; opacity: 0; } }

/* Icônes de statut */
.fx-mk {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 4px; flex: 0 0 auto;
}
.fx-mk svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fx-mk--ok { background: var(--fx-ok-soft); color: var(--fx-ok); }
.fx-mk--err { background: var(--fx-err-soft); color: var(--fx-err); }

/* ---------- 1. Génération ---------- */
.s1 { width: 100%; display: grid; grid-template-columns: 1fr; gap: 14px; align-items: center; justify-items: center; }
@media (min-width: 560px) { .s1 { grid-template-columns: 1fr 64px 1fr; } }
.s1__xml {
  margin: 0; width: 100%; max-width: 280px;
  background: var(--fx-bg); border: 1px solid var(--fx-line); border-radius: 4px;
  padding: 12px 14px; line-height: 1.75; white-space: pre; overflow: hidden; color: var(--fx-ink-2);
}
.s1__xml span { display: block; }
.s1__xml b { font-weight: 500; color: var(--fx-accent); }
.s1__pipe {
  width: 2px; height: 36px;
  background: repeating-linear-gradient(180deg, var(--fx-accent) 0 8px, transparent 8px 16px);
}
@media (min-width: 560px) {
  .s1__pipe { width: 100%; height: 2px; background: repeating-linear-gradient(90deg, var(--fx-accent) 0 8px, transparent 8px 16px); }
  .fx.is-animated .fx-panel.is-active .s1__pipe { animation: fx-in .4s both, fx-flow .5s linear infinite; animation-delay: 1.8s, 1.8s; }
}
@media (max-width: 559px) {
  .fx.is-animated .fx-panel.is-active .s1__pipe { animation: fx-in .4s both, fx-flowy .5s linear infinite; animation-delay: 1.8s, 1.8s; }
}
.s1__pdf {
  position: relative; width: 100%; max-width: 190px; aspect-ratio: 1 / 1.3;
  background: var(--fx-surface); border: 1px solid var(--fx-line); border-radius: 4px;
  padding: 16px 14px; box-shadow: 7px 7px 0 -1px var(--fx-accent-soft);
  display: flex; flex-direction: column;
}
.s1__brand { width: 42%; height: 8px; border-radius: 2px; background: var(--fx-accent); transform-origin: left; }
.s1__title { font-family: var(--fx-display); font-weight: 500; font-size: .9rem; margin: 10px 0 8px; }
.s1__line { height: 6px; border-radius: 3px; background: var(--fx-line); margin: 5px 0; transform-origin: left; }
.s1__total { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: .75rem; color: var(--fx-ink-2); }
.s1__total i { display: block; width: 34%; height: 8px; border-radius: 3px; background: var(--fx-ink); transform-origin: left; }
.s1__clip {
  position: absolute; right: -14px; bottom: -14px;
  display: flex; align-items: center; gap: 6px;
  background: var(--fx-accent); color: var(--accent-ink, #fff); border-radius: 4px;
  padding: 5px 10px 5px 8px; font-family: var(--fx-mono); font-size: .72rem;
}
.s1__clip svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; fill: none; }
.s1__tag { grid-column: 1 / -1; font-size: .8rem; color: var(--fx-ink-2); margin-top: 8px; }

/* ---------- 2. Vérification ---------- */
.s2 { position: relative; width: 100%; max-width: 470px; margin: 0; padding: 0; list-style: none; }
.s2__scan { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--fx-accent); opacity: 0; pointer-events: none; }
.fx.is-animated .fx-panel.is-active .s2__scan { animation: fx-scan 3.2s ease-in-out .2s both; }
.s2 li.s2__row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px;
  padding: 9px 0; border-bottom: 1px solid var(--fx-line); font-size: .95rem;
}
.s2__detail {
  grid-column: 1 / -1; color: var(--fx-err); background: var(--fx-err-soft);
  border-radius: 4px; padding: 6px 10px; margin-top: 4px; line-height: 1.4;
}
.s2__sum {
  margin-top: 14px; display: flex; gap: 10px; align-items: center;
  font-weight: 500; font-size: .95rem;
}

/* ---------- 3. Annuaire ---------- */
.s3 { width: 100%; max-width: 440px; display: grid; gap: 14px; }
.s3__search {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--fx-line); border-radius: 6px; padding: 10px 12px; background: var(--fx-bg);
}
.s3__search svg { width: 16px; height: 16px; stroke: var(--fx-ink-2); stroke-width: 2; fill: none; flex: 0 0 auto; }
.s3__typed {
  display: inline-block; overflow: hidden; white-space: nowrap; width: 17.5ch;
  border-right: 2px solid var(--fx-accent); font-size: .88rem;
}
.fx.is-animated .fx-panel.is-active .s3__typed {
  animation: fx-type 1.3s steps(17) .3s both, fx-caret .7s step-end 6;
}
.s3__load { height: 2px; background: var(--fx-accent); border-radius: 2px; transform-origin: left; }
.fx.is-animated .fx-panel.is-active .s3__load { animation: fx-grow .9s ease-in-out 1.7s both; }
.s3__card { border: 1px solid var(--fx-accent); border-radius: 6px; padding: 14px 16px; }
.s3__card h5 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 1rem; font-weight: 500; font-family: var(--fx-body); }
.s3__card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .9rem; }
.s3__card dt { color: var(--fx-ink-2); }
.s3__card dd { margin: 0; }

/* ---------- 4. Flux ---------- */
.s4 { width: 100%; max-width: 440px; }
.s4__req { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; font-size: .9rem; }
.s4__pill { background: var(--fx-accent-soft); color: var(--fx-accent); border-radius: 4px; padding: 3px 10px; font-weight: 500; }
.s4__tl { position: relative; list-style: none; margin: 0; padding: 0 0 0 28px; }
.s4__rail { position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--fx-line); transform-origin: top; }
.fx.is-animated .fx-panel.is-active .s4__rail { animation: fx-growy 2.8s linear .7s both; }
.s4__tl li.s4__st { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: .95rem; }
.s4__dot {
  position: absolute; left: -26px; top: 50%; width: 12px; height: 12px; margin-top: -6px;
  border-radius: 50%; background: var(--fx-surface); border: 2px solid var(--fx-accent);
}
.s4__st time { color: var(--fx-ink-2); }
.s4__st--last { font-weight: 500; color: var(--fx-accent); }
.s4__st--last .s4__dot { background: var(--fx-accent); }
.s4__st--last .s4__dot::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--fx-accent); opacity: 0;
}
.fx.is-animated .fx-panel.is-active .s4__st--last .s4__dot::after { animation: fx-ring 1.6s ease-out 3.7s 3; }

/* ---------- 5. Peppol ---------- */
.s5 { width: 100%; max-width: 460px; display: grid; gap: 10px; }
.s5 svg { width: 100%; height: auto; overflow: visible; }
.s5__edge { fill: none; stroke: var(--fx-accent); stroke-width: 2; }
.s5__mesh { fill: none; stroke: var(--fx-line); stroke-width: 1.5; }
.s5__node { fill: var(--fx-surface); stroke: var(--fx-ink); stroke-width: 1.5; }
.s5__node--hub { stroke: var(--fx-accent); }
.s5__sat { fill: var(--fx-line); }
.s5__ring { fill: none; stroke: var(--fx-accent); stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.s5 text { fill: var(--fx-ink); font-family: var(--fx-body); font-size: 11px; }
.s5 text.s5__mono { font-family: var(--fx-mono); font-size: 9.5px; fill: var(--fx-ink-2); }
.fx.is-animated .fx-panel.is-active .s5__edge { stroke-dasharray: 260; animation: fx-draw .9s ease-out both; animation-delay: calc(var(--d, 0) * 1s); }
.fx.is-animated .fx-panel.is-active .s5__ring { animation: fx-ring 1.6s ease-out 2.1s 3; }
.s5__caps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.s5__caps li { display: flex; align-items: center; gap: 10px; font-size: .92rem; }

/* ---------- Mouvement réduit : états finaux, sans animation ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx *, .fx *::before, .fx *::after { animation: none !important; transition: none !important; }
}
