/* ═══════════════════════════════════════════════════════════════════
   HALYON — pipo.css
   Pipo en halyon.team: el mismo personaje del producto (halyon.app),
   abajo a la derecha (en el lugar del viejo WhatsApp flotante) y, durante
   el intro, arriba a la derecha en el menú.
   Responde dudas sobre Halyon Team y, a las pocas preguntas, pasa la
   charla al equipo por WhatsApp (ver pipo.js).
   ═══════════════════════════════════════════════════════════════════ */
.pipo-flota, .pipo-panel {
  --p-superficie: #FFFFFF;
  --p-superficie-2: #EFEFF3;
  --p-linea: rgba(21,18,31,0.12);
  --p-sombra: 0 2px 4px rgba(21,18,31,0.06), 0 28px 56px -24px rgba(21,18,31,0.32);
  --p-acento-suave: #EFEAFE;
  --p-acento-texto: #5A33E0;
  --p-ease: cubic-bezier(0.23, 1, 0.32, 1);
}

.pipo-flota {
  position: fixed; z-index: 59;
  right: calc(clamp(16px, 2.4vw, 32px) + env(safe-area-inset-right, 0px));
  bottom: calc(clamp(16px, 2.4vw, 32px) + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  transition: opacity 220ms ease, transform 280ms var(--p-ease);
}
/* espera a que termine el intro (mientras tanto está arriba, en el menú) */
.pipo-flota.esperando, .pipo-flota.panel-abierto {
  opacity: 0; transform: translateY(16px) scale(0.94); pointer-events: none;
}
.pipo-boton {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 6px 18px 6px 6px;
  border-radius: 999px; background: var(--p-superficie); color: var(--ink);
  box-shadow: var(--p-sombra), 0 0 0 1px var(--p-linea);
  font-size: 15px; font-weight: 500;
  transition: transform 160ms var(--p-ease);
}
.pipo-boton:active { transform: scale(0.96); }

.pipo-cara { position: relative; display: block; flex: none; width: 44px; height: 44px; transform-origin: 50% 85%; }
.pipo-cara img { display: block; width: 100%; height: 100%; }
.pipo-cara-chica { width: 34px; height: 34px; }
.pipo-ojos { position: absolute; inset: 0; transition: transform 320ms var(--p-ease); }
.pipo-ojo {
  position: absolute; width: 9.6%; height: 18.6%; border-radius: 999px;
  background: #fff; box-shadow: 0 0 3px rgba(255,255,255,0.9);
  transform-origin: 50% 60%; transition: transform 90ms ease;
}
.pipo-ojo.izq { left: 40.3%; top: 42.3%; }
.pipo-ojo.der { left: 64%; top: 38%; }
.pipo-cara.parpadea .pipo-ojo, .pipo-cara.guina .pipo-ojo.der { transform: scaleY(0.12); }

.pipo-burbuja {
  max-width: 250px; margin: 0; padding: 11px 14px;
  border-radius: 16px 16px 6px 16px;
  background: var(--p-superficie); color: var(--ink);
  box-shadow: var(--p-sombra), 0 0 0 1px var(--p-linea);
  font-size: 14px; line-height: 1.4; cursor: pointer;
  opacity: 0; transform: translateY(6px) scale(0.96); transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 180ms ease, transform 240ms var(--p-ease);
}
.pipo-burbuja.visible { opacity: 1; transform: none; pointer-events: auto; }
.pipo-burbuja:empty { display: none; }

@media (max-width: 560px) {
  .pipo-boton { padding: 6px; min-height: 0; }
  .pipo-boton .pipo-boton-texto {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  .pipo-burbuja { max-width: 220px; }
}

.pipo-panel {
  position: fixed; z-index: 61;
  right: calc(clamp(16px, 2.4vw, 32px) + env(safe-area-inset-right, 0px));
  bottom: calc(clamp(16px, 2.4vw, 32px) + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column;
  width: min(390px, calc(100vw - 32px)); height: min(600px, calc(100dvh - 32px));
  border-radius: 20px; background: var(--p-superficie); color: var(--ink);
  box-shadow: var(--p-sombra), 0 0 0 1px var(--p-linea);
  transform-origin: bottom right;
  opacity: 0; transform: translateY(8px) scale(0.96); visibility: hidden;
  transition: opacity 180ms ease, transform 240ms var(--p-ease), visibility 0s linear 240ms;
}
.pipo-panel.abierto {
  opacity: 1; transform: none; visibility: visible;
  transition: opacity 180ms ease, transform 240ms var(--p-ease);
}
.pipo-panel header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--p-linea);
}
.pipo-panel header strong { display: block; font-size: 16px; font-weight: 600; }
.pipo-panel header div span { display: block; font-size: 13px; color: var(--ink-faint); }
.pipo-cerrar { display: grid; place-items: center; width: 40px; height: 40px; margin-left: auto; border-radius: 999px; }
.pipo-cerrar svg { width: 20px; height: 20px; }

.pipo-charla {
  flex: 1; display: flex; flex-direction: column; gap: 10px;
  padding: 16px; overflow-y: auto; overscroll-behavior: contain;
}
.globo {
  max-width: 88%; padding: 10px 14px; border-radius: 16px;
  font-size: 15px; line-height: 1.45;
  animation: pipoGlobo 260ms var(--p-ease);
}
.globo.pipo-dice { align-self: flex-start; background: var(--p-superficie-2); border-bottom-left-radius: 6px; }
.globo.yo { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 6px; }
.globo.pensando { display: flex; gap: 4px; padding: 14px; }
.globo.pensando i {
  width: 7px; height: 7px; border-radius: 999px; background: var(--ink-faint);
  animation: pipoEscribe 1.2s infinite ease-in-out;
}
.globo.pensando i:nth-child(2) { animation-delay: 0.15s; }
.globo.pensando i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pipoGlobo { from { opacity: 0; transform: translateY(6px); } }
@keyframes pipoEscribe { 0%, 60%, 100% { opacity: 0.3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

/* el paso al equipo: un botón de WhatsApp dentro de la charla */
.pipo-pase {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 15px; font-weight: 500;
  animation: pipoGlobo 260ms var(--p-ease);
  transition: transform 160ms var(--p-ease);
}
.pipo-pase img { width: 18px; height: 18px; }
.pipo-pase:active { transform: scale(0.97); }

.pipo-opciones { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.pipo-opciones:empty { display: none; }
.pipo-opciones button {
  min-height: 34px; padding: 0 12px; border-radius: 12px;
  background: var(--p-acento-suave); color: var(--p-acento-texto);
  font-size: 14px; font-weight: 500; text-align: left;
  transition: transform 160ms var(--p-ease);
}
.pipo-opciones button:active { transform: scale(0.97); }

.pipo-escribir { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--p-linea); }
.pipo-escribir[hidden] { display: none; }
.pipo-escribir input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px;
  border: 0; border-radius: 999px; background: var(--p-superficie-2); color: var(--ink);
  font: inherit; font-size: 16px;
}
.pipo-escribir input::placeholder { color: var(--ink-faint); }
.pipo-escribir button {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 999px;
  background: var(--ink); color: #fff;
  transition: transform 160ms var(--p-ease), opacity 160ms ease;
}
.pipo-escribir button:active { transform: scale(0.94); }
.pipo-escribir button:disabled { opacity: 0.4; }
.pipo-escribir svg { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) {
  .globo, .globo.pensando i, .pipo-pase { animation: none; }
  .pipo-ojos, .pipo-ojo { transition: none; }
}

/* texto solo para lectores de pantalla */
.solo-lectores {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Pipo arriba, en el menú del intro (en lugar del WhatsApp) ── */
.nav-pipo { display: none; }
#nav:not(.pinned) .nav-pipo {
  position: absolute; right: var(--pad-x); top: 50%; translate: 0 -50%;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 4px 14px 4px 4px; border-radius: 999px;
  color: #fff; font-size: 13.5px; font-weight: 500;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background 0.2s, scale 0.16s var(--p-ease);
}
#nav:not(.pinned) .nav-pipo .pipo-cara { width: 34px; height: 34px; }
#nav:not(.pinned) .nav-pipo:active { scale: 0.96; }
@media (hover: hover) and (pointer: fine) {
  #nav:not(.pinned) .nav-pipo:hover { background: rgba(255,255,255,0.16); }
}
@media (max-width: 600px) {
  #nav:not(.pinned) .nav-pipo { right: 16px; padding: 4px; }
  #nav:not(.pinned) .nav-pipo-texto {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}

/* ── Más vida ──────────────────────────────────────────────────
   Flota apenas (respira), saluda con la mano cuando pasa el mouse,
   mira para arriba mientras piensa la respuesta y festeja el pase. */
@media (prefers-reduced-motion: no-preference) {
  .pipo-flota:not(.esperando) .pipo-boton .pipo-cara img { animation: pipoRespira 4.2s ease-in-out infinite; }
  .pipo-boton:hover .pipo-cara, .nav-pipo:hover .pipo-cara { animation: pipoSaluda 0.7s var(--p-ease); }
}
@keyframes pipoRespira { 50% { transform: translateY(-2.5px) scale(1.02); } }
@keyframes pipoSaluda {
  25% { transform: rotate(-12deg); } 50% { transform: rotate(9deg); } 75% { transform: rotate(-5deg); }
}
.pipo-cara.piensa .pipo-ojo { translate: -14% -40%; }
.pipo-cara.contento .pipo-ojo { transform: scaleY(0.45); border-radius: 999px 999px 4px 4px; }
.pipo-ojo { transition: transform 90ms ease, translate 260ms var(--p-ease); }
