// jsdom doesn't implement matchMedia — anything that transitively imports
// theme.svelte.ts (which reads the OS color-scheme preference at module
// load) throws without this. Global vitest setup so every test file gets it
// for free instead of each one needing its own mock.
if (typeof window !== 'undefined' && !window.matchMedia) {
  window.matchMedia = (query: string): MediaQueryList =>
    ({
      matches: false,
      media: query,
      onchange: null,
      addListener: () => {},
      removeListener: () => {},
      addEventListener: () => {},
      removeEventListener: () => {},
      dispatchEvent: () => false
    }) as MediaQueryList
}
