"""Il media kit in cinque lingue (Paolo, 21/10/2026), da dati/media_kit.json.

Scrive sito/static/x/media-kit/index.html (inglese, l'indirizzo che mandiamo agli editori dal 7/10) e le cartelle
it/, fr/, de/, es/. Pagine noindex: non escono su Google, ma la pagina "Per gli editori" le linka. Gli editori
vengono da sito/src/lib/pagina-editori.js, così l'elenco vive in un posto solo.

    python3 codice/media_kit.py
"""
import html
import json
import re
from datetime import date
from pathlib import Path

RADICE = Path(__file__).resolve().parent.parent
DATI = RADICE / 'dati' / 'media_kit.json'
EDITORI = RADICE / 'sito' / 'src' / 'lib' / 'pagina-editori.js'
USCITA = RADICE / 'sito' / 'static' / 'x' / 'media-kit'
LINGUE = ['en', 'it', 'fr', 'de', 'es']
SITO = 'https://bg-perspective.it'
NNBSP = '\u202f'

MESI = {
    'en': 'January February March April May June July August September October November December',
    'it': 'gennaio febbraio marzo aprile maggio giugno luglio agosto settembre ottobre novembre dicembre',
    'fr': 'janvier février mars avril mai juin juillet août septembre octobre novembre décembre',
    'de': 'Januar Februar März April Mai Juni Juli August September Oktober November Dezember',
    'es': 'enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre',
}
PAESI = {
    'IT': {'en': 'Italy', 'it': 'Italia', 'fr': 'Italie', 'de': 'Italien', 'es': 'Italia'},
    'US': {'en': 'USA', 'it': 'USA', 'fr': 'États-Unis', 'de': 'USA', 'es': 'EE. UU.'},
    'FR': {'en': 'France', 'it': 'Francia', 'fr': 'France', 'de': 'Frankreich', 'es': 'Francia'},
    'DE': {'en': 'Germany', 'it': 'Germania', 'fr': 'Allemagne', 'de': 'Deutschland', 'es': 'Alemania'},
    'ES': {'en': 'Spain', 'it': 'Spagna', 'fr': 'Espagne', 'de': 'Spanien', 'es': 'España'},
    'GB': {'en': 'UK', 'it': 'Regno Unito', 'fr': 'Royaume-Uni', 'de': 'Großbritannien', 'es': 'Reino Unido'},
    'CH': {'en': 'Switzerland', 'it': 'Svizzera', 'fr': 'Suisse', 'de': 'Schweiz', 'es': 'Suiza'},
    'NL': {'en': 'Netherlands', 'it': 'Paesi Bassi', 'fr': 'Pays-Bas', 'de': 'Niederlande', 'es': 'Países Bajos'},
}

T = {
    'en': dict(
        locale='en_US',
        desc='I’m Paolo, and behind bg_perspective there’s also my group of friends: over 10,000 plays logged in more than ten years. I photograph only the games we actually play, and every game gets a permanent page on our website in five languages.',
        og='Board games we actually play, photographed at our table. Instagram, Threads, Facebook and a website in five languages.',
        lead='I’m Paolo, and I’m not alone behind bg_perspective: there’s my group of friends, who I’ve been playing with for more than ten years. Together we’ve logged over 10,000 plays. I photograph only the games we actually play, at the table, and every game gets a permanent page on our website, in five languages.',
        upd='Updated on {d}. I refresh these numbers every Monday.',
        ig_sub='My main channel. Last 28 days ({a} to {b}), from Meta Business Suite.',
        ig=['followers', 'views', 'of views from non-followers', 'interactions', 'accounts reached', 'new follows'],
        storico='Followers on {d}',
        ig_nota='Over {crescita} new followers in one month, and they take part: {interagenti} accounts interacted with my posts in the last 30 days. My best unboxing reel this month, {reel}, passed {views} views.',
        sito_h2='Website',
        sito_sub='Every game page is published in Italian, English, French, German and Spanish. Last 30 days, from Vercel Web Analytics and Google Search Console.',
        sito=['pages indexed by Google', 'languages for every page', 'visitors', 'page views'],
        social_h2='Threads and Facebook',
        social='Every carousel is also published on Threads (@bg_perspective, {th} followers) and on my Facebook page, BoardGame Perspective. I also post in the Italian Facebook group "Giochi da Tavolo", with over {gruppo} members.',
        pacchetto_h2='What every game gets',
        pacchetto=[('An unboxing reel', 'when the parcel arrives, with you tagged and thanked.'),
                   ('Stories', 'while I play it with my group.'),
                   ('A photo carousel', 'on Instagram, Threads and Facebook, with publisher, designers and artists tagged and invited as collaborators.'),
                   ('A permanent page', 'on bg-perspective.it in five languages.'),
                   ('My photos', "in the game's gallery on BoardGameGeek.")],
        gratis='No fees: my content is free. All I ask is a copy of the game.',
        editori_h2='Publishers I work with',
        per_editori=('For publishers', '/en/per-gli-editori'),
    ),
    'it': dict(
        locale='it_IT',
        desc='Sono Paolo, e dietro bg_perspective c’è anche il mio gruppo di amici: oltre 10.000 partite registrate in più di dieci anni. Fotografo solo i giochi che giochiamo davvero, e ogni gioco ha una pagina permanente sul nostro sito in cinque lingue.',
        og='Giochi da tavolo giocati davvero, fotografati al nostro tavolo. Instagram, Threads, Facebook e un sito in cinque lingue.',
        lead='Sono Paolo, e dietro bg_perspective non ci sono solo io: c’è il mio gruppo di amici, con cui gioco da più di dieci anni. Fra tutti abbiamo registrato oltre 10.000 partite. Fotografo solo i giochi che giochiamo davvero, al tavolo, e ogni gioco ha una pagina permanente sul nostro sito, in cinque lingue.',
        upd='Aggiornato al {d}. Questi numeri li aggiorno ogni lunedì.',
        ig_sub='Il mio canale principale. Ultimi 28 giorni (dal {a} al {b}), da Meta Business Suite.',
        ig=['follower', 'visualizzazioni', 'delle visualizzazioni da chi non ci segue', 'interazioni', 'account raggiunti', 'nuovi follow'],
        storico='Follower al {d}',
        ig_nota='Più di {crescita} follower nuovi in un mese, e partecipano: {interagenti} account hanno interagito con i miei post negli ultimi 30 giorni. Il reel di unboxing migliore del mese, {reel}, ha superato le {views} visualizzazioni.',
        sito_h2='Sito',
        sito_sub='Ogni scheda esce in italiano, inglese, francese, tedesco e spagnolo. Ultimi 30 giorni, da Vercel Web Analytics e Google Search Console.',
        sito=['pagine indicizzate da Google', 'lingue per ogni pagina', 'visitatori', 'pagine viste'],
        social_h2='Threads e Facebook',
        social='Ogni carosello esce anche su Threads (@bg_perspective, {th} follower) e sulla mia pagina Facebook, BoardGame Perspective. Pubblico anche nel gruppo Facebook "Giochi da Tavolo", con oltre {gruppo} membri.',
        pacchetto_h2='Cosa riceve ogni gioco',
        pacchetto=[('Un reel di unboxing', 'quando arriva il pacco, con voi taggati e ringraziati.'),
                   ('Le storie', 'mentre lo gioco con il mio gruppo.'),
                   ('Un carosello di foto', 'su Instagram, Threads e Facebook, con editore, autori e illustratori taggati e invitati come collaboratori.'),
                   ('Una pagina permanente', 'su bg-perspective.it, in cinque lingue.'),
                   ('Le mie foto', 'nella galleria del gioco su BoardGameGeek.')],
        gratis='Nessun compenso: i contenuti sono gratuiti. Vi chiedo solo una copia del gioco.',
        editori_h2='Collaborano con me',
        per_editori=('Per gli editori', '/per-gli-editori'),
    ),
    'fr': dict(
        locale='fr_FR',
        desc='Je suis Paolo, et derrière bg_perspective il y a aussi mon groupe d’amis : plus de 10 000 parties enregistrées en plus de dix ans. Je ne photographie que les jeux auxquels nous jouons vraiment, et chaque jeu a sa page permanente sur notre site en cinq langues.',
        og='Des jeux de société vraiment joués, photographiés à notre table. Instagram, Threads, Facebook et un site en cinq langues.',
        lead='Je suis Paolo, et je ne suis pas seul derrière bg_perspective : il y a aussi mon groupe d’amis, avec qui je joue depuis plus de dix ans. À nous tous, nous avons enregistré plus de 10 000 parties. Je ne photographie que les jeux auxquels nous jouons vraiment, à table, et chaque jeu a sa page permanente sur notre site, en cinq langues.',
        upd='Mis à jour le {d}. J’actualise ces chiffres chaque lundi.',
        ig_sub='Mon canal principal. 28 derniers jours (du {a} au {b}), d’après Meta Business Suite.',
        ig=['abonnés', 'vues', 'des vues viennent de non-abonnés', 'interactions', 'comptes touchés', 'nouveaux abonnements'],
        storico='Abonnés au {d}',
        ig_nota='Plus de {crescita} nouveaux abonnés en un mois, et ils participent : {interagenti} comptes ont interagi avec mes publications ces 30 derniers jours. Mon meilleur reel d’unboxing du mois, {reel}, a dépassé les {views} vues.',
        sito_h2='Site web',
        sito_sub='Chaque fiche est publiée en italien, anglais, français, allemand et espagnol. 30 derniers jours, d’après Vercel Web Analytics et Google Search Console.',
        sito=['pages indexées par Google', 'langues pour chaque page', 'visiteurs', 'pages vues'],
        social_h2='Threads et Facebook',
        social='Chaque carrousel est aussi publié sur Threads (@bg_perspective, {th} abonnés) et sur ma page Facebook, BoardGame Perspective. Je publie aussi dans le groupe Facebook italien « Giochi da Tavolo », qui compte plus de {gruppo} membres.',
        pacchetto_h2='Ce que reçoit chaque jeu',
        pacchetto=[('Un reel d’unboxing', 'à l’arrivée du colis, où vous êtes identifiés et remerciés.'),
                   ('Des stories', 'pendant mes parties avec mon groupe.'),
                   ('Un carrousel photo', 'sur Instagram, Threads et Facebook, avec l’éditeur, les auteurs et les illustrateurs identifiés et invités comme collaborateurs.'),
                   ('Une page permanente', 'sur bg-perspective.it, en cinq langues.'),
                   ('Mes photos', 'dans la galerie du jeu sur BoardGameGeek.')],
        gratis='Aucun tarif : mes contenus sont gratuits. Je vous demande seulement un exemplaire du jeu.',
        editori_h2='Ils collaborent avec moi',
        per_editori=('Pour les éditeurs', '/fr/per-gli-editori'),
    ),
    'de': dict(
        locale='de_DE',
        desc='Ich bin Paolo, und hinter bg_perspective steht auch meine Gruppe von Freunden: mehr als 10.000 erfasste Partien in über zehn Jahren. Ich fotografiere nur Spiele, die wir wirklich spielen, und jedes Spiel bekommt eine dauerhafte Seite auf unserer Website in fünf Sprachen.',
        og='Brettspiele, die wir wirklich spielen, an unserem Tisch fotografiert. Instagram, Threads, Facebook und eine Website in fünf Sprachen.',
        lead='Ich bin Paolo, und hinter bg_perspective stehe ich nicht allein: Da ist auch meine Gruppe von Freunden, mit der ich seit über zehn Jahren spiele. Zusammen haben wir mehr als 10.000 Partien erfasst. Ich fotografiere nur Spiele, die wir wirklich spielen, am Tisch, und jedes Spiel bekommt eine dauerhafte Seite auf unserer Website, in fünf Sprachen.',
        upd='Stand: {d}. Ich aktualisiere diese Zahlen jeden Montag.',
        ig_sub='Mein Hauptkanal. Letzte 28 Tage ({a} bis {b}), aus der Meta Business Suite.',
        ig=['Follower', 'Aufrufe', 'der Aufrufe von Nicht-Followern', 'Interaktionen', 'erreichte Konten', 'neue Follows'],
        storico='Follower am {d}',
        ig_nota='Über {crescita} neue Follower in einem Monat, und sie machen mit: {interagenti} Konten haben in den letzten 30 Tagen mit meinen Beiträgen interagiert. Mein bestes Unboxing-Reel des Monats, {reel}, hat über {views} Aufrufe.',
        sito_h2='Website',
        sito_sub='Jede Spielseite erscheint auf Italienisch, Englisch, Französisch, Deutsch und Spanisch. Letzte 30 Tage, aus Vercel Web Analytics und der Google Search Console.',
        sito=['von Google indexierte Seiten', 'Sprachen pro Seite', 'Besucher', 'Seitenaufrufe'],
        social_h2='Threads und Facebook',
        social='Jedes Karussell erscheint auch auf Threads (@bg_perspective, {th} Follower) und auf meiner Facebook-Seite BoardGame Perspective. Außerdem poste ich in der italienischen Facebook-Gruppe „Giochi da Tavolo“ mit über {gruppo} Mitgliedern.',
        pacchetto_h2='Was jedes Spiel bekommt',
        pacchetto=[('Ein Unboxing-Reel', 'wenn das Paket ankommt, mit euch markiert und einem Dankeschön.'),
                   ('Stories', 'während ich es mit meiner Gruppe spiele.'),
                   ('Ein Foto-Karussell', 'auf Instagram, Threads und Facebook; Verlag, Autoren und Illustratoren werden markiert und als Mitwirkende eingeladen.'),
                   ('Eine dauerhafte Seite', 'auf bg-perspective.it, in fünf Sprachen.'),
                   ('Meine Fotos', 'in der Galerie des Spiels auf BoardGameGeek.')],
        gratis='Keine Gebühren: Meine Inhalte sind kostenlos. Ich bitte euch nur um ein Exemplar des Spiels.',
        editori_h2='Sie arbeiten mit mir zusammen',
        per_editori=('Für Verlage', '/de/per-gli-editori'),
    ),
    'es': dict(
        locale='es_ES',
        desc='Soy Paolo, y detrás de bg_perspective está también mi grupo de amigos: más de 10.000 partidas registradas en más de diez años. Solo fotografío los juegos a los que jugamos de verdad, y cada juego tiene su página permanente en nuestra web en cinco idiomas.',
        og='Juegos de mesa jugados de verdad, fotografiados en nuestra mesa. Instagram, Threads, Facebook y una web en cinco idiomas.',
        lead='Soy Paolo, y detrás de bg_perspective no estoy solo: está también mi grupo de amigos, con el que juego desde hace más de diez años. Entre todos hemos registrado más de 10.000 partidas. Solo fotografío los juegos a los que jugamos de verdad, en la mesa, y cada juego tiene su página permanente en nuestra web, en cinco idiomas.',
        upd='Actualizado el {d}. Renuevo estas cifras cada lunes.',
        ig_sub='Mi canal principal. Últimos 28 días (del {a} al {b}), según Meta Business Suite.',
        ig=['seguidores', 'visualizaciones', 'de las visualizaciones, de no seguidores', 'interacciones', 'cuentas alcanzadas', 'nuevos seguidores'],
        storico='Seguidores el {d}',
        ig_nota='Más de {crescita} seguidores nuevos en un mes, y participan: {interagenti} cuentas han interactuado con mis publicaciones en los últimos 30 días. Mi mejor reel de unboxing del mes, {reel}, ha superado las {views} visualizaciones.',
        sito_h2='Web',
        sito_sub='Cada ficha se publica en italiano, inglés, francés, alemán y español. Últimos 30 días, según Vercel Web Analytics y Google Search Console.',
        sito=['páginas indexadas por Google', 'idiomas en cada página', 'visitantes', 'páginas vistas'],
        social_h2='Threads y Facebook',
        social='Cada carrusel se publica también en Threads (@bg_perspective, {th} seguidores) y en mi página de Facebook, BoardGame Perspective. También publico en el grupo italiano de Facebook «Giochi da Tavolo», con más de {gruppo} miembros.',
        pacchetto_h2='Lo que recibe cada juego',
        pacchetto=[('Un reel de unboxing', 'cuando llega el paquete, con vosotros etiquetados y mi agradecimiento.'),
                   ('Stories', 'mientras lo juego con mi grupo.'),
                   ('Un carrusel de fotos', 'en Instagram, Threads y Facebook, con la editorial, los autores y los ilustradores etiquetados e invitados como colaboradores.'),
                   ('Una página permanente', 'en bg-perspective.it, en cinco idiomas.'),
                   ('Mis fotos', 'en la galería del juego en BoardGameGeek.')],
        gratis='Sin tarifas: mis contenidos son gratuitos. Solo os pido un ejemplar del juego.',
        editori_h2='Colaboran conmigo',
        per_editori=('Para editoriales', '/es/per-gli-editori'),
    ),
}

CSS = """:root{--legno:#2a1c13;--legno-luce:#4a3424;--carta:#f1e7d4;--carta-70:rgba(241,231,212,.7);--carta-45:rgba(241,231,212,.45);--carta-12:rgba(241,231,212,.12);--ambra:#E0A340}
*{box-sizing:border-box}
body{margin:0;background:var(--legno);color:var(--carta);font-family:"Instrument Sans",system-ui,sans-serif;font-size:16px;line-height:1.55;-webkit-font-smoothing:antialiased}
a{color:var(--ambra)}
.wrap{max-width:920px;margin:0 auto;padding:0 16px}
header{padding:28px 0 28px;border-bottom:1px solid var(--carta-12)}
.top{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.brand{font-family:Fraunces,Georgia,serif;font-weight:300;font-size:22px}
.brand b{font-weight:600;color:var(--ambra)}
nav.lingue{display:flex;gap:4px;font-size:13px;font-weight:600;letter-spacing:.06em}
nav.lingue a{color:var(--carta-45);text-decoration:none;padding:4px 8px;border-radius:999px}
nav.lingue a[aria-current]{color:var(--legno);background:var(--ambra)}
h1{font-family:Fraunces,Georgia,serif;font-weight:600;font-size:clamp(30px,5vw,46px);line-height:1.08;margin:18px 0 12px}
.lead{color:var(--carta-70);font-size:18px;max-width:62ch;margin:0}
.upd{color:var(--carta-45);font-size:14px;margin-top:14px}
section{padding:36px 0;border-bottom:1px solid var(--carta-12)}
h2{font-family:Fraunces,Georgia,serif;font-weight:600;font-size:26px;margin:0 0 6px}
.sub{color:var(--carta-45);font-size:14px;margin:0 0 20px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:12px}
.n{background:rgba(0,0,0,.22);border:1px solid var(--carta-12);border-radius:14px;padding:16px 16px 14px}
.n b{display:block;font-family:Fraunces,Georgia,serif;font-weight:600;font-size:34px;line-height:1;color:var(--ambra)}
.n span{display:block;margin-top:8px;font-size:14px;color:var(--carta-70)}
.row{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px}
.row .chip{border:1px solid var(--carta-12);border-radius:999px;padding:6px 12px;font-size:14px;color:var(--carta-70)}
ol.pack{padding-left:20px;margin:0}
ol.pack li{margin:8px 0}
ol.pack b{color:var(--carta)}
p.gratis{margin:16px 0 0;padding:12px 16px;border-left:3px solid var(--ambra,#E0A340);background:rgba(224,163,64,.08)}
p.gratis b{color:var(--carta)}
table{width:100%;border-collapse:collapse;font-size:15px}
td{padding:9px 0;border-bottom:1px solid var(--carta-12);vertical-align:top}
td:last-child{text-align:right;color:var(--ambra);font-weight:600;white-space:nowrap;padding-left:12px}
footer{padding:32px 0 56px;color:var(--carta-70)}"""


def numero(n, l):
    s = f'{n:,}'
    if l == 'en':
        return s
    if l == 'fr':
        return s.replace(',', NNBSP)
    if l == 'es' and n < 10000:
        return str(n)  # la RAE non mette il punto sotto le cinque cifre
    return s.replace(',', '.')


def data(iso, l, anno=True):
    d = date.fromisoformat(iso)
    mese = MESI[l].split()[d.month - 1]
    giorno = f'{d.day}.' if l == 'de' else str(d.day)
    if l == 'fr' and d.day == 1:
        giorno = '1er'
    if l == 'es':
        out = f'{giorno} de {mese}' + (f' de {d.year}' if anno else '')
    else:
        out = f'{giorno} {mese}' + (f' {d.year}' if anno else '')
    return out


def url(l):
    return '/x/media-kit/' if l == 'en' else f'/x/media-kit/{l}/'


def editori():
    testo = EDITORI.read_text(encoding='utf-8')
    # dal 29/10 l'elenco sta in ELENCO e COLLABORATORI lo ordina: stesso ordine qui
    blocco = testo.split('const ELENCO = [', 1)[1].split('];', 1)[0]
    # il nome fra virgolette doppie quando ha un apostrofo (Adam's Apple Games, 18/11/2026)
    voci = re.findall(r"nome: (['\"])(.+?)\1.*?it: (true|false), voto: (\d+), follower: (\d+)", blocco)
    # dal 18/11/2026 un elenco solo per voto; l'italiano vale solo a parità (come COLLABORATORI)
    voci.sort(key=lambda v: (-int(v[3]), v[2] != 'true', -int(v[4])))
    return [v[1] for v in voci]


def pagina(l, d, nomi):
    t = T[l]
    e = html.escape
    ig, si = d['instagram'], d['sito']
    nu = lambda n: numero(n, l)
    # francese e tedesco staccano il % con lo spazio fine, lo spagnolo con uno spazio
    pct = lambda p: f"{p}{NNBSP if l in ('fr', 'de') else ' ' if l == 'es' else ''}%"
    righe_ig = [(nu(ig['follower']), t['ig'][0]), (nu(ig['visualizzazioni']), t['ig'][1]),
                (pct(ig['pct_non_follower']), t['ig'][2]),
                (nu(ig['interazioni']), t['ig'][3]), (nu(ig['account_raggiunti']), t['ig'][4]),
                (nu(ig['nuovi_follow']), t['ig'][5])]
    righe_sito = [(nu(si['pagine_indicizzate']), t['sito'][0]), (str(si['lingue']), t['sito'][1]),
                  (nu(si['visitatori']), t['sito'][2]), (nu(si['pagine_viste']), t['sito'][3])]
    nota = t['ig_nota'].format(crescita=nu(ig['crescita_mese']), interagenti=nu(ig['account_interagenti_30g']),
                               reel=ig['reel_migliore'], views=nu(ig['reel_migliore_views']))
    lingue_nav = ''.join(f'<a href="{url(x)}" hreflang="{x}" lang="{x}"{" aria-current=\"page\"" if x == l else ""}>{x.upper()}</a>' for x in LINGUE)
    alternati = '\n'.join(f'<link rel="alternate" hreflang="{x}" href="{SITO}{url(x)}">' for x in LINGUE)
    tessere = lambda righe: '\n'.join(f'  <div class="n"><b>{a}</b><span>{e(b)}</span></div>' for a, b in righe)
    storico = '\n'.join(f'  <tr><td>{e(t["storico"].format(d=data(g, l)))}</td><td>{nu(n)}</td></tr>' for g, n in ig['storico'])
    paesi = ''.join(f'<span class="chip">{e(PAESI[c][l])} {pct(p)}</span>' for c, p in si['paesi'])
    pacchetto = '\n'.join(f'  <li><b>{e(a)}</b> {e(b)}</li>' for a, b in t['pacchetto'])
    chips = ''.join(f'<span class="chip">{e(n)}</span>' for n in nomi)
    per_ed = t['per_editori']
    return f"""<!doctype html>
<html lang="{l}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<title>bg_perspective · Media kit</title>
<meta name="description" content="{e(t['desc'])}">
<meta property="og:type" content="website">
<meta property="og:site_name" content="bg_perspective">
<meta property="og:locale" content="{t['locale']}">
<meta property="og:title" content="bg_perspective · Media kit">
<meta property="og:description" content="{e(t['og'])}">
<meta property="og:url" content="{SITO}{url(l)}">
<meta property="og:image" content="{SITO}/x/media-kit/og.jpg">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="bg_perspective logo and the words Media kit">
<meta name="twitter:card" content="summary_large_image">
{alternati}
<link rel="icon" href="/favicon-32.png">
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,600&family=Instrument+Sans:wght@400;500;600&display=swap">
<style>
{CSS}
</style>
</head>
<body>
<div class="wrap">
<header>
 <div class="top"><div class="brand">bg_<b>perspective</b></div><nav class="lingue">{lingue_nav}</nav></div>
 <h1>Media kit</h1>
 <p class="lead">{e(t['lead'])}</p>
 <p class="upd">{e(t['upd'].format(d=data(d['aggiornato_il'], l)))}</p>
</header>

<section>
 <h2>Instagram · @bg_perspective</h2>
 <p class="sub">{e(t['ig_sub'].format(a=data(ig['periodo'][0], l, anno=False), b=data(ig['periodo'][1], l, anno=False)))}</p>
 <div class="grid">
{tessere(righe_ig)}
 </div>
 <table style="margin-top:22px">
{storico}
 </table>
 <p class="sub" style="margin-top:16px">{e(nota)}</p>
</section>

<section>
 <h2>{e(t['sito_h2'])} · bg-perspective.it</h2>
 <p class="sub">{e(t['sito_sub'])}</p>
 <div class="grid">
{tessere(righe_sito)}
 </div>
 <div class="row">
  {paesi}
 </div>
</section>

<section>
 <h2>{e(t['social_h2'])}</h2>
 <p class="sub">{e(t['social'].format(th=nu(d['threads_follower']), gruppo=nu(d['gruppo_facebook_membri'])))}</p>
</section>

<section>
 <h2>{e(t['pacchetto_h2'])}</h2>
 <ol class="pack">
{pacchetto}
 </ol>
 <p class="gratis"><b>{e(t['gratis'])}</b></p>
</section>

<section>
 <h2>{e(t['editori_h2'])}</h2>
 <div class="row">
  {chips}
 </div>
</section>

<footer>
 Paolo Alberti · <a href="mailto:ciao@bg-perspective.it">ciao@bg-perspective.it</a> · <a href="https://www.instagram.com/bg_perspective/">Instagram</a> · <a href="{SITO}{per_ed[1]}">{e(per_ed[0])}</a>
</footer>
</div>
</body>
</html>
"""


def main():
    d = json.loads(DATI.read_text(encoding='utf-8'))
    nomi = editori()
    for l in LINGUE:
        cartella = USCITA if l == 'en' else USCITA / l
        cartella.mkdir(parents=True, exist_ok=True)
        (cartella / 'index.html').write_text(pagina(l, d, nomi), encoding='utf-8')
        print('scritto', cartella.relative_to(RADICE) / 'index.html')


if __name__ == '__main__':
    main()
