<section id="<?php the_sub_field('section_id');?>" class="section-boxes-repeater <?php the_sub_field('section_additional_class');?>" <?php if (get_sub_field('section_bg')) { ?> style="background-image: url('<?php the_sub_field('section_bg'); ?>');" <?php } ?>>

    <?php if (get_sub_field('section_bg')) { ?>
        <span class="bg-filter"></span>
    <?php } ?>

    <div class="wrapper wrapper--inner">
        <h2 class="section-heading heading--md">
            <?php the_sub_field('section_heading');?>
        </h2>
        <p class="section-description">
            <?php the_sub_field('section_description');?>
        </p>
        <div class="boxes <?php the_sub_field('cards-style'); ?>">
            <?php if (have_rows('repeater')) : ?>
                <?php while (have_rows('repeater')) : the_row(); ?>
                    <div class="box-single <?php the_sub_field('additional_box_class');?>">
                        <?php if (the_sub_field('section_additional_class') != 'numbered-cards') : ?>
                            <span class="box-counter"></span>
                        <?php endif; ?>
                        <?php 
                            $image = get_sub_field('image');
                            if( !empty( $image ) ): ?>
                            <div class="box-image">
                                <img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" class="img-auto"/>
                            </div>
                        <?php endif; ?>
                        <div class="box-content">
                            <?php if(get_sub_field('heading')):?>
                                <h3 class="box-content__heading heading--sm">
                                    <?php the_sub_field('heading')?>
                                </h3>
                            <?php endif;?>
                            <?php if(get_sub_field('text')):?>
                                <p class="box-content__text text-bold">
                                    <?php the_sub_field('text')?>
                                </p>
                            <?php endif;?>
                            <?php if(get_sub_field('cta', 'cta_url')):?>
                                <div class="cta">
                                    <a href="<?php the_sub_field('cta_url')?>" class="btn-link">
                                        <?php the_sub_field('cta')?>
                                    </a>
                                </div>
                            <?php endif;?>
                        </div>
                    </div>
                    <?php if (have_rows('values')) : ?>
                            <div class="box-relations" style="background-image: url('<?php echo get_stylesheet_directory_uri(); ?>/images/arrow.png');">
                                <?php while (have_rows('values')) : the_row(); ?>
                                <h3 class="box-relations__single heading-red heading">
                                    <?php the_sub_field('single_value')?>
                                </h3>
                                <?php endwhile; ?>
                            </div>
                        <?php endif; ?>
                <?php endwhile; ?>
            <?php endif; ?>
        </div>
    </div>
</section>