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

get_header();

// Campos
$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'] : '';

$address   = get_field('address');
$phone     = get_field('phone');
$email     = get_field('email');
$website   = get_field('website');
$description = get_field('description');
?>

<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>
        </div>

        <figure class="cover-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>
 


      <div data-sticky-sidebar-grid class="grid u_mh-min1p5 container-info-gallery">
        <div data-sticky-sidebar class="col--sm--three--seventh col--md--two--fifth u_ph-1p5">
          <?php
          // ✅ Llamada correcta a info_card_module (espera keys, no valores)
          if (function_exists('info_card_module')) {
            info_card_module(array(
              'address',
              'phone',
              'email',
              'website',
            ));
          } else {
            // Fallback sencillo si la función no existe
            echo '<dl class="info-card__list">';
            if (!empty($address)) {
              $addr_txt = is_array($address) ? wp_strip_all_tags(implode(', ', $address)) : $address;
              echo '<dt>Address</dt><dd>' . esc_html($addr_txt) . '</dd>';
            }
            if (!empty($phone))   echo '<dt>Phone</dt><dd>' . esc_html($phone) . '</dd>';
            if (!empty($email))   echo '<dt>Email</dt><dd><a href="mailto:' . esc_attr($email) . '">' . esc_html($email) . '</a></dd>';
            if (!empty($website)) echo '<dt>Website</dt><dd><a href="' . esc_url($website) . '">' . esc_html($website) . '</a></dd>';
            echo '</dl>';
          }
          ?>
        </div>


        <div class="col--sm--four--seventh col--md--three--fifth u_ph-1p5">
          <div class="wysiwyg">
            <?php echo $description ?: ''; ?>
          </div>
        </div>
        
      </div>





  </div>
</div>

<?php 
related_activities_module();

related_artist_videos_module();

related_professionals_module();

related_pages_module_pages_only();

//related_pages_module();

get_footer();