/* "Comment ca marche" : la scene reste epinglee pendant que les trois etapes defilent ;
   elle passe de l'enregistrement a la redaction puis au compte-rendu (data-step pose par js/story.js). */

.story {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(40px, 6vw, 90px) 20px 0;
}

.story-grid {
  position: relative;
  margin-top: 28px;
}

/* Telephone : la scene colle en haut, les etapes passent dessous */
.story-stage-wrap {
  position: sticky;
  top: 68px;
  z-index: 2;
  order: -1;
  padding: 10px 0 14px;
  background: var(--bg);
}

.story-grid {
  display: flex;
  flex-direction: column;
}

.story-stage {
  position: relative;
  height: 340px;
  border-radius: var(--radius);
  background: #ffffff;
  border: 1px solid var(--line);
  overflow: hidden;
  transition: background-color 0.6s var(--ease), border-color 0.6s var(--ease);
}

.story-stage[data-step="1"] {
  background: #0b0f19;
  border-color: #0b0f19;
}

.stage-progress {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.stage-progress i {
  height: 3px;
  border-radius: 3px;
  background: #cbd5e1;
  transition: background-color 0.4s;
}

.story-stage[data-step="1"] .stage-progress i {
  background: #334155;
}

.story-stage[data-step="1"] .stage-progress i:nth-child(1),
.story-stage[data-step="2"] .stage-progress i:nth-child(-n + 2),
.story-stage[data-step="3"] .stage-progress i {
  background: var(--orange);
}

.stage-layer {
  position: absolute;
  inset: 0;
  padding: 36px 20px 18px;
  opacity: 0;
  transform: translateY(26px) scale(0.97);
  transition: opacity 0.5s var(--ease), transform 0.7s var(--ease);
  pointer-events: none;
}

.story-stage[data-step="1"] .stage-rec,
.story-stage[data-step="2"] .stage-write,
.story-stage[data-step="3"] .stage-report {
  opacity: 1;
  transform: none;
}

/* Les couches deja passees sortent par le haut */
.story-stage[data-step="2"] .stage-rec,
.story-stage[data-step="3"] .stage-rec,
.story-stage[data-step="3"] .stage-write {
  transform: translateY(-26px) scale(0.97);
}

/* 1. Enregistrement */
.stage-rec {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #ffffff;
}

.stage-timer {
  margin-top: 16px;
}

.wave-wide {
  height: 84px;
  margin-top: 18px;
  gap: 4px;
}

.stage-people {
  display: flex;
  align-items: center;
  margin-top: auto;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
}

.stage-people b {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-right: -6px;
  border: 2px solid #0b0f19;
  border-radius: 50%;
  background: #e2e8f0;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.stage-people b.is-orange {
  background: var(--orange);
  color: #ffffff;
}

.stage-people span {
  margin-left: 16px;
}

/* 2. Redaction */
.write-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 13px;
  border-radius: var(--pill);
  background: var(--ink);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.write-spin {
  width: 12px;
  height: 12px;
  border: 2px solid #475569;
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.write-wave {
  height: 3px;
  margin-top: 16px;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 4px, transparent 4px 9px);
  opacity: 0.18;
}

.write-lines {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 18px;
}

.write-lines i {
  width: var(--w);
  height: 9px;
  border-radius: 5px;
  background: #e2e8f0;
  transform: scaleX(0);
  transform-origin: left;
}

.write-lines i.is-title {
  height: 13px;
  margin-top: 6px;
  background: var(--ink);
}

.story-stage[data-step="2"] .write-lines i {
  animation: line-write 0.6s var(--ease) both;
}

.write-lines i:nth-child(1) { animation-delay: 0.25s; }
.write-lines i:nth-child(2) { animation-delay: 0.5s; }
.write-lines i:nth-child(3) { animation-delay: 0.75s; }
.write-lines i:nth-child(4) { animation-delay: 1s; }
.write-lines i:nth-child(5) { animation-delay: 1.3s; }
.write-lines i:nth-child(6) { animation-delay: 1.55s; }
.write-lines i:nth-child(7) { animation-delay: 1.8s; }
.write-lines i:nth-child(8) { animation-delay: 2.05s; }

/* 3. Compte-rendu */
.report-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.report-meta {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.report-essentiel {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--ink);
  color: #ffffff;
}

.report-essentiel p {
  margin-top: 7px;
  font-size: 12.5px;
  line-height: 1.4;
}

.report-folders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.report-actions {
  display: none;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.report-actions li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-top: 1px solid #f1f5f9;
  font-size: 13px;
  font-weight: 600;
}

.chk {
  width: 15px;
  height: 15px;
  border: 1.5px solid #94a3b8;
  border-radius: 5px;
  flex-shrink: 0;
}

.report-actions em {
  margin-left: auto;
  padding: 2px 9px;
  border-radius: var(--pill);
  background: #f1f5f9;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.story-stage[data-step="3"] .report-essentiel,
.story-stage[data-step="3"] .report-folders,
.story-stage[data-step="3"] .report-actions li {
  animation: hero-rise 0.6s var(--ease) both;
}

.story-stage[data-step="3"] .report-essentiel { animation-delay: 0.15s; }
.story-stage[data-step="3"] .report-folders { animation-delay: 0.3s; }
.story-stage[data-step="3"] .report-actions li:nth-child(1) { animation-delay: 0.45s; }
.story-stage[data-step="3"] .report-actions li:nth-child(2) { animation-delay: 0.55s; }
.story-stage[data-step="3"] .report-actions li:nth-child(3) { animation-delay: 0.65s; }

/* ---------- Etapes ---------- */
.story-step {
  position: relative;
  min-height: 40vh;
  padding: 26px 0 26px 56px;
  opacity: 0.35;
  transition: opacity 0.4s;
}

.story-step:last-child {
  min-height: 40vh;
}

.story-step.is-active {
  opacity: 1;
}

.step-num {
  position: absolute;
  left: 0;
  top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: inset 0 0 0 1.5px #cbd5e1;
  font-size: 15px;
  font-weight: 800;
  transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
}

.story-step.is-active .step-num {
  background: var(--ink);
  color: #ffffff;
  box-shadow: none;
}

.story-step h3 {
  font-size: clamp(1.3rem, 1.1rem + 1vw, 1.9rem);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.story-step p {
  max-width: 28rem;
  margin-top: 10px;
  color: var(--text);
}

/* ---------- Ordinateur : etapes a gauche, scene epinglee a droite ---------- */
@media (min-width: 900px) {
  .story-grid {
    display: grid;
    grid-template-columns: 1fr minmax(0, 460px);
    gap: 60px;
    align-items: start;
    margin-top: 0;
  }

  .story-stage-wrap {
    order: 0;
    top: 0;
    display: flex;
    align-items: center;
    height: 100vh;
    padding: 68px 0 0;
    background: transparent;
  }

  .story-stage {
    width: 100%;
    height: min(560px, 74vh);
    box-shadow: 0 40px 70px -40px rgba(15, 23, 42, 0.45);
  }

  .stage-layer {
    padding: 48px 30px 28px;
  }

  .stage-progress {
    top: 20px;
    left: 30px;
    right: 30px;
  }

  .stage-timer {
    margin-top: 44px;
    font-size: 64px;
  }

  .wave-wide {
    height: 130px;
    margin-top: 36px;
  }

  .report-title {
    font-size: 21px;
  }

  .report-essentiel {
    margin-top: 16px;
    padding: 16px 18px;
  }

  .report-essentiel p {
    font-size: 14px;
  }

  .report-folders {
    margin-top: 24px;
  }

  .report-actions {
    display: block;
  }

  .story-step {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    padding: 0 0 0 64px;
  }

  .story-step:last-child {
    min-height: 100vh;
  }

  .step-num {
    top: calc(50% - 62px);
    width: 44px;
    height: 44px;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes line-write {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}
