<?php
$datas = $args['data'];
$elements = isset($datas['element']) ? $datas['element'] : '';

?>

<div class="container relative scroll-appear">
  <div class="slick-carrousel">
    <?php
    foreach ($elements as $element) {
      $post = get_post($element);
      setup_postdata($post);
      $img = get_field('image_carrousel');
    ?>
      <div class="flex justify-center items-end text-center">
        <img class="img mx-auto " <?php acf_responsive_image($img['id'], 'medium', '200px') ?> alt="<?php echo get_the_title(); ?>" />
      </div>
    <?php
      wp_reset_postdata();
    }  ?>
  </div>

  <div class="slick-carrousel-labels ">
    <?php
    foreach ($elements as $element) {
      $post = get_post($element);
      setup_postdata($post);
      $img = get_field('image_carrousel');
      $degrade_debut = get_field('degrade')['debut'];
      $degrade_fin = get_field('degrade')['fin'];
      $etape_position
        = get_field('degrade')['etape_position'] != '' ? get_field('degrade')['etape_position']  : '0';
      $etape_couleur =
        get_field('degrade')['etape_couleur'] != '' ? get_field('degrade')['etape_couleur'] : 'transparent';


      $couleur = get_field('couleur');
      $theme = get_field('theme');
    ?>
      <div class="slick-slide-container">
        <div class="bg-up" style="background: radial-gradient(62.93% 62.93% at 50.00% 50.00%, <?php echo $degrade_debut ?> 0%,<?php echo $etape_couleur ?> <?php echo $etape_position ?>%,  <?php echo $degrade_fin ?> 100%);"></div>
        <div class="bg-down bg-[#E3998D]  " style="background: radial-gradient(98.91% 135.56% at 50.00% 0.00%, <?php echo $degrade_debut ?> 0%, <?php echo $etape_couleur ?> <?php echo $etape_position ?>%,  <?php echo $degrade_fin ?> 100%);"></div>
        <div class="content w-full">
          <div class=" text-center mx-auto">
            <h2 class="text-white heading-text">
              <strong class="block"><?php echo get_the_title(); ?></strong>
              <span><?php _e('Laurent-Perrier', 'laurentperrier'); ?></span>
            </h2>
            <a href="<?php echo get_the_permalink() ?>" class="btn <?php echo $theme ?>">
              <?php _e('En savoir plus', 'laurentperrier'); ?>
              <?php //echo get_field('en_savoir_plus', 'option') 
              ?></a>
          </div>
        </div>
      </div>
    <?php
      wp_reset_postdata();
    }  ?>
  </div>
</div>