<?php
$class = isset($args['class']) ? $args['class'] : '';
?>


<section class="section bonded-warehouse-features <?php echo $class;?>">
    <div class="container">
        <div class="text-cont text-center">
            <h2 class="section-title"><?php echo get_field('bonded_warehouse_features_section_title');?></h2>
            <p class="section-content"><?php echo get_field('bonded_warehouse_features_section_text');?></p>
        </div>   
        
        <?php if( have_rows('bonded_warehouse_features__cards_repeater') ) :?>
        <div class="warehouse-features-card-wrapper">
            <div class="row gy-3 gy-lg-4 justify-content-center">
                <?php while( have_rows('bonded_warehouse_features__cards_repeater') ) : the_row();?>
                <div class="col-md-6 col-xl-4">
                    <div class="bonded-feature-card">
                        <div class="bonded-feature-title-wrapper">
                            <h2 class="bonded-feature-title"><?php echo get_sub_field('bonded_warehouse_features__cards___title');?></h2>
                            <p class="bonded-feature-content"><?php echo get_sub_field('bonded_warehouse_features__cards___text');?></p>
                        </div>

                        <div class="automated-features-wrapper <?php echo get_sub_field('bonded_warehouse_features__cards__image') ? 'bonded-inventory-tracking' : '';?>">

                            <?php if(get_sub_field('bonded_warehouse_features__cards__image')) : ?>
                            <div class="img-cont">
                                <img src="<?php echo get_sub_field('bonded_warehouse_features__cards__image');?>" class="img-fluid" alt="<?php   echo esc_attr(get_sub_field('bonded_warehouse_features__cards___title')); ?>" loading="lazy">
                            </div>
                            <?php endif;?>

                            <?php if( have_rows('bonded_warehouse_features__card_lists_repeater') ) : ?>
                            <ul>
                                <?php while( have_rows('bonded_warehouse_features__card_lists_repeater') ): the_row(); ?>
                                <li>
                                    <div class="svg-wrapper">
                                        <?php echo get_sub_field('bonded_warehouse_features__card_lists__icon');?>
                                    </div>
                                    <?php echo get_sub_field('bonded_warehouse_features__card_lists__text');?>
                                </li>
                                <?php endwhile;?>
                            </ul>
                            <?php endif;?>
                        </div>
                    </div>
                </div>
                <?php endwhile;?>
            </div>
        </div>
        <?php endif;?>
        <?php $cta = get_field('bonded_warehouse_features_section_cta');
        if($cta) :
        ?>
        <div class="d-flex justify-content-center mt-4 mt-xl-5">
            <a href="<?php echo esc_url($cta['url'])?>" class="primary animated-cta-btn"><?php echo $cta['title'];?></a>
        </div>
        <?php endif;?>
    </div>
</section>