<?php /* NOTE: GENERATED BY GULP !!! */ ?><?php
$b = "flo-block-listing-5"; // 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

$elements_color = flo_data($data, "elements_color");
$columns = flo_data($data, "columns");
$gap = flo_data($data, "gap", 44);
$gap_for_css = $gap/ 16 / 2 . "rem";
$masonry_layout = flo_data($data, "masonry_layout");
$masonry_layout_class = $masonry_layout ? $b . "--masonry" : "";

$display_category = flo_data($data, "display_category");
$category_font = flo_data($data, "category_font");
$title_font = flo_data($data, "title_font");

$overlay_background_color = flo_data($data, "overlay_background_color");
$overlay_opacity = flo_data($data, "overlay_opacity") / 100;
$overlay_padding = flo_data($data, "overlay_padding") / 16 . "rem";
$overlay_elements_color = flo_data($data, "overlay_elements_color");
$display_decorative_icon = flo_data($data, "display_decorative_icon");
$overlay_label = flo_data($data, "overlay_label");
$overlay_label_font = flo_data($data, "overlay_label_font");

$mobile_image_height = flo_data($data, "mobile_image_height") / 16 ."rem";
$mobile_image_height_numeric = flo_data($data, "mobile_image_height");

?>

<?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
      )
      ."

      ".
      flo_render_typography_styles(
      $b__uniq_for_css." ".$b__for_css."__overlay",
      $overlay_label_font
      )
      ."

      ".$b__uniq_for_css." ".$b__for_css."__overlay {
        color: ".$overlay_elements_color.";
        width: calc(100% - ".$overlay_padding." * 2);
        height: calc(100% - ".$overlay_padding." * 2);
        transform: translate(".$overlay_padding.", ".$overlay_padding.");
      }

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

      ".$b__uniq_for_css." ".$b__for_css."__text-area {
        color: ".$elements_color.";
      }

    ",
    "breakpoint__medium_up" => "

      ".$b__uniq_for_css." ".$b__for_css."__item {
        width: calc(100% / ".$columns.");
        padding: ".$gap_for_css.";
      }
      .grid-sizer{
        width: calc(100% / ".$columns.");
      }

      ".$b__uniq_for_css." {
        margin: -".$gap_for_css.";
      }
    "

  ], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
  <div class="<?php echo $b; ?> <?php echo $b__uniq; ?> <?php echo $masonry_layout_class; ?>">
    <?php if($masonry_layout): ?>
        <div class="grid-sizer"></div>
    <?php endif; ?>
    <?php foreach($items as $item): ?>
      <?php
        $has_featured_img_class = $item["has_feat_img"] ? $b . "__item--has-featured-image" : "";

        //Image Optimization
        $img_sizes = array(
          'mobile' => array('width' => 640, 'height' => $mobile_image_height_numeric *2),  // mobile size
          'tablet' => array('width' => round((600/$columns) *2), 'height' => 9999), // tablet size
          'desktop' => array('width' => round((1125/$columns-$gap*($columns-1)) *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"]; ?>" style="
      --overlay-opacity: <?php echo $overlay_opacity; ?>;
      --mobile-height: <?php echo $mobile_image_height; ?>;
      ">
        <?php if($item["has_feat_img"]): ?>
          <span class="<?php echo $b; ?>__featured-image-wrap">
            <?php if($masonry_layout): ?>
              <?php echo $item["featured_image"]; ?>

            <?php else: ?>
              <img class="<?php echo $b; ?>__featured-image <?php echo $b; ?>__featured-image--bgi"
                 data-src= "<?php echo $item["featured_image_url"]; ?>"
                 data-srcset="<?php echo $img_vars['srcsets']; ?>"
                 sizes="<?php echo $img_vars['sizes']; ?>"
                 alt="<?php echo $item['feat_image_alt']; ?>"
               />
            <?php endif; ?>

            <?php if($overlay_label or $display_decorative_icon): ?>
              <span class="<?php echo $b; ?>__overlay">
                <span class="<?php echo $b; ?>__overlay-color"></span>
                <?php if($display_decorative_icon): ?>
                  <?php echo flo_aq_img($class = $b . "__decorative-image", $url = $item['decorative_image']['url'], $width = 100, $height = 999999, $crop = true, $alt = $item['decorative_image']['alt']); ?>

                <?php endif; ?>

                <?php if($display_decorative_icon and $overlay_label): ?>
                  <span class="<?php echo $b; ?>__separator"></span>
                <?php endif; ?>

                <?php if($overlay_label): ?>
                  <span class="<?php echo $b; ?>__overlay-label">
                    <?php echo $overlay_label; ?>

                  </span>
                <?php endif; ?>

              </span>
            <?php endif; ?>
          </span>
        <?php endif; ?>
        <span class="<?php echo $b; ?>__text-area">
          <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_5" // 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(); ?>