
.tlcps {
  position: relative;
  border-radius: 18px;
  padding: 18px 16px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.03), rgba(0,0,0,0.00));
}

.tlcps-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom: 12px;
}

.tlcps-title{
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.25;
}

.tlcps-controls{
  display:flex;
  gap: 8px;
}

.tlcps-btn{
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(6px);
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.tlcps-btn:disabled{
  opacity: .45;
  cursor: default;
  box-shadow: none;
}
.tlcps-btn:focus{
  outline: 2px solid rgba(0,0,0,0.25);
  outline-offset: 2px;
}

.tlcps-track{
  position: relative;
  display:flex;
  gap: 16px;
  overflow-x:auto;
  padding: 4px 2px 6px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  min-height: 210px;
}
.tlcps-track::-webkit-scrollbar{ display:none; }

.tlcps-cards{
  display:flex;
  gap:16px;
  width: max-content;
}

.tlcps-card{
  flex: 0 0 auto;
  width: min(320px, 82vw);
  scroll-snap-align: start;
}

@media (min-width: 720px){
  .tlcps-card{ width: 320px; }
}

.tlcps-link{
  display:block;
  text-decoration:none;
  color: inherit;
  border-radius: 16px;
  overflow:hidden;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 10px 28px rgba(0,0,0,0.10);
  transition: transform .15s ease, box-shadow .15s ease;
}
.tlcps-link:hover{
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0,0,0,0.12);
}
.tlcps-link:focus{
  outline: 2px solid rgba(0,0,0,0.28);
  outline-offset: 3px;
}

.tlcps-media{
  position:relative;
  aspect-ratio: 16 / 9;
  overflow:hidden;
  background: rgba(0,0,0,0.06);
}
.tlcps-img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}
.tlcps-img--placeholder{
  background: radial-gradient(circle at 30% 30%, rgba(0,0,0,0.08), rgba(0,0,0,0.02) 55%, rgba(0,0,0,0.06));
}

.tlcps-card-title{
  margin: 0;
  padding: 12px 12px 14px;
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 700;
}

.tlcps--no-controls .tlcps-controls{ display:none; }

/* Skeleton overlay */
.tlcps-skeleton{
  position: absolute;
  inset: 0;
  display:flex;
  gap:16px;
  padding: 0; /* track already padded */
  pointer-events: none;
}
.tlcps-skel-card{
  flex: 0 0 auto;
  width: min(320px, 82vw);
  height: 210px;
  border-radius: 16px;
  background: linear-gradient(90deg, rgba(0,0,0,0.06), rgba(0,0,0,0.02), rgba(0,0,0,0.06));
  background-size: 240% 100%;
  animation: tlcpsShimmer 1.2s ease-in-out infinite;
}
@media (min-width: 720px){
  .tlcps-skel-card{ width: 320px; }
}
@keyframes tlcpsShimmer{
  0%{ background-position: 0% 0%; }
  100%{ background-position: 100% 0%; }
}

/* IMPORTANT: Prevent visible swap.
   While loading, we show skeleton and hide preloaded cards.
*/
.tlcps--loading .tlcps-preload{
  opacity: 0;
  pointer-events: none;
}
.tlcps--loading .tlcps-skeleton{
  opacity: 1;
}

/* When ready, hide skeleton and fade in content */
.tlcps--ready .tlcps-skeleton{
  opacity: 0;
  transition: opacity .18s ease;
}
.tlcps--ready .tlcps-random{
  opacity: 1;
  transition: opacity .18s ease;
}
.tlcps-random{
  opacity: 0;
}

/* If fallback is shown (loading class removed without random), skeleton disappears automatically (no class), and preload becomes visible */
.tlcps:not(.tlcps--loading) .tlcps-skeleton{
  display:none;
}

.tlcps-empty{
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0,0,0,0.04);
  font-size: 0.95rem;
}


/* Prevent whole-page horizontal scroll on touch devices (overlay/cards must not overflow viewport) */
/*
  NOTE: We DO NOT set `overflow: hidden` on the track.
  That breaks touch/drag scrolling on mobile.
  Keep the outer wrapper clipped, but keep the track horizontally scrollable.
*/
.tlcps{
  max-width:100%;
  overflow:hidden; /* prevents the component from causing page-level horizontal scroll */
  box-sizing:border-box;
}

.tlcps-track{
  max-width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y; /* defensive: site themes sometimes override touch-action */
}
