// Banner em destaque para Dia dos Namorados (12/06)
// Inspirado nos stories da Lua Azul: aquarela azul, corações desenhados à mão,
// pulseiras em destaque, contagem regressiva.

const NAMORADOS_DATE = '2026-06-12T00:00:00-03:00';

const NAMORADOS_FEATURED = [
  { id: 'pl-ayla',     name: 'Pulseira Ayla',     sub: 'Aço Inox Legítimo',     price: 45.90, hue: 200 },
  { id: 'pl-nataly',   name: 'Pulseira Nataly',   sub: 'Banhada a ouro 18K',    price: 47.90, hue: 350 },
  { id: 'pl-isabelle', name: 'Pulseira Isabelle', sub: 'Banhada a ouro 18K',    price: 47.90, hue: 15 },
  { id: 'pl-sina',     name: 'Pulseira Siná',     sub: 'Banhada a ouro 18K',    price: 47.90, hue: 210 },
];

// ----- countdown hook -----
function useCountdown(targetIso) {
  const [now, setNow] = useState(() => Date.now());
  useEffect(() => {
    const i = setInterval(() => setNow(Date.now()), 1000);
    return () => clearInterval(i);
  }, []);
  const target = new Date(targetIso).getTime();
  const diff = Math.max(0, target - now);
  const d = Math.floor(diff / 86400000);
  const h = Math.floor((diff % 86400000) / 3600000);
  const m = Math.floor((diff % 3600000) / 60000);
  const s = Math.floor((diff % 60000) / 1000);
  return { d, h, m, s, expired: diff === 0 };
}

// ----- watercolor splash via SVG -----
function WatercolorSplash({ pos = 'tl', color = '#7a9cd9', size = 380, rotation = 0, opacity = 0.55 }) {
  const id = useMemo(() => 'wc-' + Math.random().toString(36).slice(2), []);
  const posStyle = {
    tl: { top: -size * 0.35, left: -size * 0.25 },
    tr: { top: -size * 0.35, right: -size * 0.25 },
    bl: { bottom: -size * 0.35, left: -size * 0.25 },
    br: { bottom: -size * 0.35, right: -size * 0.25 },
  }[pos] || {};
  return (
    <svg
      width={size} height={size} viewBox="0 0 200 200"
      style={{
        position: 'absolute', pointerEvents: 'none',
        transform: `rotate(${rotation}deg)`, opacity,
        ...posStyle,
      }}
    >
      <defs>
        <filter id={`${id}-rough`} x="-20%" y="-20%" width="140%" height="140%">
          <feTurbulence type="fractalNoise" baseFrequency="0.022" numOctaves="3" seed="7"/>
          <feDisplacementMap in="SourceGraphic" scale="22"/>
        </filter>
        <radialGradient id={`${id}-g1`} cx="0.45" cy="0.5" r="0.55">
          <stop offset="0%"   stopColor={color} stopOpacity="0.0"/>
          <stop offset="55%"  stopColor={color} stopOpacity="0.35"/>
          <stop offset="100%" stopColor={color} stopOpacity="0.75"/>
        </radialGradient>
        <radialGradient id={`${id}-g2`} cx="0.5" cy="0.5" r="0.5">
          <stop offset="0%"   stopColor={color} stopOpacity="0.10"/>
          <stop offset="100%" stopColor={color} stopOpacity="0"/>
        </radialGradient>
      </defs>
      <g filter={`url(#${id}-rough)`}>
        <ellipse cx="100" cy="100" rx="78" ry="60" fill={`url(#${id}-g1)`}/>
        <ellipse cx="120" cy="80"  rx="48" ry="34" fill={color} opacity="0.18"/>
        <ellipse cx="80"  cy="120" rx="40" ry="28" fill={color} opacity="0.14"/>
      </g>
      {/* fine spray dots */}
      <g fill={color} opacity="0.35">
        {[[30,40],[170,55],[20,150],[180,140],[160,170],[40,170],[160,30]].map(([x,y],i)=>(
          <circle key={i} cx={x} cy={y} r={1 + (i%3)*0.6}/>
        ))}
      </g>
      <ellipse cx="100" cy="100" rx="60" ry="46" fill={`url(#${id}-g2)`}/>
    </svg>
  );
}

// ----- hand-drawn heart -----
function DrawnHeart({ size = 60, color = '#5d7fc4', stroke = 2, style = {} }) {
  const id = useMemo(() => 'hh-' + Math.random().toString(36).slice(2), []);
  // Two overlapping slightly-offset paths => sketchy double-stroke look
  return (
    <svg width={size} height={size} viewBox="0 0 100 100" style={{ position: 'absolute', pointerEvents: 'none', ...style }}>
      <defs>
        <filter id={`${id}-shake`} x="-10%" y="-10%" width="120%" height="120%">
          <feTurbulence type="fractalNoise" baseFrequency="0.04" numOctaves="2" seed="3"/>
          <feDisplacementMap in="SourceGraphic" scale="2.2"/>
        </filter>
      </defs>
      <g fill="none" stroke={color} strokeWidth={stroke} strokeLinecap="round" strokeLinejoin="round" filter={`url(#${id}-shake)`}>
        <path d="M50 84 C 22 64, 14 44, 22 30 C 30 18, 44 20, 50 34 C 56 20, 70 18, 78 30 C 86 44, 78 64, 50 84 Z"/>
        <path d="M50 80 C 26 62, 18 44, 26 32 C 33 22, 45 24, 50 36" opacity="0.55"/>
        <path d="M52 38 C 57 24, 68 22, 75 32 C 82 44, 75 60, 52 78" opacity="0.55"/>
      </g>
    </svg>
  );
}

// ----- small jewelry illustration tuned for bracelets (beaded loop) -----
function BeadedBracelet({ hue = 200, size = '100%' }) {
  const id = useMemo(() => 'bb-' + Math.random().toString(36).slice(2), []);
  const stone = `oklch(0.72 0.14 ${hue})`;
  const stoneB = `oklch(0.58 0.16 ${hue + 4})`;
  const accent = `oklch(0.78 0.10 ${(hue + 40) % 360})`;
  const pearl = '#f6f1ea';
  const metal = '#d4af6a';
  const beads = [];
  const N = 18;
  for (let i = 0; i < N; i++) {
    const a = (i / N) * Math.PI * 2 - Math.PI / 2;
    const r = 92;
    const x = 150 + Math.cos(a) * r;
    const y = 150 + Math.sin(a) * r;
    // alternate: pearl, stone, pearl, accent
    const type = i % 4;
    beads.push({ x, y, type });
  }
  return (
    <svg viewBox="0 0 300 300" width={size} height={size} preserveAspectRatio="xMidYMid meet"
         style={{ display: 'block', width: '100%', height: '100%' }}>
      <defs>
        <radialGradient id={`${id}-p`} cx="0.35" cy="0.3"><stop offset="0%" stopColor="#fff" stopOpacity="0.95"/><stop offset="100%" stopColor={pearl}/></radialGradient>
        <radialGradient id={`${id}-s`} cx="0.35" cy="0.3"><stop offset="0%" stopColor="#fff" stopOpacity="0.7"/><stop offset="60%" stopColor={stone}/><stop offset="100%" stopColor={stoneB}/></radialGradient>
        <radialGradient id={`${id}-a`} cx="0.35" cy="0.3"><stop offset="0%" stopColor="#fff" stopOpacity="0.7"/><stop offset="100%" stopColor={accent}/></radialGradient>
      </defs>
      {/* string ring */}
      <circle cx="150" cy="150" r="92" stroke={metal} strokeWidth="1" fill="none" opacity="0.4"/>
      {beads.map((b, i) => {
        const fill = b.type === 0 ? `url(#${id}-p)` : b.type === 1 ? `url(#${id}-s)` : b.type === 2 ? `url(#${id}-p)` : `url(#${id}-a)`;
        const r = b.type === 1 ? 11 : b.type === 3 ? 9 : 10;
        return (
          <g key={i}>
            <circle cx={b.x} cy={b.y} r={r} fill={fill} stroke="rgba(0,0,0,0.08)" strokeWidth="0.5"/>
            <circle cx={b.x - r * 0.32} cy={b.y - r * 0.32} r={r * 0.25} fill="#fff" opacity="0.7"/>
          </g>
        );
      })}
      {/* clasp suggestion */}
      <circle cx="150" cy="58" r="6" fill={metal} opacity="0.7"/>
    </svg>
  );
}

// ----- countdown pip -----
function CountPip({ n, label }) {
  return (
    <div style={{ textAlign: 'center', minWidth: 56 }}>
      <div className="serif" style={{
        fontSize: 'clamp(28px, 3.2vw, 44px)', fontWeight: 500, lineHeight: 1,
        color: 'var(--blue-800)',
        fontFeatureSettings: '"tnum" 1',
      }}>
        {String(n).padStart(2, '0')}
      </div>
      <div style={{
        fontSize: 10, fontFamily: 'var(--mono)',
        letterSpacing: '0.16em', textTransform: 'uppercase',
        color: 'var(--ink-3)', marginTop: 6,
      }}>{label}</div>
    </div>
  );
}

// ====== MAIN BANNER ======
function ValentinesBanner() {
  const { d, h, m, s } = useCountdown(NAMORADOS_DATE);
  const cart = useCart();

  const [items, setItems] = useState(NAMORADOS_FEATURED);
  useEffect(() => {
    fetch('/api/products?special=namorados&_=' + Date.now(), { cache: 'no-store' })
      .then(r => r.ok ? r.json() : null)
      .then(data => {
        if (data && data.products && data.products.length > 0) {
          const mapped = data.products.slice(0, 4).map(p => ({
            id: p.id || p.slug,
            slug: p.slug,
            name: p.name,
            sub: p.short || p.cat || '',
            price: p.price,
            hue: p.hue || 200,
            image: p.image,
            images: p.images,
          }));
          setItems(mapped);
        }
      })
      .catch(() => {});
  }, []);

  // Coral / blush V-Day accent on top of brand blue
  const coral = '#e25c7c';
  const coralSoft = '#fbe1e7';

  return (
    <section id="namorados" style={{
      position: 'relative', overflow: 'hidden',
      background: 'linear-gradient(180deg, #eaf2fb 0%, #f4f8fd 55%, #fdf4f6 100%)',
      padding: '64px 0 72px',
      borderBottom: '1px solid var(--line)',
    }}>
      {/* watercolor corners */}
      <WatercolorSplash pos="tl" color="#6b8fcc" size={420} rotation={-12} opacity={0.5}/>
      <WatercolorSplash pos="tr" color="#88a8db" size={340} rotation={28} opacity={0.42}/>
      <WatercolorSplash pos="bl" color="#7ea3d4" size={360} rotation={45} opacity={0.4}/>
      <WatercolorSplash pos="br" color={coral} size={300} rotation={-25} opacity={0.28}/>

      {/* floating hand-drawn hearts */}
      <DrawnHeart size={48} color="#6b8fcc" style={{ top: 48, right: '14%', transform: 'rotate(-12deg)' }}/>
      <DrawnHeart size={34} color="#88a8db" style={{ top: 120, right: '8%', transform: 'rotate(8deg)' }}/>
      <DrawnHeart size={28} color="#7ea3d4" style={{ top: 200, right: '18%', transform: 'rotate(-18deg)' }}/>
      <DrawnHeart size={42} color={coral}  style={{ bottom: 64, left: '10%', transform: 'rotate(14deg)', opacity: 0.85 }}/>
      <DrawnHeart size={26} color={coral}  style={{ bottom: 32, left: '18%', transform: 'rotate(-6deg)', opacity: 0.75 }}/>
      <DrawnHeart size={22} color="#6b8fcc" style={{ top: 64, left: '6%', transform: 'rotate(20deg)' }}/>

      <div className="container" style={{ position: 'relative', zIndex: 2 }}>
        {/* GRID: copy / featured products */}
        <div className="two-up" style={{
          display: 'grid', gridTemplateColumns: '1.05fr 1fr', gap: 56, alignItems: 'center',
        }}>
          {/* LEFT — copy */}
          <div className="reveal">
            <div style={{
              display: 'inline-flex', alignItems: 'center', gap: 10,
              background: 'white', border: `1px solid ${coralSoft}`,
              padding: '8px 14px 8px 10px', borderRadius: 999,
              boxShadow: '0 6px 20px -10px rgba(226,92,124,0.35)',
              marginBottom: 22,
            }}>
              <span style={{
                width: 26, height: 26, borderRadius: '50%',
                background: coralSoft, color: coral,
                display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
              }}><Icon name="heart" size={14}/></span>
              <span style={{
                fontFamily: 'var(--mono)', fontSize: 11, letterSpacing: '0.18em',
                textTransform: 'uppercase', color: coral, fontWeight: 600,
              }}>Dia dos Namorados · 12 . 06</span>
            </div>

            <h2 className="serif" style={{
              fontSize: 'clamp(44px, 5.2vw, 78px)', lineHeight: 1.0,
              margin: 0, fontWeight: 400, letterSpacing: '-0.02em',
              color: 'var(--blue-900)',
            }}>
              Presenteie quem<br/>
              você <em style={{
                fontStyle: 'italic',
                color: coral,
                position: 'relative', display: 'inline-block',
              }}>
                ama
                {/* sketchy underline */}
                <svg width="120" height="14" viewBox="0 0 120 14" style={{
                  position: 'absolute', left: -4, bottom: -6, width: '108%', height: 14,
                }}>
                  <path d="M2 9 C 20 3, 40 12, 60 6 S 100 10, 118 5" fill="none" stroke={coral} strokeWidth="2" strokeLinecap="round" opacity="0.7"/>
                </svg>
              </em>.
            </h2>

            <p style={{
              fontSize: 17, lineHeight: 1.6, color: 'var(--ink-2)',
              margin: '24px 0 0', maxWidth: 480,
            }}>
              Pulseiras, colares e brincos feitos à mão em Salvador. Embalagem de presente <em>cortesia</em> e entrega antes do dia 12.
            </p>

            {/* countdown */}
            <div style={{
              marginTop: 32, padding: '18px 22px',
              background: 'rgba(255,255,255,0.7)',
              backdropFilter: 'blur(8px)',
              border: '1px solid rgba(255,255,255,0.9)',
              borderRadius: 18,
              boxShadow: '0 12px 32px -16px rgba(11,46,54,0.25)',
              display: 'inline-flex', alignItems: 'center', gap: 8,
            }}>
              <div style={{
                fontFamily: 'var(--mono)', fontSize: 10, letterSpacing: '0.16em',
                textTransform: 'uppercase', color: 'var(--ink-3)',
                writingMode: 'vertical-rl', transform: 'rotate(180deg)',
                paddingRight: 8, borderRight: '1px solid var(--line)',
                marginRight: 6,
              }}>
                Faltam
              </div>
              <CountPip n={d} label="Dias"/>
              <span style={{ color: 'var(--ink-3)', fontSize: 24, fontWeight: 300 }}>:</span>
              <CountPip n={h} label="Horas"/>
              <span style={{ color: 'var(--ink-3)', fontSize: 24, fontWeight: 300 }}>:</span>
              <CountPip n={m} label="Min"/>
              <span style={{ color: 'var(--ink-3)', fontSize: 24, fontWeight: 300 }}>:</span>
              <CountPip n={s} label="Seg"/>
            </div>

            {/* CTAs */}
            <div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', marginTop: 28 }}>
              <a href="#namorados-grid" className="btn" style={{
                height: 54, padding: '0 28px', fontSize: 15,
                background: `linear-gradient(135deg, ${coral}, #c8466b)`,
                color: 'white',
                boxShadow: `0 14px 28px -8px ${coral}80`,
              }}>
                Ver presentes <Icon name="arrow" size={16}/>
              </a>
              <a href="https://wa.me/5571999181376?text=Quero%20ajuda%20com%20um%20presente%20de%20Namorados"
                 target="_blank" rel="noreferrer" className="btn btn-ghost"
                 style={{ height: 54, padding: '0 22px', fontSize: 14 }}>
                <Icon name="whatsapp" size={16}/> Ajuda no WhatsApp
              </a>
            </div>

            {/* perks strip */}
            <div style={{
              display: 'flex', flexWrap: 'wrap', gap: 18,
              marginTop: 28, paddingTop: 24,
              borderTop: '1px dashed var(--line)',
              fontSize: 12, fontFamily: 'var(--mono)',
              textTransform: 'uppercase', letterSpacing: '0.1em',
              color: 'var(--ink-2)',
            }}>
              <span style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>
                <Icon name="sparkle" size={14}/> Embalagem presente grátis
              </span>
              <span style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>
                <Icon name="truck" size={14}/> Entrega antes do dia 12
              </span>
              <span style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>
                <Icon name="heart" size={14}/> Parcele em 6x
              </span>
            </div>
          </div>

          {/* RIGHT — featured bracelet stack */}
          <div style={{ position: 'relative', minHeight: 520 }}>
            {/* big halo behind */}
            <div style={{
              position: 'absolute', inset: '8% 6%',
              borderRadius: '50%',
              background: 'radial-gradient(circle at 50% 50%, rgba(255,255,255,0.9) 0%, rgba(234,242,251,0) 70%)',
              filter: 'blur(4px)', zIndex: 0,
            }}/>
            {/* central bracelet card */}
            {items[1] && <FeaturedCard
              item={items[1]}
              style={{
                position: 'absolute', top: '6%', left: '18%', width: '64%',
                zIndex: 3, animation: 'float-y 7s ease-in-out infinite',
              }}
              big
              onAdd={() => cart && cart.add({ ...items[1], cat: 'Pulseiras' })}
            />}
            {items[0] && <FeaturedCard
              item={items[0]}
              style={{
                position: 'absolute', top: '38%', left: '-2%', width: '44%',
                zIndex: 2, transform: 'rotate(-6deg)',
                animation: 'float-y 8s ease-in-out infinite', animationDelay: '0.4s',
              }}
              onAdd={() => cart && cart.add({ ...items[0], cat: 'Pulseiras' })}
            />}
            {items[2] && <FeaturedCard
              item={items[2]}
              style={{
                position: 'absolute', bottom: '4%', right: '-2%', width: '44%',
                zIndex: 2, transform: 'rotate(5deg)',
                animation: 'float-y 9s ease-in-out infinite', animationDelay: '0.8s',
              }}
              onAdd={() => cart && cart.add({ ...items[2], cat: 'Pulseiras' })}
            />}

            {/* moon mark accent */}
            <div style={{
              position: 'absolute', top: '0', right: '4%',
              width: 56, height: 56, borderRadius: '50%',
              background: 'radial-gradient(circle at 35% 30%, #ffffff, #c7dbf3 70%, #8eaadb 100%)',
              boxShadow: '0 8px 24px -10px rgba(11,46,54,0.3)',
              zIndex: 4,
              display: 'flex', alignItems: 'center', justifyContent: 'center',
              color: 'var(--blue-700)',
              animation: 'spin-slow 40s linear infinite',
            }}>
              <Icon name="moon" size={20}/>
            </div>
          </div>
        </div>

        {/* ====== GRID of 4 featured bracelets ====== */}
        <div id="namorados-grid" style={{ marginTop: 80, position: 'relative' }}>
          <div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', flexWrap: 'wrap', gap: 12, marginBottom: 28 }}>
            <div>
              <div className="eyebrow" style={{ color: coral, marginBottom: 8 }}>Pulseiras em destaque</div>
              <h3 className="serif" style={{ margin: 0, fontSize: 'clamp(28px, 3vw, 42px)', fontWeight: 400, letterSpacing: '-0.01em' }}>
                Para presentear seu amor
              </h3>
            </div>
            <a href="categoria.html?cat=namorados" style={{
              fontSize: 13, color: 'var(--blue-700)',
              display: 'inline-flex', alignItems: 'center', gap: 6,
              borderBottom: '1px solid var(--blue-200)', paddingBottom: 2,
            }}>
              Ver coleção completa <Icon name="arrow" size={14}/>
            </a>
          </div>

          <div className="four-up" style={{
            display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 22,
          }}>
            {items.map(item => (
              <NamoradosCard
                key={item.id} item={item}
                onAdd={() => cart && cart.add({ ...item, cat: 'Pulseiras' })}
              />
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

// ----- "Floating" featured card used in the right collage -----
function FeaturedCard({ item, style, big = false, onAdd }) {
  const [hover, setHover] = useState(false);
  const img1 = item.image || (item.images && item.images[0] && item.images[0].url);
  const img2 = (item.images && item.images[1] && item.images[1].url) || img1;
  const href = item.slug ? `/produto?slug=${item.slug}` : '#';
  return (
    <div
      onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
      style={{
        background: 'white', borderRadius: 22, overflow: 'hidden',
        boxShadow: hover
          ? '0 30px 60px -16px rgba(11,46,54,0.32)'
          : '0 20px 40px -16px rgba(11,46,54,0.22)',
        transition: 'box-shadow .25s ease, transform .25s ease',
        ...style,
      }}
    >
      <a href={href} style={{ display: 'block', aspectRatio: '1/1', background: '#f6f2ec', position: 'relative', overflow: 'hidden' }}>
        {img1
          ? <>
              <img src={img1} alt={item.name} style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover', transition: 'opacity .35s ease', opacity: hover ? 0 : 1 }}/>
              <img src={img2} alt={item.name} style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover', transition: 'opacity .35s ease', opacity: hover ? 1 : 0 }}/>
            </>
          : <BeadedBracelet hue={item.hue}/>
        }
      </a>
      <div style={{ padding: big ? '16px 18px' : '12px 14px' }}>
        <div className="serif" style={{ fontSize: big ? 20 : 15, fontWeight: 500, color: 'var(--blue-900)' }}>
          {item.name}
        </div>
        <div style={{
          fontSize: big ? 12 : 11, color: 'var(--ink-3)',
          fontFamily: 'var(--mono)', letterSpacing: '0.06em',
          marginTop: 2,
        }}>{item.sub}</div>
        <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginTop: big ? 10 : 8 }}>
          <span className="serif" style={{ fontSize: big ? 22 : 17, fontWeight: 600, color: 'var(--blue-800)' }}>
            R$ {item.price.toFixed(2).replace('.', ',')}
          </span>
          <button onClick={onAdd} aria-label="Adicionar" style={{
            width: big ? 36 : 30, height: big ? 36 : 30, borderRadius: '50%',
            background: 'var(--grad)', color: 'white', border: 'none',
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
            cursor: 'pointer',
            boxShadow: '0 6px 14px -4px rgba(6,182,212,0.5)',
          }}>
            <Icon name="plus" size={big ? 16 : 14}/>
          </button>
        </div>
      </div>
    </div>
  );
}

// ----- Grid card -----
function NamoradosCard({ item, onAdd }) {
  const [hover, setHover] = useState(false);
  const img1 = item.image || (item.images && item.images[0] && item.images[0].url);
  const img2 = (item.images && item.images[1] && item.images[1].url) || img1;
  const href = item.slug ? `/produto?slug=${item.slug}` : '#';
  return (
    <div
      onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}
      style={{
        background: 'white', borderRadius: 18, overflow: 'hidden',
        border: '1px solid var(--line)',
        transition: 'all .2s ease',
        transform: hover ? 'translateY(-4px)' : 'none',
        boxShadow: hover
          ? '0 24px 48px -16px rgba(11,46,54,0.18)'
          : '0 4px 12px -6px rgba(11,46,54,0.08)',
        position: 'relative',
      }}
    >
      <div style={{ position: 'absolute', top: 12, left: 12, zIndex: 2 }}>
        <span style={{
          display: 'inline-flex', alignItems: 'center', gap: 6,
          background: 'white', color: '#e25c7c',
          padding: '5px 10px 5px 7px', borderRadius: 999,
          fontSize: 10, fontFamily: 'var(--mono)',
          letterSpacing: '0.12em', textTransform: 'uppercase',
          fontWeight: 600,
          boxShadow: '0 6px 14px -6px rgba(11,46,54,0.18)',
        }}>
          <Icon name="heart" size={11}/> Namorados
        </span>
      </div>
      <a href={href} style={{ display: 'block', aspectRatio: '1/1', background: '#f6f2ec', position: 'relative', overflow: 'hidden' }}>
        {img1
          ? <>
              <img src={img1} alt={item.name} style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover', transition: 'opacity .35s ease', opacity: hover ? 0 : 1 }}/>
              <img src={img2} alt={item.name} style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover', transition: 'opacity .35s ease', opacity: hover ? 1 : 0 }}/>
            </>
          : <BeadedBracelet hue={item.hue}/>
        }
      </a>
      <div style={{ padding: '14px 16px 16px' }}>
        <div className="serif" style={{ fontSize: 18, fontWeight: 500, color: 'var(--blue-900)' }}>
          {item.name}
        </div>
        <div style={{
          fontSize: 11, color: 'var(--ink-3)',
          fontFamily: 'var(--mono)', letterSpacing: '0.06em',
          marginTop: 2,
        }}>{item.sub}</div>
        <div style={{
          marginTop: 12, paddingTop: 12,
          borderTop: '1px dashed var(--line)',
          display: 'flex', alignItems: 'center', justifyContent: 'space-between',
        }}>
          <span className="serif" style={{ fontSize: 20, fontWeight: 600, color: 'var(--blue-800)' }}>
            R$ {item.price.toFixed(2).replace('.', ',')}
          </span>
          <button onClick={onAdd} className="btn"
            style={{
              height: 34, padding: '0 14px', fontSize: 12,
              background: 'var(--ink)', color: 'white',
              borderRadius: 999,
            }}>
            Comprar <Icon name="arrow" size={12}/>
          </button>
        </div>
      </div>
    </div>
  );
}

// ====== TOP ANNOUNCEMENT STRIP (V-Day version) ======
function ValentinesStrip() {
  return (
    <div style={{
      background: 'linear-gradient(90deg, #e25c7c 0%, #c8466b 50%, #2d5b8a 100%)',
      color: 'white', textAlign: 'center',
      fontSize: 12, letterSpacing: '0.08em', padding: '9px 12px',
      fontFamily: 'var(--mono)',
      display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 10,
      textTransform: 'uppercase',
    }}>
      <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 21s-7-4.5-7-10a4 4 0 0 1 7-2.7A4 4 0 0 1 19 11c0 5.5-7 10-7 10z"/></svg>
      Dia dos Namorados · 12.06 · Embalagem de presente grátis & entrega antes do dia 12
      <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 21s-7-4.5-7-10a4 4 0 0 1 7-2.7A4 4 0 0 1 19 11c0 5.5-7 10-7 10z"/></svg>
    </div>
  );
}

Object.assign(window, { ValentinesBanner, ValentinesStrip });
