<?php
/**
 * Template Name: Classic
 * 产品详情页 — 经典两栏布局（左图右信息）。
 *
 * 变量作用域（由 layout 文件注入）：
 * @var PufferGo_Product_Data $data 产品数据对象。
 *
 * @package PufferGo
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
?>

<main class="puffergo-fullpage-layout puffergo-content-wrapper">
	<!-- Product Section -->
	<div class="mx-auto max-w-2xl px-4 py-16 sm:px-6 sm:py-24 lg:max-w-7xl lg:px-8">
		<?php puffergo_render_component( 'breadcrumb', array( 'items' => $data->get_breadcrumb_items() ) ); ?>

		<div class="lg:grid lg:grid-cols-2 lg:items-start lg:gap-x-8">
			<!-- Image gallery -->
			<?php puffergo_render_component( 'product-gallery', array( 'data' => $data ) ); ?>

			<!-- Product info -->
			<?php puffergo_render_component( 'product-info', array( 'data' => $data ) ); ?>
		</div>
	</div>

	<?php if ( get_the_content() ) : ?>
	<!-- Product Details Section -->
	<section class="bg-neutral-50">
		<div class="mx-auto max-w-7xl px-4 py-16 sm:px-6 sm:py-24 lg:px-8">
			<div class="lg:max-w-7xl">
				<h2 class="text-3xl font-bold tracking-tight text-neutral-900 sm:text-4xl">
					<?php esc_html_e( 'Product Details', 'puffergo' ); ?>
				</h2>
				<div class="mt-6 space-y-6 text-base text-neutral-700">
					<?php the_content(); ?>
				</div>
			</div>
		</div>
	</section>
	<?php endif; ?>

	<!-- Contact Form Section -->
	<?php if ( $data->form_enabled ) : ?>
	<div id="contact-form">
		<input type="hidden" data-pg-product-name value="<?php echo esc_attr( $data->title ); ?>">
		<?php
		$block_comment = '<!-- wp:puffergo/contact-form ' . wp_json_encode( $data->get_form_block_attrs() ) . ' /-->';
		echo do_blocks( $block_comment );
		?>
	</div>
	<?php endif; ?>
</main>
