/**
 * Location: /assets/css/home-features.css
 * Purpose:
 * - HOME FEATURES STRIP (USP BAR)
 * - Editable background, icon/text values, top gap, item gap, and item padding from Setup Page > Pages > Homepage.
 * - Desktop: compact centered flex row with admin-controlled item gap/padding.
 * - 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: var(--stm-features-bg, #e9e9e9);
  padding: 0;
  margin: var(--stm-features-top-gap, 0) 0 0;
}

/* Inner container (tabs-like feel) */
.stm-features__inner{
  max-width: var(--h-container, 1100px);
  margin: 0 auto;
  padding: 8px var(--h-gap, 20px);
  box-sizing: border-box;
}

/* Desktop compact row */
.stm-features__list{
  list-style: none;
  margin: 0;
  padding: 0;

  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: var(--stm-features-item-gap, 10px);
}

.stm-features__item{
  display: flex;
  align-items: center;
  gap: 8px;

  flex: 0 0 auto;
  width: auto;
  max-width: max-content;
  padding: var(--stm-features-item-pad-y, 6px) var(--stm-features-item-pad-x, 10px);
  min-height: 48px;
  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: 30px;
  background: #19b24a;
  opacity: .95;
}

/* Icon */
.stm-features__icon{
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  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: 600;
  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: 8px var(--h-gap, 16px);
  }

  .stm-features__list{
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;

    gap: var(--stm-features-item-gap, 10px);
    overflow-x: auto;
    overflow-y: hidden;

    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-padding-inline: 0;

    /* 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 using the admin gap value. */
  .stm-features__item{
    flex: 0 0 calc((100% - var(--stm-features-item-gap-tablet-total, 30px)) / 4);
    min-height: 42px;

    padding: min(var(--stm-features-item-pad-y, 6px), 8px) min(var(--stm-features-item-pad-x, 10px), 10px);
    gap: 8px;

    scroll-snap-align: start;

    border: 1px solid rgba(0,0,0,.05);
    border-radius: 10px;
    background: rgba(255,255,255,.92);
    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: 600;
  }

  .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: 8px var(--h-gap, 16px);
  }

  /* reduce gap slightly for tighter mobile fit */
  .stm-features__list{
    gap: var(--stm-features-item-gap, 10px);
    padding: 0 !important;  /* ✅ hard stop: no end padding => no peeking */
    margin: 0;
  }

  /* ✅ EXACT 3 visible using the admin gap value. */
  .stm-features__item{
    flex: 0 0 calc((100% - var(--stm-features-item-gap-mobile-total, 20px)) / 3);
    min-height: 42px;

    padding: min(var(--stm-features-item-pad-y, 6px), 7px) min(var(--stm-features-item-pad-x, 10px), 9px);
    gap: 7px;

    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: 600;
    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;
}

.stm-home-features{
  margin-bottom: 15px;
}

.stm-home .stm-features + *{
  margin-top: 15px;
}

.stm-home-tabs,
.stm-home-products,
.stm-home-sections{
  position: relative;
  z-index: 1;
}