/* Toisé — 03 · Comment ça marche : scène épinglée, pilotée par le scroll
   Une seule section épinglée (le scrub est ressenti, pas subi) ; sans mouvement, tout s’empile. */

.how { padding-bottom: 0; }
.how__head { margin-bottom: 0; }
.how__track { position: relative; height: 340vh; }
.how__pin {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: flex; align-items: center; padding-top: calc(var(--nav-h) - 8px);
}
.how__grid { width: min(100% - 2 * var(--gutter), var(--maxw)); margin-inline: auto; display: grid; align-items: center; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 96px); }

/* étapes : rail vertical qui se remplit avec le scroll */
.steps { position: relative; display: grid; }
.steps::before, .steps::after { content: ''; position: absolute; left: 19.5px; top: 20px; bottom: 20px; width: 1px; background: var(--frost); }
.steps::after { background: var(--indigo); transform-origin: 0 0; transform: scaleY(var(--fill, 0)); }
.step { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 24px; padding: 18px 0; }
.step__num {
  position: relative; z-index: 1; display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--frost); border-radius: var(--r); background: #fff;
  font: 400 13px/1 var(--font); color: var(--slate); font-variant-numeric: tabular-nums;
  transition: color .45s, border-color .45s, background-color .45s;
}
.step.is-active .step__num, .step.is-done .step__num { color: #fff; background: var(--indigo-fill); border-color: var(--indigo-fill); }
.step__body { display: grid; grid-template-rows: auto 0fr; align-content: start; transition: grid-template-rows .7s var(--ease-out); }
.step.is-active .step__body { grid-template-rows: auto 1fr; }
.step__t { font-size: clamp(26px, 3vw, 38px); line-height: 1.1; letter-spacing: -.025em; color: var(--smoke); transition: color .45s, margin-bottom .7s var(--ease-out), transform .5s var(--ease-out); }
.step__t button { font: inherit; letter-spacing: inherit; color: inherit; text-align: left; transition: color .3s; }
.step:hover .step__t { transform: translateX(4px); }
.step.is-active .step__t { color: var(--ink); margin-bottom: 12px; }
.step:not(.is-active):hover .step__t button { color: var(--indigo-hover); }
.step__p { min-height: 0; overflow: hidden; max-width: 40ch; font: 400 16px/1.45 var(--font); color: var(--steel); opacity: 0; transition: opacity .4s; }
.step.is-active .step__p { opacity: 1; transition-delay: .2s; }

/* scène : trois calques qui se fondent l’un dans l’autre */
.stage { position: relative; overflow: hidden; border: 1px solid var(--frost); border-radius: var(--r); background: #fff; }
.stage__bar { display: flex; align-items: center; justify-content: space-between; height: 46px; padding: 0 16px; border-bottom: 1px solid var(--frost); background: var(--mist); font: 400 13px/1 var(--font); color: var(--slate); }
.stage__pips { display: flex; gap: 6px; }
.stage__pips i { width: 20px; height: 2px; background: var(--frost); transition: background-color .45s; }
.stage__pips i.on { background: var(--indigo); }
.stage__body { position: relative; height: clamp(420px, 58vh, 520px); }
.layer { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 16px; padding: 20px; overflow: hidden; will-change: opacity, transform; }

.vcard { padding: 16px; border: 1px solid var(--frost); border-radius: var(--r); }
.vcard .wave { margin: 12px 0 8px; }
.vcard .demo__transcript { min-height: 66px; }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photo {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden; color: var(--smoke);
  border: 1px solid var(--frost); border-radius: var(--r); background: var(--mist);
  opacity: var(--r, 0); transform: translateY(calc((1 - var(--r, 0)) * 14px));
}
.photo svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.photo__scan { position: absolute; left: 0; right: 0; top: -28px; height: 28px; border-bottom: 1px solid var(--indigo); background: linear-gradient(rgba(83, 58, 253, 0), rgba(83, 58, 253, .16)); opacity: var(--sc, 0); transform: translateY(calc(var(--sy, 0) * 1px)); }
.photo__box { position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h); border: 1.5px solid var(--indigo); background: rgba(83, 58, 253, .06); opacity: var(--b, 0); transform: scale(calc(1.14 - .14 * var(--b, 0))); }
.photo__box em { position: absolute; left: -1.5px; top: -1.5px; padding: 3px 6px; background: var(--indigo); color: #fff; font: 400 10px/1 var(--font); font-style: normal; white-space: nowrap; }
.photo figcaption { position: absolute; left: 8px; bottom: 6px; font: 400 10px/1 var(--font); color: var(--slate); }

/* calque 2 : bibliothèque de prix → lignes du devis */
.layer[data-layer='0'] { justify-content: center; }
.layer[data-layer='1'] { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); align-content: center; gap: 16px; }
.lib { display: grid; gap: 12px; align-content: start; }
.lib li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid transparent; border-bottom-color: var(--frost); font: 400 12.5px/1.25 var(--font); color: var(--steel); transition: background-color .35s, color .35s, border-color .35s; }
.lib li b { font-weight: 400; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; transition: color .35s; }
.lib li.hit { background: var(--wash); border-color: var(--lilac); color: var(--indigo); }
.lib li.hit b { color: var(--indigo); }

/* calque 3 : le devis prêt, puis l’envoi */
.doc { border: 1px solid var(--frost); border-radius: var(--r); background: #fff; }
.doc__top { display: flex; align-items: center; justify-content: space-between; padding: 14px; border-bottom: 1px solid var(--frost); }
.doc__brand { display: flex; align-items: center; gap: 10px; }
.doc__brand i { width: 26px; height: 26px; border-radius: var(--r); background: var(--frost); }
.doc__brand b { display: block; width: 88px; height: 8px; border-radius: 2px; background: var(--frost); }
.doc__ref { display: grid; gap: 5px; text-align: right; font: 400 12px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--slate); }
.doc__ref span:last-child { letter-spacing: 0; text-transform: none; color: var(--ink); font-variant-numeric: tabular-nums; }
.doc__client { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--frost); font: 400 12px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--slate); }
.doc__client i { display: block; width: 120px; height: 8px; border-radius: 2px; background: var(--frost); }
.send { display: flex; justify-content: flex-end; margin-top: auto; }
.sent {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center;
  background: #fff; opacity: var(--s, 0); transform: scale(calc(.96 + .04 * var(--s, 0))); pointer-events: none;
}
.sent__ring { width: 76px; height: 76px; fill: none; stroke: var(--indigo); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sent__ring circle { stroke-dasharray: 176; stroke-dashoffset: calc(176px * (1 - var(--s, 0))); transform: rotate(-90deg); transform-origin: 32px 32px; }
.sent__ring path { stroke-dasharray: 40; stroke-dashoffset: calc(40px * (1 - var(--c, 0))); }
.sent__t { font-size: 32px; line-height: 1.1; letter-spacing: -.02em; color: var(--ink); }
.sent__s { max-width: 30ch; font: 400 15px/1.4 var(--font); color: var(--slate); }

@media (max-width: 899px) {
  .how__pin { align-items: flex-start; padding-top: calc(var(--nav-h) + 8px); }
  .how__grid { grid-template-columns: 1fr; gap: 12px; }
  .stage { order: -1; }
  .stage__body { height: clamp(300px, calc(100svh - 360px), 470px); }
  .layer { padding: 14px; gap: 12px; }
  .step { padding: 8px 0; gap: 16px; grid-template-columns: 32px minmax(0, 1fr); }
  .step__num { width: 32px; height: 32px; font-size: 12px; }
  .steps::before, .steps::after { left: 15.5px; top: 16px; bottom: 16px; }
  .step__t { font-size: 22px; }
  .step__p { font-size: 15px; }
  .layer[data-layer='1'] { grid-template-columns: 1fr; }
  .lib { display: none; }
  .vcard { padding: 12px; }
  .vcard .demo__transcript { min-height: 84px; font-size: 14px; }
  .photo figcaption { display: none; }
  .photo__box em { font-size: 8px; padding: 2px 4px; }
  .sent__t { font-size: 26px; }
  /* dans la scène, les lignes sont plus compactes ; l’étape 3 n’affiche que l’en-tête, les totaux et l’envoi */
  .stage .qrow { min-height: 40px; }
  .stage .qrow__c { padding: 6px 12px; gap: 8px; }
  .stage .qrow__m { display: none; }
  .stage .qrow__t { font-size: 12.5px; }
  .layer[data-layer='2'] [data-h='rows'] { display: none; }
}
@media (max-height: 720px) and (min-width: 900px) {
  .stage__body { height: clamp(360px, 62vh, 520px); }
  .step { padding: 12px 0; }
}

/* moins de mouvement : plus d’épinglage, les trois étapes s’empilent dans leur état final */
@media (prefers-reduced-motion: reduce) {
  .how__track { height: auto; }
  .how__pin { position: static; height: auto; padding-top: 0; padding-bottom: var(--sec); }
  .how__grid { grid-template-columns: 1fr; }
  .stage { order: 0; }
  .stage__body { display: grid; height: auto; }
  .layer { position: static; opacity: 1 !important; transform: none !important; visibility: visible !important; border-bottom: 1px solid var(--frost); }
  .layer:last-child { border-bottom: 0; }
  .layer[data-layer='2'] { min-height: 420px; }
  .steps::after { transform: scaleY(1); }
  .step__body { grid-template-rows: auto 1fr; }
  .step__p { opacity: 1; }
  .step .step__t { color: var(--ink); margin-bottom: 12px; }
  .step .step__num { color: #fff; background: var(--indigo-fill); border-color: var(--indigo-fill); }
  .lib { display: grid; }
}
