/* Referencias gráficas con movimiento: flujo del producto y comparación de beneficio.
   Sin dependencias; colores con fallback para immersive / estilos-sitio. */

.efj-motion-scene {
  --efj-m-accent: var(--accent, #0d9488);
  --efj-m-link: var(--link, #0369a1);
  --efj-m-ink: var(--text, #0b1220);
  --efj-m-muted: var(--muted, #5c6b82);
  --efj-m-surface: var(--bg-card, #ffffff);
  --efj-m-tint: var(--bg-2, #f0f5ff);
  --efj-m-bord: var(--bord, #d8e0ec);
  --efj-m-ring: color-mix(in srgb, var(--efj-m-link) 35%, transparent);
  --efj-m-bad: #b45309;
  --efj-m-good: var(--efj-m-accent);

  margin: 0 0 1.75rem;
  padding: 1.15rem 1rem 1.25rem;
  border-radius: var(--r-lg, 16px);
  border: 1px solid var(--efj-m-bord);
  background: linear-gradient(165deg, var(--efj-m-surface) 0%, var(--efj-m-tint) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95) inset, 0 12px 32px -20px rgba(11, 18, 32, 0.12);
}

.efj-motion-scene__title {
  margin: 0 0 0.25rem;
  font-size: clamp(1.05rem, 0.4vw + 0.98rem, 1.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--efj-m-ink);
  text-align: center;
}

.efj-motion-scene__lead {
  margin: 0 0 1.1rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--efj-m-muted);
  text-align: center;
  max-width: 44rem;
  margin-left: auto;
  margin-right: auto;
}

/* —— Flujo horizontal —— */
.efj-motion-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 0.15rem 0;
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
}

.efj-flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 0 1 5.6rem;
  min-width: 4.75rem;
  padding: 0.35rem 0.2rem;
  animation: efj-flow-step-pulse 10s ease-in-out infinite;
}

.efj-flow-step:nth-child(1) {
  animation-delay: 0s;
}
.efj-flow-step:nth-child(3) {
  animation-delay: 2s;
}
.efj-flow-step:nth-child(5) {
  animation-delay: 4s;
}
.efj-flow-step:nth-child(7) {
  animation-delay: 6s;
}
.efj-flow-step:nth-child(9) {
  animation-delay: 8s;
}

/* Variante 3 pasos (extensión): nodos 1,3,5 */
.efj-motion-flow--three .efj-flow-step:nth-child(1) {
  animation-delay: 0s;
}
.efj-motion-flow--three .efj-flow-step:nth-child(3) {
  animation-delay: 2.2s;
}
.efj-motion-flow--three .efj-flow-step:nth-child(5) {
  animation-delay: 4.4s;
}

/* Variante 4 pasos (recorrido web): nodos 1,3,5,7 */
.efj-motion-flow--four .efj-flow-step:nth-child(1) {
  animation-delay: 0s;
}
.efj-motion-flow--four .efj-flow-step:nth-child(3) {
  animation-delay: 2.5s;
}
.efj-motion-flow--four .efj-flow-step:nth-child(5) {
  animation-delay: 5s;
}
.efj-motion-flow--four .efj-flow-step:nth-child(7) {
  animation-delay: 7.5s;
}

@keyframes efj-flow-step-pulse {
  0%,
  8% {
    transform: translateY(0);
    filter: brightness(1);
  }
  10% {
    transform: translateY(-3px);
    filter: brightness(1.06);
  }
  12%,
  100% {
    transform: translateY(0);
    filter: brightness(1);
  }
}

.efj-flow-step__orb {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 0.35rem;
  background: linear-gradient(145deg, #ffffff, var(--efj-m-tint));
  border: 2px solid var(--efj-m-bord);
  box-shadow: 0 2px 8px rgba(11, 18, 32, 0.06);
  color: var(--efj-m-link);
}

.efj-flow-step__orb svg {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

.efj-flow-step__label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--efj-m-ink);
  line-height: 1.2;
}

.efj-flow-step__hint {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.7rem;
  line-height: 1.25;
  color: var(--efj-m-muted);
  max-width: 7rem;
}

.efj-flow-bridge {
  position: relative;
  flex: 1 1 1.25rem;
  min-width: 0.75rem;
  max-width: 3.5rem;
  height: 4px;
  align-self: center;
  margin-top: -1.5rem;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--efj-m-bord), color-mix(in srgb, var(--efj-m-link) 28%, var(--efj-m-bord)));
  overflow: hidden;
}

.efj-flow-bridge::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--efj-m-link) 55%, white) 45%,
    transparent 100%
  );
  animation: efj-flow-bridge-shine 2.4s ease-in-out infinite;
}

@keyframes efj-flow-bridge-shine {
  0% {
    transform: translateX(-100%);
    opacity: 0.5;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: translateX(100%);
    opacity: 0.5;
  }
}

.efj-flow-bridge__dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0;
  border-radius: 50%;
  background: var(--efj-m-link);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--efj-m-link) 22%, transparent);
  animation: efj-flow-dot 2.8s linear infinite;
}

@keyframes efj-flow-dot {
  0% {
    left: 0;
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  92% {
    opacity: 1;
  }
  100% {
    left: calc(100% - 9px);
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .efj-motion-flow {
    flex-direction: column;
    align-items: stretch;
    max-width: 20rem;
  }

  .efj-flow-step {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    align-items: center;
    flex: 1 1 auto;
    min-width: 100%;
    animation: efj-flow-step-pulse-mobile 9s ease-in-out infinite;
  }

  .efj-flow-step:nth-child(1) {
    animation-delay: 0s;
  }
  .efj-flow-step:nth-child(3) {
    animation-delay: 1.8s;
  }
  .efj-flow-step:nth-child(5) {
    animation-delay: 3.6s;
  }
  .efj-flow-step:nth-child(7) {
    animation-delay: 5.4s;
  }
  .efj-flow-step:nth-child(9) {
    animation-delay: 7.2s;
  }

  .efj-motion-flow--three .efj-flow-step:nth-child(1) {
    animation-delay: 0s;
  }
  .efj-motion-flow--three .efj-flow-step:nth-child(3) {
    animation-delay: 2s;
  }
  .efj-motion-flow--three .efj-flow-step:nth-child(5) {
    animation-delay: 4s;
  }

  .efj-motion-flow--four .efj-flow-step:nth-child(1) {
    animation-delay: 0s;
  }
  .efj-motion-flow--four .efj-flow-step:nth-child(3) {
    animation-delay: 2s;
  }
  .efj-motion-flow--four .efj-flow-step:nth-child(5) {
    animation-delay: 4s;
  }
  .efj-motion-flow--four .efj-flow-step:nth-child(7) {
    animation-delay: 6s;
  }

  @keyframes efj-flow-step-pulse-mobile {
    0%,
    8% {
      transform: translateX(0);
    }
    10% {
      transform: translateX(4px);
    }
    12%,
    100% {
      transform: translateX(0);
    }
  }

  .efj-flow-step__orb {
    margin-bottom: 0;
    margin-right: 0.75rem;
    flex-shrink: 0;
  }

  .efj-flow-step__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .efj-flow-bridge {
    flex: 0 0 auto;
    width: 4px;
    height: 1.1rem;
    min-width: 4px;
    max-width: none;
    margin: 0.1rem 0 0.1rem 1.4rem;
    align-self: flex-start;
    background: linear-gradient(
      180deg,
      var(--efj-m-bord),
      color-mix(in srgb, var(--efj-m-link) 28%, var(--efj-m-bord))
    );
  }

  .efj-flow-bridge::after {
    animation: efj-flow-bridge-shine-v 2.4s ease-in-out infinite;
  }

  @keyframes efj-flow-bridge-shine-v {
    0% {
      transform: translateY(-100%);
    }
    100% {
      transform: translateY(100%);
    }
  }

  .efj-flow-bridge__dot {
    top: 0;
    left: 50%;
    margin: 0 0 0 -4.5px;
    animation: efj-flow-dot-v 2.8s linear infinite;
  }

  @keyframes efj-flow-dot-v {
    0% {
      top: 0;
      opacity: 0;
    }
    8% {
      opacity: 1;
    }
    92% {
      opacity: 1;
    }
    100% {
      top: calc(100% - 9px);
      opacity: 0;
    }
  }
}

.efj-flow-step__text {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* —— Comparador “tiempo / fricción” —— */
.efj-motion-compare-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
  margin: 1rem 0 0;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.efj-motion-compare-bars__col {
  padding: 0.85rem 1rem;
  border-radius: var(--r-md, 14px);
  border: 1px solid var(--efj-m-bord);
  background: var(--efj-m-surface);
}

.efj-motion-compare-bars__col--bad {
  border-color: color-mix(in srgb, var(--efj-m-bad) 35%, var(--efj-m-bord));
  background: color-mix(in srgb, var(--efj-m-bad) 6%, var(--efj-m-surface));
}

.efj-motion-compare-bars__col--good {
  border-color: color-mix(in srgb, var(--efj-m-good) 38%, var(--efj-m-bord));
  background: color-mix(in srgb, var(--efj-m-good) 8%, var(--efj-m-surface));
}

.efj-motion-compare-bars__head {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--efj-m-ink);
}

.efj-motion-compare-bars__meter {
  height: 10px;
  border-radius: 6px;
  background: rgba(11, 18, 32, 0.08);
  overflow: hidden;
  margin-bottom: 0.45rem;
}

.efj-motion-compare-bars__fill {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  border-radius: 6px;
  animation: efj-meter-breathe 4.5s ease-in-out infinite;
}

.efj-motion-compare-bars__col--bad .efj-motion-compare-bars__fill {
  background: linear-gradient(90deg, #ea580c, #fb923c);
  animation-name: efj-meter-stress;
}

.efj-motion-compare-bars__col--good .efj-motion-compare-bars__fill {
  background: linear-gradient(90deg, var(--efj-m-accent), #2dd4bf);
  animation-name: efj-meter-ease;
}

@keyframes efj-meter-stress {
  0%,
  100% {
    transform: scaleX(0.92);
  }
  50% {
    transform: scaleX(1);
  }
}

@keyframes efj-meter-ease {
  0%,
  100% {
    transform: scaleX(0.38);
  }
  50% {
    transform: scaleX(0.62);
  }
}

.efj-motion-compare-bars__cap {
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--efj-m-muted);
  margin: 0;
}

.efj-motion-caption {
  margin: 1rem 0 0;
  font-size: 0.82rem;
  text-align: center;
  color: var(--efj-m-muted);
  line-height: 1.45;
}

@media (max-width: 520px) {
  .efj-motion-compare-bars {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .efj-flow-step,
  .efj-flow-bridge::after,
  .efj-flow-bridge__dot,
  .efj-motion-compare-bars__fill {
    animation: none !important;
  }

  .efj-flow-step {
    filter: none !important;
    transform: none !important;
  }

  .efj-motion-compare-bars__col--bad .efj-motion-compare-bars__fill {
    transform: scaleX(0.95);
  }

  .efj-motion-compare-bars__col--good .efj-motion-compare-bars__fill {
    transform: scaleX(0.52);
  }

  .efj-flow-bridge::after {
    opacity: 0.35;
    transform: none;
  }

  .efj-flow-bridge__dot {
    left: 50%;
    margin-left: -4.5px;
    opacity: 0.85;
    animation: none !important;
  }
}
