/* Mobile Pill Navigation — TitanPro style
   Floating pill bar on mobile (<=768px).
   Expands into rounded card on hamburger tap.
   body .navbar / body #rollin-nav specificity overrides inline styles. */

/* Pill menu hidden on desktop */
.pill-menu { display: none; }
.pill-backdrop { display: none; }

@media (max-width: 768px) {

    /* ==========================================
       Pill base — closed state
       ========================================== */
    body .navbar {
        top: 10px !important;
        left: 12px !important;
        right: 12px !important;
        height: auto !important;
        max-height: 54px;
        overflow: hidden;
        border-radius: 100px;
        background: #111111 !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
        padding: 0 0.75rem 0 1.25rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    border-radius 0.35s ease,
                    box-shadow 0.3s ease;
    }

    body .navbar .navbar-inner {
        display: flex;
        align-items: center;
        min-height: 54px;
    }

    body .navbar .navbar-brand img {
        height: 28px;
    }

    /* Astro pages */
    body #rollin-nav {
        top: 10px;
        left: 12px;
        right: 12px;
        height: auto;
        max-height: 54px;
        overflow: hidden;
        border-radius: 100px;
        background: #111111;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
        padding: 0 0.75rem 0 1.25rem;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    border-radius 0.35s ease,
                    box-shadow 0.3s ease;
    }

    body #rollin-nav > div:first-child {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 54px;
    }

    body #rollin-nav img {
        height: 28px;
        filter: invert(0) !important;
    }

    /* ==========================================
       Pill expanded — open state
       ========================================== */
    body .navbar.menu-open,
    body #rollin-nav.menu-open {
        max-height: 80vh;
        border-radius: 20px;
        box-shadow: 0 8px 48px rgba(0, 0, 0, 0.85);
        overflow-y: auto;
    }

    /* Navbar inner row — keep it 54px so content is consistent */
    body .navbar.menu-open .navbar-inner,
    body #rollin-nav.menu-open > div:first-child {
        min-height: 54px;
    }

    /* ==========================================
       Pill menu panel — links inside the pill
       ========================================== */
    .pill-menu {
        display: flex;
        flex-direction: column;
        padding: 0.375rem 0.75rem 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        margin-top: 0.125rem;
        opacity: 0;
        transform: translateY(-6px);
        transition: opacity 0.15s ease, transform 0.15s ease;
    }

    .menu-open .pill-menu {
        opacity: 1;
        transform: translateY(0);
        transition: opacity 0.3s ease 0.12s, transform 0.3s ease 0.12s;
    }

    .pill-menu-link {
        color: #999;
        text-decoration: none;
        font-size: 0.95rem;
        font-weight: 500;
        padding: 0.6rem 0.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        transition: color 0.15s;
    }

    .pill-menu-link:last-child {
        border-bottom: none;
    }

    .pill-menu-link:hover,
    .pill-menu-link:active {
        color: #fff;
    }

    .pill-menu-divider {
        height: 0;
        margin: 0.2rem 0;
    }

    /* Auth buttons at bottom of pill menu */
    .pill-menu-actions {
        display: flex;
        gap: 0.5rem;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    .pill-menu-btn {
        flex: 1;
        padding: 0.6rem;
        font-size: 0.85rem;
        font-weight: 600;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        background: transparent;
        color: #ccc;
        cursor: pointer;
        transition: all 0.15s;
        font-family: inherit;
        text-align: center;
        text-decoration: none;
    }

    .pill-menu-btn:hover {
        border-color: rgba(20, 184, 166, 0.4);
        color: #fff;
    }

    .pill-menu-btn-primary {
        background: rgba(20, 184, 166, 0.15);
        border-color: rgba(20, 184, 166, 0.25);
        color: #14b8a6;
    }

    .pill-menu-btn-primary:hover {
        background: rgba(20, 184, 166, 0.25);
        color: #2dd4bf;
    }

    /* App Store banner (top of mobile menu) */
    .pill-menu-appbanner {
        display: flex;
        align-items: center;
        gap: 0.7rem;
        padding: 0.7rem 0.75rem;
        margin-bottom: 0.6rem;
        background: linear-gradient(135deg, rgba(20, 184, 166, 0.16), rgba(20, 184, 166, 0.05));
        border: 1px solid rgba(20, 184, 166, 0.28);
        border-radius: 12px;
        text-decoration: none;
        transition: all 0.18s ease;
    }
    .pill-menu-appbanner:hover,
    .pill-menu-appbanner:active {
        background: linear-gradient(135deg, rgba(20, 184, 166, 0.24), rgba(20, 184, 166, 0.1));
        border-color: rgba(20, 184, 166, 0.45);
    }
    .pill-menu-appbanner-icon {
        flex-shrink: 0;
        width: 36px;
        height: 36px;
        border-radius: 9px;
        background: #14b8a6;
        display: grid;
        place-items: center;
        box-shadow: 0 4px 14px rgba(20, 184, 166, 0.3);
    }
    .pill-menu-appbanner-icon svg {
        width: 20px;
        height: 20px;
        color: #0a0a0a;
    }
    .pill-menu-appbanner-text { flex: 1; min-width: 0; line-height: 1.15; }
    .pill-menu-appbanner-title {
        font-size: 0.88rem;
        font-weight: 700;
        color: #fff;
        letter-spacing: -0.01em;
    }
    .pill-menu-appbanner-sub {
        font-size: 0.7rem;
        color: #14b8a6;
        font-weight: 600;
        margin-top: 3px;
        letter-spacing: 0.02em;
    }
    .pill-menu-appbanner-arrow {
        color: #14b8a6;
        font-size: 1.1rem;
        font-weight: 700;
        flex-shrink: 0;
    }

    /* ==========================================
       Backdrop scrim
       ========================================== */
    .pill-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .pill-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }
}
