/* =====================================================================
   Carrusel Tendal Hosting · Swiper 11 sobre contenedores de Elementor
   Clases (Avanzado > Clases CSS):  th-slider > th-slide > th-caja
   Secciones: Sección th-slider > Columna > Sección interior th-slide > Columna th-caja
   El diseño de cada diapositiva (fondo, caja, textos, botón) se hace en
   Elementor. Aquí solo: mecánica del slider, zoom, animación y controles.
   ===================================================================== */

.th-slider {
  /* Colores de los controles */
  --th-topo: #5E503F;
  --th-topo-suave: rgba(94, 80, 63, .7);
  --th-pista: rgba(94, 80, 63, .28);
  --th-crema: #EAE0D5;
  --th-pizarra: #22333B;
  --th-f-display: "Montserrat", "Helvetica Neue", Arial, sans-serif;

  /* Posición de los controles (ajustar si cambias el ancho de la caja) */
  --th-wrap: 1140px;                                 /* = ancho "encajado" de Elementor */
  --th-gutter: max(16px, env(safe-area-inset-left, 0px));
  --th-pest-izq: 44px;                               /* margen izq. de las pestañas dentro de la caja */
  --th-pest-ancho: calc(min(50%, 570px) - 88px);     /* ancho caja - padding */
  --th-pest-abajo: 34px;
  --th-mandos-abajo: 26px;

  --th-ease: cubic-bezier(.22, .7, .2, 1);
  --th-dur: 7000ms; /* lo pone el JS */
}

/* ---------- Antes de iniciar (y sin JS): solo la primera ---------- */
body:not(.elementor-editor-active) .th-slider:not(.th-listo) .th-slide ~ .th-slide { display: none; }

/* ---------- Mecánica ---------- */
.th-slider.swiper {
  display: block;
  padding: 0 !important;
  overflow: hidden;
  isolation: isolate;
}
.th-slider > .swiper-wrapper {
  min-height: inherit;     /* hereda la altura mínima puesta en el contenedor th-slider */
  align-items: stretch;
}
.th-slider .th-slide.swiper-slide {
  position: relative;
  flex-shrink: 0;
  height: auto;            /* todas igual de altas que la más alta */
  margin: 0 !important;
  overflow: hidden;
  isolation: isolate;
}

/* Copia del fondo del contenedor, con zoom lento */
.th-slider .th-fondo {
  position: absolute; inset: 0; z-index: -1;
  background: inherit;
  transform: scale(1.08);
  pointer-events: none;
}
.th-slider .swiper-slide-active .th-fondo {
  transform: scale(1);
  transition: transform calc(var(--th-dur) + 1.2s) linear;
}

/* ---------- Entrada escalonada del contenido de .th-caja ----------
   Widgets dentro de: columna (.elementor-widget-wrap), contenedor, o contenedor encajado */
.th-slider .th-caja > .elementor-element,
.th-slider .th-caja > .e-con-inner > .elementor-element,
.th-slider .th-caja > .elementor-widget-wrap > .elementor-element {
  transition: opacity .6s var(--th-ease), transform .8s var(--th-ease);
}
.th-slider .swiper-slide:not(.swiper-slide-active) .th-caja > .elementor-element,
.th-slider .swiper-slide:not(.swiper-slide-active) .th-caja > .e-con-inner > .elementor-element,
.th-slider .swiper-slide:not(.swiper-slide-active) .th-caja > .elementor-widget-wrap > .elementor-element {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .4s var(--th-ease), transform 0s .4s;
}
.th-slider .swiper-slide-active .th-caja > :nth-child(1),
.th-slider .swiper-slide-active .th-caja > * > .elementor-element:nth-child(1) { transition-delay: .25s; }
.th-slider .swiper-slide-active .th-caja > :nth-child(2),
.th-slider .swiper-slide-active .th-caja > * > .elementor-element:nth-child(2) { transition-delay: .33s; }
.th-slider .swiper-slide-active .th-caja > :nth-child(3),
.th-slider .swiper-slide-active .th-caja > * > .elementor-element:nth-child(3) { transition-delay: .41s; }
.th-slider .swiper-slide-active .th-caja > :nth-child(4),
.th-slider .swiper-slide-active .th-caja > * > .elementor-element:nth-child(4) { transition-delay: .49s; }
.th-slider .swiper-slide-active .th-caja > :nth-child(5),
.th-slider .swiper-slide-active .th-caja > * > .elementor-element:nth-child(5) { transition-delay: .57s; }
.th-slider .swiper-slide-active .th-caja > :nth-child(n+6),
.th-slider .swiper-slide-active .th-caja > * > .elementor-element:nth-child(n+6) { transition-delay: .65s; }

/* ---------- Antetítulo con rayitas (widget Titular con clase th-eyebrow) ---------- */
.th-eyebrow .elementor-heading-title {
  display: inline-flex; align-items: center; gap: 12px;
}
.th-eyebrow .elementor-heading-title::before,
.th-eyebrow .elementor-heading-title::after {
  content: ""; width: 22px; height: 1px; background: currentColor; opacity: .6;
}

/* ---------- Controles (los crea el JS) ---------- */
.th-slider .th-controles {
  position: absolute; left: 0; right: 0; bottom: 0; top: 0; z-index: 3;
  pointer-events: none;
}
.th-slider .th-controles-wrap {
  position: relative; height: 100%;
  max-width: var(--th-wrap); margin: 0 auto;
  padding-inline: var(--th-gutter);
}
.th-slider .th-pestanas,
.th-slider .th-der { pointer-events: auto; }

/* Pestañas con barra de progreso */
.th-slider .th-pestanas {
  position: absolute;
  left: calc(var(--th-gutter) + var(--th-pest-izq));
  bottom: var(--th-pest-abajo);
  width: var(--th-pest-ancho);
  display: grid; grid-template-columns: repeat(var(--th-n, 4), minmax(0, 1fr)); gap: 10px;
}
.th-slider button.th-pest {
  position: relative; margin: 0; padding: 12px 0 0; min-height: 0;
  border: 0; border-radius: 0; background: none; box-shadow: none;
  cursor: pointer; text-align: left; white-space: normal;
  font: 500 10.5px/1.3 var(--th-f-display); letter-spacing: .12em; text-transform: uppercase;
  color: var(--th-topo-suave);
  transition: color .25s;
}
.th-slider button.th-pest:hover,
.th-slider button.th-pest:focus,
.th-slider button.th-pest.is-on { background: none; color: var(--th-topo); }
.th-slider .th-pest::before,
.th-slider .th-pest i { content: ""; position: absolute; left: 0; top: 0; height: 2px; }
.th-slider .th-pest::before { right: 0; background: var(--th-pista); }
.th-slider .th-pest i { width: 0; background: var(--th-topo); }
.th-slider .th-pest.is-hecho i { width: 100%; }
.th-slider .th-pest.is-on i { animation: th-llenar var(--th-dur) linear forwards; }
.th-slider.is-pausa .th-pest.is-on i { animation-play-state: paused; }
@keyframes th-llenar { from { width: 0; } to { width: 100%; } }

/* Pausa / anterior / siguiente */
.th-slider .th-der {
  position: absolute; right: var(--th-gutter); bottom: var(--th-mandos-abajo);
  display: flex; align-items: center; gap: 10px;
}
.th-slider button.th-mando {
  width: 46px; height: 46px; min-height: 0; margin: 0; padding: 0;
  display: grid; place-items: center;
  border: 1px solid rgba(234, 224, 213, .7); border-radius: 0;
  background: rgba(34, 51, 59, .3); color: var(--th-crema); box-shadow: none;
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transition: background .2s, color .2s, border-color .2s;
}
.th-slider button.th-mando:hover { background: var(--th-crema); color: var(--th-pizarra); border-color: var(--th-crema); }
.th-slider button.th-mando:focus:not(:hover) { background: rgba(34, 51, 59, .3); color: var(--th-crema); }
.th-slider .th-mando svg { width: 18px; height: 12px; }
.th-slider .th-mando .th-i-play { display: none; }
.th-slider.is-pausa .th-mando .th-i-pausa { display: none; }
.th-slider.is-pausa .th-mando .th-i-play { display: block; }
.th-slider :focus-visible { outline: 2px solid var(--th-pizarra); outline-offset: 3px; }

/* ---------- Tablet (≤1024 px, breakpoint de Elementor) ---------- */
@media (max-width: 1024px) {
  .th-slider {
    --th-pest-izq: 30px;
    --th-pest-ancho: calc(min(64%, 520px) - 60px);
  }
}

/* ---------- Móvil (≤767 px, breakpoint de Elementor) ---------- */
@media (max-width: 767px) {
  .th-slider {
    --th-pest-izq: 6px;
    --th-pest-ancho: calc(100% - 2 * var(--th-gutter) - 12px);
    --th-pest-abajo: 26px;
  }
  .th-slider .th-der { top: 16px; bottom: auto; }
  .th-slider button.th-mando { width: 42px; height: 42px; }
  .th-slider button.th-pest { font-size: 9.5px; letter-spacing: .06em; }
}

@media (prefers-reduced-motion: reduce) {
  .th-slider .th-fondo,
  .th-slider .swiper-slide-active .th-fondo { transform: none; transition: none; }
  .th-slider .th-caja > .elementor-element,
  .th-slider .th-caja > .e-con-inner > .elementor-element,
  .th-slider .th-caja > .elementor-widget-wrap > .elementor-element { transform: none !important; }
  .th-slider .th-pest.is-on i { animation: none; width: 100%; }
}
