/**
 * Location: /assets/css/home-features.css
 * Purpose:
 * - HOME FEATURES STRIP (USP BAR)
 * - Desktop: 5-column grid (with green separators).
 * - Tablet: horizontal swipe, EXACT 4 visible (others via swipe).
 * - Mobile: horizontal swipe, EXACT 3 visible (others via swipe) — NO 4th peeking.
 * - Container width/padding matches your theme container feel (tabs-like).
 *
 * Related CSS/JS:
 * - No JS required (CSS-only swipe).
 *
 * Linkage/Loader:
 * - Enqueued on is_front_page() from /inc/enqueue.php as `stm-home-features`.
 *
 * @package SuntechMallVPro
 */

/* =========================
   Base
========================= */
.stm-features{
  background: transparent;
  padding: 0;
  margin: 0;
}

/* Inner container (tabs-like feel) */
.stm-features__inner{
  max-width: var(--h-container, 1100px);
  margin: 0 auto;
  padding: 18px var(--h-gap, 20px);
  box-sizing: border-box;
}

/* Desktop grid */
.stm-features__list{
  list-style: none;
  margin: 0;
  padding: 0;

  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
}

.stm-features__item{
  display: flex;
  align-items: center;
  gap: 14px;

  padding: 10px 18px;
  min-height: 62px;
  position: relative;
  box-sizing: border-box;
}

/* Green vertical separators */
.stm-features__item:not(:last-child)::after{
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 42px;
  background: #19b24a;
  opacity: .95;
}

/* Icon */
.stm-features__icon{
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: block;

  background-image: var(--stm-feat-ico);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* Text */
.stm-features__text{
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.1;
  min-width: 0;
}

.stm-features__l1{
  display: block;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .2px;
  color: #0b1220;
  font-size: 14px;
}

.stm-features__l2{
  display: block;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .2px;
  color: #0b1220;
  font-size: 13px;
  opacity: .95;
}

/* =========================
   Tablet + Mobile: Swipe Row
   Tablet: 4 visible
   Mobile: 3 visible (NO peeking)
========================= */
@media (max-width: 1024px){

  .stm-features__inner{
    max-width: var(--h-container, 1200px);
    padding: 14px var(--h-gap, 16px);
  }

  .stm-features__list{
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;

    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;

    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;

    /* IMPORTANT: no extra right padding on tablet (prevents weird peeking) */
    padding: 0;
    margin: 0;

    grid-template-columns: none;
  }

  .stm-features__list::-webkit-scrollbar{ display: none; }
  .stm-features__list{ scrollbar-width: none; }

  .stm-features__item:not(:last-child)::after{ display:none; }

  /* ✅ EXACT 4 visible on tablet:
     width = (100% - 3 gaps) / 4  */
  .stm-features__item{
    flex: 0 0 calc((100% - (12px * 3)) / 4);
    min-height: 52px;

    padding: 8px 10px;
    gap: 9px;

    scroll-snap-align: start;

    border: 1px solid rgba(0,0,0,.05);
    border-radius: 10px;
    background: rgba(255,255,255,.75);
    backdrop-filter: blur(2px);
    box-sizing: border-box;
  }

  .stm-features__icon{
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
  }

  /* Keep 2 lines like desktop */
  .stm-features__l1,
  .stm-features__l2{
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .stm-features__l1{
    font-size: 12px;
    font-weight: 900;
  }

  .stm-features__l2{
    font-size: 11px;
    font-weight: 500;
    opacity: .95;
  }
}

/* =========================
   Mobile: EXACT 3 visible (NO 4th peeking)
========================= */
@media (max-width: 640px){

  .stm-features__inner{
    padding: 12px var(--h-gap, 16px);
  }

  /* reduce gap slightly for tighter mobile fit */
  .stm-features__list{
    gap: 10px;
    padding: 0 !important;  /* ✅ hard stop: no end padding => no peeking */
    margin: 0;
  }

  /* ✅ EXACT 3 visible:
     width = (100% - 2 gaps) / 3
     gap=10px => subtract 20px */
  .stm-features__item{
    flex: 0 0 calc((100% - 20px) / 3);
    min-height: 46px;

    padding: 7px 9px;
    gap: 8px;

    border-radius: 9px;
  }

  .stm-features__icon{
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
  }

  /* lock text to 2 lines style (single-line each) */
  .stm-features__l1{
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stm-features__l2{
    font-size: 9px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: .95;
  }
}

/* =========================
   SAFETY VISIBILITY FIX
========================= */
.stm-home-features,
.stm-features,
section.stm-home-features{
  position: relative;
  z-index: 5;
}

/* ensure next section does not overlap */
.stm-home-features{
  margin-bottom: 40px;
}

.stm-home-tabs,
.stm-home-products,
.stm-home-sections{
  position: relative;
  z-index: 1;
}
