/* Mobile collapsed nav + floating download CTA (marketing pages) */

.floating-download-btn {
    display: none;
}

.nav-menu-brand {
    display: none;
}

.nav-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.nav-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
}

.nav-menu-icon {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    position: relative;
}

.nav-menu-icon::before,
.nav-menu-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: currentColor;
    transition: transform 0.2s ease, top 0.2s ease;
}

.nav-menu-icon::before { top: -6px; }
.nav-menu-icon::after { top: 6px; }

.nav-menu-toggle[aria-expanded="true"] .nav-menu-icon {
    background: transparent;
}

.nav-menu-toggle[aria-expanded="true"] .nav-menu-icon::before {
    top: 0;
    transform: rotate(45deg);
}

.nav-menu-toggle[aria-expanded="true"] .nav-menu-icon::after {
    top: 0;
    transform: rotate(-45deg);
}

.nav-menu-backdrop {
    display: none;
}

/* Fold / tablet portrait and touch phones (Fold 3 unfolded can exceed 768px) */
@media (min-width: 1025px) {
    .header-actions {
        display: none;
    }
}

@media (max-width: 1024px), ((hover: none) and (pointer: coarse) and (max-width: 1200px)) {
    body.nav-open {
        overflow: hidden;
    }

    .nav-menu-toggle {
        display: flex;
    }

    .site-header,
    header.site-header {
        padding: 0.65rem 0;
    }

    .header-content {
        position: relative;
        justify-content: flex-start;
        align-items: center;
        min-height: 40px;
    }

    .site-header .header-content,
    header .header-content {
        padding-right: 0;
    }

    .header-brand {
        display: none !important;
    }

    .header-actions {
        margin-left: 0;
        margin-right: 0;
        order: -1;
        position: relative;
        z-index: 2;
    }

    .floating-download-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: 1;
        padding: 0.45rem 0.9rem;
        font-size: 0.8rem;
        font-weight: 700;
        line-height: 1.2;
        text-decoration: none;
        color: #041407;
        background: linear-gradient(135deg, #1DB954, #1ed760);
        border-radius: 999px;
        box-shadow: 0 4px 18px rgba(29, 185, 84, 0.45);
        white-space: nowrap;
        transition: box-shadow 0.2s ease;
    }

    .floating-download-btn:hover {
        box-shadow: 0 6px 22px rgba(29, 185, 84, 0.5);
        color: #041407;
    }

    .nav-menu-brand {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        padding: 1rem 1.5rem;
        font-weight: 700;
        font-size: 1.15rem;
        letter-spacing: -0.02em;
        color: #fff !important;
        text-decoration: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-menu-brand img {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        flex-shrink: 0;
    }

    .site-nav-panel {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        z-index: 999;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
        background: rgba(10, 10, 15, 0.97);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
        transition: max-height 0.28s ease, opacity 0.22s ease;
    }

    .site-nav-panel.is-open {
        max-height: min(75vh, 480px);
        opacity: 1;
        pointer-events: auto;
    }

    .site-nav-panel a:not(.nav-menu-brand) {
        display: block;
        padding: 0.85rem 1.5rem;
        font-size: 0.95rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .site-nav-panel a:last-child {
        border-bottom: none;
    }

    .site-nav-panel .nav-cta {
        display: none;
    }

    .nav-menu-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 998;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease;
    }

    .nav-menu-backdrop.is-visible {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-width: 380px) {
    .floating-download-btn {
        font-size: 0.72rem;
        padding: 0.4rem 0.75rem;
    }
}

/* JS fallback when cached CSS missed the breakpoint (e.g. stale bundle on phone) */
html.mobile-site-nav .nav-menu-toggle {
    display: flex;
}

html.mobile-site-nav .header-brand {
    display: none !important;
}

html.mobile-site-nav .floating-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    color: #041407;
    background: linear-gradient(135deg, #1DB954, #1ed760);
    border-radius: 999px;
    box-shadow: 0 4px 18px rgba(29, 185, 84, 0.45);
    white-space: nowrap;
}

html.mobile-site-nav .site-nav-panel {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 999;
    display: flex;
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    background: rgba(10, 10, 15, 0.97);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

html.mobile-site-nav .site-nav-panel.is-open {
    max-height: min(75vh, 480px);
    opacity: 1;
    pointer-events: auto;
}

html.mobile-site-nav .nav-menu-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.5rem;
    font-weight: 700;
    color: #fff !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

html.mobile-site-nav .site-nav-panel .nav-cta {
    display: none;
}

html.mobile-site-nav .nav-menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
}

html.mobile-site-nav .nav-menu-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 1025px) {
    html.mobile-site-nav .nav-menu-toggle,
    html.mobile-site-nav .floating-download-btn {
        display: none;
    }

    html.mobile-site-nav .header-brand {
        display: flex !important;
    }
}
