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

<section class="section faqs <?php echo $class;?>">
    <div class="container">
        <div class="text-cont slide-down">
            <h2 class="section-title"><?php echo get_field('cold_chain_faqs_heading'); ?></h2>
        </div>

        <?php if( have_rows('cold_chain_qnas') ): 
            $i = 1;
        ?>
        <div class="accordion" id="faqs-accordion">

                <?php while( have_rows('cold_chain_qnas') ): the_row();  ?>
                <div class="accordion-item slide-down">
                    <h2 class="accordion-header" id="heading<?php echo $i; ?>">
                        <button class="accordion-button <?php echo $i == 1 ? '' : 'collapsed';?>" type="button" data-bs-toggle="collapse" data-bs-target="#collapse<?php echo $i; ?>" aria-expanded="<?php echo $i==1 ? 'true' : 'false'; ?>" aria-controls="collapse<?php echo $i; ?>">
                            <?php echo get_sub_field('questions'); ?>
                        </button>
                    </h2>
                    <div id="collapse<?php echo $i; ?>" class="accordion-collapse collapse <?php echo $i==1 ? 'show' : '';?>" aria-labelledby="heading<?php echo $i; ?>" data-bs-parent="#faqs-accordion">
                        <div class="accordion-body">
                            <?php echo get_sub_field('answer'); ?>
                        </div>
                    </div>
                </div>
                <?php $i++;?>
                <?php endwhile; ?>
                <?php endif; ?>
        </div>
    </div>
</section>