// 网站背景图配置（前端可配，不需要改代码）。
// - 手机端用 mobileImages，电脑端用 desktopImages（按视口宽度 768px 区分）
// - blur.enabled 控制是否启用高斯模糊遮罩
// - blur.amount 是模糊强度，建议 4px～10px
// - blur.overlayOpacity 是白色蒙层透明度，0~1，建议 0.2～0.5

const mobileImages = [
  'https://image.smyhub.com/file/手机壁纸/女生/1772108123232_VJ86r.jpg',
  'https://image.smyhub.com/file/手机壁纸/女生/1772108022800_f945774e0a45f7a4afdc3da2b112025f.png',
  'https://image.smyhub.com/file/手机壁纸/女生/1772108024006_3f9030ba77e355869115bc90fe019d53.png',
  'https://image.smyhub.com/file/手机壁纸/女生/1772108030393_159bbf61f88b38475ee9144a2e8e4956.png',
  'https://image.smyhub.com/file/手机壁纸/女生/1772108021977_8020902a0c8788538eee1cd06e784c6a.png',
  'https://image.smyhub.com/file/手机壁纸/女生/1772108021881_44374ab6c1daa54e0204bca48ac382f2.png',
];

const desktopImages = [
  'https://image.smyhub.com/file/电脑壁纸/女生/cuSpSkq4.webp',
  'https://image.smyhub.com/file/电脑壁纸/女生/5CrdoShv.webp',
  'https://image.smyhub.com/file/电脑壁纸/女生/xTsVkCli.webp',
  'https://image.smyhub.com/file/电脑壁纸/女生/ItOJOHST.webp',
  'https://image.smyhub.com/file/电脑壁纸/女生/cUDkKiOf.webp',
  'https://image.smyhub.com/file/电脑壁纸/女生/c2HxMuGK.webp',
  'https://image.smyhub.com/file/电脑壁纸/女生/L0nQHehz.webp',
  'https://image.smyhub.com/file/电脑壁纸/女生/hj64Cqxn.webp',
];

// 内容区块（搜索框、分类块、内容卡片、顶栏和底栏）的半透明背景透明度，0=全透明 1=不透明，可自行修改
window.SITE_GLASS_OPACITY = 0.3;

export const getGlassOpacity = () => {
  if (typeof window !== 'undefined' && typeof window.SITE_GLASS_OPACITY === 'number') {
    return window.SITE_GLASS_OPACITY;
  }
  return 0.3;
};

export const BACKGROUND_CONFIG = {
  mobileImages,
  desktopImages,
  blur: {
    enabled: true,
    amount: '6px',
    overlayOpacity: 0.35,
  },
};

export const pickBackgroundImage = (isMobile) => {
  const list = isMobile ? BACKGROUND_CONFIG.mobileImages : BACKGROUND_CONFIG.desktopImages;
  if (!Array.isArray(list) || list.length === 0) return null;
  const index = Math.floor(Math.random() * list.length);
  return list[index];
};

// 同时挂到 window 上，方便在控制台调试或以后用纯 script 标签引入时访问。
if (typeof window !== 'undefined') {
  window.SITE_MOBILE_BACKGROUND_IMAGES = mobileImages;
  window.SITE_DESKTOP_BACKGROUND_IMAGES = desktopImages;
  window.SITE_BACKGROUND_BLUR = BACKGROUND_CONFIG.blur;
}
