/* =====================================================================
   Qhawaq · Escenas que avanzan con el scroll («while scrolling in view»)
   JS fija en cada sección: --p (0 → 1) y, en la historia, --s0 … --s4.
   Sin JS o con movimiento reducido, todo se muestra completo y sin fijar.
   ===================================================================== */

/* ---------- Portada: el texto se eleva y la foto crece al bajar ---------- */
.hero { --p: 0; }
.motion .hero .hero-copy { translate: 0 calc(var(--p) * -90px); opacity: calc(1 - var(--p) * 1.3); }
.motion .hero .hero-media { scale: calc(1 + var(--p) * .18); translate: 0 calc(var(--p) * 70px); opacity: calc(1 - var(--p) * .6); }
.motion .hero .scroll-hint { opacity: calc(1 - var(--p) * 4); }

/* ---------- Frase que se ilumina palabra por palabra ---------- */
.wordfill { --p: 1; position: relative; color: #fff; background: #04122a; }
.wf-stage { position: relative; overflow: hidden; min-height: 80vh; display: grid; place-items: center; padding: 120px 0; isolation: isolate; }
.wf-bg { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; z-index: -2; scale: calc(1.25 - var(--p) * .25); filter: blur(calc((1 - var(--p)) * 4px)); }
.wf-shade { position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 50% 50%, rgba(4, 18, 42, .72), rgba(4, 18, 42, .96) 75%); }
.wf-in { text-align: center; max-width: 1000px; }
.wf-text { font-size: clamp(2rem, 5.6vw, 4.6rem); font-weight: 800; line-height: 1.08; letter-spacing: -.03em; margin: 0; }
.wf-text .w { display: inline-block; opacity: .16; transform: translateY(8px); filter: blur(2px); transition: opacity .35s ease, transform .35s ease, filter .35s ease, color .35s ease; }
.wf-text .w.on { opacity: 1; transform: none; filter: none; }
.wf-text .w.hl-w.on { color: var(--accent); }
.wf-chips { list-style: none; padding: 0; margin: 36px 0 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.wf-chips li { padding: 9px 18px; border-radius: 999px; background: rgba(239, 68, 68, .18); border: 1px solid rgba(252, 165, 165, .5); color: #fecaca; font-weight: 700; }
.motion .wordfill { height: 260vh; }
.motion .wf-stage { position: sticky; top: 0; height: 100vh; min-height: 0; padding: 0; }
.motion .wf-chips li { opacity: clamp(0, (var(--p) - .72) * 8 - var(--ci, 0) * .6, 1); translate: 0 calc((1 - clamp(0, (var(--p) - .72) * 8 - var(--ci, 0) * .6, 1)) * 20px); }
.wf-chips li:nth-child(2) { --ci: 1; }
.wf-chips li:nth-child(3) { --ci: 2; }

/* ---------- Historia fija: cómo funciona ---------- */
.story { --s0: 1; --s1: 1; --s2: 1; --s3: 1; --s4: 1; --p: 1; position: relative; color: #fff; background: radial-gradient(900px 600px at 80% 40%, rgba(8, 145, 178, .25), transparent 70%), linear-gradient(160deg, var(--navy-950), #04122a); }
.story-stage { display: flex; align-items: center; padding: 110px 0 90px; }
.story-in { display: grid; grid-template-columns: .85fr 1.15fr; gap: 64px; align-items: center; }
.story-title { font-size: clamp(1.7rem, 3vw, 2.5rem); margin-bottom: 28px; }
.story-steps { list-style: none; padding: 0; margin: 0 0 26px; display: grid; gap: 14px; }
.story-steps li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .03); transition: background .4s ease, border-color .4s ease, opacity .4s ease, transform .4s ease; }
.story-steps .icon { margin: 0; flex: none; background: rgba(34, 211, 238, .14); color: var(--accent); }
.story-steps h3 { margin: 2px 0 2px; color: #fff; }
.story-steps p { margin: 0; color: #cbd5e1; font-size: .95rem; }
.step-num { font-size: .75rem; font-weight: 800; color: var(--accent); letter-spacing: .1em; }
.story-progress { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); margin-bottom: 22px; overflow: hidden; }
.story-progress span { display: block; height: 100%; width: calc(var(--p) * 100%); background: linear-gradient(90deg, var(--accent), #3b82f6, #10b981); }

.motion .story { height: 560vh; }
.motion .story-stage { position: sticky; top: 0; height: 100vh; padding: 100px 0 30px; }
.motion .story-steps li { opacity: .35; transform: scale(.97); }
.motion .story-steps li.done { opacity: .6; }
.motion .story-steps li.on { opacity: 1; transform: none; background: rgba(34, 211, 238, .1); border-color: rgba(34, 211, 238, .45); }
.motion .story-steps li.on .icon { background: var(--accent); color: var(--navy-950); }

/* Escena visual */
.story-visual { position: relative; padding: 0 30px 110px 0; }
.sv-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden; border: 1px solid rgba(34, 211, 238, .35); box-shadow: 0 40px 80px rgba(0, 0, 0, .5); scale: calc(.9 + var(--s0) * .1); opacity: calc(.4 + var(--s0) * .6); }
.sv-frame img { width: 100%; height: 100%; object-fit: cover; scale: calc(1.15 - var(--s1) * .15); filter: saturate(calc(.4 + var(--s0) * .6)) brightness(calc(1 - var(--s3) * .35)); }
.sv-scan { position: absolute; left: 0; right: 0; height: 3px; top: calc(var(--s0) * 100%); background: var(--accent); box-shadow: 0 0 24px 6px rgba(34, 211, 238, .6); opacity: calc((1 - var(--s1)) * min(1, var(--s0) * 6)); }
.sv-scan::after { content: ""; position: absolute; left: 0; right: 0; bottom: 3px; height: 90px; background: linear-gradient(to top, rgba(34, 211, 238, .22), transparent); }
.sv-box { position: absolute; left: 46.5%; top: 56%; width: 16%; height: 42%; border: 3px solid #f87171; border-radius: 6px; box-shadow: 0 0 0 9999px rgba(4, 18, 42, calc(var(--s1) * .35)), 0 0 24px rgba(248, 113, 113, .6); opacity: var(--s1); scale: calc(1.6 - var(--s1) * .6); }
.sv-box span { position: absolute; left: -3px; top: -30px; white-space: nowrap; padding: 4px 10px; border-radius: 6px 6px 6px 0; background: #ef4444; color: #fff; font-size: .78rem; font-weight: 800; }
.sv-tag { position: absolute; left: 14px; top: 14px; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: rgba(7, 29, 64, .85); border: 1px solid rgba(34, 211, 238, .4); font-size: .82rem; opacity: calc(min(1, var(--s0) * 3) * (1 - var(--s2))); }
.sv-tag .icon.xs { width: 26px; height: 26px; border-radius: 50%; }
.sv-tag .icon.xs svg { width: 15px; height: 15px; animation: spin 2s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

.sv-phone { position: absolute; right: -6px; top: 30%; width: 210px; padding: 14px 10px; border-radius: 30px; background: #0b1220; border: 8px solid #1e293b; box-shadow: 0 30px 60px rgba(0, 0, 0, .55); opacity: var(--s2); translate: calc((1 - var(--s2)) * 160px) calc((1 - var(--s2)) * 40px); rotate: calc((1 - var(--s2)) * 12deg); }
.sv-notif { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; background: #fff; color: var(--ink); font-size: .78rem; scale: calc(.8 + var(--s2) * .2); }
.sv-notif strong { font-size: .9rem; }
.sv-notif span { color: #475569; }
.sv-notif .notif-app { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--cyan-700); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }
.sv-notif .icon.xs { width: 18px; height: 18px; border-radius: 5px; background: var(--navy-950); color: var(--accent); }
.sv-notif .icon.xs svg { width: 12px; height: 12px; }

.sv-map { position: absolute; left: -26px; bottom: 34px; width: 300px; height: 170px; border-radius: 16px; overflow: hidden; border: 1px solid rgba(34, 211, 238, .4); box-shadow: 0 30px 60px rgba(0, 0, 0, .55); opacity: var(--s3); translate: calc((1 - var(--s3)) * -120px) calc((1 - var(--s3)) * 60px); scale: calc(.85 + var(--s3) * .15); }
.sv-map .map-mock { position: absolute; inset: 0; min-height: 0; border-radius: 0; }

.sv-states { position: absolute; left: 0; right: 30px; bottom: -6px; opacity: min(1, calc(var(--s3) * 2 + var(--s4))); }
.sv-track { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.sv-track span { display: block; height: 100%; width: calc(var(--s4) * 100%); background: linear-gradient(90deg, #ef4444, #f59e0b, #0ea5e9, #10b981); }
.sv-states ul { list-style: none; padding: 0; margin: 10px 0 0; display: flex; justify-content: space-between; font-size: .85rem; font-weight: 700; color: #64748b; }
.sv-states li { transition: color .3s ease; }
.sv-states li.lit:nth-child(1) { color: #fca5a5; }
.sv-states li.lit:nth-child(2) { color: #fcd34d; }
.sv-states li.lit:nth-child(3) { color: #7dd3fc; }
.sv-states li.lit:nth-child(4) { color: #6ee7b7; }

/* ---------- Desplazamiento horizontal: para quién ---------- */
.hscroll { --p: 0; position: relative; background: var(--soft); }
.hs-stage { overflow: hidden; padding: 90px 0; }
.hs-track { display: flex; gap: 24px; padding: 0 max(16px, calc((100vw - 1180px) / 2)); width: max-content; }
.hs-intro { width: min(380px, 80vw); flex: none; align-self: center; }
.hs-intro h2 { font-size: clamp(1.8rem, 3.4vw, 2.8rem); }
.hs-hint { color: var(--cyan-700); font-weight: 700; }
.hs-card { position: relative; flex: none; width: min(460px, 78vw); height: min(560px, 68vh); border-radius: 24px; overflow: hidden; color: #fff; text-decoration: none; isolation: isolate; box-shadow: 0 30px 60px rgba(7, 29, 64, .25); }
.hs-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: scale .8s ease; }
.hs-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(4, 18, 42, .97) 18%, rgba(4, 18, 42, .1)); }
.hs-card:hover img { scale: 1.07; }
.hs-card-in { position: absolute; left: 26px; right: 26px; bottom: 26px; display: grid; gap: 6px; }
.hs-card-in .icon { margin: 6px 0; background: rgba(255, 255, 255, .15); }
.hs-card-in b { font-size: 1.6rem; }
.hs-card-in em { font-style: normal; color: #e2e8f0; }
.hs-card-in .more { margin-top: 8px; font-weight: 700; color: var(--accent); }
.hs-num { font-size: 3.2rem; font-weight: 800; color: rgba(255, 255, 255, .28); line-height: 1; }
.hs-end { flex: none; width: min(340px, 78vw); align-self: center; padding: 32px; border-radius: 24px; background: linear-gradient(160deg, var(--navy-950), var(--cyan-700)); color: #fff; }
.hs-end p { color: #cbd5e1; }
.hs-bar { width: min(1180px, 100% - 32px); margin: 34px auto 0; height: 4px; border-radius: 4px; background: #dbe3ee; overflow: hidden; }
.hs-bar span { display: block; height: 100%; width: calc(var(--p) * 100%); background: linear-gradient(90deg, var(--cyan-600), #3b82f6); }

/* Sin movimiento: tarjetas en cuadrícula */
html:not(.motion) .hs-track { flex-wrap: wrap; width: auto; padding: 0 16px; max-width: 1180px; margin: 0 auto; }
html:not(.motion) .hs-bar { display: none; }

.motion .hscroll { height: var(--hs-height, 300vh); }
.motion .hs-stage { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 70px 0 20px; }
.motion .hs-track { translate: calc(var(--hs-x, 0) * 1px) 0; will-change: translate; }
.motion .hs-card { rotate: calc(var(--tilt, 0) * 1deg); }

/* ---------- Pantallas pequeñas ---------- */
@media (max-width: 900px) {
  .story-in { grid-template-columns: 1fr; gap: 20px; }
  .motion .story-stage { padding: 74px 0 16px; align-items: flex-start; }
  .story-title { font-size: 1.5rem; margin-bottom: 12px; }
  .motion .story-steps { position: relative; min-height: 96px; margin-bottom: 12px; }
  .motion .story-steps li { position: absolute; inset: 0 0 auto 0; opacity: 0; transform: translateY(14px); }
  .motion .story-steps li.on { opacity: 1; transform: none; }
  .motion .story-steps li.done { opacity: 0; }
  .story-text .link-arrow { display: none; }
  .story-visual { padding: 0 0 70px; max-width: 520px; }
  .sv-phone { width: 160px; right: 0; top: 18%; }
  .sv-map { width: 190px; height: 110px; left: 0; bottom: 34px; }
  .sv-states { right: 0; }
  .hs-num { display: none; }
}
@media (max-width: 560px) {
  .story-steps p { font-size: .88rem; }
  .sv-states ul { font-size: .72rem; }
  .wf-text { font-size: 2.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .wf-bg { scale: 1; filter: none; }
}

/* ---------- Cabeceras internas: el texto se eleva y se desvanece al bajar ---------- */
.page-hero { --p: 0; }
.motion .page-hero .hero-anim { translate: 0 calc(var(--p) * -80px); opacity: calc(1 - var(--p) * 1.4); }
.motion .page-hero .hero-media { scale: calc(1 + var(--p) * .15); translate: 0 calc(var(--p) * 60px); }

/* ---------- Captura que se endereza y se acerca (sección fija) ---------- */
.showcase-scrub { --p: 1; --q: 1; position: relative; color: #fff; background: radial-gradient(800px 500px at 50% 60%, rgba(8, 145, 178, .28), transparent 70%), linear-gradient(160deg, var(--navy-950), #04122a); }
.ss-stage { padding: 96px 0 72px; }
.showcase-scrub .head { text-align: center; margin-inline: auto; }
.showcase-scrub .head h2::after { left: 50%; translate: -50% 0; }
.ss-browser { max-width: 1080px; margin: 0 auto; transform-origin: 50% 80%; transform: perspective(1400px) rotateX(calc((1 - var(--q)) * 32deg)) scale(calc(.72 + var(--q) * .28)); }
.ss-browser .badge-float { animation: none; opacity: 0; translate: 0 18px; transition: opacity .45s ease, translate .45s ease; }
.ss-browser .badge-float.on { opacity: 1; translate: 0 0; }
html:not(.motion) .ss-browser .badge-float { opacity: 1; translate: 0 0; }
.motion .showcase-scrub { height: 260vh; }
.motion .ss-stage { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 104px 0 20px; }
.motion .ss-stage .head { margin-bottom: 24px; }
.motion .ss-browser { width: min(1080px, calc((100vh - 260px) * 1.6)); }

/* ---------- Tarjetas que suben escalonadas con el scroll ---------- */
.motion [data-scrub="rise"] > * { --r: clamp(0, (var(--p, 0) - .05) * 5 - var(--i, 0) * .25, 1); opacity: var(--r); translate: 0 calc((1 - var(--r)) * 110px); rotate: calc((1 - var(--r)) * 4deg); }

/* ---------- Antes / con Qhawaq ---------- */
.vs { --p: 1; }
.motion .vs .before li { transition: opacity .5s ease, filter .5s ease, transform .5s ease; }
.motion .vs .before li.off { opacity: .45; filter: grayscale(1); transform: scale(.97); text-decoration: line-through; text-decoration-thickness: 2px; }
.motion .vs .after li { opacity: 0; transform: translateX(60px); transition: opacity .55s cubic-bezier(.2, .7, .2, 1), transform .55s cubic-bezier(.2, .7, .2, 1); }
.motion .vs .after li.on { opacity: 1; transform: none; }
.motion .vs-mid .icon { rotate: calc((1 - clamp(0, var(--p) * 2.5, 1)) * -180deg); scale: calc(.8 + clamp(0, var(--p) * 2.5, 1) * .3); }
@media (max-width: 900px) { .motion .vs .after li { transform: translateY(30px); } }

/* ---------- Palabra gigante rellena con una foto ---------- */
.zoomtext { --p: 1; position: relative; background: #04122a; color: #fff; overflow-x: clip; }
.zt-stage { min-height: 80vh; display: grid; place-content: center; text-align: center; padding: 100px 16px; overflow: hidden; }
.zt-word { margin: 0; font-size: clamp(4rem, 18vw, 15rem); font-weight: 800; line-height: .9; letter-spacing: calc((1 - var(--p)) * .35em); background: url(/img/qhawaq-expandiendose.jpg) center / cover; -webkit-background-clip: text; background-clip: text; color: transparent; scale: calc(2.2 - var(--p) * 1.2); filter: drop-shadow(0 10px 40px rgba(34, 211, 238, .25)); }
.zt-sub { margin: 26px auto 0; max-width: 560px; font-size: clamp(1.1rem, 2vw, 1.5rem); color: #cbd5e1; opacity: clamp(0, (var(--p) - .55) * 4, 1); translate: 0 calc((1 - clamp(0, (var(--p) - .55) * 4, 1)) * 20px); }
.zoomtext .kicker { opacity: clamp(0, (var(--p) - .4) * 4, 1); }
.motion .zoomtext { height: 240vh; }
.motion .zt-stage { position: sticky; top: 0; height: 100vh; min-height: 0; }
