/* Industrial Union UI Kit — product catalog
   Early-1900s industrial / railroad & miner heritage workwear.
   Near-monochrome; raw-material colorways. Images are blank slots. */

const CATEGORIES = [
  { id: "jackets", label: "JACKETS & OUTERWEAR", short: "JACKETS" },
  { id: "pants", label: "PANTS & OVERALLS", short: "PANTS" },
];

const PRODUCTS = [
  {
    id: "type-2-jacket", name: "Type 2 Jacket", cat: "jackets", price: 425,
    colorway: "Hickory Stripe", flagship: true,
    fabric: "Vintage hickory stripe", weight: "11 oz",
    construction: "Double-needle chain stitched felled seams",
    madeIn: "Los Angeles, CA",
    sizes: ["XS", "S", "M", "L", "XL", "XXL"],
    slots: ["FRONT", "BACK", "POCKET", "PLACKET", "CUFF"],
    imgs: {
      FRONT: "assets/type-2-jacket-front.jpg",
      BACK: "assets/type-2-jacket-back.jpg",
      POCKET: "assets/type-2-jacket-pocket.jpg",
      PLACKET: "assets/type-2-jacket-placket.jpg",
      CUFF: "assets/type-2-jacket-cuff.jpg",
    },
    blurb: "A pleated jacket cut from the railroad era in hickory-stripe denim. Built to wear in over a working life.",
    care: "Wash cold inside-out, hang dry. The stripe pales handsomely at the cuffs and elbows.",
  },
];

function productsByCat(catId) {
  return catId === "all" ? PRODUCTS : PRODUCTS.filter((p) => p.cat === catId);
}
function findProduct(id) { return PRODUCTS.find((p) => p.id === id); }
/* image path for a given slot, if a real photo exists */
function prodImg(p, slot) { return p && p.imgs && p.imgs[slot] ? p.imgs[slot] : null; }
function catLabel(id) { const c = CATEGORIES.find((c) => c.id === id); return c ? c.label : ""; }
function catShort(id) { const c = CATEGORIES.find((c) => c.id === id); return c ? c.short : ""; }

Object.assign(window, { CATEGORIES, PRODUCTS, productsByCat, findProduct, prodImg, catLabel, catShort });
