<?php
if ( ! get_theme_mod( 'lawyer_consultant_firm_enable_offer_section', false ) ) {
	return;
}

/**
 * Render Offer Section.
 */ 
$lawyer_consultant_firm_offer_sub_heading = get_theme_mod( 'lawyer_consultant_firm_offer_sub_heading');
$lawyer_consultant_firm_offer_text = get_theme_mod( 'lawyer_consultant_firm_offer_text');
$lawyer_consultant_firm_offer_section_heading = get_theme_mod( 'lawyer_consultant_firm_offer_section_heading');
$lawyer_consultant_firm_offer_section_content = get_theme_mod( 'lawyer_consultant_firm_offer_section_content');
?>

<section id="lawyer_consultant_firm_offer_section primary" class="offer-section offer-style-1">
	<?php
	if ( is_customize_preview() ) :
		lawyer_consultant_firm_section_link( 'lawyer_consultant_firm_offer_section' );
	endif;
	?>
    <div class="offer-section-wrapper">
        <div class="asterthemes-wrapper">
            <div class="offer-single-outer">
                <div class="offer-single">
                    <div class="offer-caption">
                        <div class="offer-boxes">
                            <div class="offer-grid">
                                <?php
                                for ( $lawyer_consultant_firm_i = 1; $lawyer_consultant_firm_i <= 6; $lawyer_consultant_firm_i++ ) :
                                    $lawyer_consultant_firm_icon  = get_theme_mod( "lawyer_consultant_firm_offer_icon_{$lawyer_consultant_firm_i}", 'fas fa-balance-scale' );
                                    $lawyer_consultant_firm_title = get_theme_mod( "lawyer_consultant_firm_offer_heading_{$lawyer_consultant_firm_i}" );
                                    $lawyer_consultant_firm_link  = get_theme_mod( "lawyer_consultant_firm_offer_link_{$lawyer_consultant_firm_i}" );

                                    // Skip empty offers
                                    if ( empty( $lawyer_consultant_firm_title ) && empty( $lawyer_consultant_firm_icon ) ) {
                                        continue;
                                    }
                                    ?>
                                    
                                    <?php if ( ! empty( $lawyer_consultant_firm_link ) ) : ?>
                                        <a href="<?php echo esc_url( $lawyer_consultant_firm_link ); ?>" class="offer-item wow fadeInUp" data-wow-duration="1s" target="_blank">
                                            <div class="offer-inner">
                                                <?php if ( ! empty( $lawyer_consultant_firm_icon ) ) : ?>
                                                    <div class="offer-icon">
                                                        <i class="<?php echo esc_attr( $lawyer_consultant_firm_icon ); ?>"></i>
                                                    </div>
                                                <?php endif; ?>

                                                <?php if ( ! empty( $lawyer_consultant_firm_title ) ) : ?>
                                                    <h3 class="offer-title"><?php echo esc_html( $lawyer_consultant_firm_title ); ?></h3>
                                                <?php endif; ?>
                                            </div>
                                        </a>
                                    <?php else : ?>
                                        <div class="offer-item wow fadeInUp" data-wow-duration="1s">
                                            <div class="offer-inner">
                                                <?php if ( ! empty( $lawyer_consultant_firm_icon ) ) : ?>
                                                    <div class="offer-icon">
                                                        <i class="<?php echo esc_attr( $lawyer_consultant_firm_icon ); ?>"></i>
                                                    </div>
                                                <?php endif; ?>

                                                <?php if ( ! empty( $lawyer_consultant_firm_title ) ) : ?>
                                                    <h3 class="offer-title"><?php echo esc_html( $lawyer_consultant_firm_title ); ?></h3>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    <?php endif; ?>

                                <?php endfor; ?>
                            </div>
                            <div class="offer-catption-wrapper wow zoomIn">
                                <h3 class="offer-head-title">
                                    <?php echo esc_html( $lawyer_consultant_firm_offer_sub_heading ); ?>
                                </h3>
                                <h1 class="offer-text">
                                    <?php echo esc_html( $lawyer_consultant_firm_offer_text ); ?>
                                </h1>
                                <h1 class="offer-caption-title">
                                    <a href="<?php the_permalink(); ?>"><?php echo esc_html( $lawyer_consultant_firm_offer_section_heading ); ?></a>
                                </h1>
                                <p class="offer-caption-content">
                                    <?php echo esc_html( $lawyer_consultant_firm_offer_section_content ); ?>
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>		
        </div>
    </div>
</section>