
/* =========================================================
   PUBLIDEAS — MAGIC TRANSFORM PARA SECCIÓN PRODUCTOS
   V58
   Adaptación HTML/CSS/JS del concepto React Bits Pro:
   "Documents fly in and come out as colorful results".
   ========================================================= */

.products-section{
  position:relative;
  isolation:isolate;
}

.products-section .product-magic-transform{
  position:relative;
  z-index:3;
  margin-top:8px;
  margin-bottom:8px;
  pointer-events:none;
}

.product-magic-flow{
  position:relative;
  width:min(100%,1180px);
  min-height:164px;
  margin:0 auto;
  display:grid;
  grid-template-columns:minmax(250px,1fr) 210px minmax(250px,1fr);
  align-items:center;
  gap:clamp(24px,4vw,58px);
  padding:18px clamp(18px,3vw,34px);
  overflow:hidden;
  border-radius:32px;
  background:
    radial-gradient(circle at 50% 50%,rgba(83,202,216,.16),transparent 28%),
    linear-gradient(120deg,rgba(255,255,255,.30),rgba(255,255,255,.08));
  border:1px solid rgba(70,54,168,.09);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.48),
    0 18px 52px rgba(47,67,104,.05);
}

.product-magic-flow::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(
      100deg,
      transparent 0%,
      rgba(90,213,228,.04) 36%,
      rgba(90,213,228,.22) 49%,
      rgba(106,88,221,.18) 52%,
      transparent 68%
    );
  transform:translateX(-115%);
  animation:pmSweep 5.2s cubic-bezier(.55,.05,.2,1) infinite;
}

.product-magic-flow::after{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width:240px;
  height:110px;
  transform:translate(-50%,-50%);
  border-radius:50%;
  background:rgba(81,207,221,.18);
  filter:blur(36px);
  pointer-events:none;
}

/* ---------- documentos de entrada ---------- */
.product-magic-transform .magic-documents{
  position:relative;
  height:118px;
  min-width:0;
}

.product-magic-transform .magic-doc{
  position:absolute;
  left:0;
  top:50%;
  width:112px;
  height:78px;
  padding:13px 12px;
  border-radius:14px;
  background:rgba(255,255,255,.92);
  border:1px solid rgba(66,54,154,.11);
  box-shadow:0 12px 30px rgba(32,48,74,.12);
  transform:translate3d(-150px,-50%,0) rotate(-8deg) scale(.82);
  opacity:0;
}

.product-magic-transform .magic-doc i{
  display:block;
  height:5px;
  margin-bottom:7px;
  border-radius:999px;
  background:#dfe6ef;
}
.product-magic-transform .magic-doc i:nth-child(1){width:78%}
.product-magic-transform .magic-doc i:nth-child(2){width:58%}
.product-magic-transform .magic-doc i:nth-child(3){width:68%}
.product-magic-transform .magic-doc b{
  position:absolute;
  left:12px;
  bottom:10px;
  color:#4434a0;
  font:800 .60rem/1 Manrope,sans-serif;
  letter-spacing:.12em;
}

.product-magic-transform .magic-doc-a{animation:pmDocA 5.2s cubic-bezier(.2,.75,.2,1) infinite}
.product-magic-transform .magic-doc-b{animation:pmDocB 5.2s cubic-bezier(.2,.75,.2,1) infinite}
.product-magic-transform .magic-doc-c{animation:pmDocC 5.2s cubic-bezier(.2,.75,.2,1) infinite}

/* ---------- núcleo ---------- */
.product-magic-transform .magic-transform-core{
  position:relative;
  z-index:4;
  width:190px;
  height:126px;
  margin:auto;
  display:flex;
  align-items:center;
  justify-content:center;
}

.product-magic-transform .magic-core-mark{
  position:relative;
  z-index:4;
  width:78px;
  height:78px;
  border-radius:24px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fff;
  background:linear-gradient(135deg,#4434a0 0%,#6253d7 48%,#55cbd9 100%);
  box-shadow:
    0 18px 44px rgba(67,52,160,.25),
    0 0 0 8px rgba(255,255,255,.52);
  animation:pmCorePulse 2.6s ease-in-out infinite;
}

.product-magic-transform .magic-core-mark svg{width:45px;height:45px}

.product-magic-transform .magic-transform-core small{
  position:absolute;
  left:50%;
  bottom:0;
  transform:translateX(-50%);
  white-space:nowrap;
  color:#4638a0;
  font:800 .60rem/1 Manrope,sans-serif;
  letter-spacing:.13em;
}

.product-magic-transform .magic-orbit{
  position:absolute;
  left:50%;
  top:50%;
  border:1px solid rgba(81,202,216,.34);
  border-radius:50%;
  transform:translate(-50%,-50%);
}
.product-magic-transform .magic-orbit-a{
  width:122px;height:88px;
  animation:pmOrbit 5s linear infinite;
}
.product-magic-transform .magic-orbit-b{
  width:158px;height:112px;
  border-color:rgba(92,72,204,.20);
  animation:pmOrbitReverse 7s linear infinite;
}

/* ---------- resultados ---------- */
.product-magic-transform .magic-results{
  position:relative;
  height:118px;
  min-width:0;
}

.product-magic-transform .magic-result{
  position:absolute;
  right:0;
  top:50%;
  width:128px;
  height:82px;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  gap:9px;
  padding:14px;
  border-radius:18px;
  color:#fff;
  box-shadow:0 14px 32px rgba(40,52,95,.18);
  transform:translate3d(-80px,-50%,0) rotate(-4deg) scale(.60);
  opacity:0;
}
.product-magic-transform .magic-result b{
  font:800 .66rem/1 Manrope,sans-serif;
  letter-spacing:.12em;
}
.product-magic-transform .magic-result i{
  display:block;
  width:52%;
  height:5px;
  border-radius:999px;
  background:rgba(255,255,255,.65);
}

.product-magic-transform .result-cyan{
  background:linear-gradient(135deg,#43c7d9,#7fe4ec);
  animation:pmResultA 5.2s cubic-bezier(.2,.75,.2,1) infinite;
}
.product-magic-transform .result-violet{
  background:linear-gradient(135deg,#4434a0,#7564e8);
  animation:pmResultB 5.2s cubic-bezier(.2,.75,.2,1) infinite;
}
.product-magic-transform .result-blue{
  background:linear-gradient(135deg,#245dc5,#52cbd8);
  animation:pmResultC 5.2s cubic-bezier(.2,.75,.2,1) infinite;
}

/* línea de energía central */
.product-magic-transform .magic-flow-line{
  position:absolute;
  left:12%;
  right:12%;
  top:50%;
  height:2px;
  transform:translateY(-50%);
  overflow:hidden;
  border-radius:999px;
  background:linear-gradient(90deg,transparent,rgba(81,202,216,.18),rgba(78,57,174,.16),transparent);
}
.product-magic-transform .magic-flow-line span{
  position:absolute;
  top:0;
  left:-18%;
  width:18%;
  height:100%;
  background:linear-gradient(90deg,transparent,#69dbe7,#6b58db,transparent);
  filter:drop-shadow(0 0 7px rgba(91,214,226,.8));
  animation:pmEnergy 2.15s linear infinite;
}

.product-magic-caption{
  margin:10px auto 0;
  text-align:center;
  color:rgba(43,54,79,.62);
  font:600 .76rem/1.5 Manrope,sans-serif;
}

/* La sección completa entra con una micro transformación,
   y las tarjetas hacen un reveal de "resultado". */
.products-section.magic-products-ready .product-card{
  --pm-card-delay:0ms;
}
.products-section.magic-products-ready .product-card.magic-transform-card-enter{
  animation:pmCardMaterialize .72s cubic-bezier(.18,.78,.2,1) both;
  animation-delay:var(--pm-card-delay);
}

/* ---------- keyframes ---------- */
@keyframes pmSweep{
  0%,8%{transform:translateX(-115%);opacity:0}
  22%{opacity:1}
  72%{opacity:.88}
  100%{transform:translateX(115%);opacity:0}
}

@keyframes pmDocA{
  0%,7%{transform:translate3d(-150px,-50%,0) rotate(-9deg) scale(.82);opacity:0}
  16%{opacity:1}
  28%{transform:translate3d(18px,-78%,0) rotate(-5deg) scale(.96);opacity:1}
  41%{transform:translate3d(220px,-50%,0) rotate(2deg) scale(.45);opacity:0}
  100%{opacity:0}
}
@keyframes pmDocB{
  0%,15%{transform:translate3d(-150px,-50%,0) rotate(7deg) scale(.80);opacity:0}
  24%{opacity:1}
  36%{transform:translate3d(28px,-44%,0) rotate(4deg) scale(.98);opacity:1}
  49%{transform:translate3d(215px,-50%,0) rotate(-2deg) scale(.42);opacity:0}
  100%{opacity:0}
}
@keyframes pmDocC{
  0%,23%{transform:translate3d(-150px,-50%,0) rotate(-5deg) scale(.80);opacity:0}
  32%{opacity:1}
  44%{transform:translate3d(4px,-17%,0) rotate(-2deg) scale(.96);opacity:1}
  57%{transform:translate3d(220px,-50%,0) rotate(2deg) scale(.42);opacity:0}
  100%{opacity:0}
}

@keyframes pmResultA{
  0%,35%{transform:translate3d(-95px,-50%,0) rotate(-7deg) scale(.45);opacity:0}
  48%{opacity:1}
  62%{transform:translate3d(-2px,-79%,0) rotate(-4deg) scale(1);opacity:1}
  77%{transform:translate3d(120px,-86%,0) rotate(2deg) scale(.94);opacity:0}
  100%{opacity:0}
}
@keyframes pmResultB{
  0%,43%{transform:translate3d(-95px,-50%,0) rotate(5deg) scale(.45);opacity:0}
  56%{opacity:1}
  70%{transform:translate3d(6px,-48%,0) rotate(3deg) scale(1);opacity:1}
  85%{transform:translate3d(120px,-45%,0) rotate(-2deg) scale(.94);opacity:0}
  100%{opacity:0}
}
@keyframes pmResultC{
  0%,51%{transform:translate3d(-95px,-50%,0) rotate(-5deg) scale(.45);opacity:0}
  64%{opacity:1}
  78%{transform:translate3d(-8px,-18%,0) rotate(-3deg) scale(1);opacity:1}
  93%{transform:translate3d(120px,-15%,0) rotate(2deg) scale(.94);opacity:0}
  100%{opacity:0}
}

@keyframes pmCorePulse{
  0%,100%{transform:scale(1) rotate(-1deg);filter:saturate(1)}
  50%{transform:scale(1.06) rotate(1deg);filter:saturate(1.2)}
}
@keyframes pmOrbit{to{transform:translate(-50%,-50%) rotate(360deg)}}
@keyframes pmOrbitReverse{to{transform:translate(-50%,-50%) rotate(-360deg)}}
@keyframes pmEnergy{to{left:118%}}
@keyframes pmCardMaterialize{
  0%{opacity:.10;transform:translateY(34px) scale(.92) rotateY(-8deg);filter:blur(9px) saturate(.55)}
  65%{opacity:1;filter:blur(0) saturate(1.18)}
  100%{opacity:1;transform:translateY(0) scale(1) rotateY(0);filter:none}
}

/* ---------- responsive ---------- */
@media(max-width:900px){
  .product-magic-flow{
    grid-template-columns:1fr 150px 1fr;
    gap:14px;
    min-height:145px;
    padding-inline:16px;
  }
  .product-magic-transform .magic-transform-core{width:140px}
  .product-magic-transform .magic-core-mark{width:66px;height:66px;border-radius:20px}
  .product-magic-transform .magic-doc{width:92px;height:68px}
  .product-magic-transform .magic-result{width:100px;height:72px;padding:11px}
}

@media(max-width:650px){
  .products-section .product-magic-transform{
    margin-top:0;
    margin-bottom:2px;
  }
  .product-magic-flow{
    min-height:132px;
    grid-template-columns:1fr 90px 1fr;
    border-radius:24px;
    gap:6px;
    padding:12px 8px;
  }
  .product-magic-transform .magic-transform-core{width:90px;height:110px}
  .product-magic-transform .magic-core-mark{width:54px;height:54px;border-radius:17px;box-shadow:0 12px 30px rgba(67,52,160,.20),0 0 0 5px rgba(255,255,255,.50)}
  .product-magic-transform .magic-core-mark svg{width:32px;height:32px}
  .product-magic-transform .magic-transform-core small{font-size:.46rem;letter-spacing:.08em}
  .product-magic-transform .magic-documents,.product-magic-transform .magic-results{height:100px}
  .product-magic-transform .magic-doc{width:74px;height:58px;padding:9px}
  .product-magic-transform .magic-doc b{font-size:.48rem;left:9px;bottom:7px}
  .product-magic-transform .magic-doc i{height:4px;margin-bottom:5px}
  .product-magic-transform .magic-result{width:78px;height:58px;padding:9px;border-radius:14px}
  .product-magic-transform .magic-result b{font-size:.48rem}
  .product-magic-transform .magic-result i{height:4px}
  .product-magic-caption{font-size:.68rem;padding-inline:18px}
}

@media(prefers-reduced-motion:reduce){
  .product-magic-flow::before,
  .product-magic-transform .magic-doc,
  .product-magic-transform .magic-result,
  .product-magic-transform .magic-core-mark,
  .product-magic-transform .magic-orbit,
  .product-magic-transform .magic-flow-line span{
    animation:none !important;
  }
  .product-magic-transform .magic-doc-a{opacity:1;transform:translate(8px,-80%) rotate(-4deg) scale(.86)}
  .product-magic-transform .magic-doc-b{opacity:1;transform:translate(24px,-46%) rotate(3deg) scale(.86)}
  .product-magic-transform .magic-doc-c{opacity:1;transform:translate(5px,-10%) rotate(-2deg) scale(.86)}
  .product-magic-transform .result-cyan{opacity:1;transform:translate(-2px,-80%) rotate(-4deg) scale(.88)}
  .product-magic-transform .result-violet{opacity:1;transform:translate(6px,-48%) rotate(3deg) scale(.88)}
  .product-magic-transform .result-blue{opacity:1;transform:translate(-8px,-16%) rotate(-2deg) scale(.88)}
}
