<?php if ( get_theme_mod( 'expert_finance_manager_show_hide_sec', false ) ) : ?>
  <section id="service-sec" class="py-5 px-md-0 px-3">
    <div class="container">
      <div class="text-center">
        <?php
        // Short heading
        $expert_finance_manager_short_heading = get_theme_mod( 'expert_finance_manager_serv_short_heading', '' );
        if ( $expert_finance_manager_short_heading ) :
          ?>
          <p class="serv-short d-inline-block text-capitalize my-0 mb-2">
            <?php echo esc_html( $expert_finance_manager_short_heading ); ?>
          </p>
        <?php endif; ?>
        <?php
        $expert_finance_manager_section_title = get_theme_mod( 'expert_finance_manager_featured_section_title', '' );
        if ( $expert_finance_manager_section_title ) :
          ?>
          <h2 class="mb-lg-5 mb-4 text-capitalize">
            <?php echo esc_html( $expert_finance_manager_section_title ); ?>
          </h2>
        <?php endif; ?>
      </div>
      <?php
      $expert_finance_manager_category_slug   = get_theme_mod( 'expert_finance_manager_featured_section_category', 'uncategorized' );
      $expert_finance_manager_posts_per_page  = absint( get_theme_mod( 'expert_finance_manager_num_posts', 4 ) );
      $query = new WP_Query( array(
        'category_name'  => sanitize_title( $expert_finance_manager_category_slug ),
        'posts_per_page' => $expert_finance_manager_posts_per_page,
      ) );
      if ( $query->have_posts() ) : ?>
        <div class="services-carousel owl-carousel">
          <?php
          $expert_finance_manager_i = 1; // ← index to match the Customizer “team role” fields
          while ( $query->have_posts() ) : $query->the_post();
            ?>
            <div class="item wow bounceIn" data-wow-delay="0.5s">
              <div class="cat-inner-box">
                <?php if ( has_post_thumbnail() ) : ?>
                  <?php the_post_thumbnail( 'full', array(
                    'alt' => esc_attr( get_the_title() ),
                  ) ); ?>
                <?php else : ?>
                  <div class="post-color"></div>
                <?php endif; ?>
                <div class="inner-content px-3 py-4 text-center">
                  <h3 class="mb-2">
                    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                  </h3>
                  <?php
                  $expert_finance_manager_team_role = get_theme_mod( 'expert_finance_manager_team_role' . $expert_finance_manager_i, 'Accountant' );
                  if ( $expert_finance_manager_team_role ) :
                    ?>
                    <p class="team-role"><?php echo esc_html( $expert_finance_manager_team_role ); ?></p>
                  <?php endif; ?>
                </div>
              </div>
            </div>
            <?php
            $expert_finance_manager_i++; 
          endwhile;
          wp_reset_postdata();
          ?>
        </div>
      <?php endif; ?>
    </div>
  </section>
<?php endif; ?>