<?php
$clientReviews = $clientReviews ?? [
  [
    'name' => 'Ralph Edwards',
    'role' => 'Published Author',
    'image' => 'assets/images/rev-1.webp',
    'text' => 'Miller Freeman guided me through every step of publishing. My book went live on schedule and the final print quality exceeded what I expected.',
  ],
  [
    'name' => 'Arlene McCoy',
    'role' => 'First-Time Author',
    'image' => 'assets/images/rev-2.webp',
    'text' => 'I had no idea where to start with self-publishing. Their team made the process clear, organized, and far less overwhelming than I imagined.',
  ],
  [
    'name' => 'Dianne Russell',
    'role' => 'Business Author',
    'image' => 'assets/images/rev-3.webp',
    'text' => 'From formatting to distribution setup, everything was handled professionally. I always knew what stage my project was in and what came next.',
  ],
  [
    'name' => 'Ralph Edwards',
    'role' => 'Published Author',
    'image' => 'assets/images/rev-1.webp',
    'text' => 'Miller Freeman guided me through every step of publishing. My book went live on schedule and the final print quality exceeded what I expected.',
  ],
  [
    'name' => 'Arlene McCoy',
    'role' => 'First-Time Author',
    'image' => 'assets/images/rev-2.webp',
    'text' => 'I had no idea where to start with self-publishing. Their team made the process clear, organized, and far less overwhelming than I imagined.',
  ],
  [
    'name' => 'Dianne Russell',
    'role' => 'Business Author',
    'image' => 'assets/images/rev-3.webp',
    'text' => 'From formatting to distribution setup, everything was handled professionally. I always knew what stage my project was in and what came next.',
  ],
];
$clientReviewsTitle = $clientReviewsTitle ?? 'What Authors <em>Say</em>';
$clientReviewsDesc = $clientReviewsDesc ?? 'Real feedback from authors who published their books with Miller Freeman.';
?>

<section class="client-reviews">
  <div class="container">
    <?php if ($clientReviewsTitle !== ''): ?>
    <div class="client-reviews-header text-center">
      <h2 class="client-reviews-title"><?= $clientReviewsTitle ?></h2>
      <?php if ($clientReviewsDesc !== ''): ?>
      <p class="client-reviews-desc"><?= htmlspecialchars($clientReviewsDesc) ?></p>
      <?php endif; ?>
    </div>
    <?php endif; ?>

    <div class="swiper client-reviews-slider">
      <div class="swiper-wrapper">
        <?php foreach ($clientReviews as $review): ?>
        <div class="swiper-slide">
          <article class="client-review-card">
            <div class="client-review-head">
              <div class="client-review-meta">
                <h3 class="client-review-name"><?= htmlspecialchars($review['name']) ?></h3>
                <p class="client-review-role"><?= htmlspecialchars($review['role']) ?></p>
                <div class="client-review-stars" aria-label="4 out of 5 stars">
                  <?php for ($i = 0; $i < 4; $i++): ?>
                  <svg width="18" height="18" viewBox="0 0 18 18" fill="none" aria-hidden="true"><path d="M9 1.5L11.04 6.63L16.5 7.29L12.45 11.07L13.59 16.5L9 13.88L4.41 16.5L5.55 11.07L1.5 7.29L6.96 6.63L9 1.5Z" fill="currentColor"/></svg>
                  <?php endfor; ?>
                  <svg width="18" height="18" viewBox="0 0 18 18" fill="none" aria-hidden="true"><path d="M9 1.5L11.04 6.63L16.5 7.29L12.45 11.07L13.59 16.5L9 13.88L4.41 16.5L5.55 11.07L1.5 7.29L6.96 6.63L9 1.5Z" stroke="currentColor" stroke-width="1.2" fill="none"/></svg>
                </div>
              </div>
              <img src="<?= htmlspecialchars($review['image']) ?>" alt="<?= htmlspecialchars($review['name']) ?>" class="client-review-avatar">
            </div>
            <div class="client-review-divider" aria-hidden="true"></div>
            <p class="client-review-text"><?= htmlspecialchars($review['text']) ?></p>
          </article>
        </div>
        <?php endforeach; ?>
      </div>
      <div class="client-reviews-pagination"></div>
    </div>
  </div>
</section>
