<?php

use Joomla\CMS\Language\Text;

$numcols = !empty($this->params->get('columns')) ? $this->params->get('columns') : $this->params->get('num_columns');

$col_class = 'col-12';

if($this->params->get('card_layout') == 'isotope') {
	$col_class .= ' col';
}

if ($numcols > 1) {
    $col_class .= ' col-sm-' . floor(12/$numcols);
}
// column for large screen
$numcols = intval($this->params->get('num_columns_md'));
if ($numcols) {
    $col_class .= ' col-md-' . floor(12/$numcols);
}
// column for extra large screen
$numcols = intval($this->params->get('num_columns_lg'));
if ($numcols) {
    $col_class .= ' col-lg-' . floor(12/$numcols);
}
?>

<?php if (empty($this->intro_items)) : ?>
	<?php if ($this->params->get('show_no_articles', 1)) : ?>
		<p><?php echo Text::_('COM_CONTENT_NO_ARTICLES'); ?></p>
	<?php endif; ?>
<?php else: ?>
	<div class="row">
	<?php foreach ($this->intro_items as $key => &$item) : ?>

		<?php $rowcount = ((int) $key % (int) $this->columns) + 1; ?>
		<div class="<?php echo trim($col_class) ?>">
			<div class="item card-item column-<?php echo $rowcount; ?> <?php echo $item->state == 0 ? ' system-unpublished' : null; ?>" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
				<?php
								$this->item = &$item;
								echo $this->loadTemplate('item');
								?>
			</div><!-- end item -->
		</div><!-- end span -->

	<?php endforeach; ?>
	</div>
<?php endif; ?>
	