/* ============================================================
   QUY TRÌNH LÀM VIỆC – WORK PROCESS TIMELINE
   File: assets/css/section-process.css
   ============================================================ */

/* ------ Wrapper ngoài cùng ------ */
.wp-process-timeline {
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1024px) {
  .wp-process-timeline {
    margin-top: -20px;
    margin-bottom: -20px;
  }
}

/* ------ Container – Desktop: Flexbox hàng ngang ------ */
/*
   position: relative để neo pseudo-element ::before (đường kẻ ngang).
*/
.wp-process-timeline__container {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  width: 100%;
  position: relative; /* neo điểm cho ::before */
}

/* ------ Đường kẻ ngang nối liền icon đầu đến icon cuối (Desktop) ------ */
/*
   Dùng ::before trên container thay vì ::after trên từng icon-box.
   Lý do: với 6 item flex:1, tâm của item đầu = 100%/12,
   tâm của item cuối = 100% - 100%/12.
   => left: calc(100% / 12), right: calc(100% / 12).
   top: 36px = 72px (icon height) / 2.
   z-index: 0 nằm chìm dưới icon-box (z-index: 1).
   KHÔNG cần :last-child vì đường kẻ chỉ vẽ 1 lần, chính xác.
*/
.wp-process-timeline__container::before {
  content: "";
  position: absolute;
  top: 36px; /* = icon-height / 2 = 72px / 2 */
  left: calc(100% / 12); /* tâm của item đầu tiên (1/6 / 2) */
  right: calc(100% / 12); /* tâm của item cuối cùng */
  height: 1.5px;
  background: linear-gradient(90deg, #d0d5e3 0%, #b8bfd4 100%);
  z-index: 0;
  pointer-events: none;
}

/* ------ Item từng bước – Desktop ------ */
.wp-process-timeline__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  min-width: 0; /* ngăn tràn nội dung */
}

/* ------ Wrapper nội dung bên trong hỗ trợ hoạt ảnh ------ */
.wp-process-timeline__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* ------ Wrapper icon ------ */
.wp-process-timeline__icon-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  z-index: 1; /* nằm trên đường kẻ ::before của container */
  flex-shrink: 0;
  transition:
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}

@media (hover: hover) {
  .wp-process-timeline__icon-box:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    border-color: #c8cfe0;
  }
}

/* ------ Icon image ------ */
.wp-process-timeline__icon {
  width: 100%;
  height: auto;
  display: block;
}

/* ------ Vùng meta (số, tiêu đề, mô tả) ------ */
.wp-process-timeline__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 25px;
}

/* ------ Số thứ tự ------ */
.wp-process-timeline__number {
  font-family: inherit;
  font-size: 24px;
  font-weight: 300;
  letter-spacing: 0.04em;
  line-height: 1;
  margin-bottom: 6px;
  display: block;
}

/* ------ Tiêu đề bước ------ */
.wp-process-timeline__title {
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  color: var(--ast-global-color-0);
  margin: 0 0 6px 0;
  padding: 0;
  line-height: 1.3;
}

/* ------ Mô tả ngắn ------ */
.wp-process-timeline__desc {
  font-family: inherit;
  font-weight: 400;
}

/* ============================================================
   RESPONSIVE – TABLET (768px - 1024px)
   Hiển thị 3 bước cùng lúc + 1 phần bước tiếp theo (Peeking)
   ============================================================ */
@media (min-width: 768px) and (max-width: 1024px) {
  /* ------ Ẩn đường kẻ của container (dành cho Desktop) ------ */
  .wp-process-timeline__container::before,
  .wp-process-timeline__item::before,
  .wp-process-timeline__item::after {
    display: none;
  }

  /* ------ Vẽ đường kẻ nối ngang giữa các icon-box trên Tablet ------ */
  .wp-process-timeline__icon-box::after {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 100%;
    width: calc(
      30vw + 20px - 72px
    ); /* 30vw width + 20px gap - 72px icon width */
    height: 1.5px;
    background: linear-gradient(90deg, #d0d5e3 0%, #b8bfd4 100%);
    pointer-events: none;
    z-index: 0;
  }

  /* Ẩn đường kẻ ở item cuối cùng */
  .wp-process-timeline__item:last-child .wp-process-timeline__icon-box::after {
    display: none;
  }

  /* ------ Container (Track) cuộn ngang cho Tablet ------ */
  .wp-process-timeline__container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-behavior: auto;         /* Không dùng smooth để tránh xung đột với Lenis */
    scroll-snap-type: x proximity; /* proximity thay vì mandatory: không ép snap, tránh đơ */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    touch-action: pan-x;           /* Báo trình duyệt đây là vùng cuộn ngang - loại bỏ delay 300ms */

    padding-left: 5vw;
    padding-right: 5vw;
    padding-top: 20px; /* Tránh bị cắt icon khi chạy reveal animation hoặc hover */
    padding-bottom: 20px;
    box-sizing: border-box;
    gap: 20px;
    justify-content: flex-start;
    align-items: flex-start;
  }

  /* Ẩn thanh cuộn trên WebKit (Chrome, Safari) */
  .wp-process-timeline__container::-webkit-scrollbar {
    display: none;
  }

  /* ------ Item bước quy trình trên Tablet (rộng 30vw) ------ */
  .wp-process-timeline__item {
    flex: 0 0 30%;
    width: 30vw;
    scroll-snap-align: center;
    padding: 0 8px;
    box-sizing: border-box;
    touch-action: pan-x; /* Đảm bảo vuốt ngang mượt trên từng item */

    /* Reset Card Style - Giữ !important phòng trường hợp bị ghi đè từ css toàn cục */
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
  }

  /* ------ Tiêu đề và Mô tả bước trên Tablet ------ */
  .wp-process-timeline__title {
    font-size: 14.5px;
  }

  .wp-process-timeline__desc {
    max-width: 100%;
  }
}

/* ============================================================
   RESPONSIVE – MOBILE (max-width: 767px)
   Hiển thị 2 bước cùng lúc (rộng 50vw) + Peeking gợi ý cuộn
   ============================================================ */
@media (max-width: 767px) {
  /* ------ Ẩn đường kẻ của container (dành cho Desktop) ------ */
  .wp-process-timeline__container::before,
  .wp-process-timeline__item::before,
  .wp-process-timeline__item::after {
    display: none;
  }

  /* ------ Container (Track) cuộn ngang cho Mobile ------ */
  .wp-process-timeline__container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-behavior: auto;         /* Không dùng smooth để tránh xung đột với Lenis */
    scroll-snap-type: x proximity; /* proximity thay vì mandatory: không ép snap, tránh đơ */
    scrollbar-width: none;
    -ms-overflow-style: none;
    touch-action: pan-x;           /* Báo trình duyệt đây là vùng cuộn ngang - loại bỏ delay 300ms */

    padding-left: 8.75vw;
    padding-right: 8.75vw;
    padding-top: 20px; /* Tránh bị cắt icon khi chạy reveal animation hoặc hover */
    padding-bottom: 20px;
    box-sizing: border-box;
    gap: 16px;
    justify-content: flex-start;
    align-items: flex-start;
  }

  .wp-process-timeline__container::-webkit-scrollbar {
    display: none;
  }

  /* ------ Item bước quy trình trên Mobile (rộng 50vw) ------ */
  .wp-process-timeline__item {
    flex: 0 0 50%;
    width: 50vw;
    scroll-snap-align: center;
    padding: 0 6px;
    box-sizing: border-box;
    touch-action: pan-x; /* Đảm bảo vuốt ngang mượt trên từng item */

    /* Reset Card Style - Giữ !important phòng trường hợp bị ghi đè từ css toàn cục */
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
  }

  /* Đường kẻ nối ngang giữa các icon-box trên Mobile */
  .wp-process-timeline__icon-box::after {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 100%;
    width: calc(
      50vw + 16px - 60px
    ); /* 50vw width + 16px gap - 60px icon width */
    height: 1.5px;
    background: linear-gradient(90deg, #d0d5e3 0%, #b8bfd4 100%);
    pointer-events: none;
    z-index: 0;
  }

  /* Ẩn đường nối trên item cuối cùng */
  .wp-process-timeline__item:last-child .wp-process-timeline__icon-box::after {
    display: none;
  }

  .wp-process-timeline__title {
    margin-bottom: 4px;
  }

  .wp-process-timeline__desc {
    line-height: 1.4;
    padding: 0;
    max-width: 100%;
  }
}

/* ============================================================
   CUSTOM SCROLL REVEAL ANIMATIONS
   ============================================================ */
.wt-reveal {
  opacity: 0;
  /* Bỏ will-change ở đây để tránh tạo quá nhiều composite layer trên mobile */
}

.wt-reveal-fade-up {
  transform: translateY(30px);
  transition:
    opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@media (max-width: 1024px) {
  .wt-reveal-fade-up {
    transform: none; /* Tránh dịch chuyển dọc trên Mobile/Tablet để không bị xung đột Scroll Snap và lỗi cắt hình */
  }
}

/* Khi phần tử xuất hiện trong viewport */
.wt-reveal.is-visible {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Các khoảng Delay tùy chỉnh */
.wt-reveal-delay-200 {
  transition-delay: 200ms;
}
.wt-reveal-delay-400 {
  transition-delay: 400ms;
}
.wt-reveal-delay-600 {
  transition-delay: 600ms;
}
.wt-reveal-delay-800 {
  transition-delay: 800ms;
}
.wt-reveal-delay-1000 {
  transition-delay: 1000ms;
}

/* Các khoảng Duration tùy chỉnh */
.wt-reveal-duration-800 {
  transition-duration: 800ms;
}

/* ============================================================
   SWIPE GUIDE INSTRUCTION FOR MOBILE & TABLET (.wt-scroll-guide-pill)
   ============================================================ */
.wt-scroll-guide-wrapper {
  position: absolute;
  top: 73px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
  display: none;
}

.wt-scroll-guide-wrapper.wt-active {
  opacity: 1 !important;
  visibility: visible !important;
}

@media (max-width: 1024px) {
  .wt-scroll-guide-wrapper {
    display: block;
  }
}

@media (min-width: 1025px) {
  .wt-scroll-guide-wrapper {
    display: none !important;
  }
}

.wt-scroll-guide-wrapper.wt-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
}

.wt-scroll-guide-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background-color: #00000099;
  padding: 10px 24px;
  border-radius: 100px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  color: #ffffff;
  pointer-events: none;
}

.wt-scroll-guide-arrow {
  display: inline-flex;
  color: #ffffff;
}

.wt-scroll-guide-hand {
  display: inline-flex;
  color: #06bc06;
  animation: wt-hand-swipe 1.5s ease-in-out infinite;
}

@keyframes wt-hand-swipe {
  0% {
    transform: translateX(8px);
  }
  50% {
    transform: translateX(-8px);
  }
  100% {
    transform: translateX(8px);
  }
}

/* Hiệu ứng nhấp nháy cho mũi tên trái/phải tương ứng với hướng vuốt */
.wt-scroll-guide-arrow.wt-arrow-left {
  animation: wtSwipeArrowLeft 1.5s ease-in-out infinite;
}

.wt-scroll-guide-arrow.wt-arrow-right {
  animation: wtSwipeArrowRight 1.5s ease-in-out infinite;
}

@keyframes wtSwipeArrowLeft {
  0%,
  100% {
    opacity: 0.2;
    transform: translateX(2px) scale(0.9);
  }
  50% {
    opacity: 1;
    transform: translateX(-2px) scale(1.1);
  }
}

@keyframes wtSwipeArrowRight {
  0%,
  100% {
    opacity: 1;
    transform: translateX(2px) scale(1.1);
  }
  50% {
    opacity: 0.2;
    transform: translateX(-2px) scale(0.9);
  }
}
