<?php
/**
 * Main footer content — StoreCraft demo layout.
 *
 * @package Storecraft
 * @since 1.0
 */

$storecraft_news_heading     = get_theme_mod( 'storecraft_footer_newsletter_heading', __( 'Subscribe to our newsletter', 'storecraft' ) );
$storecraft_news_placeholder = get_theme_mod( 'storecraft_footer_newsletter_placeholder', __( 'Enter your email address', 'storecraft' ) );
$storecraft_shop_heading     = get_theme_mod( 'storecraft_footer_shop_heading', __( 'Quick Links', 'storecraft' ) );
$storecraft_service_heading  = get_theme_mod( 'storecraft_footer_service_heading', __( 'Store Links', 'storecraft' ) );
$storecraft_about_heading    = get_theme_mod( 'storecraft_footer_about_heading', __( 'About Us', 'storecraft' ) );
$storecraft_social_heading   = get_theme_mod( 'storecraft_footer_social_heading', __( 'Social Platform', 'storecraft' ) );
$storecraft_social_links     = storecraft_get_footer_social_links();
?>

<div class="hbs-footer-newsletter">
	<div class="container">
		<?php if ( ! empty( $storecraft_news_heading ) ) : ?>
			<h2 class="hbs-footer-newsletter-title"><?php echo esc_html( $storecraft_news_heading ); ?></h2>
		<?php endif; ?>
		<form class="hbs-footer-newsletter-form" action="#" method="post" onsubmit="return false;">
			<label class="screen-reader-text" for="hbs-footer-email"><?php esc_html_e( 'Email address', 'storecraft' ); ?></label>
			<input type="email" id="hbs-footer-email" name="hbs-footer-email" placeholder="<?php echo esc_attr( $storecraft_news_placeholder ); ?>" required />
			<button type="submit"><?php esc_html_e( 'Subscribe', 'storecraft' ); ?></button>
		</form>
	</div>
</div>

<div class="hbs-footer-main">
	<div class="container">
		<div class="hbs-footer-menus">
			<div class="hbs-footer-col">
				<?php if ( ! empty( $storecraft_shop_heading ) ) : ?>
					<h3 class="hbs-footer-heading"><?php echo esc_html( $storecraft_shop_heading ); ?></h3>
				<?php endif; ?>
				<?php
				wp_nav_menu(
					array(
						'theme_location' => 'footer-shop',
						'container'      => false,
						'menu_class'     => 'hbs-footer-menu',
						'depth'          => 1,
						'fallback_cb'    => 'storecraft_footer_menu_fallback',
					)
				);
				?>
			</div>

			<div class="hbs-footer-col">
				<?php if ( ! empty( $storecraft_service_heading ) ) : ?>
					<h3 class="hbs-footer-heading"><?php echo esc_html( $storecraft_service_heading ); ?></h3>
				<?php endif; ?>
				<?php
				wp_nav_menu(
					array(
						'theme_location' => 'footer-service',
						'container'      => false,
						'menu_class'     => 'hbs-footer-menu',
						'depth'          => 1,
						'fallback_cb'    => 'storecraft_footer_menu_fallback',
					)
				);
				?>
			</div>

			<div class="hbs-footer-col">
				<?php if ( ! empty( $storecraft_about_heading ) ) : ?>
					<h3 class="hbs-footer-heading"><?php echo esc_html( $storecraft_about_heading ); ?></h3>
				<?php endif; ?>
				<?php
				wp_nav_menu(
					array(
						'theme_location' => 'footer-about',
						'container'      => false,
						'menu_class'     => 'hbs-footer-menu',
						'depth'          => 1,
						'fallback_cb'    => 'storecraft_footer_menu_fallback',
					)
				);
				?>
			</div>

			<div class="hbs-footer-col hbs-footer-col-social">
				<?php if ( ! empty( $storecraft_social_heading ) ) : ?>
					<h3 class="hbs-footer-heading"><?php echo esc_html( $storecraft_social_heading ); ?></h3>
				<?php endif; ?>
				<?php if ( ! empty( $storecraft_social_links ) ) : ?>
					<ul class="hbs-footer-social">
						<?php foreach ( $storecraft_social_links as $storecraft_network => $storecraft_social ) : ?>
							<li>
								<a href="<?php echo esc_url( $storecraft_social['url'] ); ?>" target="_blank" rel="noopener noreferrer" aria-label="<?php echo esc_attr( $storecraft_social['label'] ); ?>">
									<?php echo wp_kses( $storecraft_social['icon'], storecraft_get_svg_allowed_html() ); ?>
								</a>
							</li>
						<?php endforeach; ?>
					</ul>
				<?php else : ?>
					<p class="hbs-footer-social-empty"><?php esc_html_e( 'Add social links in the Customizer.', 'storecraft' ); ?></p>
				<?php endif; ?>
			</div>
		</div>
	</div>
</div>

<div class="hbs-footer-brand">
	<div class="container">
		<a class="hbs-footer-wordmark" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
	</div>
</div>
