/* ============================================================
   CONVERZA — Animations
   Detalle de movimiento estilo Emil Kowalski: entradas suaves,
   spring sutil, stagger por scroll y micro-interacciones.
   ============================================================ */

/* ---------- Keyframes ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes bubble-in {
  0%   { opacity: 0; transform: translateY(10px) scale(0.92); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-5px); opacity: 1; }
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@keyframes pulse-ring {
  0%   { transform: scale(0.9); opacity: 0.6; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { opacity: 0; }
}
@keyframes float-soft {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}
@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

/* ---------- Scroll reveal (driven by JS adding .in-view) ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.7s var(--ease-out-expo),
    transform 0.7s var(--ease-out-expo);
  will-change: opacity, transform;
}
[data-reveal].in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Variants */
[data-reveal="left"]  { transform: translateX(-30px); }
[data-reveal="right"] { transform: translateX(30px); }
[data-reveal="scale"] { transform: scale(0.94); }
[data-reveal="left"].in-view,
[data-reveal="right"].in-view { transform: translateX(0); }
[data-reveal="scale"].in-view { transform: scale(1); }

/* Stagger children (set --i via inline style or nth-child below) */
[data-stagger] > * {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.6s var(--ease-out-expo),
    transform 0.6s var(--ease-out-expo);
}
[data-stagger].in-view > * {
  opacity: 1;
  transform: translateY(0);
}
[data-stagger].in-view > *:nth-child(1) { transition-delay: 0.05s; }
[data-stagger].in-view > *:nth-child(2) { transition-delay: 0.12s; }
[data-stagger].in-view > *:nth-child(3) { transition-delay: 0.19s; }
[data-stagger].in-view > *:nth-child(4) { transition-delay: 0.26s; }
[data-stagger].in-view > *:nth-child(5) { transition-delay: 0.33s; }
[data-stagger].in-view > *:nth-child(6) { transition-delay: 0.40s; }

/* ---------- Hero entrance (runs on load) ---------- */
.anim-load {
  opacity: 0;
  animation: fade-up 0.9s var(--ease-out-expo) forwards;
}
.anim-load.d1 { animation-delay: 0.05s; }
.anim-load.d2 { animation-delay: 0.15s; }
.anim-load.d3 { animation-delay: 0.25s; }
.anim-load.d4 { animation-delay: 0.35s; }
.anim-load.d5 { animation-delay: 0.45s; }

.window.anim-load {
  animation: scale-in 1s var(--ease-out-expo) forwards;
  animation-delay: 0.3s;
}

/* ---------- Chat bubbles staged reveal ---------- */
.chat-body .bubble,
.chat-body .typing {
  opacity: 0;
}
.chat-body.play .bubble,
.chat-body.play .typing {
  animation: bubble-in 0.5s var(--ease-spring) forwards;
}
.chat-body.play .bubble:nth-child(1) { animation-delay: 0.2s; }
.chat-body.play .bubble:nth-child(2) { animation-delay: 0.7s; }
.chat-body.play .typing               { animation-delay: 1.2s; }
.chat-body.play .bubble:nth-child(4) { animation-delay: 2.0s; }
.chat-body.play .bubble:nth-child(5) { animation-delay: 2.6s; }

/* ---------- Live status pulse ---------- */
.live-dot {
  position: relative;
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--brand);
  animation: pulse-ring 2s var(--ease-out-expo) infinite;
}

/* ---------- Float decoration ---------- */
.float { animation: float-soft 6s var(--ease-in-out) infinite; }
.float.delay { animation-delay: 1.5s; }

/* ---------- Shimmer skeleton / text ---------- */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--surface) 25%,
    var(--surface-2) 50%,
    var(--surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2.2s linear infinite;
}

/* ---------- Animated gradient border (CTA / featured) ---------- */
.glow-border {
  position: relative;
}
.glow-border::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--angle, 0deg),
    transparent 0%,
    var(--brand) 15%,
    transparent 35%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spin-slow 6s linear infinite;
  pointer-events: none;
}
@property --angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* ---------- Magnetic / press feedback handled in JS ---------- */
.magnetic { transition: transform 0.2s var(--ease-spring); }

/* ---------- Reduced motion: disable the showy stuff ---------- */
@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  [data-stagger] > * { opacity: 1 !important; transform: none !important; }
  .anim-load { opacity: 1; animation: none; }
  .chat-body .bubble,
  .chat-body .typing { opacity: 1; animation: none; }
  .marquee-track { animation: none; }
  .float, .live-dot::after, .glow-border::after, .shimmer { animation: none; }
}
