<section class="py-24 bg-[#F8FAFC]" id="reviews">
  <div class="container mx-auto px-6">

    <!-- Heading & CTA -->
    <div class="flex flex-col md:flex-row justify-between items-end mb-16 border-l-4 border-[#F9AB00] pl-8">
      <div class="max-w-xl">
        <h2 class="text-5xl md:text-7xl font-black text-[#202124] tracking-tighter uppercase leading-[0.8] mb-4">
          The <span class="text-[#F9AB00] font-light italic">Climber's</span> Voice
        </h2>
        <p class="text-[#5F6368] font-bold tracking-[0.3em] uppercase text-[10px]">Verified Feedback from our Google Business Profile</p>
      </div>

      <a href="https://g.page/r/CTXE2FgLIPvyEBM/review"
         target="_blank"
         class="mt-8 md:mt-0 relative group flex items-center gap-6 bg-[#F1F3F4] pl-8 pr-2 py-2 rounded-2xl shadow-[0_20px_40px_-10px_rgba(32,33,36,0.1)] hover:shadow-[0_20px_40px_-10px_rgba(32,33,36,0.15)] transition-all duration-500 hover:-translate-y-1">

        <div class="flex flex-col">
          <div class="flex items-center gap-2 mb-1">
            <span class="relative flex h-2 w-2">
              <span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-[#F9AB00] opacity-75"></span>
              <span class="relative inline-flex rounded-full h-2 w-2 bg-[#F9AB00]"></span>
            </span>
            <span class="text-[9px] font-black uppercase tracking-[0.2em] text-[#F9AB00]">Share your story</span>
          </div>
          <span class="text-sm font-black uppercase tracking-widest text-[#F9AB00]">Write a Review</span>
        </div>

        <div class="w-14 h-14 rounded-xl bg-white flex items-center justify-center group-hover:bg-[#F9AB00] transition-all duration-500">
          <i data-lucide="star" class="w-6 h-6 text-[#F9AB00] fill-[#F9AB00] group-hover:text-white group-hover:fill-white transition-colors"></i>
        </div>
      </a>
    </div>

    <!-- Reviews Grid -->
    <div id="reviews-container" class="grid gap-6 md:grid-cols-2 lg:grid-cols-12 auto-rows-fr">
      <!-- Summary Card -->
      <div class="lg:col-span-4 bg-white rounded-[3rem] p-12 flex flex-col items-center justify-center text-center relative overflow-hidden group border border-[#E8EAED] shadow-sm">
        <div class="text-[80px] font-black text-[#F9AB00] leading-none tracking-tighter mb-2">4.8+</div>
        <div class="flex gap-1 justify-center mb-6" id="summary-stars"></div>
        <p class="text-[#5F6368] font-black uppercase tracking-[0.3em] text-[10px]">Perfect Google Rating</p>
      </div>
    </div>

  </div>
</section>

<script>
  // Review data
  const reviews = [
    {
      name: 'Lizzie Raymont',
      role: 'Expedition Member',
      text: 'An absolutely incredible experience that exceeded all expectations. Our guide Joseph was so knowledgeable about the mountain and wildlife. He kept us safe and informed every step.',
      img: 'https://i.pravatar.cc/150?u=lizzie',
      stars: 5
    },
    {
      name: 'Pamela',
      role: 'Solo Traveler',
      text: 'Challenging but rewarding with breathtaking scenery. I was impressed with the organization—including gear rental and pre-trip info. A fantastic adventure that I highly recommend.',
      img: 'https://i.pravatar.cc/150?u=pamela',
      stars: 4.9
    },
    {
      name: 'Kamau',
      role: 'Couple Traveler',
      text: 'Unforgettable trekking adventure! The company made everything seamless. Knowledgeable guides and views that you will never forget. Best time in Kenya.',
      img: 'https://i.pravatar.cc/150?u=kamau',
      stars: 5
    },
    {
      name: 'Samuel O.',
      role: 'Group Lead',
      text: 'We took a group of university students and had the best time. Samuel was a fantastic guide. We are already planning our return to reach the top!',
      img: 'https://i.pravatar.cc/150?u=samuel',
      stars: 4.7
    },
    {
      name: 'Olivia',
      role: 'Solo Hiker',
      text: 'As a solo traveler, safety was my priority. This team exceeded every standard. The logistics were flawless and the equipment provided was top-tier.',
      img: 'https://i.pravatar.cc/150?u=olivia',
      stars: 4.5
    }
  ];

  // Render stars with Google yellow (#F9AB00)
  function renderStars(rating) {
    const full = Math.floor(rating);
    const hasHalf = rating % 1 >= 0.5;
    let html = '';

    for (let i = 0; i < full; i++) {
      html += '<i data-lucide="star" class="w-3.5 h-3.5 fill-[#F9AB00] text-[#F9AB00]"></i>';
    }
    if (hasHalf) {
      html += '<i data-lucide="star-half" class="w-3.5 h-3.5 fill-[#F9AB00] text-[#F9AB00]"></i>';
    }
    const rendered = full + (hasHalf ? 1 : 0);
    for (let i = rendered; i < 5; i++) {
      html += '<i data-lucide="star" class="w-3.5 h-3.5 text-[#F9AB00]"></i>';
    }
    return html;
  }

  // Render summary stars
  document.getElementById('summary-stars').innerHTML = renderStars(4.8);

  // Render individual reviews
  const container = document.getElementById('reviews-container');
  reviews.forEach(review => {
    const el = document.createElement('article');
    el.className = 'lg:col-span-4 bg-white rounded-[3rem] p-10 border border-[#E8EAED] shadow-sm flex flex-col hover:border-[#F9AB00]/50 transition-all duration-500';
    el.innerHTML = `
      <div class="flex justify-between items-start mb-8">
        <div class="flex gap-1">
          ${renderStars(review.stars)}
        </div>
        <div class="w-8 h-8 rounded-lg bg-[#F1F3F4] flex items-center justify-center">
          <img src="https://upload.wikimedia.org/wikipedia/commons/c/c1/Google_Color_Icon.svg" class="w-4 h-4">
        </div>
      </div>
      <p class="text-[#202124] text-sm leading-relaxed font-medium italic mb-10 flex-grow">
        "${review.text}"
      </p>
      <div class="flex items-center gap-4 pt-6 border-t border-[#E8EAED]">
        <img src="${review.img}" alt="${review.name}" class="w-10 h-10 rounded-full object-cover border border-[#E8EAED]">
        <div class="flex flex-col">
          <span class="text-[10px] font-bold text-[#202124] tracking-widest">${review.name}</span>
          <span class="text-[8px] text-[#5F6368] font-medium uppercase tracking-widest">${review.role}</span>
        </div>
      </div>
    `;
    container.appendChild(el);
  });

  // Initialize Lucide icons
  document.addEventListener('DOMContentLoaded', () => {
    if (typeof lucide !== 'undefined') {
      lucide.createIcons();
    }
  });
</script>