/* ── Public demo sandbox (Ticket 6) ─────────────────────────────────────────────────────────────
   Loaded by js/demo-guard.js ONLY while a demo is running (and by demo.html). Existing custom properties only.
   The banner is fixed to the top of the viewport; this sheet reserves its space (body margin) and moves the shared
   mobile nav below it, so nothing is covered and nothing overlaps the Dynamic Island / notch. */

:root.gf-demo {
    --gf-demo-bar: 38px;
    --gf-demo-h: calc(env(safe-area-inset-top, 0px) + var(--gf-demo-bar));
    /* the banner now owns the top safe-area strip, so the shared nav must not add it a second time */
    --mobile-top-safe-area: 0px;
}
@media (max-width: 520px) {
    :root.gf-demo { --gf-demo-bar: 62px; }
}
:root.gf-demo body { margin-top: var(--gf-demo-h); }
@media (max-width: 900px) {
    :root.gf-demo nav.gf-app-nav { top: var(--gf-demo-h); }
}

.gf-demo-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1200;
    box-sizing: border-box;
    min-height: var(--gf-demo-h);
    padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
    background: var(--gold);
    color: #1a1200;
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    line-height: 1.25;
}
.gf-demo-badge {
    flex: 0 0 auto;
    font-weight: 700; letter-spacing: .06em;
    padding: 2px 8px; border-radius: 999px;
    background: #1a1200; color: #ffd966;
    font-size: 0.72rem;
}
.gf-demo-note { flex: 1 1 200px; min-width: 0; font-weight: 500; }
.gf-demo-actions { flex: 0 0 auto; display: flex; gap: 6px; margin-left: auto; }
.gf-demo-btn {
    min-height: 32px; min-width: 44px; padding: 4px 12px;
    border-radius: 8px; border: 1px solid #1a1200;
    background: transparent; color: #1a1200;
    font: inherit; font-weight: 600; cursor: pointer;
}
.gf-demo-btn--exit { background: #1a1200; color: #ffd966; }
.gf-demo-btn:focus-visible { outline: 3px solid #1a1200; outline-offset: 2px; }
.gf-demo-btn--arm { background: #7a1d00; border-color: #7a1d00; color: #fff; }
.gf-demo-toast {
    position: fixed; z-index: 1210; left: 50%; transform: translateX(-50%);
    top: calc(var(--gf-demo-h) + 8px);
    background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
    border-radius: 10px; padding: 8px 14px; font-size: .85rem; box-shadow: 0 6px 20px rgba(0,0,0,.35);
    max-width: calc(100vw - 24px);
}
@media (max-width: 520px) {
    .gf-demo-note { flex-basis: 100%; order: 3; font-size: 0.74rem; }
    .gf-demo-actions { order: 2; }
}
:root[data-theme="light"] .gf-demo-banner { background: #8a6500; color: #fff; border-bottom-color: rgba(0,0,0,.35); }
:root[data-theme="light"] .gf-demo-badge { background: #fff; color: #5c4300; }
:root[data-theme="light"] .gf-demo-btn { border-color: #fff; color: #fff; }
:root[data-theme="light"] .gf-demo-btn--exit { background: #fff; color: #5c4300; }
:root[data-theme="light"] .gf-demo-btn:focus-visible { outline-color: #fff; }

/* ── Demo Host page (demo.html) ───────────────────────────────────────────────────────────────── */
.gf-demo-host { background: var(--bg); color: var(--text); min-height: 100vh; min-height: 100dvh; margin: 0; }
.gf-demo-host-header { padding: calc(14px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); }
.gf-demo-host-brand { display: flex; align-items: center; gap: 8px; color: var(--gold); font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.15rem; }
.gf-demo-host-tag { margin-left: 4px; }
.gf-demo-host-main { max-width: 640px; margin: 0 auto; padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.gf-demo-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg, 14px); padding: 22px 20px; margin-top: 10px; }
.gf-demo-card[hidden] { display: none; }
.gf-demo-card h1 { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; line-height: 1.2; margin: 0 0 10px; color: var(--text); outline: none; }
.gf-demo-lead { color: var(--text-muted); line-height: 1.6; margin: 0 0 14px; }
.gf-demo-facts { margin: 0 0 18px; padding-left: 20px; color: var(--text-muted); line-height: 1.55; }
.gf-demo-facts li { margin-bottom: 8px; }
.gf-demo-facts strong { color: var(--text); }
.gf-demo-small { font-size: .8rem; color: var(--text-muted); margin: 8px 0 0; }
.gf-demo-thanks { font-weight: 600; color: var(--gold); margin: 0 0 2px; }
.gf-demo-cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.gf-demo-cta-row .btn { text-decoration: none; display: inline-block; text-align: center; min-height: 44px; }
.gf-demo-q { border: 0; padding: 0; margin: 0 0 18px; }
.gf-demo-q legend, .gf-demo-legend { display: block; font-weight: 600; color: var(--text); margin: 0 0 8px; padding: 0; }
.gf-demo-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.gf-demo-pill {
    min-height: 40px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg-input); color: var(--text-muted);
    font: inherit; font-size: .85rem;
}
.gf-demo-pill[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #1a1200; font-weight: 600; }
.gf-demo-pill:focus-visible, .gf-demo-card .btn:focus-visible, #q3Text:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
#q3Text { width: 100%; box-sizing: border-box; background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; resize: vertical; }

/* ── Simulated scans (js/demo-scan.js) ────────────────────────────────────────────────────────── */
.gf-demo-scan { position: fixed; inset: 0; z-index: 1300; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0.6); padding: 12px; }
.gf-demo-scan__panel { width: 100%; max-width: 460px; max-height: calc(100vh - 24px - env(safe-area-inset-top, 0px)); max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px)); overflow-y: auto; background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 16px; padding: 16px 16px calc(14px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.gf-demo-scan__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.gf-demo-scan__title { flex: 1; margin: 0; font-size: 1.1rem; font-family: 'Space Grotesk', sans-serif; outline: none; }
.gf-demo-scan__x { min-width: 44px; min-height: 44px; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: var(--text); font-size: 1.4rem; cursor: pointer; }
.gf-demo-scan__x:focus-visible, .gf-demo-scan .nv2-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.gf-demo-scan__note { color: var(--text-muted); line-height: 1.5; font-size: .88rem; margin: 0 0 12px; }
.gf-demo-scan__card { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.gf-demo-scan__nutri { margin-top: 8px; }
.gf-demo-scan__qty { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.gf-demo-scan__qty strong { min-width: 28px; text-align: center; font-size: 1.1rem; }
.gf-demo-scan__lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.gf-demo-scan__line { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.gf-demo-scan__line input { width: 22px; height: 22px; margin-top: 2px; flex: 0 0 auto; }
.gf-demo-scan__line .nv2-caption { display: block; }
.gf-demo-scan__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.gf-demo-scan__actions .nv2-btn { min-height: 44px; }
@media (min-width: 640px) { .gf-demo-scan { align-items: center; } }
