@php // Adaptive column width: 3-up grid for 3 items, 4-up for 4, 6-up for 6. // Without this, 4 items rendered with `col-md-4` (Bootstrap 12/4 = 3-cols) // wrap to a 3+1 layout — see html/home-pet-care.html where the demo uses // a 4-up swiper (data-preview="4") for the same content. $count = count($items); $colClass = match (true) { $count <= 2 => 'col-md-6 col-sm-6', $count === 3 => 'col-md-4 col-sm-6', $count === 4 => 'col-md-3 col-sm-6', $count === 6 => 'col-md-2 col-sm-6', default => 'col-md-3 col-sm-6', }; @endphp