/* Shared palette for native page, panel and dialog scrollbars on both axes.
 * Module CSS keeps overflow, scrollport geometry and intentional hidden bars.
 */
:root {
    --oz-scrollbar-thumb: var(--oz-ui-primary, #315aca);
    --oz-scrollbar-track: var(--oz-ui-primary-soft, #edf2ff);
    --oz-scrollbar-thumb-hover: var(--oz-ui-primary-hover, #2349b2);
    --oz-scrollbar-nav-thumb: #93c5fd;
    --oz-scrollbar-nav-thumb-hover: #bfdbfe;
}

@media (forced-colors: none) {
    :where(html, body, body *) {
        /* Palette is shared even when a legacy module declares its own color. */
        scrollbar-color: var(--oz-scrollbar-thumb) var(--oz-scrollbar-track) !important;
        scrollbar-width: thin;
    }

    /* Older WebKit/Blink without native scrollbar-color support. */
    @supports not (scrollbar-color: #315aca #edf2ff) {
        :where(html, body, body *)::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        :where(html, body, body *)::-webkit-scrollbar-track,
        :where(html, body, body *)::-webkit-scrollbar-corner {
            background-color: var(--oz-scrollbar-track) !important;
            border-radius: 8px;
        }

        :where(html, body, body *)::-webkit-scrollbar-thumb {
            background-color: var(--oz-scrollbar-thumb) !important;
            border-radius: 8px;
        }

        :where(html, body, body *)::-webkit-scrollbar-thumb:hover {
            background-color: var(--oz-scrollbar-thumb-hover) !important;
        }
    }

    /* The rail uses its existing accessible custom indicator on desktop. */
    .nav-scrollbar-thumb::before {
        background-color: var(--oz-scrollbar-nav-thumb) !important;
    }

    .nav-rail:hover .nav-scrollbar-thumb::before,
    .nav-scrollbar[data-dragging="true"] .nav-scrollbar-thumb::before,
    .nav-scrollbar-thumb:focus-visible::before {
        background-color: var(--oz-scrollbar-nav-thumb-hover) !important;
    }
}

@media (forced-colors: active) {
    :where(html, body, body *) {
        scrollbar-color: auto !important;
    }
}
