.tst-modal, .tst-overlay, .tst-dialog { box-sizing: border-box; }

/* Contenedor del modal (oculto por defecto) */
.tst-modal[aria-hidden="true"] { display: none; }
.tst-modal[aria-hidden="false"] { display: block; }

/* Capa de fondo tipo lightbox */
.tst-overlay {
  position: fixed; 
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  z-index: 99;
}

/* Caja del diálogo centrada */
.tst-dialog {
  position: fixed; 
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(1200px, 92vw);
  max-height: 85vh;
  background: #111; 
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  outline: none;
  z-index: 999;
}

/* Grid 2 columnas, responsive */
.tst-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  min-height: min(70vh, 720px);
  /* clave para que los hijos puedan reducirse y scrollear */
  min-height: 0; 
}

@media (max-width: 768px) {
  .tst-grid { 
    grid-template-columns: 1fr; 
    min-height: auto; }
}

/* Columna izquierda (foto) */
.tst-col-left {
  background: var(--c-primario);
  display: grid;
  place-items: center;
}
.tst-avatar {
  width: 100%; 
  height: 100%;
  object-fit: cover; 
  display: block;
}

/* Columna derecha (negro + imagen de fondo cover) */
.tst-col-right {
  position: relative;
  background: var(--c-primario);
  isolation: isolate;


  max-height: 85vh;      
  overflow-y: auto;

  min-height: 0; 
  -webkit-overflow-scrolling: touch;  /* suaviza en iOS */
  overscroll-behavior: contain;       /* evita arrastre del body */
}
.tst-col-right::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url('/wp-content/uploads/2025/09/clinica-schiavone-patron-schiavone.png');
  background-size: cover;
  background-position: center;
  opacity: 0.8;           
  z-index: -1;
}
.tst-right-inner {
  padding: clamp(20px, 3vw, 36px);
  color: #fff;

  overflow: visible;   /* quita el scroll aquí */
  max-height: none;    /* y cualquier tope */
}
.tst-title {
  margin: 70px 0 8px; 
  
  
}
.tst-text {
  margin-top: 30px;
}

.tst-text p {
  line-height: 1.6; 
  font-size: clamp(15px, 2vw, 18px); 
  margin: 0 0 16px;
}
.tst-author {
  margin: 8px 0 0; 
  font-size: clamp(15px, 2vw, 18px);

}

/* Botón cerrar (cruz amarilla arriba izquierda) */
.tst-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    color: var(--c-tonico);
    border: none;
    width: 59px;
    height: 51px;
    font-size: 30px;
    line-height: 35px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    z-index: 2;
    transition: all 0.3s ease;
}
.tst-close:hover {
  opacity: 0.7;       /* tono más claro al pasar el ratón (opcional) */
}

button:hover {
    color: inherit !important;
    background-color: transparent !important;
}

/* Evitar scroll del body cuando el modal está abierto */
body.tst-lock { overflow: hidden; }

/* Transiciones suaves (opcional) */
.tst-dialog { 
  animation: tst-pop 180ms ease-out; 
  max-height: 85vh;
  display: block;      /* o flex con columna si quieres header/footer fijos */
  overflow: hidden;
}
@keyframes tst-pop {
  from { transform: translate(-50%, -48%) scale(0.98); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.tst-title {
  margin: 70px 0 8px; 
  
  
}


@media (max-width: 768px) {
  .tst-title {
  margin: 40px 0 8px;
  
}

.tst-close {

    top: 5px;
    right: 5px;
    

}
}

/* FACILITACIONES */

.tit-test {
  font-family: var(--font-main), sans-serif;
  text-transform: uppercase;
  font-size: clamp(20px, 3vw, 28px);
  text-align: center;
}

.testimonio-corto {
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 4;      /* número de líneas */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 40px;
}

.bloque-testimonio .vce-single-image-container:first-of-type .vce-single-image-inner, .bloque-testimonio .vce-single-image-container:first-of-type .vce-single-image-wrapper{
  height: 680px;
  width: 100%;
}

.bloque-testimonio
  .vce-single-image-container:first-of-type
  .vce-single-image-wrapper
  img.vce-single-image {
    height: 100%;
    width: 100%;
    object-fit: cover;
    /* horizontal: 50%  |  vertical: calc(50% - 40px)  */
    
    display: block;
}

@media (max-width: 1400px) {
  .bloque-testimonio .vce-single-image-container:first-of-type .vce-single-image-inner, .bloque-testimonio .vce-single-image-container:first-of-type .vce-single-image-wrapper{
    height: 580px !important;

}

}

@media (max-width: 1024px) {
  .bloque-testimonio .vce-single-image-container:first-of-type .vce-single-image-inner, .bloque-testimonio .vce-single-image-container:first-of-type .vce-single-image-wrapper{
    height: 380px !important;
  }
}

@media (max-width: 768px) {
  .bloque-testimonio .vce-single-image-container:first-of-type .vce-single-image-inner, .bloque-testimonio .vce-single-image-container:first-of-type .vce-single-image-wrapper{
    height: 880px !important;
  }

  .tst-avatar {
    width: 50%;
   
}

 .tst-dialog {
    position: fixed;
    inset: 0;                 /* ocupa todo */
    transform: none;          /* quita el translate */
    width: 100vw;
    height: 100dvh;           /* viewport real en móviles */
    max-height: none;
    border-radius: 0;         /* opcional */
  }

  .tst-grid {
    grid-template-columns: 1fr;
    min-height: 0;            /* IMPORTANTÍSIMO */
    height: 100%;             /* que el grid llene el modal */
  }

  .tst-col-left,
  .tst-col-right {
    min-height: 0;            /* permite que la derecha scrollee */
  }

  .tst-col-right {
    max-height: none;         /* deja que el alto lo marque el modal */
    height: 100%;             /* y que pueda scrollear dentro */
  }

  /* opcional: evita que la X tape texto por el safe area */
  .tst-right-inner {
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 600px) {
  .bloque-testimonio .vce-single-image-container:first-of-type .vce-single-image-inner, .bloque-testimonio .vce-single-image-container:first-of-type .vce-single-image-wrapper{
    height: 680px !important;
  }
}

@media (max-width: 440px) {
  .bloque-testimonio .vce-single-image-container:first-of-type .vce-single-image-inner, .bloque-testimonio .vce-single-image-container:first-of-type .vce-single-image-wrapper{
    height: 480px !important;
  }
}

/* --- FIX 1: evitar salto de animación y suavizar overlay --- */
.tst-overlay {
  animation: tst-fade-in 160ms ease-out;
}
@keyframes tst-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* animación de escritorio: ok con translate */
.tst-dialog {
  will-change: transform, opacity;
  animation: tst-pop 180ms ease-out;
}

/* soporte accesibilidad */
@media (prefers-reduced-motion: reduce) {
  .tst-overlay, .tst-dialog { animation: none !important; }
}

/* --- FIX 2: min-height del grid (el segundo min-height:0 anulaba el primero) --- */
.tst-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  /* mantiene alto mínimo para que no “encoja” */
  min-height: min(70vh, 720px);
}

/* --- MÓVIL: fullscreen, sin foto y con scroll SOLO en la columna de texto --- */
@media (max-width: 768px) {
  /* El modal ocupa la pantalla completa y sin translate -> sin salto */
  .tst-dialog {
    position: fixed;
    inset: 0;
    transform: none !important;         /* clave para evitar conflicto con @keyframes de escritorio */
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    /* animación específica para móvil (sin translate) */
    animation: tst-fade-scale 160ms ease-out;
  }
  @keyframes tst-fade-scale {
    from { opacity: 0; transform: none; }
    to   { opacity: 1;  transform: none; }
  }

  /* 1 columna */
  .tst-grid {
    grid-template-columns: 1fr;
    min-height: 0;
    height: 100%;
  }

  /* oculta columna izquierda (foto) por completo */
  .tst-col-left { 
    display: none !important; 
  }

  /* solo texto: desactiva imagen/patrón de fondo en la derecha */
  .tst-col-right::before { 
    content: none !important; 
  }

  /* la derecha ocupa y scrollea todo el alto */
  .tst-col-right {
    height: 100%;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* margen/padding seguros y X ajustada */
  .tst-right-inner { 
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
  .tst-title { margin: 40px 0 8px; }
  .tst-close { top: 5px; right: 5px; }
}

/* --- (opcional) transición suave al cerrar/abrir si cambias aria-hidden --- */
.tst-modal[aria-hidden="false"] .tst-dialog { pointer-events: auto; }
.tst-modal[aria-hidden="true"]  .tst-dialog { pointer-events: none; }

.tst-overlay { z-index: 10000000; }
.tst-dialog { z-index: 10000001; }



/* ====== VIDEO + TEXTO (RESPONSIVE) ====== */
.tst-video-wrapper{
  display: grid;
  gap: clamp(16px, 2.5vw, 24px);
  /* centra el bloque en layouts anchos */
  max-width: min(980px, 94vw);
  margin: 0 80px;
  padding-top: 80px;
  padding-bottom: 50px;
  position: relative;
  z-index: 0; 
}

.tst-video{
  width: 100%;
  aspect-ratio: 16 / 9;         /* mantiene 16:9 */
  background: #000;             /* evita destello blanco al cargar */
  border-radius: 0px;
  overflow: hidden;
  
}



.tst-dialog::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('/wp-content/uploads/2025/09/clinica-schiavone-patron-schiavone.png');
  background-size: cover;
  background-position: center;
  opacity: 0.6;
  z-index: -1;
  border-radius: 12px; /* opcional, para que coincida con el vídeo */
}

.tst-video,
.tst-video-text {
  position: relative;
  z-index: 1;
}

/* Fallback si un navegador no soporta aspect-ratio */
@supports not (aspect-ratio: 16/9){
  .tst-video{ position: relative; height: 0; padding-bottom: 56.25%; }
  .tst-video > iframe,
  .tst-video > video{ position: absolute; inset: 0; width: 100%; height: 100%; }
}

/* El media (iframe o video) ocupa todo el contenedor */
.tst-video > iframe,
.tst-video > video{
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;            /* en <video> ayuda con letterboxing */
}

/* Texto bajo el vídeo: legible en desktop */
.tst-video-text{
  max-width: 70ch;
  color: #fff;
}
.tst-video-text .tst-title{ margin: 0; }
.tst-video-text .tst-description{
  margin-top: 10px;
  line-height: 1.6;
  font-size: clamp(15px, 2vw, 18px);
}

/* ====== MÓVIL (<=768px) ====== */
@media (max-width: 768px){
  /* Tu modal ya es fullscreen en móvil; afinamos solo el bloque de video */
  .tst-video{ border-radius: 0px; }

  /* El texto ocupa todo el ancho; tamaños un pelín más compactos */
  .tst-video-text{ max-width: none; }
  .tst-video-text .tst-title{
    font-size: clamp(18px, 5vw, 24px);
    line-height: 1.2;
    margin-top: 4px;
  }
  .tst-video-text .tst-description{
    font-size: clamp(14px, 4vw, 16px);
    line-height: 1.6;
  }

  /* Evita que el contenido quede bajo la X o notch */
  .tst-right-inner{
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}

/* ====== VARIANTES ÚTILES (opcionales) ====== */
/* Si algún testimonio es vertical, añade .is-vertical al contenedor .tst-video */
.tst-video.is-vertical{ aspect-ratio: 9 / 16; }
@supports not (aspect-ratio: 9/16){
  .tst-video.is-vertical{ padding-bottom: 177.78%; } /* 9:16 */
}

/* Si quieres que el vídeo nunca crezca más que el modal en altura en horizontal muy pequeña */
@media (max-height: 520px){
  .tst-video{ aspect-ratio: auto; height: 56vh; }
  @supports not (aspect-ratio: auto){
    .tst-video{ height: 56vh; padding-bottom: 0; }
  }
}
