/*
 * Put .scroll-column on the content of a grid column. It scrolls its own content and never reaches
 * below the viewport: scroll_column.js sets --scroll-column-top to its distance from the viewport
 * top. Once the page has scrolled it up, it sticks to the top of the viewport. Its parent column
 * has to be as tall as the row, which a Bootstrap .row gives by default. Below md the page scrolls
 * as usual.
 */
/*
 * Not inherited: scroll_column.js changes the value on every page scroll, and an inherited custom
 * property makes the browser recalculate the style of the whole form inside the column each frame.
 */
@property --scroll-column-top {
    syntax: '<length>';
    inherits: false;
    initial-value: 0px;
}

@media (min-width: 768px) {
    /*
     * Reserves the height the column reaches once it sticks. Without it the page ends just below the
     * growing column, so one scroll of the page can never move further than the content below the
     * columns. Scrolling over anything outside a column then feels very slow.
     */
    .row > :has(> .scroll-column) {
        min-height: 100dvh;
    }

    .scroll-column {
        position: sticky;
        top: 0;
        max-height: calc(100dvh - var(--scroll-column-top, 0px));
        overflow-y: auto;
        padding-bottom: 3rem;
        scrollbar-width: none;
        &::-webkit-scrollbar {
            display: none;
        }
    }
}
