#!/usr/bin/env python3
"""
Generate CCG26 Sponsorship Package in multiple formats:
- Slide deck as PDF (via HTML + weasyprint)  — matches slides.jeffemmett.com
- Document-style HTML + PDF

The slide deck matches the online deck at slides.jeffemmett.com/ccg26-sponsorship
"""

import os
import shutil
from pathlib import Path
from weasyprint import HTML
from pdf2image import convert_from_path

# Output directory
OUTPUT_DIR = Path("/home/jeffe/Github/crypto-commons-gather.ing-website")
IMAGE_DIR = OUTPUT_DIR / "public" / "images"
SLIDES_DIR = OUTPUT_DIR / "public" / "slides"
PUBLIC_DIR = OUTPUT_DIR / "public"


def create_slide_deck():
    """Create a 12-slide PDF deck matching the online version."""

    img = lambda name: (IMAGE_DIR / name).as_uri()

    deck_html = f"""<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CCG 2026 Sponsorship Deck</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {{
    --red: #B22234;
    --red-dark: #8a1a28;
    --dark: #1a1a1a;
    --dark-card: #2a2a2a;
    --light: #f5f5f5;
    --salmon: #e69b91;
    --muted-light: #a0a0a0;
    --muted-dark: #787878;
    --card-border: #ddd;
    --white: #fff;
    --black: #141414;
}}

* {{ margin: 0; padding: 0; box-sizing: border-box; }}

body {{
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}}

@page {{
    size: 13.333in 7.5in;
    margin: 0;
}}

.slide {{
    width: 13.333in;
    height: 7.5in;
    position: relative;
    overflow: hidden;
    page-break-after: always;
    padding: 1in 0.6in 0.6in;
}}
.slide:last-child {{ page-break-after: avoid; }}

/* Background variants */
.slide.light {{ background: var(--light); }}
.slide.dark {{ background: var(--dark); color: var(--white); }}
.slide.red {{
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
    color: var(--white);
}}
/* Photo slides: image as bg, overlay via child div */
.slide.red-photo {{
    background: url('{img("20220429-145734.jpg")}') center/cover no-repeat;
    color: var(--white);
}}
.slide.dark-photo-courtyard {{
    background: url('{img("20220830-104828.jpg")}') center/cover no-repeat;
    color: var(--white);
}}
.slide.dark-photo-outdoor {{
    background: url('{img("20220503-155430.jpg")}') center/cover no-repeat;
    color: var(--white);
}}
.slide.red-photo-river {{
    background: url('{img("20220430-170329.jpg")}') center/cover no-repeat;
    color: var(--white);
}}
.slide.light-photo-group {{
    background: url('{img("20220505-113225.jpg")}') center/cover no-repeat;
}}
.slide.dark-photo-mountain {{
    background: url('{img("20220906-143605.jpg")}') center/cover no-repeat;
    color: var(--white);
}}
.slide.light-photo-workshop {{
    background: url('{img("20220430-112350.jpg")}') center/cover no-repeat;
}}
.slide.light-photo-morning {{
    background: url('{img("20220901-085249.jpg")}') center/cover no-repeat;
}}

/* Overlay + content wrapper for photo slides */
.photo-overlay {{
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}}
.photo-content {{
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
}}

/* Footer */
.footer {{
    position: absolute;
    bottom: 0.25in;
    left: 0.4in;
    right: 0.4in;
    display: flex;
    justify-content: space-between;
    font-size: 9pt;
    color: var(--muted-dark);
}}
.dark .footer, .red .footer, .red-photo .footer,
.dark-photo-courtyard .footer, .dark-photo-outdoor .footer,
.dark-photo-mountain .footer, .red-photo-river .footer {{
    color: var(--muted-light);
}}

/* Section label */
.section-label {{
    font-size: 10pt;
    font-weight: 700;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.08in;
}}

/* Slide title */
.slide-title {{
    font-size: 32pt;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 0.2in;
    color: var(--black);
}}
.dark .slide-title, .dark-photo-courtyard .slide-title, .dark-photo-outdoor .slide-title, .dark-photo-mountain .slide-title {{
    color: var(--white);
}}

/* Cards */
.card {{
    background: var(--white);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 0.25in 0.3in;
}}
.card-dark {{
    background: var(--dark-card);
    border: 1px solid #444;
    border-radius: 10px;
    padding: 0.25in 0.3in;
}}

/* Grid layouts */
.grid-2x2 {{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.2in;
}}
.grid-3 {{
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.2in;
}}
.grid-2x3 {{
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0.2in;
}}
.two-col {{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4in;
    align-items: start;
}}
.two-col-wide-left {{
    display: grid;
    grid-template-columns: 55% 1fr;
    gap: 0.35in;
    align-items: start;
}}
.two-col-wide-right {{
    display: grid;
    grid-template-columns: 1fr 55%;
    gap: 0.35in;
    align-items: start;
}}

/* Check list */
.check-list {{ list-style: none; padding: 0; }}
.check-list li {{
    padding: 0.04in 0;
    font-size: 11pt;
    line-height: 1.5;
}}
.check-list li::before {{
    content: "✓  ";
    color: var(--red);
    font-weight: 600;
}}
.dark .check-list li::before,
.dark-photo-courtyard .check-list li::before,
.dark-photo-outdoor .check-list li::before,
.dark-photo-mountain .check-list li::before {{
    color: var(--salmon);
}}

/* Stat number */
.stat-num {{
    font-size: 28pt;
    font-weight: 800;
    color: var(--red);
    line-height: 1.2;
}}
.dark .stat-num, .dark-photo-courtyard .stat-num, .dark-photo-outdoor .stat-num, .dark-photo-mountain .stat-num {{
    color: var(--salmon);
}}
.stat-label {{
    font-size: 10pt;
    color: var(--muted-dark);
}}
.dark .stat-label, .dark-photo-mountain .stat-label {{ color: var(--muted-light); }}

/* Quote */
.quote {{
    border-left: 3px solid var(--red);
    padding-left: 0.2in;
    margin-top: 0.25in;
}}
.quote p {{
    font-style: italic;
    font-size: 11pt;
    color: var(--muted-light);
    line-height: 1.5;
}}
.quote cite {{
    display: block;
    font-style: normal;
    font-size: 9pt;
    color: var(--muted-light);
    margin-top: 0.06in;
}}

/* Tier card category label */
.tier-cat {{
    font-size: 8pt;
    font-weight: 700;
    color: var(--muted-dark);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.12in;
    margin-bottom: 0.04in;
}}
.dark .tier-cat, .dark-photo-mountain .tier-cat {{ color: var(--muted-light); }}

/* Budget table */
.budget-table {{
    width: 100%;
    border-collapse: collapse;
}}
.budget-table td {{
    padding: 0.08in 0;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
}}
.budget-table .item {{ font-size: 11pt; }}
.budget-table .sub {{ font-size: 8pt; color: var(--muted-dark); }}
.budget-table .amount {{ font-size: 11pt; font-weight: 600; text-align: right; }}
.budget-table .total td {{
    border-bottom: none;
    border-top: 2px solid var(--black);
    padding-top: 0.12in;
    font-weight: 700;
    font-size: 13pt;
}}
.budget-table .total .amount {{ color: var(--red); font-size: 15pt; }}

/* Progress bar */
.bar-track {{ background: #eee; border-radius: 4px; height: 8px; margin-top: 4px; }}
.bar-fill {{ background: var(--red); border-radius: 4px; height: 8px; }}

/* Gap highlight */
.gap-card {{
    background: #fff5f5;
    border: 2px solid var(--red);
    border-radius: 10px;
    padding: 0.2in 0.25in;
}}

/* Pill */
.pill {{
    display: inline-block;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 20px;
    padding: 6px 22px;
    font-size: 12pt;
}}

/* Muted text */
.muted {{ color: var(--muted-dark); }}
.dark .muted, .red .muted, .red-photo .muted,
.dark-photo-courtyard .muted, .dark-photo-outdoor .muted,
.dark-photo-mountain .muted, .red-photo-river .muted {{
    color: var(--muted-light);
}}

/* Accent price */
.price-salmon {{ color: var(--salmon); font-size: 32pt; font-weight: 800; }}
.price-red {{ color: var(--red); font-size: 32pt; font-weight: 800; }}

/* Contact card on red */
.contact-box {{
    background: rgba(140,25,35,0.7);
    border-radius: 10px;
    padding: 0.18in 0.3in;
    text-align: center;
    margin: 0 auto;
    max-width: 5in;
}}

.bonus-bar {{
    background: rgba(140,25,35,0.7);
    border-radius: 8px;
    padding: 0.12in 0.3in;
    text-align: center;
    font-size: 10pt;
    margin: 0.2in 1in 0;
}}

.tier-highlight {{
    border-left: 3px solid var(--red);
}}
</style>
</head>
<body>

<!-- ============ SLIDE 1: Cover ============ -->
<div class="slide red-photo" style="text-align: center;">
    <div class="photo-overlay" style="background: rgba(178,34,52,0.7);"></div>
    <div class="photo-content" style="padding-top: 1.2in;">
        <div class="pill" style="margin-bottom: 0.2in;">6th Edition — August 16-22, 2026</div>
        <h1 style="font-size: 48pt; font-weight: 900; margin-bottom: 0.15in;">Crypto Commons<br>Gathering 2026</h1>
        <div style="width: 0.8in; height: 3px; background: white; margin: 0.15in auto;"></div>
        <p style="font-size: 18pt; margin-top: 0.2in;">Sponsorship Partnership Deck</p>
        <p class="muted" style="font-size: 12pt; margin-top: 0.15in;">Commons Hub, Austrian Alps · cryptocommonsgather.ing</p>
        <div class="footer"><span>CCG 2026</span><span>01</span></div>
    </div>
</div>

<!-- ============ SLIDE 2: About ============ -->
<div class="slide light">
    <div class="two-col-wide-left">
        <div>
            <div class="section-label">About the Gathering</div>
            <h2 class="slide-title">A week-long unconference where crypto meets the commons</h2>
            <p style="font-size: 12pt; color: var(--muted-dark); line-height: 1.6; margin-bottom: 0.15in;">
                The Crypto Commons Gathering is an annual retreat in the Austrian Alps where builders,
                researchers, and activists working on regenerative finance, cooperative economics, and
                commons-based infrastructure come together for a week of co-living, co-creating, and
                radical imagination.
            </p>
            <p style="font-size: 12pt; color: var(--muted-dark); line-height: 1.6;">
                Now in its <strong style="color: var(--black);">6th edition</strong>, CCG has become the premier gathering for the people building
                post-capitalist economic infrastructure. Not a conference — a convivium.
            </p>
        </div>
        <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 0.12in; align-content: center;">
            <div class="card" style="text-align: center; padding: 0.25in 0.15in;">
                <div class="stat-num">6th</div>
                <div class="stat-label">Annual Edition</div>
            </div>
            <div class="card" style="text-align: center; padding: 0.25in 0.15in;">
                <div class="stat-num">60+</div>
                <div class="stat-label">Participants</div>
            </div>
            <div class="card" style="text-align: center; padding: 0.25in 0.15in;">
                <div class="stat-num">15+</div>
                <div class="stat-label">Countries</div>
            </div>
            <div class="card" style="text-align: center; padding: 0.25in 0.15in;">
                <div class="stat-num" style="font-size: 32pt;">∞</div>
                <div class="stat-label">Real Value Produced</div>
            </div>
        </div>
    </div>
    <div class="footer"><span>CCG 2026</span><span>02</span></div>
</div>

<!-- ============ SLIDE 3: Track Record ============ -->
<div class="slide dark-photo-courtyard">
    <div class="photo-overlay" style="background: rgba(26,26,26,0.75);"></div>
    <div class="photo-content">
        <div class="section-label">Track Record</div>
        <h2 class="slide-title">Real impact across five editions</h2>
        <div class="two-col" style="margin-top: 0.15in;">
            <div class="card-dark" style="text-align: center; padding: 0.35in;">
                <div style="font-size: 48pt; font-weight: 800; color: var(--salmon);">300+</div>
                <div style="font-size: 11pt; color: var(--muted-light); margin-top: 0.05in;">Total Attendees Across Five Editions</div>
                <p style="font-size: 11pt; color: var(--muted-light); margin-top: 0.12in;">Builders, researchers, activists, artists, and funders from 15+ countries.</p>
            </div>
            <div class="card-dark">
                <h3 style="font-size: 14pt; font-weight: 700; margin-bottom: 0.15in;">Movements Catalyzed</h3>
                <p style="font-size: 11pt; margin-bottom: 0.08in;"><strong style="color: var(--salmon);">#ReFi</strong> — Regenerative Finance: catalyzed at CCG, ReFi Unconference (2022) was one of the first ReFi events</p>
                <p style="font-size: 11pt; margin-bottom: 0.08in;"><strong style="color: var(--salmon);">#CoFi</strong> — Cooperative Finance: redefining collaborative financial infrastructure</p>
                <p style="font-size: 11pt; margin-bottom: 0.12in;"><strong style="color: var(--salmon);">#MycoFi</strong> — Mycelial Finance: biomimetic approaches to economic design</p>
                <div style="border-top: 1px solid #444; padding-top: 0.1in;">
                    <p style="font-size: 9pt; color: var(--muted-light);">New protocols, collaborative frameworks, and digital public infrastructures have emerged from these gatherings.</p>
                </div>
            </div>
        </div>
        <p style="text-align: center; font-size: 10pt; color: var(--muted-light); margin-top: 0.2in;">
            Teams from Commons Stack, BlockScience, Regen Network, EthicHub, Circles UBI, ReFi DAO, Holochain, Economic Space Agency, zkNetwork, and more.
        </p>
        <div class="footer"><span>CCG 2026</span><span>03</span></div>
    </div>
</div>

<!-- ============ SLIDE 4: Why Partner ============ -->
<div class="slide light-photo-group">
    <div class="photo-overlay" style="background: rgba(245,245,245,0.75);"></div>
    <div class="photo-content">
        <div class="section-label">Why Partner With Us</div>
        <h2 class="slide-title">Four reasons to sponsor CCG</h2>
        <div class="grid-2x2" style="margin-top: 0.1in;">
            <div class="card">
                <h3 style="font-size: 13pt; font-weight: 700; margin-bottom: 0.1in;">Reach Influential Builders, Thought Leaders &amp; Decision Makers</h3>
                <p style="font-size: 10pt; color: var(--muted-dark); line-height: 1.5;">ReFi protocol teams, DAO governance researchers, cooperative founders, academic researchers, and impact investors. Decision-makers you won't find at traditional crypto conferences.</p>
            </div>
            <div class="card">
                <h3 style="font-size: 13pt; font-weight: 700; margin-bottom: 0.1in;">Association with Real Impact</h3>
                <p style="font-size: 10pt; color: var(--muted-dark); line-height: 1.5;">CCG has catalyzed #ReFi, #CoFi, and #MycoFi — movements shaping regenerative finance. Your brand joins a legacy of genuine innovation.</p>
            </div>
            <div class="card">
                <h3 style="font-size: 13pt; font-weight: 700; margin-bottom: 0.1in;">Values-Aligned Audience</h3>
                <p style="font-size: 10pt; color: var(--muted-dark); line-height: 1.5;">These aren't casual observers. They lead projects with real traction, make purchasing decisions, and influence discourse across crypto-commons and open source.</p>
            </div>
            <div class="card">
                <h3 style="font-size: 13pt; font-weight: 700; margin-bottom: 0.1in;">Six Years of Trust</h3>
                <p style="font-size: 10pt; color: var(--muted-dark); line-height: 1.5;">Complete financial transparency. Non-extractive economics. Participant-driven format. 500+ active community members. No one profits — all funds serve the gathering.</p>
            </div>
        </div>
        <div class="footer"><span>CCG 2026</span><span>04</span></div>
    </div>
</div>

<!-- ============ SLIDE 5: Who You'll Reach ============ -->
<div class="slide dark-photo-outdoor">
    <div class="photo-overlay" style="background: rgba(26,26,26,0.75);"></div>
    <div class="photo-content">
        <div class="section-label">Who You'll Reach</div>
        <h2 class="slide-title">60+ participants from 15+ countries</h2>
        <p class="muted" style="font-size: 12pt; margin-bottom: 0.2in;">Not casual observers — committed builders who influence discourse and make decisions for their organizations.</p>
        <div class="grid-2x3">
            <div class="card-dark">
                <div class="stat-num">35%</div>
                <div style="font-weight: 700; font-size: 11pt; margin: 0.04in 0;">Builders &amp; Devs</div>
                <div style="font-size: 9pt; color: var(--muted-light);">Protocol engineers, smart contract devs, infrastructure builders</div>
            </div>
            <div class="card-dark">
                <div class="stat-num">25%</div>
                <div style="font-weight: 700; font-size: 11pt; margin: 0.04in 0;">Researchers</div>
                <div style="font-size: 9pt; color: var(--muted-light);">PhD students, professors, think tank members, policy experts</div>
            </div>
            <div class="card-dark">
                <div class="stat-num">15%</div>
                <div style="font-weight: 700; font-size: 11pt; margin: 0.04in 0;">Artists &amp; Designers</div>
                <div style="font-size: 9pt; color: var(--muted-light);">Game designers, solarpunk creators, UX/UI specialists</div>
            </div>
            <div class="card-dark">
                <div class="stat-num">15%</div>
                <div style="font-weight: 700; font-size: 11pt; margin: 0.04in 0;">Activists &amp; Organizers</div>
                <div style="font-size: 9pt; color: var(--muted-light);">Cooperative founders, community organizers, policy advocates</div>
            </div>
            <div class="card-dark">
                <div class="stat-num">10%</div>
                <div style="font-weight: 700; font-size: 11pt; margin: 0.04in 0;">Investors &amp; Funders</div>
                <div style="font-size: 9pt; color: var(--muted-light);">Impact investors, grant makers, ecosystem funders</div>
            </div>
            <div class="card-dark">
                <div class="stat-num">60%</div>
                <div style="font-weight: 700; font-size: 11pt; margin: 0.04in 0;">Based in Europe</div>
                <div style="font-size: 9pt; color: var(--muted-light);">20% N. America, 15% Global South, 5% Asia-Pacific</div>
            </div>
        </div>
        <div class="footer"><span>CCG 2026</span><span>05</span></div>
    </div>
</div>

<!-- ============ SLIDE 6: Partnership Tiers Overview ============ -->
<div class="slide light" style="padding-top: 0.5in; text-align: center;">
    <div class="section-label">Partnership Tiers</div>
    <h2 class="slide-title" style="text-align: center; font-size: 34pt;">Three ways to support CCG 2026</h2>
    <p class="muted" style="font-size: 11pt; margin-bottom: 0.25in;">We're seeking ~€10,000 in total sponsorship. Every contribution makes CCG more accessible and impactful.</p>

    <div class="grid-3" style="text-align: left;">
        <!-- First Among Equals -->
        <div class="card tier-highlight" style="padding: 0.25in;">
            <div style="font-size: 12pt; font-weight: 800;">FIRST AMONG EQUALS</div>
            <div style="font-size: 28pt; font-weight: 800; color: var(--red);">€5,000</div>
            <div class="tier-cat">Recognition</div>
            <div style="font-size: 9pt;">✓ Logo on website hero &amp; all pages<br>✓ Featured on all event materials &amp; badges<br>✓ Opening &amp; closing acknowledgment<br>✓ Social media across all channels</div>
            <div class="tier-cat">Engagement</div>
            <div style="font-size: 9pt;">✓ <strong>2 event tickets, lodging and food</strong><br>✓ 30-min sponsored session slot<br>✓ Participant introductions</div>
            <div class="tier-cat">Content &amp; Media</div>
            <div style="font-size: 9pt;">✓ Pre-event spotlight<br>✓ Post-event report feature<br>✓ "Official Sponsor" usage rights</div>
        </div>
        <!-- Vanguard -->
        <div class="card" style="padding: 0.25in;">
            <div style="font-size: 12pt; font-weight: 800;">VANGUARD</div>
            <div style="font-size: 28pt; font-weight: 800; color: var(--red);">€2,500</div>
            <div class="tier-cat">Recognition</div>
            <div style="font-size: 9pt;">✓ Logo on website sponsor section<br>✓ Logo on event signage<br>✓ Social media mention</div>
            <div class="tier-cat">Engagement</div>
            <div style="font-size: 9pt;">✓ <strong>1 event ticket</strong><br>✓ Priority registration</div>
            <div class="tier-cat">Content &amp; Media</div>
            <div style="font-size: 9pt;">✓ Event newsletter mention<br>✓ Post-event summary inclusion</div>
        </div>
        <!-- Comrade -->
        <div class="card" style="padding: 0.25in;">
            <div style="font-size: 12pt; font-weight: 800;">COMRADE</div>
            <div style="font-size: 28pt; font-weight: 800; color: var(--red);">€1,000</div>
            <div class="tier-cat">Recognition</div>
            <div style="font-size: 9pt;">✓ Name/logo on supporters section<br>✓ Social media thank-you<br>✓ Ceremony acknowledgment</div>
            <div class="tier-cat">Engagement</div>
            <div style="font-size: 9pt;">✓ <strong>1 event ticket at 50% off</strong></div>
        </div>
    </div>
    <div class="footer"><span>CCG 2026</span><span>06</span></div>
</div>

<!-- ============ SLIDE 7: First Among Equals Detail ============ -->
<div class="slide dark-photo-mountain">
    <div class="photo-overlay" style="background: rgba(26,26,26,0.75);"></div>
    <div class="photo-content">
        <div class="two-col">
            <div>
                <div class="section-label">Lead Partner</div>
                <h2 style="font-size: 34pt; font-weight: 900; margin-bottom: 0;">FIRST AMONG<br>EQUALS</h2>
                <div class="price-salmon" style="margin-bottom: 0.2in;">€5,000</div>
                <p style="font-size: 12pt; color: var(--muted-light); line-height: 1.5; margin-bottom: 0.2in;">
                    All sponsors are equal, but some are more equal than others. Maximum visibility,
                    meaningful engagement, and lasting association with the commons movement.
                </p>
                <div class="quote">
                    <p>"The ideas I encountered at CCG completely changed how I think about protocol design. It's like nothing else in the crypto space."</p>
                    <cite>— ReFi builder, 2023</cite>
                </div>
            </div>
            <div class="card-dark">
                <div class="tier-cat" style="margin-top: 0;">What You Get</div>
                <ul class="check-list" style="margin-top: 0.1in;">
                    <li><strong>2 event tickets, lodging and food</strong> to the week-long gathering</li>
                    <li><strong>30-minute sponsored session</strong> — workshop, presentation, or demo</li>
                    <li>Logo on <strong>website hero section</strong> and every page</li>
                    <li>Featured on <strong>all event materials</strong>, badges, and signage</li>
                    <li><strong>Acknowledgment</strong> at opening and closing ceremonies</li>
                    <li>Social media spotlight across <strong>all CCG channels</strong></li>
                    <li><strong>Spotlight</strong> in pre-event communications to 500+ members</li>
                    <li>Dedicated <strong>feature in post-event report</strong></li>
                    <li>Rights to use <strong>"First Among Equals — CCG 2026"</strong></li>
                    <li>Participant introductions (with consent)</li>
                </ul>
            </div>
        </div>
        <div class="footer"><span>CCG 2026</span><span>07</span></div>
    </div>
</div>

<!-- ============ SLIDE 8: Vanguard Detail ============ -->
<div class="slide light">
    <div class="two-col">
        <div class="card" style="align-self: start;">
            <div class="tier-cat" style="margin-top: 0;">What You Get</div>
            <ul class="check-list" style="margin-top: 0.1in;">
                <li><strong>1 event ticket</strong> to the week-long gathering</li>
                <li><strong>Priority registration</strong> — secure your spot before public sales</li>
                <li>Logo on the <strong>website sponsor section</strong></li>
                <li>Logo on <strong>event signage</strong> at the Commons Hub</li>
                <li><strong>Social media mention</strong> across CCG channels</li>
                <li>Named in <strong>event newsletter</strong> to 500+ subscribers</li>
                <li>Included in <strong>post-event summary</strong> and documentation</li>
            </ul>
        </div>
        <div>
            <div class="section-label">Supporter</div>
            <h2 style="font-size: 36pt; font-weight: 900; margin-bottom: 0; color: var(--black);">VANGUARD</h2>
            <div class="price-red" style="margin-bottom: 0.2in;">€2,500</div>
            <p style="font-size: 12pt; color: var(--muted-dark); line-height: 1.5; margin-bottom: 0.2in;">
                Lead the charge for regenerative futures. Meaningful recognition and a direct connection to the
                community, at an accessible investment level.
            </p>
            <div class="quote" style="border-color: var(--red);">
                <p style="color: var(--muted-dark);">"CCG is where I found my people — the ones who actually believe another world is possible and are building it together."</p>
                <cite style="color: var(--muted-dark);">— Returning participant, 2024</cite>
            </div>
        </div>
    </div>
    <div class="footer"><span>CCG 2026</span><span>08</span></div>
</div>

<!-- ============ SLIDE 9: Comrade ============ -->
<div class="slide dark">
    <div class="two-col">
        <div>
            <div class="section-label">Solidarity</div>
            <h2 style="font-size: 36pt; font-weight: 900; margin-bottom: 0;">COMRADE</h2>
            <div class="price-salmon" style="margin-bottom: 0.2in;">€1,000</div>
            <p style="font-size: 12pt; color: var(--muted-light); line-height: 1.5; margin-bottom: 0.2in;">
                Show solidarity with the movement. Every contribution helps keep CCG accessible
                and makes a real difference for participants who need support.
            </p>
            <div class="quote">
                <p>"I came for the unconference, I stayed for the community. Four years later, my closest collaborators are people I met at CCG."</p>
                <cite>— Cooperative founder, 2022</cite>
            </div>
        </div>
        <div class="card-dark">
            <div class="tier-cat" style="margin-top: 0;">What You Get</div>
            <ul class="check-list" style="margin-top: 0.1in;">
                <li><strong>1 event ticket at 50% off</strong> — attend the full gathering at half price</li>
                <li>Name or logo on the <strong>website supporters section</strong></li>
                <li><strong>Social media thank-you</strong> post across CCG channels</li>
                <li><strong>Acknowledgment</strong> at opening and closing ceremonies</li>
            </ul>
            <div style="border-top: 1px solid #444; margin-top: 0.2in; padding-top: 0.15in;">
                <p style="font-size: 10pt; color: var(--muted-light);">Perfect for individuals, small organizations, and cooperatives who want to show support for commons-based futures.</p>
            </div>
        </div>
    </div>
    <div class="footer"><span>CCG 2026</span><span>09</span></div>
</div>

<!-- ============ SLIDE 10: Budget ============ -->
<div class="slide light-photo-morning">
    <div class="photo-overlay" style="background: rgba(245,245,245,0.75);"></div>
    <div class="photo-content">
        <div class="section-label">Full Transparency</div>
        <h2 class="slide-title">Where your sponsorship goes</h2>
        <div class="two-col" style="margin-top: 0.05in;">
            <div>
                <h3 style="font-size: 13pt; font-weight: 700; margin-bottom: 0.12in;">Estimated Event Budget</h3>
            <table class="budget-table">
                <tr><td><span class="item">Food &amp; catering</span><br><span class="sub">6 days, 60+ participants</span></td><td class="amount">€8,500</td></tr>
                <tr><td><span class="item">Venue</span><br><span class="sub">Facility, electricity, water, internet</span></td><td class="amount">€5,000</td></tr>
                <tr><td><span class="item">Accessibility &amp; travel support</span><br><span class="sub">Grants, subsidies, accommodations</span></td><td class="amount">€3,500</td></tr>
                <tr><td><span class="item">Event coordination</span><br><span class="sub">Part-time logistics &amp; comms</span></td><td class="amount">€3,000</td></tr>
                <tr><td><span class="item">Design &amp; marketing</span><br><span class="sub">Branding, print materials, outreach</span></td><td class="amount">€2,000</td></tr>
                <tr><td><span class="item">Documentation &amp; media</span><br><span class="sub">Photo, video, written summaries</span></td><td class="amount">€1,500</td></tr>
                <tr><td><span class="item">Supplies &amp; admin</span><br><span class="sub">Materials, insurance, processing</span></td><td class="amount">€1,500</td></tr>
                <tr class="total"><td>Total</td><td class="amount">€25,000</td></tr>
            </table>
        </div>
        <div>
            <h3 style="font-size: 13pt; font-weight: 700; margin-bottom: 0.12in;">Revenue Sources</h3>
            <div class="card" style="margin-bottom: 0.12in; padding: 0.18in 0.25in;">
                <div style="display: flex; justify-content: space-between; font-size: 11pt;">
                    <span>Food contributions</span><strong>~€8.5k</strong>
                </div>
                <div class="bar-track"><div class="bar-fill" style="width: 75%;"></div></div>
            </div>
            <div class="card" style="margin-bottom: 0.12in; padding: 0.18in 0.25in;">
                <div style="display: flex; justify-content: space-between; font-size: 11pt;">
                    <span>Ticket sales</span><strong>~€7k</strong>
                </div>
                <div class="bar-track"><div class="bar-fill" style="width: 60%;"></div></div>
            </div>
            <div class="gap-card" style="margin-bottom: 0.12in;">
                <div style="display: flex; justify-content: space-between; align-items: baseline;">
                    <strong style="font-size: 11pt;">Sponsorship gap</strong>
                    <strong style="font-size: 16pt; color: var(--red);">~€10k</strong>
                </div>
                <p style="font-size: 9pt; color: var(--muted-dark); margin-top: 0.05in;">This is where your support makes the difference.</p>
                <div style="display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 0.08in;">
                    <div style="width: 34%; background: #5a8f5a; border-radius: 4px 0 0 4px;"></div>
                    <div style="width: 28%; background: #4a7fb5;"></div>
                    <div style="width: 38%; background: #ccc; border-radius: 0 4px 4px 0;"></div>
                </div>
                <div style="display: flex; justify-content: space-between; font-size: 8pt; color: var(--muted-dark); margin-top: 3px;">
                    <span>Food €8.5k</span><span>Tickets €7k</span><span style="color: #999; font-weight: 600;">Unfunded ~€10k</span>
                </div>
            </div>
            <div style="background: #eee; border-radius: 8px; padding: 0.12in 0.2in;">
                <strong style="font-size: 10pt;">Transparency &amp; Accountability</strong>
                <p style="font-size: 9pt; color: var(--muted-dark); margin-top: 0.03in;">Full budget will be published publicly.</p>
            </div>
        </div>
    </div>
        <div class="footer"><span>CCG 2026</span><span>10</span></div>
    </div>
</div>

<!-- ============ SLIDE 11: Alternative Partnerships ============ -->
<div class="slide light-photo-workshop">
    <div class="photo-overlay" style="background: rgba(245,245,245,0.75);"></div>
    <div class="photo-content">
        <div class="section-label">Beyond Financial Sponsorship</div>
        <h2 class="slide-title">Alternative partnerships welcome</h2>
        <div class="grid-2x3" style="margin-top: 0.1in;">
        <div class="card">
            <h3 style="font-size: 13pt; font-weight: 700; margin-bottom: 0.02in;">Track Sponsorship</h3>
            <div style="font-size: 9pt; color: var(--muted-dark); margin-bottom: 0.08in;">Custom pricing</div>
            <p style="font-size: 10pt; color: var(--muted-dark); line-height: 1.4;">Sponsor a specific theme track with naming rights and session curation involvement.</p>
        </div>
        <div class="card">
            <h3 style="font-size: 13pt; font-weight: 700; margin-bottom: 0.02in;">Accommodation</h3>
            <div style="font-size: 9pt; color: var(--muted-dark); margin-bottom: 0.08in;">~€3,000–5,000</div>
            <p style="font-size: 10pt; color: var(--muted-dark); line-height: 1.4;">Cover accommodation for participants who need financial support, broadening access.</p>
        </div>
        <div class="card">
            <h3 style="font-size: 13pt; font-weight: 700; margin-bottom: 0.02in;">Meal Sponsorship</h3>
            <div style="font-size: 9pt; color: var(--muted-dark); margin-bottom: 0.08in;">~€2,000–4,000</div>
            <p style="font-size: 10pt; color: var(--muted-dark); line-height: 1.4;">Sponsor catered meals — your name becomes synonymous with nourishment and care.</p>
        </div>
        <div class="card">
            <h3 style="font-size: 13pt; font-weight: 700; margin-bottom: 0.02in;">Documentation</h3>
            <div style="font-size: 9pt; color: var(--muted-dark); margin-bottom: 0.08in;">~€1,500</div>
            <p style="font-size: 10pt; color: var(--muted-dark); line-height: 1.4;">Support professional photography, videography, and written summaries with credit.</p>
        </div>
        <div class="card">
            <h3 style="font-size: 13pt; font-weight: 700; margin-bottom: 0.02in;">Travel Grants</h3>
            <div style="font-size: 9pt; color: var(--muted-dark); margin-bottom: 0.08in;">Custom</div>
            <p style="font-size: 10pt; color: var(--muted-dark); line-height: 1.4;">Fund travel scholarships for participants from underrepresented regions or backgrounds.</p>
        </div>
        <div class="card">
            <h3 style="font-size: 13pt; font-weight: 700; margin-bottom: 0.02in;">Tech Partnership</h3>
            <div style="font-size: 9pt; color: var(--muted-dark); margin-bottom: 0.08in;">In-kind</div>
            <p style="font-size: 10pt; color: var(--muted-dark); line-height: 1.4;">Provide tools, platforms, or infrastructure (streaming, collaboration) in exchange for recognition.</p>
        </div>
    </div>
        <div class="footer"><span>CCG 2026</span><span>11</span></div>
    </div>
</div>

<!-- ============ SLIDE 12: Closing CTA ============ -->
<div class="slide red-photo-river" style="text-align: center;">
    <div class="photo-overlay" style="background: rgba(178,34,52,0.72);"></div>
    <div class="photo-content" style="padding-top: 0.2in;">
        <h2 style="font-size: 42pt; font-weight: 800; margin-bottom: 0.2in;">Let's build together.</h2>
        <p style="font-size: 13pt; max-width: 8in; margin: 0 auto 0.35in; line-height: 1.5; opacity: 0.9;">
            We're not seeking logo placement in exchange for attention.<br>
            We're seeking partners who share our vision of regenerative,<br>
            cooperative, and commons-based futures.
        </p>
        <div class="contact-box" style="margin-bottom: 0.25in;">
            <div style="font-size: 10pt; opacity: 0.7; margin-bottom: 0.05in;">Get in touch</div>
            <div style="font-size: 16pt; font-weight: 700;">contact@cryptocommonsgather.ing</div>
        </div>
        <div style="opacity: 0.7; font-size: 10pt; margin-bottom: 0.04in;">Learn more</div>
        <div style="font-size: 14pt; font-weight: 700; margin-bottom: 0.3in;">cryptocommonsgather.ing/sponsorships</div>
        <div class="bonus-bar">
            <strong>Bonus:</strong> Valley of the Commons takes place at the same venue immediately after CCG — sponsors gain extended visibility across both events.
        </div>
        <p style="font-size: 10pt; opacity: 0.6; margin-top: 0.25in;">Crypto Commons Association · Commons Hub, Reichenau an der Rax, Austria</p>
        <div class="footer"><span>CCG 2026</span><span>12</span></div>
    </div>
</div>

</body>
</html>"""

    # Save deck HTML
    deck_html_path = OUTPUT_DIR / "CCG26-Sponsorship-Deck.html"
    with open(deck_html_path, "w") as f:
        f.write(deck_html)
    print(f"Created: {deck_html_path}")

    # Generate deck PDF
    deck_pdf_path = OUTPUT_DIR / "CCG26-Sponsorship-Package.pdf"
    HTML(string=deck_html, base_url=str(OUTPUT_DIR)).write_pdf(deck_pdf_path)
    print(f"Created: {deck_pdf_path}")

    return deck_html_path, deck_pdf_path


def export_slide_images(pdf_path):
    """Convert each PDF page to a JPEG image for the flipbook."""
    SLIDES_DIR.mkdir(parents=True, exist_ok=True)

    images = convert_from_path(str(pdf_path), dpi=150)
    for i, image in enumerate(images, start=1):
        # Resize to 1200px wide, maintain 16:9 aspect ratio
        target_width = 1200
        aspect = image.height / image.width
        target_height = int(target_width * aspect)
        resized = image.resize((target_width, target_height))

        slide_path = SLIDES_DIR / f"slide-{i:02d}.jpg"
        resized.save(str(slide_path), "JPEG", quality=85, optimize=True)
        print(f"Created: {slide_path}")

    return len(images)


def copy_pdf_to_public(pdf_path):
    """Copy the PDF to public/ so the download link works."""
    dest = PUBLIC_DIR / pdf_path.name
    shutil.copy2(str(pdf_path), str(dest))
    print(f"Copied: {dest}")
    return dest


if __name__ == "__main__":
    print("Generating CCG 2026 Sponsorship Package...\n")

    deck_html, deck_pdf = create_slide_deck()

    # Export slide images for flipbook
    num_slides = export_slide_images(deck_pdf)
    print(f"\nExported {num_slides} slide images to {SLIDES_DIR}")

    # Copy PDF to public/ for download link
    public_pdf = copy_pdf_to_public(deck_pdf)

    print("\n✅ All documents generated successfully!")
    print(f"\nFiles created:")
    print(f"  - Deck HTML:  {deck_html}")
    print(f"  - Deck PDF:   {deck_pdf}")
    print(f"  - Public PDF: {public_pdf}")
    print(f"  - Slides:     {SLIDES_DIR}/slide-01.jpg through slide-{num_slides:02d}.jpg")
