/* ==========================================================================
   INTEGRACIÓN CONSCIENTE · pieza interactiva "El bucle"
   --------------------------------------------------------------------------
   Scrollytelling: una figura fija en el centro que se transforma con el scroll.
   No es la ventana de app de RESET (aquí no hay área de miembros que enseñar):
   es el propio mecanismo del producto dibujado — el bucle automático que se
   abre, se bifurca y termina teniendo otra salida.

     escena 1 · el bucle cerrado, girando solo
     escena 2 · se abre una rendija: ves venir la reacción
     escena 3 · de la rendija sale otro camino
     escena 4 · el camino nuevo es el principal; el viejo se apaga
   ========================================================================== */

.vive{padding-bottom:0;overflow:visible}
.vive-intro{max-width:720px;padding-bottom:0}
.vive-intro .h2{margin-top:15px;font-weight:300}
.vive-intro p{margin-top:18px;color:var(--tinta-2);font-size:18px}
.vive-desliza{
  display:inline-flex;align-items:center;gap:10px;margin-top:20px;
  font-size:11.5px;letter-spacing:.22em;text-transform:uppercase;
  font-weight:600;color:var(--tinta-3);
}
.vive-desliza i{display:block;width:40px;height:1px;background:var(--linea);position:relative;overflow:hidden}
.vive-desliza i::after{content:"";position:absolute;inset:0;width:14px;
  background:var(--realce);animation:desliza 2.6s var(--ease) infinite}
@keyframes desliza{0%{transform:translateX(-14px)}60%,100%{transform:translateX(40px)}}

/* el raíl da la altura de scroll; la escena se queda pegada dentro */
.vive-rail{height:205vh;position:relative}
/* la escena se pega arriba. Si se centra en 100vh enteros queda un hueco
   enorme entre el "Desliza" y la figura, así que se limita el alto. */
.vive-stage{position:sticky;top:66px;padding-top:clamp(4px,1vh,14px);
  height:min(calc(100vh - 66px),554px);min-height:454px;
  display:flex;flex-direction:column;justify-content:center;overflow:hidden;
  background:var(--piedra);z-index:1}
.vive-grid{display:grid;grid-template-columns:minmax(0,.86fr) minmax(0,1.14fr);
  gap:clamp(28px,5vw,72px);align-items:center;width:100%}

/* ---------- textos (se funden uno sobre otro) ---------- */
.vs-texts{position:relative;min-height:355px}
.vs-txt{
  position:absolute;inset:0;display:flex;flex-direction:column;align-items:flex-start;
  opacity:0;transform:translateY(14px);pointer-events:none;
  transition:opacity .55s var(--ease),transform .55s var(--ease);
}
.vs-txt.on{opacity:1;transform:none;pointer-events:auto}
.vs-n{font-family:var(--serif);font-size:13px;font-weight:400;color:var(--realce);
  letter-spacing:.18em;margin-bottom:14px}
.vs-txt .eyebrow{color:var(--s3)}
.vs-txt h3{font-size:clamp(1.65rem,3.1vw,2.5rem);margin-top:12px;line-height:1.14;
  font-weight:300;max-width:16ch}
.vs-txt h3 em{font-style:italic;color:var(--s3)}
.vs-txt p{margin-top:18px;color:var(--tinta-2);font-size:16.8px;max-width:40ch}
.vs-semana{margin-top:20px;display:inline-flex;align-items:center;gap:9px;
  font-size:12px;letter-spacing:.14em;text-transform:uppercase;font-weight:600;
  color:var(--tinta-3);padding:7px 14px;border-radius:100px;
  box-shadow:inset 0 0 0 1px var(--linea);background:var(--papel)}
.vs-semana b{color:var(--s4);font-weight:700}

/* ---------- la figura ---------- */
.vs-vis{display:grid;place-items:center}
.bucle{width:100%;max-width:560px;overflow:visible}
.bucle text{font-family:var(--sans);font-size:11.5px;font-weight:600;
  letter-spacing:.17em;text-transform:uppercase;fill:var(--tinta-3)}

/* trazos base */
.bc-arco,.bc-cierra,.bc-rama{fill:none;stroke-linecap:round;
  transition:stroke .9s var(--ease),opacity .7s var(--ease),stroke-width .7s var(--ease)}
.bc-arco{stroke:var(--tinta-3);stroke-width:2}
/* los trazos que se dibujan usan pathLength="100" en el HTML, así el
   dasharray es exacto sin tener que medir la curva */
.bc-cierra{stroke:var(--tinta-3);stroke-width:2;
  stroke-dasharray:100;stroke-dashoffset:0;
  transition:stroke-dashoffset .8s var(--ease),opacity .6s var(--ease)}
.bc-rama{stroke:var(--s3);stroke-width:2;
  stroke-dasharray:100;stroke-dashoffset:100;opacity:0;
  transition:stroke-dashoffset 1.15s var(--ease),opacity .5s var(--ease),stroke .9s var(--ease)}

/* el punto que recorre el bucle */
.bc-orbita{transform-box:view-box;transform-origin:205px 255px;
  animation:bc-gira 2.3s linear infinite}
.bc-impulso{fill:var(--realce);stroke:var(--piedra);stroke-width:2.5;transition:opacity .5s var(--ease),fill .9s var(--ease)}
@keyframes bc-gira{to{transform:rotate(360deg)}}

/* el punto quieto en la rendija (escenas 3-4) */
.bc-pausa{fill:var(--realce);stroke:var(--piedra);stroke-width:2.5;opacity:0;transition:opacity .6s var(--ease)}

/* nodo del estado nuevo */
.bc-nodo{fill:var(--s3);opacity:0;
  transition:opacity .6s var(--ease),fill .9s var(--ease),r .6s var(--ease)}
.bc-nodo-halo{fill:none;stroke:var(--s3);stroke-width:1.2;opacity:0;
  transition:opacity .7s var(--ease),stroke .9s var(--ease)}

/* flecha de entrada del estímulo */
.bc-entra{fill:none;stroke:var(--tinta-3);stroke-width:2;stroke-linecap:round;
  stroke-linejoin:round;transition:opacity .6s var(--ease),stroke .9s var(--ease)}

/* etiquetas que aparecen por escena */
.bc-lbl{opacity:0;transition:opacity .6s var(--ease)}
.bc-lbl-rendija{fill:var(--realce)}
.bc-lbl-nueva{fill:var(--s3)}
.bc-lbl-vieja{transition:opacity .6s var(--ease),fill .9s var(--ease)}

/* ======================  estados por escena  ====================== */

/* 1 · bucle cerrado, girando rápido */
.vive-stage[data-escena="1"] .bc-orbita{animation-duration:2.3s}

/* 2 · se abre la rendija y el giro se frena */
.vive-stage[data-escena="2"] .bc-cierra{stroke-dashoffset:100;opacity:0}
.vive-stage[data-escena="2"] .bc-orbita{animation-duration:5.4s}
.vive-stage[data-escena="2"] .bc-lbl-rendija{opacity:1}

/* 3 · el punto se detiene en la rendija y sale la rama */
.vive-stage[data-escena="3"] .bc-cierra{stroke-dashoffset:100;opacity:0}
.vive-stage[data-escena="3"] .bc-orbita{animation-play-state:paused;opacity:0}
.vive-stage[data-escena="3"] .bc-impulso{opacity:0}
.vive-stage[data-escena="3"] .bc-pausa{opacity:1}
.vive-stage[data-escena="3"] .bc-rama{stroke-dashoffset:0;opacity:1}
.vive-stage[data-escena="3"] .bc-nodo{opacity:1}
.vive-stage[data-escena="3"] .bc-lbl-rendija{opacity:1}
.vive-stage[data-escena="3"] .bc-lbl-nueva{opacity:1}

/* 4 · el camino nuevo manda; el bucle viejo se apaga */
.vive-stage[data-escena="4"] .bc-cierra{stroke-dashoffset:100;opacity:0}
.vive-stage[data-escena="4"] .bc-orbita{animation-play-state:paused;opacity:0}
.vive-stage[data-escena="4"] .bc-impulso{opacity:0}
.vive-stage[data-escena="4"] .bc-arco{stroke:var(--linea);stroke-width:1.2;opacity:.75}
.vive-stage[data-escena="4"] .bc-entra{stroke:var(--s3)}
.vive-stage[data-escena="4"] .bc-pausa{opacity:1;fill:var(--s3)}
.vive-stage[data-escena="4"] .bc-rama{stroke-dashoffset:0;opacity:1;
  stroke:var(--realce);stroke-width:3.2}
.vive-stage[data-escena="4"] .bc-nodo{opacity:1;fill:var(--realce)}
.vive-stage[data-escena="4"] .bc-nodo-halo{opacity:1;stroke:var(--realce)}
.vive-stage[data-escena="4"] .bc-lbl-nueva{opacity:1;fill:var(--realce)}
.vive-stage[data-escena="4"] .bc-lbl-vieja{opacity:.4}

/* ---------- puntos de progreso + pista ---------- */
.vive-dots{display:flex;gap:9px;justify-content:center;margin-top:clamp(22px,3.5vw,38px)}
.vive-dots i{width:7px;height:7px;border-radius:50%;background:var(--linea);
  cursor:pointer;transition:background-color .3s var(--ease),transform .3s var(--ease)}
.vive-stage[data-escena="1"] .vive-dots i:nth-child(1),
.vive-stage[data-escena="2"] .vive-dots i:nth-child(2),
.vive-stage[data-escena="3"] .vive-dots i:nth-child(3),
.vive-stage[data-escena="4"] .vive-dots i:nth-child(4){
  background:var(--s3);transform:scale(1.42)
}50%{transform:translateY(4px)}}

/* ==========================================================================
   "La línea" — ilustración de la sección DESPUÉS
   Una línea que entra a sacudidas y sale regulada. Se dibuja al entrar
   en pantalla (no en bucle), como pide el sistema de movimiento.
   ========================================================================== */
.linea-fig{width:100%;overflow:visible}
.linea-fig path{fill:none;stroke-linecap:round;stroke-linejoin:round}
.ln-guia{stroke:var(--linea);stroke-width:1;stroke-dasharray:3 6}
.ln-traza{
  stroke:var(--realce);stroke-width:2.6;
  stroke-dasharray:1000;stroke-dashoffset:1000;
  transition:stroke-dashoffset 2.6s var(--ease),stroke 2.2s var(--ease) .6s;
}
.linea-fig.visto .ln-traza{stroke-dashoffset:0;stroke:var(--s3)}
.ln-marca{fill:var(--realce);opacity:0;transition:opacity .6s var(--ease) 1.9s}
.linea-fig.visto .ln-marca{opacity:1}
.ln-txt{font-family:var(--sans);font-size:11px;font-weight:600;letter-spacing:.18em;
  text-transform:uppercase;fill:var(--tinta-3);opacity:0;
  transition:opacity .6s var(--ease) 2.1s}
.linea-fig.visto .ln-txt{opacity:1}

/* ==========================================================================
   responsive de la pieza interactiva
   En móvil el scrollytelling de dos columnas no funciona: se convierte en
   una secuencia vertical normal, cada escena con su figura ya resuelta.
   ========================================================================== */
/* Ojo con .vs-texts: las escenas van en position:absolute, así que el alto
   lo tiene que reservar el contenedor. Si se queda corto, el texto se
   desborda y pisa los puntos de progreso. Al cambiar el copy de las
   escenas hay que revisar que la más larga siga cabiendo. */
@media (max-width:920px){
  .vive-grid{grid-template-columns:1fr;gap:26px}
  .vs-texts{min-height:325px}
  .bucle{max-width:min(420px,82vw)}
  .vive-stage{min-height:514px}
  .vive-rail{height:205vh}
}
@media (max-width:700px){
  .vive-rail{height:195vh}
  /* 100dvh, no 100svh: svh se queda con el alto "corto" (barra de Safari
     visible) y al hacer scroll esa barra se esconde, el viewport real crece
     y el contenido centrado en un alto más chico queda pegado arriba con
     un hueco abajo. dvh sigue el alto real en cada instante. */
  .vive-stage{height:calc(100dvh - 66px);min-height:580px;justify-content:flex-start;padding-top:12px}
  .vive-grid{gap:18px}
  .vs-texts{min-height:345px;order:2}
  .vs-vis{order:1}
  .bucle{max-width:min(320px,78vw)}
  .vs-txt h3{font-size:1.5rem;max-width:none}
  .vs-txt p{font-size:15.5px;max-width:none}
  .bucle text{font-size:14px}
}
/* ---------- movimiento reducido ----------
   Sin scrollytelling: las 4 escenas se despliegan en vertical y la figura
   se muestra ya resuelta (el estado de la escena 4), que es el que explica
   la idea completa de un vistazo. El JS se desactiva solo en este caso. */
@media (prefers-reduced-motion:reduce){
  .vive-rail{height:auto}
  .vive-stage{position:static;height:auto;min-height:0;padding:0 0 var(--sec)}
  .vive-grid{grid-template-columns:1fr}
  .vs-texts{min-height:0;display:grid;gap:40px}
  .vs-txt{position:static;opacity:1;transform:none;pointer-events:auto}
  .vive-dots,.vive-desliza{display:none}

  /* la figura, en su estado final */
  .bc-cierra{stroke-dashoffset:100;opacity:0}
  .bc-orbita,.bc-impulso{opacity:0}
  .bc-arco{stroke:var(--linea);stroke-width:1.2;opacity:.75}
  .bc-entra{stroke:var(--s3)}
  .bc-pausa{opacity:1;fill:var(--s3)}
  .bc-rama{stroke-dashoffset:0;opacity:1;stroke:var(--realce);stroke-width:3.2}
  .bc-nodo{opacity:1;fill:var(--realce)}
  .bc-nodo-halo{opacity:1;stroke:var(--realce)}
  .bc-lbl-nueva{opacity:1;fill:var(--realce)}
  .bc-lbl-rendija{opacity:1}
  .bc-lbl-vieja{opacity:.4}

  .ln-traza{stroke-dashoffset:0;stroke:var(--s3)}
  .ln-marca,.ln-txt{opacity:1}
}
