<section id="hero-slider" class="hero-slider swiper">
        <div class="swiper-wrapper wrapper--inner">
            <?php if (have_rows('single-slide')) : ?>
            <?php while (have_rows('single-slide')) : the_row(); ?>
                <div class="swiper-slide" style="background: url('<?php the_sub_field('background'); ?>');">

                <span class="bg-filter"></span>

                    <!-- <div class="wrapper "> -->
                    <?php if(have_rows('slide_main_heading')): ?>
                    <?php while(have_rows('slide_main_heading')): the_row();?>
                            <?php if(get_sub_field('choose_heading') == 'h1'): ?>
                            <h1 class="hero-slider-heading heading--xl text-white">
                                <?= the_sub_field('heading'); ?>
                            </h1>
                        <?php else: ?>
                            <h2 class="hero-slider-heading heading--xl text-white">
                                <?= the_sub_field('heading'); ?>
                            </h2>
                        <?php endif; ?>
                        <?php endwhile; ?>
                    <?php endif; ?>

                        <?php if (have_rows('slide_content')) : ?>
                        <?php while (have_rows('slide_content')) : the_row(); ?>

                            <div class="flex flex-col hero-slider-content box box--dark">
                                <?php if (get_sub_field('heading')) : ?>
                                    <h2 class="hero-heading heading heading--md text-white">
                                        <?php the_sub_field('heading'); ?>
                                    </h2>
                                <?php endif; ?>
                                <?php if (get_sub_field('description')) : ?>
                                    <p class="hero-slider-text text-regular text-white">
                                        <?php the_sub_field('description'); ?>
                                    </p>
                                <?php endif; ?>
                                <?php 
                                $cta = get_sub_field('cta');
                                if( $cta ): 
                                    $cta_url = $cta['url'];
                                    $cta_title = $cta['title'];
                                    $cta_target = $cta['target'] ? $cta['target'] : '_self';

                                    if($cta_url) :
                                    ?>
                                    <a class="btn btn-secondary" href="<?php echo esc_url( $cta_url ); ?>" target="<?php echo esc_attr( $cta_target ); ?>"><?php echo esc_html( $cta_title ); ?></a>
                                <?php endif; endif; ?>

                            </div>
                        <?php endwhile; ?>
                        <?php endif; ?>
                    <!-- </div> -->
                </div> 
            <?php endwhile; ?>
            <?php endif; ?>

            <div class="swiper-nav">
                <div class="swiper-button swiper-button-prev">
                </div>
                <div class="swiper-button swiper-button-next">
                </div>
            </div>
        </div>
</section>


