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

$profile_id   = $args['profile_id'] ?? '';
$profile_name = $args['profile_name'] ?? '';

$intro_poster_id = gigneo_post_meta( $profile_id, '_gigneo_pm_intro_poster' );
$intro_video_id  = gigneo_post_meta( $profile_id, '_gigneo_pm_intro_video' );
$intro_video_url = ! empty( $intro_video_id ) ? wp_get_attachment_url( $intro_video_id ) : '';

if ( empty( $profile_id ) || empty( $intro_video_url ) ) {
	return;
}
?>
<div class="gn-section gn-intro-section">
	<div class="gn-head">
		<h4 class="gn-title">
			<?php
			printf(
			// translators: %s is profile name
				esc_html__( 'Meet %s', 'gigneo' ),
				esc_html( $profile_name )
			);
			?>
		</h4>
	</div>
	<div class="gn-body">
		<figure class="gn-intro-video">
			<?php gigneo_attachment_image_src( $intro_poster_id ?? 0, 'large' ); ?>
			<?php if ( ! empty( $intro_video_url ) ) { ?>
				<a href="<?php echo esc_url( $intro_video_url ); ?>" data-gn-fancybox class="gn-play-video-toggle">
					<i class="hi hi-play" aria-hidden="true"></i>
				</a>
			<?php } ?>
		</figure>
	</div>
</div>
