// data.jsx — product + brand data for Sax Playing Dog
// Exposed on window for the other babel scripts.

const HAT_BASE = 'uploads/assets/hats';

// Each colorway carries its own "wash" theme. Picking a color shifts the whole site.
const COLORWAYS = [
  {
    id: 'black',
    name: 'Black',
    swatch: '#111111',
    thread: 'Gold & red thread',
    dir: `${HAT_BASE}/black`,
    files: {
      front: 'corduroy-hat-black-front-6a159381b310d.png',
      rightFront: 'corduroy-hat-black-right-front-6a159381b45f4.png',
      left: 'corduroy-hat-black-left-6a159381b417d.png',
      back: 'corduroy-hat-black-back-6a159381b37b7.png',
      right: 'corduroy-hat-black-right-6a159381b3ccc.png',
      leftFront: 'corduroy-hat-black-left-front-6a159381b4afe.png',
    },
    logo: 'assets/logo-black.png',
    // theme tokens
    theme: {
      hat: '#1a1a1a',        // deep brand color
      hatDeep: '#000000',
      wash: '#f3f2f0',       // page background tint
      panel: '#ffffff',
      accent: '#c8962a',     // gold embroidery accent
      onHat: '#ffffff',
      glow: 'rgba(20,20,20,0.14)',
    },
  },
  {
    id: 'blue',
    name: 'Oxford Navy',
    swatch: '#1d2f4f',
    thread: 'White & blue thread',
    dir: `${HAT_BASE}/blue`,
    files: {
      front: 'corduroy-hat-oxford-navy-front-6a15940ee0ff4.png',
      rightFront: 'corduroy-hat-oxford-navy-right-front-6a15940ee1b18.png',
      left: 'corduroy-hat-oxford-navy-left-6a15940ee18cd.png',
      back: 'corduroy-hat-oxford-navy-back-6a15940ee13e6.png',
      detail: 'corduroy-hat-oxford-navy-product-details-6a15940ee2019.png',
      detail2: 'corduroy-hat-oxford-navy-product-details-2-6a15940ee2297.png',
    },
    logo: 'assets/logo-blue.png',
    theme: {
      hat: '#1d2f4f',
      hatDeep: '#15233c',
      wash: '#eaeff6',
      panel: '#ffffff',
      accent: '#2f6fb3',
      onHat: '#ffffff',
      glow: 'rgba(29,47,79,0.20)',
    },
  },
  {
    id: 'tan',
    name: 'Camel',
    swatch: '#a9763f',
    thread: 'Green & white thread',
    dir: `${HAT_BASE}/tan`,
    files: {
      front: 'corduroy-hat-camel-front-6a159445a82ab.png',
      rightFront: 'corduroy-hat-camel-right-front-6a159445a8b9e.png',
      left: 'corduroy-hat-camel-left-6a159445a898f.png',
      back: 'corduroy-hat-camel-back-6a159445a85a4.png',
      detail: 'corduroy-hat-camel-product-details-6a159445a8fcb.png',
      detail2: 'corduroy-hat-camel-product-details-2-6a159445a91a1.png',
    },
    logo: 'assets/logo-tan.png',
    theme: {
      hat: '#a9763f',
      hatDeep: '#8a5e2f',
      wash: '#f6efe3',
      panel: '#fffdf9',
      accent: '#3f7d5a',
      onHat: '#ffffff',
      glow: 'rgba(169,118,63,0.22)',
    },
  },
  {
    id: 'olive',
    name: 'Dark Olive',
    swatch: '#565a36',
    thread: 'Blue & white thread',
    dir: `${HAT_BASE}/green`,
    files: {
      front: 'corduroy-hat-dark-olive-front-6a1593c8ac126.png',
      rightFront: 'corduroy-hat-dark-olive-right-front-6a1593c8acd71.png',
      left: 'corduroy-hat-dark-olive-left-6a1593c8aca87.png',
      back: 'corduroy-hat-dark-olive-back-6a1593c8ac4c7.png',
      detail: 'corduroy-hat-dark-olive-product-details-6a1593c8ad308.png',
      detail2: 'corduroy-hat-dark-olive-product-details-2-6a1593c8ad5b8.png',
    },
    logo: 'assets/logo-olive.png',
    theme: {
      hat: '#565a36',
      hatDeep: '#43472a',
      wash: '#eef0e5',
      panel: '#fcfdf8',
      accent: '#3f6f8c',
      onHat: '#ffffff',
      glow: 'rgba(86,90,54,0.22)',
    },
  },
];

// Build an ordered gallery (full URLs) for a colorway.
function galleryFor(cw) {
  const f = cw.files;
  const order = ['front', 'rightFront', 'left', 'back', 'detail', 'detail2', 'right', 'leftFront'];
  return order
    .filter((k) => f[k])
    .map((k) => ({ key: k, src: `${cw.dir}/${f[k]}` }));
}

const PRODUCT = {
  name: 'The Corduroy Cap',
  tagline: 'Six-panel corduroy cap with the iconic hand-embroidered Sax Playing Dog.',
  price: 39.99,
  size: 'One size · adjustable strap · ships embroidered to order',
  details: [
    '100% cotton corduroy — soft, unstructured low profile',
    'Iconic "Sax Playing Dog" logo embroidered front & center',
    'Cotton twill sweatband · curved visor · 6-panel construction',
    'Adjustable corduroy strap with silver-tone buckle & grommet',
    'Stitched to order — one cap at a time',
  ],
};

const STORY = {
  kicker: 'The story',
  title: 'One drawing, one first date, one very good dog.',
  body: [
    'I drew the dog years ago — a nod to ancient Egyptian wall art, flattened and side-on, except this one is mid-song with a saxophone. Corduroy has its own ancient lineage: the fabric traces back to Egypt around AD 200, later marketed as corde du roi — cord of the king. Felt right.',
    'I showed it to a girl on our first date. She\'s my wife now. Somewhere between then and the wedding the dog became a thing: stitched onto a hat, handed around to family, asked after by friends.',
    'So we made more. Same drawing, real corduroy, embroidered one cap at a time.',
  ],
};

const SOCIALS = [
  { label: 'Instagram', handle: '@saxplayingdog', href: 'https://instagram.com/saxplayingdog' },
  { label: 'TikTok', handle: '@saxplayingdog', href: 'https://tiktok.com/@saxplayingdog' },
];

// Display order: green (olive) → blue → tan → black
const _ORDER = ['olive', 'blue', 'tan', 'black'];
const COLORWAYS_ORDERED = _ORDER.map((id) => COLORWAYS.find((c) => c.id === id));

Object.assign(window, { COLORWAYS: COLORWAYS_ORDERED, galleryFor, PRODUCT, STORY, SOCIALS });
