/* =========================================================================
   07 · Cierre (.s-cierre) — sección violeta
   Lámina 15 (manifiesto) + escenas Stinger y End del video Boom:
   isotipo blanco con anillo fino que se dibuja, ondas que se expanden y
   chispas en órbita; manifiesto palabra por palabra; video completo en
   bandeja oscura; CTA final en tarjeta de vidrio oscuro con los 3 pasos
   unidos por una hairline con pulsos.
   - La entrada corre una vez al aparecer (.is-armed → .is-play).
   - Los loops (ondas, chispas, pulsos, anillo del play) corren solo con
     .is-live, que el JS pone mientras la sección está en pantalla.
   - Movimiento reducido o sin JS: estado final estático.
   AA: todo el texto chico vive sobre superficies oscuras (bandeja y tarjeta);
   el manifiesto va arriba, sobre el tramo más oscuro del degradé.
   ========================================================================= */

.s-cierre {
  overflow: hidden;
  padding-bottom: calc(var(--section-y) * 1.05);
}
/* Las reglas de la grilla bajan hasta el borde (el padding inferior es mayor) */
.s-cierre > .frame::before,
.s-cierre > .frame::after { bottom: calc(-1.05 * var(--section-y)); }
/* Halo oscuro tras el manifiesto (como el End): da profundidad y asegura
   contraste del titular sobre el degradé. */
.s-cierre::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: min(900px, 70%);
  background: radial-gradient(72% 58% at 50% 24%, rgba(22, 18, 70, 0.56), rgba(22, 18, 70, 0) 78%);
  pointer-events: none;
  z-index: -1;
}

.s-cierre .s-cierre__inner {
  display: grid;
  justify-items: center;
}

/* ---------- Manifiesto ---------- */
.s-cierre .s-cierre__head {
  display: grid;
  justify-items: center;
  gap: clamp(28px, 3.4vw, 44px);
  text-align: center;
  width: 100%;
}
.s-cierre .s-cierre__title {
  font-size: clamp(32px, 4.4vw, 62px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  max-width: 24ch;
  color: #fff;
  text-shadow: 0 2px 30px rgba(20, 16, 70, 0.35);
}
.s-cierre .s-cierre__w { display: inline-block; }

/* Marca: isotipo + anillos (1:1) */
.s-cierre .s-cierre__mark {
  --mark: clamp(132px, 13vw, 184px);
  position: relative;
  width: var(--mark);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}
.s-cierre .s-cierre__rings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.s-cierre .s-cierre__ring {
  fill: none;
  stroke: #fff;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transform-box: fill-box;
  transform-origin: center;
}
.s-cierre .s-cierre__ring--outer { stroke: rgba(255, 255, 255, 0.42); stroke-dasharray: 1; stroke-dashoffset: 0; }
.s-cierre .s-cierre__ring--inner { stroke: rgba(255, 255, 255, 0.16); }
.s-cierre .s-cierre__ring--wave { opacity: 0; }
.s-cierre .s-cierre__orbit { transform-box: view-box; transform-origin: 120px 120px; }
.s-cierre .s-cierre__spark { fill: #fff; opacity: 0.7; filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.9)); }
.s-cierre .s-cierre__iso {
  position: relative;
  width: 34%;
  height: auto;
  filter: drop-shadow(0 6px 22px rgba(20, 16, 70, 0.45));
}

/* ---------- Hilo: línea fina con pulso entre el manifiesto y el video ---------- */
.s-cierre .s-cierre__player::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 1px;
  height: clamp(48px, 6vw, 80px);
  margin-left: -0.5px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 50%, rgba(255, 255, 255, 0) 100%) 0 -40px / 1px 40px no-repeat,
    linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.35));
}

/* ---------- CTA final ---------- */
.s-cierre .s-cierre__cta {
  width: 100%;
  max-width: 1040px;
  margin-top: clamp(48px, 6vw, 80px);
  padding: clamp(24px, 4vw, 56px);
  border-radius: var(--r-lg);
  background: rgba(20, 18, 36, 0.84);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 40px 80px -40px rgba(14, 10, 50, 0.8);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.s-cierre .s-cierre__ask { display: grid; gap: 24px; justify-items: start; }
.s-cierre .s-cierre__h3 {
  font-weight: 300;
  font-size: clamp(26px, 2.6vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  max-width: 16ch;
  text-wrap: balance;
}
.s-cierre .s-cierre__form input { height: 44px; }
.s-cierre .s-cierre__form input::placeholder { color: var(--muted); }
.s-cierre .s-cierre__form .btn { height: 44px; padding: 0 20px; }
.s-cierre .s-cierre__form:focus-within { outline: 2px solid var(--lila-claro); outline-offset: 3px; }
.s-cierre .s-cierre__form:has(button:focus) { outline: none; }
.s-cierre .s-cierre__form button:focus-visible { outline: 2px solid #0e0d0c; outline-offset: -5px; }
.s-cierre .s-cierre__msg {
  margin: -8px 0 0;
  min-height: 1.5em;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}
.s-cierre .s-cierre__msg.is-ok::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: 1px;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.18);
}

/* Pasos: línea vertical con nodos de anillo y un pulso que baja */
.s-cierre .s-cierre__steps {
  position: relative;
  padding-left: clamp(0px, 4vw, 56px);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}
.s-cierre .s-cierre__label { margin: 0 0 22px; color: var(--ink-2); }
.s-cierre .s-cierre__list { list-style: none; margin: 0; padding: 0; }
.s-cierre .s-cierre__step {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  column-gap: 14px;
  padding-bottom: 22px;
}
.s-cierre .s-cierre__step:last-child { padding-bottom: 0; }
/* Nodo: anillo que se enciende cuando pasa el pulso */
.s-cierre .s-cierre__step::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(20, 18, 36, 1);
  box-sizing: border-box;
}
/* Tramo entre nodos con su pulso */
.s-cierre .s-cierre__step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 22px;
  bottom: 4px;
  width: 1px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0), #fff, rgba(255, 255, 255, 0)) 0 -28px / 1px 28px no-repeat,
    rgba(255, 255, 255, 0.18);
}
.s-cierre .s-cierre__num {
  grid-column: 2;
  font-family: var(--font-mono);
  font-size: var(--t-eyebrow);
  letter-spacing: 0.08em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  line-height: 20px;
}
.s-cierre .s-cierre__text {
  grid-column: 2;
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* ---------- Entrada (una vez) ---------- */
.s-cierre.is-armed .s-cierre__ring--outer,
.s-cierre.is-armed .s-cierre__ring--inner,
.s-cierre.is-armed .s-cierre__iso,
.s-cierre.is-armed .s-cierre__orbit,
.s-cierre.is-armed .s-cierre__w {
  animation-fill-mode: both;
  animation-play-state: paused;
  animation-timing-function: var(--ease);
}
.s-cierre.is-armed.is-play .s-cierre__ring--outer,
.s-cierre.is-armed.is-play .s-cierre__ring--inner,
.s-cierre.is-armed.is-play .s-cierre__iso,
.s-cierre.is-armed.is-play .s-cierre__orbit,
.s-cierre.is-armed.is-play .s-cierre__w {
  animation-play-state: running;
}
.s-cierre.is-armed .s-cierre__ring--outer { animation-name: s-cierre-draw; animation-duration: 1200ms; animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
.s-cierre.is-armed .s-cierre__ring--inner { animation-name: s-cierre-fade; animation-duration: 900ms; animation-delay: 380ms; }
.s-cierre.is-armed .s-cierre__iso { animation-name: s-cierre-iso; animation-duration: 1100ms; animation-delay: 120ms; }
.s-cierre.is-armed .s-cierre__orbit { animation-name: s-cierre-fade; animation-duration: 900ms; animation-delay: 700ms; }
.s-cierre.is-armed .s-cierre__w {
  animation-name: s-cierre-word;
  animation-duration: 900ms;
  animation-delay: calc(760ms + var(--i, 0) * 65ms);
}

@keyframes s-cierre-draw {
  from { stroke-dashoffset: 1; transform: rotate(-120deg); stroke: #fff; opacity: 0; }
  4%   { opacity: 1; }
  60%  { stroke: #fff; }
  to   { stroke-dashoffset: 0; transform: rotate(0deg); stroke: rgba(255, 255, 255, 0.42); }
}
@keyframes s-cierre-fade {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: none; }
}
@keyframes s-cierre-iso {
  from { opacity: 0; transform: scale(0.82); filter: blur(6px) drop-shadow(0 6px 22px rgba(20, 16, 70, 0.45)); }
  to   { opacity: 1; transform: none; filter: blur(0) drop-shadow(0 6px 22px rgba(20, 16, 70, 0.45)); }
}
@keyframes s-cierre-word {
  from { opacity: 0; transform: translateY(0.38em); filter: blur(8px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

/* ---------- Loops (.is-loop los define; corren solo con .is-live) ---------- */
.s-cierre.is-loop .s-cierre__rings { animation: s-cierre-spin 80s linear infinite; }
.s-cierre.is-loop .s-cierre__ring--wave { animation: s-cierre-wave 3.6s cubic-bezier(0.16, 1, 0.3, 1) 900ms infinite both; }
.s-cierre.is-loop .s-cierre__ring--wave2 { animation-name: s-cierre-wave2; animation-delay: 1500ms; }
.s-cierre.is-loop .s-cierre__spark { animation: s-cierre-twinkle 2.8s ease-in-out calc(var(--k) * -0.43s) infinite; }
.s-cierre.is-loop .s-cierre__player::before { animation: s-cierre-thread 2.4s cubic-bezier(0.45, 0, 0.2, 1) infinite; }
.s-cierre.is-loop .s-cierre__disc::before { animation: s-cierre-breathe 2.6s var(--ease) infinite; }
.s-cierre.is-loop .s-cierre__disc::after { animation: s-cierre-breathe 2.6s var(--ease) 0.5s infinite; }
.s-cierre.is-loop .s-cierre__step::before { animation: s-cierre-node 3.6s ease-out calc(var(--n) * 1.1s) infinite; }
.s-cierre.is-loop .s-cierre__step:not(:last-child)::after { animation: s-cierre-seg 3.6s cubic-bezier(0.45, 0, 0.2, 1) calc(var(--n) * 1.1s + 0.15s) infinite; }
/* Fuera de pantalla, todo loop queda en pausa donde iba */
.s-cierre.is-loop:not(.is-live) .s-cierre__rings,
.s-cierre.is-loop:not(.is-live) .s-cierre__ring--wave,
.s-cierre.is-loop:not(.is-live) .s-cierre__spark,
.s-cierre.is-loop:not(.is-live) .s-cierre__player::before,
.s-cierre.is-loop:not(.is-live) .s-cierre__disc::before,
.s-cierre.is-loop:not(.is-live) .s-cierre__disc::after,
.s-cierre.is-loop:not(.is-live) .s-cierre__step::before,
.s-cierre.is-loop:not(.is-live) .s-cierre__step:not(:last-child)::after {
  animation-play-state: paused;
}

@keyframes s-cierre-spin { to { transform: rotate(360deg); } }
@keyframes s-cierre-wave {
  0%   { opacity: 0; transform: scale(1); }
  8%   { opacity: 0.5; }
  70%, 100% { opacity: 0; transform: scale(1.7); }
}
@keyframes s-cierre-wave2 {
  0%   { opacity: 0; transform: scale(1); }
  10%  { opacity: 0.25; }
  70%, 100% { opacity: 0; transform: scale(1.4); }
}
@keyframes s-cierre-twinkle {
  0%, 100% { opacity: 0.2; }
  50%      { opacity: 1; }
}
@keyframes s-cierre-thread {
  0%   { background-position: 0 -40px, 0 0; }
  100% { background-position: 0 calc(100% + 40px), 0 0; }
}
@keyframes s-cierre-breathe {
  0%   { transform: scale(0.92); opacity: 0.8; }
  100% { transform: scale(1.28); opacity: 0; }
}
@keyframes s-cierre-node {
  0%   { background: #fff; border-color: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.14), 0 0 14px rgba(201, 189, 230, 0.7); }
  30%, 100% { background: rgba(20, 18, 36, 1); border-color: rgba(255, 255, 255, 0.55); box-shadow: none; }
}
@keyframes s-cierre-seg {
  0%   { background-position: 0 -28px, 0 0; }
  32%, 100% { background-position: 0 calc(100% + 28px), 0 0; }
}

/* ---------- Tablet ---------- */
@media (max-width: 1023.98px) {
  .s-cierre .s-cierre__cta { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .s-cierre .s-cierre__steps {
    padding-left: 0;
    padding-top: clamp(28px, 4vw, 40px);
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  .s-cierre .s-cierre__h3 { max-width: 20ch; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767.98px) {
  /* En angosto el brillo lila de la esquina llega al titular: halo más ancho */
  .s-cierre::before { background: radial-gradient(140% 50% at 50% 22%, rgba(22, 18, 70, 0.6), rgba(22, 18, 70, 0) 80%); }
  .s-cierre .s-cierre__bar { min-height: 40px; }
  .s-cierre .s-cierre__caption { font-size: 10.5px; }
  .s-cierre .s-cierre__disc::after { inset: -16px; }
}
@media (max-width: 479.98px) {
  .s-cierre .s-cierre__form {
    flex-direction: column;
    align-items: stretch;
    border-radius: var(--r-lg);
    padding: 6px;
    max-width: none;
  }
  .s-cierre .s-cierre__form input {
    flex: none;
    width: 100%;
    height: 44px;
    padding: 0 14px;
  }
  .s-cierre .s-cierre__form .btn { width: 100%; }
  .s-cierre .s-cierre__form button:focus-visible { outline-offset: -4px; }
  .s-cierre .s-cierre__ask { justify-items: stretch; }
}

/* ---------- Sin JavaScript: la portada no tapa los controles nativos ---------- */
@media (scripting: none) {
  .s-cierre .s-cierre__cover { display: none; }
}

/* ---------- Movimiento reducido: estado final estático ---------- */
@media (prefers-reduced-motion: reduce) {
  .s-cierre *,
  .s-cierre *::before,
  .s-cierre *::after { animation: none !important; }
  .s-cierre .s-cierre__rings { animation: none !important; }
  .s-cierre .s-cierre__player::before { background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.35)); }
  .s-cierre .s-cierre__disc,
  .s-cierre .s-cierre__cover,
  .s-cierre .s-cierre__player.is-playing .s-cierre__cover { transition: none; }
  .s-cierre .s-cierre__cover:hover .s-cierre__disc { transform: none; }
}
