<?php
$datas = $args['data'];
$titre = isset($datas['titre']) ? $datas['titre'] : '';
$texte = isset($datas['texte']) ? $datas['texte'] : '';
$image = isset($datas['image']) ? $datas['image'] : '';
$lien_dachat = isset($datas['lien_dachat']) ? $datas['lien_dachat'] : '';
$couleur_texte = isset($datas['couleur_texte']) ? $datas['couleur_texte'] : '';
$couleur_fond = isset($datas['couleur_fond']) ? $datas['couleur_fond'] : '';
?>

<div style="background-color:<?php echo $couleur_fond ?>; color:<?php echo $couleur_texte; ?>!important;">
  <div class="container max-w-7xl mx-auto md:flex items-center pt-16 pb-6 md:py-16 md:gap-16 lg:gap-24">
    <div class="md:basis-7/12  flex flex-col justify-center md:block">
      <div class="md:max-w-2xl">
        <h2 class=" mb-8 md:mb-10 heading-text text-base md:text-2xl  scroll-appear" style="color:<?php echo $couleur_texte; ?>!important;"><?php echo $titre; ?></h2>
        <div class="body-text  scroll-appear" style="color:<?php echo $couleur_texte; ?>!important;">
          <?php echo $texte; ?>
        </div>

        <?php
        if (isset($lien_dachat) && $lien_dachat != '') {
          foreach ($lien_dachat as $item) {
            $post = get_post($item);
            setup_postdata($post);
            // echo get_the_ID();

            include('lien_dachat.php');
            wp_reset_postdata();
          }
        }
        ?>
      </div>
    </div>
    <div class="md:basis-5/12 md:flex md:items-center ">
      <div class="w-full lg:h-full md:sticky md:top-[25%] lg:top-[0px] flex items-center lg:justify-end ">
        <img class="pt-5 md:pb-10 md:py-0 max-w-full xl:max-w-md h-auto w-full scroll-appear scroll-appear-image" <?php acf_responsive_image($image['id'], 'medium', '100%') ?> />
      </div>
    </div>
  </div>
</div>