<?php
/**
 * Template Name: Variant 2
 *
 * PufferGo footer template variant 2 (Tailwind layout).
 * Uses same footer context as footer.php; different markup/CSS.
 *
 * @var PufferGo_Footer_Data $data Footer data (injected by render_variants).
 *
 * @package PufferGo
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
?>
<footer class="puffergo-footer-2 puffergo-default-footer bg-neutral-50">
	<div class="puffergo-footer-2__inner mx-auto max-w-7xl px-6 py-16 sm:py-24 lg:px-8 lg:py-32">
		<div class="puffergo-footer-2__grid xl:flex xl:flex-row xl:gap-8">
			<div class="puffergo-footer-2__logo">
				<a href="<?php echo esc_url( $data->home_url ); ?>" class="inline-flex items-center text-lg font-semibold text-neutral-900 no-underline" aria-label="<?php echo esc_attr( $data->brand_name ); ?>">
				<?php if ( ! puffergo_the_logo( 'h-8 w-auto max-w-[12rem] object-contain object-left ', array( 'loading' => 'lazy' ) ) ) : ?>
					<?php echo esc_html( $data->brand_name ? $data->brand_name : __( 'Logo', 'puffergo' ) ); ?>
				<?php endif; ?>
				</a>
			</div>
			<?php if ( ! empty( $data->sections ) ) : ?>
			<div class="puffergo-footer-2__sections mt-16 flex flex-row flex-wrap gap-8 xl:mt-0">
				<?php foreach ( $data->sections as $section ) : ?>
					<?php
					$title = isset( $section['title'] ) ? $section['title'] : '';
					$links = isset( $section['links'] ) && is_array( $section['links'] ) ? $section['links'] : array();
					if ( empty( $links ) ) {
						continue;
					}
					?>
					<div class="puffergo-footer-2__section">
						<?php if ( $title !== '' ) : ?>
							<h3 class="puffergo-footer-2__section-title text-sm/6 font-semibold text-neutral-900"><?php echo esc_html( $title ); ?></h3>
						<?php endif; ?>
						<ul role="list" class="puffergo-footer-2__links mt-6 space-y-4 m-0 list-none">
							<?php foreach ( $links as $link ) : ?>
								<?php
								$name = isset( $link['name'] ) ? $link['name'] : '';
								$url  = isset( $link['url'] ) ? $link['url'] : '';
								if ( $url === '' ) {
									continue;
								}
								if ( $name === '' ) {
									continue;
								}
								?>
								<li>
									<a href="<?php echo esc_url( $url ); ?>" class="text-sm/6 text-neutral-600 hover:text-neutral-900"><?php echo esc_html( $name ); ?></a>
								</li>
							<?php endforeach; ?>
						</ul>
					</div>
				<?php endforeach; ?>
			</div>
			<?php endif; ?>
			<?php require PUFFERGO_PLUGIN_DIR . '/templates/components/footer-empty-menu-notice.php'; ?>
		</div>
		<p class="puffergo-footer-2__copyright mt-10 text-center text-sm/6 text-neutral-600">
			<?php if ( $data->copyright_text !== '' ) : ?>
				<?php echo esc_html( $data->copyright_text ); ?>
			<?php else : ?>
				&copy; <?php echo esc_html( $data->year ); ?> <?php echo esc_html( $data->brand_name ); ?>. <?php esc_html_e( 'All rights reserved.', 'puffergo' ); ?>
			<?php endif; ?>
		</p>
	</div>
</footer>
