// kit-collateral.jsx — application mockups. Relies on marks + kit-ui (CT).
const C = window.CT; // brand colors

/* ---- social avatars ---- */
function Avatar({ accentBg }) {
  return (
    <div style={{ width: 112, height: 112, borderRadius: '50%', overflow: 'hidden',
      background: accentBg ? 'var(--ct-accent)' : C.cream,
      display: 'flex', alignItems: 'center', justifyContent: 'center',
      boxShadow: '0 6px 18px rgba(0,0,0,0.12)' }}>
      <Core s={accentBg ? 96 : 100} mono={accentBg ? C.cream : null} />
    </div>
  );
}

/* ---- neon sign ---- */
function NeonSign() {
  return (
    <div style={{ width: '100%', minHeight: 264, borderRadius: 17, overflow: 'hidden', position: 'relative',
      background: 'radial-gradient(120% 95% at 50% 40%, #123b35 0%, #0a1a16 58%, #070f0d 100%)',
      display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 20 }}>
      <div style={{ filter: 'drop-shadow(0 0 4px var(--ct-accent)) drop-shadow(0 0 13px var(--ct-accent))' }}>
        <Core s={78} mono="#FFFFFF" />
      </div>
      <div style={{ filter: 'drop-shadow(0 0 5px var(--ct-accent)) drop-shadow(0 0 16px var(--ct-accent))' }}>
        <Wordmark size={28} color="#fff" accent="#fff" place={false} />
      </div>
      <div style={{ position: 'absolute', left: '50%', bottom: 20, transform: 'translateX(-50%)',
        width: '56%', height: 1, background: 'linear-gradient(90deg, transparent, var(--ct-accent), transparent)', opacity: 0.55 }} />
    </div>
  );
}

/* ---- to-go cup ---- */
function Cup() {
  return (
    <div style={{ position: 'relative', width: 150, height: 176 }}>
      <div style={{ position: 'absolute', top: 0, left: 9, width: 132, height: 16, borderRadius: 6, background: C.ink }} />
      <div style={{ position: 'absolute', top: 20, left: 0, width: 150, height: 156, background: C.cream,
        clipPath: 'polygon(8% 0, 92% 0, 100% 100%, 0% 100%)',
        display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 10 }}>
        <Core s={58} />
        <Wordmark size={16} place={false} />
      </div>
    </div>
  );
}

/* ---- tote ---- */
function Tote() {
  return (
    <div style={{ position: 'relative', width: 150, height: 186 }}>
      <div style={{ position: 'absolute', top: 0, left: 34, width: 30, height: 42,
        border: `7px solid ${C.ink}`, borderBottom: 'none', borderRadius: '16px 16px 0 0' }} />
      <div style={{ position: 'absolute', top: 0, right: 34, width: 30, height: 42,
        border: `7px solid ${C.ink}`, borderBottom: 'none', borderRadius: '16px 16px 0 0' }} />
      <div style={{ position: 'absolute', top: 32, left: 0, width: 150, height: 154, background: C.sand,
        borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
        <Badge s={118} />
      </div>
    </div>
  );
}

/* ---- phone wallpaper (golden-ratio, symmetric) ---- */
function Wallpaper() {
  const icon = { display: 'flex', gap: 2.5, alignItems: 'center' };
  return (
    <div style={{ width: 148, height: 312, borderRadius: 32, padding: 5, background: '#0a1714',
      boxShadow: '0 14px 30px rgba(0,0,0,0.3)' }}>
      <div style={{ position: 'relative', width: '100%', height: '100%', borderRadius: 27, overflow: 'hidden',
        background: `linear-gradient(180deg, ${C.ink} 0%, #14564e 58%, #186b61 100%)` }}>
        <div style={{ position: 'absolute', top: 52, left: '50%', transform: 'translateX(-50%)', width: 104, height: 104,
          borderRadius: '50%', background: 'radial-gradient(circle, var(--ct-accent) 0%, rgba(255,138,61,0) 70%)', opacity: 0.55 }} />
        <div style={{ position: 'absolute', top: 75, left: '50%', transform: 'translateX(-50%)', width: 42, height: 42,
          borderRadius: '50%', background: 'var(--ct-accent)' }} />
        <svg viewBox="0 0 138 130" width="138" height="130" style={{ position: 'absolute', bottom: 0, left: 0 }}>
          <path d="M0,30 C34.5,12 103.5,12 138,30 L138,130 L0,130 Z" fill={C.aqua} opacity="0.9" />
          <path d="M0,52 C34.5,36 103.5,36 138,52 L138,130 L0,130 Z" fill={C.teal} />
          <path d="M0,76 C34.5,62 103.5,62 138,76 L138,130 L0,130 Z" fill={C.ink} opacity="0.5" />
        </svg>
        <div style={{ position: 'absolute', top: 11, left: 15, right: 15, display: 'flex', justifyContent: 'space-between',
          alignItems: 'center', color: '#fff', fontFamily: "'Outfit', sans-serif", fontSize: 9.5, fontWeight: 600 }}>
          <span style={{ letterSpacing: '0.02em' }}>9:41</span>
          <span style={icon}>
            <svg width="11" height="8" viewBox="0 0 11 8"><rect x="0" y="5" width="1.6" height="3" rx="0.5" fill="#fff" /><rect x="2.6" y="3.4" width="1.6" height="4.6" rx="0.5" fill="#fff" /><rect x="5.2" y="1.7" width="1.6" height="6.3" rx="0.5" fill="#fff" /><rect x="7.8" y="0" width="1.6" height="8" rx="0.5" fill="#fff" /></svg>
            <span style={{ display: 'inline-block', width: 14, height: 7.5, borderRadius: 2, border: '1px solid rgba(255,255,255,0.8)', position: 'relative' }}>
              <span style={{ position: 'absolute', inset: 1, width: '70%', background: '#fff', borderRadius: 1 }} />
            </span>
          </span>
        </div>
        <div style={{ position: 'absolute', top: 10, left: '50%', transform: 'translateX(-50%)', width: 38, height: 12, borderRadius: 7, background: '#000' }} />
        <div style={{ position: 'absolute', top: 127, left: 0, right: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 8 }}>
          <div style={{ fontFamily: "'Space Grotesk', sans-serif", fontSize: 19, fontWeight: 700, letterSpacing: '0.05em', color: '#fff', whiteSpace: 'nowrap' }}>
            COCO<span style={{ color: 'var(--ct-accent)' }}>&nbsp;TIDE</span>
          </div>
          <div style={{ width: 24, height: 2, borderRadius: 2, background: 'rgba(255,255,255,0.55)' }} />
          <div style={{ color: 'rgba(255,255,255,0.82)', fontFamily: "'Outfit', sans-serif", fontSize: 7.5,
            letterSpacing: '0.24em', fontWeight: 500, lineHeight: 1.8, textAlign: 'center', maxWidth: 96 }}>WHERE OCEAN MEETS CITY</div>
        </div>
      </div>
    </div>
  );
}

/* ---- coaster ---- */
function Coaster() {
  return (
    <div style={{ width: 150, height: 150, borderRadius: '50%', background: C.sand,
      display: 'flex', alignItems: 'center', justifyContent: 'center',
      boxShadow: 'inset 0 0 0 6px rgba(12,63,58,0.12)' }}>
      <Badge s={132} />
    </div>
  );
}

/* ---- business card (front + back) ---- */
function BusinessCard() {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 16, alignItems: 'center' }}>
      <div style={{ width: 250, height: 150, borderRadius: 12, background: C.ink, position: 'relative',
        overflow: 'hidden', boxShadow: '0 10px 24px rgba(0,0,0,0.18)',
        display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
        <Badge s={104} reversed={true} />
      </div>
      <div style={{ width: 250, height: 150, borderRadius: 12, background: C.cream, position: 'relative',
        overflow: 'hidden', boxShadow: '0 10px 24px rgba(0,0,0,0.12)', padding: 22, boxSizing: 'border-box' }}>
        <Wordmark size={20} place={false} center={false} />
        <div style={{ fontFamily: "'Outfit', sans-serif", fontSize: 11, color: C.teal, letterSpacing: '0.18em', marginTop: 5 }}>BEACHSIDE · HULHUMALÉ</div>
        <div style={{ position: 'absolute', left: 22, bottom: 20, fontFamily: "'Outfit', sans-serif", fontSize: 11.5, lineHeight: 1.7, color: '#3a5a54' }}>
          <div style={{ fontWeight: 600, color: C.ink }}>Maya Reef · Floor Lead</div>
          <div>hello@cocotide.mv · @cocotide</div>
        </div>
        <div style={{ position: 'absolute', right: -16, bottom: -16, opacity: 0.9 }}><Core s={64} /></div>
      </div>
    </div>
  );
}

/* ---- menu card ---- */
function MenuCard() {
  const item = (n, p) => (
    <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', gap: 8 }}>
      <span style={{ fontFamily: "'Outfit', sans-serif", fontSize: 11.5, color: '#26443f', whiteSpace: 'nowrap' }}>{n}</span>
      <span style={{ flex: 1, borderBottom: '1px dotted rgba(12,63,58,0.25)', margin: '0 2px 3px' }} />
      <span style={{ fontFamily: "'Space Grotesk', sans-serif", fontSize: 11.5, fontWeight: 600, color: 'var(--ct-accent)' }}>{p}</span>
    </div>
  );
  return (
    <div style={{ width: 215, background: C.cream, borderRadius: 12, padding: '26px 24px',
      boxShadow: '0 12px 28px rgba(0,0,0,0.14)' }}>
      <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 10, marginBottom: 18 }}>
        <Core s={54} />
        <div style={{ fontFamily: "'Space Grotesk', sans-serif", fontSize: 11, fontWeight: 600, letterSpacing: '0.34em', color: C.ink }}>COCONUT BAR</div>
      </div>
      <div style={{ display: 'flex', flexDirection: 'column', gap: 11 }}>
        {item('Tide Cold Brew', '95')}
        {item('Coco Matcha', '110')}
        {item('Sunset Spritz', '130')}
        {item('Reef Greens', '160')}
        {item('Salt & Lime', '85')}
      </div>
      <div style={{ marginTop: 18, paddingTop: 12, borderTop: '1px solid rgba(12,63,58,0.12)',
        textAlign: 'center', fontFamily: "'Outfit', sans-serif", fontSize: 9.5, letterSpacing: '0.22em', color: C.teal }}>
        WHERE OCEAN MEETS CITY
      </div>
    </div>
  );
}

/* ---- exterior signage ---- */
function Signage() {
  return (
    <div style={{ width: '100%', height: 230, borderRadius: 16, overflow: 'hidden', position: 'relative',
      background: 'linear-gradient(180deg, #cfe7e6 0%, #e3ddca 100%)',
      display: 'flex', alignItems: 'flex-end', justifyContent: 'center' }}>
      {/* facade */}
      <div style={{ width: '84%', height: 168, background: C.cream, borderRadius: '8px 8px 0 0',
        position: 'relative', boxShadow: '0 -10px 28px rgba(0,0,0,0.08)', borderBottom: `7px solid ${C.ink}` }}>
        {/* striped awning along the top */}
        <div style={{ position: 'absolute', top: 0, left: 0, right: 0, height: 18,
          background: `repeating-linear-gradient(90deg, ${C.teal} 0 16px, ${C.cream} 16px 32px)`,
          borderRadius: '8px 8px 0 0' }} />
        {/* centered mark + wordmark, symmetric, with clear space below the awning */}
        <div style={{ position: 'absolute', top: 18, bottom: 0, left: 0, right: 0,
          display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 12 }}>
          <Core s={46} />
          <Wordmark size={22} place={true} />
        </div>
      </div>
    </div>
  );
}

/* ---- social post ---- */
function SocialPost() {
  return (
    <div style={{ width: 200, height: 200, borderRadius: 16, overflow: 'hidden', position: 'relative',
      background: `linear-gradient(160deg, ${C.turq}, ${C.teal})`, boxShadow: '0 12px 26px rgba(0,0,0,0.16)' }}>
      <div style={{ position: 'absolute', inset: 0, opacity: 0.5,
        backgroundImage: `url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'><path d='M-2,30 C22,16 68,16 92,30 M-2,56 C22,42 68,42 92,56' fill='none' stroke='${C.cream}' stroke-width='3' stroke-linecap='round' opacity='0.5'/></svg>`)}")` }} />
      <div style={{ position: 'absolute', top: 16, left: 16, width: 40, height: 40, borderRadius: '50%',
        background: 'var(--ct-accent)', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
        <Core s={34} mono={C.cream} />
      </div>
      <div style={{ position: 'absolute', left: 18, bottom: 20, right: 18 }}>
        <div style={{ fontFamily: "'Space Grotesk', sans-serif", fontSize: 27, fontWeight: 700, lineHeight: 1.05, color: '#fff' }}>
          SUNDAY<br />SUNDOWN
        </div>
        <div style={{ fontFamily: "'Outfit', sans-serif", fontSize: 10.5, letterSpacing: '0.16em', color: 'rgba(255,255,255,0.85)', marginTop: 8, whiteSpace: 'nowrap' }}>
          LIVE SETS · 5–8 PM
        </div>
      </div>
    </div>
  );
}

/* ---- gift card ---- */
function GiftCard() {
  return (
    <div style={{ width: 250, height: 150, borderRadius: 12, overflow: 'hidden', position: 'relative',
      background: C.teal, boxShadow: '0 10px 24px rgba(0,0,0,0.18)' }}>
      <svg viewBox="0 0 250 80" width="250" height="80" style={{ position: 'absolute', bottom: 0, left: 0 }}>
        <path d="M0,28 C62,10 188,10 250,28 L250,80 L0,80 Z" fill={C.aqua} opacity="0.85" />
        <path d="M0,44 C62,26 188,26 250,44 L250,80 L0,80 Z" fill={C.ink} opacity="0.5" />
      </svg>
      <div style={{ position: 'absolute', top: 18, left: 20 }}><Core s={50} mono={C.cream} /></div>
      <div style={{ position: 'absolute', top: 22, right: 22, fontFamily: "'Space Grotesk', sans-serif",
        fontSize: 12, fontWeight: 600, letterSpacing: '0.28em', color: C.cream }}>GIFT CARD</div>
      <div style={{ position: 'absolute', left: 20, bottom: 16, fontFamily: "'Space Grotesk', sans-serif",
        fontSize: 26, fontWeight: 700, color: '#fff' }}>MVR 500</div>
    </div>
  );
}

/* ---- staff tee ---- */
function Tee() {
  return (
    <div style={{ position: 'relative', width: 190, height: 170 }}>
      <svg viewBox="0 0 200 180" width="190" height="170">
        <path d="M58,14 L86,6 C92,18 108,18 114,6 L142,14 L168,40 L150,60 L140,50 L140,172 L60,172 L60,50 L50,60 L32,40 Z"
          fill={C.ink} stroke="rgba(0,0,0,0.1)" strokeWidth="1" />
      </svg>
      <div style={{ position: 'absolute', top: 66, left: '50%', transform: 'translateX(-50%)' }}>
        <Core s={58} mono={C.cream} />
      </div>
    </div>
  );
}

/* ---- packaging / takeaway bag ---- */
function Bag() {
  return (
    <div style={{ position: 'relative', width: 150, height: 180 }}>
      <div style={{ position: 'absolute', top: 18, left: 0, width: 150, height: 162, background: C.sand,
        borderRadius: '4px 4px 6px 6px', boxShadow: 'inset 0 0 0 1px rgba(12,63,58,0.08)' }} />
      <div style={{ position: 'absolute', top: 18, left: 0, width: 150, height: 22, background: 'rgba(12,63,58,0.06)' }} />
      <div style={{ position: 'absolute', top: 0, left: 38, width: 26, height: 30, border: `5px solid ${C.ink}`,
        borderBottom: 'none', borderRadius: '14px 14px 0 0' }} />
      <div style={{ position: 'absolute', top: 0, right: 38, width: 26, height: 30, border: `5px solid ${C.ink}`,
        borderBottom: 'none', borderRadius: '14px 14px 0 0' }} />
      <div style={{ position: 'absolute', top: 74, left: 0, right: 0, display: 'flex', justifyContent: 'center' }}>
        <Badge s={96} />
      </div>
    </div>
  );
}

Object.assign(window, { Avatar, NeonSign, Cup, Tote, Wallpaper, Coaster, BusinessCard, MenuCard, Signage, SocialPost, GiftCard, Tee, Bag });
