<?php
$data = $args['data'] ?? array();
$image = $data['image'] ?? 0;
$sur_titre = $data['sur_titre'] ?? '';
$titre = $data['titre'] ?? '';
$texte = $data['texte'] ?? '';
$dates = $data['dates'] ?? array();
$lien = $data['lien'] ?? array();
?>
<div class="pages-list reverse  px-4 xl:px-0 overflow-hidden">
	<div class="container  max-w-[1050px] mx-auto">
		<div class="mb-12">
			<!-- <div class="card-banner scroll-appear scroll-appear-scale"></div> -->
			<?php if ($image > 0) : ?>
				<?php echo wp_get_attachment_image($image, 'full', false, array('loading' => 'lazy', 'class' => 'scroll-appear scroll-appear-fade-up')); ?>
			<?php endif; ?>
		</div>
		<div class="card-timeline relative">
			<div class="left card-body relative scroll-appear">
				<?php if (!empty($sur_titre) || !empty($titre)) : ?>
					<div class="card-title-container liseret red">
						<?php if (!empty($sur_titre)) : ?>
							<h3 class=" card-uptitle">
								<?php echo $sur_titre; ?>
							</h3>
						<?php endif; ?>
						<?php if (!empty($titre)) : ?>
							<h2 class="card-title">
								<?php echo $titre; ?>
							</h2>
						<?php endif; ?>
					</div>
				<?php endif; ?>
				<?php if (!empty($texte)) : ?>
					<p class="card-text">
						<?php echo $texte; ?>
					</p>
				<?php endif; ?>

				<?php if (isset($lien['title']) && !empty($lien['title'])) : ?>
					<a href="<?php echo $lien['url']; ?>" class="btn-primary stretched-link">
						<span><?php echo lnj_load_inline_svg('circle-left.svg'); ?></span>
						<span>
							<?php echo $lien['title']; ?>
						</span>
						<span><?php echo lnj_load_inline_svg('plus.svg'); ?></span>
					</a>
				<?php endif; ?>
			</div>
			<div class="right ">
				<?php if (is_array($dates) && sizeof($dates) > 0) : ?>
					<ul class="card-list">
						<?php foreach ($dates as $date) : ?>
							<?php if (isset($date['description']) && isset($date['color_picto'])) : ?>
								<li class="<?php echo $date['color_picto']; ?>">
									<?php echo $date['description']; ?>
								</li>
							<?php endif; ?>
						<?php endforeach; ?>
					</ul>
				<?php endif; ?>
			</div>
		</div>
	</div>

</div>