/* ==========================================================================
   ValueStats · Mobile app navigation
   ========================================================================== */

.mobile-app-navigation {
    --mobile-nav-height: 4.25rem;
    --mobile-nav-surface: rgba(250, 252, 251, .97);
    --mobile-nav-sheet: #f7faf8;
    --mobile-nav-border: #d5dfda;
    --mobile-nav-ink: #24342b;
    --mobile-nav-muted: #708078;
    --mobile-nav-primary: #087a55;
    --mobile-nav-primary-soft: #e6f3ed;
}

.mobile-app-tabbar {
    position: fixed;
    z-index: 70;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: start;
    padding: .34rem .3rem calc(.28rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--mobile-nav-border);
    background: var(--mobile-nav-surface);
    box-shadow: 0 -8px 26px rgba(18, 43, 30, .1);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    will-change: transform;
}

.mobile-app-tabbar::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    height: max(3rem, env(safe-area-inset-bottom));
    background: var(--mobile-nav-surface);
    pointer-events: none;
}

.mobile-app-tabbar > a,
.mobile-app-tabbar > button {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 3.45rem;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .15rem;
    padding: .25rem .15rem .2rem;
    border: 0;
    border-radius: .34rem;
    color: var(--mobile-nav-muted);
    background: transparent;
    font: inherit;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.mobile-app-tabbar > a::before,
.mobile-app-tabbar > button::before {
    content: '';
    position: absolute;
    top: -.36rem;
    left: 50%;
    width: 2.2rem;
    height: 2px;
    background: transparent;
    transform: translateX(-50%);
}

.mobile-app-tabbar > a:active,
.mobile-app-tabbar > button:active {
    background: var(--mobile-nav-primary-soft);
}

.mobile-app-tabbar > .is-active {
    color: var(--mobile-nav-primary);
}

.mobile-app-tabbar > .is-active::before {
    background: var(--mobile-nav-primary);
}

.mobile-app-tabbar svg,
.mobile-app-tabbar-icon > svg {
    width: 1.32rem;
    height: 1.32rem;
    flex: 0 0 auto;
}

.mobile-app-tabbar > a > span:last-child,
.mobile-app-tabbar > button > span:last-child {
    overflow: hidden;
    width: 100%;
    font-size: .6rem;
    font-weight: 680;
    letter-spacing: .005em;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-app-tabbar-icon {
    position: relative;
    display: inline-flex;
}

.mobile-app-live-badge {
    position: absolute;
    top: -.34rem;
    right: -.5rem;
    display: inline-flex;
    min-width: .95rem;
    height: .95rem;
    align-items: center;
    justify-content: center;
    padding: 0 .2rem;
    border: 2px solid #f9fbfa;
    border-radius: 999px;
    color: #fff;
    background: #dc2626;
    font-size: .48rem;
    font-weight: 800;
    line-height: 1;
}

.mobile-app-live-badge.hidden {
    display: none;
}

.mobile-app-navigation-backdrop {
    position: fixed;
    z-index: 64;
    inset: 0;
    background: rgba(2, 11, 7, .54);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .18s ease, visibility .18s ease;
}

.mobile-app-sheet {
    position: fixed;
    z-index: 65;
    right: 0;
    bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) - 1px);
    left: 0;
    overflow-y: auto;
    max-height: min(78dvh, 46rem);
    padding: .55rem .85rem 1rem;
    border: 1px solid var(--mobile-nav-border);
    border-bottom: 0;
    border-radius: .7rem .7rem 0 0;
    color: var(--mobile-nav-ink);
    background: var(--mobile-nav-sheet);
    box-shadow: 0 -22px 52px rgba(2, 17, 10, .24);
    overscroll-behavior: contain;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(100%);
    transition: opacity .18s ease, visibility .18s ease, transform .22s ease;
}

.mobile-app-navigation.is-open .mobile-app-navigation-backdrop,
.mobile-app-navigation.is-open .mobile-app-sheet {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mobile-app-navigation.is-open .mobile-app-sheet {
    transform: translateY(0);
}

.mobile-app-menu-open {
    overflow: hidden;
}

.mobile-app-sheet-handle {
    width: 2.6rem;
    height: 3px;
    margin: 0 auto .65rem;
    border-radius: 999px;
    background: #b9c6bf;
}

.mobile-app-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .05rem .15rem .75rem;
}

.mobile-app-sheet-eyebrow {
    margin: 0 0 .13rem;
    color: var(--mobile-nav-primary);
    font-size: .58rem;
    font-weight: 750;
    letter-spacing: .105em;
    text-transform: uppercase;
}

.mobile-app-sheet-header h2 {
    margin: 0;
    color: var(--mobile-nav-ink);
    font-size: 1.18rem;
    font-weight: 690;
    letter-spacing: -.035em;
}

.mobile-app-sheet-close {
    display: grid;
    width: 2.15rem;
    height: 2.15rem;
    place-items: center;
    border: 1px solid var(--mobile-nav-border);
    border-radius: .34rem;
    color: var(--mobile-nav-muted);
    background: #fff;
}

.mobile-app-sheet-close svg {
    width: 1rem;
    height: 1rem;
}

.mobile-app-sheet-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr));
    gap: .45rem;
    padding-bottom: .8rem;
}

.mobile-app-sheet-actions > button {
    display: flex;
    min-width: 0;
    min-height: 4.4rem;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .42rem;
    padding: .55rem;
    border: 1px solid var(--mobile-nav-border);
    border-radius: .42rem;
    color: #4a5c52;
    background: #fff;
    font-size: .68rem;
    font-weight: 680;
}

.mobile-app-sheet-actions > button:active {
    border-color: #9ec7b5;
    color: var(--mobile-nav-primary);
    background: var(--mobile-nav-primary-soft);
}

.mobile-app-sheet-icon {
    display: grid;
    width: 1.8rem;
    height: 1.8rem;
    place-items: center;
    border-radius: .3rem;
    color: var(--mobile-nav-primary);
    background: var(--mobile-nav-primary-soft);
}

.mobile-app-sheet-icon--favourite {
    color: #a16207;
    background: #fef3c7;
}

.mobile-app-sheet-icon svg {
    width: 1.05rem;
    height: 1.05rem;
}

.mobile-app-theme-icon--dark {
    display: none;
}

[data-theme="dark"] .mobile-app-theme-icon--light {
    display: none;
}

[data-theme="dark"] .mobile-app-theme-icon--dark {
    display: block;
}

.mobile-app-sheet-links {
    overflow: hidden;
    border: 1px solid var(--mobile-nav-border);
    border-radius: .45rem;
    background: #fff;
}

.mobile-app-sheet-links > a {
    display: grid;
    min-height: 2.85rem;
    grid-template-columns: 1.15rem minmax(0, 1fr) .85rem;
    gap: .75rem;
    align-items: center;
    padding: .68rem .8rem;
    border-bottom: 1px solid #e4ebe7;
    color: #3e5046;
    font-size: .76rem;
    font-weight: 650;
}

.mobile-app-sheet-links > a:last-child {
    border-bottom: 0;
}

.mobile-app-sheet-links > a:active {
    color: var(--mobile-nav-primary);
    background: var(--mobile-nav-primary-soft);
}

.mobile-app-sheet-links > a > svg {
    width: 1.05rem;
    height: 1.05rem;
    color: #718179;
}

.mobile-app-sheet-links .mobile-app-sheet-chevron {
    width: .75rem;
    height: .75rem;
    color: #a1aea7;
}

.mobile-app-sheet-account {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
    margin-top: .65rem;
}

.mobile-app-sheet-account > a {
    display: flex;
    min-height: 2.55rem;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .55rem .65rem;
    border: 1px solid var(--mobile-nav-border);
    border-radius: .38rem;
    color: #405149;
    background: #fff;
    font-size: .7rem;
    font-weight: 670;
}

.mobile-app-sheet-account svg {
    width: .95rem;
    height: .95rem;
}

.mobile-app-sheet-account .mobile-app-sheet-account-primary {
    border-color: #087a55;
    color: #fff;
    background: #087a55;
}

.mobile-app-sheet-account .mobile-app-sheet-account-danger {
    color: #b42318;
}

@media (max-width: 767px) {
    body {
        padding-bottom: calc(4.25rem + env(safe-area-inset-bottom));
    }

    .site-topbar .topbar-mobile-actions,
    .site-topbar .topbar-mobile-menu {
        display: none !important;
    }

    .site-topbar > .topbar-shell > .topbar-row {
        justify-content: flex-start;
    }

    .subscription-promo-region {
        bottom: calc(4.55rem + env(safe-area-inset-bottom)) !important;
    }
}

[data-theme="dark"] .mobile-app-navigation {
    --mobile-nav-surface: rgba(10, 22, 16, .97);
    --mobile-nav-sheet: #0d1a14;
    --mobile-nav-border: #2c4237;
    --mobile-nav-ink: #e3ede7;
    --mobile-nav-muted: #8fa198;
    --mobile-nav-primary: #6ee7b7;
    --mobile-nav-primary-soft: rgba(52, 211, 153, .11);
}

[data-theme="dark"] .mobile-app-tabbar {
    box-shadow: 0 -8px 28px rgba(0, 0, 0, .34);
}

[data-theme="dark"] .mobile-app-live-badge {
    border-color: #0a1610;
}

[data-theme="dark"] .mobile-app-sheet-handle {
    background: #4a6256;
}

[data-theme="dark"] .mobile-app-sheet-close,
[data-theme="dark"] .mobile-app-sheet-actions > button,
[data-theme="dark"] .mobile-app-sheet-links,
[data-theme="dark"] .mobile-app-sheet-account > a {
    border-color: var(--mobile-nav-border);
    color: #c6d4cc;
    background: #111f18;
}

[data-theme="dark"] .mobile-app-sheet-links > a {
    border-color: #263b30;
    color: #c6d4cc;
}

[data-theme="dark"] .mobile-app-sheet-links > a > svg {
    color: #91a39a;
}

[data-theme="dark"] .mobile-app-sheet-account .mobile-app-sheet-account-primary {
    border-color: #13a875;
    color: #effcf5;
    background: #087a55;
}

[data-theme="dark"] .mobile-app-sheet-account .mobile-app-sheet-account-danger {
    color: #fca5a5;
}

@media (prefers-reduced-motion: reduce) {
    .mobile-app-navigation *,
    .mobile-app-navigation *::before,
    .mobile-app-navigation *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
