/* App-host base only. All product styling comes from the QistPay.UI bundle (tokens + Qp* utilities);
   nothing here re-themes the product. This file just makes the WASM PWA fill the viewport and keeps
   the framework's loading + error chrome legible. */

html, body {
    height: 100%;
    margin: 0;
    background: var(--qp-screen); /* paints the viewport behind the app root so there's no dark band */
}

/* The Blazor mount point is the app viewport; QpAppShell fills it as a flex child so the bottom
   QpTabBar pins to the viewport edge (not mid-screen on short/empty states) and the scrolling
   <main> bounds its own overflow. height (not min-height) gives the shell a definite height to
   resolve against; min-height:0 on the shell lets main's overflow-y-auto scroll internally. */
#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#app > div {
    flex: 1;
    min-height: 0;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        inset-inline-end: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e8ecef;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #0d9f6e; /* --qp-green */
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    color: #0f172a; /* --qp-ink */
    font-family: Inter, system-ui, sans-serif;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

/* ── Desktop device frame (host chrome only) ─────────────────────────────────────────────────────
   The Shopper client is a phone app; on a desktop viewport it otherwise stretches to 2000px wide
   and stops reading as one. Above a viewport that can actually hold a phone, the host paints a
   device around the SAME product surface — ink body, the canonical 44px bezel / 35px screen radii
   from DESIGN.md ("The phone: 44px bezel, 35px screen, ink body"), on the Gallery's dark docs
   ground so the two documentation contexts match.

   Two-Context Rule, held: every declaration here is on the HOST's own chrome (body, #app and the
   Blazor root box). Nothing reaches inside the product surface, and nothing is drawn OVER it —
   which is why there is no notch or home indicator: those would sit on pixels QpTopBar / QpTabBar
   own. The frame is furniture; the screen is the product.

   Narrow windows and real devices never match this query, so the PWA stays full-bleed where it
   ships. Resizing the window is the toggle — no flag, no JS.

   transform on #app is load-bearing, not decoration: it makes the device a containing block for
   position:fixed descendants, which keeps DemoBadge (fixed, bottom-end) inside the phone instead of
   floating in the corner of the desktop window. */
@media (min-width: 900px) and (min-height: 640px) {
    body {
        height: auto;
        min-height: 100%;
        display: grid;
        place-items: center;
        padding: 24px;
        background: #1a1714; /* the Gallery's docs ground */
    }

    /* The phone body. Height tracks the viewport on shorter screens so the frame never scrolls. */
    #app {
        width: 390px;   /* iPhone 14/15 Pro logical width */
        height: min(844px, calc(100dvh - 48px));
        flex: none;
        padding: 10px;  /* the marketing hero phone's bezel thickness (p-2.5) */
        background: #17251f; /* --ink */
        border-radius: 44px;
        box-shadow: 0 30px 60px -20px rgba(11, 63, 49, 0.55),
                    inset 0 0 0 1px rgba(255, 255, 255, 0.07);
        transform: translateZ(0);
    }

    /* The screen. Clips the product to the bezel's inner radius. */
    #app > div {
        border-radius: 35px;
        overflow: hidden;
        background: var(--qp-screen);
    }
}
