.ibfg-wrap{
  width:100%;
  --ibfg-cols: 4;
  --ibfg-gap: 24px;
}

.ibfg-tabs{
  display:flex;
  justify-content:center;
  align-items:center;
  flex-wrap:wrap;
  gap:16px;
  margin-bottom:34px;
}

.ibfg-tab{
  border:2px solid #555;
  background:#fff;
  cursor:pointer;
  line-height:1;
  transition:transform .15s ease, opacity .15s ease, background .15s ease, color .15s ease;
}

.ibfg-tab:hover{ transform:translateY(-1px); }
.ibfg-tab.is-active{ opacity:1; }

/* FLEX GRID: centers automatically when items are fewer */
.ibfg-grid{
  position: relative;
  transition: height .35s ease;
 /* required for smooth leaving absolute items */
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap: var(--ibfg-gap);
}

.ibfg-card{
  overflow:hidden;
  transition: opacity .35s ease, transform .35s ease;
  opacity:1;
  transform: translateY(0);
  width: calc((100% - (var(--ibfg-gap) * (var(--ibfg-cols) - 1))) / var(--ibfg-cols));
  box-sizing:border-box;
  will-change: transform, opacity;
}

/* Fade states */
.ibfg-card.is-fading-out{
  opacity:0;
  transform: translateY(6px);
}

.ibfg-card.is-hidden{
  display:none;
}

.ibfg-card.is-fading-in{
  opacity:0;
  transform: translateY(6px);
}

/* When a card leaves, we temporarily absolutely-position it so layout can reflow smoothly */
.ibfg-card.is-leaving{
  position:absolute !important;
  z-index: 2;
}

.ibfg-link{
  display:block;
  text-decoration:none;
}

.ibfg-img{
  width:100%;
  height:260px;
  background:#f2f2f2;
  overflow:hidden;
}

.ibfg-img img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
}

.ibfg-meta{
  background:#0B3B1E;
  text-align:center;
}

.ibfg-title{
  font-weight:700;
  font-size:18px;
  line-height:1.2;
  margin:0;
}

.ibfg-caption{
  font-size:14px;
  line-height:1.2;
  margin-top:4px;
}

/* Load More */
.ibfg-loadmore-wrap{
  display:flex;
  justify-content:center;
  margin-top:28px;
}

.ibfg-loadmore{
  border:2px solid #555;
  background:#fff;
  padding:12px 22px;
  cursor:pointer;
  transition:transform .15s ease, opacity .15s ease;
}
.ibfg-loadmore:hover{ transform:translateY(-1px); }

.ibfg-loadmore.is-disabled{
  opacity:.5;
  pointer-events:none;
}

/* Safety: prevent tiny widths on very small screens */
@media (max-width: 767px){
  .ibfg-card{ width: 100%; }
}

/* Mobile carousel mode (Swipe) */
@media (max-width: 767px){
  .ibfg-wrap[data-mobile-view="carousel"] .ibfg-grid{
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    justify-content: flex-start;
    padding-bottom: 8px;
  }
  .ibfg-wrap[data-mobile-view="carousel"] .ibfg-card{
    width: 80%;
    flex: 0 0 auto;
    scroll-snap-align: center;
  }
}

.ibfg-grid.is-animating{overflow:hidden;}
