<!-- About Section -->

<div class="container ">
      <!-- <img src="assets/img/Team.png" class="attorneys__back" alt=""> -->
      <p class=" title-span-head">Legal Expertise</p>
      <p>At Nzamba Kitonga Advocates LLP, we excel in providing tailored legal solutions that empower our clients to
        thrive in their industries. Our commitment to excellence and innovative thinking sets us apart, positioning us
        as one of the top law firms in the country. Our proactive approach ensures that we address legal challenges
        effectively, both domestically and internationally. When you choose Nzamba Kitonga Advocates LLP, you're
        partnering with a team of dedicated professionals who are committed to your success.
      </p>

    </div>

    
    <div class="container capabilities">
    <div class="row">
        <?php
        // Custom Query for 'legal' post type
        $args = array(
            'post_type'      => 'legal',
            'posts_per_page' => 100, // Retrieve all posts
        );

        $query = new WP_Query($args);

        // Check if there are any posts
        if ($query->have_posts()) :
            while ($query->have_posts()) : $query->the_post();
                
                // Check if the repeater field has rows
                if (have_rows('legal_expert')) :
                    while (have_rows('legal_expert')) : the_row();
                        // Get sub-field values
                        $svg_url = get_sub_field('external_svg_image'); // URL of the SVG image
                        $title = get_sub_field('title'); // Title
                        $progress = get_sub_field('progress'); // Progress percentage
                        $link = get_sub_field('link'); // Link
                        ?>

                        <div class="col-md-4 pb-5">
                            <div class="card rounded-card">
                                <div class="img-wrapper">
                                    <?php if ($svg_url) : ?>
                                        <img class="img-fluid" src="<?php echo esc_url($svg_url); ?>" alt="<?php echo esc_attr($title); ?>" />
                                    <?php endif; ?>
                                </div>
                                <h3><?php echo esc_html($title); ?></h3>
                                <div class="progress">
                                    <div class="progress-bar" role="progressbar" style="width: <?php echo esc_attr($progress); ?>%;" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
                                </div>
                            
                                <?php
                                // Check if $link is an array and contains 'url'
                                if (is_array($link) && isset($link['url']) && !empty($link['url'])) :
                                    $link_url = esc_url($link['url']);
                                    $link_title = esc_html($link['title']);
                                ?>
                                    <a href="<?php echo $link_url; ?>" class="link">Learn More <i class="fab fa-plus"></i></a>
                                <?php else : ?>
                                    <p>No link available.</p>
                                <?php endif; ?>
                              
                            </div>
                        </div>

                    <?php
                    endwhile;
                endif;

            endwhile;
            wp_reset_postdata(); // Reset post data
        else :
            // No posts found
            ?>
            <p>No legal services found.</p>
        <?php endif; ?>
    </div>
</div>

</div>

</div>
