/* Mobile quick access — shared color tokens from ck-theme.css, no additional libraries. */
.ck-mobile-bottom-nav,
.ck-mobile-account-layer { display: none; }

@media (max-width: 991.98px) {
    /* Reserve the visible dock height and a gap when the browser scrolls a focused item. */
    html { scroll-padding-bottom: calc(84px + var(--ck-mobile-visual-bottom, 0px) + env(safe-area-inset-bottom, 0px)); }
    /* A fixed reserve prevents the page footer from disappearing behind the dock. */
    body { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
    body.ck-account-sheet-open { overflow: hidden; }
    /* The fixed contact shortcuts would otherwise overlap the five-tab navigation. */
    .ck-dock { display: none !important; }

    .ck-mobile-bottom-nav, .ck-mobile-bottom-nav * { box-sizing: border-box; }
    .ck-mobile-bottom-nav {
        position: fixed;
        inset-inline: 0;
        /* visualViewport correction for Android/iOS browser toolbars. */
        bottom: var(--ck-mobile-visual-bottom, 0px);
        z-index: 1070;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
        align-items: center;
        grid-auto-rows: minmax(0, 1fr);
        height: calc(76px + env(safe-area-inset-bottom, 0px));
        min-height: calc(76px + env(safe-area-inset-bottom, 0px));
        padding: 5px max(8px, env(safe-area-inset-right, 0px)) calc(5px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
        border-top: 1px solid var(--ck-border);
        background: var(--ck-nav-bg);
        -webkit-backdrop-filter: blur(18px);
        backdrop-filter: blur(18px);
        box-shadow: 0 -12px 28px rgba(0, 0, 0, .12);
        direction: rtl;
    }
    .ck-mobile-bottom-link {
        display: grid;
        grid-template-rows: 26px 18px;
        align-content: center;
        justify-items: center;
        gap: 3px;
        min-width: 0;
        width: 100%;
        height: 62px;
        min-height: 62px;
        padding: 5px 1px;
        border: 1px solid transparent;
        border-radius: 12px;
        background: transparent;
        color: var(--ck-muted);
        text-align: center;
        text-decoration: none;
        font-family: inherit;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: color .16s, background-color .16s, border-color .16s;
    }
    .ck-mobile-bottom-link > i {
        display: block;
        font-size: 1.3rem;
        line-height: 26px;
        height: 26px;
        width: 100%;
        text-align: center;
    }
    .ck-mobile-bottom-link > span {
        display: block;
        width: 100%;
        height: 18px;
        font-size: clamp(.6rem, 2.2vw, .75rem);
        line-height: 18px;
        font-weight: 750;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: clip;
    }
    /* Do not move or hide the dock when active/hovered. The keyboard state is separate. */
    body.ck-mobile-keyboard-open .ck-mobile-bottom-nav { display: none !important; }
    /* Explicitly neutralize generic body a styles, including Safari link reset. */
    .ck-mobile-bottom-nav a.ck-mobile-bottom-link { color: var(--ck-muted); text-decoration: none; }
    .ck-mobile-bottom-nav a.ck-mobile-bottom-link:hover,
    .ck-mobile-bottom-nav a.ck-mobile-bottom-link:focus-visible,
    .ck-mobile-bottom-nav a.ck-mobile-bottom-link.is-active,
    .ck-mobile-bottom-nav a.ck-mobile-bottom-link[aria-expanded="true"],
    .ck-mobile-bottom-link:hover,
    .ck-mobile-bottom-link:focus-visible,
    .ck-mobile-bottom-link.is-active,
    .ck-mobile-bottom-link[aria-expanded="true"] {
        color: var(--ck-primary);
        background: var(--ck-surface-hover);
        border-color: var(--ck-border);
    }
    .ck-mobile-bottom-link:focus-visible,
    .ck-mobile-account-close:focus-visible { outline: 2px solid var(--ck-primary); outline-offset: 2px; }
    /* Account screens use the bottom-sheet navigation instead of a second inline mobile menu. */
    .account-flow main .account-sidebar { display: none !important; }

    .ck-mobile-account-layer {
        position: fixed;
        inset: 0;
        z-index: 1090;
        display: block;
        visibility: hidden;
        pointer-events: none;
    }
    .ck-mobile-account-layer.is-open { visibility: visible; pointer-events: auto; }
    .ck-mobile-account-backdrop {
        position: absolute;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        padding: 0;
        border: none;
        background: rgba(0, 0, 0, .65);
        opacity: 0;
        transition: opacity .22s;
    }
    .ck-mobile-account-layer.is-open .ck-mobile-account-backdrop { opacity: 1; }
    .ck-mobile-account-panel {
        position: absolute;
        inset-block: 0;
        inset-inline-start: 0;
        width: min(390px, calc(100vw - 28px));
        max-width: 100%;
        display: flex;
        flex-direction: column;
        background: var(--ck-bg-2);
        color: var(--ck-text);
        border-inline-end: 1px solid var(--ck-border);
        box-shadow: -20px 0 55px rgba(0, 0, 0, .22);
        transform: translateX(105%);
        transition: transform .24s ease;
        outline: none;
    }
    .ck-mobile-account-layer.is-open .ck-mobile-account-panel { transform: translateX(0); }
    .ck-mobile-account-heading {
        flex: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 66px;
        padding: 14px 18px;
        border-bottom: 1px solid var(--ck-border);
        color: var(--ck-text-heading);
    }
    .ck-mobile-account-heading strong { font-size: 1rem; }
    .ck-mobile-account-close {
        width: 36px;
        height: 36px;
        display: grid;
        place-items: center;
        border: 1px solid var(--ck-border);
        border-radius: 11px;
        background: var(--ck-surface);
        color: var(--ck-text);
        cursor: pointer;
    }
    .ck-mobile-account-content {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 14px 14px calc(20px + env(safe-area-inset-bottom, 0px));
        scrollbar-width: thin;
    }
    .ck-mobile-account-sidebar { display: block; width: 100%; min-width: 0; }
    .ck-mobile-account-sidebar .account-menu { display: block; overflow: visible; border: 0; background: transparent; }
    .ck-mobile-account-sidebar .account-menu-summary { display: none !important; }
    .ck-mobile-account-sidebar .account-menu-panel { display: grid !important; gap: 12px; padding: 0; }
    .ck-mobile-account-sidebar .account-desktop-identity { display: flex !important; }
    .ck-mobile-account-sidebar .account-nav {
        border: 1px solid var(--ck-border);
        border-radius: 16px;
        background: var(--ck-surface);
        padding: 10px;
    }
    /* The same sidebar is opened from *all* public pages, not only /profile.
       Provide drawer-local styles so account-pages.css needn't load sitewide. */
    .ck-mobile-account-sidebar .account-desktop-identity {
        align-items: center; gap: 12px; padding: 12px;
        border: 1px solid var(--ck-border); border-radius: 14px;
        background: var(--ck-surface);
    }
    .ck-mobile-account-sidebar .account-desktop-identity > div { min-width: 0; overflow-wrap: anywhere; }
    .ck-mobile-account-sidebar .account-desktop-identity strong,
    .ck-mobile-account-sidebar .account-desktop-identity span,
    .ck-mobile-account-sidebar .account-desktop-identity small { display: block; }
    .ck-mobile-account-sidebar .account-desktop-identity strong { color: var(--ck-text-heading); font-size: .94rem; }
    .ck-mobile-account-sidebar .account-desktop-identity small,
    .ck-mobile-account-sidebar .account-desktop-identity > div > span { color: var(--ck-muted); font-size: .78rem; }
    .ck-mobile-account-sidebar .account-menu-avatar {
        display: grid; place-items: center; flex: none;
        width: 40px; height: 40px; border-radius: 12px;
        background: var(--ck-surface-hover); color: var(--ck-primary); font-weight: 800;
    }
    .ck-mobile-account-sidebar .account-nav-group { display: grid; gap: 4px; padding-block: 6px; }
    .ck-mobile-account-sidebar .account-nav-group + .account-nav-group { border-top: 1px solid var(--ck-border); }
    .ck-mobile-account-sidebar .account-nav-group-title {
        display: block; padding: 7px 10px; font-size: .75rem;
        color: var(--ck-muted); font-weight: 700;
    }
    .ck-mobile-account-sidebar .account-nav-link {
        min-height: 44px; display: flex; align-items: center; gap: 10px;
        padding: 10px 12px; border-radius: 10px;
        color: var(--ck-text); text-decoration: none; font-size: .86rem;
    }
    .ck-mobile-account-sidebar .account-nav-link:hover,
    .ck-mobile-account-sidebar .account-nav-link.is-active {
        color: var(--ck-primary); background: var(--ck-surface-hover);
    }
    .ck-mobile-account-sidebar .account-nav-link > .account-nav-current { margin-inline-start: auto; }
}

@media (max-width: 359.98px) {
    .ck-mobile-bottom-nav { gap: 1px; padding-inline: 4px; }
    .ck-mobile-bottom-link > span { font-size: .6rem; letter-spacing: -.02em; }
    .ck-mobile-bottom-link > i { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
    .ck-mobile-bottom-link,
    .ck-mobile-account-backdrop,
    .ck-mobile-account-panel { transition: none !important; }
}
