<?php
/**
 * Single vehicle — full design-system page.
 *
 * Loaded via template_include for a singular `vehicles` view. Override by
 * copying this file to {your-theme}/automotive-feed-import/single-vehicle-page.php.
 * The classic/block page shell (theme header + footer) is provided by
 * render_aii_page_shell(); the detail markup lives in single-vehicle.php.
 *
 * Owning the document lets the plugin emit exactly one <h1> (no duplicate
 * theme post-title) — important for SEO and JSON-LD schema eligibility.
 *
 * @package AutomotiveFeedImport
 */

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

global $afi;
if (! isset($afi) || ! is_object($afi)) {
	get_header();
	get_footer();
	return;
}

$afi->render_aii_page_shell(function () use ($afi) {
	if (have_posts()) {
		the_post();
		// Detail markup is fully escaped inside get_single_vehicle_html()/partial.
		echo $afi->get_single_vehicle_html(get_the_ID()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
	}
});
