/* =========================
   BASE BLOCK
========================= */
.four-pillars {
  overflow-x: clip;
}

/* =========================
   BACKGROUND
========================= */
.four-pillars__bg::before,
.four-pillars__bg::after {
  position: absolute;
  z-index: -1;
  transform: scaleX(var(--dir));
}

.four-pillars__bg::before {
  content: "";
  background: url('../~/media/Images/T/taaleem/ir/custom-components/four-pillars/four-pillars-pattern-1.svg');
  top: 22%;
  inset-inline-start: 0;
  height: 65%;
  width: 50%;
  background-size: contain;
  background-position: left center;
   background-repeat: no-repeat;
}

.four-pillars__bg::after {
  content: "";
  background: url('../~/media/Images/T/taaleem/ir/custom-components/four-pillars/four-pillars-pattern-2.svg');
  top: 31%;
  inset-inline-end: 0;
  height: 70%;
  width: 50%;
  background-size: contain;
  background-position: right bottom;
   background-repeat: no-repeat;
}

/* =========================
   GRID (DESKTOP)
========================= */
.four-pillars__cards.d-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr)); /* ✅ FIXED */
  gap: clamp(1.6rem, 2.5vw, 4.8rem);
  align-items: stretch;
}

/* =========================
   CARD
========================= */
.four-pillars__card {
  position: relative;
  height: clamp(28rem, 40vw, 56.8rem);
  cursor: pointer;
  overflow: hidden;

  transform: translateZ(0);
  will-change: transform;
}

/* grid placement */
.four-pillars__card:nth-child(1) {
  grid-column: 1;
  grid-row: 1 / span 2;
}
.four-pillars__card:nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}
.four-pillars__card:nth-child(3) {
  grid-column: 3;
  grid-row: 1 / span 2;
}
.four-pillars__card:nth-child(4) {
  grid-column: 2;
  grid-row: 2;
}

/* =========================
   INNER WRAPPER
========================= */
.four-pillars__inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  contain: layout paint; /* ✅ prevents jump */
}

/* =========================
   FRONT & BACK (IMPORTANT FIX)
========================= */
.four-pillars-card__front,
.four-pillars-card__back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s ease;
}

/* FRONT */
.four-pillars-card__front {
  z-index: 2;
  opacity: 1;
  visibility: visible;
}

.four-pillars-card__front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.four-pillars-card__front .theme-2 {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
}

.four-pillars-card__body {
    max-height: 10rem; /* adjust as needed */
    overflow-y: auto;
    margin-bottom: 1rem;
}

.four-pillars__cta {
    flex-shrink: 0;
}
.four-pillars-card__body::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.four-pillars-card__body {
    scrollbar-width: none;
}
@media (max-width: 1199px) {
    .four-pillars-card__body {
        max-height: 8rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}
/* =========================
   OVERLAY
========================= */
.four-pillars-card__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(33, 46, 7, 0) 40%,
    rgba(33, 46, 7, 0.8) 100%
  );
}

/* =========================
   BACK
========================= */
.four-pillars-card__back {
  z-index: 3;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  background: var(--gradient-1);
  color: var(--base-8);

  display: flex;
  flex-direction: column;
  justify-content: flex-end;

  /*padding: 0 var(--md-3) var(--md-3);*/
	padding: var(--md-3);
    overflow: hidden;
  transform: translateY(10px);
}
.four-pillars-card__expanded {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
@media (max-width: 1199px) {
    .four-pillars-card__back {
        justify-content: flex-start;
    }

    .four-pillars-card__expanded {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}
.four-pillars-card__back h2 {
    flex-shrink: 0;
    margin-bottom: 1rem;
}

.four-pillars-card__expanded {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
} 
/* =========================
   CONTENT
========================= */
.four-pillars-card__content {
  position: relative;
  z-index: 2;
  color: #fff;
  transform: translateZ(0);
  will-change: opacity;
}

/* =========================
   ACTIVE / HOVER STATE
========================= */
.four-pillars__card:hover .four-pillars-card__front,
.four-pillars__card.active .four-pillars-card__front,
.four-pillars__card--flipped .four-pillars-card__front {
  opacity: 0;
  visibility: hidden;
}

.four-pillars__card:hover .four-pillars-card__back,
.four-pillars__card.active .four-pillars-card__back,
.four-pillars__card--flipped .four-pillars-card__back {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

/* =========================
   TABLET & MOBILE (SLIDER FIXED)
========================= */
@media (max-width: 1199px) {
  .four-pillars__cards.d-grid {
    display: flex !important;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;

    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;

    gap: 1.6rem;
    padding: 0 2rem 2.4rem;
  }

  .four-pillars__cards.d-grid::-webkit-scrollbar {
    display: none;
  }

  .four-pillars__card {
    flex: 0 0 60%;
    max-width: 60%;
    height: clamp(26rem, 48vw, 40rem);
    scroll-snap-align: start;
  }

  .four-pillars__card:nth-child(n) {
    grid-column: unset;
    grid-row: unset;
  }
}

/* =========================
   MOBILE
========================= */
@media (max-width: 767px) {
  .four-pillars__cards.d-grid {
    padding: 0 1.6rem 2rem;
    gap: 1.2rem;
  }

  .four-pillars__card {
    flex: 0 0 98%;
    max-width: 98%;
    height: clamp(24rem, 70vw, 40rem);
  }
  .four-pillars-card__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(33, 46, 7, 0) 15%,
    rgba(33, 46, 7, 0.8) 100%
  );
}
}

/* =========================
   SMALL DEVICES
========================= */
@media (max-width: 575px) {
  .four-pillars__bg::after {
    content: none;
  }
}

/* =========================
   ARROW LIST
========================= */
.four-pillars ul {
  list-style: none;
  padding-inline-start: 0;
}

.four-pillars ul li {
  position: relative;
  padding-inline-start: 2.5rem;
}

.four-pillars ul li::before {
  content: "→";
  position: absolute;
  inset-inline-start: 0;
  font-size: 1.5rem;
  transform: scaleX(var(--dir));
}