<?php
/**
 * Template Name: Custom Home Page
 */
get_header();
?>

<main role="main" id="skip_content">
  <?php do_action( 'home_tutor_above_banner' ); ?>
  <?php if ( get_theme_mod( 'home_tutor_banner_hide', false ) ) { ?>
    <section id="banner" class="mw-100 m-auto">
      <div class="container">
        <div class="row">
          <div class="col-xl-5 col-lg-5 col-md-5 col-12 align-self-end banner-left-content d-flex gap-lg-5 gap-md-3 gap-5 flex-column">
            <div class="banner-content wow zoomInLeft">
              <?php if ( get_theme_mod( 'home_tutor_banner_title') != '' ){ ?>
                <h1 class="banner-title text-capitalize pb-0 mb-4 text-lg-start text-md-start text-center">
                  <?php echo esc_html( get_theme_mod( 'home_tutor_banner_title') ); ?>
                </h1>
              <?php } ?>
              <?php if(get_theme_mod('home_tutor_banner_desc_text') != ''){ ?>
                <p class="banner-desc mb-4 text-lg-start text-md-start text-center"><?php echo esc_html(get_theme_mod('home_tutor_banner_desc_text')); ?></p>
              <?php } ?>
              <div class="banner-main-btn d-flex gap-lg-5 gap-2 justify-content-lg-start justify-content-md-start justify-content-center mb-lg-5 mb-2">
                <?php if ( get_theme_mod('home_tutor_banner_btn_text1') != '') {?>
                  <div class ="banner-btn1">
                    <a class="text-capitalize mt-1" href="<?php echo esc_url(get_theme_mod('home_tutor_banner_btn_url1'));?>"><?php echo esc_html(get_theme_mod('home_tutor_banner_btn_text1'));?><i class="fa-solid fa-angles-right ms-2"></i></a>
                  </div>
                <?php }?>
                <?php if ( get_theme_mod('home_tutor_banner_btn_text2') != '') {?>
                  <div class ="banner-btn2">
                    <a class="text-capitalize mt-1" href="<?php echo esc_url(get_theme_mod('home_tutor_banner_btn_url2'));?>"><?php echo esc_html(get_theme_mod('home_tutor_banner_btn_text2'));?><i class="fa-solid fa-angles-right ms-2"></i></a>
                  </div>
                <?php }?>
              </div>
            </div>
            <?php if ( get_theme_mod( 'home_tutor_banner_phone_box_hide', false ) ) { ?>
              <div class="banner-phone-box pe-lg-5 pe-4 py-3">
                <div class="row wow zoomIn">
                  <div class="col-xl-3 col-lg-4 col-md-3 col-4 align-self-center">
                    <?php if(get_theme_mod('home_tutor_banner_phone_icon') != ''){ ?>
                      <i class="<?php echo esc_attr(get_theme_mod('home_tutor_banner_phone_icon')); ?>"></i>
                    <?php }?>
                  </div>
                  <div class="col-xl-9 col-lg-8 col-md-9 col-8 align-self-center">
                    <?php if ( get_theme_mod( 'home_tutor_banner_phone_title') != '' ){ ?>
                      <h6 class="phone-title text-capitalize pb-2">
                        <?php echo esc_html( get_theme_mod( 'home_tutor_banner_phone_title') ); ?>
                      </h6>
                    <?php } ?>
                    <?php if(get_theme_mod('home_tutor_banner_phone_number') != ''){ ?>
                      <div class="phone">
                        <a href="tel:<?php echo esc_attr( get_theme_mod('home_tutor_banner_phone_number') ); ?>"><?php echo esc_html(get_theme_mod('home_tutor_banner_phone_number'));?></a>
                      </div>
                    <?php }?>
                  </div>
                </div>
              </div>
            <?php }?>
          </div>
          <div class="offset-xl-1 offset-lg-1 offset-md-1 col-xl-6 col-lg-6 col-md-6 col-12 align-self-end banner-img-box text-end">
            <div class="row">
              <div class="col-xl-6 col-lg-6 col-md-6 col-12 banner-middle mb-lg-5 mb-md-3">
                <?php for ($home_tutor_i=0; $home_tutor_i < 3 ; $home_tutor_i++) { ?>
                  <?php if(get_theme_mod('home_tutor_banner_mid_box_icon' .$home_tutor_i) != '' || get_theme_mod('home_tutor_banner_mid_text' .$home_tutor_i) != ''){ ?>
                    <div class="banner-mid-box d-flex align-items-center gap-3 gap-md-2 gap-lg-3 mb-lg-5 mb-4 py-1 ps-1 pe-3 wow rollIn">
                      <i class="<?php echo esc_attr(get_theme_mod('home_tutor_banner_mid_box_icon' .$home_tutor_i)); ?>"></i>
                      <p class="banner-mid-text text-capitalize"><?php echo esc_html(get_theme_mod('home_tutor_banner_mid_text' .$home_tutor_i)); ?></p>
                    </div>
                  <?php }?>
                <?php } ?>
                <?php if(get_theme_mod('home_tutor_banner_mid_count') != '' || get_theme_mod('home_tutor_banner_mid_count_text') != ''){ ?>  
                  <div class="count-box p-4 wow rollIn">
                    <p class="banner-mid-count text-center"><?php echo esc_html(get_theme_mod('home_tutor_banner_mid_count')); ?></p>
                    <p class="banner-count-text text-center text-capitalize"><?php echo esc_html(get_theme_mod('home_tutor_banner_mid_count_text')); ?></p>
                  </div>
                <?php } ?>
              </div>
              <div class="col-xl-6 col-lg-6 col-md-6 col-12 banner-end-box ps-lg-5 ps-md-3 ps-0">
                <?php if ( get_theme_mod('home_tutor_banner_right_image') != "" ) {?>
                  <div class="banner-right-img">
                    <img class="banner-img position-relative wow zoomIn" src="<?php echo esc_url(get_theme_mod('home_tutor_banner_right_image')); ?>">
                  </div>
                <?php }?>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="clearfix"></div>
    </section>
  <?php }?>
  <?php do_action( 'home_tutor_below_banner' ); ?>

  <!-- Resources Section -->
  <?php if( get_theme_mod( 'home_tutor_section_title') != '' || get_theme_mod( 'home_tutor_section_small_text') != '' || get_theme_mod( 'home_tutor_popular_resources_category') != '') { ?>
    <section id="resources-sec" class="py-5 mt-5">
      <div class="container">
        <div class="row wow fadeInDown">
          <div class="col-xl-9 col-lg-9 col-md-8 col-12 align-self-center">
            <div class="heading-box text-lg-start text-md-start text-center">
              <?php if( get_theme_mod( 'home_tutor_section_sub_title') != '') { ?>  
                <p class="section-desc text-capitalize mb-2 position-relative"><?php echo esc_html(get_theme_mod('home_tutor_section_sub_title'));?></p>
              <?php } ?>
              <?php if( get_theme_mod( 'home_tutor_section_title') != '') { ?>  
                <h2 class="section-heading text-capitalize pb-0"><?php echo esc_html(get_theme_mod('home_tutor_section_title'));?></h2>
              <?php } ?>
            </div>
          </div>
          <div class="col-xl-3 col-lg-3 col-md-4 col-12 align-self-center text-lg-end text-md-end text-center">
            <div class ="resources-sec-btn">
              <a class="text-capitalize" href="<?php echo esc_url(get_theme_mod('home_tutor_resources_section_btn_url'));?>"><?php echo esc_html(get_theme_mod('home_tutor_resources_section_btn_text'));?><i class="fa-solid fa-angles-right ms-2"></i></a>
            </div>
          </div>
        </div>
        <div class="resources-btm-boxes mt-lg-4 mt-md-4 mt-5">
          <div class="row">
            <?php
              $home_tutor_catData =  get_theme_mod('home_tutor_our_resources');
              if($home_tutor_catData){
              $home_tutor_page_query = new WP_Query(array( 'category_name' => esc_html($home_tutor_catData,'home-tutor'))); ?>
              <?php while( $home_tutor_page_query->have_posts() ) : $home_tutor_page_query->the_post(); ?>
              <div class="col-xl-3 col-lg-4 col-md-6 col-12 resources">
                <div class="box mb-5 p-4 wow rollIn">
                  <div class="resources-img position-relative">
                    <?php the_post_thumbnail(); ?>
                    <?php if( get_theme_mod('home_tutor_practice_button_text','Read More') != ''){ ?>
                      <div class="resources-btn-box position-absolute">
                        <a class="resources-btn" href="<?php echo esc_url(get_permalink()); ?>"><?php echo esc_html(get_theme_mod('home_tutor_practice_button_text',__('Read More','home-tutor')));?><span class="screen-reader-text"><?php the_title(); ?></span></a>
                      </div>
                    <?php } ?>
                  </div>
                  <div class="box-content mt-4">
                    <h5 class="title pb-0 position-relative"><?php the_title(); ?></h5>
                  </div>
                </div>
              </div>
            <?php endwhile;
              wp_reset_postdata();
            } ?>
          </div>
        </div>
      </div>
    </section>
  <?php }?>

  <div class="container front-page-content mt-4">
    <?php while ( have_posts() ) : the_post(); ?>
      <div class="new-text"><?php the_content(); ?></div>
    <?php endwhile; // end of the loop. ?>
  </div>
</main>

<?php get_footer(); ?>