/* ==========================================================================
   CRUZA · Recorrido con scroll (statement + story con iPhone fijo)
   Easing y tiempos según emil-design-eng / apple-design
   ========================================================================== */
:root {
  --ease-out-strong: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out-strong: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --app-green: #00C896;
  --app-green-soft: #E6FAF4;
  --app-ink: #0F172A;
  --app-slate: #1E293B;
  --app-muted: #64748B;
  --app-line: #E2E8F0;
  --app-bg: #F8FAFC;
}

/* ---------- Statement: frase que se ilumina palabra a palabra ---------- */
.statement-section { padding: 18vh 0 14vh; background: #fff; }
.statement-text {
  max-width: 1040px; margin: 0 auto; padding: 0 24px;
  font-size: clamp(32px, 5.2vw, 72px); line-height: 1.08; font-weight: 800;
  letter-spacing: -0.035em; color: var(--app-ink);
}
.statement-text .w { color: rgba(15, 23, 42, 0.14); transition: color 220ms ease; }
.statement-text .w.on { color: var(--app-ink); }
.statement-text .w.g.on { color: var(--app-green); }

/* ---------- Story ---------- */
.story-section { position: relative; background: linear-gradient(180deg, #fff 0%, #F4FBF8 50%, #fff 100%); padding: 120px 0 40px; }
.story-head { text-align: center; max-width: 760px; margin: 0 auto; padding: 0 24px; }
.story-head .section-subtitle { margin-left: auto; margin-right: auto; }

.story {
  position: relative; max-width: 1180px; margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px;
}
.story-steps { position: relative; padding-left: 40px; }
.story-rail { position: absolute; left: 8px; top: 50vh; bottom: 50vh; width: 2px; background: var(--app-line); border-radius: 2px; }
.story-rail i { position: absolute; inset: 0 0 auto 0; height: 0; background: var(--app-green); border-radius: 2px; }

.story-step {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  opacity: .28; transform: translateY(12px);
  transition: opacity 500ms var(--ease-out-strong), transform 500ms var(--ease-out-strong);
}
.story-step.is-active { opacity: 1; transform: none; }
.story-step .num {
  display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700;
  color: var(--app-green); letter-spacing: .02em; margin-bottom: 14px;
}
.story-step .num b {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--app-green-soft); color: #047857; font-size: 13px;
}
.story-step h3 { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.06; letter-spacing: -0.03em; font-weight: 800; color: var(--app-ink); margin: 0 0 18px; }
.story-step p { font-size: 18px; line-height: 1.6; color: #475569; max-width: 460px; margin: 0 0 22px; }
.story-step ul { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 10px; }
.story-step li { display: flex; gap: 10px; align-items: flex-start; font-size: 15.5px; color: #334155; line-height: 1.45; }
.story-step li::before {
  content: ""; flex: 0 0 18px; height: 18px; margin-top: 2px; border-radius: 50%;
  background: var(--app-green-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4.5 8.2 2.3 2.3 4.7-5' fill='none' stroke='%23059669' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat;
}

/* ---------- iPhone fijo ---------- */
.story-stage { position: relative; }
.story-sticky { position: sticky; top: 0; height: 100vh; display: grid; place-items: center; }
.phone-x {
  --ph-w: 318px; --ph-h: 660px;
  position: relative; width: var(--ph-w); height: var(--ph-h);
  border-radius: 54px; padding: 12px; background: #0B1220;
  box-shadow: 0 0 0 2px #2A3447 inset, 0 40px 80px -20px rgba(15, 23, 42, .35), 0 18px 36px -18px rgba(0, 200, 150, .35);
  transform: scale(var(--ph-scale, 1)) translateY(var(--ph-y, 0px));
  will-change: transform;
}
.phone-x::before { /* Dynamic Island */
  content: ""; position: absolute; top: 22px; left: 50%; width: 104px; height: 30px; margin-left: -52px;
  border-radius: 20px; background: #000; z-index: 5;
}
.phone-x__screen { position: relative; height: 100%; border-radius: 42px; overflow: hidden; background: var(--app-bg); font-family: var(--cruza-font); color: var(--app-slate); }
.app-status { height: 46px; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 26px 6px; font-size: 13px; font-weight: 700; color: var(--app-ink); }
.app-status span:last-child { letter-spacing: .08em; font-size: 11px; }
.app-top { height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--app-line); }
.app-top__brand { display: flex; align-items: center; gap: 6px; font-weight: 800; letter-spacing: .14em; font-size: 13px; color: var(--app-ink); }
.app-top__brand img { width: 22px; height: 22px; }
.app-top__bell { width: 30px; height: 30px; border-radius: 50%; background: var(--app-bg); display: grid; place-items: center; position: relative; }
.app-top__bell::after { content: ""; position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: #EF4444; box-shadow: 0 0 0 2px #fff; }

.app-screens { position: absolute; inset: 94px 0 74px; }
.app-screen {
  position: absolute; inset: 0; padding: 14px 14px 0; overflow: hidden;
  opacity: 0; transform: translateY(14px) scale(.985); filter: blur(4px);
  transition: opacity 420ms var(--ease-out-strong), transform 520ms var(--ease-out-strong), filter 420ms var(--ease-out-strong);
  pointer-events: none;
}
.app-screen.is-on { opacity: 1; transform: none; filter: blur(0); }

.app-tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 74px; padding: 6px 10px 18px;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; background: #fff; border-top: 1px solid var(--app-line);
}
.app-tab { display: grid; justify-items: center; gap: 3px; font-size: 9.5px; font-weight: 600; color: #94A3B8; transition: color 250ms ease; }
.app-tab svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-tab.is-on { color: var(--app-green); }
.app-tab--scan { transform: translateY(-12px); }
.app-tab--scan span:first-child {
  width: 50px; height: 50px; border-radius: 50%; background: var(--app-green); display: grid; place-items: center;
  box-shadow: 0 8px 18px -6px rgba(0, 200, 150, .7); color: #fff; transition: transform 300ms var(--ease-out-strong);
}
.app-tab--scan.is-on span:first-child { transform: scale(1.08); }
.app-tab--scan svg { stroke: #fff; }

/* ---------- Piezas de la app ---------- */
.a-hi { font-size: 11px; color: var(--app-muted); }
.a-title { font-size: 17px; font-weight: 800; color: var(--app-ink); letter-spacing: -.01em; margin: 1px 0 10px; }
.a-card { background: #fff; border: 1px solid var(--app-line); border-radius: 16px; padding: 12px; }
.a-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--app-green-soft); color: #047857; }
.a-pill--amber { background: #FEF3C7; color: #B45309; }
.a-search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--app-line); border-radius: 12px; background: #fff; font-size: 12.5px; color: var(--app-ink); }
.a-search svg { width: 15px; height: 15px; stroke: var(--app-muted); fill: none; stroke-width: 2; }
.a-caret { display: inline-block; width: 1.5px; height: 14px; background: var(--app-green); margin-left: 1px; vertical-align: -2px; animation: aCaret 1s steps(1) infinite; }
@keyframes aCaret { 50% { opacity: 0; } }
.a-chips { display: flex; gap: 6px; margin: 10px 0; overflow: hidden; }
.a-chip { flex: none; font-size: 10.5px; font-weight: 600; padding: 5px 10px; border-radius: 99px; background: #fff; border: 1px solid var(--app-line); color: #475569; }
.a-chip.on { background: var(--app-green); border-color: var(--app-green); color: #fff; }

/* aparición escalonada genérica: .stg hijos entran cuando el padre tiene .play */
.stg > * { opacity: 0; transform: translateY(10px); transition: opacity 360ms var(--ease-out-strong), transform 420ms var(--ease-out-strong); }
.play .stg > * { opacity: 1; transform: none; }
.play .stg > *:nth-child(2) { transition-delay: 70ms; }
.play .stg > *:nth-child(3) { transition-delay: 140ms; }
.play .stg > *:nth-child(4) { transition-delay: 210ms; }
.play .stg > *:nth-child(5) { transition-delay: 280ms; }

/* 1 · Descubre */
.biz { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 10px; margin-bottom: 8px; transition: border-color 300ms ease, box-shadow 300ms ease, opacity 360ms var(--ease-out-strong), transform 420ms var(--ease-out-strong); }
.biz__ph { width: 44px; height: 44px; border-radius: 12px; background-size: cover; background-position: center; }
.biz b { display: block; font-size: 12.5px; color: var(--app-ink); }
.biz small { font-size: 10.5px; color: var(--app-muted); }
.biz em { font-style: normal; font-size: 10px; font-weight: 800; color: #047857; }
.biz.sel { border-color: var(--app-green); box-shadow: 0 0 0 3px rgba(0, 200, 150, .15); }
.a-propose { display: flex; align-items: center; justify-content: center; gap: 6px; height: 40px; border-radius: 12px; background: var(--app-green); color: #fff; font-size: 12.5px; font-weight: 700; margin-top: 4px; opacity: 0; transform: translateY(8px); transition: opacity 360ms var(--ease-out-strong), transform 420ms var(--ease-out-strong); }
.a-propose.show { opacity: 1; transform: none; }

/* 2 · Conecta */
.chat-head { display: flex; align-items: center; gap: 9px; padding-bottom: 10px; border-bottom: 1px solid var(--app-line); margin-bottom: 10px; }
.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: #F59E0B; flex: none; }
.chat-head b { display: block; font-size: 12.5px; color: var(--app-ink); }
.chat-head small { font-size: 10px; color: var(--app-green); font-weight: 600; }
.bub { max-width: 82%; font-size: 11.5px; line-height: 1.45; padding: 9px 11px; border-radius: 14px; margin-bottom: 8px; opacity: 0; transform: translateY(8px) scale(.98); transition: opacity 320ms var(--ease-out-strong), transform 380ms var(--ease-out-strong); }
.bub.in { opacity: 1; transform: none; }
.bub--them { background: #fff; border: 1px solid var(--app-line); border-bottom-left-radius: 4px; }
.bub--me { margin-left: auto; background: var(--app-green); color: #fff; border-bottom-right-radius: 4px; }
.bub small { display: block; font-size: 9px; opacity: .7; margin-top: 3px; text-align: right; }
.proposal { border: 1px solid var(--app-green); background: var(--app-green-soft); border-radius: 14px; padding: 10px; font-size: 11px; color: #065F46; margin-bottom: 8px; opacity: 0; transform: translateY(8px); transition: opacity 320ms var(--ease-out-strong), transform 380ms var(--ease-out-strong); }
.proposal.in { opacity: 1; transform: none; }
.proposal b { display: block; font-size: 12px; color: var(--app-ink); margin: 2px 0; }
.typing { display: inline-flex; gap: 3px; padding: 10px 12px; background: #fff; border: 1px solid var(--app-line); border-radius: 14px; border-bottom-left-radius: 4px; opacity: 0; transition: opacity 200ms ease; }
.typing.in { opacity: 1; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: #94A3B8; animation: aDot 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes aDot { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-3px); opacity: 1; } }

/* 3 · Activa */
.deal-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--app-line); font-size: 12px; color: #334155; }
.deal-row:last-child { border-bottom: 0; }
.deal-row b { margin-left: auto; color: var(--app-ink); font-size: 12px; }
.tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #CBD5E1; display: grid; place-items: center; flex: none; transition: background 250ms ease, border-color 250ms ease; }
.tick svg { width: 11px; height: 11px; stroke: #fff; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 14; stroke-dashoffset: 14; transition: stroke-dashoffset 300ms var(--ease-out-strong) 80ms; }
.deal-row.ok .tick { background: var(--app-green); border-color: var(--app-green); }
.deal-row.ok .tick svg { stroke-dashoffset: 0; }
.bar { height: 6px; border-radius: 6px; background: var(--app-line); overflow: hidden; margin: 8px 0 4px; }
.bar i { display: block; height: 100%; width: var(--w, 0%); background: var(--app-green); transition: width 500ms var(--ease-out-strong); }
.a-active { display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px; border-radius: 12px; background: var(--app-ink); color: #fff; font-size: 12.5px; font-weight: 700; margin-top: 12px; transition: background 300ms ease; }
.a-active.done { background: var(--app-green); }
.a-active .pop { display: inline-block; transform: scale(.9); opacity: 0; transition: transform 380ms var(--ease-out-strong), opacity 250ms ease; }
.a-active.done .pop { transform: scale(1); opacity: 1; }

/* 4 · Valida */
.app-screen--dark { background: #0B1220; color: #fff; }
.scan-title { font-size: 12px; font-weight: 700; color: #CBD5E1; text-align: center; margin: 4px 0 14px; }
.scan-box { position: relative; width: 210px; height: 210px; margin: 0 auto; border-radius: 22px; background: radial-gradient(circle at 50% 50%, #1E293B, #0B1220 70%); }
.scan-box > i { position: absolute; width: 34px; height: 34px; border: 3px solid var(--app-green); }
.scan-box > i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 20px; }
.scan-box > i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 20px; }
.scan-box > i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 20px; }
.scan-box > i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 20px; }
.scan-qr { position: absolute; inset: 40px; display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; opacity: .9; }
.scan-qr span { background: #fff; border-radius: 1.5px; }
.scan-qr span.o { background: transparent; }
.scan-line { position: absolute; left: 14px; right: 14px; top: 16px; height: 2px; background: var(--app-green); box-shadow: 0 0 14px 2px rgba(0, 200, 150, .7); border-radius: 2px; }
.play .scan-line { animation: aScan 1.6s var(--ease-in-out-strong) infinite alternate; }
@keyframes aScan { to { transform: translateY(176px); } }
.scan-hint { text-align: center; font-size: 11px; color: #94A3B8; margin-top: 14px; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; background: #fff; color: var(--app-slate);
  border-radius: 22px 22px 0 0; padding: 10px 16px 18px; transform: translateY(105%);
  transition: transform 560ms var(--ease-drawer);
  box-shadow: 0 -20px 40px -10px rgba(0, 0, 0, .35);
}
.sheet.up { transform: none; }
.sheet::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 4px; background: #CBD5E1; margin: 0 auto 12px; }
.sheet__ok { width: 46px; height: 46px; border-radius: 50%; background: var(--app-green-soft); display: grid; place-items: center; margin: 0 auto 8px; }
.sheet__ok svg { width: 24px; height: 24px; stroke: var(--app-green); fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset 420ms var(--ease-out-strong) 380ms; }
.sheet.up .sheet__ok svg { stroke-dashoffset: 0; }
.sheet h5 { text-align: center; font-size: 16px; font-weight: 800; color: var(--app-ink); margin: 0 0 2px; }
.sheet .code { text-align: center; font-size: 10.5px; color: var(--app-muted); margin-bottom: 10px; }
.sheet .a-card { font-size: 11.5px; display: grid; gap: 6px; }
.sheet .money { display: flex; justify-content: space-between; font-weight: 700; color: var(--app-ink); }
.sheet .money b { color: #047857; }

/* 5 · Mide */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.kpi { padding: 10px; }
.kpi small { display: block; font-size: 10px; color: var(--app-muted); }
.kpi b { font-size: 18px; color: var(--app-ink); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .a-pill { margin-top: 4px; }
.chart { display: flex; align-items: flex-end; gap: 7px; height: 92px; padding-top: 8px; }
.chart i { flex: 1; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #34D399, var(--app-green)); height: var(--h); transform: scaleY(0); transform-origin: bottom; transition: transform 700ms var(--ease-out-strong); }
.play .chart i { transform: scaleY(1); }
.chart i:nth-child(2) { transition-delay: 60ms; } .chart i:nth-child(3) { transition-delay: 120ms; } .chart i:nth-child(4) { transition-delay: 180ms; }
.chart i:nth-child(5) { transition-delay: 240ms; } .chart i:nth-child(6) { transition-delay: 300ms; } .chart i:nth-child(7) { transition-delay: 360ms; }
.chart-days { display: flex; gap: 7px; font-size: 9px; color: #94A3B8; margin-top: 4px; }
.chart-days span { flex: 1; text-align: center; }
.toast {
  position: absolute; left: 10px; right: 10px; top: 8px; display: flex; gap: 9px; align-items: center;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(16px) saturate(180%); -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--app-line); border-radius: 16px; padding: 10px; font-size: 11px; box-shadow: 0 12px 30px -12px rgba(15, 23, 42, .3);
  transform: translateY(-130%); opacity: 0; transition: transform 520ms var(--ease-drawer), opacity 300ms ease;
}
.toast.in { transform: none; opacity: 1; }
.toast b { display: block; font-size: 11.5px; color: var(--app-ink); }
.toast .ic { width: 30px; height: 30px; border-radius: 10px; background: var(--app-green-soft); display: grid; place-items: center; flex: none; }
.toast .ic svg { width: 16px; height: 16px; stroke: #059669; fill: none; stroke-width: 2.2; }

/* ---------- Responsive: móvil ---------- */
@media (max-width: 900px) {
  .story-section { padding: 72px 0 0; }
  .story { display: flex; flex-direction: column; padding: 0; gap: 0; }
  /* el iPhone y el texto viven en una pantalla fija; los pasos solo marcan el ritmo del scroll */
  .story-stage { order: -1; position: sticky; top: 0; height: 100svh; z-index: 1; }
  .story-sticky { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 96px 20px 0; background: #F4FBF8; }
  .phone-fit { height: calc(660px * var(--fit, .6)); flex: none; }
  .phone-x { --ph-y: 0px !important; transform-origin: top center; }
  .story-steps { margin-top: -100svh; padding: 0; visibility: hidden; }
  .story-step { min-height: 85svh; }
  .story-step:last-child { min-height: 100svh; }
  .story-rail { display: none; }
  .story-caption { width: 100%; max-width: 420px; margin-top: 22px; text-align: left; transition: opacity 220ms ease, transform 320ms var(--ease-out-strong), filter 220ms ease; }
  .story-caption.out { opacity: 0; transform: translateY(8px); filter: blur(3px); }
  .story-caption .num { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--app-green); margin-bottom: 8px; }
  .story-caption .num b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--app-green-soft); color: #047857; font-size: 12px; }
  .story-caption h3 { font-size: 23px; line-height: 1.15; letter-spacing: -.025em; font-weight: 800; color: var(--app-ink); margin: 0 0 8px; }
  .story-caption p { font-size: 15.5px; line-height: 1.5; color: #475569; margin: 0 0 14px; }
  .story-caption .btn-demo-header { display: inline-flex; padding: 12px 20px; font-size: 14px; }
  .story-dots { display: flex; gap: 6px; margin-top: 4px; }
  .story-dots i { width: 6px; height: 6px; border-radius: 6px; background: #CBD5E1; transition: width 300ms var(--ease-out-strong), background 250ms ease; }
  .story-dots i.on { width: 22px; background: var(--app-green); }
  .statement-section { padding: 12vh 0 10vh; }
}
@media (min-width: 901px) { .story-caption, .story-dots { display: none; } .phone-fit { display: contents; } }


/* ---------- Movimiento reducido: sin desplazamientos, solo fundidos ---------- */
@media (prefers-reduced-motion: reduce) {
  .story-step, .app-screen, .stg > *, .bub, .proposal, .biz, .a-propose, .sheet, .toast, .chart i { transition-duration: 150ms !important; transition-delay: 0ms !important; transform: none !important; filter: none !important; }
  .play .scan-line, .a-caret, .typing i { animation: none !important; }
  .phone-x { transform: none !important; }
  .statement-text .w { color: var(--app-ink); }
}
body { overflow-x: clip; }
