#!/usr/bin/env python3
from PIL import Image, ImageDraw, ImageFont
import os

W, H = 1080, 1350
BG = (26, 26, 46)        # #1a1a2e
TXT = (255, 255, 255)    # white
ORANGE = (249, 115, 22)  # #f97316
MUTED = (200, 200, 210)

def font(sz, bold=False):
    for p in ["/usr/share/fonts/truetype/poppins/Poppins-Bold.ttf",
              "/usr/share/fonts/truetype/poppins/Poppins-SemiBold.ttf",
              "/usr/share/fonts/truetype/poppins/Poppins-Regular.ttf",
              "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",
              "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"]:
        if os.path.exists(p):
            try:
                return ImageFont.truetype(p, sz)
            except Exception:
                continue
    return ImageFont.load_default()

img = Image.new("RGB", (W, H), BG)
d = ImageDraw.Draw(img)

# Safe zone
SZ = 65

# Header
d.text((SZ, SZ), "DAS BENGKEL INDONESIA", font=font(34, True), fill=ORANGE)
d.text((W-SZ, SZ), "OTOMOTIF", font=font(30, True), fill=TXT, anchor="ra")

# Accent line under header
d.line([(SZ, SZ+70), (W-SZ, SZ+70)], fill=ORANGE, width=4)

# Title (big, bold)
title = "FORTUNER\nDIESEL\nPERLU\nOVERHAUL?"
d.multiline_text((SZ, 250), title, font=font(88, True), fill=TXT, spacing=12)

# Subtitle
d.text((SZ, 820), "Bongkar total bukan berarti rusak total.", font=font(40, True), fill=ORANGE)

# Body points
y = 900
points = [
    ("Oli cepat habis?", "Bisa jadi piston & ring sudah aus"),
    ("Asap biru/putih pekat", "Oli terbakar di ruang bakar"),
    ("Tarikan berat, brebet", "Kompresi turun — butuh cek presisi"),
    ("Jangan asal bongkar", "Harus pakai ukur presisi & torque wrench"),
]
for t, s in points:
    d.text((SZ, y), "\u2713  " + t, font=font(36, True), fill=TXT)
    d.text((SZ+45, y+52), s, font=font(28), fill=MUTED)
    y += 140

# Footer
d.line([(SZ, H-140), (W-SZ, H-140)], fill=(70,70,100), width=3)
d.text((SZ, H-120), "www.dasindonesia.com", font=font(30, True), fill=ORANGE)
d.text((W-SZ, H-120), "#OverhaulFortuner", font=font(30, True), fill=TXT, anchor="ra")

img.save("das_fb_20260830.png")
print("saved das_fb_20260830.png")
