/* Kinetic mock brain. window.K */
const I = window.Icon;

/* ---- 5 OUTPUT styles (reel look) ---- */
const STYLES = [
  { id:'bold', name:'Bold', desc:'Heavy sans · slamming motion', swatch:'black/yellow',
    bg:'#0B0B0B', text:'#FFFFFF', accent:'#FFE600', font:'heavy', weight:900, anim:'slam', upper:true, tracking:'-0.02em' },
  { id:'editorial', name:'Editorial', desc:'Serif · calm & premium', swatch:'cream/serif',
    bg:'#EFE7D6', text:'#1A1611', accent:'#B5472B', font:'serif', weight:400, anim:'softfade', upper:false, tracking:'0' },
  { id:'hype', name:'Hype', desc:'Neon · aggressive', swatch:'neon',
    bg:'#060507', text:'#FFFFFF', accent:'#00FF9C', font:'heavy', weight:900, anim:'neonin', upper:true, tracking:'-0.01em', glow:true },
  { id:'mono', name:'Mono', desc:'Terminal green · typewriter', swatch:'terminal',
    bg:'#070B08', text:'#46F58E', accent:'#46F58E', font:'mono', weight:600, anim:'type', upper:false, tracking:'0' },
  { id:'clean', name:'Clean', desc:'White · one accent · calm', swatch:'white',
    bg:'#FAFAF8', text:'#15151A', accent:'#2D6BFF', font:'sans', weight:700, anim:'rise', upper:false, tracking:'-0.02em' },
];

/* ---- Treatments. Two families: 'say' (animated text) and 'show' (graphic) ---- */
const TREATMENTS = {
  text:      { id:'text',      family:'say',  label:'Animated text', Icon:I.TextAnim,  blurb:'Words hit on screen' },
  bars:      { id:'bars',      family:'show', label:'Bars',          Icon:I.Bars,      blurb:'Compare two values' },
  counter:   { id:'counter',   family:'show', label:'Counter',       Icon:I.Counter,   blurb:'One big number' },
  ring:      { id:'ring',      family:'show', label:'Ring',          Icon:I.Ring,      blurb:'A percentage' },
  checklist: { id:'checklist', family:'show', label:'Checklist',     Icon:I.Checklist, blurb:'A short list' },
  quote:     { id:'quote',     family:'show', label:'Quote',         Icon:I.Quote,     blurb:'A pulled quote' },
  timeline:  { id:'timeline',  family:'show', label:'Timeline',      Icon:I.Timeline,  blurb:'Before → after' },
  iconrow:   { id:'iconrow',   family:'show', label:'Icon row',      Icon:I.IconRow,   blurb:'Emoji + labels' },
};
const TREATMENT_ORDER = ['text','bars','counter','ring','timeline','checklist','quote','iconrow'];

/* ---- The AI-written script (editable). Structure-tagged lines ---- */
const SCRIPT_LINES = [
  { role:'Hook',   text:"AI didn't change SaaS. It deleted the moat." },
  { role:'Beat',   text:"Copying a feature used to take eighteen months." },
  { role:'Beat',   text:"Now? Two and a half weeks." },
  { role:'Payoff', text:"If your edge is one feature, it's already gone." },
  { role:'CTA',    text:"The new moat is how fast you learn. Follow for more." },
];
const SCRIPT_TEXT = SCRIPT_LINES.map(l => l.text).join('\n');
const STRUCTURE = [
  { role:'Hook',   tone:'accent',  desc:'Stops the scroll' },
  { role:'Beats',  tone:'default', desc:'The argument' },
  { role:'Payoff', tone:'default', desc:'The turn' },
  { role:'CTA',    tone:'success', desc:'The ask' },
];

/* ---- Storyboard: scenes/beats with a treatment each. Mixes say-it + show-it ---- */
const STORYBOARD = [
  { id:'s1', role:'Hook',   treatment:'text',    text:'AI killed the SaaS moat.',
    payload:{ lines:[{t:'AI killed the',role:'small'},{t:'SaaS moat',role:'hook',accent:true}] } },
  { id:'s2', role:'Beat',   treatment:'bars',    text:'Copying a feature: 18 months → 2.4 weeks.',
    payload:{ title:'Time to copy a feature', a:{label:'Then',val:'18 mo',pct:100}, b:{label:'Now',val:'2.4 wk',pct:14} } },
  { id:'s3', role:'Beat',   treatment:'counter', text:'Now it takes 2.4 weeks.',
    payload:{ value:'2.4', unit:'weeks', caption:'to copy what took 18 months' } },
  { id:'s4', role:'Payoff', treatment:'text',    text:'Anyone can copy it.',
    payload:{ lines:[{t:'Anyone',role:'punch',accent:true},{t:'can copy it.',role:'punch'}] } },
  { id:'s5', role:'CTA',    treatment:'text',    text:'The moat is how fast you learn.',
    payload:{ lines:[{t:'The new moat:',role:'small'},{t:'how fast',role:'hook',accent:true},{t:'you learn.',role:'hook'}] } },
];

/* ---- Reel scenes used by the looping preview (derived, simple) ---- */
const SCENES = [
  { id:0, dur:2200, treatment:'text', payload:{ lines:[{t:'AI killed the',role:'small'},{t:'SaaS moat',role:'hook',accent:true}] } },
  { id:1, dur:2400, treatment:'text', payload:{ lines:[{t:'18 months',role:'small'},{t:'→ 2.4 weeks',role:'stat',accent:true}] } },
  { id:2, dur:2000, treatment:'text', payload:{ lines:[{t:'Anyone',role:'punch',accent:true},{t:'can copy it.',role:'punch'}] } },
  { id:3, dur:2400, treatment:'text', payload:{ lines:[{t:'The new moat:',role:'small'},{t:'how fast you learn',role:'hook',accent:true}] } },
];
const REEL_MS = SCENES.reduce((a,s)=>a+s.dur,0);

/* ---- Voice path ---- */
const RAW_TRANSCRIPT = "Okay so here's a thought I keep coming back to. I think AI basically killed the SaaS moat, you know? Copying a feature, it used to take like eighteen months, and now it's down to two and a half weeks. So anyone can just copy it. Kind of wild.";
const KEY_PHRASES = ['SaaS moat','18 months','2.4 weeks','anyone can copy'];
const SENTIMENT = { label:'Assertive', conf:0.71 };
const CUT = { keptPct:38, dropped:['filler & throat-clearing','“you know / honestly”','“kind of wild”'] };

/* ---- Hook scoring ---- */
const BASE_HOOK = { text:'AI killed the SaaS moat.', score:78 };
const HOOKS = [
  { text:'Your SaaS moat? AI just deleted it.', score:91, reason:'Direct address + loss aversion, 6 words.', best:true },
  { text:'The thing protecting your startup is gone.', score:86, reason:'Opens a curiosity gap — names no villain yet.' },
  { text:'18 months of work, copied in 2.4 weeks.', score:83, reason:'Leads cold with the concrete stat contrast.' },
];

/* ---- Result copy ---- */
const CAPTION = "AI didn't change SaaS — it deleted the moat.\n\nCopying a feature used to take 18 months. Now it's 2.4 weeks. If your edge is a single feature, it's already gone.\n\nThe new moat isn't the product. It's how fast you learn. 👇";
const HASHTAGS = ['#buildinpublic','#saas','#startups','#AItools','#founders','#productstrategy'];

/* ---- Loaders ---- */
const SCRIPT_STEPS_VOICE = ['Transcribe','Trim the ramble','Write the script'];
const SCRIPT_STEPS_TYPE = ['Read your idea','Find the angle','Write the script'];

/* ---- Pipeline (live board, after Animate this) ---- */
const STAGES = [
  { id:'storyboard', label:'Lay out scenes', sub:'Compose each beat into motion', Icon:I.Layers,  dur:2600 },
  { id:'hook',       label:'Hook score',     sub:'Score the opener · sharpen it',  Icon:I.Target,  dur:2700 },
  { id:'render',     label:'Render',         sub:'Compose the 9:16 MP4',           Icon:I.Clapper, dur:4200 },
];

const EXAMPLES = [
  'AI killed the SaaS moat — copying a feature went from 18 months to 2.4 weeks.',
  "3 money lessons I wish I'd learned at 22.",
  'Why most morning routines are quietly a waste of time.',
];
const DEFAULT_IDEA = 'AI killed the SaaS moat — copying a feature went from 18 months to 2.4 weeks. Anyone can copy it now.';

window.K = {
  STYLES, TREATMENTS, TREATMENT_ORDER, SCRIPT_LINES, SCRIPT_TEXT, STRUCTURE, STORYBOARD,
  SCENES, REEL_MS, RAW_TRANSCRIPT, KEY_PHRASES, SENTIMENT, CUT, BASE_HOOK, HOOKS,
  CAPTION, HASHTAGS, SCRIPT_STEPS_VOICE, SCRIPT_STEPS_TYPE, STAGES, EXAMPLES, DEFAULT_IDEA,
};
