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


if (is_array($datas)) :
  if (is_array($recompenses) && count($recompenses) > 0) {
?>
    <div class="section-container max-w-[950px] mx-auto ">
      <h2 class="new-section-title"><?php echo $titre; ?></h2>
      <div class="flex flex-col md:flex-row md:justify-center gap-10 md:gap-20 lg:gap-40">
        <?php
        foreach ($recompenses as $item) {
        ?>
          <div class="item text-center flex flex-col heading-text">
            <div class="flex flex-col grow">
              <div class="head mb-[10px] lg:mb-5 flex items-center grow  scroll-appear">
                <?php if (is_array($item['image'])) : ?>
                  <img alt="<?php echo esc_attr($item['image']['alt']) ?>" class="max-w-[150px] md:max-w-[200px] w-full mx-auto" <?php echo acf_responsive_image($item['image']['id'], 'medium', '100%') ?> >
                <?php endif; ?>
              </div>
              <div class="body scroll-appear">
                <?php if (!empty($item['annee'])) { ?>
                  <div class="text-[8px] lg:text-base font-normal uppercase leading-tight"><?php echo $item['annee'] ?></div>

                <?php } ?>
                <div class="text-[15px] lg:text-3xl font-normal uppercase !leading-none"><span><?php echo $item['note'] ?></span></div>
              </div>
            </div>

          </div>
        <?php } ?>
      </div>
    </div>
<?php
  }
endif; ?>