/* ==========================================================================
   Marquee.jsx | 03 Brand marquee
   Seamless loop: two identical groups, each holding the phrases twice, so the
   track can slide exactly half its width. Pauses on hover; static when
   reduced motion is requested or decorative animations are switched off.
   ========================================================================== */

const MC_MARQUEE_ITEMS = [
  'Leave the dust to Dusty',
  'A lot of clean',
  'We make the mess disappear',
  'Fresh spaces',
  'Happy places',
  'Attention to detail',
  'Sydney cleaning services',
];

function MCMarqueeGroup() {
  const doubled = MC_MARQUEE_ITEMS.concat(MC_MARQUEE_ITEMS);
  return (
    <ul className="mc-marquee__group" role="list">
      {doubled.map((item, index) => (
        <li key={`${item}-${index}`}>
          <span>{item}</span>
          <MCIcon name={index % 2 === 0 ? 'sparkle' : 'moon'} className="mc-marquee__sep" />
        </li>
      ))}
    </ul>
  );
}

function MCMarquee() {
  return (
    <div className="mc-marquee">
      <p className="mc-sr">{MC_MARQUEE_ITEMS.join('. ')}.</p>
      <div className="mc-marquee__track mc-anim" aria-hidden="true">
        <MCMarqueeGroup />
        <MCMarqueeGroup />
      </div>
    </div>
  );
}

Object.assign(window, { MCMarquee, MCMarqueeGroup });
