/* EL VIAJERO: un compañero que camina mientras bajas por la página y hace algo distinto en cada sección.
   Pequeño, a un costado, nunca encima del texto. Se puede ocultar. Con "reducir movimiento", queda quieto. */
.vj { position: fixed; z-index: 60; left: 18px; bottom: 22px; width: 96px; pointer-events: none;
  opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
.vj.is-in { opacity: 1; transform: none; }
.vj { transition: opacity .5s ease, transform .5s ease, bottom .5s cubic-bezier(.3, .8, .3, 1); }
.vj.is-end { bottom: 190px; }
@media (max-width: 639px) { .vj.is-end { bottom: 230px; } }
.vj.is-away { opacity: 0; transform: translateY(16px); }
.vj svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 8px 10px rgb(28 15 92 / .28)); }
.vj__fig { transition: transform .3s ease; transform-origin: 50% 100%; }
.vj.is-up .vj__fig { transform: scaleX(-1); }

/* Partes que se mueven (ejes en coordenadas del dibujo) */
.vj .p { transform-box: view-box; transition: transform .35s cubic-bezier(.3, .8, .3, 1); }
.vj .leg-f { transform-origin: 56px 92px; }
.vj .leg-b { transform-origin: 50px 92px; }
.vj .arm-f { transform-origin: 57px 60px; }
.vj .arm-b { transform-origin: 51px 60px; }
.vj .body { transform-origin: 54px 120px; }
.vj .prop { opacity: 0; transition: opacity .3s ease; }

/* Caminar: piernas y brazos alternados, el cuerpo sube y baja un poquito */
.vj.is-walking .leg-f { animation: vj-a .46s ease-in-out infinite alternate; }
.vj.is-walking .leg-b { animation: vj-b .46s ease-in-out infinite alternate; }
.vj.is-walking .arm-f { animation: vj-b .46s ease-in-out infinite alternate; }
.vj.is-walking .arm-b { animation: vj-a .46s ease-in-out infinite alternate; }
.vj.is-walking .body { animation: vj-bob .23s ease-in-out infinite alternate; }
@keyframes vj-a { from { transform: rotate(24deg); } to { transform: rotate(-24deg); } }
@keyframes vj-b { from { transform: rotate(-24deg); } to { transform: rotate(24deg); } }
@keyframes vj-bob { to { transform: translateY(-2.5px); } }

/* Poses (cuando se detiene): una por sección */
.vj:not(.is-walking).pose-wave .arm-f { transform: rotate(-125deg); animation: vj-wave .7s ease-in-out infinite alternate; }
@keyframes vj-wave { from { transform: rotate(-108deg); } to { transform: rotate(-138deg); } }
.vj:not(.is-walking).pose-wave .suitcase { opacity: 1; }

.vj:not(.is-walking).pose-point .arm-f { transform: rotate(-82deg); }

.vj:not(.is-walking).pose-read .arm-f, .vj:not(.is-walking).pose-read .arm-b { transform: rotate(-58deg); }
.vj:not(.is-walking).pose-read .book { opacity: 1; }

.vj:not(.is-walking).pose-laptop .arm-f, .vj:not(.is-walking).pose-laptop .arm-b { transform: rotate(-52deg); }
.vj:not(.is-walking).pose-laptop .laptop { opacity: 1; }

.vj:not(.is-walking).pose-stairs .stairs { opacity: 1; }
.vj:not(.is-walking).pose-stairs .leg-f { transform: rotate(-22deg); }
.vj:not(.is-walking).pose-stairs .arm-f { transform: rotate(18deg); }
.vj:not(.is-walking).pose-stairs .arm-b { transform: rotate(-18deg); }

.vj:not(.is-walking).pose-selfie .arm-f { transform: rotate(-128deg); }
.vj:not(.is-walking).pose-selfie .phone { opacity: 1; }

.vj:not(.is-walking).pose-think .arm-f { transform: rotate(-140deg); }
.vj:not(.is-walking).pose-think .ask { opacity: 1; animation: vj-float 1.4s ease-in-out infinite alternate; }
@keyframes vj-float { to { transform: translateY(-4px); } }

.vj:not(.is-walking).pose-party .arm-f { transform: rotate(-122deg); }
.vj:not(.is-walking).pose-party .arm-b { transform: rotate(122deg); }
.vj:not(.is-walking).pose-party .body { animation: vj-jump .6s cubic-bezier(.3, .7, .4, 1) infinite alternate; }
.vj:not(.is-walking).pose-party .confetti { opacity: 1; }
@keyframes vj-jump { to { transform: translateY(-9px); } }

/* La burbuja de lo que dice */
.vj__bubble { position: absolute; left: calc(100% + 6px); bottom: 58%; width: max-content; max-width: 250px; padding: 10px 14px; border-radius: 16px 16px 16px 4px;
  background: #fff; color: #1c0f5c; box-shadow: 0 12px 30px -12px rgb(28 15 92 / .45); font: 600 14px/1.35 "Figtree", system-ui, sans-serif;
  opacity: 0; transform: translateY(6px) scale(.96); transform-origin: 0 100%; transition: opacity .3s ease, transform .35s cubic-bezier(.2, .9, .3, 1.3); }
.vj__bubble.is-on { opacity: 1; transform: none; }
.vj__bubble b { color: #ff2e93; }

/* Ocultar / volver a mostrar */
.vj__hide { position: absolute; top: -6px; right: -4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .92); color: #5d547f;
  box-shadow: 0 2px 8px rgb(0 0 0 / .18); font: 700 13px/1 "Figtree", system-ui, sans-serif; cursor: pointer; pointer-events: auto; opacity: .75; }
.vj__hide:hover, .vj__hide:focus-visible { opacity: 1; }
.vj-back { position: fixed; z-index: 60; left: 14px; bottom: 22px; border: 0; border-radius: 999px; padding: 8px 12px; background: #fff; color: #1c0f5c;
  box-shadow: 0 6px 18px -8px rgb(0 0 0 / .35); font: 700 13px/1 "Figtree", system-ui, sans-serif; cursor: pointer; }
.vj-back[hidden] { display: none; }

/* Celular: más pequeño, en la esquina, encima de la barra de pestañas */
@media (max-width: 639px) {
  .vj { left: 6px; bottom: 92px; width: 56px; }
  .vj__bubble { max-width: min(210px, calc(100vw - 90px)); font-size: 13px; padding: 8px 12px; bottom: 70%; }
  .vj-back { bottom: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  html:not(.forzar-animacion) .vj, html:not(.forzar-animacion) .vj .p, html:not(.forzar-animacion) .vj__bubble { transition: none; }
  html:not(.forzar-animacion) .vj.is-walking .p, html:not(.forzar-animacion) .vj .p, html:not(.forzar-animacion) .vj .ask { animation: none !important; }
}
