import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { test } from 'node:test';

const homeTemplate = readFileSync(new URL('../src/app/pages/home/home.component.html', import.meta.url), 'utf8');
const homeStyles = readFileSync(new URL('../src/app/pages/home/home.component.scss', import.meta.url), 'utf8');
const styles = readFileSync(new URL('../src/styles.scss', import.meta.url), 'utf8');

test('home page avoids common AI-generated visual patterns', () => {
  const bannedPatterns = [
    /Gradient orbs/i,
    /gradient-text/,
    /from-purple-600\s+to-violet-600/,
    /lg:grid-cols-3/,
    /blur-\[128px\]/
  ];

  for (const pattern of bannedPatterns) {
    assert.doesNotMatch(homeTemplate, pattern);
  }
});

test('global palette uses a restrained product-led brand system', () => {
  assert.doesNotMatch(styles, /Inter:wght/);
  assert.doesNotMatch(styles, /hsl\(280\s+90%\s+70%\)/);
  assert.match(styles, /--primary:\s*\d+\s+\d+%\s+\d+%/);
});

test('hero screenshot does not add duplicate app chrome', () => {
  assert.doesNotMatch(homeTemplate, /window-bar/);
  assert.doesNotMatch(homeStyles, /\.window-bar/);
});

test('self-hostable section keeps title and copy in separate readable columns', () => {
  assert.doesNotMatch(homeStyles, /\.host-section\s*{[^}]*align-items:\s*end/s);
  assert.match(homeStyles, /\.host-section\s*{[^}]*align-items:\s*start/s);
  assert.match(homeStyles, /\.host-section-copy/);
});