/* ReptiVibe mobile navigation · v5 */
#rv-mobile-button,
#rv-mobile-overlay,
#rv-mobile-drawer {
    display: none;
}

@media (max-width: 900px) {
    html,
    body {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    body.rv-mobile-open {
        overflow: hidden !important;
        overscroll-behavior: none;
        touch-action: none;
    }

    #rv-mobile-button {
        position: fixed;
        z-index: 2147483000;
        top: max(10px, env(safe-area-inset-top));
        right: max(10px, env(safe-area-inset-right));
        display: grid;
        place-items: center;
        width: 48px;
        height: 48px;
        padding: 0;
        border: 1px solid rgba(215, 170, 67, .42);
        border-radius: 15px;
        background: linear-gradient(145deg, rgba(30, 31, 45, .98), rgba(15, 17, 26, .98));
        color: #f7e7b0;
        box-shadow: 0 10px 28px rgba(0, 0, 0, .34), inset 0 0 20px rgba(215, 170, 67, .06);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    #rv-mobile-button:focus-visible,
    .rv-mobile-close:focus-visible,
    .rv-mobile-item:focus-visible,
    .rv-mobile-animals-toggle:focus-visible,
    .rv-mobile-animal:focus-visible {
        outline: 2px solid var(--accent, #d7aa43);
        outline-offset: 2px;
    }

    .rv-mobile-burger {
        display: grid;
        gap: 5px;
        width: 23px;
    }

    .rv-mobile-burger i {
        display: block;
        width: 100%;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
        transition: transform .2s ease, opacity .2s ease;
    }

    body.rv-mobile-open .rv-mobile-burger i:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    body.rv-mobile-open .rv-mobile-burger i:nth-child(2) { opacity: 0; }
    body.rv-mobile-open .rv-mobile-burger i:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    #rv-mobile-overlay {
        position: fixed;
        z-index: 2147483001;
        inset: 0;
        display: block;
        background: rgba(3, 5, 10, .68);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        backdrop-filter: blur(5px);
        transition: opacity .22s ease, visibility .22s ease;
    }

    #rv-mobile-drawer {
        position: fixed;
        z-index: 2147483002;
        top: 0;
        right: 0;
        bottom: 0;
        display: flex;
        flex-direction: column;
        width: min(360px, calc(100vw - 38px));
        max-width: 90vw;
        padding: max(13px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
        overflow: hidden;
        background:
            radial-gradient(circle at 88% 4%, rgba(215, 170, 67, .10), transparent 28%),
            radial-gradient(circle at 10% 80%, rgba(78, 205, 196, .06), transparent 32%),
            #0d1018;
        color: #f7f5ef;
        border-left: 1px solid rgba(215, 170, 67, .20);
        box-shadow: -24px 0 70px rgba(0, 0, 0, .48);
        transform: translate3d(105%, 0, 0);
        visibility: hidden;
        pointer-events: none;
        transition: transform .24s cubic-bezier(.2,.8,.2,1), visibility .24s ease;
    }

    body.rv-mobile-open #rv-mobile-overlay {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    body.rv-mobile-open #rv-mobile-drawer {
        transform: translate3d(0, 0, 0);
        visibility: visible;
        pointer-events: auto;
    }

    .rv-mobile-header {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 2px 0 13px;
        border-bottom: 1px solid rgba(215, 170, 67, .16);
    }

    .rv-mobile-drawer-brand {
        display: flex;
        align-items: center;
        min-width: 0;
        gap: 11px;
    }

    .rv-mobile-drawer-brand img {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        border-radius: 50%;
        object-fit: contain;
        filter: drop-shadow(0 0 7px rgba(34, 240, 215, .38));
    }

    .rv-mobile-drawer-brand > span {
        min-width: 0;
        display: grid;
        gap: 4px;
    }

    .rv-mobile-drawer-brand strong {
        font-family: 'Playfair Display', Georgia, serif;
        font-size: 21px;
        line-height: 1;
        letter-spacing: .2px;
        color: #fff;
    }

    .rv-mobile-drawer-brand strong span { color: #d7aa43; }

    .rv-mobile-drawer-brand small {
        color: #9298aa;
        font: 700 9px/1.1 'Montserrat', sans-serif;
        letter-spacing: .09em;
        text-transform: uppercase;
    }

    .rv-mobile-close {
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
        padding: 0 0 3px;
        border: 1px solid rgba(255, 255, 255, .10);
        border-radius: 12px;
        background: rgba(255, 255, 255, .055);
        color: #f4f4f1;
        font: 300 29px/1 Arial, sans-serif;
        cursor: pointer;
    }

    .rv-mobile-content {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 14px 2px 3px 0;
        scrollbar-width: thin;
        scrollbar-color: rgba(215, 170, 67, .42) transparent;
    }

    .rv-mobile-content::-webkit-scrollbar { width: 5px; }
    .rv-mobile-content::-webkit-scrollbar-thumb { background: rgba(215, 170, 67, .42); border-radius: 999px; }

    .rv-mobile-section {
        display: grid;
        gap: 7px;
        margin: 0 0 17px;
    }

    .rv-mobile-section-title {
        margin: 0 6px 1px;
        color: #858da1;
        font: 800 10px/1.2 'Montserrat', sans-serif;
        letter-spacing: .11em;
        text-transform: uppercase;
    }

    .rv-mobile-list {
        display: grid;
        gap: 6px;
    }

    .rv-mobile-item,
    .rv-mobile-animals-toggle {
        width: 100%;
        min-height: 48px;
        display: grid;
        grid-template-columns: 30px minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        padding: 9px 12px;
        border: 1px solid rgba(255, 255, 255, .09);
        border-radius: 13px;
        background: rgba(255, 255, 255, .035);
        color: #f2f2ee;
        text-align: left;
        font: 720 13px/1.25 'Montserrat', sans-serif;
        cursor: pointer;
        transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
    }

    .rv-mobile-item:active,
    .rv-mobile-animals-toggle:active { transform: scale(.985); }

    .rv-mobile-item.active {
        border-color: rgba(215, 170, 67, .48);
        background: linear-gradient(90deg, rgba(215, 170, 67, .15), rgba(78, 205, 196, .055));
        color: #ffe8a0;
        box-shadow: inset 3px 0 0 #d7aa43;
    }

    .rv-mobile-icon {
        width: 28px;
        height: 28px;
        display: grid;
        place-items: center;
        border-radius: 9px;
        background: rgba(215, 170, 67, .075);
        color: #ddbc63;
    }

    .rv-mobile-icon svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .rv-mobile-item-label {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .rv-mobile-badge {
        min-width: 24px;
        height: 24px;
        display: grid;
        place-items: center;
        padding: 0 7px;
        border-radius: 999px;
        background: rgba(215, 170, 67, .11);
        color: #d9bd70;
        font: 800 10px/1 'Montserrat', sans-serif;
    }

    .rv-mobile-animals-toggle {
        grid-template-columns: 30px minmax(0, 1fr) auto 17px;
    }

    .rv-mobile-chevron {
        color: #9da3b1;
        font-size: 18px;
        line-height: 1;
        transform: rotate(0deg);
        transition: transform .18s ease;
    }

    .rv-mobile-animals-toggle[aria-expanded="true"] .rv-mobile-chevron { transform: rotate(180deg); }

    .rv-mobile-animal-list {
        display: grid;
        gap: 5px;
        padding: 6px 0 0 14px;
    }

    .rv-mobile-animal-list[hidden] { display: none !important; }

    .rv-mobile-animal {
        width: 100%;
        min-height: 42px;
        display: grid;
        grid-template-columns: 12px minmax(0, 1fr);
        align-items: center;
        gap: 9px;
        padding: 8px 11px;
        border: 1px solid rgba(255, 255, 255, .075);
        border-radius: 11px;
        background: rgba(255, 255, 255, .025);
        color: #c6cad3;
        text-align: left;
        font: 650 12px/1.25 'Montserrat', sans-serif;
        cursor: pointer;
    }

    .rv-mobile-animal span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .rv-mobile-animal-mark {
        width: 8px;
        height: 8px;
        border: 1px solid #777e91;
        border-radius: 50%;
    }

    .rv-mobile-animal.active {
        border-color: rgba(78, 205, 196, .30);
        background: rgba(78, 205, 196, .07);
        color: #e7fffc;
    }

    .rv-mobile-animal.active .rv-mobile-animal-mark {
        border-color: #4ecdc4;
        background: #4ecdc4;
        box-shadow: 0 0 9px rgba(78, 205, 196, .55);
    }

    .rv-mobile-empty {
        padding: 10px 12px;
        border: 1px dashed rgba(255, 255, 255, .10);
        border-radius: 11px;
        color: #8d94a5;
        font: 600 11px/1.4 'Montserrat', sans-serif;
    }

    /* Public header: emblem and ReptiVibe stay on one line. */
    .public-header .public-header-inner,
    .legal-header .public-header-inner {
        width: 100% !important;
        min-height: 68px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
        padding: 8px 68px 8px 14px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    .public-header .public-brand,
    .legal-header .public-brand {
        min-width: 0 !important;
        display: inline-flex !important;
        flex: 0 1 auto !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 0 !important;
    }

    .public-header .public-brand > img,
    .legal-header .public-brand > img {
        width: 42px !important;
        height: 42px !important;
        flex: 0 0 42px !important;
    }

    .public-header .public-brand .brand-wordmark,
    .legal-header .public-brand .brand-wordmark {
        display: inline-flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: baseline !important;
        white-space: nowrap !important;
        font-size: 25px !important;
        line-height: 1 !important;
    }

    .public-header .public-nav,
    .legal-header .public-nav,
    .public-header .public-login-button,
    .legal-header .public-login-button {
        display: none !important;
    }

    .public-header .public-header-actions,
    .legal-header .public-header-actions {
        flex: 0 0 auto !important;
        margin-left: auto !important;
    }

    /* Cabinet header: keep only brand, theme and the dedicated menu button. */
    .app-container.visible .header .header-inner {
        width: 100% !important;
        min-height: 68px !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 8px 68px 8px 14px !important;
        box-sizing: border-box !important;
    }

    .app-container.visible .header-brand {
        min-width: 0 !important;
        flex: 0 1 auto !important;
        display: inline-flex !important;
        flex-wrap: nowrap !important;
        gap: 10px !important;
    }

    .app-container.visible .header-brand .logo-img-header {
        width: 42px !important;
        height: 42px !important;
        flex: 0 0 42px !important;
    }

    .app-container.visible .header-brand .brand-wordmark {
        display: inline-flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        white-space: nowrap !important;
        font-size: 24px !important;
    }

    .app-container.visible .header-nav { display: none !important; }

    .app-container.visible .header-actions {
        min-width: 40px !important;
        flex: 0 0 auto !important;
        display: flex !important;
        margin-left: auto !important;
        gap: 0 !important;
    }

    .app-container.visible .header-actions > :not(.theme-toggle-app) {
        display: none !important;
    }

    .app-container.visible .theme-toggle-app,
    .public-header .theme-toggle-public,
    .legal-header .theme-toggle-public,
    .reading-header .theme-toggle {
        display: inline-flex !important;
        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        border-radius: 12px !important;
    }

    .theme-toggle-label { display: none !important; }

    /* Long article pages. */
    .reading-header .reading-header-inner {
        width: 100% !important;
        min-height: 68px !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 8px 68px 8px 14px !important;
        box-sizing: border-box !important;
    }

    .reading-header .reading-brand {
        min-width: 0 !important;
        flex: 0 1 auto !important;
        display: inline-flex !important;
        flex-wrap: nowrap !important;
        gap: 10px !important;
    }

    .reading-header .reading-brand img {
        width: 42px !important;
        height: 42px !important;
        flex: 0 0 42px !important;
    }

    .reading-header .reading-brand .brand-wordmark {
        font-size: 24px !important;
        white-space: nowrap !important;
    }

    .reading-header .reading-nav { display: none !important; }
    .reading-header .reading-header-actions { margin-left: auto !important; }

    /* Undo every legacy mobile-menu hiding class from previous hotfixes. */
    .rv-mobile-moved,
    .rv-mobile-brand-keep,
    .rv-mobile-theme-keep {
        visibility: revert !important;
        opacity: revert !important;
        pointer-events: revert !important;
    }

    .rv-mobile-empty-bar {
        width: revert !important;
        height: revert !important;
        overflow: visible !important;
    }

    html[data-theme="light"] #rv-mobile-button {
        border-color: rgba(70, 74, 145, .42);
        background: linear-gradient(145deg, #f8fafc, #e4e8ed);
        color: #363a7d;
        box-shadow: 0 10px 26px rgba(43, 50, 65, .20), inset 0 0 18px rgba(70, 74, 145, .06);
    }

    html[data-theme="light"] #rv-mobile-overlay { background: rgba(31, 38, 51, .48); }

    html[data-theme="light"] #rv-mobile-drawer {
        background:
            radial-gradient(circle at 88% 4%, rgba(70, 74, 145, .10), transparent 28%),
            radial-gradient(circle at 10% 80%, rgba(38, 111, 122, .06), transparent 32%),
            #edf1f4;
        color: #252a35;
        border-left-color: rgba(70, 74, 145, .18);
        box-shadow: -22px 0 62px rgba(42, 50, 63, .24);
    }

    html[data-theme="light"] .rv-mobile-header { border-bottom-color: rgba(70, 74, 145, .16); }
    html[data-theme="light"] .rv-mobile-drawer-brand strong { color: #292d39; }
    html[data-theme="light"] .rv-mobile-drawer-brand strong span { color: #4b4f91; }
    html[data-theme="light"] .rv-mobile-drawer-brand small,
    html[data-theme="light"] .rv-mobile-section-title { color: #667080; }
    html[data-theme="light"] .rv-mobile-drawer-brand img { filter: drop-shadow(0 0 7px rgba(70, 74, 145, .35)); }

    html[data-theme="light"] .rv-mobile-close {
        border-color: rgba(63, 75, 90, .13);
        background: rgba(255, 255, 255, .65);
        color: #303745;
    }

    html[data-theme="light"] .rv-mobile-item,
    html[data-theme="light"] .rv-mobile-animals-toggle {
        border-color: rgba(65, 78, 94, .14);
        background: rgba(255, 255, 255, .58);
        color: #303643;
    }

    html[data-theme="light"] .rv-mobile-item.active {
        border-color: rgba(70, 74, 145, .40);
        background: linear-gradient(90deg, rgba(70, 74, 145, .13), rgba(38, 111, 122, .045));
        color: #303477;
        box-shadow: inset 3px 0 0 #464a91;
    }

    html[data-theme="light"] .rv-mobile-icon {
        background: rgba(70, 74, 145, .08);
        color: #4b4f91;
    }

    html[data-theme="light"] .rv-mobile-badge {
        background: rgba(70, 74, 145, .09);
        color: #4b4f91;
    }

    html[data-theme="light"] .rv-mobile-animal {
        border-color: rgba(65, 78, 94, .12);
        background: rgba(255, 255, 255, .42);
        color: #596271;
    }

    html[data-theme="light"] .rv-mobile-animal.active {
        border-color: rgba(38, 111, 122, .25);
        background: rgba(38, 111, 122, .075);
        color: #274e57;
    }

    html[data-theme="light"] .rv-mobile-empty {
        border-color: rgba(65, 78, 94, .17);
        color: #6d7582;
    }
}

@media (max-width: 380px) {
    .public-header .public-header-inner,
    .legal-header .public-header-inner,
    .app-container.visible .header .header-inner,
    .reading-header .reading-header-inner {
        padding-left: 10px !important;
        padding-right: 64px !important;
    }

    .public-header .public-brand > img,
    .legal-header .public-brand > img,
    .app-container.visible .header-brand .logo-img-header,
    .reading-header .reading-brand img {
        width: 38px !important;
        height: 38px !important;
        flex-basis: 38px !important;
    }

    .public-header .public-brand .brand-wordmark,
    .legal-header .public-brand .brand-wordmark,
    .app-container.visible .header-brand .brand-wordmark,
    .reading-header .reading-brand .brand-wordmark {
        font-size: 21px !important;
    }

    #rv-mobile-button {
        right: max(8px, env(safe-area-inset-right));
        width: 46px;
        height: 46px;
    }
}

@media (min-width: 901px) {
    #rv-mobile-button,
    #rv-mobile-overlay,
    #rv-mobile-drawer {
        display: none !important;
    }
}
