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

<section class="section why-our-wms <?php echo $class;?>">
    <div class="container">
        <div class="text-cont text-center">
            <h2 class="section-title mb-4"><?php echo get_field('wms_gradient_cards_section_title');?></h2>
            <p class="section-content"><?php echo get_field('wms_gradient_cards_section_text');?></p>
        </div>
        <?php if( have_rows('wms_gradient_cards__repeater') ): ?>
        <?php $i = 1;?>
        <div class="row gy-4 gx-2 align-items-center">
        <?php while( have_rows('wms_gradient_cards__repeater') ): the_row(); ?>
            <div class="col-lg-4 col-md-6">
                <div class="card <?php echo $i == 2 ? 'center-card' : '' ?>">
                    <div class="card-inner">
                        <div class="svg-cont">
                            <?php echo get_sub_field('wms_gradient__card_icon');?>
                        </div>
                        <div class="text-content">
                            <h3><?php echo get_sub_field('wms_gradient__card_heading');?></h3>
                            <p><?php echo get_sub_field('wms_gradient__card_text');?></p>
                        </div>
                    </div>
                </div>
            </div>
        <?php
         $i++ ;
        endwhile; ?>
        </div>
        <?php endif; ?>

        <?php $cta = get_field('wms_gradient_cards_section_cta');
        if($cta) :
        ?>
        <div class="text-center mt-5">
            <a href="<?php echo esc_url($cta['url'])?>" class="primary animated-cta-btn"><?php echo $cta['title'];?></a>
        </div>
        <?php endif;?>
    </div>
</section>