<?php
/**
 * Template Name: Magazine Hero Article
 * Template Post Type: post
 *
 * @package HaPantheon
 */

get_header();
while ( have_posts() ) :
	the_post();
	?>
	<article id="post-<?php the_ID(); ?>" <?php post_class( 'article-magazine-template' ); ?>>
		<header class="mag-hero">
			<img decoding="async" src="<?php echo esc_url( hapantheon_featured_image_url( get_the_ID(), 'full' ) ); ?>" alt="<?php echo esc_attr( get_the_title() ); ?>">
			<div class="mag-hero-in">
				<span class="eyebrow"><?php echo esc_html( hapantheon_category_label() ); ?></span>
				<h1><?php the_title(); ?></h1>
				<?php hapantheon_post_meta_row(); ?>
			</div>
			<div class="meander" aria-hidden="true"></div>
		</header>

		<div class="wrap art-body article-content magazine-content">
			<?php the_content(); ?>
			<?php hapantheon_share_row(); ?>
			<?php hapantheon_author_box(); ?>
			<?php hapantheon_adjacent_navigation(); ?>
		</div>
	</article>

	<div class="float-bar" role="toolbar" aria-label="<?php esc_attr_e( 'פעולות מהירות', 'hapantheon' ); ?>">
		<a href="https://wa.me/?text=<?php echo rawurlencode( get_the_title() . ' ' . get_permalink() ); ?>" target="_blank" rel="noopener noreferrer" aria-label="<?php esc_attr_e( 'שיתוף ב-WhatsApp', 'hapantheon' ); ?>"><?php echo hapantheon_icon( 'whatsapp' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></a>
		<a href="https://t.me/share/url?url=<?php echo rawurlencode( get_permalink() ); ?>&amp;text=<?php echo rawurlencode( get_the_title() ); ?>" target="_blank" rel="noopener noreferrer" aria-label="<?php esc_attr_e( 'שיתוף ב-Telegram', 'hapantheon' ); ?>"><?php echo hapantheon_icon( 'telegram' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></a>
		<button type="button" data-fb="copy" data-copy-url="<?php the_permalink(); ?>" aria-label="<?php esc_attr_e( 'העתקת קישור', 'hapantheon' ); ?>"><?php echo hapantheon_icon( 'link' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></button>
		<button type="button" data-fb="top" aria-label="<?php esc_attr_e( 'חזרה לראש העמוד', 'hapantheon' ); ?>"><?php echo hapantheon_icon( 'up' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></button>
	</div>
	<?php
	hapantheon_related_posts();
	hapantheon_post_newsletter();
	if ( comments_open() || get_comments_number() ) {
		comments_template();
	}
endwhile;
get_footer();
