/* ── Mobile Bottom Tab Bar ───────────────────────────────────────────────────
   Visible only on touch devices at narrow viewports.
   device.js sets body[data-touch="true"] before this stylesheet is applied.
   ────────────────────────────────────────────────────────────────────────── */

:root {
    --ln-tab-bar-height: 56px;
}

/* Tab bar base — hidden by default, revealed only on narrow-touch */
#ln-mobile-nav {
    display: none;
}

@media (max-width: 768px) {
    body[data-touch="true"] #ln-mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9000;
        background: #fff;
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.08);
        /* Respect home indicator on iOS/Android */
        padding-bottom: env(safe-area-inset-bottom, 0px);
        height: calc(var(--ln-tab-bar-height) + env(safe-area-inset-bottom, 0px));
        align-items: stretch;
    }

    /* Hide the hamburger nav sidebar toggle when tab bar is active */
    body[data-touch="true"] #lnNavToggle,
    body[data-touch="true"] .ln-nav-toggle,
    body[data-touch="true"] #lnHamburgerToggle {
        display: none !important;
    }
}

/* ── Individual tab items ────────────────────────────────────────────────── */

.ln-mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: #64748b;
    font-size: 10px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    line-height: 1;
    min-height: 44px;   /* WCAG tap target */
    cursor: pointer;
    border: none;
    background: none;
    padding: 6px 4px 2px;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.16s ease;
    letter-spacing: 0.01em;
    position: relative;
}

.ln-mobile-tab:active {
    color: #4338ca;
}

.ln-mobile-tab svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ln-mobile-tab span {
    display: block;
}

/* Active state — accent colour + filled icon indicator dot */
.ln-mobile-tab[aria-current="page"] {
    color: #4f46e5;
}

.ln-mobile-tab[aria-current="page"]::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #4f46e5;
}

/* ── Page body bottom clearance ─────────────────────────────────────────── */
/* Pages that include mobile_nav.css get a bottom spacer via JS; this is the
   fallback for pages that don't dynamically inject it. */

@media (max-width: 768px) {
    body[data-touch="true"] {
        padding-bottom: calc(var(--ln-tab-bar-height) + env(safe-area-inset-bottom, 0px));
    }
}
