/* denovo-kit / scroll.css
   Scroll system: thin scrollbars + auto-fade indicators at the edges
   of scrollable regions. Requires scroll-system.js to toggle the
   .has-more-above / .has-more-below classes. Works on its own
   even if the JS is missing (no fades, but scrolling still works). */

/* Universal scroll container — thin scrollbar, overscroll containment. */
.scroll-box {
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
    overscroll-behavior-y: contain;
}

/* Page-level autohide scrollbar. JS adds .scrolling on activity. */
main {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s;
    overscroll-behavior-y: none;
}
main.scrolling {
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

/* Fade indicators wrapping a .scroll-box. scroll-system.js auto-wraps
   .scroll-box elements in a .scroll-fade-wrap and toggles the classes. */
.scroll-fade-wrap {
    --fade-bg: var(--bg);
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.scroll-fade-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: linear-gradient(transparent, var(--fade-bg));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.scroll-fade-wrap.has-more-below::after { opacity: 1; }
.scroll-fade-wrap::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: linear-gradient(var(--fade-bg), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1;
}
.scroll-fade-wrap.has-more-above::before { opacity: 1; }

/* Containers on raised surfaces override the fade color. */
.on-raised .scroll-fade-wrap { --fade-bg: var(--bg-raised); }

/* Collapse the wrap when its scroll child is hidden. */
.scroll-fade-wrap:has(> [style*="display: none"]),
.scroll-fade-wrap:has(> [style*="display:none"]),
.scroll-fade-wrap:has(> [hidden]) {
    display: none;
}
