/*
 * Features Row — [iw_features_row]
 * Design source: Figma 407:41710 (desktop 4 cols) + 407:42312 (mobile h-scroll).
 *
 * Structure:
 *   1. Container + heading
 *   2. Grid + item base
 *   3. Style-2 modifier (white card with shadow)
 *   4. Responsive overrides (@media — desc theo width)
 */

/* ─── 1. Container + heading ──────────────────────────────── */

.iw-features-row {
  padding-top: 60px;
  padding-bottom: 60px;
  /* Fullwidth breakout so inner 1440 container is viewport-aligned
     regardless of Flatsome page-wrapper max-width. */
  position: relative;
  /* z-index keeps cards above a preceding element when offset_top is negative
     (cards pulled up to overlap the section above — e.g. a hero banner). */
  z-index: 2;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.iw-features-row__inner {
  max-width: var(--iw-container-max);
  margin: 0 auto;
  padding: 0 var(--iw-container-pad-x);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Heading row (optional) — title + subtitle, position-aware. */
.iw-features-row__heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
.iw-features-row__heading--center { align-items: center; text-align: center; }
.iw-features-row__heading--right  { align-items: flex-end;  text-align: right; }

.iw-features-row__heading-title {
  margin: 0;
  font-family: inherit;
  font-weight: 700;
  font-size: 40px;
  line-height: 48px;
  color: #3d3d3d;
}

.iw-features-row__heading-subtitle {
  margin: 0;
  font-family: inherit;
  font-weight: 400;
  font-size: 20px;
  line-height: 28px;
  color: #3d3d3d;
}
.iw-features-row__heading-subtitle--left   { text-align: left;   align-self: flex-start; }
.iw-features-row__heading-subtitle--center { text-align: center; align-self: center;     }
.iw-features-row__heading-subtitle--right  { text-align: right;  align-self: flex-end;   }

/* ─── 2. Grid + item base ─────────────────────────────────── */

.iw-features-row__scroll {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

.iw-features-row__item {
  background: #f7f7f8;
  border-radius: 12px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-sizing: border-box;
  font-family: inherit;
  color: #3d3d3d;
}

.iw-features-row__icon {
  height: 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  /* No width constraint — container sizes to child img natural width.
     Per Figma, icon Group extends past 60px wrapper (speed/support have
     viewBox wider than 60), and downloaded SVGs use
     preserveAspectRatio="none", so fixing width=60 squishes them. */
}

.iw-features-row__icon img {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
}

.iw-features-row__text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
  width: 100%;
}

/* NOTE: 2 rules cùng selector .iw-features-row__title — rule sau (28/40)
   override rule trên (22/1.4). Giữ nguyên cấu trúc cũ để không đổi behavior. */
.iw-features-row__title {
  margin: 0;
  font-size: 22px;
  line-height: 1.4;
  font-weight: 700;
  color: #3d3d3d;
}

.iw-features-row__desc {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: #3d3d3d;
}

.iw-features-row__title {
  font-size: 28px;
  line-height: 40px;
}

/* ─── 3. Style-2 modifier (white card with shadow) ─────────── */

/* Style 2: white card, border + drop shadow (Figma 1642:47687). */
.iw-features-row--style-2 .iw-features-row__item {
  background: #fff;
  border: 1px solid #e7e7e7;
  border-radius: 16px;
  /* padding: 40px; */
  gap: 16px;
  box-shadow:
    0 4px 6px -2px rgba(16, 24, 40, 0.03),
    0 12px 16px -4px rgba(16, 24, 40, 0.08);
}

/* @media (max-width: 1024px) {
  .iw-features-row__title {
    font-size: 18px;
  }
} */

/* ─── 4. Responsive overrides ─────────────────────────────── */
/* Cascade order: rộng → hẹp. */

/* Tablet-desktop range 993-1280: 4-col grid still on, ease padding/title
   so cards không cramped giữa khoảng này. */
@media (min-width: 993px) and (max-width: 1280px) {
  .iw-features-row__icon {
    height: 45px;
  }
  .iw-features-row__item {
    padding: 20px 16px;
    gap: 12px;
  }
  .iw-features-row__title {
    font-size: 20px;
    line-height: 30px;
  }
}

/* Mobile ≤992: switch sang horizontal scroll row (Figma 407:42312).
   NOTE: gộp từ 2 block `@media (max-width: 992px)` cũ — 1 set item
   padding/title chung, 1 set scroll layout. Cùng breakpoint, cùng selector
   → source order wins (rule sau thắng), behavior không đổi. */
@media (max-width: 992px) {
  .iw-features-row {
    padding: 40px 0;
  }
  .iw-features-row__inner {
    padding: 0;
    gap: 16px;
  }
  /* Heading inset 16px ngang (inner đã bỏ horizontal padding để scroll
     full-bleed). Mirror PDH grid mobile pattern. */
  .iw-features-row__heading {
    padding-left: var(--iw-container-pad-x);
    padding-right: var(--iw-container-pad-x);
    box-sizing: border-box;
    width: 100%;
  }
  .iw-features-row__heading-title {
    font-size: 24px;
    line-height: 32px;
  }
  .iw-features-row__heading-subtitle {
    font-size: 16px;
    line-height: 22px;
  }
  /* Scroll full-bleed: padding bottom only; first/last card 16px lề bằng
     margin trên item, scroll-padding cho scroll-snap target. */
  .iw-features-row__scroll {
    display: flex;
    grid-template-columns: none;
    gap: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 16px;
    padding: 0 0 20px;
    scrollbar-width: none;
  }
  .iw-features-row__scroll > .iw-features-row__item:first-child {
    margin-left: 16px;
  }
  .iw-features-row__scroll > .iw-features-row__item:last-child {
    margin-right: 16px;
  }
  .iw-features-row__scroll::-webkit-scrollbar {
    display: none;
  }
  .iw-features-row__item {
    flex: 0 0 224px;
    width: 224px;
    scroll-snap-align: start;
    padding: 20px 16px;
  }
  .iw-features-row__icon {
    height: 48px;
  }
  .iw-features-row__title {
    font-size: 18px;
  }
  .iw-features-row__desc {
    font-size: 14px;
    line-height: 24px;
  }
}

/* Mobile ≤768: style-2 margin-top adjustment. */
@media (max-width: 768px) {
  .iw-features-row--style-2.iw-features-row {
    margin-top: -100px !important;
  }
}

/* Small mobile ≤540. */
@media (max-width: 540px) {
  .iw-features-row {
    padding: 20px 0;
  }
  .iw-features-row__item {
    padding: 8px;
    gap: 8px !important;
  }
  .iw-features-row__text {
    gap: 4px;
  }
  .iw-features-row--style-2.iw-features-row {
    margin-top: -50px !important;
  }
  /* .iw-features-row--style-2 .iw-features-row__item {
    gap: 8px;
  } */
}
