// Rôle : vérifie les conventions statiques des styles Sass.
import { readFile } from "node:fs/promises";
import { test } from "node:test";
import assert from "node:assert/strict";

test("style entrypoint and theme layers are wired", async () => {
  const styles = await readFile("website/src/styles/main.scss", "utf8");
  const styleNebula = await readFile("website/src/styles/_nebula.scss", "utf8");
  const styleTokens = await readFile("website/src/styles/_tokens.scss", "utf8");
  const styleBase = await readFile("website/src/styles/_base.scss", "utf8");
  const styleMixins = await readFile("website/src/styles/_mixins.scss", "utf8");
  const styleShell = await readFile("website/src/styles/_shell.scss", "utf8");
  const styleCards = await readFile("website/src/styles/_cards.scss", "utf8");
  const styleHome = await readFile("website/src/styles/_home.scss", "utf8");
  const styleToolboxes = await readFile("website/src/styles/_toolboxes.scss", "utf8");
  const styleOverlays = await readFile("website/src/styles/_overlays.scss", "utf8");
  const styleIcons = await readFile("website/src/styles/_icons.scss", "utf8");
  const styleGames = await readFile("website/src/styles/_games.scss", "utf8");
  const styleMhwilds = await readFile("website/src/styles/_mhwilds.scss", "utf8");
  const styleResponsive = await readFile("website/src/styles/_responsive.scss", "utf8");

  assert.match(styles, /@use "tokens"/);
  assert.match(styles, /@use "nebula"/);
  assert.match(styles, /@use "toolboxes"/);
  assert.match(styles, /@use "mhwilds"/);
  assert.match(styles, /@use "diablo4"/);
  assert.match(styleTokens, /--gradient-brand/);
  assert.match(styleBase, /:is\(/);
  assert.match(styleBase, /\.card-icon-button/);
  assert.match(styleBase, /\.drawer-action-button/);
  assert.match(styleBase, /\.import-icon-button/);
  assert.match(styleBase, /themed-scrollbar/);
  assert.match(styleBase, /body\.is-modal-open/);
  assert.match(styleNebula, /@function star-field/);
  assert.match(styleNebula, /body::after/);
  assert.match(styleHome, /\.dialogue-line i/);
  assert.match(styleHome, /font-style: italic/);
  assert.match(styleHome, /\.about-page/);
  assert.match(styleHome, /\.nebula-panel/);
  assert.match(styleHome, /\.about-story-section/);
  assert.match(styleHome, /\.about-tools-list/);
  assert.match(styleHome, /\.about-tool-item \.module-icon/);
  assert.match(styleMixins, /@mixin gold-panel-frame/);
  assert.match(styleShell, /\.sidebar-about-link/);
  assert.match(styleToolboxes, /\.module-icon-abacus/);
  assert.match(styleToolboxes, /\.module-icon-calculator/);
  assert.match(styleToolboxes, /\.module-icon-columns/);
  assert.match(styleToolboxes, /\.module-icon-table/);
  assert.match(styleToolboxes, /\.calculator-module/);
  assert.match(styleToolboxes, /\.table-module/);
  assert.match(styleToolboxes, /\.table-cell-input\.is-selected/);
  assert.match(styleToolboxes, /\.notepad-toolbar-button\.danger/);
  assert.match(styleToolboxes, /\.toolbox-icon-picker/);
  assert.match(styleToolboxes, /\.toolbox-game-icon/);
  assert.match(styleToolboxes, /\.toolbox-hero-link/);
  assert.match(styleToolboxes, /\.toolbox-actions-row/);
  assert.match(styleToolboxes, /\.text-import-actions/);
  assert.match(styleToolboxes, /\.text-import-modal-dialog/);
  assert.doesNotMatch(styleToolboxes, /lecture seule/);
  assert.match(styleIcons, /ui-icon-drag/);
  assert.match(styleIcons, /ui-icon-dropdown/);
  assert.match(styleIcons, /ui-icon-enter/);
  assert.match(styleIcons, /ui-icon-calculator/);
  assert.match(styleIcons, /ui-icon-scrollable/);
  assert.match(styleIcons, /ui-icon-hide/);
  assert.match(styleIcons, /ui-icon-eye-open/);
  assert.match(styleIcons, /ui-icon-eye-closed/);
  assert.match(styleIcons, /ui-icon-chevron-down/);
  assert.match(styleIcons, /ui-icon-chevron-up/);
  assert.match(styleIcons, /ui-icon-flip/);
  assert.match(styleIcons, /ui-icon-add/);
  assert.match(styleIcons, /ui-icon-add-row/);
  assert.match(styleIcons, /ui-icon-add-column/);
  assert.match(styleIcons, /ui-icon-remove-row/);
  assert.match(styleIcons, /ui-icon-remove-column/);
  assert.match(styleIcons, /ui-icon-table/);
  assert.match(styleIcons, /ui-icon-map/);
  assert.match(styleIcons, /ui-icon-grab/);
  assert.match(styleIcons, /ui-icon-shield/);
  assert.match(styleIcons, /ui-icon-gun/);
  assert.match(styleToolboxes, /\.combo-hold-controls/);
  assert.match(styleToolboxes, /\.combo-input-direction/);
  assert.match(styleToolboxes, /\.combo-device-n64\.combo-value-stick-up/);
  assert.match(styleToolboxes, /\.combo-device-n64\.combo-value-up/);
  assert.match(styleToolboxes, /\.combo-value-grab \.ui-icon/);
  assert.match(styleGames, /\.game-home-card/);
  assert.match(styleGames, /\.game-layout/);
  assert.match(styleGames, /\.game-grid/);
  assert.match(styleGames, /\.filter-panel/);
  assert.match(styleMhwilds, /\.mhwilds-card/);
  assert.match(styleMhwilds, /\.mhwilds-flip-indicator/);
  assert.doesNotMatch(styleMhwilds, /\.game-(home-card|layout|grid)/);
  assert.match(styleCards, /compact-data-card/);
  assert.match(styleOverlays, /overscroll-behavior: contain/);
  assert.match(styleResponsive, /@media \(max-width: 760px\)/);
});
