/* GRID PRINCIPAL: thumbs + imagen grande */
.trex-slider-lite {
  display: grid;
  grid-template-columns: 20% 79%;
  gap: 4px;
  position: relative;
}

/* COLUMNA DE MINIATURAS */
.tsl-thumbs {
  display: flex;
  flex-direction: column;
  gap: 4px; /* Debe coincidir con GAP del JS */
  overflow: auto;
  max-height: 100%;
}

.tsl-thumb {
  position: relative;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
}
.tsl-thumb img {
  display: block;
  width: 100%;
  /* height: var(--tsl-thumb-h, 90px); */
  height: auto;
  object-fit: cover;
}
.tsl-thumb.is-active {
  outline: 2px solid rgba(0, 0, 0, 0.35);
}
.tsl-thumb:focus-visible {
  outline: 2px solid #e11d48;
  outline-offset: 2px;
}

/* Overlay "View more" en la última miniatura visible */
.tsl-view-more-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* background: rgb(0 0 0 / 25%); */
    color: #fff;
    font-weight: 600;
    padding: 0.35rem 0.55rem;
    border-radius: 8px;
    pointer-events: auto;
    font-family: 'Inter';
    font-size: 16px;
    text-wrap: nowrap;
}

/* ZONA PRINCIPAL (IMAGEN GRANDE) */
.tsl-main-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tsl-main {
  position: relative;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 3 / 2;
}

.tsl-main-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transition: opacity 0.25s ease-in-out;
}

/* Fade al cambiar de imagen */
.tsl-main-img.is-fading {
  opacity: 0;
}

/* FLECHAS DEL SLIDER PRINCIPAL */
.tsl-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  z-index: 3;
  opacity: 0;               /* ocultas por defecto */
  pointer-events: none;     /* no clickeables mientras están ocultas */
  transition: opacity 0.2s ease-in-out;
}

.tsl-nav--prev {
  left: 8px;
}

.tsl-nav--next {
  right: 8px;
}

.trex-slider-lite:hover .tsl-nav {
  opacity: 1;
  pointer-events: auto;
}

/* LIGHTBOX: FONDO OSCURO + CONTENIDO BLANCO */
.tsl-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.tsl-lightbox[hidden] {
  display: none;
}

.tsl-lightbox-backdrop {
  position: absolute;
  inset: 0;
}

.tsl-lightbox-content {
    position: relative;
    background: #fff;
    color: #111;
    border-radius: 12px;
    max-width: 960px;
    width: 90%;
    max-height: 90vh;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter';
    overflow: hidden;
}

/* Botón cerrar del lightbox */
.tsl-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: #111;
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-size: 22px;
  line-height: 1;
  width: 36px;
  height: 36px;
  cursor: pointer;
  z-index: 1;
}

/* Lista de items del lightbox */
.tsl-lightbox-items {
  width: 100%;
}

/* Cada item del lightbox (slide) */
.tsl-lightbox-item {
  display: none;
  margin: 0;
  position: relative; /* necesario para el skeleton ::before */
}

.tsl-lightbox-item.is-active {
  display: block;
}

/* Imagen del lightbox: reservamos espacio con aspect-ratio */
.tsl-lightbox-item img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;      /* reserva altura aun antes de cargar */
  object-fit: contain;
  border-radius: 8px;
}

/* Skeleton loading: overlay animado mientras carga la imagen */
.tsl-lightbox-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, #f3f3f3 25%, #e5e5e5 37%, #f3f3f3 63%);
  background-size: 400% 100%;
  opacity: 0;
  pointer-events: none;
}

.tsl-lightbox-item.is-loading::before {
  opacity: 1;
  animation: tsl-skeleton 1.1s ease-in-out infinite;
}

@keyframes tsl-skeleton {
  0%   { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* Caption y número de imagen */
.tsl-lightbox-caption {
    font-size: 0.9rem;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.45);
    padding: 8px 16px;
}

.tsl-lightbox-counter {
  font-weight: 600;
}

.tsl-lightbox-alt {
  flex: 1;
  text-align: right;
}

/* Flechas dentro del lightbox */
.tsl-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  z-index: 1;
}

.tsl-lightbox-prev {
  left: 12px;
}

.tsl-lightbox-next {
  right: 12px;
}

.tsl-thumb:before {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.25) 100%);
}
.tsl-main-wrapper .tsl-main {
    position: relative;
}
.tsl-main-wrapper .tsl-main:before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    /* background: linear-gradient(180deg, rgba(0, 0, 0, 0.00) 30%, rgba(0, 0, 0, 0.40) 100%); */
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .trex-slider-lite {
    grid-template-columns: 100%;
    grid-template-rows: auto auto;
  }

  .tsl-thumbs {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .tsl-lightbox-content {
    padding: 16px 32px;
    max-width: 100%;
  }

  /* En móvil las flechas siempre visibles (no hay hover) */
  .tsl-nav {
    opacity: 1;
    pointer-events: auto;
  }
}
