// ═══════════════════════════════════════════════
// FERMENTY MOBILE — Shell (phone frame + screen layout)
// ═══════════════════════════════════════════════

// ── Dev preview wrapper ──────────────────────
// Sólo se renderiza en desktop (el layout detecta el user-agent):
// simula la pantalla del móvil dentro de un frame.
.fm-preview {
    min-height: 100vh;
    background: #EDEAE4;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 32px;
    padding: 40px 24px;
    flex-wrap: wrap;
}

.fm-preview-label {
    @include section-label;
    text-align: center;
    margin-bottom: 10px;
    color: #888;
}

// ── Phone frame (dev only) ───────────────────
.fm-frame {
    // Fixed-height device frame: a flex column so the content scrolls
    // internally between the topbar and the (always-visible) bottom nav.
    width: 390px;
    height: 820px;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    border-radius: 40px;
    border: 7px solid $t-dark;
    overflow: hidden;
    background: var(--bg-canvas);
    position: relative;
    box-shadow: 0 24px 60px rgba(0,0,0,.18);

    .fm-notch {
        flex-shrink: 0;
        width: 110px;
        height: 26px;
        background: $t-dark;
        border-radius: 0 0 16px 16px;
        margin: 0 auto;
    }
}

// ── Non-preview (real device) root ───────────
// Locks the app to the viewport so the body never scrolls — only .fm-screen does.
.fm-app-root {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-canvas);
    position: relative;
    // Safe areas (notch/gestos): relevantes con viewport-fit=cover,
    // sobre todo al rotar a apaisado. En navegadores normales valen 0.
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

// ── Screen root: the scrollable content area ──
// Sits between the topbar and the bottom nav and is the ONLY scroller.
.fm-screen {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-canvas);
    position: relative;
}

// ── CSS fallback: narrow desktop windows ─────
// Real phones never render the frame (user-agent check in the layout);
// this keeps a narrow desktop browser window usable too.
@media (max-width: 460px) {
    .fm-preview {
        min-height: 0;
        padding: 0;
        gap: 0;
        background: var(--bg-canvas);
        display: block;
    }
    .fm-preview-label { display: none; }
    .fm-frame {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .fm-notch { display: none; }
}
