/* Santiago Pardo - Carrusel de testimoniales (pagina de inicio).
   Un testimonio a la vez; el script elige uno al azar en cada visita.
   La seccion se edita en Elementor; este archivo solo da el comportamiento de carrusel.
   Ganchos: ID CSS "testimoniales" (seccion) y "sp-testimonios" (pista de tarjetas). */

/* Comparte fondo con la seccion anterior ("El despacho"): sin relleno superior para no duplicar el espacio */
#testimoniales { padding-block-start: 0; }
#testimoniales .sp-section-head { align-items: flex-end; }

/* Pista desplazable */
#sp-testimonios {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 1.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0;
  cursor: grab;
}
#sp-testimonios::-webkit-scrollbar { display: none; }
#sp-testimonios:focus-visible { outline: 2px solid var(--sp-color-focus); outline-offset: 4px; }
#sp-testimonios.is-dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; user-select: none; }

/* Tarjeta: una a la vez, ancho completo */
#sp-testimonios > .e-con {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1.75rem;
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1.5rem, 6vw, 5rem);
}
#sp-testimonios > .e-con::before {
  content: "\201C";
  display: block;
  position: static;
  inset: auto;
  width: auto;
  height: 1.75rem;
  opacity: 1;
  background: none;
  mix-blend-mode: normal;
  border-radius: 0;
  overflow: visible;
  font-family: var(--sp-font-display), serif;
  font-weight: 300;
  font-size: 4.5rem;
  line-height: 0.75;
  color: var(--sp-color-accent);
}
#sp-testimonios > .e-con > p {
  max-width: 52rem;
  font-family: var(--sp-font-display), sans-serif;
  font-weight: 300;
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  line-height: 1.55;
  color: var(--sp-color-ink);
}

/* Autor: solo el nombre */
#sp-testimonios > .e-con > .e-con {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 0;
  border: 0;
}
#sp-testimonios > .e-con > .e-con::before {
  content: "";
  display: block;
  position: static;
  width: 2rem;
  height: 1px;
  flex: 0 0 2rem;
  opacity: 1;
  background: var(--sp-color-accent);
}
#sp-testimonios > .e-con > .e-con h3 {
  font-family: var(--sp-font-body), sans-serif;
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--sp-color-ink-muted);
}

/* Controles (los agrega el script) */
.sp-tst-nav { display: flex; gap: 0.75rem; flex: 0 0 auto; }
.sp-tst-btn {
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid var(--sp-color-line);
  border-radius: 2px;
  background: transparent;
  color: var(--sp-color-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.sp-tst-btn svg { width: 1.125rem; height: 1.125rem; }
.sp-tst-btn:hover:not(:disabled) { border-color: var(--sp-color-accent); color: var(--sp-color-accent); }
.sp-tst-btn:focus-visible { outline: 2px solid var(--sp-color-focus); outline-offset: 2px; }
.sp-tst-btn:disabled { opacity: 0.35; cursor: default; }

.sp-tst-dots { display: flex; justify-content: center; gap: 0.5rem; margin-top: -1.5rem; }
.sp-tst-dot {
  width: 1.75rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.sp-tst-dot::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  margin-top: -1px;
  background: var(--sp-color-line);
  transition: background-color 0.2s ease;
}
.sp-tst-dot[aria-current="true"]::after { background: var(--sp-color-accent); }
.sp-tst-dot:focus-visible { outline: 2px solid var(--sp-color-focus); outline-offset: 2px; }

@media (max-width: 767px) {
  #testimoniales .sp-section-head { align-items: flex-start; }
  #sp-testimonios > .e-con { gap: 1.25rem; }
  .sp-tst-dots { margin-top: -2rem; }
}
@media (prefers-reduced-motion: reduce) {
  #sp-testimonios { scroll-behavior: auto; }
}
