/* ==========================================================================
   BeZion Makers · Sistema de movimiento ("Calma con precisión")
   Solo tokens existentes (var(--…)) · Sin JavaScript todo es visible
   ========================================================================== */

@property --mx {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 50%;
}

@property --my {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 50%;
}

:root {
  --mov-rapido: .25s;
  --mov-base: .6s;
  --mov-lento: 1.1s;
  --ease-salida: cubic-bezier(.16, 1, .3, 1);
  interpolate-size: allow-keywords;
}

/* Barra de lectura superior de 2 px en --acento con scaleX() */
.barra-lectura {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 80;
  height: 2px;
  background: var(--acento);
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
  will-change: transform;
}

/* Máscara de líneas de SplitText: protege descendentes sin recortarlos */
.bz-linea-mask {
  padding-bottom: .1em;
  margin-bottom: -.1em;
}

/* ---------- F2b · Horizonte de velas WebGL detrás del hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
}
.hero > .contenedor {
  position: relative;
  z-index: 2;
}
.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Estados iniciales solo cuando precarga.js activó html.js.
   La imagen del hero (.hero-media img) NUNCA arranca con opacidad 0 (es el LCP). */
html.js .hero-texto .linea-superior,
html.js .hero-texto .subtitulo,
html.js .hero-texto .apoyo,
html.js .hero-texto .botones,
html.js .hero-texto .chips li {
  opacity: 0;
  transform: translateY(20px);
}

html.js [data-revelar]:not(h1):not(h2):not(:has(h2)) {
  opacity: 0;
  transform: translateY(24px);
}

html.js [data-revelar]:has(h2) > :not(h2) {
  opacity: 0;
  transform: translateY(24px);
}

/* ---------- F1.5.1 · Cómo funciona: barras comparativas y flujo SVG ---------- */
.comparativa-barras {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}
.comparativa-fila {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  align-items: center;
}
.comparativa-cifra {
  font-size: 14px;
  font-weight: 700;
  color: var(--texto-suave);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.comparativa-cifra-acento {
  color: var(--acento-texto);
}
.comparativa-pista {
  display: block;
  height: 10px;
  background: var(--linea);
  border-radius: var(--pildora);
  overflow: hidden;
}
.comparativa-relleno {
  display: block;
  height: 100%;
  border-radius: var(--pildora);
  transform-origin: 0 50%;
}
.comparativa-suave {
  width: 43.6%;
  background: var(--texto-suave);
}
.comparativa-acento {
  width: 100%;
  background: var(--acento);
}
html.js .comparativa-relleno {
  transform: scaleX(0);
}

.flujo-dinero {
  display: none;
}
.pasos-envoltura {
  position: relative;
}
.flujo-svg {
  overflow: visible;
  fill: none;
}
.flujo-base {
  stroke: var(--linea);
  stroke-width: 1.5;
}
.flujo-trazo,
.flujo-trazo-movil {
  stroke: var(--acento);
  stroke-width: 2;
  stroke-linecap: round;
}
.flujo-nodo {
  fill: var(--fondo);
  stroke: var(--linea);
  stroke-width: 2;
  transition: stroke var(--mov-rapido) var(--ease-salida), fill var(--mov-rapido) var(--ease-salida);
}
.flujo-nodo.activo {
  fill: var(--acento);
  stroke: var(--acento);
}
.flujo-svg-movil {
  position: absolute;
  left: -14px;
  top: 24px;
  bottom: 24px;
  width: 16px;
  height: calc(100% - 48px);
  pointer-events: none;
}
.pasos li {
  transition:
    border-color var(--mov-base) var(--ease-salida),
    box-shadow var(--mov-base) var(--ease-salida);
}
.pasos li::before {
  transition: opacity var(--mov-base) var(--ease-salida);
}
.pasos li p {
  transition: color var(--mov-base) var(--ease-salida);
}
.pasos li.paso-inactivo {
  border-color: color-mix(in srgb, var(--linea) 55%, var(--superficie));
  box-shadow: none;
}
.pasos li.paso-inactivo::before {
  opacity: .28;
}
.pasos li.paso-inactivo p {
  color: var(--texto-suave);
  opacity: 1;
}
.pasos li.paso-activo {
  border-color: color-mix(in srgb, var(--acento) 48%, var(--linea));
  box-shadow: var(--sombra-tarjeta);
}
.pasos li.paso-activo::before {
  opacity: 1;
}
.pasos li.paso-activo p {
  color: var(--texto);
}

@media (min-width: 1024px) {
  .flujo-dinero {
    display: block;
    margin-top: 28px;
  }
  .flujo-svg-escritorio {
    width: 100%;
    height: 32px;
  }
  .flujo-svg-movil {
    display: none;
  }
  .como-escena .subtitulo-bloque {
    margin-top: 72px;
  }
}

/* ---------- F1.5.2 · Catálogo: borde de luz en PEICAR ---------- */
.tarjeta-estrella {
  position: relative;
  transform-style: preserve-3d;
}
@media (hover: hover) and (pointer: fine) {
  .tarjeta-estrella::after {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1.5px;
    border-radius: inherit;
    background: radial-gradient(
      380px circle at var(--mx) var(--my),
      color-mix(in srgb, var(--acento) 35%, transparent),
      transparent 70%
    );
    -webkit-mask: linear-gradient(var(--superficie) 0 0) content-box, linear-gradient(var(--superficie) 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(var(--superficie) 0 0) content-box, linear-gradient(var(--superficie) 0 0);
    mask-composite: exclude;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--mov-rapido) var(--ease-salida);
  }
  .tarjeta-estrella:hover::after {
    opacity: 1;
  }
}

/* ---------- F1.5.3 · Para quién es: carrusel con arrastre y medidor ---------- */
@media (min-width: 1120px) {
  .perfiles {
    display: flex;
    gap: 20px;
    margin: 48px calc(-1 * var(--margen)) -16px;
    padding: 8px var(--margen) 24px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--margen);
  }
  .perfil {
    flex: 0 0 304px;
    scroll-snap-align: start;
  }
}
@media (hover: hover) and (pointer: fine) {
  .perfiles {
    cursor: grab;
  }
  .perfiles.arrastrando {
    cursor: grabbing;
    scroll-snap-type: none;
    user-select: none;
  }
}
.perfiles:focus-visible {
  outline: 3px solid var(--texto);
  outline-offset: 4px;
  border-radius: var(--radio-tarjeta);
}
.medidor-riesgo {
  grid-column: 1 / -1;
  display: block;
  height: 6px;
  margin-top: 6px;
  background: var(--linea);
  border-radius: var(--pildora);
  overflow: hidden;
}
.medidor-riesgo-barra {
  display: block;
  height: 100%;
  width: var(--riesgo-pct, 50%);
  background: var(--acento);
  border-radius: var(--pildora);
  transform-origin: 0 50%;
}
html.js .medidor-riesgo-barra {
  transform: scaleX(0);
}

/* ---------- F1.5.4 · Historia: línea de tiempo con scaleY ---------- */
.linea-tiempo-trazo {
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--acento);
  transform-origin: 50% 0;
  transform: scaleY(0);
  pointer-events: none;
}

/* ---------- F1.5.5 · FAQ: altura animada e ícono + a - ---------- */
.acordeon details::details-content {
  overflow: hidden;
  height: 0;
  opacity: 0;
  transition:
    height var(--mov-base) var(--ease-salida),
    opacity var(--mov-rapido) var(--ease-salida),
    content-visibility var(--mov-base) allow-discrete;
}
.acordeon details[open]::details-content {
  height: auto;
  opacity: 1;
}
.acordeon details[open] summary .icono {
  transform: none;
}
.acordeon summary .icono-v {
  transform-origin: 12px 12px;
  transition: transform var(--mov-rapido) var(--ease-salida), opacity var(--mov-rapido) var(--ease-salida);
}
.acordeon details[open] summary .icono-v {
  transform: scaleY(0);
  opacity: 0;
}

/* ---------- F1.5.6 · Simulador: barra scaleX, presión y check animado ---------- */
.sim-pantalla[data-pantalla="preguntas"] {
  position: relative;
}
.sim-fantasma {
  position: absolute;
  inset: 52px 0 auto 0;
  pointer-events: none;
}
html.js .avance-barra span {
  width: 100% !important;
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform var(--mov-base) var(--ease-salida);
}
.opcion-check {
  position: absolute;
  left: 27px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--superficie);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
}
html.js .opcion[aria-pressed="true"]::before {
  background-image: none;
}
html.js .opcion[aria-pressed="true"] .opcion-check {
  opacity: 1;
}

/* ---------- F2.3 / R2.1 · Gráfica de proyección 0-30 años ---------- */
.grafica-bloque {
  margin-top: 32px;
}
.grafica-cabecera {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 10px;
}
.grafica-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.grafica-toggle-texto {
  font-size: 14px;
  font-weight: 700;
  color: var(--texto);
}
.grafica-envoltura {
  position: relative;
  padding: 16px 12px 12px;
  background: var(--fondo);
  border: 1px solid var(--linea);
  border-radius: 16px;
}
.grafica-envoltura:focus-visible {
  outline: 3px solid var(--texto);
  outline-offset: 3px;
}
.grafica-leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 0 2px;
  font-size: 13px;
  font-weight: 500;
}
.grafica-leyenda-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--texto-suave);
}
.grafica-leyenda-item.es-activa {
  color: var(--texto);
  font-weight: 700;
}
.grafica-muestra {
  display: inline-block;
  width: 22px;
  height: 0;
}
.grafica-muestra-perfil {
  border-top: 2.5px solid var(--acento);
}
.grafica-muestra-cetes {
  border-top: 1.5px dashed var(--texto-suave);
}
.grafica-muestra-comp-0 { border-top: 2px dotted var(--texto-suave); opacity: .5; }
.grafica-muestra-comp-1 { border-top: 1.5px dashed var(--texto-suave); opacity: .62; }
.grafica-muestra-comp-2 { border-top: 1.5px solid var(--texto-suave); opacity: .45; }
.grafica-muestra-comp-3 { border-top: 2px dashed var(--texto-suave); opacity: .82; }
.grafica-muestra-comp-4 { border-top: 1.5px solid var(--texto-suave); opacity: .9; }
.grafica-svg {
  display: block;
  width: 100%;
  height: 220px;
  overflow: visible;
  touch-action: pan-y;
}
@media (min-width: 640px) {
  .grafica-envoltura {
    padding: 20px 20px 14px;
  }
  .grafica-svg {
    height: 250px;
  }
}
@media (min-width: 960px) {
  .grafica-svg {
    height: 280px;
  }
}
.grafica-rejilla line {
  stroke: var(--linea);
  stroke-width: 1;
}
.grafica-area {
  fill: color-mix(in srgb, var(--acento) 10%, transparent);
}
.grafica-trazo-cetes {
  fill: none;
  stroke: var(--texto-suave);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.grafica-trazo-perfil {
  fill: none;
  stroke: var(--acento);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.grafica-trazo-comp {
  fill: none;
  stroke: var(--texto-suave);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.grafica-comp-0 { stroke-dasharray: 2 4; opacity: .48; }
.grafica-comp-1 { stroke-dasharray: 9 4; opacity: .60; }
.grafica-comp-2 { stroke-dasharray: 10 3 2 3; opacity: .72; }
.grafica-comp-3 { stroke-dasharray: 16 4; opacity: .84; }
.grafica-comp-4 { stroke-dasharray: none; opacity: .90; }
.grafica-guia {
  stroke: var(--linea);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.grafica-eje text {
  fill: var(--texto-suave);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.grafica-punto-cetes {
  fill: var(--superficie);
  stroke: var(--texto-suave);
  stroke-width: 1.5;
}
.grafica-punto-perfil {
  fill: var(--acento);
  stroke: var(--superficie);
  stroke-width: 1.5;
}
.grafica-foco-cetes {
  fill: var(--superficie);
  stroke: var(--texto-suave);
  stroke-width: 2;
}
.grafica-foco-perfil {
  fill: var(--acento);
  stroke: var(--superficie);
  stroke-width: 2;
}
.grafica-etiqueta {
  position: absolute;
  top: 44px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  min-width: 168px;
  max-width: calc(100% - 24px);
  padding: 10px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--superficie) 88%, transparent);
  font-size: 13px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.grafica-etiqueta-anio {
  font-size: 12px;
  font-weight: 700;
  color: var(--texto-suave);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.grafica-etiqueta-perfil {
  margin-top: 2px;
  font-weight: 700;
  color: var(--texto);
}
.grafica-etiqueta-cetes {
  color: var(--texto-suave);
}

@media (prefers-reduced-motion: reduce) {
  html.js .hero-texto .linea-superior,
  html.js .hero-texto .subtitulo,
  html.js .hero-texto .apoyo,
  html.js .hero-texto .botones,
  html.js .hero-texto .chips li,
  html.js [data-revelar]:not(h1):not(h2):not(:has(h2)),
  html.js [data-revelar]:has(h2) > :not(h2),
  html.js .comparativa-relleno,
  html.js .medidor-riesgo-barra {
    transform: none !important;
  }
  .linea-tiempo-trazo {
    transform: scaleY(1) !important;
  }
}

@media print {
  .barra-lectura {
    display: none !important;
  }
  html.js [data-revelar],
  html.js [data-revelar] > * {
    opacity: 1 !important;
    transform: none !important;
  }
}
