<?php
/**
 * Template Name: Home Custom Page
 */
?>

<?php get_header(); ?>

<main id="main" role="main">
  <?php do_action( 'pr_agency_above_slider' ); ?>

  <?php if ( get_theme_mod( 'pr_agency_banner_hide_show', false ) != '' ) : ?>
  <section id="pr-banner" class="pr-banner-section">
    <div class="pr-banner-overlay"></div>
    <div class="pr-banner-inner">
      <div class="container">
        <div class="row align-items-center">
          <div class="col-lg-5 pr-banner-collage-col">
            <div class="pr-collage">
              <?php
                $pr_agency_collage_img_1 = get_theme_mod( 'pr_agency_banner_img_1', '' );
                $pr_agency_collage_img_2 = get_theme_mod( 'pr_agency_banner_img_2', '' );
                $pr_agency_collage_img_3 = get_theme_mod( 'pr_agency_banner_img_3', '' );
              ?>
              <div class="pr-collage-grid">
                  <?php if ( $pr_agency_collage_img_1 ) : ?>
                    <div class="pr-collage-cell pr-collage-cell-1">
                        <img src="<?php echo esc_url( $pr_agency_collage_img_1 ); ?>" alt="">
                    </div>
                  <?php endif; ?>
                  <?php if ( $pr_agency_collage_img_2 ) : ?>
                    <div class="pr-collage-cell pr-collage-cell-2">
                        <img src="<?php echo esc_url( $pr_agency_collage_img_2 ); ?>" alt="">
                    </div>
                  <?php endif; ?>
                  <?php if ( $pr_agency_collage_img_3 ) : ?>
                    <div class="pr-collage-cell pr-collage-cell-3">
                        <img src="<?php echo esc_url( $pr_agency_collage_img_3 ); ?>" alt="">
                    </div>
                  <?php endif; ?>
                <?php if ( $pr_agency_collage_img_1 && $pr_agency_collage_img_2 && $pr_agency_collage_img_3 ) : ?>
                <div class="pr-collage-cell pr-collage-cell-4"></div>
                <?php endif; ?>
              </div>
            </div>
          </div>

          <div class="col-lg-7 pr-banner-content-col">
            <div class="pr-banner-content">
              <?php
                $pr_agency_banner_heading   = get_theme_mod( 'pr_agency_banner_heading', '' );
                $pr_agency_banner_desc      = get_theme_mod( 'pr_agency_banner_desc', '' );
                $pr_agency_banner_btn1_text = get_theme_mod( 'pr_agency_banner_btn1_text', '' );
                $pr_agency_banner_btn1_url  = get_theme_mod( 'pr_agency_banner_btn1_url', '#' );
                $pr_agency_banner_btn2_text = get_theme_mod( 'pr_agency_banner_btn2_text', '' );
                $pr_agency_banner_btn2_url  = get_theme_mod( 'pr_agency_banner_btn2_url', '#' );
              ?>
              <?php if ( $pr_agency_banner_heading ) : ?>
              <h2 class="pr-banner-heading"><?php echo esc_html( $pr_agency_banner_heading ); ?></h2>
              <?php endif; ?>
              <?php if ( $pr_agency_banner_desc ) : ?>
              <p class="pr-banner-desc"><?php echo esc_html( $pr_agency_banner_desc ); ?></p>
              <?php endif; ?>
              <?php if ( $pr_agency_banner_btn1_text || $pr_agency_banner_btn2_text ) : ?>
              <div class="pr-banner-buttons">
                <?php if ( $pr_agency_banner_btn1_text ) : ?>
                <a href="<?php echo esc_url( $pr_agency_banner_btn1_url ); ?>" class="pr-banner-btn-outline"><?php echo esc_html( $pr_agency_banner_btn1_text ); ?></a>
                <?php endif; ?>
                <?php if ( $pr_agency_banner_btn2_text ) : ?>
                <a href="<?php echo esc_url( $pr_agency_banner_btn2_url ); ?>" class="pr-banner-btn-primary"><?php echo esc_html( $pr_agency_banner_btn2_text ); ?></a>
                <?php endif; ?>
              </div>
              <?php endif; ?>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>
  <?php endif; ?>

  <?php do_action( 'pr_agency_below_slider' ); ?>

  <section id="feature-section">
    <?php
    $pr_agency_pkg_heading = get_theme_mod( 'pr_agency_packages_heading', '' );
    $pr_agency_pkg_subtext = get_theme_mod( 'pr_agency_packages_subtext', '' );
    $pr_agency_has_pkg = false;
    for ( $pr_agency_i = 1; $pr_agency_i <= 3; $pr_agency_i++ ) {
      if ( get_theme_mod( 'pr_agency_package_' . $pr_agency_i . '_name' ) != '' || get_theme_mod( 'pr_agency_package_' . $pr_agency_i . '_img' ) != '' ) {
        $pr_agency_has_pkg = true;
        break;
      }
    }
    if ( $pr_agency_pkg_heading != '' || $pr_agency_pkg_subtext != '' || $pr_agency_has_pkg ) : ?>
    <div class="container">
      <?php if ( $pr_agency_pkg_heading != '' || $pr_agency_pkg_subtext != '' ) : ?>
      <div class="packages-head text-center mb-5">
        <?php if ( $pr_agency_pkg_heading != '' ) : ?>
          <h2 class="packages-title"><?php echo esc_html( $pr_agency_pkg_heading ); ?></h2>
        <?php endif; ?>
        <?php if ( $pr_agency_pkg_subtext != '' ) : ?>
          <p class="packages-desc"><?php echo esc_html( $pr_agency_pkg_subtext ); ?></p>
        <?php endif; ?>
      </div>
      <?php endif; ?>
      <div class="row justify-content-center">
        <?php for ( $pr_agency_i = 1; $pr_agency_i <= 3; $pr_agency_i++ ) :
          $pr_agency_pkg_img   = get_theme_mod( 'pr_agency_package_' . $pr_agency_i . '_img', '' );
          $pr_agency_pkg_name  = get_theme_mod( 'pr_agency_package_' . $pr_agency_i . '_name', '' );
          $pr_agency_pkg_desc  = get_theme_mod( 'pr_agency_package_' . $pr_agency_i . '_desc', '' );
          $pr_agency_pkg_url   = get_theme_mod( 'pr_agency_package_' . $pr_agency_i . '_url', '#' );
          $pr_agency_pkg_btn   = get_theme_mod( 'pr_agency_package_' . $pr_agency_i . '_btn', __( 'Read More', 'pr-agency' ) );
          if ( $pr_agency_pkg_img == '' && $pr_agency_pkg_name == '' ) : ?>
            <?php continue; ?>
          <?php endif; ?>
          <div class="col-lg-4 col-md-6 mb-4 packet">
            <div class="package-card">
              <div class="package-img-wrap">
                <?php if ( $pr_agency_pkg_img != '' ) : ?>
                  <img src="<?php echo esc_url( $pr_agency_pkg_img ); ?>" alt="<?php echo esc_attr( $pr_agency_pkg_name ); ?>">
                <?php endif; ?>
              </div>
            </div>
                <div class="package-info">
                  <?php if ( $pr_agency_pkg_name != '' ) : ?>
                    <h3 class="package-name"><?php echo esc_html( $pr_agency_pkg_name ); ?></h3>
                  <?php endif; ?>
                  <?php if ( $pr_agency_pkg_desc != '' ) : ?>
                    <p class="package-desc"><?php echo esc_html( $pr_agency_pkg_desc ); ?></p>
                  <?php endif; ?>
                  <a href="<?php echo esc_url( $pr_agency_pkg_url ); ?>" class="package-btn">
                    <?php echo esc_html( $pr_agency_pkg_btn ? $pr_agency_pkg_btn : __( 'Read More', 'pr-agency' ) ); ?> &rarr;
                  </a>
                </div>
          </div>
        <?php endfor; ?>
      </div>
    </div>
    <?php endif; ?>
  </section>

  <div class="container entry-content">
    <?php while ( have_posts() ) : the_post(); ?>
      <?php the_content(); ?>
    <?php endwhile; // end of the loop. ?>
  </div>
</main>
<?php get_footer(); ?>