/* One mobile navigation geometry and surface for every page, including video.
   Safe area belongs inside the bar, not in a pseudo-element below it. */
:root, [data-theme="dark"], [data-theme="light"] {
    /* Resolve through the existing theme tokens on initial load and switches. */
    --fu-bottom-nav-surface: var(--navbg);
    --bottom-nav-height: 64px;
    --bottom-safe-area: env(safe-area-inset-bottom, 0px);
    --bottom-nav-total-height: calc(var(--bottom-nav-height) + var(--bottom-safe-area));
    --bottom-content-gap: 12px;
    --bottom-nav-clearance: calc(var(--bottom-nav-total-height) + var(--bottom-content-gap));
    --fu-bottom-nav-content-height: var(--bottom-nav-height);
    --app-viewport-height: 100vh;
}
@supports (height: 100dvh) {
    :root { --app-viewport-height: 100dvh; }
}
/* Opt in on the actual scroll owner, never on both body and its child. */
.bottom-nav-scroll {
    padding-bottom: var(--bottom-nav-clearance) !important;
    scroll-padding-bottom: var(--bottom-nav-clearance);
}
.bottom-nav-viewport {
    height: var(--app-viewport-height) !important;
    height: min(var(--app-viewport-height), var(--visual-viewport-height, 100dvh)) !important;
}
@media (min-width: 768px) {
    :root { --bottom-nav-total-height: 0px; --bottom-nav-clearance: var(--bottom-content-gap); }
}
@media (max-width: 767px) {
    html[data-nav-keyboard] .bottom-nav {
        visibility: hidden;
        pointer-events: none;
    }
}
@media (max-width: 767px) {
    html { background-color: var(--fu-bottom-nav-surface) !important; }
    .bottom-nav {
        background: var(--fu-bottom-nav-surface) !important;
        bottom: 0 !important;
        height: var(--bottom-nav-total-height) !important;
        min-height: 0 !important;
        max-height: none !important;
        padding: 0 0 var(--bottom-safe-area) !important;
        box-sizing: border-box !important;
        align-items: center !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}
bottom-nav { background: var(--fu-bottom-nav-surface) !important; }
.bottom-nav::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 200px;
    background: var(--fu-bottom-nav-surface);
    pointer-events: none;
}

bottom-nav {
    display: block;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--fu-bottom-nav-surface);
    box-sizing: border-box;
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-top: 1px solid var(--brd);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 0 var(--bottom-safe-area);
    z-index: 50;
    transition: background .3s, border-color .3s, transform .35s cubic-bezier(.32, .94, .6, 1);
    height: var(--bottom-nav-total-height);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.bottom-nav.hidden-nav {
    transform: translateY(100%);
}

.nav-item {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 6px clamp(8px, 3vw, 14px);
    border-radius: 14px;
    transition: background .15s;
    position: relative;
    background: none;
    border: none;
    text-decoration: none;
    color: inherit;
}
.nav-item:hover {
    background: var(--pdim);
}
.nav-item svg {
    width: clamp(20px, 5vw, 24px);
    height: clamp(20px, 5vw, 24px);
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke .15s;
}
.nav-item span {
    font-size: clamp(9px, 2vw, 10px);
    color: var(--muted);
    font-weight: 600;
    letter-spacing: .03em;
}
.nav-item.active svg {
    stroke: var(--p);
}
.nav-item.active span {
    color: var(--p);
}
.nav-item .nav-badge {
    position: absolute;
    top: 3px;
    right: clamp(4px, 2vw, 6px);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--p);
    border: 1.5px solid var(--bg);
}

.nav-av {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    background: linear-gradient(135deg, #1a1035, #3b1a6b);
}
.nav-item.active .nav-av {
    border-color: var(--p);
}

.add-post-btn {
    background: var(--p);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px var(--pglow);
    transform: translateY(-2px);
    flex-shrink: 0;
    transition: transform .15s, box-shadow .15s;
}
.add-post-btn:active {
    transform: translateY(-2px) scale(.92);
}
.add-post-btn svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
}

/* ─── Dark‑mode fix: remove blur artifacts ─── */
[data-theme="dark"] .bottom-nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--fu-bottom-nav-surface);
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none !important;
    }
}

/* Shell ownership only: the existing 64px + safe-area contract is unchanged. */
html[data-fu-screen-child] bottom-nav { display: none !important; }
html[data-fu-shell] bottom-nav[data-fu-shell-nav] > .bottom-nav { z-index: 20000; }
html[data-fu-shell] bottom-nav[data-fu-shell-nav] > .bottom-nav.hidden-nav { transform: none; }
.fu-navigation-status {
    position: fixed; z-index: 20001; left: 16px; right: 16px;
    bottom: var(--bottom-nav-clearance); padding: 10px 14px;
    background: var(--bg); color: var(--text); border: 1px solid var(--brd);
    border-radius: 12px; font: 14px system-ui;
}
.fu-navigation-status[hidden] { display: none; }
html[data-fu-screen-suspended] canvas { visibility: hidden; }

/* Preserve the original full-screen modal stacking above the 50-layer bar.
   The single component remains mounted and returns when the modal closes. */
html[data-nav-overlay] bottom-nav[data-fu-shell-nav] > .bottom-nav {
    visibility: hidden;
    pointer-events: none;
}
