// Simplified Silgimar mark — washing-drum circle with infinity inside.
// Single-stroke geometric: one perfect circle (drum) + an infinity loop
// rendered as a continuous path, so it reads as "endless cycle inside the machine".

// Original Silgimar logo — uses the bitmap from the project assets.
// Kept un-altered to preserve brand identity per user request.
// Original Silgimar logo. The PNG asset is 3612×2968 with the circular mark
// occupying roughly the top ~75% and the SILGIMAR wordmark beneath it.
// We crop to just the drum mark by sizing the background to 100%/75% and
// pinning it to the top, so the same asset can serve as the icon-only mark
// without doubling up with the wordmark we render in HTML alongside it.
function SilgimarMark({ size = 44, withWordmark = false, spinning = false }) {
  const px = typeof size === 'number' ? `${size}px` : size;
  if (withWordmark) {
    return (
      <span
        aria-label="Silgimar"
        style={{
          display:'inline-block',
          width: px,
          backgroundImage: 'url(assets/old-logo.png)',
          backgroundSize: 'contain',
          backgroundRepeat: 'no-repeat',
          backgroundPosition: 'center',
          aspectRatio: '3612 / 2968',
        }}
      />
    );
  }
  return (
    <span
      aria-label="Silgimar"
      style={{
        display:'inline-block',
        width: px,
        height: px,
        backgroundImage: 'url(assets/old-logo.png)',
        backgroundSize: '100% auto',
        backgroundRepeat: 'no-repeat',
        backgroundPosition: 'top center',
        animation: spinning ? 'silg-spin 14s linear infinite' : 'none',
        transformOrigin: 'center',
      }}
    >
      <style>{`@keyframes silg-spin { to { transform: rotate(360deg) } }`}</style>
    </span>
  );
}

function SilgimarLockup({ markSize = 40 }) {
  return (
    <a href="#top" className="brand">
      <img src="assets/logo.png" alt="Silgimar" style={{ height: markSize, width: 'auto' }}/>
    </a>
  );
}

window.SilgimarMark = SilgimarMark;
window.SilgimarLockup = SilgimarLockup;
