<?php
/**
 * Template part for displaying posts in the Video format.
 *
 * Shows the featured video (first embed/shortcode in content) prominently,
 * with title and excerpt below.
 *
 * @package FansPaysite
 * @since   2.3
 */
?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'fps-post-card fps-format-video' ); ?>>
	<?php
	$content = apply_filters( 'the_content', get_the_content() );
	$video   = get_media_embedded_in_content( $content, array( 'video', 'object', 'embed', 'iframe' ) );
	?>
	<?php if ( ! empty( $video ) ) : ?>
		<div class="fps-post-media fps-responsive-embed">
			<?php echo $video[0]; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
		</div>
	<?php elseif ( has_post_thumbnail() ) : ?>
		<div class="fps-post-thumbnail">
			<?php the_post_thumbnail( 'medium_large', array( 'class' => 'ui image rounded', 'loading' => 'lazy' ) ); ?>
		</div>
	<?php endif; ?>
	<div class="fps-post-body">
		<div class="fps-format-icon"><i class="fas fa-video"></i></div>
		<h2><a href="<?php the_permalink(); ?>" aria-label="<?php echo esc_attr( sprintf( __( 'Watch %s', 'fanspaysite' ), get_the_title() ) ); ?>"><?php the_title(); ?></a></h2>
		<?php the_excerpt(); ?>
	</div>
</article>
