#!/usr/bin/env node
// One-off: opportunities-3d method1-code.html -> brand-v5 (method1-v5.html)
import { readFileSync, writeFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
const dir = fileURLToPath(new URL('../opportunities-3d/', import.meta.url));
let s = readFileSync(dir + 'method1-code.html', 'utf8');

s = s.replace(/@font-face\{[^}]*\}/, `@font-face{ font-family:'Switzer'; src:url('fonts/Switzer-Regular.woff2') format('woff2'); font-weight:100 449; font-style:normal; font-display:block; }
  @font-face{ font-family:'Switzer'; src:url('fonts/Switzer-Medium.woff2') format('woff2'); font-weight:450 549; font-style:normal; font-display:block; }
  @font-face{ font-family:'Switzer'; src:url('fonts/Switzer-Semibold.woff2') format('woff2'); font-weight:550 900; font-style:normal; font-display:block; }`);
s = s.replaceAll("'InterLocal'", "'Switzer'");

const M = [
  // background + dot grid
  ['#fbfaf9', '#F7F6F1'], ['#f4f3f1', '#F0F2EA'], ['#eceae7', '#E6EDE1'], ['#d6d4d0', '#CBD4C6'],
  // surfaces (no pure-white fills per brand)
  ['background:#fff', 'background:#F9F8F3'], ['background:#fbfbfa', 'background:#F7F6F1'],
  ['fill="#fff"', 'fill="#F4F1EA"'], ['color:#fff', 'color:#F4F1EA'],
  // logo tile + accents: blue -> Racing Green / Mint-100
  ['#17161a', '#11462C'], ['#2f7cf6', '#11462C'], ['#e7effb', '#D8EBDD'],
  // status pills -> greens-only ramp
  ['#e3f4e7', '#D8EBDD'], ['#2f9e51', '#11462C'],
  ['#fdeede', '#E4EBDC'], ['#d98324', '#175635'],
  ['#e6eefc', '#DCEEE8'], ['#3a72e0', '#2E7D68'],
  ['#efe9fb', '#E6E9E2'], ['#7b57cf', '#0A1F14'],
  // tooltip -> Console Ground
  ['#1e1d21', '#0C1712'],
  // warm greys -> ink-tinted neutrals
  ['#26241f', '#15130E'], ['#2a2824', '#221F18'], ['#3d3b37', '#3B382F'],
  ['#5b5955', '#57544B'], ['#7c7a77', '#7B776C'], ['#8a8884', '#8B877C'],
  ['#8f8d89', '#8F8B80'], ['#8b8985', '#8B877C'], ['#a3a19d', '#A5A196'],
  ['#a6a4a0', '#A5A196'], ['#a9a7a3', '#A9A59A'], ['#b4b2ae', '#B5B1A6'],
  ['#b7b5b1', '#B8B4A9'], ['#d3d1cd', '#D3CFC5'], ['#e7e5e1', '#E6E4DC'],
  ['#eae8e4', '#E9E7DF'], ['#eeecea', '#EDEBE4'], ['#f0efec', '#EFEEE7'],
  ['#f3f2ef', '#F2F1EA'], ['#fafafa', '#F8F7F2'],
  // hairlines
  ['rgba(0,0,0,.05)', 'rgba(21,19,14,.07)'], ['rgba(0,0,0,.03)', 'rgba(21,19,14,.04)'],
  // brand radius on the hero window
  ['background:#F9F8F3; border-radius:18px', 'background:#F9F8F3; border-radius:40px'],
];
for (const [a, b] of M) s = s.replaceAll(a, b);

writeFileSync(dir + 'method1-v5.html', s);
console.log('wrote method1-v5.html');
