/* Demo inmersiva (product-funnel/discovery-pages/demo-inmersiva.view.php). Base: site-base/site.css (tokens, botones, teléfono).
 * Una ventana de «editor» con 5 etapas; solo la activa ocupa espacio (sin huecos en móvil) y entra con un fundido.
 * data-stage="static" (sin JS): se ven las fotos y el resultado, uno debajo del otro. Con «reducir movimiento», site.css
 * desactiva animaciones y transiciones: las etapas cambian sin movimiento. */

.demo-hero {
  padding-bottom: clamp(24px, 4vw, 48px);
}
.demo-section {
  padding-top: 0;
}

/* ── Ventana ── */
.immersive {
  position: relative;
  isolation: isolate;
}
.immersive::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 8% 12% auto;
  height: 70%;
  border-radius: 50%;
  background: var(--grad);
  filter: blur(120px);
  opacity: 0.16;
  pointer-events: none;
}
.demo-window {
  position: relative;
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.demo-window::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--grad);
  opacity: 0.35;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.demo-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 46px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.demo-dots {
  display: inline-flex;
  gap: 7px;
}
.demo-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}
.demo-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--muted);
}
.demo-sim {
  font-size: 0.72rem;
  padding: 3px 10px;
}

/* ── Etapas (indicador) ── */
.demo-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--line);
  counter-reset: st;
}
.demo-steps li {
  counter-increment: st;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 6px;
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--muted);
  transition: color 0.4s var(--ease);
}
.demo-steps li::before {
  content: counter(st);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease),
    color 0.4s;
}
.demo-steps li::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}
.demo-steps li.is-done {
  color: var(--text-2);
}
.demo-steps li.is-done::before {
  content: "✓";
  border-color: transparent;
  background: var(--surface-2);
  color: var(--ok);
}
.demo-steps li[aria-current="step"] {
  color: var(--text);
}
.demo-steps li[aria-current="step"]::before {
  border-color: transparent;
  background: var(--grad);
  color: var(--on-accent);
}
.demo-steps li[aria-current="step"]::after,
.demo-steps li.is-done::after {
  transform: scaleX(1);
}
.immersive[data-stage="static"] .demo-steps {
  display: none;
}

/* ── Lienzo y paneles ── */
.demo-canvas {
  position: relative;
  min-height: 520px;
  padding: clamp(18px, 3vw, 36px);
  display: grid;
  align-content: center;
}
.immersive[data-stage="static"] .demo-canvas {
  min-height: 0;
  gap: 40px;
}
.ds {
  min-width: 0;
}
.ds.is-enter {
  animation: ds-in 0.7s var(--ease) both;
}
@keyframes ds-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    filter: blur(6px);
  }
}
.ds-kicker {
  margin: 0 0 16px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

/* 1 · Fotos */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(6px, 1.2vw, 14px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.photo-tile {
  overflow: hidden;
  border-radius: 14px;
  aspect-ratio: 3 / 4;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.immersive.is-js .photo-tile {
  opacity: 0;
  transform: translateY(26px) scale(0.92);
  filter: blur(8px);
  transition: opacity 0.7s var(--ease), transform 0.8s var(--ease),
    filter 0.7s var(--ease);
  transition-delay: calc(var(--i, 0) * 85ms);
}
.immersive.is-js .photo-tile.is-in {
  opacity: 1;
  transform: none;
  filter: none;
}
.photo-tile.is-in img {
  animation: kenburns 9s ease-out both;
}
@keyframes kenburns {
  from {
    transform: scale(1.12);
  }
}

/* 2 · Subir */
.ds-upload {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(16px, 3vw, 32px);
  align-items: stretch;
}
.dropzone {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 32px 20px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--line-2);
  background: var(--surface);
  text-align: center;
  transition: border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
}
.dropzone p {
  margin: 0;
}
.dropzone.is-over {
  border-color: var(--accent-2);
  background: rgba(34, 211, 238, 0.06);
  box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.08);
}
.drop-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--grad-soft);
}
.drop-icon .i {
  width: 26px;
  height: 26px;
}
.dropzone.is-over .drop-icon {
  animation: bob 0.9s var(--ease) infinite alternate;
}
@keyframes bob {
  to {
    transform: translateY(-6px);
  }
}
.drop-btn {
  pointer-events: none;
}
.drop-btn.is-pressed {
  transform: scale(0.95);
  background: var(--surface-2);
}
.queue {
  display: grid;
  align-content: start;
  gap: 10px;
}
.queue-head {
  display: flex;
  justify-content: space-between;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.queue-head b {
  color: var(--text);
}
.queue-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.queue-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(60px, 0.8fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.82rem;
}
.immersive.is-js .queue-row {
  opacity: 0;
  transform: translateX(-14px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.immersive.is-js .queue-row.is-in {
  opacity: 1;
  transform: none;
}
.queue-row img {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  object-fit: cover;
}
.queue-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}
.queue-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.queue-bar i {
  display: block;
  height: 100%;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.75s cubic-bezier(0.4, 0, 0.2, 1);
}
.queue-row.is-up .queue-bar i,
.immersive[data-stage="static"] .queue-bar i {
  transform: scaleX(1);
}
.queue-ok {
  display: grid;
  place-items: center;
  color: var(--ok);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.3s, transform 0.35s var(--ease);
}
.queue-ok .i {
  width: 16px;
  height: 16px;
  stroke-width: 2.4;
}
.queue-row.is-done .queue-ok {
  opacity: 1;
  transform: none;
}

/* 3 · Renderizar */
.ds-render {
  display: grid;
  justify-items: center;
  gap: 22px;
  text-align: center;
}
.render-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
}
.render-summary div {
  display: inline-flex;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.85rem;
}
.render-summary dt {
  color: var(--muted);
}
.render-summary dd {
  margin: 0;
  font-weight: 600;
}
.render-btn {
  min-height: 64px;
  padding: 0 40px;
  font-size: 1.15rem;
}
.render-btn::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 2px solid rgba(255, 60, 172, 0.55);
  animation: ring-pulse 1.6s var(--ease) infinite;
  pointer-events: none;
}
@keyframes ring-pulse {
  0% {
    opacity: 0.9;
    transform: scale(0.96);
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}
.render-btn.is-pressed {
  transform: scale(0.95);
  box-shadow: 0 0 60px -6px rgba(255, 60, 172, 0.8),
    0 0 120px -10px rgba(34, 211, 238, 0.6);
}
.render-btn.is-pressed::after {
  animation: none;
  opacity: 0;
}
.ds-render .fine {
  margin: 0;
}

/* 4 · Procesando */
.ds-processing {
  display: grid;
  justify-items: center;
  gap: 22px;
  text-align: center;
}
.film {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-sm);
  -webkit-mask: linear-gradient(
    90deg,
    transparent,
    #000 12%,
    #000 88%,
    transparent
  );
  mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.film::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 70%
  );
  background-size: 250% 100%;
  animation: shimmer 1.8s linear infinite;
}
@keyframes shimmer {
  from {
    background-position: 150% 0;
  }
  to {
    background-position: -150% 0;
  }
}
.film-track {
  display: flex;
  gap: 10px;
  width: max-content;
  animation: film 16s linear infinite;
}
.film-track img {
  width: 92px;
  height: 122px;
  border-radius: 10px;
  object-fit: cover;
  filter: saturate(0.6) brightness(0.8);
}
@keyframes film {
  to {
    transform: translateX(-50%);
  }
}
.ring {
  --p: 0;
  display: grid;
  place-items: center;
  width: 168px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(
      closest-side,
      var(--surface-solid) 82%,
      transparent 83% 100%
    ),
    conic-gradient(
      #ff3cac 0%,
      #a463ff calc(var(--p) * 0.5%),
      #22d3ee calc(var(--p) * 1%),
      var(--surface-2) 0
    );
}
.ring b {
  font-size: 2.2rem;
  font-weight: 650;
  letter-spacing: -0.04em;
}
.phase {
  min-height: 1.6em;
  margin: 0;
  color: var(--text-2);
}
.phase.is-swap {
  animation: phase-in 0.45s var(--ease);
}
@keyframes phase-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* 5 · Resultado */
.result-head {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin-bottom: clamp(22px, 3vw, 36px);
  text-align: center;
}
.result-head h3 {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  letter-spacing: -0.03em;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(10px, 1.6vw, 20px);
}
.result-grid .device-sm {
  width: 100%;
  padding: 6px;
  border-radius: 26px;
}
.result-grid .device-sm .screen {
  border-radius: 21px;
}
.result-grid .device-sm .screen::after {
  height: 12px;
  top: 6px;
}
.result-grid .demo-label {
  top: 26px;
  left: 8px;
  right: 8px;
  font-size: 0.64rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-grid .demo-ctrl {
  width: 32px;
  height: 32px;
  right: 8px;
  bottom: 8px;
}
.result-grid .demo-sound {
  left: 8px;
}
.immersive.is-js .result-item {
  opacity: 0;
  transform: translateY(34px) scale(0.94);
  transition: opacity 0.8s var(--ease), transform 0.9s var(--ease);
  transition-delay: calc(var(--i, 0) * 120ms);
}
.immersive.is-js .result-item.is-in {
  opacity: 1;
  transform: none;
}
.result-note {
  max-width: 640px;
  margin: 24px auto 0;
  text-align: center;
}
.result-cta {
  justify-content: center;
  margin-top: 22px;
}

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-top: 20px;
}
.demo-skip {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.93rem;
  cursor: pointer;
  color: var(--text-2);
}

/* Lo que la demo acelera */
.real-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.real-steps .card > b {
  display: block;
  margin-bottom: 22px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
}

@media (max-width: 1100px) {
  .result-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .real-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .demo-steps li {
    flex-direction: column;
    gap: 4px;
    padding: 10px 2px;
    font-size: 0.68rem;
  }
  .demo-canvas {
    min-height: 440px;
  }
  .photo-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .photo-tile {
    border-radius: 9px;
  }
  .ds-upload {
    grid-template-columns: 1fr;
  }
  .dropzone {
    padding: 20px 16px;
  }
  .queue-list {
    max-height: 248px;
    overflow: hidden;
  }
  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .real-steps {
    grid-template-columns: 1fr;
  }
  .demo-sim {
    display: none;
  }
  /* Teléfonos de 2 columnas: la etiqueta puede ir en dos líneas; el CTA largo se parte en lugar de salirse */
  .result-grid .demo-label {
    white-space: normal;
    line-height: 1.25;
    padding: 4px 6px;
  }
  .result-cta .btn {
    width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    padding-block: 12px;
  }
}

.result-reveal {
  padding: 1rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.result-reveal.is-in {
  opacity: 1;
  transform: none;
}

.result-reveal h3 {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  letter-spacing: -0.03em;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .result-reveal {
    transition: none;
  }
}
