"""Store screenshots and social covers (iShatat, 12 November 2026: "all seven, and with creativity").

The App Store pair: the first screenshot asks the product's question and the real screen rises from the foot of the
board, the way the S rises from the foot of the letterhead; the last one signs off. The covers each wear one of the
approved patterns, built outward from the name: S4 on YouTube, the point field on X, S3 on LinkedIn.

Usage: python3 -I make_store_and_social.py            (all of them)
       python3 -I make_store_and_social.py x-header   (only the named ones)"""
import pathlib, sys
HERE = pathlib.Path(__file__).resolve().parent
sys.path.insert(0, str(HERE)); sys.path.insert(0, str(HERE.parents[1] / "brand-book/source"))
import make_templates as T
from make_templates import INK, GRAPHITE, NIGHT, POINTS, template, signature, family, one_point, cut_s, spelled, line_and_point
from patterns import pattern_panel, s4_rhythm, s3_weave, point_field

TONE = "#1E1F23"          # one step lighter than Night: a pattern is felt before it is seen
MINE = []

def mine(key, *args, **kw):
    MINE.append(key)
    return template(key, *args, **kw)

def placeholder(x, y, w, h, words, radius=72):
    """Where the real screen goes: a dark glass with a hairline, its size written in it."""
    return (f'<div style="position:absolute;left:{x}px;top:{y}px;width:{w}px;height:{h}px;border-radius:{radius}px;background:#16171A;'
            f'box-shadow:inset 0 0 0 2px #2A2B30;display:flex;align-items:center;justify-content:center">'
            f'<span class="label" style="font-size:22px;color:#4A4B50">{words}</span></div>')

@mine("app-store-first", "App Store, first screenshot", 1290, 2796, "The first App Store screenshot: the question, and the real screen rising from the foot")
def app_store_first():
    m = 96
    return f'''<div style="position:absolute;left:{m}px;top:{m}px">{one_point("SHETA", 44)}</div>
<div class="q" style="position:absolute;left:{m}px;top:300px;width:1098px;font-size:112px;color:{INK}">What if a number could keep a secret?</div>
<div style="position:absolute;left:{m}px;top:780px;width:900px;font-size:40px;line-height:1.4;color:{GRAPHITE}">One hidden number. Every guess tells you a little more.</div>
{placeholder(m, 1060, 1098, 2000, "The app's screen, 1179 × 2556")}'''

@mine("app-store-last", "App Store, last screenshot", 1290, 2796, "The last App Store screenshot: the family, and the signature")
def app_store_last():
    m = 96
    return f'''{cut_s(1250, -430, 1080)}
<div class="q" style="position:absolute;left:{m}px;top:300px;width:1098px;font-size:96px;color:{INK}">One maker.<br>Five questions.</div>
<div style="position:absolute;left:{m}px;top:620px">{line_and_point(320, GRAPHITE)}</div>
<div style="position:absolute;left:{m}px;top:700px;width:1000px">{family(38)}</div>
<div style="position:absolute;left:{m}px;bottom:{m + 40}px">{signature("SHETA", "Ink on dark", 64)}</div>'''

def cover(w, h, name_w, cx, cy, pattern):
    svg = pattern_panel(pattern(w, h, name_w, cx, cy), w, h, NIGHT, TONE, "c", (name_w, cx, cy, INK))
    sized = svg.replace("<svg ", f'<svg width="{w}" height="{h}" ', 1)
    return f'<div style="position:absolute;inset:0">{sized}</div>'

@mine("youtube-banner", "YouTube banner", 2560, 1440, "The channel art; everything that matters sits in the 1546 × 423 centre every screen shows")
def youtube_banner():
    return cover(2560, 1440, 760, 1280, 720, s4_rhythm)

@mine("x-header", "X header", 1500, 500, "The header on X; the profile picture covers the lower left, so the name sits in the middle")
def x_header():
    return cover(1500, 500, 520, 750, 230, lambda w, h, n, cx, cy: point_field(w, h, n, cx, cy, "horizon"))

@mine("linkedin-cover", "LinkedIn cover", 1128, 191, "The company page's cover on LinkedIn")
def linkedin_cover():
    return cover(1128, 191, 300, 564, 95, s3_weave)

if __name__ == "__main__":
    T.build(tuple(sys.argv[1:]) or tuple(MINE))
