:root {
    --wizzy-promo-banner-height: 44px;
    --wizzy-nav-height: 64px;
    --wizzy-fixed-header-offset: calc(var(--wizzy-promo-banner-height) + var(--wizzy-nav-height));
}

/* PHP SEO fallback: keep in DOM for crawlers, do not flash unstyled HTML before React mounts */
body.wizzy-react-page #wizzy-seo-fallback {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    pointer-events: none;
}

html.wizzy-react-ready #wizzy-seo-fallback {
    display: none !important;
}

@media (max-width: 767px) {
    :root {
        /* Fallback until JS measures the wrapped promo banner. */
        --wizzy-promo-banner-height: 92px;
        --wizzy-nav-height: 64px;
    }
}

/*
 * Mobile/tablet homepage hero:
 * - Keep badge/headline clear of fixed promo + header
 * - Fit the demo illustration inside the viewport
 * - No horizontal overflow; floating badges stay fully on-screen
 */
@media (max-width: 1023px) {
    html,
    body.wizzy-react-page {
        overflow-x: hidden;
        max-width: 100%;
    }

    #root,
    #root > div {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Fixed promo + nav: pt-32 / pt-24 are too small on mobile (blog listing, articles, legal, etc.) */
    #root section.pt-32 {
        padding-top: calc(var(--wizzy-fixed-header-offset) + 1.25rem) !important;
    }

    #root main.pt-24,
    #root main.min-h-screen.bg-background.pt-24 {
        padding-top: calc(var(--wizzy-fixed-header-offset) + 1rem) !important;
    }

    #root section.relative.pt-32 {
        overflow-x: hidden !important;
        overflow-y: visible !important;
        max-width: 100%;
    }

    #root section.relative.pt-32 > .wizzy-container {
        max-width: 100%;
        overflow-x: hidden;
    }

    #root section.relative.pt-32 .min-h-\[560px\] {
        min-height: 0 !important;
        gap: 1.75rem !important;
        align-items: start !important;
        max-width: 100%;
        overflow-x: hidden;
    }

    #root section.relative.pt-32 .min-h-\[560px\] > div:first-child {
        max-width: 100%;
        min-width: 0;
    }

    #root section.relative.pt-32 .min-h-\[560px\] > div:first-child h1 {
        font-size: clamp(1.75rem, 7vw, 2.25rem) !important;
        margin-bottom: 1.25rem !important;
    }

    #root section.relative.pt-32 .min-h-\[560px\] > div:first-child p {
        margin-bottom: 1.5rem !important;
    }

    /* Demo column: keep illustration inside screen width */
    #root section.relative.pt-32 .min-h-\[560px\] > div:last-child {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        overflow: hidden;
        padding: 1.25rem 0.75rem 0.25rem;
    }

    #root section.relative.pt-32 .min-h-\[560px\] > div:last-child > .relative {
        position: relative;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        transform: scale(0.88);
        transform-origin: top center;
        margin: 0 auto -8%;
    }

    /* Pull floating badges inward so they are visible and do not overflow */
    #root section.relative.pt-32 .min-h-\[560px\] > div:last-child [class*="-right-4"] {
        right: 0.25rem !important;
        top: 0.25rem !important;
    }

    #root section.relative.pt-32 .min-h-\[560px\] > div:last-child [class*="-left-6"] {
        left: 0.25rem !important;
    }

    #root section.relative.pt-32 .min-h-\[560px\] > div:last-child [class*="-right-4"] > div {
        width: 4.5rem !important;
        height: 4.5rem !important;
    }

    #root section.relative.pt-32 .min-h-\[560px\] > div:last-child img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    #root section.relative.pt-32 .min-h-\[560px\] > div:last-child .rounded-2xl {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    #root section.relative.pt-32 .min-h-\[560px\] > div:last-child {
        padding: 1.5rem 0.5rem 0.25rem;
    }

    #root section.relative.pt-32 .min-h-\[560px\] > div:last-child > .relative {
        transform: scale(0.82);
        margin-bottom: -12%;
    }

    #root section.relative.pt-32 .min-h-\[560px\] > div:last-child [class*="-right-4"] > div {
        width: 4rem !important;
        height: 4rem !important;
    }
}

/* Integration pages: keep PHP core logos sized and non-overflowing */
@media (max-width: 767px) {
    #root main section.relative.min-h-screen img[alt="Shopify"],
    #root main section.relative.min-h-screen img[alt="Shopify Plus"],
    #root main section.relative.min-h-screen img[alt="Magento"] {
        max-width: 42vw;
        height: auto;
        max-height: 4.5rem;
        object-fit: contain;
    }
}

/* Unified FAQ accordion (wizzy-faq.js) — matches /product/ai-autocomplete */
#root [data-wizzy-faq-accordion] [data-wizzy-faq-item] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#root [data-wizzy-faq-accordion] [data-wizzy-faq-item][data-state="open"] {
    border-color: hsl(var(--accent) / 0.3);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

#root [data-wizzy-faq-accordion] button[data-state="open"] > svg {
    transform: rotate(180deg);
}

#root [data-wizzy-faq-accordion] [data-wizzy-faq-panel] {
    overflow: hidden;
}
