// Sportistry marketing website — home.jsx
// Shared chrome (MarketingNav, Footer) + the Home page and its sections.
// Bilingual: data arrays are built at render time via helper functions so a
// language switch re-localises everything (see i18n.jsx).

function webEvents() {
    return [
        {
            id: "w1",
            sport: "soccer",
            title: tr(
                "Sunday 5-a-side · all levels",
                "Vasárnapi kispályás · minden szint",
            ),
            time: tr("Sun · 3:00 PM", "V · 15:00"),
            location: tr(
                "Városliget · 0.9 km",
                "Városliget · 0,9 km",
            ),
            going: 8,
            left: 2,
            status: "live",
            attendees: [
                { name: "Marco P", tint: "#1652F0" },
                { name: "Ana R", tint: "#E27A2B" },
                { name: "Jo K", tint: "#6A3FF0" },
                { name: "Kim L", tint: "#0DB1C9" },
                { name: "Sam W", tint: "#F0498D" },
            ],
        },
        {
            id: "w2",
            sport: "basket",
            title: tr(
                "Friday hoops at Erzsébet tér",
                "Pénteki kosár az Erzsébet téren",
            ),
            time: tr("Fri · 7:30 PM", "P · 19:30"),
            location: tr("Erzsébet tér · 1.9 km", "Erzsébet tér · 1,9 km"),
            going: 10,
            status: "full",
            attendees: [
                { name: "Sam S", tint: "#F0498D" },
                { name: "Kai T", tint: "#84B30C" },
                { name: "Lou D", tint: "#2EB85C" },
            ],
        },
        {
            id: "w3",
            sport: "running",
            title: tr("Sunrise 5k loop", "Hajnali 5K kör"),
            time: tr("Wed · 7:00 AM", "Sze · 7:00"),
            location: tr("Margitsziget · 3.2 km", "Margitsziget · 3,2 km"),
            going: 14,
            left: 6,
            status: "going",
            joined: true,
            attendees: [
                { name: "Tia M", tint: "#6A3FF0" },
                { name: "Owen P", tint: "#0DB1C9" },
                { name: "Niko F", tint: "#1652F0" },
                { name: "Pip R", tint: "#E27A2B" },
            ],
        },
        {
            id: "w4",
            sport: "padel",
            title: tr("Padel doubles · social", "Padel páros · társasági"),
            time: tr("Sat · 11:00 AM", "Szo · 11:00"),
            location: tr(
                "Padel Garden Budapest · 2.9 km",
                "Padel Garden Budapest · 2,9 km",
            ),
            going: 4,
            left: 0,
            status: "open",
            attendees: [
                { name: "Diego A", tint: "#00C2A8" },
                { name: "Mae H", tint: "#1652F0" },
            ],
        },
        {
            id: "w5",
            sport: "cycling",
            title: tr("Weekend ride · 30km", "Hétvégi tekerés · 30 km"),
            time: tr("Sat · 8:00 AM", "Szo · 8:00"),
            location: tr(
                "Hűvösvölgyi végállomás · 5.5 km",
                "Hűvösvölgyi végállomás · 5,5 km",
            ),
            going: 7,
            left: 5,
            status: "open",
            attendees: [
                { name: "Eli K", tint: "#0DB1C9" },
                { name: "Mara T", tint: "#1652F0" },
                { name: "Bobi L", tint: "#84B30C" },
            ],
        },
        {
            id: "w6",
            sport: "volley",
            title: tr("Beach volley · doubles", "Strandröplabda · páros"),
            time: tr("Sun · 4:30 PM", "V · 16:30"),
            location: tr("Kopaszi-gát · 1.4 km", "Kopaszi-gát · 1,4 km"),
            going: 6,
            left: 2,
            status: "going",
            attendees: [
                { name: "Nico V", tint: "#F0498D" },
                { name: "Iris H", tint: "#6A3FF0" },
            ],
        },
    ];
}

function navLinks() {
    return [
        {
            id: "discover",
            label: tr("Discover", "Felfedezés"),
            href: "/discover",
        },
        {
            id: "edzoknek",
            label: tr("For coaches", "Edzőknek"),
            href: "/edzoknek",
        },
        {
            id: "helyszineknek",
            label: tr("For venues", "Helyszíneknek"),
            href: "/helyszineknek",
        },
        { id: "blog", label: tr("Blog", "Blog"), href: "/blog" },
        { id: "about", label: tr("About", "Rólunk"), href: "/about" },
    ];
}

// ───────────────────── Top nav (shared) ─────────────────────
function MarketingNav({ current }) {
    const [scrolled, setScrolled] = React.useState(
        () => typeof window !== "undefined" && window.scrollY > 8,
    );
    const [menuOpen, setMenuOpen] = React.useState(false);
    const isMobile = useIsMobile(920); // nav links + CTA need more room than the general breakpoint
    React.useEffect(() => {
        const f = () => setScrolled(window.scrollY > 8);
        f();
        window.addEventListener("scroll", f);
        return () => window.removeEventListener("scroll", f);
    }, []);
    React.useEffect(() => {
        if (!isMobile) setMenuOpen(false);
    }, [isMobile]);
    // Desktop-only trial: past the scroll threshold, the wordmark rolls fully into the glyph
    // (not scrubbed to scroll distance — a small scroll still plays the full animation).
    const collapse = !isMobile && scrolled ? 1 : 0;
    return (
        <header
            style={{
                position: "sticky",
                top: 0,
                zIndex: 50,
                // No backdrop-filter by design. A blurred position:sticky header
                // makes Chromium re-sample its backdrop on unrelated repaints
                // (e.g. browser-chrome / bookmark-bar hover), and on some GPUs it
                // mis-samples — flashing a light "box shadow" wash over the bar.
                // A translucent dark background keeps the layered-over-hero feel
                // without the compositing hazard.
                background:
                    scrolled || menuOpen
                        ? "rgba(10,14,28,0.95)"
                        : "rgba(10,14,28,0.78)",
                borderBottom:
                    scrolled || menuOpen
                        ? "1px solid rgba(255,255,255,0.08)"
                        : "1px solid transparent",
                transition: "background 200ms, border-color 200ms",
                color: "white",
            }}
        >
            <Container
                style={{
                    padding: isMobile ? "14px 20px" : "14px 32px",
                    display: "flex",
                    alignItems: "center",
                    justifyContent: "space-between",
                }}
                width={MAXW}
            >
                <div style={{ display: "flex", alignItems: "center", gap: 30 }}>
                    <a href="/" style={{ textDecoration: "none" }}>
                        <Logo
                            light
                            size={30}
                            collapse={collapse}
                            collapseAnim={!isMobile}
                        />
                    </a>
                    {!isMobile && (
                        <nav style={{ display: "flex", gap: 24 }}>
                            {navLinks().map((l) => {
                                const active = current === l.id;
                                return (
                                    <a
                                        key={l.id}
                                        href={l.href}
                                        style={{
                                            color: active
                                                ? "white"
                                                : "rgba(255,255,255,0.78)",
                                            textDecoration: "none",
                                            fontFamily: FB,
                                            fontWeight: 600,
                                            fontSize: 14,
                                            position: "relative",
                                            paddingBottom: 2,
                                            whiteSpace: "nowrap",
                                            borderBottom: active
                                                ? "2px solid " + SB.lime
                                                : "2px solid transparent",
                                        }}
                                        onMouseEnter={(e) =>
                                            (e.currentTarget.style.color =
                                                "white")
                                        }
                                        onMouseLeave={(e) =>
                                            (e.currentTarget.style.color =
                                                active
                                                    ? "white"
                                                    : "rgba(255,255,255,0.78)")
                                        }
                                    >
                                        {l.label}
                                    </a>
                                );
                            })}
                        </nav>
                    )}
                </div>
                {isMobile ? (
                    <div
                        style={{
                            display: "flex",
                            alignItems: "center",
                            gap: 10,
                        }}
                    >
                        <LangToggle />
                        <button
                            aria-label={tr("Menu", "Menü")}
                            onClick={() => setMenuOpen((o) => !o)}
                            style={{
                                background: "transparent",
                                border: "none",
                                color: "white",
                                padding: 6,
                                cursor: "pointer",
                                display: "flex",
                                alignItems: "center",
                                justifyContent: "center",
                            }}
                        >
                            <WIcon
                                name={menuOpen ? "close" : "menu"}
                                size={26}
                                color="white"
                            />
                        </button>
                    </div>
                ) : (
                    <div
                        style={{
                            display: "flex",
                            alignItems: "center",
                            gap: 14,
                        }}
                    >
                        <a
                            href="/app"
                            style={{
                                color: "rgba(255,255,255,0.85)",
                                fontFamily: FB,
                                fontWeight: 600,
                                fontSize: 14,
                                textDecoration: "none",
                                whiteSpace: "nowrap",
                            }}
                        >
                            {tr("Sign in", "Bejelentkezés")}
                        </a>
                        <LangToggle />
                        <WButton
                            variant="accent"
                            size="sm"
                            icon="download"
                            href="/download"
                        >
                            {tr("Get the app", "Töltsd le")}
                        </WButton>
                    </div>
                )}
            </Container>
            {isMobile && menuOpen && (
                <div
                    style={{
                        borderTop: "1px solid rgba(255,255,255,0.08)",
                        padding: "8px 20px 20px",
                        display: "flex",
                        flexDirection: "column",
                        gap: 4,
                    }}
                >
                    {navLinks().map((l) => {
                        const active = current === l.id;
                        return (
                            <a
                                key={l.id}
                                href={l.href}
                                style={{
                                    color: active
                                        ? SB.lime
                                        : "rgba(255,255,255,0.85)",
                                    textDecoration: "none",
                                    fontFamily: FB,
                                    fontWeight: 600,
                                    fontSize: 16,
                                    padding: "12px 0",
                                    borderBottom:
                                        "1px solid rgba(255,255,255,0.06)",
                                }}
                            >
                                {l.label}
                            </a>
                        );
                    })}
                    <div style={{ marginTop: 10 }}>
                        <WButton
                            variant="accent"
                            size="md"
                            icon="download"
                            href="/download"
                            full
                        >
                            {tr("Get the app", "Töltsd le")}
                        </WButton>
                    </div>
                </div>
            )}
        </header>
    );
}

// ───────────────────── Footer (shared) ─────────────────────
function Footer() {
    const isMobile = useIsMobile();
    const cols = [
        {
            h: tr("Product", "Termék"),
            items: [
                [tr("Discover", "Felfedezés"), "/discover"],
                [tr("Download", "Letöltés"), "/download"],
            ],
        },
        {
            h: tr("For organizers", "Szervezőknek"),
            items: [
                [tr("For clubs & venues", "Kluboknak és helyszíneknek"), "/helyszineknek"],
                [tr("Blog", "Blog"), "/blog"],
            ],
        },
        {
            h: tr("Company", "Cég"),
            items: [
                [tr("About", "Rólunk"), "/about"],
                [tr("Contact", "Kapcsolat"), "mailto:info@sportistry.app"],
            ],
        },
        {
            h: tr("Legal", "Jogi"),
            items: [
                [tr("Privacy", "Adatvédelem"), "/privacy"],
                [tr("Terms", "ÁSZF"), "/terms"],
                [tr("Legal Notice", "Impresszum"), "/impresszum"],
                [tr("Cookie settings", "Süti beállítások"), "#cookies"],
            ],
        },
    ];
    return (
        <footer
            style={{
                background: SB.ink950,
                color: "white",
                padding: "64px 0 32px",
            }}
        >
            <Container>
                <div
                    style={{
                        display: "grid",
                        gridTemplateColumns: isMobile
                            ? "1fr 1fr"
                            : "1.6fr 1fr 1fr 1fr 1fr",
                        gap: 32,
                        paddingBottom: 40,
                        borderBottom: "1px solid rgba(255,255,255,0.08)",
                    }}
                >
                    <div
                        style={isMobile ? { gridColumn: "1 / -1" } : undefined}
                    >
                        <a href="/" style={{ textDecoration: "none" }}>
                            <Logo light size={28} />
                        </a>
                        <p
                            style={{
                                fontFamily: FB,
                                fontWeight: 500,
                                fontSize: 13,
                                lineHeight: "20px",
                                color: "rgba(255,255,255,0.62)",
                                maxWidth: 260,
                                margin: "14px 0 18px",
                            }}
                        >
                            {tr(
                                "Get out there. Together. Find real games with real people near you.",
                                "Mozduljunk ki. Együtt. Találj valódi meccseket valódi emberekkel a közeledben.",
                            )}
                        </p>
                        <StoreBadges />
                    </div>
                    {cols.map((col) => (
                        <div key={col.h}>
                            <div
                                style={{
                                    fontFamily: FD,
                                    fontWeight: 700,
                                    fontSize: 12,
                                    letterSpacing: ".08em",
                                    textTransform: "uppercase",
                                    color: "white",
                                    marginBottom: 14,
                                }}
                            >
                                {col.h}
                            </div>
                            {col.items.map(([label, href]) => (
                                <a
                                    key={label}
                                    href={href}
                                    onClick={(e) => {
                                        // "#cookies" re-opens the consent banner
                                        // (window.sbCookieSettings, defined in
                                        // index.html) instead of navigating.
                                        // stopPropagation is required: the marketing
                                        // router's document-level click listener
                                        // (useRoute in pages.jsx) otherwise pushState's
                                        // the href and leaves a "#cookies" in the URL.
                                        if (href === "#cookies") {
                                            e.preventDefault();
                                            e.stopPropagation();
                                            if (window.sbCookieSettings)
                                                window.sbCookieSettings();
                                        }
                                    }}
                                    style={{
                                        display: "block",
                                        color: "rgba(255,255,255,0.62)",
                                        fontFamily: FB,
                                        fontWeight: 500,
                                        fontSize: 13,
                                        padding: "5px 0",
                                        textDecoration: "none",
                                    }}
                                    onMouseEnter={(e) =>
                                        (e.currentTarget.style.color = "white")
                                    }
                                    onMouseLeave={(e) =>
                                        (e.currentTarget.style.color =
                                            "rgba(255,255,255,0.62)")
                                    }
                                >
                                    {label}
                                </a>
                            ))}
                        </div>
                    ))}
                </div>
                <div
                    style={{
                        paddingTop: 24,
                        fontFamily: FB,
                        fontSize: 12,
                        color: "rgba(255,255,255,0.5)",
                    }}
                >
                    <span>
                        {tr(
                            "© 2026 Sportistry. Made for people who actually play.",
                            "© 2026 Sportistry. Azoknak, akik tényleg játszanak.",
                        )}
                    </span>
                </div>
            </Container>
        </footer>
    );
}

// Reusable dark glow backdrop for dark sections
function DarkGlows() {
    return (
        <>
            <div
                style={{
                    position: "absolute",
                    top: -120,
                    right: -60,
                    width: 540,
                    height: 540,
                    borderRadius: "50%",
                    background:
                        "radial-gradient(circle, #1652F0, transparent 70%)",
                    opacity: 0.55,
                    filter: "blur(8px)",
                }}
            />
            <div
                style={{
                    position: "absolute",
                    bottom: -220,
                    left: -100,
                    width: 480,
                    height: 480,
                    borderRadius: "50%",
                    background:
                        "radial-gradient(circle, #6A3FF0, transparent 70%)",
                    opacity: 0.45,
                    filter: "blur(8px)",
                }}
            />
        </>
    );
}

// ───────────────────── Hero ─────────────────────
function Hero() {
    const ev = webEvents();
    const isMobile = useIsMobile();
    return (
        <section
            style={{
                background: SB.ink950,
                color: "white",
                position: "relative",
                overflow: "hidden",
            }}
        >
            <DarkGlows />
            <Container
                style={{
                    padding: isMobile ? "40px 20px 48px" : "84px 32px 92px",
                    display: "grid",
                    gridTemplateColumns: isMobile ? "1fr" : "1.1fr 1fr",
                    gap: isMobile ? 36 : 56,
                    alignItems: "center",
                    position: "relative",
                    zIndex: 1,
                }}
            >
                <div>
                    <div
                        style={{
                            display: "inline-flex",
                            alignItems: "center",
                            gap: 8,
                            background: "rgba(198,247,60,0.12)",
                            color: SB.lime,
                            padding: "6px 12px",
                            borderRadius: 999,
                            fontFamily: FD,
                            fontWeight: 700,
                            fontSize: 11,
                            letterSpacing: ".08em",
                            textTransform: "uppercase",
                        }}
                    >
                        <span
                            style={{
                                width: 7,
                                height: 7,
                                borderRadius: "50%",
                                background: SB.lime,
                                animation: "sb-pulse 1.4s ease-in-out infinite",
                            }}
                        />
                        {tr(
                            "Real games, real people, near you",
                            "Valódi meccsek, valódi emberek a közeledben",
                        )}
                    </div>
                    <h1
                        style={{
                            fontFamily: FD,
                            fontWeight: 900,
                            fontSize: isMobile ? 38 : 70,
                            lineHeight: isMobile ? "40px" : "72px",
                            letterSpacing: "-0.03em",
                            margin: "20px 0 16px",
                            color: "#FFFFFF",
                        }}
                    >
                        {tr("Get out there.", "Mozduljunk ki.")}
                        <br />
                        <span style={{ color: SB.lime }}>
                            {tr("Together.", "Együtt.")}
                        </span>
                    </h1>
                    <p
                        style={{
                            fontFamily: FB,
                            fontWeight: 500,
                            fontSize: isMobile ? 16 : 20,
                            lineHeight: isMobile ? "24px" : "30px",
                            color: "rgba(255,255,255,0.82)",
                            maxWidth: 480,
                            margin: 0,
                        }}
                    >
                        {tr(
                            "Sportistry is the easy way to find pickup games, start crews, and actually show up. No flakes. No spreadsheets. Just play.",
                            "A Sportistry a legegyszerűbb módja, hogy spontán meccseket találj, csapatot szervezz, és tényleg ott is legyél. Nincs lemorzsolódás. Nincs táblázatkezelés. Csak a játék.",
                        )}
                    </p>
                    <div
                        style={{
                            display: "flex",
                            gap: 12,
                            marginTop: 32,
                            flexWrap: "wrap",
                        }}
                    >
                        <WButton
                            variant="accent"
                            size="lg"
                            icon="download"
                            href="/download"
                        >
                            {tr("Get the app", "Töltsd le az appot")}
                        </WButton>
                        <WButton
                            variant="onDark"
                            size="lg"
                            iconRight="arrow"
                            href="/discover"
                        >
                            {tr("Find a game", "Keress meccset")}
                        </WButton>
                    </div>
                    <div
                        style={{
                            display: "flex",
                            alignItems: "center",
                            gap: 14,
                            marginTop: 28,
                        }}
                    >
                        <WAvatarStack
                            people={[
                                { name: "A B", tint: "#1652F0" },
                                { name: "C D", tint: "#E27A2B" },
                                { name: "E F", tint: "#6A3FF0" },
                                { name: "G H", tint: "#0DB1C9" },
                            ]}
                            size={32}
                            extra={0}
                        />
                        <span
                            style={{
                                fontFamily: FB,
                                fontWeight: 500,
                                fontSize: 13,
                                color: "rgba(255,255,255,0.7)",
                            }}
                        >
                            {tr("Built for players who ", "Azoknak, akik ")}
                            <strong style={{ color: "white" }}>
                                {tr("actually show up", "tényleg megjelennek")}
                            </strong>
                            {tr(".", ".")}
                        </span>
                    </div>
                </div>
                {isMobile ? (
                    <div
                        style={{
                            display: "flex",
                            flexDirection: "column",
                            gap: 14,
                        }}
                    >
                        <WEventCard event={ev[1]} compact />
                        <WEventCard event={ev[0]} compact />
                    </div>
                ) : (
                    <div
                        style={{
                            position: "relative",
                            height: 490,
                            pointerEvents: "none",
                        }}
                    >
                        <div
                            style={{
                                position: "absolute",
                                top: 14,
                                right: 20,
                                width: 340,
                                transform: "rotate(-4deg)",
                            }}
                        >
                            <WEventCard event={ev[1]} compact />
                        </div>
                        <div
                            style={{
                                position: "absolute",
                                top: 122,
                                left: 0,
                                width: 380,
                                transform: "rotate(3deg)",
                                zIndex: 1,
                            }}
                        >
                            <WEventCard event={ev[0]} />
                        </div>
                        <div
                            style={{
                                position: "absolute",
                                bottom: -6,
                                right: 0,
                                width: 380,
                                transform: "rotate(-1deg)",
                            }}
                        >
                            <WEventCard event={ev[2]} compact />
                        </div>
                    </div>
                )}
            </Container>
        </section>
    );
}

// ───────────────────── Trust / stats strip ─────────────────────
function TrustStrip() {
    const isMobile = useIsMobile();
    const stats = [
        [
            `${Object.keys(WEB_SPORTS).length}+`,
            tr("sports & counting", "sportág, és egyre több"),
        ],
        [
            tr("One tap", "Egy kattintás"),
            tr("to join a game", "a csatlakozáshoz"),
        ],
        [tr("Free", "Ingyenes"), tr("to find & play", "keresni és játszani")],
        [
            tr("Waitlists", "Várólisták"),
            tr("keep games full", "tartják tele a meccset"),
        ],
    ];
    return (
        <div
            style={{
                background: SB.ink900,
                color: "white",
                borderTop: "1px solid rgba(255,255,255,0.06)",
            }}
        >
            <Container
                style={{
                    padding: isMobile ? "22px 20px" : "26px 32px",
                    display: "grid",
                    gridTemplateColumns: isMobile
                        ? "repeat(2, 1fr)"
                        : "repeat(4, 1fr)",
                    gap: isMobile ? 20 : 24,
                }}
            >
                {stats.map(([n, l]) => (
                    <div
                        key={l}
                        style={{
                            display: "flex",
                            flexDirection: "column",
                            gap: 2,
                            borderLeft: "2px solid rgba(198,247,60,0.5)",
                            paddingLeft: 16,
                        }}
                    >
                        <span
                            style={{
                                fontFamily: FD,
                                fontWeight: 900,
                                fontSize: 30,
                                letterSpacing: "-0.02em",
                                fontVariantNumeric: "tabular-nums",
                            }}
                        >
                            {n}
                        </span>
                        <span
                            style={{
                                fontFamily: FB,
                                fontWeight: 500,
                                fontSize: 13,
                                color: "rgba(255,255,255,0.65)",
                            }}
                        >
                            {l}
                        </span>
                    </div>
                ))}
            </Container>
        </div>
    );
}

// ───────────────────── How it works ─────────────────────
function HowItWorks() {
    const isMobile = useIsMobile();
    const steps = [
        {
            n: "01",
            icon: "search",
            tint: SB.blue,
            sport: "soccer",
            img: IMG.soccer,
            title: tr("Find a game", "Találj meccset"),
            desc: tr(
                "Browse pickup games, classes and runs near you. Filter by sport, level and free spots.",
                "Böngéssz spontán meccsek, edzések vagy lokációk között a közeledben. Szűrj sportág, szint és szabad helyek szerint.",
            ),
            label: "browsing the feed",
        },
        {
            n: "02",
            icon: "bolt",
            tint: SB.lime,
            sport: "running",
            img: IMG.lacing,
            dark: true,
            title: tr("Tap I'm in", "Kattints a Benne vagyokra"),
            desc: tr(
                "One tap locks your spot. Smart reminders and a waitlist keep the game full and on time.",
                "Egy kattintás lefoglalja a helyed. Okos emlékeztetők és várólista tartják tele és időben a meccset.",
            ),
            label: "tap to join",
        },
        {
            n: "03",
            icon: "trophy",
            tint: "#6A3FF0",
            sport: "basket",
            img: IMG.golden,
            title: tr("Show up & play", "Jelenj meg és játssz"),
            desc: tr(
                "Meet your crew at the spot. Log the result, keep your streak, do it all again next week.",
                "Találkozz a csapatoddal a helyszínen. Rögzítsd az eredményt, tartsd a sorozatod.",
            ),
            label: "golden-hour game",
        },
    ];
    return (
        <Section bg={SB.ink50}>
            <Container>
                <div style={{ textAlign: "center", marginBottom: 52 }}>
                    <Eyebrow>{tr("How it works", "Hogyan működik")}</Eyebrow>
                    <h2
                        style={{
                            fontFamily: FD,
                            fontWeight: 800,
                            fontSize: isMobile ? 28 : 44,
                            lineHeight: isMobile ? "34px" : "50px",
                            letterSpacing: "-0.02em",
                            color: SB.ink900,
                            margin: "10px 0 0",
                        }}
                    >
                        {tr(
                            "Three taps from couch to court.",
                            "Három kattintás a kanapétól a pályáig.",
                        )}
                    </h2>
                </div>
                <div
                    style={{
                        display: "grid",
                        gridTemplateColumns: isMobile
                            ? "1fr"
                            : "repeat(3, 1fr)",
                        gap: 24,
                    }}
                >
                    {steps.map((s) => (
                        <div
                            key={s.n}
                            style={{
                                background: "white",
                                borderRadius: 20,
                                overflow: "hidden",
                                boxShadow: "0 2px 4px rgba(18,23,38,0.06)",
                            }}
                        >
                            <PhotoSlot
                                label={s.label}
                                src={s.img}
                                sport={s.sport}
                                height={172}
                                radius={0}
                                tint={shadeWeb(s.tint, -0.1)}
                                glow={s.tint}
                            />
                            <div style={{ padding: 24 }}>
                                <div
                                    style={{
                                        display: "flex",
                                        alignItems: "center",
                                        gap: 12,
                                        marginBottom: 12,
                                    }}
                                >
                                    <div
                                        style={{
                                            width: 42,
                                            height: 42,
                                            borderRadius: 12,
                                            background: s.tint,
                                            display: "flex",
                                            alignItems: "center",
                                            justifyContent: "center",
                                        }}
                                    >
                                        <WIcon
                                            name={s.icon}
                                            size={22}
                                            color={s.dark ? SB.ink900 : "white"}
                                        />
                                    </div>
                                    <span
                                        style={{
                                            fontFamily: FM,
                                            fontSize: 13,
                                            color: SB.ink400,
                                            fontWeight: 500,
                                        }}
                                    >
                                        {s.n}
                                    </span>
                                </div>
                                <div
                                    style={{
                                        fontFamily: FD,
                                        fontWeight: 800,
                                        fontSize: 22,
                                        letterSpacing: "-0.01em",
                                        color: SB.ink900,
                                    }}
                                >
                                    {s.title}
                                </div>
                                <p
                                    style={{
                                        fontFamily: FB,
                                        fontWeight: 500,
                                        fontSize: 14,
                                        lineHeight: "22px",
                                        color: SB.ink600,
                                        margin: "8px 0 0",
                                    }}
                                >
                                    {s.desc}
                                </p>
                            </div>
                        </div>
                    ))}
                </div>
            </Container>
        </Section>
    );
}

// ───────────────────── Value props ─────────────────────
function ValueProps() {
    const isMobile = useIsMobile();
    const items = [
        {
            icon: "bolt",
            tint: SB.lime,
            dark: true,
            title: tr("One tap to join", "Egy kattintás a csatlakozáshoz"),
            desc: tr(
                "Browse pickup games near you. Hit \"I'm in\". Show up. That's it.",
                "Böngéssz meccseket a közeledben. Kattints a „Benne vagyok”-ra. Jelenj meg. Ennyi.",
            ),
        },
        {
            icon: "repeat",
            tint: SB.blue,
            title: tr(
                "Crews that don't flake",
                "Csapatok, amelyek nem morzsolódnak le",
            ),
            desc: tr(
                "Recurring groups with smart reminders and replacement waitlists.",
                "Visszatérő csoportok okos emlékeztetőkkel és pótló várólistával.",
            ),
        },
        {
            icon: "shield",
            tint: "#6A3FF0",
            title: tr("Safer pickups", "Biztonságosabb meccsek"),
            desc: tr(
                "Verified profiles, skill-level filtering, no-show tracking. Real people.",
                "Ellenőrzött profilok, szint szerinti szűrés, lemorzsolódás-követés. Valódi emberek.",
            ),
        },
        {
            icon: "trophy",
            tint: "#E27A2B",
            title: tr("Track your year", "Kövesd az éved"),
            desc: tr(
                "Streaks, results, achievements. Watch the games stack up.",
                "Sorozatok, eredmények, kitűzők. Nézd, ahogy gyűlnek a meccsek.",
            ),
        },
    ];
    return (
        <Section bg="white">
            <Container>
                <div style={{ textAlign: "center", marginBottom: 52 }}>
                    <Eyebrow>
                        {tr("Why Sportistry", "Miért a Sportistry")}
                    </Eyebrow>
                    <h2
                        style={{
                            fontFamily: FD,
                            fontWeight: 800,
                            fontSize: isMobile ? 28 : 44,
                            lineHeight: isMobile ? "34px" : "50px",
                            letterSpacing: "-0.02em",
                            color: SB.ink900,
                            margin: "10px 0 0",
                        }}
                    >
                        {tr(
                            "Built for the people who actually play.",
                            "Azoknak, akik tényleg játszanak.",
                        )}
                    </h2>
                </div>
                <div
                    style={{
                        display: "grid",
                        gridTemplateColumns: isMobile
                            ? "1fr 1fr"
                            : "repeat(4, 1fr)",
                        gap: isMobile ? 14 : 20,
                    }}
                >
                    {items.map((it) => (
                        <div
                            key={it.title}
                            style={{
                                background: "white",
                                borderRadius: 18,
                                padding: 28,
                                boxShadow:
                                    "0 2px 4px rgba(18,23,38,0.06), 0 1px 2px rgba(18,23,38,0.04)",
                            }}
                        >
                            <div
                                style={{
                                    width: 52,
                                    height: 52,
                                    borderRadius: 14,
                                    background: it.tint,
                                    display: "flex",
                                    alignItems: "center",
                                    justifyContent: "center",
                                    marginBottom: 16,
                                }}
                            >
                                <WIcon
                                    name={it.icon}
                                    size={26}
                                    color={it.dark ? SB.ink900 : "white"}
                                />
                            </div>
                            <div
                                style={{
                                    fontFamily: FD,
                                    fontWeight: 800,
                                    fontSize: 18,
                                    letterSpacing: "-0.01em",
                                    color: SB.ink900,
                                }}
                            >
                                {it.title}
                            </div>
                            <p
                                style={{
                                    fontFamily: FB,
                                    fontWeight: 500,
                                    fontSize: 14,
                                    lineHeight: "22px",
                                    color: SB.ink600,
                                    margin: "8px 0 0",
                                }}
                            >
                                {it.desc}
                            </p>
                        </div>
                    ))}
                </div>
            </Container>
        </Section>
    );
}

// ───────────────────── Sports grid ─────────────────────
// FALLBACK ONLY — the live numbers come from the API (see useSportCounts).
// These were the real counts on 2026-07-28; they exist so a failed or slow
// fetch renders plausible tiles instead of a grid of zeros. They will drift,
// and that is fine: nothing reads them once the fetch resolves.
//
// The previous version of this map was hand-written marketing numbers that had
// never matched the database (it claimed 16 hiking events against 1 real one).
const SPORT_COUNTS_FALLBACK = {
    soccer: 31,
    yoga: 17,
    tennis: 17,
    running: 16,
    basket: 14,
    cycling: 14,
    padel: 13,
    climbing: 12,
    volley: 11,
    swimming: 9,
    fitness: 7,
    beerpong: 2,
    hiking: 1,
    badminton: 1,
    bouldering: 1,
    handball: 1,
    golf: 1,
    hockey: 1,
    boxing: 1,
    martialarts: 1,
};

// Real per-sport event counts from GET /api/public-stats/sport-counts.
// Unauthenticated and server-cached (5 min), so this is a cheap single call.
// Counts are all-time and exclude our seed events — see the route for why.
function useSportCounts() {
    const [counts, setCounts] = React.useState(SPORT_COUNTS_FALLBACK);
    React.useEffect(() => {
        // SITE_API_BASE comes from components.jsx, which index.html loads
        // before this file — see the script order there before moving it.
        if (typeof SITE_API_BASE !== "string") return;
        let alive = true;
        fetch(SITE_API_BASE + "/public-stats/sport-counts")
            .then((r) => (r.ok ? r.json() : null))
            .then((d) => {
                if (alive && d && d.counts) setCounts(d.counts);
            })
            .catch(() => {}); // keep the fallback — a dead API is not a blank grid
        return () => {
            alive = false;
        };
    }, []);
    return counts;
}

// Grid shows the busiest sports as full photo tiles; the rest collapse into
// a "more sports" chip row so the section stays a fixed height as the sport
// list keeps growing.
const FEATURED_SPORT_COUNT = 12;
function SportsGrid() {
    const isMobile = useIsMobile();
    const [showAll, setShowAll] = React.useState(false);
    const counts = useSportCounts();
    const byCount = ([a], [b]) => (counts[b] || 0) - (counts[a] || 0);
    // Only a sport with a photo may be featured. A featured tile whose key is
    // missing from SPORT_IMG renders as a bare gradient — that was the bug
    // fixed on 2026-07-28, and ordering by real counts would reintroduce it
    // (beerpong outranks hiking and badminton but has no photo).
    const all = Object.entries(WEB_SPORTS);
    const withPhoto = all.filter(([k]) => SPORT_IMG[k]).sort(byCount);
    const withoutPhoto = all.filter(([k]) => !SPORT_IMG[k]).sort(byCount);
    const featured = withPhoto.slice(0, FEATURED_SPORT_COUNT);
    const rest = [...withPhoto.slice(FEATURED_SPORT_COUNT), ...withoutPhoto];
    return (
        <Section bg={SB.ink50}>
            <Container>
                <div
                    style={{
                        display: "flex",
                        justifyContent: "space-between",
                        alignItems: "flex-end",
                        marginBottom: 32,
                        flexWrap: "wrap",
                        gap: 16,
                    }}
                >
                    <div>
                        <Eyebrow>
                            {tr("What we cover", "Amit lefedünk")}
                        </Eyebrow>
                        <h2
                            style={{
                                fontFamily: FD,
                                fontWeight: 800,
                                fontSize: isMobile ? 26 : 40,
                                lineHeight: isMobile ? "32px" : "46px",
                                letterSpacing: "-0.02em",
                                color: SB.ink900,
                                margin: "8px 0 0",
                            }}
                        >
                            {tr(
                                `${all.length}+ sports. More on the way.`,
                                `${all.length}+ sportág. És egyre több.`,
                            )}
                        </h2>
                    </div>
                    <WButton
                        variant="outline"
                        iconRight="arrow"
                        href="/discover"
                    >
                        {tr("Browse all games", "Összes meccs")}
                    </WButton>
                </div>
                <div
                    style={{
                        display: "grid",
                        gridTemplateColumns: isMobile
                            ? "1fr 1fr"
                            : "repeat(4, 1fr)",
                        gap: isMobile ? 12 : 16,
                    }}
                >
                    {featured.map(([k, s]) => (
                        <a
                            key={k}
                            href="/discover"
                            style={{
                                aspectRatio: "4/3",
                                borderRadius: 18,
                                padding: 20,
                                color: "white",
                                textDecoration: "none",
                                background: `radial-gradient(circle at 30% 20%, ${s.tint}, ${shadeWeb(s.tint, -0.45)})`,
                                display: "flex",
                                flexDirection: "column",
                                justifyContent: "space-between",
                                position: "relative",
                                overflow: "hidden",
                                cursor: "pointer",
                                transition: "transform 160ms ease",
                            }}
                            onMouseEnter={(e) =>
                                (e.currentTarget.style.transform =
                                    "translateY(-3px)")
                            }
                            onMouseLeave={(e) =>
                                (e.currentTarget.style.transform =
                                    "translateY(0)")
                            }
                        >
                            <PhotoTexture />
                            <div
                                style={{
                                    position: "absolute",
                                    right: -12,
                                    bottom: -12,
                                    opacity: 0.16,
                                    transform: "rotate(-8deg)",
                                    lineHeight: 0,
                                    zIndex: 1,
                                }}
                            >
                                <SportGlyph sport={k} size={130} color="#fff" />
                            </div>
                            {SPORT_IMG[k] && (
                                <img
                                    src={uimg(SPORT_IMG[k], 600, 65)}
                                    alt={sportLabel(k)}
                                    loading="lazy"
                                    style={{
                                        position: "absolute",
                                        inset: 0,
                                        width: "100%",
                                        height: "100%",
                                        objectFit: "cover",
                                    }}
                                />
                            )}
                            <div
                                style={{
                                    position: "absolute",
                                    inset: 0,
                                    background:
                                        "linear-gradient(to top, rgba(10,14,28,0.66), rgba(10,14,28,0.12) 60%)",
                                }}
                            />
                            <div
                                style={{
                                    position: "relative",
                                    display: "flex",
                                    justifyContent: "flex-start",
                                }}
                            >
                                {/* No pill at all rather than "0 esemény" —
                                    a sport can be photo-backed but empty. */}
                                {(counts[k] || 0) > 0 && (
                                    <span
                                        style={{
                                            fontFamily: FD,
                                            fontWeight: 700,
                                            fontSize: 11,
                                            letterSpacing: ".08em",
                                            textTransform: "uppercase",
                                            background: "rgba(255,255,255,0.18)",
                                            padding: "4px 9px",
                                            borderRadius: 999,
                                        }}
                                    >
                                        {counts[k]} {tr("events", "esemény")}
                                    </span>
                                )}
                            </div>
                            <div
                                style={{
                                    position: "relative",
                                    fontFamily: FD,
                                    fontWeight: 800,
                                    fontSize: 26,
                                    letterSpacing: "-0.01em",
                                }}
                            >
                                {sportLabel(k)}
                            </div>
                        </a>
                    ))}
                </div>
                {rest.length > 0 && (
                    <div style={{ marginTop: 20 }}>
                        <button
                            onClick={() => setShowAll((v) => !v)}
                            style={{
                                display: "inline-flex",
                                alignItems: "center",
                                gap: 6,
                                background: "none",
                                border: "none",
                                cursor: "pointer",
                                padding: 0,
                                fontFamily: FB,
                                fontWeight: 600,
                                fontSize: 14,
                                color: SB.blue,
                            }}
                        >
                            {showAll
                                ? tr("Show fewer sports", "Kevesebb sportág")
                                : tr(
                                      `+${rest.length} more sports`,
                                      `+${rest.length} további sportág`,
                                  )}
                            <span
                                style={{
                                    display: "inline-flex",
                                    transform: showAll
                                        ? "rotate(180deg)"
                                        : "none",
                                    transition: "transform 160ms ease",
                                }}
                            >
                                <WIcon
                                    name="chevronDown"
                                    size={16}
                                    color={SB.blue}
                                    strokeWidth={2.5}
                                />
                            </span>
                        </button>
                        {showAll && (
                            <div
                                style={{
                                    display: "flex",
                                    flexWrap: "wrap",
                                    gap: 10,
                                    marginTop: 16,
                                }}
                            >
                                {rest.map(([k, s]) => (
                                    <WChip
                                        key={k}
                                        color={s.tint}
                                        onClick={() =>
                                            (window.location.href =
                                                "/discover")
                                        }
                                    >
                                        {sportLabel(k)}
                                    </WChip>
                                ))}
                            </div>
                        )}
                    </div>
                )}
            </Container>
        </Section>
    );
}

// ───────────────────── Testimonials ─────────────────────
function testimonials() {
    return [
        {
            quote: tr(
                "We used to flake on our football WhatsApp every other week. Moved the crew to Sportistry and we’ve shown up 9 weeks in a row.",
                "Régen kéthetente lemondtuk a focit a WhatsApp-csoportban. Átköltöztettük a csapatot a Sportistry-re, és már 9 hete egyfolytában megjelenünk.",
            ),
            name: "Marco Powell",
            role: tr(
                "Captain · Bermondsey FC",
                "Csapatkapitány · Bermondsey FC",
            ),
            tint: "#1652F0",
            highlight: tr("9 weeks in a row", "9 hete egyfolytában"),
        },
        {
            quote: tr(
                "I moved cities and knew nobody. Three pickup games later I had a regular run crew and a Tuesday padel game.",
                "Új városba költöztem, és senkit sem ismertem. Három meccs után már volt egy állandó futócsapatom és egy keddi padelpartim.",
            ),
            name: "Ana Reyes",
            role: tr("Runner · Hyde Park", "Futó · Hyde Park"),
            tint: "#6A3FF0",
            highlight: tr("a regular run crew", "egy állandó futócsapatom"),
        },
        {
            quote: tr(
                "As a coach, filling a class used to be endless texts. Now it’s one post and a waitlist that fills itself.",
                "Edzőként egy óra feltöltése végtelen üzengetés volt. Most egyetlen poszt, és a várólista magától megtelik.",
            ),
            name: "Dale Okoro",
            role: tr("Coach · Camden Hoops", "Edző · Camden Hoops"),
            tint: "#E27A2B",
            highlight: tr(
                "a waitlist that fills itself",
                "a várólista magától megtelik",
            ),
        },
    ];
}
function Testimonials() {
    const isMobile = useIsMobile();
    return (
        <Section bg="white">
            <Container>
                <div style={{ textAlign: "center", marginBottom: 48 }}>
                    <Eyebrow>
                        {tr(
                            "Real crews, real streaks",
                            "Valódi csapatok, valódi sorozatok",
                        )}
                    </Eyebrow>
                    <h2
                        style={{
                            fontFamily: FD,
                            fontWeight: 800,
                            fontSize: isMobile ? 28 : 44,
                            lineHeight: isMobile ? "34px" : "50px",
                            letterSpacing: "-0.02em",
                            color: SB.ink900,
                            margin: "10px 0 0",
                        }}
                    >
                        {tr(
                            "People keep showing up.",
                            "Az emberek újra meg újra megjelennek.",
                        )}
                    </h2>
                </div>
                <div
                    style={{
                        display: "grid",
                        gridTemplateColumns: isMobile
                            ? "1fr"
                            : "repeat(3, 1fr)",
                        gap: 20,
                    }}
                >
                    {testimonials().map((t) => (
                        <div
                            key={t.name}
                            style={{
                                background: SB.ink50,
                                borderRadius: 20,
                                padding: 28,
                                display: "flex",
                                flexDirection: "column",
                            }}
                        >
                            <div
                                style={{
                                    display: "flex",
                                    gap: 2,
                                    marginBottom: 14,
                                }}
                            >
                                {[...Array(5)].map((_, i) => (
                                    <WIcon
                                        key={i}
                                        name="star"
                                        size={16}
                                        color={SB.lime}
                                    />
                                ))}
                            </div>
                            <p
                                style={{
                                    fontFamily: FD,
                                    fontWeight: 700,
                                    fontSize: 19,
                                    lineHeight: "27px",
                                    letterSpacing: "-0.01em",
                                    color: SB.ink900,
                                    margin: 0,
                                    flex: 1,
                                }}
                            >
                                {t.quote.split(t.highlight)[0]}
                                <span
                                    style={{
                                        background: "rgba(198,247,60,0.45)",
                                        padding: "0 2px",
                                        borderRadius: 3,
                                    }}
                                >
                                    {t.highlight}
                                </span>
                                {t.quote.split(t.highlight)[1]}
                            </p>
                            <div
                                style={{
                                    display: "flex",
                                    alignItems: "center",
                                    gap: 12,
                                    marginTop: 22,
                                }}
                            >
                                <WAvatar
                                    name={t.name}
                                    tint={t.tint}
                                    size={42}
                                />
                                <div>
                                    <div
                                        style={{
                                            fontFamily: FD,
                                            fontWeight: 800,
                                            fontSize: 15,
                                            color: SB.ink900,
                                        }}
                                    >
                                        {t.name}
                                    </div>
                                    <div
                                        style={{
                                            fontFamily: FB,
                                            fontWeight: 500,
                                            fontSize: 13,
                                            color: SB.ink500,
                                        }}
                                    >
                                        {t.role}
                                    </div>
                                </div>
                            </div>
                        </div>
                    ))}
                </div>
                <p
                    style={{
                        textAlign: "center",
                        fontFamily: FB,
                        fontWeight: 500,
                        fontSize: 12,
                        color: SB.ink400,
                        marginTop: 28,
                    }}
                >
                    {tr(
                        "Illustrative examples of how crews use Sportistry.",
                        "Szemléltető példák arra, hogyan használják a csapatok a Sportistryt.",
                    )}
                </p>
            </Container>
        </Section>
    );
}

// ───────────────────── App download band ─────────────────────
function AppDownloadBand() {
    const isMobile = useIsMobile();
    return (
        <Section bg={SB.ink50} pad="60px 0">
            <Container>
                <div
                    style={{
                        background: SB.ink950,
                        borderRadius: 28,
                        padding: isMobile ? "40px 24px 0" : "56px 56px 0",
                        color: "white",
                        position: "relative",
                        overflow: "hidden",
                        display: "grid",
                        gridTemplateColumns: isMobile ? "1fr" : "1.1fr 0.9fr",
                        gap: isMobile ? 28 : 40,
                        alignItems: "end",
                    }}
                >
                    <div
                        style={{
                            position: "absolute",
                            top: -80,
                            right: -40,
                            width: 360,
                            height: 360,
                            borderRadius: "50%",
                            background:
                                "radial-gradient(circle, #1652F0, transparent 70%)",
                            opacity: 0.6,
                        }}
                    />
                    <div
                        style={{
                            position: "relative",
                            paddingBottom: isMobile ? 32 : 56,
                        }}
                    >
                        <Eyebrow color={SB.lime}>
                            {tr("Play now", "Játssz most")}
                        </Eyebrow>
                        <h2
                            style={{
                                fontFamily: FD,
                                fontWeight: 900,
                                fontSize: isMobile ? 28 : 46,
                                lineHeight: isMobile ? "34px" : "50px",
                                letterSpacing: "-0.02em",
                                margin: "12px 0 14px",
                                color: "#FFFFFF",
                            }}
                        >
                            {tr(
                                "Your next game is one tap away.",
                                "A következő meccsed egy kattintásnyira van.",
                            )}
                        </h2>
                        <p
                            style={{
                                fontFamily: FB,
                                fontWeight: 500,
                                fontSize: 17,
                                lineHeight: "26px",
                                color: "rgba(255,255,255,0.78)",
                                maxWidth: 440,
                                margin: "0 0 26px",
                            }}
                        >
                            {tr(
                                "Find games, RSVP in a tap, and get nudged before kickoff — free, right in your browser. The iOS and Android apps are on the way.",
                                "Találj meccseket, jelezz vissza egy kattintással, és kapj emlékeztetőt kezdés előtt – ingyen, egyenesen a böngésződben. Az iOS és Android alkalmazások hamarosan érkeznek.",
                            )}
                        </p>
                        {!isMobile && (
                            <WButton variant="accent" size="lg" href="/app/">
                                {tr("Try the web app", "Kipróbálom a webappot")}
                            </WButton>
                        )}
                        <div style={{ marginTop: isMobile ? 0 : 18 }}>
                            <StoreBadges size="lg" />
                        </div>
                    </div>
                    <div
                        style={{
                            position: "relative",
                            display: "flex",
                            justifyContent: "center",
                            alignItems: "flex-end",
                        }}
                    >
                        <PhoneMock height={isMobile ? 300 : 380} />
                    </div>
                </div>
            </Container>
        </Section>
    );
}

// Simple phone mockup with a labelled screen slot
function PhoneMock({ height = 380 }) {
    const w = height * 0.49;
    return (
        <div
            style={{
                width: w,
                height,
                background: "#05080F",
                borderRadius: 34,
                padding: 8,
                boxShadow:
                    "0 30px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.08)",
                position: "relative",
            }}
        >
            <div
                style={{
                    position: "absolute",
                    top: 16,
                    left: "50%",
                    transform: "translateX(-50%)",
                    width: 64,
                    height: 5,
                    borderRadius: 3,
                    background: "rgba(255,255,255,0.25)",
                    zIndex: 2,
                }}
            />
            <PhotoSlot
                label="app screen · feed"
                src={IMG.soccer}
                imgPosition="75% 50%"
                sport="soccer"
                radius={28}
                tint={SB.blue700}
                glow={SB.blue}
                style={{ height: "100%" }}
            >
                <div
                    style={{
                        position: "absolute",
                        inset: 0,
                        display: "flex",
                        flexDirection: "column",
                        justifyContent: "flex-end",
                        padding: 16,
                        gap: 10,
                    }}
                >
                    <div
                        style={{
                            background: "rgba(255,255,255,0.95)",
                            borderRadius: 14,
                            padding: 12,
                        }}
                    >
                        <div
                            style={{
                                fontFamily: FD,
                                fontWeight: 800,
                                fontSize: 14,
                                color: SB.ink900,
                            }}
                        >
                            {tr("Sunday 5-a-side", "Vasárnapi kispályás")}
                        </div>
                        <div
                            style={{
                                fontFamily: FB,
                                fontSize: 11,
                                color: SB.ink500,
                                margin: "2px 0 8px",
                            }}
                        >
                            {tr("Sun · 3:00 PM · 0.6 mi", "V · 15:00 · 0,9 km")}
                        </div>
                        <div
                            style={{
                                background: SB.blue,
                                color: "white",
                                borderRadius: 999,
                                textAlign: "center",
                                padding: "7px 0",
                                fontFamily: FB,
                                fontWeight: 700,
                                fontSize: 12,
                            }}
                        >
                            {tr("I'm in", "Benne vagyok")}
                        </div>
                    </div>
                </div>
            </PhotoSlot>
        </div>
    );
}

// ───────────────────── FAQ ─────────────────────
function faqItems() {
    return [
        {
            q: tr("Is Sportistry free?", "Ingyenes a Sportistry?"),
            a: tr(
                "Yes — the app is completely free. Downloading it, finding games and joining them costs nothing.",
                "Igen – az app teljesen ingyenes. A letöltése, a meccskeresés és a csatlakozás semmibe sem kerül.",
            ),
        },
        {
            q: tr(
                "What if people don’t show up?",
                "Mi van, ha valaki nem jelenik meg?",
            ),
            a: tr(
                "Every game tracks no-shows and runs a replacement waitlist, so a dropped spot gets filled automatically. Repeat no-shows lose their reliability rating.",
                "Minden meccs követi a meg nem jelenéseket és pótló várólistát működtet, így a felszabaduló hely automatikusan betöltődik. Az ismételt távolmaradás rontja a megbízhatósági pontszámot.",
            ),
        },
        {
            q: tr(
                "Do I need to be good at the sport?",
                "Jónak kell lennem az adott sportban?",
            ),
            a: tr(
                'No. Every game lists a skill level — from "first timers welcome" to "competitive" — so you always know what you’re walking into.',
                "Nem. Minden meccsnél fel van tüntetve a szint – a „kezdők is jöhetnek”-től a „versenyszintig” –, így mindig tudod, mire számíthatsz.",
            ),
        },
        {
            q: tr(
                "Which sports and cities are live?",
                "Mely sportágak és városok érhetők el?",
            ),
            a: tr(
                "Eight sports today (soccer, basketball, tennis, running, cycling, volleyball, climbing and padel), with more cities and sports added every month.",
                "Jelenleg nyolc sportág (foci, kosárlabda, tenisz, futás, kerékpár, röplabda, mászás és padel), havonta bővülő városokkal és kínálattal.",
            ),
        },
        {
            q: tr(
                "Can I organize my own games or crew?",
                "Szervezhetek saját meccset vagy csapatot?",
            ),
            a: tr(
                "Absolutely. Anyone can post an event in under a minute. Recurring crews, venue management and payments are built in — see For clubs & venues.",
                "Természetesen. Bárki feladhat eseményt egy percen belül. A visszatérő csapatok, a helyszínkezelés és a fizetés is beépítve – lásd a Kluboknak és helyszíneknek oldalt.",
            ),
        },
    ];
}
function FAQ() {
    const [open, setOpen] = React.useState(0);
    const items = faqItems();
    const isMobile = useIsMobile();
    return (
        <Section bg="white">
            <Container width={860}>
                <div style={{ textAlign: "center", marginBottom: 44 }}>
                    <Eyebrow>{tr("Good questions", "Jó kérdések")}</Eyebrow>
                    <h2
                        style={{
                            fontFamily: FD,
                            fontWeight: 800,
                            fontSize: isMobile ? 26 : 40,
                            lineHeight: isMobile ? "32px" : "46px",
                            letterSpacing: "-0.02em",
                            color: SB.ink900,
                            margin: "10px 0 0",
                        }}
                    >
                        {tr(
                            "Everything you might ask.",
                            "Minden, amit kérdezhetsz.",
                        )}
                    </h2>
                </div>
                <div
                    style={{
                        display: "flex",
                        flexDirection: "column",
                        gap: 12,
                    }}
                >
                    {items.map((f, i) => {
                        const isOpen = open === i;
                        return (
                            <div
                                key={i}
                                style={{
                                    background: isOpen ? SB.ink50 : "white",
                                    border: "1px solid " + SB.ink100,
                                    borderRadius: 16,
                                    overflow: "hidden",
                                    transition: "background 160ms",
                                }}
                            >
                                <button
                                    onClick={() => setOpen(isOpen ? -1 : i)}
                                    style={{
                                        width: "100%",
                                        display: "flex",
                                        alignItems: "center",
                                        justifyContent: "space-between",
                                        gap: 16,
                                        padding: "20px 22px",
                                        background: "transparent",
                                        border: "none",
                                        cursor: "pointer",
                                        textAlign: "left",
                                    }}
                                >
                                    <span
                                        style={{
                                            fontFamily: FD,
                                            fontWeight: 700,
                                            fontSize: 18,
                                            letterSpacing: "-0.01em",
                                            color: SB.ink900,
                                        }}
                                    >
                                        {f.q}
                                    </span>
                                    <span
                                        style={{
                                            flexShrink: 0,
                                            width: 30,
                                            height: 30,
                                            borderRadius: 999,
                                            background: isOpen
                                                ? SB.blue
                                                : SB.ink100,
                                            display: "flex",
                                            alignItems: "center",
                                            justifyContent: "center",
                                            transition: "background 160ms",
                                        }}
                                    >
                                        <WIcon
                                            name={isOpen ? "minus" : "plus"}
                                            size={16}
                                            color={isOpen ? "white" : SB.ink700}
                                        />
                                    </span>
                                </button>
                                {isOpen && (
                                    <div
                                        style={{
                                            padding: "0 22px 22px",
                                            fontFamily: FB,
                                            fontWeight: 500,
                                            fontSize: 15,
                                            lineHeight: "24px",
                                            color: SB.ink600,
                                            maxWidth: 680,
                                        }}
                                    >
                                        {f.a}
                                    </div>
                                )}
                            </div>
                        );
                    })}
                </div>
            </Container>
        </Section>
    );
}

// ───────────────────── Final CTA ─────────────────────
function FinalCTA() {
    const isMobile = useIsMobile();
    return (
        <section
            style={{
                background: SB.ink950,
                color: "white",
                position: "relative",
                overflow: "hidden",
            }}
        >
            <DarkGlows />
            <Container
                style={{
                    padding: isMobile ? "56px 20px" : "88px 32px",
                    position: "relative",
                    zIndex: 1,
                    textAlign: "center",
                }}
            >
                <Eyebrow color={SB.lime} style={{ justifyContent: "center" }}>
                    {tr("Ready when you are", "Készen állunk, amikor te is")}
                </Eyebrow>
                <h2
                    style={{
                        fontFamily: FD,
                        fontWeight: 900,
                        fontSize: isMobile ? 32 : 58,
                        lineHeight: isMobile ? "36px" : "60px",
                        letterSpacing: "-0.03em",
                        margin: "14px 0 18px",
                        color: "#FFFFFF",
                    }}
                >
                    {tr("Your next game is", "A következő meccsed")}
                    <br />
                    <span style={{ color: SB.lime }}>
                        {tr("one tap away.", "egy kattintásnyira.")}
                    </span>
                </h2>
                <p
                    style={{
                        fontFamily: FB,
                        fontWeight: 500,
                        fontSize: 18,
                        color: "rgba(255,255,255,0.78)",
                        maxWidth: 460,
                        margin: "0 auto 30px",
                    }}
                >
                    {tr(
                        "Jump into Sportistry and find a game happening near you this week.",
                        "Vágj bele a Sportistrybe, és találj egy meccset a közeledben még a héten.",
                    )}
                </p>
                <div
                    style={{
                        display: "flex",
                        flexDirection: "column",
                        alignItems: "center",
                        gap: 18,
                    }}
                >
                    {!isMobile && (
                        <WButton variant="accent" size="lg" href="/app/">
                            {tr("Try the web app", "Kipróbálom a webappot")}
                        </WButton>
                    )}
                    <StoreBadges size="lg" />
                </div>
            </Container>
        </section>
    );
}

// ───────────────────── Crews & Tournaments ─────────────────────
function TournamentsCrews() {
    const isMobile = useIsMobile();
    const cards = [
        {
            icon: "users",
            tint: SB.blue,
            sport: "soccer",
            img: IMG.soccer,
            title: tr("Crews", "Csapatok"),
            desc: tr(
                "Your regular groups. Create a crew with your friends, invite members by @username or email, chat, and spin up recurring sessions in a tap.",
                "Az állandó csoportjaid. Hozz létre csapatot a barátaiddal, hívj meg tagokat @felhasználónévvel vagy emaillel, csevegj, és indíts visszatérő edzéseket egy kattintással.",
            ),
            points: [
                tr("Invite-only groups", "Meghívásos csoportok"),
                tr("Built-in group chat", "Beépített csoportchat"),
                tr("Recurring games", "Visszatérő meccsek"),
            ],
        },
        {
            icon: "trophy",
            tint: "#6A3FF0",
            sport: "basket",
            img: SPORT_IMG.basket,
            title: tr("Tournaments", "Tornák"),
            desc: tr(
                "Run a proper competition. Add teams and players, generate a knockout bracket, and play through from the quarterfinals to a crowned champion.",
                "Szervezz igazi versenyt. Adj hozzá csapatokat és játékosokat, generálj egyenes kieséses táblát, és játssz végig a negyeddöntőtől a győztesig.",
            ),
            points: [
                tr("Single-elimination brackets", "Egyenes kieséses tábla"),
                tr("Teams & guest players", "Csapatok és vendégjátékosok"),
                tr("Live results & a champion", "Élő eredmények és győztes"),
            ],
        },
    ];
    return (
        <Section bg="white">
            <Container>
                <div style={{ textAlign: "center", marginBottom: 52 }}>
                    <Eyebrow>
                        {tr("More than pickup", "Több mint spontán meccs")}
                    </Eyebrow>
                    <h2
                        style={{
                            fontFamily: FD,
                            fontWeight: 800,
                            fontSize: isMobile ? 28 : 44,
                            lineHeight: isMobile ? "34px" : "50px",
                            letterSpacing: "-0.02em",
                            color: SB.ink900,
                            margin: "10px 0 0",
                        }}
                    >
                        {tr(
                            "Crews to play with. Tournaments to win.",
                            "Csapatok, amikkel játszhatsz. Tornák, amiket megnyerhetsz.",
                        )}
                    </h2>
                </div>
                <div
                    style={{
                        display: "grid",
                        gridTemplateColumns: isMobile
                            ? "1fr"
                            : "repeat(2, 1fr)",
                        gap: 24,
                    }}
                >
                    {cards.map((c) => (
                        <div
                            key={c.title}
                            style={{
                                background: "white",
                                borderRadius: 22,
                                overflow: "hidden",
                                border: "1px solid " + SB.ink100,
                                boxShadow: "0 2px 4px rgba(18,23,38,0.06)",
                            }}
                        >
                            <PhotoSlot
                                label={c.title}
                                src={c.img}
                                sport={c.sport}
                                height={200}
                                radius={0}
                                tint={shadeWeb(c.tint, -0.1)}
                                glow={c.tint}
                            />
                            <div style={{ padding: 28 }}>
                                <div
                                    style={{
                                        display: "flex",
                                        alignItems: "center",
                                        gap: 12,
                                        marginBottom: 12,
                                    }}
                                >
                                    <div
                                        style={{
                                            width: 46,
                                            height: 46,
                                            borderRadius: 13,
                                            background: c.tint,
                                            display: "flex",
                                            alignItems: "center",
                                            justifyContent: "center",
                                        }}
                                    >
                                        <WIcon
                                            name={c.icon}
                                            size={24}
                                            color="white"
                                        />
                                    </div>
                                    <div
                                        style={{
                                            fontFamily: FD,
                                            fontWeight: 800,
                                            fontSize: 26,
                                            letterSpacing: "-0.01em",
                                            color: SB.ink900,
                                        }}
                                    >
                                        {c.title}
                                    </div>
                                </div>
                                <p
                                    style={{
                                        fontFamily: FB,
                                        fontWeight: 500,
                                        fontSize: 15,
                                        lineHeight: "23px",
                                        color: SB.ink600,
                                        margin: "0 0 18px",
                                    }}
                                >
                                    {c.desc}
                                </p>
                                <div
                                    style={{
                                        display: "flex",
                                        flexDirection: "column",
                                        gap: 10,
                                    }}
                                >
                                    {c.points.map((p) => (
                                        <div
                                            key={p}
                                            style={{
                                                display: "flex",
                                                gap: 10,
                                                alignItems: "center",
                                            }}
                                        >
                                            <span
                                                style={{
                                                    flexShrink: 0,
                                                    width: 20,
                                                    height: 20,
                                                    borderRadius: 999,
                                                    background: SB.blue50,
                                                    display: "flex",
                                                    alignItems: "center",
                                                    justifyContent: "center",
                                                }}
                                            >
                                                <WIcon
                                                    name="check"
                                                    size={13}
                                                    color={c.tint}
                                                />
                                            </span>
                                            <span
                                                style={{
                                                    fontFamily: FB,
                                                    fontWeight: 600,
                                                    fontSize: 14,
                                                    color: SB.ink700,
                                                }}
                                            >
                                                {p}
                                            </span>
                                        </div>
                                    ))}
                                </div>
                            </div>
                        </div>
                    ))}
                </div>
            </Container>
        </Section>
    );
}

// ───────────────────── Home page ─────────────────────
function HomePage() {
    return (
        <div>
            <Hero />
            <TrustStrip />
            <HowItWorks />
            <ValueProps />
            <SportsGrid />
            <TournamentsCrews />
            {/* Testimonials hidden until we have real users/quotes — see testimonials() above */}
            <AppDownloadBand />
            <FAQ />
            <FinalCTA />
        </div>
    );
}

Object.assign(window, {
    webEvents,
    navLinks,
    MarketingNav,
    Footer,
    DarkGlows,
    PhoneMock,
    Hero,
    TrustStrip,
    HowItWorks,
    ValueProps,
    SportsGrid,
    SPORT_COUNTS_FALLBACK,
    Testimonials,
    testimonials,
    AppDownloadBand,
    FAQ,
    faqItems,
    FinalCTA,
    HomePage,
});
