/*
 Theme Name: Twenty Seventeen Child
 Template: twentyseventeen
 Text Domain: twentyseventeen-child
*/
<?php
/**
 * Child theme override for Twenty Seventeen
 * Front page panels: show ONLY the featured image + title.
 *
 * Place this file in:
 * /wp-content/themes/twentyseventeen-child/template-parts/page/content-front-page-panels.php
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

// Get the featured image URL (same size used by Twenty Seventeen panels)
$thumbnail_url = '';
if ( has_post_thumbnail() ) {
	$image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'twentyseventeen-featured-image' );
	$thumbnail_url = $image ? $image[0] : '';
}

// Build BEM-like classes consistent with Twenty Seventeen structure
$article_classes = 'panel';
?>

<article id="post-<?php the_ID(); ?>" <?php post_class( $article_classes ); ?>>

	<?php if ( $thumbnail_url ) : ?>
		<div class="panel-image" style="background-image: url('<?php echo esc_url( $thumbnail_url ); ?>');">
			<a class="panel-image-link" href="<?php the_permalink(); ?>">
				<span class="screen-reader-text">
					<?php /* Accessible text so SR users know what this panel links to */ ?>
					<?php the_title(); ?>
				</span>
			</a>
		</div><!-- .panel-image -->
	<?php else : ?>
		<?php
		// Fallback: if no featured image, still render a neutral panel with the title clickable.
		?>
		<div class="panel-image no-thumb">
			<a class="panel-image-link" href="<?php the_permalink(); ?>">
				<span class="screen-reader-text"><?php the_title(); ?></span>
			</a>
		</div>
	<?php endif; ?>

	<?php
	/**
	 * Title overlay only.
	 * We intentionally omit the entire ".panel-content" inner markup used by the parent theme
	 * (no excerpt, no buttons, no meta).
	 * We keep a minimal title container for styling/overlay.
	 */
	?>
	<header class="panel-title-overlay">
		<h2 class="entry-title">
			<a href="<?php the_permalink(); ?>">
				<?php the_title(); ?>
			</a>
		</h2>
	</header>

</article><!-- #post-## -->

