<?php /*template name: nosidebar*/ get_header(); ?>
<div class="uk-cover-container uk-text-center banner" style="background-color: <?= get_field('colour_picker_banner_bg'); ?>">
    <canvas class="uk-visible@m" width="" height="400"></canvas>
    <canvas class="uk-hidden@m" width="" height="500"></canvas>

		<?php 
$image = get_field('top_banner');

if( $image ): 
    // Since 'full' isn't in ['sizes'], we use the top-level ['url']
    $url = $image['url']; 
    $alt = $image['alt'];
?>
    <img class="uk-visible@m" 
         uk-img 
         data-src="<?php echo esc_url($url); ?>" 
         alt="<?php echo esc_attr($alt); ?>" 
         data-width 
         data-height 
         uk-cover />

<?php else: ?>
    <img class="uk-visible@m" 
         uk-img 
         data-src="<?php echo get_template_directory_uri(); ?>/images/blue-splatter.webp" 
         data-width 
         data-height 
         uk-cover>
<?php endif; ?>
	
	
<?php 
$image2 = get_field('top_banner_mobile');

if( $image2 ): 
    // Use the top-level URL for the full size
    $url2 = $image2['url'];
    $alt2 = $image2['alt'];
?>
    <img class="uk-hidden@m" 
         uk-img 
         data-src="<?php echo esc_url($url2); ?>" 
         alt="<?php echo esc_attr($alt2); ?>" 
         data-width 
         data-height 
         uk-cover />

<?php else: ?>
    <img class="uk-hidden@m" 
         uk-img 
         data-src="<?php echo get_template_directory_uri(); ?>/images/blue-splatter-mobile.webp" 
         data-width 
         data-height 
         uk-cover>
<?php endif; ?>
	
	<div class="uk-position-cover uk-text-center uk-container uk-flex uk-flex-center uk-flex-middle">
        <div uk-scrollspy="target: > h2, p; cls: uk-animation-slide-bottom-medium; delay: 200">
           <h2 class="white">
			   <?php if( get_field('banner_title')) { ?><?= get_field('banner_title'); ?><?php } else { ?><?php the_title(); ?><?php } ?>
			</h2>
			<p class="white uk-width-2-3@m uk-margin-auto">
				<?php if( get_field('banner_text')) { ?><?= get_field('banner_text'); ?><?php } else { ?><?php the_excerpt(); ?><?php } ?>
			</p>
        </div>
    </div>
</div>
<div class="uk-container uk-margin-large-top uk-margin-large-bottom">
	<main role="main">
		<section>

			<?php if (have_posts()): while (have_posts()) : the_post(); ?>

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

					<?php the_content(); ?>

					<br class="clear">

					<p class="uk-text-right"><?php edit_post_link( __('Edit this page'), '', '', 0, 'post-edit-link uk-text-large uk-padding-small uk-button-large uk-button uk-button-primary' ); ?></p>

				</article>

			<?php endwhile; ?><?php endif; ?>

		</section>
	</main>
</div>
<?php get_footer(); ?>
