<?php
/**
 * Introduction — compatibilité PHP.
 *
 * @package PCC
 * @license GPL-2.0-or-later
 */

defined( 'ABSPATH' ) || exit;

$intro_collapsed = PCC_Admin::is_intro_collapsed();
?>
<section
	class="pcc-intro<?php echo $intro_collapsed ? ' is-collapsed' : ''; ?>"
	id="pcc-intro"
	aria-labelledby="pcc-intro-title"
>
	<div class="pcc-intro-icon" aria-hidden="true">🔧</div>
	<div class="pcc-intro-body">
		<div class="pcc-intro-head">
			<h2 id="pcc-intro-title"><?php esc_html_e( 'What does this plugin do?', 'php-compatibility-checker-by-volade' ); ?></h2>
			<button
				type="button"
				class="button-link pcc-intro-toggle"
				aria-expanded="<?php echo $intro_collapsed ? 'false' : 'true'; ?>"
				aria-controls="pcc-intro-content"
				data-label-collapse="<?php esc_attr_e( 'Collapse', 'php-compatibility-checker-by-volade' ); ?>"
				data-label-expand="<?php esc_attr_e( 'Show introduction', 'php-compatibility-checker-by-volade' ); ?>"
			>
				<?php echo $intro_collapsed ? esc_html__( 'Show introduction', 'php-compatibility-checker-by-volade' ) : esc_html__( 'Collapse', 'php-compatibility-checker-by-volade' ); ?>
			</button>
		</div>
		<div class="pcc-intro-collapsible" id="pcc-intro-content"<?php echo $intro_collapsed ? ' hidden' : ''; ?>>
			<p class="pcc-intro-lead">
				<?php esc_html_e( 'Before upgrading PHP on your host, scan your plugins and themes for code that may break on the target version.', 'php-compatibility-checker-by-volade' ); ?>
			</p>
			<p>
				<?php esc_html_e( 'PHP Compatibility Checker by Volade runs locally on your server — no external API. Results list errors (will break) and warnings (deprecations) with file and line number.', 'php-compatibility-checker-by-volade' ); ?>
			</p>

			<ol class="pcc-workflow">
				<li class="pcc-workflow-step">
					<span class="pcc-workflow-num" aria-hidden="true">1</span>
					<div>
						<strong><?php esc_html_e( 'Choose a preset', 'php-compatibility-checker-by-volade' ); ?></strong>
						<span><?php esc_html_e( 'Target PHP 8.3, 8.4, or the next version from your server.', 'php-compatibility-checker-by-volade' ); ?></span>
					</div>
				</li>
				<li class="pcc-workflow-step">
					<span class="pcc-workflow-num" aria-hidden="true">2</span>
					<div>
						<strong><?php esc_html_e( 'Run the scan', 'php-compatibility-checker-by-volade' ); ?></strong>
						<span><?php esc_html_e( 'Active plugins and theme first — vendor folders skipped by default.', 'php-compatibility-checker-by-volade' ); ?></span>
					</div>
				</li>
				<li class="pcc-workflow-step">
					<span class="pcc-workflow-num" aria-hidden="true">3</span>
					<div>
						<strong><?php esc_html_e( 'Fix & validate', 'php-compatibility-checker-by-volade' ); ?></strong>
						<span><?php esc_html_e( 'Resolve errors, export JSON, then test on staging before switching PHP.', 'php-compatibility-checker-by-volade' ); ?></span>
					</div>
				</li>
			</ol>

			<ul class="pcc-intro-list">
				<li><strong><?php esc_html_e( 'Errors', 'php-compatibility-checker-by-volade' ); ?></strong> — <?php esc_html_e( 'fix these before upgrading PHP.', 'php-compatibility-checker-by-volade' ); ?></li>
				<li><strong><?php esc_html_e( 'Warnings', 'php-compatibility-checker-by-volade' ); ?></strong> — <?php esc_html_e( 'deprecated code that may still run but should be updated.', 'php-compatibility-checker-by-volade' ); ?></li>
				<li><strong><?php esc_html_e( 'Staging', 'php-compatibility-checker-by-volade' ); ?></strong> — <?php esc_html_e( 'always test on staging after fixing reported issues.', 'php-compatibility-checker-by-volade' ); ?></li>
			</ul>

			<div class="pcc-feature-badges">
				<span class="pcc-feature-badge"><?php esc_html_e( '100% local scan', 'php-compatibility-checker-by-volade' ); ?></span>
				<span class="pcc-feature-badge"><?php esc_html_e( 'No external API', 'php-compatibility-checker-by-volade' ); ?></span>
				<span class="pcc-feature-badge"><?php esc_html_e( 'JSON export free', 'php-compatibility-checker-by-volade' ); ?></span>
				<span class="pcc-feature-badge"><?php esc_html_e( 'Runtime deprecations', 'php-compatibility-checker-by-volade' ); ?></span>
			</div>

			<p class="pcc-intro-tip">
				<?php esc_html_e( 'Tip: use a preset, run the scan, then export the JSON report. No Volade account required for the essentials.', 'php-compatibility-checker-by-volade' ); ?>
			</p>
		</div>
	</div>
</section>
