/* Colibri · movimiento.
   Cargar después de components.css. Todo se apaga con prefers-reduced-motion. */

:root {
  --q-spring: cubic-bezier(.34, 1.56, .64, 1);
  --q-out: cubic-bezier(.2, .7, .2, 1);
  --q-soft: cubic-bezier(.45, .05, .25, 1);   /* firmas: entra y sale suave, sin rebote */
  --q-calm: cubic-bezier(.22, 1, .36, 1);     /* hover: crece sin pasarse */
}

/* ───────────── Marca de producto 3D ─────────────
   <q-shape> de 13 px o más se dibuja con la forma 3D (assets/products/<p>/forma-chica.webp).
   .q-mark envuelve: la escala de hover va en el contenedor; la firma animada, en la imagen.
   Criterio: sutil. Recorridos cortos, 2 s o más, sin rebote. */
.q-mark { display: inline-block; position: relative; flex: none; line-height: 0; transition: transform .7s var(--q-calm); will-change: transform; }
.q-mark :is(img, svg) { display: block; width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 55%; filter: drop-shadow(0 2px 2px rgba(17,19,24,.10)); }
.q-mark::after { /* resplandor suave en hover y en el producto activo */
  content: ""; position: absolute; inset: -30%; border-radius: 50%; z-index: -1; opacity: 0; transform: scale(.8);
  background: radial-gradient(closest-side, var(--mark-glow, rgba(17,19,24,.12)), transparent);
  transition: opacity .8s var(--q-calm), transform .8s var(--q-calm);
}

/* Forma plana: sin sombra ni resplandor. */
.q-mark--flat svg { filter: none !important; transform-origin: 50% 55%; }
.q-mark--flat::after { display: none; }

/* Hover: crece un poco y toca su firma. Sirve sobre la marca o sobre cualquier contenedor con [data-mark-host]. */
.q-mark:hover, [data-mark-host]:hover .q-mark, .q-rail__item:hover .q-mark { transform: scale(1.4); }
.q-mark:hover::after, [data-mark-host]:hover .q-mark::after, .q-rail__item:hover .q-mark::after, .q-mark.is-on::after { opacity: .7; transform: scale(1); }
.q-mark:hover :is(img, svg), [data-mark-host]:hover .q-mark :is(img, svg), .q-rail__item:hover .q-mark :is(img, svg), .q-mark.is-playing :is(img, svg) { animation: var(--sig) both; }

/* Firmas: cada forma se mueve según lo que significa */
.q-mark[data-p="members"]    { --sig: q-sig-members 2s var(--q-soft); }
.q-mark[data-p="insights"]   { --sig: q-sig-insights 2.4s var(--q-soft); }
.q-mark[data-p="engage"]     { --sig: q-sig-engage 2s var(--q-soft); }
.q-mark[data-p="loyalty"]    { --sig: q-sig-loyalty 2.4s var(--q-soft); }
.q-mark[data-p="ledger"]     { --sig: q-sig-ledger 2s var(--q-soft); }
.q-mark[data-p="frontside"]  { --sig: q-sig-frontside 2.4s var(--q-soft); }
.q-mark[data-p="integrator"] { --sig: q-sig-integrator 2.2s var(--q-soft); }
.q-mark[data-p="shield"]     { --sig: q-sig-shield 2.2s var(--q-soft); }
.q-mark[data-p="autopilot"]  { --sig: q-sig-autopilot 2.6s var(--q-soft); }

/* Members · gota: se estira apenas, como una gota que se asienta (una persona, única) */
@keyframes q-sig-members { 0%, 100% { transform: none; } 40% { transform: translateY(-4%) scale(.98, 1.04); } 70% { transform: translateY(1%) scale(1.02, .98); } }
/* Insights · rombo: se inclina y muestra otra faceta */
@keyframes q-sig-insights { 0%, 100% { transform: perspective(80px) rotateY(0); } 50% { transform: perspective(80px) rotateY(-32deg); } }
/* Engage · triángulo: avanza un paso (el recorrido de un journey) */
@keyframes q-sig-engage { 0%, 100% { transform: none; } 50% { transform: translateX(6%) rotate(3deg); } }
/* Loyalty · estrella: gira un poco y se ilumina */
@keyframes q-sig-loyalty { 0%, 100% { transform: none; filter: drop-shadow(0 2px 2px rgba(17,19,24,.1)); } 50% { transform: rotate(16deg) scale(1.03); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--q-loyalty-grad-brillo) 70%, transparent)); } }
/* Ledger · cuadrado: el bloque sube apenas y se asienta en su lugar */
@keyframes q-sig-ledger { 0%, 100% { transform: none; } 40% { transform: translateY(-6%) rotate(-5deg); } 75% { transform: translateY(1%) rotate(1deg); } }
/* Frontside · arco: la puerta se entreabre */
@keyframes q-sig-frontside { 0%, 100% { transform: perspective(60px) rotateY(0); } 50% { transform: perspective(60px) rotateY(-22deg); } }
/* Integrator · cruz: gira lo justo para encastrar */
@keyframes q-sig-integrator { 0%, 100% { transform: none; } 50% { transform: rotate(14deg) scale(.98); } }
/* Shield · hexágono: un latido suave */
@keyframes q-sig-shield { 0%, 100% { transform: none; filter: drop-shadow(0 2px 2px rgba(17,19,24,.1)); } 50% { transform: scale(1.04); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--q-shield-color) 50%, transparent)); } }
/* Autopilot · cápsula: flota y corrige el rumbo */
@keyframes q-sig-autopilot { 0%, 100% { transform: none; } 35% { transform: translateY(-4%) rotate(-5deg); } 70% { transform: translateY(-2%) rotate(3deg); } }

/* Producto activo en el riel: respira muy despacio */
.q-rail__item[aria-current="page"] .q-mark::after { opacity: .6; transform: scale(1); }
.q-rail__item[aria-current="page"] .q-mark :is(img, svg) { animation: q-breathe 6s ease-in-out infinite; }
.q-rail__item[aria-current="page"]:hover .q-mark :is(img, svg) { animation: var(--sig) both; }
@keyframes q-breathe { 0%, 100% { transform: none; } 50% { transform: translateY(-2%) scale(1.02); } }

/* Indicador del riel: entra deslizando */
.q-rail__item[aria-current="page"]::before { animation: q-rail-in .5s var(--q-spring) both; }
@keyframes q-rail-in { from { transform: scaleY(0); } }

/* ───────────── Entradas ───────────── */
.q-reveal { opacity: 0; transform: translateY(14px); }
.q-reveal.is-in { opacity: 1; transform: none; transition: opacity .7s var(--q-out), transform .8s var(--q-out); transition-delay: var(--d, 0ms); }

/* Barras de presupuesto y medidores: se llenan */
.q-meter__fill { transform-origin: left center; animation: q-fill 1.1s var(--q-out) .25s both; }
@keyframes q-fill { from { transform: scaleX(0); } }
.q-meter__mark { animation: q-fade .4s ease 1.2s both; }
@keyframes q-fade { from { opacity: 0; } }

/* Gráficos de línea: se dibujan (motion.js pone --len) */
.q-draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: q-draw 1.6s var(--q-out) var(--d, .2s) forwards; }
@keyframes q-draw { to { stroke-dashoffset: 0; } }
.q-draw-fade { opacity: 0; animation: q-fade-in .6s ease var(--d, 1.2s) forwards; }
@keyframes q-fade-in { to { opacity: 1; } }

/* ───────────── Halos vivos ───────────── */
.q-halo-vivo { position: relative; isolation: isolate; overflow: hidden; }
.q-halo-vivo::before {
  content: ""; position: absolute; inset: -25%; z-index: -1; pointer-events: none;
  background: radial-gradient(28% 34% at 20% 24%, color-mix(in srgb, var(--q-engage-color) 30%, transparent), transparent 70%), radial-gradient(26% 32% at 48% 86%, color-mix(in srgb, var(--q-shield-color) 22%, transparent), transparent 70%), radial-gradient(30% 36% at 86% 18%, color-mix(in srgb, var(--q-autopilot-color) 28%, transparent), transparent 70%), radial-gradient(24% 30% at 74% 84%, color-mix(in srgb, var(--q-ledger-color) 22%, transparent), transparent 70%);
  animation: q-halo-drift 26s ease-in-out infinite alternate;
}
@keyframes q-halo-drift { 0% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(3%, -2%) rotate(4deg); } 100% { transform: translate(-3%, 2%) rotate(-3deg); } }

/* Luz que sigue al mouse en tarjetas noche */
.q-dark.q-spot::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(127,214,210,.13), transparent 70%);
}
.q-dark.q-spot:hover::after { opacity: 1; }

/* Tarjetas que se pueden abrir: el borde se marca apenas */
a.q-card, .q-card[data-lift], .q-insight { transition: border-color .2s, box-shadow .35s var(--q-out); }
a.q-card:hover, .q-card[data-lift]:hover, .q-insight:hover { border-color: var(--q-borde-fuerte); box-shadow: var(--q-shadow-1); }

/* Chip de decisiones: un brillo que cruza cada tanto */
.q-chip.q-shimmer { position: relative; overflow: hidden; }
.q-chip.q-shimmer::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.75), transparent); animation: q-shimmer 7s ease-in-out 2s infinite; }
@keyframes q-shimmer { 0%, 82% { left: -60%; } 100% { left: 130%; } }

/* Filas nuevas en tablas en vivo */
.q-row-new td { animation: q-row-in .9s var(--q-out) both, q-row-flash 2.4s ease .1s both; }
@keyframes q-row-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes q-row-flash { 0% { background: var(--q-seleccion); } 100% { background: transparent; } }

/* Morfología: la forma que piensa (Autopilot consultando productos) */
.q-morph { display: inline-block; width: 18px; height: 18px; flex: none; background: var(--q-engage-color); animation: q-morph 4s cubic-bezier(.7,0,.2,1) infinite; }
@keyframes q-morph {
  0%, 16% { clip-path: polygon(50% 8%, 92% 86%, 8% 86%, 50% 8%); background: var(--q-engage-color); }
  20%, 36% { clip-path: polygon(14% 14%, 86% 14%, 86% 86%, 14% 86%); background: var(--q-ledger-color); }
  40%, 56% { clip-path: polygon(50% 4%, 92% 28%, 92% 72%, 50% 96%, 8% 72%, 8% 28%); background: var(--q-shield-color); }
  60%, 76% { clip-path: polygon(50% 2%, 98% 50%, 50% 98%, 2% 50%); background: var(--q-insights-color); }
  80%, 96% { clip-path: polygon(34% 6%, 66% 6%, 66% 94%, 34% 94%); background: var(--q-autopilot-color); }
  100% { clip-path: polygon(50% 8%, 92% 86%, 8% 86%, 50% 8%); background: var(--q-engage-color); }
}

/* Escritura de Autopilot */
.q-typing::after { content: "▍"; color: var(--q-autopilot-color); animation: q-caret .9s steps(1) infinite; margin-left: 1px; }
@keyframes q-caret { 50% { opacity: 0; } }

/* Aparición de una fila del rastro, con su marca tocando la firma */
.q-trace__row { animation: q-sube-chico .5s var(--q-out) both; }
@keyframes q-sube-chico { from { opacity: 0; transform: translateY(6px); } }

/* Transiciones entre pantallas (Chrome, View Transitions entre documentos) */
@view-transition { navigation: auto; }
.q-top { view-transition-name: q-top; }
.q-rail { view-transition-name: q-rail; }
::view-transition-old(root) { animation: q-vt-out .22s ease both; }
::view-transition-new(root) { animation: q-vt-in .38s var(--q-out) both; }
@keyframes q-vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes q-vt-in { from { opacity: 0; transform: translateY(10px); } }

/* Cambio de tema: fundido corto, sin desplazamiento */
.q-cambia-tema::view-transition-old(root) { animation: none; }
.q-cambia-tema::view-transition-new(root) { animation: q-fundido .24s ease both; }
@keyframes q-fundido { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .q-mark, .q-mark :is(img, svg), .q-mark::after, .q-reveal, .q-halo-vivo::before, .q-meter__fill, .q-draw, .q-chip.q-shimmer::after, .q-morph, .q-row-new td, .q-trace__row { animation: none !important; transition: none !important; }
  .q-reveal { opacity: 1; transform: none; }
  .q-draw { stroke-dashoffset: 0; }
  .q-draw-fade { opacity: 1; }
  @view-transition { navigation: none; }
}

/* Modo quieto (?still en la URL; ?quieto sigue valiendo): capturas y presentaciones estáticas */
.q-quieto .q-mark, .q-quieto .q-mark :is(img, svg), .q-quieto .q-mark::after, .q-quieto .q-reveal, .q-quieto .q-halo-vivo::before, .q-quieto .q-meter__fill, .q-quieto .q-draw, .q-quieto .q-chip.q-shimmer::after, .q-quieto .q-morph, .q-quieto .q-row-new td, .q-quieto .q-trace__row { animation: none !important; transition: none !important; }
.q-quieto .q-reveal { opacity: 1; transform: none; }
.q-quieto .q-draw { stroke-dashoffset: 0; }
.q-quieto .q-draw-fade { opacity: 1; }

/* Entradas de piezas: señales y pasos nuevos del lienzo */
.q-signal { animation: q-sube-chico .6s var(--q-out) both; }
.q-signal:nth-child(1) { animation-delay: .5s; } .q-signal:nth-child(2) { animation-delay: .65s; } .q-signal:nth-child(n+3) { animation-delay: .8s; }
.q-node--new { animation: q-sube-chico .6s var(--q-out) .4s both; }
.q-fork > div:nth-child(1) .q-node--new { animation-delay: .75s; } .q-fork > div:nth-child(2) .q-node--new { animation-delay: .95s; }
.q-canvas.is-applied .q-node--new { animation: q-node-ok .5s ease both; }
@keyframes q-node-ok { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--q-autopilot-color) 50%, transparent); } to { box-shadow: 0 0 0 10px transparent; } }
.q-quieto :is(.q-signal, .q-node--new, .q-result, .q-preview) { animation: none !important; }
@media (prefers-reduced-motion: reduce) { :is(.q-signal, .q-node--new, .q-result, .q-preview) { animation: none !important; } }
