/* =============================================================================
   COMPOSANT : PARCOURS EN ÉTAPES (sticky scroll)
   Média sticky à gauche, étapes qui défilent à droite. Sur mobile : le média
   sticky disparaît et chaque étape porte sa propre image.

   UTILISATION, voir process-steps.js pour le markup complet.
   Les "props" sont le contenu HTML lui-même (sur-titre, titre, texte, image
   par étape) : il reste dans la page pour rester indexable par Google.

   AUTONOME : ne dépend d'aucune classe de page (fade-up, fade-up-d1,
   fade-up-delay-1... qui ne portent pas le même nom d'une page à l'autre).
   Seule dépendance : les variables de palette --bg / --bg-alt / --text /
   --text-soft / --accent, présentes sur toutes les pages.

   Préfixe .ps-* volontaire : #process, #process-steps et #process-header
   existent déjà sur certaines pages et désignent autre chose.
   ============================================================================= */

/* ATTENTION : le sticky ci-dessous exige qu'AUCUN ancêtre ne soit un conteneur
   de défilement. Un simple `overflow-x: hidden` sur body suffit à le casser,    l'élément se cale alors sur body, qui ne défile pas, et suit le contenu au
   lieu de rester fixe. Les pages déclarent donc `overflow-x: clip`, qui borne
   le débordement horizontal sans créer de conteneur de défilement. */
.process-sticky {
  display: flex;
  height: 300vh;              /* 3 étapes x 100vh = la course du sticky */
  background: var(--bg);
}

/* ---- Colonne gauche : média sticky ---- */
.ps-media {
  width: 50%;
  position: sticky;
  /* Calé sous la navbar fixe (80px) plutôt qu'en haut de fenêtre, sinon le
     haut du visuel passe dessous. La hauteur est réduite d'autant pour que la
     colonne tienne dans la fenêtre visible. */
  top: 80px;
  height: calc(100vh - 80px);
  background: radial-gradient(ellipse at 50% 60%, rgba(59,130,246,0.07) 0%, transparent 65%), var(--bg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ps-card {
  position: relative;
  width: 85%;
  height: 72vh;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(59,130,246,0.75);
  box-shadow: 0 0 40px rgba(59,130,246,0.32);
}

.ps-state {
  position: absolute;
  inset: 0;
  opacity: 0;
  z-index: 1;
  transition: opacity 600ms ease;
}
.ps-state.is-active { opacity: 1; z-index: 2; }
.ps-state img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Filet vertical sur l'image de la dernière étape */
.ps-state .ps-split {
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: #ffffff;
  opacity: 0.6;
  z-index: 10;
}

/* ---- Barre de progression ---- */
.ps-progress {
  position: absolute;
  bottom: 20px; right: 20px;
  display: flex;
  gap: 8px;
  z-index: 10;
}
.ps-seg {
  width: 40px; height: 3px;
  border-radius: 2px;
  background: #CBD5E1;
  transition: background 400ms ease;
}
.ps-seg.is-active { background: var(--accent); }

/* ---- Colonne droite : étapes ---- */
.ps-steps { width: 50%; background: var(--bg); }

.ps-step {
  height: 100vh;
  display: flex;
  align-items: center;
  padding: 0 72px;
}

.ps-inner { max-width: 480px; }
.ps-mobile-img { display: none; }

.ps-number {
  display: block;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.1em;
  font-weight: 500;
  margin-bottom: 18px;
}

.ps-title {
  font-weight: 900;
  font-size: clamp(26px, 3vw, 38px);
  color: var(--text);
  margin-bottom: 26px;
  line-height: 1.15;
  letter-spacing: -2px;
}

.ps-text {
  font-weight: 300;
  font-size: 18px;
  color: var(--text-soft);
  line-height: 1.7;
  max-width: 460px;
}

/* ---- Révélation interne (remplace le fade-up des pages) ---- */
.ps-inner > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms cubic-bezier(0.16,1,0.3,1),
              transform 600ms cubic-bezier(0.16,1,0.3,1);
}
.ps-step.is-in .ps-inner > * { opacity: 1; transform: none; }
.ps-step.is-in .ps-inner > *:nth-child(1) { transition-delay: 0ms; }
.ps-step.is-in .ps-inner > *:nth-child(2) { transition-delay: 100ms; }
.ps-step.is-in .ps-inner > *:nth-child(3) { transition-delay: 200ms; }
.ps-step.is-in .ps-inner > *:nth-child(4) { transition-delay: 300ms; }

@media (prefers-reduced-motion: reduce) {
  .ps-inner > * { opacity: 1; transform: none; transition: none; }
  .ps-state, .ps-seg { transition: none; }
}

/* ---- Mobile : plus de sticky, scroll vertical normal ----
   Le média sticky est masqué (en scroll normal il resterait hors écran une fois
   le texte atteint) : chaque étape affiche sa propre image. */
@media (max-width: 768px) {
  .process-sticky { flex-direction: column; height: auto; }
  .ps-media { display: none; }
  .ps-steps { width: 100%; }
  .ps-step { flex-direction: column; height: auto; padding: 48px 24px; }
  .ps-inner { width: 100%; max-width: 100%; }
  .ps-mobile-img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 24px;
  }
  .ps-number { font-size: 12px; }
  .ps-title { font-size: 26px; }
}

@media (max-width: 480px) {
  .ps-step { padding: 36px 20px; }
  .ps-mobile-img { height: 180px; }
  .ps-title { font-size: 22px; }
}
