<?php
/**
 * @package far_loop
 */

get_header();

// Campos
$subtitle         = get_field('subtitle');
$cover            = get_field('featured_image');
$cover_url        = !empty($cover['url']) ? $cover['url'] : get_template_directory_uri() . '/img/horizontal-placeholder.svg';
$cover_caption    = !empty($cover['caption']) ? $cover['caption'] : '';
$lead_description = get_field('lead_description');
$full_description = get_field('full_description');
$terms            = get_the_terms(get_the_ID(), 'activity-type');
?>

<div class="u_pt-5">
  <div class="l_container u_mv-5 wrapper-profile">

		<div class="page-title u_mb-3 u_mb-md-4">
			<h1 class="page-title__alpha-title u_mb-0p5"><?php the_title(); ?></h1>
			<h3 class="info-card__value"><?php activity_date_string(); ?></h3>
			<?php if ( !empty($subtitle) ) : ?>
				<h2 class="page-title__gamma-title birth-date">&mdash;&nbsp;<?php echo esc_html($subtitle); ?></h2>
			<?php endif; ?>
		</div>

		<?php
		// Si es una "exhibition-route", se mantiene el partial específico
		$is_exhibition_route = ( !empty($terms) && !is_wp_error($terms) && isset($terms[0]->slug) && $terms[0]->slug === 'exhibition-route' );
		if ( $is_exhibition_route ) {
		get_template_part('template-parts/exhibition-route');
		} else {
		?>
		<figure class="cover-image activity-single-image">
			<img src="<?php echo esc_url($cover_url); ?>" alt="<?php echo esc_attr($cover_caption ?: get_the_title()); ?>">
			<?php if ( $cover_caption ) : ?>
			<figcaption class="cover-image__caption"><?php echo esc_html($cover_caption); ?></figcaption>
			<?php endif; ?>
		</figure>
		<?php } ?>



		<div data-sticky-sidebar-grid class="grid u_mh-min1p5 container-info-activity">
			<div data-sticky-sidebar class="col--sm--three--seventh col--md--two--fifth u_ph-1p5">
				<?php get_template_part('template-parts/info-card-list'); ?>
			</div>

			<div class="col--sm--four--seventh col--md--three--fifth u_ph-1p5">
				<?php if ( !empty($lead_description) ) : ?>
					<?php echo esc_html($lead_description); ?>
				<?php endif; ?>

				<div class="wysiwyg">
					<?php echo $full_description ?: ''; ?>
				</div>

			

			</div>

		</div>

		<div class="container-programme-activity">
					<?php

					get_template_part('template-parts/programme');

					get_template_part('template-parts/participants');
					get_template_part('template-parts/curators');
					get_template_part('template-parts/speakers');
					?>

		</div>



  </div>
</div>

<?php
related_activities_module();

related_artist_videos_module();

related_professionals_module();

related_galleries_module();

related_pages_module_pages_only();



get_footer();