<?php
    $heroOverlayStyles = '';
    if ($block->overlay_opacity) {
        $opacity = $block->overlay_opacity / 100;
        $heroOverlayStyles .= "opacity: $opacity;";
        if ($block->overlay_color) {
            $heroOverlayStyles .= "background-color: $block->overlay_color;";
        }
    }
    // optimizes image load by preloading the resource
    if ($block->mobileImages->count()) {
        RequestContext::set('preloadImages', [
            ['url' => getMediaUrl($block->mobileImages->random()['filename'], '640x1036') . '.webp', 'type' => 'image/webp']
        ]);
    }
?>
<div class="newhome-hero newhome-hero--<?php echo e($block->hero_type); ?> newhome-hero--<?php echo e($block->alignment); ?> block-margin-top--<?php echo e($block->margin_type_top); ?> block-margin-bottom--<?php echo e($block->margin_type_bottom); ?>">
  <?php if($block->anchor_id ): ?>
      <div id="<?php echo e($block->anchor_id); ?>" class="anchor-offset"></div>
  <?php endif; ?>
  <div class="newhome-hero__media-wrapper">
    <picture>
        <?php if($block->images->count()): ?>
            <source media="(min-width: 768px)" srcset="<?php echo e(getMediaUrl($block->images->random()['filename'], '1920x768')); ?>.webp" type="image/webp">
            <source media="(min-width: 768px)" srcset="<?php echo e(getMediaUrl($block->images->random()['filename'], '1920x768')); ?>">
        <?php endif; ?>
        <?php if($block->mobileImages->count()): ?>
          <source srcset="<?php echo e(getMediaUrl($block->mobileImages->random()['filename'], '640x1036')); ?>.webp" type="image/webp">
          <img src="<?php echo e(getMediaUrl($block->mobileImages->random()['filename'], '640x1036')); ?>">
        <?php elseif($block->images->count()): ?>
            <source srcset="<?php echo e(getMediaUrl($block->images->random()['filename'], '640x1036')); ?>.webp" type="image/webp">
            <img src="<?php echo e(getMediaUrl($block->images->random()['filename'], '640x1036')); ?>">
        <?php endif; ?>
    </picture>
    <?php if($block->bg_type == 'video' && !empty($block->bgVideo)): ?>
      <video autoplay muted="" preload="none" defaultmuted="" loop="true" width="1920" height="1080" data-role="visible-load">
        <source data-src="<?php echo e(getMediaUrl($block->bgVideo->filename)); ?>" type="video/mp4">
      </video>
    <?php endif; ?>
    <div
        class="newhome-hero__media-overlay"
        style="<?php echo e($heroOverlayStyles); ?>"
    ></div>
  </div>
  <div class="newhome-hero__overlay">
    <div class="newhome-hero__content">
      <h1 class="newhome-hero__title"><?php echo co2_subscript(e($block->block_title)); ?></h1>
      
      <div class="newhome-hero__content-subtitle rich-content">
          <?php echo $block->content; ?>

      </div>

      <div class="newhome-hero__cta">
        <?php echo generateLink($block->cta1, 'std-button std-button--large blue-button home-hero-button'); ?>

      </div>
    </div>
  </div>
  <button class="scroll-down-btn" data-action="scroll-down"></button>
</div>
<style>
    <?php if($block->font_color): ?>
        .newhome-hero .newhome-hero__title,
        .newhome-hero .newhome-hero__subtitle{
            color: <?php echo e($block->font_color); ?>;
        }
    <?php endif; ?>
</style>
<?php /**PATH /var/www/html-staging/resources/views/frontend/templates/blocks/home-hero.blade.php ENDPATH**/ ?>