/* ============================================================
   WOW — SYSTÈME RACINAIRE & PARTICULES
   Importé du moderne, adapté en couche de fond
   ============================================================ */

/* ---------- Conteneur de fond appliqué à chaque page ---------- */
.wr-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
  opacity: 0.85;
}

/* Empêche que les fonds passent au-dessus du contenu */
.page > * { position: relative; z-index: 1; }
.page > .wr-bg { z-index: 0; }

/* ---------- Soil particles canvas ---------- */
.wr-soil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.45;
}

/* ---------- Root SVG ---------- */
.wr-roots {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.42;
}

.wr-root-path {
  stroke-dasharray: var(--dash-len, 800);
  stroke-dashoffset: var(--dash-len, 800);
  animation: wr-draw 2.6s cubic-bezier(.3,.8,.3,1) forwards;
}

@keyframes wr-draw {
  to { stroke-dashoffset: 0; }
}

/* ---------- Couleurs racines selon famille ---------- */
.page.fam-vegetales      { --wr-color: #0E7C5A; }  /* emerald */
.page.fam-minerales      { --wr-color: #C4451C; }  /* rust */
.page.fam-animales       { --wr-color: #8a2a18; }  /* deep rust */
.page.fam-specifiques    { --wr-color: #d4901c; }  /* deep saffron */
.page.chapter-cover,
.page.chapter-foreword,
.page.chapter-toc,
.page.fam-termes,
.page.fam-certifications,
.page.fam-index          { --wr-color: #0E7C5A; }  /* emerald default */

/* ---------- Pulsations radiales décoratives ---------- */
.wr-pulse {
  position: absolute;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--wr-color, #0E7C5A) 60%, transparent);
  pointer-events: none;
  opacity: 0;
  animation: wr-pulse 4s ease-out infinite;
}
.wr-pulse.p2 { animation-delay: 1.3s; }
.wr-pulse.p3 { animation-delay: 2.6s; }

@keyframes wr-pulse {
  0%   { transform: scale(0.4); opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ---------- Renforce contraste du contenu par-dessus ---------- */
.page {
  isolation: isolate;
}

/* Hint sur prefers-reduced-motion : on garde les racines mais sans tracé */
@media (prefers-reduced-motion: reduce) {
  .wr-root-path {
    stroke-dashoffset: 0 !important;
    animation: none !important;
  }
  .wr-pulse { animation: none !important; opacity: 0.3; }
}
