/* ─────────────────────────────────────────────────────────
   Stats V2 — Scroll Stack Cards (puerto divi-plus/ScrollStackCards).
   Soporta layout vertical (colapso por altura) y horizontal (colapso por ancho).
   ───────────────────────────────────────────────────────── */

/* Reset agresivo de ancestros Divi (overflow/transform/filter/contain).
   Crítico para que position:sticky funcione en style2 — Divi por defecto
   añade overflow:hidden a sections con dividers, transform en sticky modules
   nativos, etc. Estos disparadores crean containing blocks que rompen sticky. */
/* Reset Divi: overflow/transform/etc en ancestros rompen position:sticky
   y el pin de GSAP. Solo neutralizamos en wrappers que contienen el módulo. */
.et_pb_module.stats_v2,
.et_pb_module.stats_v2 > .et_pb_module_inner,
.et_pb_column:has(.stats_v2_wrap),
.et_pb_row:has(.stats_v2_wrap),
.et_pb_section:has(.stats_v2_wrap),
.et_pb_section.section_has_divider:has(.stats_v2_wrap),
.et_pb_section.et_pb_top_divider:has(.stats_v2_wrap),
.et_pb_section.et_pb_bottom_divider:has(.stats_v2_wrap) {
  overflow: visible !important;
  contain: none !important;
  transform: none !important;
  filter: none !important;
  perspective: none !important;
  clip-path: none !important;
}

/* CRÍTICO para GSAP pin: cuando el módulo vive en una columna 1/2 de un row
   Divi flex, la columna NO se estira con el espacio que añade pinSpacing.
   Forzamos align-items:flex-start y altura auto en row+column para que el
   espacio inyectado por pinSpacing crezca la columna libremente. */
.et_pb_row:has(.stats_v2_wrap) {
  align-items: flex-start !important;
}
.et_pb_column:has(.stats_v2_wrap) {
  align-self: flex-start !important;
  height: auto !important;
}

/* Wrapper raíz ─────────────────────────────────────────────────────────── */
.stats_v2_wrap {
  --stack-top: 0px;
  --stack-gap: 16px;
  --stats-icon-size: 40px;
  --stats-icon-color: #BAA1FF;
  --stats-image-size: 30%;
  --stats-card-width: 400px;
  --stats-collapsed-width: 200px;
  --stats-card-min-height: 0px;
  --stats-card-padding: 32px;
  --stats-num-fs: 60px;
  --stats-num-text-fs: 34px;
  --stats-eyebrow-fs: 18px;
  --stats-desc-fs: 20px;
  position: relative;
  width: 100%;
}

.stats_v2_scroll_wrapper { position: relative; width: 100%; }

/* ── ITEM (base, común a ambos layouts) ─────────────────────────────────── */
.stats_v2_item {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(186, 161, 255, 0.18);
  background: linear-gradient(135deg, #2a1840 0%, #1A0F2E 100%);
  will-change: transform, height, width;
}

.stats_v2_item {
  min-height: var(--stats-card-min-height, 0px);
}

.stats_v2_item_inner {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: var(--stats-card-padding, 32px);
  height: 100%;
  box-sizing: border-box;
}

/* title-wrap = lo que queda visible cuando la card colapsa.
   Mantenemos icono + número en una fila para ahorrar altura. */
.stats_v2_title_wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}
.stats_v2_title_wrap .stats_v2_num { color: #fff; }

.stats_v2_icon_wrapper { display: inline-flex; align-items: center; justify-content: center; }
.stats_v2_icon_wrapper .et-pb-icon {
  font-family: 'ETmodules' !important;
  speak: none;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  font-size: var(--stats-icon-size, 40px);
  color: var(--stats-icon-color, #BAA1FF);
  display: inline-block;
}

.stats_v2_num {
  font-size: var(--stats-num-text-fs, 34px);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0;
}
.stats_v2_num--text {
  font-size: var(--stats-num-text-fs, 34px);
  letter-spacing: -0.025em;
}

.stats_v2_content_wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stats_v2_eyebrow {
  font-size: var(--stats-eyebrow-fs, 18px);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #BAA1FF;
}
.stats_v2_content { color: rgba(255,255,255,0.88); }
.stats_v2_content p {
  font-size: var(--stats-desc-fs, 20px);
  font-weight: 300;
  line-height: 1.5;
  margin: 0;
  color: inherit;
}

.stats_v2_image_wrapper {
  flex: 0 0 var(--stats-image-size, 30%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stats_v2_image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  object-fit: cover;
}

.stats_v2_button_wrapper { margin-top: 16px; }
.stats_v2_button {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(186, 161, 255, 0.18);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid rgba(186, 161, 255, 0.35);
  transition: background 0.2s ease, transform 0.2s ease;
}
.stats_v2_button:hover {
  background: rgba(186, 161, 255, 0.32);
  transform: translateY(-1px);
}

/* ── VARIANTES DE COLOR ─────────────────────────────────────────────────── */
.stats_v2_scroll_items .stats_v2_item.stats_v2_item--blue,
.stats_v2_item.stats_v2_item--blue {
  background:
    radial-gradient(ellipse at 100% 0%, rgba(71, 153, 212, 0.45) 0%, transparent 60%),
    linear-gradient(315deg, #251739 0%, #1e1330 100%);
}
.stats_v2_scroll_items .stats_v2_item.stats_v2_item--pink,
.stats_v2_item.stats_v2_item--pink {
  background:
    radial-gradient(ellipse at 100% 0%, rgba(255, 77, 128, 0.40) 0%, transparent 60%),
    linear-gradient(315deg, #2f1f48 0%, #261939 100%);
}
.stats_v2_scroll_items .stats_v2_item.stats_v2_item--lavender,
.stats_v2_item.stats_v2_item--lavender {
  background:
    radial-gradient(ellipse at 100% 0%, rgba(186, 161, 255, 0.40) 0%, transparent 60%),
    linear-gradient(135deg, #2a1840 0%, #1A0F2E 100%);
}
.stats_v2_scroll_items .stats_v2_item.stats_v2_item--amber,
.stats_v2_item.stats_v2_item--amber {
  background:
    radial-gradient(ellipse at 100% 0%, rgba(255, 159, 28, 0.40) 0%, transparent 60%),
    linear-gradient(135deg, #352450 0%, #2a1840 100%);
}
.stats_v2_scroll_items .stats_v2_item.stats_v2_item--green,
.stats_v2_item.stats_v2_item--green {
  background:
    radial-gradient(ellipse at 100% 0%, rgba(91, 191, 138, 0.55) 0%, transparent 60%),
    linear-gradient(135deg, #3a2658 0%, #2a1840 100%);
}

/* ── VERTICAL LAYOUT ────────────────────────────────────────────────────── */
.stats_v2_scroll_wrapper.layout-vertical { overflow: hidden; }
.stats_v2_scroll_wrapper.layout-vertical .stats_v2_scroll_items {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  /* position:sticky con top:0 como fallback. El offset --stack-top NO se
     aplica aquí porque empujaría las cards desde el render inicial. Lo
     aplica GSAP al inicializar el pin via `start: 'top Xpx'`. */
  position: sticky;
  top: 0;
}
.stats_v2_scroll_wrapper.layout-vertical .stats_v2_item {
  flex: none;
  margin-bottom: var(--stack-gap, 16px);
  transform: translateZ(0);
}
/* En vertical, el item_inner apila título + descripción + imagen + botón
   en columna (no en fila lado a lado). El title-wrap queda arriba para
   que sea lo único visible cuando la card colapsa por scroll. */
.stats_v2_scroll_wrapper.layout-vertical .stats_v2_item_inner {
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
}
.stats_v2_scroll_wrapper.layout-vertical .stats_v2_image_wrapper {
  flex: 0 0 auto;
  width: var(--stats-image-size, 100%);
  max-width: 100%;
}

/* ── ESTILO 2: COLAPSO A PEEK (efecto pila) ──────────────────────────────
   Mismo patrón que estilo 1: GSAP colapsa la altura de cada card. La
   diferencia: la altura colapsada = 14px (peekOffset) → solo se ve una
   "tira" del fondo de cada card formando una pila de colores visible.
   Box-shadow superior acentúa la separación entre cards de la pila. */
.stats_v2_scroll_wrapper.layout-vertical.style2 .stats_v2_item {
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.2);
}

/* ── HORIZONTAL LAYOUT ──────────────────────────────────────────────────── */
.stats_v2_scroll_wrapper.layout-horizontal {
  width: 100%;
  overflow: hidden;
  position: relative;
  position: sticky;
  top: var(--stack-top, 0px);
}
.stats_v2_scroll_wrapper.layout-horizontal .stats_v2_scroll_items {
  display: flex;
  position: relative;
  width: max-content;
  height: clamp(420px, 70vh, 640px);
}
.stats_v2_scroll_wrapper.layout-horizontal .stats_v2_item {
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  white-space: nowrap;
  margin-right: var(--stack-gap, 16px);
}
.stats_v2_scroll_wrapper.layout-horizontal .stats_v2_item_inner {
  width: var(--stats-card-width, 400px);
  min-width: var(--stats-collapsed-width, 200px);
  height: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  flex-direction: column;
}

/* ── MOBILE: desactivar el pin, items en flujo normal ───────────────────── */
@media (max-width: 980px) {
  /* Módulo y wrappers Divi al 100% en responsive (evita que la columna del
     row Divi limite el ancho del módulo). */
  .et_pb_module.stats_v2,
  .et_pb_module.stats_v2 > .et_pb_module_inner,
  .stats_v2_wrap {
    width: 100% !important;
    max-width: var(--stats-mobile-max-width, 100%) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .stats_v2_scroll_wrapper.layout-vertical,
  .stats_v2_scroll_wrapper.layout-horizontal {
    height: auto !important;
    overflow: visible;
    position: static;
    width: 100% !important;
  }
  .stats_v2_scroll_wrapper .stats_v2_scroll_items {
    position: static !important;
    width: 100% !important;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .stats_v2_item {
    height: auto !important;
    width: 100% !important;
    position: relative !important;
    margin-right: 0 !important;
  }
  .stats_v2_item_inner {
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .stats_v2_image_wrapper { flex: 0 0 100% !important; }
}
