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

$service_id = $args['p_id'] ?? get_the_ID();

$service_faqs = gigneo_post_meta( $service_id, '_gigneo_pm_faqs' );

if ( empty( $service_faqs ) || ! is_array( $service_faqs ) ) {
	return;
}
?>
<div class="gn-section gn-description-section">
	<div class="gn-head">
		<h3 class="gn-title"><?php echo esc_html__( 'FAQs', 'gigneo' ); ?></h3>
	</div>
	<div class="gn-body">
		<div class="gn-accordion-wrapper">
			<?php
			foreach ( $service_faqs as $key => $faq ) {
				?>
				<div class="gn-accordion-item">
					<div class="gn-head">
						<h4 class="gn-title"><?php echo esc_html( $faq['question'] ); ?></h4>
						<button type="button" class="gn-toggle">
							<i class="hi hi-chevron-down" aria-hidden="true"></i>
						</button>
					</div>
					<div class="gn-body">
						<pre class="gn-pre"><?php echo wp_kses( $faq['answer'], gigneo_allowed_html_tags() ); ?></pre>
					</div>
				</div>
			<?php } ?>
		</div>
	</div>
</div>
