/* Components for the ViZO Studio website UI kit.
   Export to window so multiple babel scripts can share. */

const { useState, useEffect, useRef } = React;

/* ---------------- Primitives ---------------- */

function Eyebrow({ children, color = 'var(--graphite)' }) {
  return (
    <div style={{
      fontSize: 12, fontWeight: 600, letterSpacing: '0.12em',
      textTransform: 'uppercase', color, lineHeight: 1.4
    }}>{children}</div>);

}

function Button({ children, variant = 'primary', size = 'medium', onClick, arrow = false, style = {} }) {
  const sizes = {
    small: { height: 36, padX: 16, fontSize: 14 },
    medium: { height: 44, padX: 20, fontSize: 15 },
    large: { height: 56, padX: 28, fontSize: 16 },
    xl: { height: 64, padX: 36, fontSize: 17 }
  };
  const s = sizes[size];
  const variants = {
    primary: { background: 'var(--ink)', color: 'var(--canvas)', border: 'none' },
    primaryInv: { background: 'var(--canvas)', color: 'var(--ink)', border: 'none' },
    secondary: { background: 'transparent', color: 'var(--ink)', border: '1.5px solid var(--ink)' },
    secondaryInv: { background: 'transparent', color: 'var(--canvas)', border: '1.5px solid var(--canvas)' },
    ghost: { background: 'transparent', color: 'var(--ink)', border: 'none' }
  };
  const v = variants[variant];
  const [hover, setHover] = useState(false);
  return (
    <button
      onClick={onClick}
      onMouseEnter={() => setHover(true)}
      onMouseLeave={() => setHover(false)}
      style={{
        ...v,
        height: s.height, padding: `0 ${s.padX}px`, fontSize: s.fontSize,
        fontFamily: 'var(--font-sans)', fontWeight: 600, letterSpacing: '0.01em',
        borderRadius: 4, cursor: 'pointer', display: 'inline-flex', alignItems: 'center', gap: 8,
        transition: 'all 200ms var(--ease-standard)',
        transform: hover ? 'translateY(-1px)' : 'translateY(0)',
        background: hover && variant === 'primary' ? 'var(--charcoal)' : v.background,
        ...style
      }}>
      
      <span style={{ fontWeight: "700" }}>{children}</span>
      {arrow &&
      <span style={{
        display: 'inline-block',
        transition: 'transform 200ms var(--ease-standard)',
        transform: hover ? 'translateX(4px)' : 'translateX(0)'
      }}>→</span>
      }
    </button>);

}

function Tag({ children, variant = 'default', style }) {
  const v = {
    default: { background: 'var(--bone)', color: 'var(--charcoal)' },
    featured: { background: 'var(--accent-amber)', color: 'var(--ink)' },
    status: { background: 'var(--canvas)', color: 'var(--ink)', border: '1px solid var(--ink)' },
    credit: { background: 'var(--ink)', color: 'var(--canvas)', fontFamily: 'var(--font-mono)', letterSpacing: 0, textTransform: 'none', fontWeight: 500 }
  }[variant];
  return (
    <span style={{
      display: 'inline-flex', alignItems: 'center', gap: 6,
      padding: '4px 10px', borderRadius: 6,
      fontFamily: 'var(--font-sans)', fontSize: 11, fontWeight: 600,
      letterSpacing: '0.08em', textTransform: 'uppercase',
      ...v, ...style
    }}>{children}</span>);

}

/* ---------------- Placeholder image ----------------
   We don't have real fashion imagery, so render a tasteful
   monochrome placeholder with a caption. Treat as intentional.
*/
function FashionPlate({ ratio = '4 / 5', label = 'Figure', subject = 'Model · campaign', dark = false, idx = 0, src, fit = 'cover', position = 'center', bg, alt, children }) {
  // Subtle tonal variation between plates
  const tones = dark ?
  ['#1A1A1A', '#222', '#0F0F0F', '#1F1F1F'] :
  ['#E8E5E0', '#D8D4CD', '#EFECE6', '#DDD8D0'];
  const accent = dark ?
  ['#2E2E2E', '#3A3A3A', '#252525', '#333'] :
  ['#C4BFB7', '#B8B3AB', '#CFC9C0', '#A8A39A'];
  const t1 = tones[idx % tones.length];
  const t2 = accent[idx % accent.length];
  const hasImage = Boolean(src);
  // Caption shows only when there is a label or subject to display.
  const labelText = (label || '').trim();
  const subjectText = (subject || '').trim();
  const hasCaption = Boolean(labelText || subjectText);
  // Alt: explicit prop wins; else label + subject (empty parts dropped); else a safe fallback.
  const imgAlt =
    (alt && alt.trim()) ||
    [labelText, subjectText].filter(Boolean).join(' \u2014 ') ||
    'ViZO \u2014 AI-generated fashion image';
  return (
    <div style={{
      aspectRatio: ratio,
      background: hasImage ? bg || 'var(--bone)' : `linear-gradient(160deg, ${t1} 0%, ${t2} 100%)`,
      position: 'relative', overflow: 'hidden',
      borderRadius: 0
    }}>
      {hasImage ?
      <img
        src={src}
        alt={imgAlt}
        style={{
          position: 'absolute', inset: 0,
          width: '100%', height: '100%',
          objectFit: fit, objectPosition: position,
          display: 'block'
        }} /> : (


      /* subtle vertical band to evoke garment silhouette */
      <div style={{
        position: 'absolute', top: 0, bottom: 0,
        left: '38%', width: '24%',
        background: dark ? 'rgba(0,0,0,0.15)' : 'rgba(0,0,0,0.06)'
      }} />)
      }
      {hasCaption &&
      <div style={{
        position: 'absolute', bottom: 16, left: 16, right: 16,
        display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end',
        color: hasImage ? 'rgba(255,255,255,1)' : dark ? 'rgba(255,255,255,0.92)' : 'rgba(10,10,10,0.85)',
        textShadow: hasImage ? '0 1px 3px rgba(0,0,0,0.55), 0 0 1px rgba(0,0,0,0.4)' : 'none',
        fontFamily: 'var(--font-mono)', fontSize: 10, letterSpacing: '0.04em',
        pointerEvents: 'none'
      }}>
        <span style={{ textTransform: 'uppercase', letterSpacing: '0.12em', fontWeight: 600 }}>{label}</span>
        <span style={{ textTransform: 'uppercase', letterSpacing: '0.12em', fontWeight: 600 }}>{subject}</span>
      </div>
      }
      {children}
    </div>);

}

/* ---------------- Icons (Lucide inline, 1.5 stroke) ---------------- */
const Icon = {
  arrow: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M5 12h14" /><path d="m13 6 6 6-6 6" /></svg>,
  check: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="m5 12 5 5L20 7" /></svg>,
  sparkle: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M12 3v4M12 17v4M5 12H1M23 12h-4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8" /></svg>,
  camera: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z" /><circle cx="12" cy="13" r="3.5" /></svg>,
  layers: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="m12 2 10 6-10 6L2 8z" /><path d="m2 16 10 6 10-6" /><path d="m2 12 10 6 10-6" /></svg>,
  wand: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M15 4V2" /><path d="M15 16v-2" /><path d="M8 9h2" /><path d="M20 9h2" /><path d="M17.8 11.8 19 13" /><path d="M15 9h0" /><path d="M17.8 6.2 19 5" /><path d="m3 21 9-9" /><path d="M12.2 6.2 11 5" /></svg>,
  grid: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M3 3h7v7H3zM14 3h7v7h-7zM14 14h7v7h-7zM3 14h7v7H3z" /></svg>,
  download: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /><path d="m7 10 5 5 5-5" /><path d="M12 15V3" /></svg>,
  shirt: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z" /></svg>,
  package: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="m7.5 4.27 9 5.15" /><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z" /><path d="m3.3 7 8.7 5 8.7-5" /><path d="M12 22V12" /></svg>,
  list: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><line x1="8" x2="21" y1="6" y2="6" /><line x1="8" x2="21" y1="12" y2="12" /><line x1="8" x2="21" y1="18" y2="18" /><line x1="3" x2="3.01" y1="6" y2="6" /><line x1="3" x2="3.01" y1="12" y2="12" /><line x1="3" x2="3.01" y1="18" y2="18" /></svg>,
  ghost: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M9 10h.01" /><path d="M15 10h.01" /><path d="M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z" /></svg>,
  user: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" /><circle cx="12" cy="7" r="4" /></svg>,
  tree: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M12 13v8" /><path d="M12 3v3" /><path d="M18 6a3 3 0 0 1-3 3h-2a3 3 0 0 0-3 3v1" /><path d="M6 6a3 3 0 0 0 3 3h2" /><path d="M18 18a3 3 0 0 0-3-3h-2" /><path d="M6 18a3 3 0 0 1 3-3h2" /></svg>,
  scan: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M3 7V5a2 2 0 0 1 2-2h2" /><path d="M17 3h2a2 2 0 0 1 2 2v2" /><path d="M21 17v2a2 2 0 0 1-2 2h-2" /><path d="M7 21H5a2 2 0 0 1-2-2v-2" /><path d="M7 12h10" /></svg>,
  hash: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><line x1="4" x2="20" y1="9" y2="9" /><line x1="4" x2="20" y1="15" y2="15" /><line x1="10" x2="8" y1="3" y2="21" /><line x1="16" x2="14" y1="3" y2="21" /></svg>,
  maximize: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M8 3H5a2 2 0 0 0-2 2v3" /><path d="M21 8V5a2 2 0 0 0-2-2h-3" /><path d="M3 16v3a2 2 0 0 0 2 2h3" /><path d="M16 21h3a2 2 0 0 0 2-2v-3" /></svg>,
  store: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7" /><path d="M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8" /><path d="M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4" /><path d="M2 7h20" /><path d="M22 7v3a2 2 0 0 1-2 2v0a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12v0a2 2 0 0 1-2-2V7" /></svg>,
  globe: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="10" /><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" /><path d="M2 12h20" /></svg>,
  gem: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M6 3h12l4 6-10 13L2 9Z" /><path d="M11 3 8 9l4 13 4-13-3-6" /><path d="M2 9h20" /></svg>,
  sparkles: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.582a.5.5 0 0 1 0 .962L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z" /><path d="M20 3v4" /><path d="M22 5h-4" /><path d="M4 17v2" /><path d="M5 18H3" /></svg>,
  cog: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /><circle cx="12" cy="12" r="3" /></svg>,
  film: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><rect width="18" height="18" x="3" y="3" rx="2" /><path d="M7 3v18" /><path d="M3 7.5h4" /><path d="M3 12h18" /><path d="M3 16.5h4" /><path d="M17 3v18" /><path d="M17 7.5h4" /><path d="M17 16.5h4" /></svg>,
  clock: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="10" /><polyline points="12 6 12 12 16 14" /></svg>,
  imagePlay: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><rect width="18" height="18" x="3" y="3" rx="2" /><circle cx="8" cy="8" r="1.4" /><path d="m10 14 4.5 2.6L10 19.2z" /></svg>,
  type: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><polyline points="4 7 4 4 20 4 20 7" /><line x1="9" x2="15" y1="20" y2="20" /><line x1="12" x2="12" y1="4" y2="20" /></svg>,
  shoe: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M2 17h17a3 3 0 0 0 3-3v-1h-9l-3-3-3 1-2 2H3a1 1 0 0 0-1 1v3z" /><path d="M5 13v-2" /><path d="M9 11.5l-1 -1" /></svg>,
  pencil: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" /></svg>,
  hat: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><g transform="translate(12 13) scale(1.15) translate(-12 -13)"><path d="M2.4 14.2 Q12 16.2 21.6 14.2 Q21 15.4 12 15.8 Q3 15.4 2.4 14.2 Z" /><path d="M6.6 14.2 C6.6 11.4 7.2 9 9 8.6 Q10.2 8.4 10.8 10.2 Q11.4 11.4 12 11.4 Q12.6 11.4 13.2 10.2 Q13.8 8.4 15 8.6 C16.8 9 17.4 11.4 17.4 14.2" /><path d="M6.7 14.2 Q12 14.9 17.3 14.2" /></g></svg>,
  handbag: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M8.4 10 Q8.4 5.6 12 5.6 Q15.6 5.6 15.6 10" /><path d="M5.6 10 L18.4 10 L19.2 19.2 Q19.2 20 18.4 20 L5.6 20 Q4.8 20 4.8 19.2 Z" /><circle cx="12" cy="10" r="0.6" fill="currentColor" stroke="none" /></svg>,
  digitalTwin: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><rect x="2" y="4" width="11" height="15" rx="1" strokeDasharray="2 2" /><rect x="10" y="7" width="12" height="15" rx="1" /><path d="M16 17 L16 12" /><path d="M13.5 14 L16 12 L18.5 14" /></svg>,
  consistency: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><rect x="2" y="7.5" width="5.5" height="9.5" rx="0.5" /><rect x="9.25" y="7.5" width="5.5" height="9.5" rx="0.5" /><rect x="16.5" y="7.5" width="5.5" height="9.5" rx="0.5" /><circle cx="8.4" cy="12.25" r="0.4" fill="currentColor" stroke="none" /><circle cx="15.65" cy="12.25" r="0.4" fill="currentColor" stroke="none" /></svg>,
  lock: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M7.6 11.2 L7.6 8.4 Q7.6 4.8 12 4.8 Q16.4 4.8 16.4 8.4 L16.4 11.2" /><rect x="5.2" y="11.2" width="13.6" height="9.6" rx="1.2" /><circle cx="12" cy="15.2" r="0.7" /><path d="M12 15.9 L12 17.6" /></svg>,
  studioLight: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M6.8 4.1 L17.1 2.4 L18.1 8.6 L7.9 10.3 Z" /><path d="M7.9 5.5 L17.1 3.8" opacity="0.5" /><path d="M13 9.6 L12 18.8" /><path d="M12 18.8 L8.2 21.9" /><path d="M12 18.8 L12 21.9" /><path d="M12 18.8 L15.8 21.9" /></svg>,
  resolution: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><rect x="3" y="4" width="18" height="15" rx="1" /><rect x="3" y="8" width="13" height="11" rx="1" /><rect x="3" y="13" width="8" height="6" rx="0.5" /></svg>,
  editorialSets: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinejoin="round"><rect x="3" y="3" width="14" height="14" rx="1.5" /><rect x="7" y="7" width="14" height="14" rx="1.5" /></svg>,
  clapper: (p) => <svg {...p} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"><path d="M20.2 6 3 11l-.9-2.4c-.3-1 .3-2.1 1.3-2.4l13.6-3.6c1-.3 2.1.3 2.4 1.3z" /><path d="m6.2 5.3 3.1 3.9" /><path d="m12.4 3.4 3.1 4" /><path d="M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" /></svg>
};

Object.assign(window, { Eyebrow, Button, Tag, FashionPlate, Icon });

/* ---------------- Responsive hooks ----------------
   Single source of truth for breakpoints:
     mobile  <  640   (single column, hamburger nav)
     tablet  640–1023 (two-column layouts allowed)
     desktop >= 1024  (full multi-column)
   useIsMobile(bp) keeps a custom threshold (TopNav uses 900) for fine-tuning
   places where the cliff between bars/menus needs to bend earlier.
*/
const BP = { mobile: 640, desktop: 1024 };

function useViewport() {
  const get = () => typeof window !== 'undefined' ? window.innerWidth : 1440;
  const [w, setW] = useState(get);
  useEffect(() => {
    const onResize = () => setW(get());
    window.addEventListener('resize', onResize);
    window.addEventListener('orientationchange', onResize);
    return () => {
      window.removeEventListener('resize', onResize);
      window.removeEventListener('orientationchange', onResize);
    };
  }, []);
  return w;
}

function useBreakpoint() {
  const w = useViewport();
  const isMobile = w < BP.mobile;
  const isTablet = w >= BP.mobile && w < BP.desktop;
  const isDesktop = w >= BP.desktop;
  return { width: w, isMobile, isTablet, isDesktop, isMobileOrTablet: !isDesktop };
}

function useIsMobile(bp = BP.mobile) {
  const w = useViewport();
  return w < bp;
}

/* cols(mobile, tablet, desktop) — convenience for gridTemplateColumns */
function cols(m, t, d) {
  return ({ isMobile, isTablet }) => isMobile ? m : isTablet ? t : d;
}

Object.assign(window, { useViewport, useBreakpoint, useIsMobile, cols, BP });