/* Ostia Flow — module de scrollytelling pinné, autonome (pas de dépendance à
   ostia-shell.css/js). Pensé pour être réutilisé sur n'importe quelle page :
   marquer une séquence de <li data-flow-step> avec [data-ostia-flow], le
   contenu reste lisible et complet sans JS (progressive enhancement). */

.ostia-flow-layout {
  display: block;
  margin-top: 40px;
  position: relative;
}

@media (min-width: 860px) {
  .ostia-flow-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 56px;
    align-items: start;
  }
}

/* Le systeme de reveal du shell pose parfois transform/filter/will-change
   sur les sections ambiantes ; ces proprietes creeraient un containing
   block qui perturbe le panneau sticky. On neutralise localement. */
section:has([data-ostia-flow]) {
  will-change: auto !important;
  transform: none !important;
  filter: none !important;
}

/* Panneau "readout" : sticky dans sa colonne, il accompagne la lecture
   des etapes sans recouvrir le contenu (body est en overflow-x: clip,
   position: sticky fonctionne desormais partout). */
.ostia-flow-visual {
  position: sticky;
  top: 120px;
  align-self: start;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(120% 140% at 18% -10%, rgba(16, 185, 129, 0.18), transparent 55%),
    rgba(255, 255, 255, 0.035);
  border-radius: 1.75rem;
  padding: 26px 28px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.ostia-flow.is-in-view .ostia-flow-visual {
  opacity: 1;
  transform: translateY(0);
}

.ostia-flow-visual::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.35), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
  opacity: 0.7;
}

.ostia-flow-visual-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  position: relative;
}

.ostia-flow-visual-index {
  font-family: "Space Grotesk", "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: #6ee7b7;
}

.ostia-flow-visual-total {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: rgba(148, 163, 184, 0.6);
}

.ostia-flow-visual-label {
  position: relative;
  margin: 14px 0 0;
  font-size: 1.3rem;
  font-weight: 900;
  color: #fff;
  line-height: 1.25;
  min-height: 1.3em;
}

.ostia-flow-visual-status {
  position: relative;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #34d399;
  text-transform: uppercase;
}

.ostia-flow-visual-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #34d399;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: ostiaFlowPulseDot 1.6s ease-in-out infinite;
}

@keyframes ostiaFlowPulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
}

.ostia-flow-wave {
  position: relative;
  margin-top: 20px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 36px;
}

.ostia-flow-wave span {
  flex: 1;
  border-radius: 999px;
  background: linear-gradient(180deg, #34d399, rgba(16, 185, 129, 0.25));
  animation: ostiaFlowWave 1.1s ease-in-out infinite;
  animation-play-state: paused;
  transform-origin: bottom;
}

.ostia-flow.is-in-view .ostia-flow-wave span {
  animation-play-state: running;
}

.ostia-flow-wave span:nth-child(1) { animation-delay: -1.1s; height: 30%; }
.ostia-flow-wave span:nth-child(2) { animation-delay: -0.9s; height: 60%; }
.ostia-flow-wave span:nth-child(3) { animation-delay: -0.7s; height: 100%; }
.ostia-flow-wave span:nth-child(4) { animation-delay: -0.5s; height: 45%; }
.ostia-flow-wave span:nth-child(5) { animation-delay: -0.3s; height: 75%; }
.ostia-flow-wave span:nth-child(6) { animation-delay: -0.15s; height: 35%; }

@keyframes ostiaFlowWave {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

.ostia-flow-bar {
  position: relative;
  margin-top: 20px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.ostia-flow-bar span {
  display: block;
  height: 100%;
  width: calc(var(--flow-progress, 0) * 100%);
  background: linear-gradient(90deg, #10b981, #34d399);
}

/* steps timeline */
.ostia-flow-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.ostia-flow-steps::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.ostia-flow-steps::after {
  content: "";
  position: absolute;
  left: 19px;
  top: 8px;
  width: 2px;
  height: calc(var(--flow-progress, 0) * (100% - 16px));
  background: linear-gradient(180deg, #34d399, #10b981);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.5);
}

.ostia-flow-step {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 20px;
  padding: 26px 0;
  min-height: 24vh;
  align-content: center;
  opacity: 0.4;
  filter: saturate(0.65);
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), filter 0.45s ease;
}

@media (min-width: 860px) {
  .ostia-flow-step {
    min-height: 32vh;
  }
}

.ostia-flow-step + .ostia-flow-step {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ostia-flow-step.is-active,
.ostia-flow-step.is-past {
  opacity: 1;
  filter: saturate(1);
}

.ostia-flow-step-dot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #020617;
  font-weight: 900;
  font-size: 0.95rem;
  color: #94a3b8;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.ostia-flow-step.is-active .ostia-flow-step-dot,
.ostia-flow-step.is-past .ostia-flow-step-dot {
  border-color: transparent;
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #022c22;
}

.ostia-flow-step.is-active .ostia-flow-step-dot {
  box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.14), 0 8px 24px rgba(16, 185, 129, 0.4);
  transform: scale(1.08);
}

.ostia-flow-step-body h3 {
  color: #cbd5e1;
  transition: color 0.4s ease;
}

@media (min-width: 860px) {
  /* densifie le rythme : titres plus presents, texte plus ample */
  .ostia-flow-step-body h3 {
    font-size: clamp(1.35rem, 1.9vw, 1.75rem);
    line-height: 1.15;
  }

  .ostia-flow-step-body p {
    font-size: 1.05rem;
    max-width: 34rem;
  }
}

.ostia-flow-step.is-active .ostia-flow-step-body h3,
.ostia-flow-step.is-past .ostia-flow-step-body h3 {
  color: #fff;
}

@media (max-width: 859px) {
  /* statique sur mobile : sticky recouvrirait le texte des etapes */
  .ostia-flow-visual {
    position: static;
    margin-bottom: 24px;
    padding: 16px 20px;
  }

  .ostia-flow-visual::before {
    display: none;
  }

  .ostia-flow-wave {
    height: 24px;
    margin-top: 12px;
  }

  .ostia-flow-visual-label {
    font-size: 1.05rem;
    min-height: 0;
    margin-top: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ostia-flow-visual {
    display: none;
  }

  .ostia-flow-step {
    opacity: 1 !important;
    filter: none !important;
    transition: none !important;
  }

  .ostia-flow-step-dot,
  .ostia-flow-step-body h3 {
    transition: none !important;
  }

  .ostia-flow-steps::after {
    display: none;
  }

  .ostia-flow-wave span {
    animation: none !important;
  }
}
