/* Container */
.ValueBlocks-container {
  display: flex;
  width: 100%;
  height: 320px; /* adjust height as needed */
  overflow: hidden;
  gap: 10px;
  align-items: stretch;
}

/* Each box */
.ValueBlocks-item {
  flex-grow: 0;
  flex-shrink: 0;
  transition: flex-basis 0.45s ease, background 0.35s ease;
  display: flex;
  align-items: stretch;
  border-radius: 20px;
  overflow: hidden;
  background: #033c67;
  min-width: 0;
  cursor: pointer;
}

/* Default widths */
.ValueBlocks-item1 { flex-basis: 50%; }
.ValueBlocks-item2 { flex-basis: 25%; }
.ValueBlocks-item3 { flex-basis: 25%; }

/* States applied by JS */
.ValueBlocks-item.active { flex-basis: 48% !important; }
.ValueBlocks-item.shrink { flex-basis: 25% !important; }

/* internal layout: text left, media (image) right */
.ValueBlocks-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px;
  box-sizing: border-box;
  transition: width 0.45s ease, padding 0.3s ease, opacity 0.3s ease;
  min-width: 0;
}

/* media column (image container) */
.ValueBlocks-media {
  width: 0;                 /* hidden when not active */
  overflow: hidden;
  transition: width 0.45s ease, opacity 0.35s ease;
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  min-width: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* image fills container */
.ValueBlocks-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* When an item is active: split 50% / 50% and show media */
.ValueBlocks-item.active .ValueBlocks-text { width: 50%; }
.ValueBlocks-item.active .ValueBlocks-media {
  width: 50%;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* When an item is shrunk (25%): hide media and let text take full width */
.ValueBlocks-item.shrink .ValueBlocks-text { width: 100%; }
.ValueBlocks-item.shrink .ValueBlocks-media {
  width: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Ensure initial default: item1 shows image, others hidden */
.ValueBlocks-item1 .ValueBlocks-text { width: 50%; }
.ValueBlocks-item1 .ValueBlocks-media {
  width: 50%;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.ValueBlocks-item2 .ValueBlocks-media,
.ValueBlocks-item3 .ValueBlocks-media {
  width: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Text styles */
.ValueBlocks-text h5 { margin-bottom: 8px; color: #fff; }
.ValueBlocks-text .text-white { color: #e6e6e6; }

/* Button inside text */
.valueblocks-btn {
  margin-top: 10px;
  display: inline-block;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
}

/* Responsive: on small screens stack vertically */
@media (max-width: 767.98px) {
  .ValueBlocks-container { flex-direction: column; height: auto; }
  .ValueBlocks-item { flex-basis: auto !important; width: 100%; }
  .ValueBlocks-text { width: 100% !important; padding: 14px; }
  .ValueBlocks-media { width: 100% !important; height: 180px; opacity: 1; visibility: visible; pointer-events: auto; } /* show on stacked */
  .ValueBlocks-media img { height: 100%; }
}

/* ===== Mobile-only overrides: stack + reveal image on active/hover ===== */
@media (max-width: 767.98px) {

  /* stack vertically, let container size itself */
  .ValueBlocks-container {
    flex-direction: column !important;
    gap: 14px;
    height: auto !important;
    align-items: stretch;
  }

  /* each item becomes full-width card and flows vertically */
  .ValueBlocks-item {
    flex-basis: auto !important;
    width: 100% !important;
    display: block !important;               /* let inner divs flow top->bottom */
    overflow: hidden;
    border-radius: 12px !important;          /* each card rounded on mobile */
    transition: margin 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  }

  /* text takes full width above image */
  .ValueBlocks-text {
    width: 100% !important;
    padding: 16px !important;
    box-sizing: border-box;
    display: block !important;
  }

  /* media becomes hidden by default using max-height for smooth animation */
  .ValueBlocks-media {
    width: 100% !important;
    max-height: 0;                             /* collapsed */
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.45s ease, opacity 0.35s ease, visibility 0.35s;
  }

  /* ensure image scales naturally (height:auto) */
  .ValueBlocks-media img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
  }

  /* When a card is active (or hovered on capable devices) reveal image */
  .ValueBlocks-item.active .ValueBlocks-media,
  .ValueBlocks-item:hover .ValueBlocks-media {
    max-height: 320px;     /* adjust this value to control revealed image height */
    opacity: 1;
    visibility: visible;
  }

  /* Make sure text spacing looks good when media is revealed */
  .ValueBlocks-item .ValueBlocks-text {
    padding-bottom: 12px;
  }

  /* override first/last-child desktop rounding rules so every card is rounded on mobile */
  .ValueBlocks-item:first-child,
  .ValueBlocks-item:last-child,
  .ValueBlocks-item:not(:first-child):not(:last-child) {
    border-radius: 12px !important;
  }

  /* small tweak to the button to keep it nicer on small screens */
  .valueblocks-btn {
    padding: 8px 10px;
    font-size: 14px;
  }
}