const INSTAGRAM = "suburbantroll";
const CASHAPP = "suburbantroll";
const CASHAPP2 = "ssuperrmaan";
const WHATSAPP = "2563088458";

const ITEMS = [
  {
    title: "Vintage Hoodie",
    price: 35,
    img: "",
    desc: "Good condition, oversized fit."
  },
  {
    title: "Streetwear Tee",
    price: 20,
    img: "",
    desc: "High-quality print."
  },
  {
    title: "Jeans / Street Denim",
    price: 40,
    img: "",
    desc: "Clean, no stains."
  }
];

document.addEventListener("DOMContentLoaded", () => {
  document.getElementById("instagram-link").href = `https://instagram.com/${INSTAGRAM}`;
  document.getElementById("cashapp-link").href = `https://cash.app/$${CASHAPP}`;

  const items = document.getElementById("items");
  ITEMS.forEach(i => items.appendChild(makeCard(i)));
});

function makeCard(item){
  const card = document.createElement("div");
  card.className = "card";

  const img = document.createElement("div");
  img.className = "product-img";
  img.textContent = item.img ? "" : item.title;

  if(item.img){
    const im = document.createElement("img");
    im.src = item.img;
    im.style.width = "100%";
    im.style.height = "100%";
    im.style.objectFit = "cover";
    im.style.borderRadius = "10px";
    img.appendChild(im);
  }

  const title = document.createElement("div");
  title.style.fontWeight = "600";
  title.textContent = item.title;

  const price = document.createElement("div");
  price.style.color = "#ffd166";
  price.style.fontWeight = "700";
  price.textContent = `$${item.price}`;

  const desc = document.createElement("div");
  desc.style.color = "var(--muted)";
  desc.style.fontSize = "0.9rem";
  desc.textContent = item.desc;

  const actions = document.createElement("div");
  actions.className = "actions";

  const dm = document.createElement("a");
  dm.className = "action-btn";
  dm.href = `https://instagram.com/${INSTAGRAM}`;
  dm.target = "_blank";
  dm.textContent = "DM to Buy";

  const buy = document.createElement("a");
  buy.className = "action-btn buy";
  buy.href = `https://cash.app/$${CASHAPP}`;
  buy.target = "_blank";
  buy.textContent = "CashApp";

  actions.appendChild(dm);
  actions.appendChild(buy);

  card.appendChild(img);
  card.appendChild(title);
  card.appendChild(price);
  card.appendChild(desc);
  card.appendChild(actions);

  return card;
}