/* ---------- 4. COMO FUNCIONA ----------
   Estado padrão (sem JS / movimento reduzido): os 5 passos abertos e o celular na pose final.
   Com pin (classe .is-pinned): só o passo ativo abre, o celular conta a história em scrub. */
.how { position: relative; padding-top: var(--s-9); }
.how .sec-head { margin-bottom: var(--s-8); }
.how-stage { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: clamp(2rem, 6vw, 6rem); align-items: center; }

/* trilho de passos */
.steps { position: relative; display: grid; gap: var(--s-2); --fill: 1; }
.steps::before, .steps::after { content: ""; position: absolute; left: 1.1875rem; top: 1.25rem; bottom: 2.4rem; width: 2px; border-radius: 2px; }
.steps::before { background: var(--line-strong); }
.steps::after { background: var(--accent); transform-origin: 50% 0; transform: scaleY(var(--fill)); }
.step { position: relative; display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: var(--s-4); padding-bottom: var(--s-4); }
.step-node { position: relative; z-index: 1; width: 2.5rem; height: 2.5rem; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: .9375rem; font-variant-numeric: tabular-nums;
  background: var(--bg); border: 2px solid var(--accent); color: var(--accent); transition: background-color var(--d-slow) ease, color var(--d-slow) ease, border-color var(--d-slow) ease, box-shadow var(--d-slow) var(--ease-out); }
.step-btn { display: block; text-align: left; font: inherit; color: inherit; padding: .4rem 0; cursor: default; }
.step h3 { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: 1.12; font-size: var(--t-h3); text-wrap: balance; }
.step-more { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .6s var(--ease-out); }
.step-more-in { overflow: hidden; min-height: 0; }
.step .who { margin-top: var(--s-3); font-size: var(--t-sm); font-weight: 600; color: var(--ink-3); }
.step .who.sys { color: var(--accent); }
.step p:not(.who) { margin-top: var(--s-3); color: var(--ink-2); max-width: 34rem; text-wrap: pretty; }
.step p b { color: var(--ink); }
.step .g { color: var(--accent); }

/* pin ligado: só o passo ativo abre */
.how.is-pinned .how-pin { height: calc(100svh - var(--nav-h)); display: grid; align-items: center; }
.how.is-pinned .step-btn { cursor: pointer; }
.how.is-pinned .step:not(.is-active) .step-more { grid-template-rows: 0fr; }
.how.is-pinned .step:not(.is-active) h3 { color: var(--ink-3); }
.how.is-pinned .step:not(.is-active) .step-node { background: var(--bg); color: var(--ink-3); border-color: var(--line-strong); }
.how.is-pinned .step.is-done .step-node { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.how.is-pinned .step.is-done h3 { color: var(--ink-2); }
.how.is-pinned .step.is-active .step-node { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 .45rem var(--accent-soft); }
@media (hover: hover) { .how.is-pinned .step:not(.is-active) .step-btn:hover h3, .how.is-pinned .step:not(.is-active) .step-btn:hover { color: var(--ink); } }

/* imagens à direita: escura em cima, clara embaixo */
.how-visual { display: grid; justify-items: stretch; gap: 0; align-content: center; }
.how-img { margin: 0; border-radius: var(--radius-l); overflow: hidden; border: 1px solid var(--line-strong); box-shadow: var(--shadow-panel); background: var(--bg-raised); }
.how-img img { width: 100%; height: auto; aspect-ratio: 1344 / 768; object-fit: cover; }

/* balões extras do chat */
.chat-typing { display: inline-flex; gap: .22rem; padding: .55rem .7rem; border-radius: .75rem; background: var(--bubble-in); border: 1px solid var(--line); }
.chat-typing.out { align-self: flex-end; background: var(--bubble-out); border-color: var(--accent-soft); border-bottom-right-radius: .25rem; }
.chat-typing i { width: .3rem; height: .3rem; border-radius: 50%; background: var(--ink-3); animation: dot 1s ease-in-out infinite; }
.chat-typing i:nth-child(2) { animation-delay: .15s; } .chat-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }
.chat-typing[data-ty] { display: none; }
.rcp { display: grid; gap: .3rem; padding: .4rem; }
.rcp small { color: var(--ink-3); font-size: .6875rem; padding: 0 .25rem; }
.rcp-card { display: grid; gap: .3rem; width: 7.5rem; padding: .55rem; border-radius: .5rem; background: var(--bg-sunken); border: 1px dashed var(--line-strong); }
.rcp-card i { display: block; height: .3rem; border-radius: 2px; background: var(--line-strong); }
.rcp-card i:nth-child(2) { width: 70%; } .rcp-card i:nth-child(3) { width: 45%; }
.rcp-card b { display: block; height: .5rem; width: 55%; border-radius: 2px; background: var(--accent); margin-top: .2rem; }
.sys-chip { align-self: center; display: flex; margin: .1rem 0; padding: .35rem .75rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.sys-chip svg { width: .95rem; height: .95rem; flex: none; }
.sys-chip > span { display: inline-flex; align-items: center; gap: .4rem; }
.sys-chip > .sys-wait { display: none; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.file { display: flex; align-items: center; gap: .6rem; }
.file-ic { display: grid; place-items: center; width: 2rem; height: 2.4rem; border-radius: .4rem; background: var(--bg-sunken); color: var(--accent); flex: none; }
.file-ic svg { width: 1.2rem; height: 1.2rem; }
.file-t { display: grid; line-height: 1.25; } .file-t small { color: var(--ink-3); font-size: .6875rem; }

.how-close-wrap { padding: var(--s-9) 0 var(--s-10); text-align: center; }
.how-close { font-size: clamp(1.9rem, 1.2rem + 3vw, 3.6rem); max-width: 18em; margin-inline: auto; }

@media (max-width: 56rem) {
  .how-stage { grid-template-columns: 1fr; gap: var(--s-5); }
  .how.is-pinned .how-stage { grid-template-rows: auto auto; align-content: center; }
  .how.is-pinned .how-phone { order: -1; }
  .how.is-pinned .phone { height: min(22rem, calc(100svh - var(--nav-h) - 24rem)); min-height: 15rem; }
  .how.is-pinned .step p:not(.who) { font-size: .9375rem; line-height: 1.5; }
  .how.is-pinned .steps::before, .how.is-pinned .steps::after { display: none; }
  .how.is-pinned .step:not(.is-active) { display: none; }
  .how.is-pinned .step { padding-bottom: 0; }
  .how.is-pinned .step h3 { font-size: 1.25rem; }
}

/* seta entre as imagens: desce pela direita, atravessa e entra pela esquerda; pulsos de luz percorrem o trajeto */
.how-link { --link-h: 4rem; position: relative; display: block; width: 100%; height: var(--link-h); }
.how-link svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.how-link path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.hl-base { stroke: var(--line-strong); stroke-width: 2; }
.hl-flow { stroke: var(--accent); stroke-width: 3; stroke-dasharray: 10 400; stroke-dashoffset: 10; filter: drop-shadow(0 0 4px var(--accent)); animation: hl-run 2.8s cubic-bezier(.45,.05,.55,.95) infinite; }
.hl-flow-2 { animation-delay: -1.4s; }
@keyframes hl-run { from { stroke-dashoffset: 10; } to { stroke-dashoffset: -110; } }
.how-link::after { content: ""; position: absolute; left: 14%; bottom: 1px; width: .75rem; height: .75rem; translate: -50% 0; rotate: 45deg; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); }
@media (prefers-reduced-motion: reduce) { .hl-flow { animation: none; stroke-dasharray: none; stroke: var(--accent); filter: none; stroke-width: 2; } .hl-flow-2 { display: none; } }

/* com pin: as duas imagens cabem na altura da tela e ficam estáticas */
.how.is-pinned .how-visual { width: 100%; max-width: calc((100svh - var(--nav-h) - 3rem - 4rem) / 2 * 1.75); margin-inline: auto; }
.how-img:last-child img { aspect-ratio: 1376 / 600; object-position: 50% 62%; }

/* celular (usado em Especialista, Multimídia e Pagamentos) */
.phone { position: relative; width: min(17.5rem, 100%); height: min(35rem, calc(100svh - var(--nav-h) - 9rem)); min-height: 24rem; padding: .55rem; border-radius: 2.2rem; background: var(--bg-sunken); border: 1px solid var(--line-strong); box-shadow: var(--shadow-panel); }
.phone-screen { position: relative; height: 100%; border-radius: 1.7rem; overflow: hidden; background: var(--bg-raised); }
.phone .chat { border: 0; border-radius: 0; font-size: .8125rem; }
