<section class="section inventory-cycle">
    <div class="container">
        <h2 class="section-title text-center"><?php echo get_field('cycle_title'); ?></h2>
        <p class="section-content text-center"><?php echo get_field('cycle_description'); ?></p>

        <div class="row mt-3 mt-lg-5 gy-4">
            <div class="col-lg-5">
                <?php
                    $inventory_optimization_link = get_field('inventory_optimization_link');
                    echo isset($inventory_optimization_link) && !empty($inventory_optimization_link) ? '<a aria-label="For Inventory Optimization Card Link" href="' . $inventory_optimization_link . '" class="text-decoration-none">' : '';
                ?>
                <div class="card inventory-card">
                    <div class="card-header">
                        <h2 class="card-title text-center"><?php echo get_field('inventory_optimization_title'); ?></h2>
                        <p class="card-description text-center mb-5"><?php echo get_field('inventory_optimization_description'); ?></p>
                    </div>
                    <div class="card-body d-flex align-items-end justify-content-end">
                        <div class="img-cont ms-lg-2">
                            <img src="<?php echo get_field('inventory_optimization_image'); ?>" alt="<?php echo get_field('inventory_optimization_title'); ?>" class="img-fluid" loading="lazy">    
                        </div>
                    </div>
                </div>
                <?php echo isset($inventory_optimization_link) && !empty($inventory_optimization_link) ? '</a>' : ''; ?>
            </div>
            <div class="col-lg-7">
                <div class="row gy-3">
                    <div class="col-lg-12">
                        <?php
                            $warehouse_management_link = get_field('warehouse_management_link');
                            echo isset($warehouse_management_link) && !empty($warehouse_management_link) ? '<a href="' . $warehouse_management_link . '" class="text-decoration-none">' : '';
                        ?>
                        <div class="card warehouse-card">
                            <div class="card-body">
                                <div class="row gx-0">
                                    <div class="col-md-7">
                                        <div class="card-header">
                                            <h2 class="card-title"><?php echo get_field('warehouse_management_title'); ?></h2>
                                            <p class="card-description mb-5"><?php echo get_field('warehouse_management_description'); ?></p>
                                        </div>
                                    </div>
                                    <div class="col-md-5 d-flex justify-content-center align-items-center">
                                        <div class="img-cont">
                                            <img src="<?php echo get_field('warehouse_management_image'); ?>" alt="<?php echo get_field('warehouse_management_title'); ?>" class="img-fluid" loading="lazy">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php echo isset($warehouse_management_link) && !empty($warehouse_management_link) ? '</a>' : ''; ?>
                    </div>

                    <div class="col-lg-12">
                        <?php
                            $order_fulfillment_link = get_field('order_fulfillment_link');
                            echo isset($order_fulfillment_link) && !empty($order_fulfillment_link) ? '<a href="' . $order_fulfillment_link . '" class="text-decoration-none">' : '';
                        ?>
                        <div class="card faster-order-card">
                            <div class="card-body">
                                <div class="row">
                                    <div class="col-md-7">
                                        <div class="card-header">
                                            <h2 class="card-title"><?php echo get_field('order_fulfillment_title'); ?></h2>
                                            <p class="card-description mb-5"><?php echo get_field('order_fulfillment_description'); ?></p>
                                        </div>
                                    </div>
                                    <div class="col-md-5 d-flex justify-content-end align-items-end">
                                        <div class="img-cont">
                                            <img src="<?php echo get_field('order_fulfillment_image'); ?>" alt="<?php echo get_field('order_fulfillment_title'); ?>" class="img-fluid" loading="lazy">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php echo isset($order_fulfillment_link) && !empty($order_fulfillment_link) ? '</a>' : ''; ?>
                    </div>
                </div>
            </div>

            <div class="col-lg-7">
                <div class="row gy-3">
                    <div class="col-lg-12">
                        <?php
                            $forecasting_link = get_field('forecasting_link');
                            echo isset($forecasting_link) && !empty($forecasting_link) ? '<a href="' . $forecasting_link . '" class="text-decoration-none">' : '';
                        ?>
                        <div class="card forecast-card">
                            <div class="card-body">
                                <div class="row gx-0">
                                    <div class="col-md-7">
                                        <div class="card-header">
                                            <h2 class="card-title"><?php echo get_field('forecasting_title'); ?></h2>
                                            <p class="card-description mb-5"><?php echo get_field('forecasting_description'); ?></p>
                                        </div>
                                    </div>
                                    <div class="col-md-5 d-flex justify-content-center align-items-center">
                                        <div class="img-cont">
                                            <img src="<?php echo get_field('forecasting_image'); ?>" alt="<?php echo get_field('forecasting_title'); ?>" class="img-fluid" loading="lazy">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php echo isset($forecasting_link) && !empty($forecasting_link) ? '</a>' : ''; ?>
                    </div>

                    <div class="col-lg-12">
                        <?php
                            $realtime_insights_link = get_field('realtime_insights_link');
                            echo isset($realtime_insights_link) && !empty($realtime_insights_link) ? '<a href="' . $realtime_insights_link . '" class="text-decoration-none">' : '';
                        ?>
                        <div class="card realtime-card">
                            <div class="card-body">
                                <div class="row">
                                    <div class="col-md-7">
                                        <div class="card-header">
                                            <h2 class="card-title"><?php echo get_field('realtime_insights_title'); ?></h2>
                                            <p class="card-description mb-5"><?php echo get_field('realtime_insights_description'); ?></p>
                                        </div>
                                    </div>
                                    <div class="col-md-5 d-flex justify-content-end align-items-end">
                                        <div class="img-cont">
                                            <img src="<?php echo get_field('realtime_insights_image'); ?>" alt="<?php echo get_field('realtime_insights_title'); ?>" class="img-fluid" loading="lazy">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php echo isset($realtime_insights_link) && !empty($realtime_insights_link) ? '</a>' : ''; ?>
                    </div>
                </div>
            </div>

            <div class="col-lg-5">
                <?php
                    $order_management_link = get_field('order_management_link');
                    echo isset($order_management_link) && !empty($order_management_link) ? '<a href="' . $order_management_link . '" class="text-decoration-none">' : '';
                ?>
                <div class="card order-management-card">
                    <div class="card-header">
                        <h2 class="card-title text-center"><?php echo get_field('order_management_title'); ?></h2>
                        <p class="card-description text-center mb-5"><?php echo get_field('order_management_description'); ?></p>
                    </div>
                    <div class="card-body d-flex align-items-end justify-content-end">
                        <div class="img-cont">
                            <img src="<?php echo get_field('order_management_image'); ?>" alt="<?php echo get_field('order_management_title'); ?>" class="img-fluid" loading="lazy">    
                        </div>
                    </div>
                </div>
                <?php echo isset($order_management_link) && !empty($order_management_link) ? '</a>' : ''; ?>
            </div>
        </div>
    </div>
</section>
