/* ==========================================================================
   M4 SERVICES INC. - ANIMATIONS & INTERACTIONS DYNAMIQUES (ÉTAPE 1)
   Optimisé pour 60fps (transform & opacity uniquement)
   Conforme prefers-reduced-motion & accessibilité
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. LOGO SVG ANIMÉ (Tracé séquentiel stroke-dasharray)
   -------------------------------------------------------------------------- */
.brand-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
  transition: transform 0.25s ease, opacity 0.25s ease;
  animation: logoEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.brand:hover .brand-logo {
  transform: scale(1.03);
}

@keyframes logoEntrance {
  0% {
    opacity: 0;
    transform: translateY(-3px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.m4-stroke-orange {
  stroke: #fd5d00;
  stroke-width: 19;
  stroke-linecap: square;
  stroke-linejoin: miter;
  fill: none;
}

.m4-stroke-white {
  stroke: #2c2c2c;
  stroke-width: 19;
  stroke-linecap: square;
  stroke-linejoin: miter;
  fill: none;
}

.m4-animated-logo .m4-line {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: drawStroke 0.45s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* Lignes Orange du "M" (départ 0.05s) */
.m4-animated-logo .m-line-1 { animation-delay: 0.05s; }
.m4-animated-logo .m-line-2 { animation-delay: 0.18s; }
.m4-animated-logo .m-line-3 { animation-delay: 0.32s; }
.m4-animated-logo .m-line-4 { animation-delay: 0.46s; }
.m4-animated-logo .m-line-5 { animation-delay: 0.60s; }

/* Lignes Blanches du "4" (départ après le M, ~0.70s) */
.m4-animated-logo .four-line-1 { animation-delay: 0.72s; }
.m4-animated-logo .four-line-2 { animation-delay: 0.86s; }
.m4-animated-logo .four-line-3 { animation-delay: 0.98s; }

/* Texte SERVICES INC. */
.m4-animated-logo .m4-logo-text {
  opacity: 0;
  transform: translateY(6px);
  animation: logoTextFadeIn 0.5s ease-out 1.12s forwards;
}

@keyframes drawStroke {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes logoTextFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   2. BULLES DE SAVON INTERACTIVES (Arrière-plan Hero)
   -------------------------------------------------------------------------- */
.bubbles-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 8;
}

/* --------------------------------------------------------------------------
   3. TITRE AVEC MOTS TOURNANTS (Défilement vertical toutes les 2,5s)
   -------------------------------------------------------------------------- */
.rotating-word-container {
  display: inline-block;
  vertical-align: baseline;
  position: relative;
  overflow: hidden;
  height: 1.25em;
  padding: 0 0.15em;
  color: var(--color-accent);
}

.rotating-word-list {
  display: inline-flex;
  flex-direction: column;
  transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

.rotating-word-item {
  display: block;
  height: 1.25em;
  line-height: 1.25em;
  color: var(--color-accent);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   4. APPARITIONS VARIÉES DES SECTIONS (IntersectionObserver, 1 seule fois)
   -------------------------------------------------------------------------- */
.reveal-init {
  opacity: 0;
  will-change: transform, opacity;
  transition-property: transform, opacity, filter;
  transition-duration: 0.65s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Variante A : Montée fluide */
.reveal-fade-up {
  transform: translateY(32px);
}
.reveal-fade-up.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Variante B : Glissement latéral gauche */
.reveal-slide-left {
  transform: translateX(-40px);
}
.reveal-slide-left.is-revealed {
  opacity: 1;
  transform: translateX(0);
}

/* Variante C : Glissement latéral droit */
.reveal-slide-right {
  transform: translateX(40px);
}
.reveal-slide-right.is-revealed {
  opacity: 1;
  transform: translateX(0);
}

/* Variante D : Mise au point (focus) */
.reveal-focus {
  transform: scale(0.95);
  filter: blur(8px);
  transition-duration: 0.75s;
}
.reveal-focus.is-revealed {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
}

/* Décalage échelonné pour grilles de cartes (Stagger) */
.reveal-stagger > *:nth-child(1) { transition-delay: 0.08s; }
.reveal-stagger > *:nth-child(2) { transition-delay: 0.18s; }
.reveal-stagger > *:nth-child(3) { transition-delay: 0.28s; }
.reveal-stagger > *:nth-child(4) { transition-delay: 0.38s; }

/* --------------------------------------------------------------------------
   5. RESPECT STRICT DU MODE RÉDUIT (prefers-reduced-motion)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .m4-animated-logo .m4-line {
    stroke-dasharray: none !important;
    stroke-dashoffset: 0 !important;
    animation: none !important;
  }
  
  .m4-animated-logo .m4-logo-text {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .bubbles-canvas {
    display: none !important;
  }

  .rotating-word-list {
    transition: none !important;
  }

  .reveal-init,
  .reveal-fade-up,
  .reveal-slide-left,
  .reveal-slide-right,
  .reveal-focus {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
  }
}
