from PIL import Image, ImageDraw, ImageFont, ImageFilter, ImageEnhance

src='/home/spazio/.hermes/cache/images/img_5384b6302ca1.jpg'
out='/home/spazio/cosmos_luminosity_aesthetic_mockup.jpg'
W,H=1080,1350
im=Image.open(src).convert('RGB').resize((W,H))
# Refined grade: slightly deeper, desaturated, cleaner highlights.
im=ImageEnhance.Color(im).enhance(.82)
im=ImageEnhance.Contrast(im).enhance(1.08)
im=ImageEnhance.Brightness(im).enhance(.88).convert('RGBA')

# Elegant left veil, deliberately covering the original copy while feathering into photo.
veil=Image.new('RGBA',(W,H),(0,0,0,0)); px=veil.load()
for y in range(H):
    for x in range(W):
        # editorial field extends beyond all old copy
        t=max(0,min(1,(790-x)/390))
        a=int(238*(t*t)*(0.93 if y<900 else 0.58))
        # soft top/bottom cinematic shaping
        if y<130: a=max(a,int(90*(1-y/130)))
        if y>1060: a=max(a,int(110*((y-1060)/(H-1060))))
        px[x,y]=(11,6,22,a)
im=Image.alpha_composite(im,veil)

d=ImageDraw.Draw(im)
serif='/home/spazio/.fonts/cl/PlayfairDisplay-Bold.ttf'
sans='/home/spazio/.fonts/cl/Manrope.ttf'
WHITE=(248,245,238,255)
VIOLET=(164,117,232,255)  # velvety, premium
YELLOW=(244,207,78,255)   # solar, not neon
GOLD=(207,168,91,255)
MUTED=(224,216,230,225)

# Fonts
f_meta=ImageFont.truetype(sans,20)
f_num=ImageFont.truetype(sans,18)
f_serif=ImageFont.truetype(serif,70)
f_serif_big=ImageFont.truetype(serif,84)
f_sans_bold=ImageFont.truetype(sans,25)
f_signature=ImageFont.truetype(sans,17)

# Header — restrained gold navigation.
d.text((64,54),'COSMOS LUMINOSITY  ·  QUESTION 03',font=f_meta,fill=GOLD)
d.text((1016,54),'04 / 07',font=f_num,fill=WHITE,anchor='ra')
d.line((64,92,1016,92),fill=(207,168,91,125),width=1)

# Main copy: editorial serif, with only two precise color accents.
x=64; y=170
for text,color,font in [
    ('Какой',WHITE,f_serif),
    ('вариант',VIOLET,f_serif_big),
    ('ты пока даже',WHITE,f_serif),
    ('не рассматриваешь?',YELLOW,f_serif),
]:
    d.text((x,y),text,font=font,fill=color)
    bb=d.textbbox((x,y),text,font=font)
    y=bb[3]+2

# Small gold sign / visual pause.
d.ellipse((66,y+35,76,y+45),fill=GOLD)
d.line((92,y+40,190,y+40),fill=GOLD,width=2)

# Supporting copy — quiet, premium, more spacious.
sy=y+82
for line in ['Старый вывод сужает обзор.','Вопрос возвращает внимание','к ещё не замеченному.']:
    d.text((64,sy),line,font=f_sans_bold,fill=MUTED)
    sy += 39

# Bottom label — subtle brand architecture.
d.line((64,1262,1016,1262),fill=(255,255,255,70),width=1)
d.text((64,1284),'A LIVING INTERFACE OF ATTENTION',font=f_signature,fill=(245,240,246,190))
d.text((1016,1284),'COSMOS LUMINOSITY',font=f_signature,fill=GOLD,anchor='ra')

im.convert('RGB').save(out,quality=96,subsampling=0)
print(out)
