/* ============================================================
   MUSOCI — enhancements.css
   Améliorations visuelles chargées APRÈS style.css.
   Contenu :
     1. Barre de progression de lecture (scroll-driven animations)
     2. Curseur personnalisé (styles uniquement — DOM créé par cursor.js)
     3. Icônes (topbar, retour en haut, coches, étoiles)
     4. Micro-interactions (boutons, liens, cartes, sélection, scrollbar)
     5. Accessibilité (prefers-reduced-motion)
   Charte : bleu marine #0C3B66 / orange #F2921D — transitions 200–300ms.
   ============================================================ */

/* ============================================================
   1. Barre de progression de lecture
   Pilotée uniquement par CSS (animation-timeline) — aucun JS.
   Hors support, la barre reste à scaleX(0) : invisible.
   ============================================================ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 200;
  pointer-events: none;
}

.scroll-progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--orange), var(--blue));
  transform-origin: left;
  transform: scaleX(0);
}

/* Navigateurs modernes : la barre suit la progression du défilement */
@supports (animation-timeline: scroll()) {
  .scroll-progress span {
    animation: scrollProgress linear both;
    animation-timeline: scroll(root);
  }
}

@keyframes scrollProgress {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ============================================================
   2. Curseur personnalisé
   Les éléments (.mcursor, .mcursor-dot, .mcursor-ring,
   .mcursor-picto, .mcursor-burst) sont créés par cursor.js.
   Actif uniquement sur pointeur précis (souris), désactivé
   si l'utilisateur préfère réduire les animations.
   ============================================================ */
@media (pointer: fine) {

  /* Le curseur natif est masqué seulement quand le JS a posé la classe */
  body.has-custom-cursor,
  body.has-custom-cursor * {
    cursor: none !important;
  }

  /* Conteneur global — ne capte jamais la souris */
  .mcursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    pointer-events: none;
  }

  /* Traînée « ruban » : SVG plein écran SOUS les éléments du curseur.
     Le <path> (dégradé orange→bleu, lissage quadratique) est redessiné
     à chaque frame par cursor.js — ici seulement le cadre et l'opacité. */
  .mcursor-ribbon {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    pointer-events: none;
    opacity: 0.5;
  }
  /* Sur fond bleu marine, le ruban devient plus lumineux */
  .mcursor-ribbon.is-dark {
    opacity: 0.7;
  }

  /* Ombre au sol : ellipse floue sous le parapluie — position, échelle et
     opacité pilotées par cursor.js (respire à l'inverse du rebond du picto) */
  .mcursor-shadow {
    position: fixed;
    top: 0;
    left: 0;
    width: 26px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(12, 59, 102, 0.55), rgba(12, 59, 102, 0) 100%);
    filter: blur(2px);
    opacity: 0.2;
    pointer-events: none;
    will-change: transform, opacity;
  }

  /* Point central orange */
  .mcursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--orange);
    pointer-events: none;
    will-change: transform;
    transition: scale 0.15s ease;
  }

  /* Très léger « ghost » lumineux derrière le point orange */
  .mcursor-dot::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: rgba(242, 146, 29, 0.3);
    filter: blur(4px);
    z-index: -1;
  }

  /* Anneau bleu qui suit le point avec un léger retard (géré par le JS) */
  .mcursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1.5px solid rgba(55, 138, 221, 0.55);
    background: transparent;
    pointer-events: none;
    will-change: transform, width, height;
    transition:
      width 0.25s ease,
      height 0.25s ease,
      border-color 0.25s ease,
      background-color 0.25s ease,
      border-radius 0.25s ease,
      scale 0.2s ease;
  }

  /* Survol d'un élément interactif : l'anneau s'ouvre et passe à l'orange */
  .mcursor-ring.is-hover {
    width: 56px;
    height: 56px;
    border-color: var(--orange);
    background: rgba(242, 146, 29, 0.06);
  }

  /* Clic maintenu : l'anneau se contracte légèrement */
  .mcursor-ring.is-down {
    scale: 0.85;
  }

  /* Champ texte (input/textarea) : l'anneau devient un curseur de saisie */
  .mcursor-ring.is-text {
    width: 2px;
    height: 22px;
    border-radius: 2px;
    border-color: transparent;
    background: var(--blue);
  }

  /* Mode clair du curseur sur les sections bleu marine (classe posée en JS
     via la délégation mouseover — héro, simulateur, footer, bandeaux…) */
  .mcursor.is-dark .mcursor-ring {
    border-color: rgba(255, 255, 255, 0.6);
  }
  .mcursor.is-dark .mcursor-ring.is-hover {
    border-color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
  }
  .mcursor.is-dark .mcursor-ring.is-text {
    border-color: transparent;
    background: #fff;
  }
  .mcursor.is-dark .mcursor-picto {
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
  }

  /* Pictogramme MUSOCI (parapluie) qui accompagne le curseur */
  .mcursor-picto {
    position: fixed;
    top: 0;
    left: 0;
    width: 34px;
    height: 34px;
    opacity: 0.9;
    pointer-events: none;
    filter: drop-shadow(0 4px 8px rgba(12, 59, 102, 0.25));
    will-change: transform;
    transition: width 0.25s ease, height 0.25s ease, opacity 0.25s ease;
  }
  .mcursor-picto.is-hover {
    width: 44px;
    height: 44px;
  }
  /* Flottement doux du pictogramme (appliqué à l'image interne
     pour ne pas entrer en conflit avec le transform posé par le JS) */
  .mcursor-picto img {
    width: 100%;
    height: 100%;
    animation: mcursorFloat 3s ease-in-out infinite;
  }

  /* Onde circulaire émise au clic */
  .mcursor-burst {
    position: fixed;
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--orange);
    pointer-events: none;
    animation: mcursorBurst 0.55s ease-out forwards;
  }
  /* Deuxième onde, bleue, légèrement décalée dans le temps */
  .mcursor-burst--blue {
    border-color: rgba(55, 138, 221, 0.7);
    animation-duration: 0.6s;
  }

  /* Goutte de pluie : s'échappe du pictogramme quand le pointeur va vite,
     dérive (--dx) puis tombe (--dy) en s'estompant — gravité 100 % CSS */
  .mcursor-drop {
    position: fixed;
    top: 0;
    left: 0;
    width: 5px;
    height: 5px;
    margin: -2px 0 0 -2px;
    border-radius: 50%;
    background: var(--blue);
    opacity: 0.7;
    pointer-events: none;
    animation: mcursorDrop 0.7s ease-in forwards;
  }

  /* Gouttelette d'éclaboussure au clic (trajectoire radiale --dx/--dy) */
  .mcursor-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: var(--orange);
    opacity: 0.85;
    pointer-events: none;
    animation: mcursorSplash 0.55s ease-out forwards;
  }
}

@keyframes mcursorFloat {
  0%, 100% { transform: translateY(-3px); }
  50%      { transform: translateY(3px); }
}

@keyframes mcursorBurst {
  from {
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    opacity: 0.8;
  }
  to {
    width: 70px;
    height: 70px;
    margin: -35px 0 0 -35px;
    opacity: 0;
  }
}

@keyframes mcursorDrop {
  from { transform: translate(0, 0) scale(1); opacity: 0.7; }
  to   { transform: translate(var(--dx, 0px), var(--dy, 40px)) scale(0.4); opacity: 0; }
}

@keyframes mcursorSplash {
  from { transform: translate(0, 0) scale(1); opacity: 0.85; }
  to   { transform: translate(var(--dx, 0px), var(--dy, -20px)) scale(0.3); opacity: 0; }
}

/* Si l'utilisateur préfère réduire les animations :
   curseur natif conservé, éléments du curseur personnalisé masqués */
@media (prefers-reduced-motion: reduce) {
  body.has-custom-cursor,
  body.has-custom-cursor * {
    cursor: auto !important;
  }
  .mcursor,
  .mcursor-dot,
  .mcursor-ring,
  .mcursor-picto,
  .mcursor-burst,
  .mcursor-ribbon,
  .mcursor-shadow,
  .mcursor-drop,
  .mcursor-splash {
    display: none !important;
  }
}

/* ============================================================
   3. Icônes moins génériques
   ============================================================ */

/* Réseaux sociaux (topbar) : pictos SVG nets + survol orange plein */
.topbar-socials a svg {
  width: 12px;
  height: 12px;
  display: block;
}
.topbar-socials a:hover {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

/* Bouton retour en haut : flèche SVG */
.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* Coches (héro, listes de confiance) */
.hero-trust svg.check-ico,
.check-ico {
  width: 14px;
  height: 14px;
  color: var(--orange);
  vertical-align: -2px;
}

/* Rangée d'étoiles (témoignages) */
.stars-row {
  display: inline-flex;
  gap: 3px;
  color: var(--orange);
}
.stars-row svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* ============================================================
   4. Micro-interactions élégantes
   ============================================================ */

/* --- Brillance discrète sur les boutons pleins au survol --- */
.btn--orange,
.btn--navy {
  position: relative;
  overflow: hidden;
}
.btn--orange::after,
.btn--navy::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 100%
  );
  transform: translateX(-160%) skewX(-18deg);
  transition: transform 0.5s ease;
  pointer-events: none;
}
.btn--orange:hover::after,
.btn--navy:hover::after {
  transform: translateX(280%) skewX(-18deg);
}

/* --- Liens du pied de page : soulignement animé --- */
.footer-links a {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: background-size 0.3s ease, color var(--transition);
}
.footer-links a:hover {
  background-size: 100% 1px;
}

/* --- Formule mise en avant : lueur orange au survol --- */
.plan-card--featured:hover {
  box-shadow: var(--shadow-md), 0 0 0 4px rgba(242, 146, 29, 0.12);
}

/* --- Emplacements photos : l'icône se soulève, l'étiquette fonce --- */
.photo-slot svg {
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.photo-slot .ps-label {
  transition: color 0.3s ease;
}
.photo-slot:hover svg {
  transform: translateY(-4px);
  opacity: 1;
}
.photo-slot:hover .ps-label {
  color: var(--navy);
}

/* --- Puces villes : liseré gauche orange qui se déploie au survol --- */
.city-chip {
  position: relative;
  overflow: hidden;
}
.city-chip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--orange);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.25s ease;
}
.city-chip:hover::before {
  transform: scaleY(1);
}

/* --- Sélection de texte aux couleurs de la charte --- */
::selection {
  background: var(--orange);
  color: #fff;
}

/* --- Barre de défilement personnalisée --- */
/* Firefox */
html {
  scrollbar-color: var(--navy) var(--grey);
}
/* WebKit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--grey);
}
::-webkit-scrollbar-thumb {
  background: var(--navy);
  border-radius: 100px;
  border: 2px solid var(--grey);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--orange);
}

/* ============================================================
   5. Accessibilité — neutralise les animations ajoutées ici
   (le curseur personnalisé est déjà désactivé plus haut)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .scroll-progress span {
    animation: none;
    transform: scaleX(0);
  }
  .mcursor-picto img {
    animation: none;
  }
  .btn--orange::after,
  .btn--navy::after {
    display: none;
  }
  .footer-links a,
  .photo-slot svg,
  .photo-slot .ps-label,
  .city-chip::before {
    transition: none;
  }
}

/* ============================================================
   6. Simulateur — mode Entreprise (grands effectifs)
   Le curseur « enfants » devient un champ de saisie libre
   « salariés à couvrir » (1 à 100 000), accompagné de paliers.
   ============================================================ */
.sim-panel input[type="number"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--navy);
  background: var(--white);
  outline: none;
  transition: border-color var(--transition);
}
.sim-panel input[type="number"]:focus { border-color: var(--blue); }

.sim-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.sim-quick-btn {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--ink);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
}
.sim-quick-btn:hover { border-color: var(--orange); color: var(--orange); }
.sim-quick-btn.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
