/* ============================================================
   POST SLIDER - Dùng Shortcode [wt_post_slider]
   File: assets/css/post-slider.css
   ============================================================ */

.wt-post-slider {
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

.wt-post-slider__container {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  scroll-behavior: auto;         /* Không dùng smooth để tránh xung đột với Lenis */
  scroll-snap-type: x proximity; /* proximity: không ép snap, giúp vuốt ngang mượt hơn */
  touch-action: pan-x;           /* Báo trình duyệt đây là vùng cuộn ngang - loại bỏ delay 300ms */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Hide scrollbar Firefox */
  -ms-overflow-style: none; /* Hide scrollbar IE/Edge */
}

.wt-post-slider__container::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari */
}

/* ------ Pagination Dots ------ */
.wt-post-slider__dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.wt-post-slider__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #cbd5e1; /* Light grey */
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (hover: hover) {
  .wt-post-slider__dot:hover {
    background-color: #94a3b8;
  }
}

.wt-post-slider__dot.is-active {
  background-color: #1e293b; /* Dark grey/black, matching the image */
  transform: scale(1.2);
}

/* ------ Desktop (> 1024px) ------ */
@media (min-width: 1025px) {
  .wt-post-slider__card {
    flex: 0 0 calc((100% - 60px) / 4); /* Exactly 4 cards visible */
    scroll-snap-align: start;
  }
}

/* ------ Card Item UI ------ */
.wt-post-slider__card {
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  text-decoration: none;
  overflow: hidden;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
  height: 100%;
  box-sizing: border-box;
}

@media (hover: hover) {
  .wt-post-slider__card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  }
}

/* ------ Image Box ------ */
.wt-post-slider__image-box {
  width: 100%;
  aspect-ratio: 16/9;
  min-height: 190px;
  overflow: hidden;
  background-color: #f5f6fa;
  position: relative;
}

.wt-post-slider__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

@media (hover: hover) {
  .wt-post-slider__card:hover .wt-post-slider__image {
    transform: scale(1.05);
  }
}

.wt-post-slider__image-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e4e7ef 0%, #f5f6fa 100%);
}

/* ------ Content Area ------ */
.wt-post-slider__content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.wt-post-slider__title {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: #0b1a30; /* Màu xanh đen đậm */
  margin: 0;
  line-height: 1.4;

  /* Giới hạn tối đa 2 dòng bằng line-clamp */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;

  transition: color 0.2s ease;
}

@media (hover: hover) {
  .wt-post-slider__card:hover .wt-post-slider__title {
    color: var(--ast-global-color-0, #0056b3); /* Đổi màu khi hover card */
  }
}

/* ------ Responsive Mobile & Tablet (< 1024px) ------ */
@media (max-width: 1024px) {
  .wt-post-slider__container {
    overflow-x: auto;
    scroll-behavior: auto;
    scroll-snap-type: x proximity;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Ẩn scrollbar Firefox */
    -ms-overflow-style: none; /* Ẩn scrollbar IE/Edge */
  }

  .wt-post-slider__container::-webkit-scrollbar {
    display: none; /* Ẩn scrollbar Chrome/Safari */
  }

  .wt-post-slider__card {
    flex: 0 0 72%; /* Chiếm khoảng 70% - 75% chiều rộng màn hình */
    width: 72vw;
    scroll-snap-align: center;
    touch-action: pan-x;
  }
}

/* ------ Thiết kế riêng cho Tablet (768px - 1024px) ------ */
@media (min-width: 768px) and (max-width: 1024px) {
  .wt-post-slider__card {
    flex: 0 0 35%; /* Trên Tablet hiển thị được ~2.5 card */
    width: 35vw;
  }
}
