"""Generate the instrument faceplates and material swatches for the assembly hall."""
from pathlib import Path
import numpy as np
from PIL import Image,ImageDraw,ImageFont
A=Path(__file__).resolve().parent/'textures'
fontdir=Path('/System/Library/Fonts/Supplemental')
def font(n,heavy=False):return ImageFont.truetype(str(fontdir/('Arial Bold.ttf' if heavy else 'Arial Unicode.ttf')),n)
def face(name,title,subtitle,rows,accent='#85dec2'):
 im=Image.new('RGB',(1200,610),'#152c33');d=ImageDraw.Draw(im)
 d.rectangle((0,0,18,610),fill=accent);d.text((54,41),subtitle.upper(),font=font(31,True),fill=accent);d.text((51,108),title,font=font(61,True),fill='#f2efe0');d.line((54,222,1140,222),fill='#678085',width=3)
 for i,line in enumerate(rows):d.text((55,266+83*i),line,font=font(36),fill='#d1e3dd')
 im.save(A/(name+'.jpg'),quality=94)
face('fibers','Fibers','Contradiction  /  1', ['At least half of all fibers qualify.','Average their Reach witnesses.','Re ⟨Cv, w⟩ ≥ μ / 2'])
face('splitproof','Splitting','Contradiction  /  2',['Lift the endpoint actions.','Pay one error at each level.','‖A − C‖ ≤ Σ γₘ'])
face('limit','Limit','Contradiction  /  3',['Take N large in the polynomial bound.','The assumed subspace forces zero.','Re ⟨q(T)ξ, ζ⟩ > 0'],'#efbc81')
face('terminal','Proof verification','Kernel console',['Target   Solution.onL2','Lean     4.34.1','Mathlib  d13f23b7'])
face('towerplate','Block assembly','Finite construction',['Input       K₀ = ℂ','Output     K₁ = ℂ³','Coupling   τ₁ = 1 / 192'])
face('endpoint','Endpoint pairing','Reach and Split',['Reach     max Re ⟨Av,w⟩','Split        approximate both end slots','First-stage minimum   μ₁ = 1/8'])
face('planeplate','Invariant plane','Finite operator controls',['Input     v ∈ span(e₁, e₂)','Inspect  Tv and its normal component.'])
rng=np.random.default_rng(342)
n=rng.normal(0,2.5,(512,1024))+rng.normal(0,3.1,(512,1))
for name,base in [('alloy',(131,144,143)),('rubber',(69,77,77))]:
 rgb=np.uint8(np.clip(n[:,:,None]+np.array(base)[None,None,:],0,255));Image.fromarray(rgb).save(A/(name+'.jpg'),quality=90)
