<?php /* NOTE: GENERATED BY GULP !!! */ ?><?php
$b = "flo-block-listing-4"; // To be used inside HTML

// Start: Class name automation
  $b__for_css = ".".$b; // To be used inside CSS
  $b__uniq = $b."--".mt_rand(1, 999); // To be used inside HTML
  $b__uniq_for_css = ".".$b__uniq; // To be used inside CSS
// End: Class name automation

$columns = flo_data($data, "columns");
$gap = flo_data($data, "gap", 44) / 16 . "rem";
$overlay_background_color = flo_data($data, "overlay_background_color");
$overlay_elements_color = flo_data($data, "text_area_elements_color");
$display_decorative_images = flo_data($data, "display_decorative_images");
$title_font = flo_data($data, "title_font");
$display_category = flo_data($data, "display_category");
$category_font = flo_data($data, "category_font");

?>

<?php echo $__env->make('components.flo-generic-listing-items-data', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php
  global $items;
?>
<?php $__env->startSection('block_content'); ?>
  <?php echo $__env->make('core.style', [
    "breakpoint__general" => "

      ".
      flo_render_typography_styles(
      $b__uniq_for_css." ".$b__for_css."__title",
      $title_font
      )
      ."

      ".
      flo_render_typography_styles(
      $b__uniq_for_css." ".$b__for_css."__category",
      $category_font
      )
      ."

      ".$b__uniq_for_css." ".$b__for_css."__overlay {
        color: ".$overlay_elements_color.";
        background-color: ".$overlay_background_color.";
      }

    ",
    "breakpoint__medium_up" => "
      ".$b__uniq_for_css." ".$b__for_css."__item {
        width: calc(100% / ".$columns." - ".$gap." * (".$columns." - 1) / ".$columns.");
        margin-bottom: ".$gap.";
      }

      ".$b__uniq_for_css." {
        margin-bottom: -".$gap.";
      }

      ".$b__uniq_for_css." ".$b__for_css."__item:not(:nth-child(".$columns."n)) {
        margin-right: ".$gap.";
      }
    "
  ], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
  <div class="<?php echo $b; ?> <?php echo $b__uniq; ?>">
    <?php foreach($items as $item): ?>
      <?php
        $has_featured_img_class = $item["has_feat_img"] ? $b . "__item--has-featured-image" : "";

        // Images Optimization

        $img_sizes = array(
          'mobile' => array('width' => 640, 'height' => 9999),  // mobile size
          'tablet' => array('width' => round((594/$columns) *2), 'height' => 9999), // tablet size
          'desktop' => array('width' => round((1114/$columns) *2), 'height' => 9999),
        );

        $img_vars = generate_srcsets($item['featured_image_url'], $img_sizes, $crop = false);

      ?>
      <a class="<?php echo $b; ?>__item <?php echo $has_featured_img_class; ?>" href="<?php echo $item["url"]; ?>">
        <?php if($item["has_feat_img"]): ?>
          <img class="<?php echo $b; ?>__featured-image"
            data-src="<?php echo $item["feat_image_url_large"]; ?>"
            data-srcset="<?php echo $img_vars['srcsets']; ?>"
            sizes ="<?php echo $img_vars['sizes']; ?>"
            alt = "<?php echo $item['feat_image_alt']; ?>"
          />
        <?php endif; ?>
        <span class="<?php echo $b; ?>__overlay">
          <?php if($display_decorative_images && $item["decorative_image"]): ?>
            <img class="<?php echo $b; ?>__decorative-image" src="<?php echo $item["decorative_image"]["url"]; ?>" alt="<?php echo $item["decorative_image"]["alt"]; ?>">
          <?php endif; ?>
          <h2 class="<?php echo $b; ?>__title">
            <?php echo $item["title"]; ?>

          </h2>
          <?php if($display_category): ?>
            <h4 class="<?php echo $b; ?>__category">
              <?php echo $item["first_category"]; ?>

            </h4>
          <?php endif; ?>
        </span>
      </a>
    <?php endforeach; ?>
  </div>
<?php $__env->stopSection(true); ?>

<?php echo $__env->make('layout.block', [
  "block_classes" => "", // Will be added to main block span. e.g. flo-block--full-width
  "data_onready" => "flo_block_listing_4" // Specify a function (see _blank.js on how to define) that will be executed on document ready.
], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>