.scroller { --scroller-curtain-color: var(--gray-1); --scroller-curtain-size: min(25%, var(--space-6)); display: flex; flex-direction: column; gap: var(--space-3); position: relative; .content { overflow: auto; /* Contains children's stacking so the bars always sit above them */ isolation: isolate; /* The custom bars overlay the content instead of taking a gutter */ scrollbar-width: none; &::-webkit-scrollbar { display: none; } } &:hover, &:focus-within, &:has([data-dragging="true"]) { .bar { opacity: 1; } } &[data-orientation="vertical"], &[data-orientation="both"] { min-height: 0; .content { flex: 1 1 auto; min-height: 0; padding-bottom: 0; } } &[data-orientation="vertical"] { .content { overflow-x: hidden; overflow-y: auto; } } .curtain { position: absolute; opacity: 0; pointer-events: none; &[data-axis="x"] { top: 0; width: var(--scroller-curtain-size); height: 100%; &[data-side="start"] { left: 0; background: linear-gradient( 90deg, var(--scroller-curtain-color), transparent ); } &[data-side="end"] { right: 0; background: linear-gradient( 90deg, transparent, var(--scroller-curtain-color) ); } } &[data-axis="y"] { left: 0; width: 100%; height: var(--scroller-curtain-size); &[data-side="start"] { top: 0; background: linear-gradient( 180deg, var(--scroller-curtain-color), transparent ); } &[data-side="end"] { bottom: 0; background: linear-gradient( 180deg, transparent, var(--scroller-curtain-color) ); } } } .bar { /* TODO: temporarily hidden */ display: none !important; position: absolute; opacity: 0; transition-duration: var(--duration-brief); &[data-hidden="true"] { display: none; } &[data-axis="x"] { left: 0; right: 0; bottom: 0; height: var(--space-4); } &[data-axis="y"] { top: 0; bottom: 0; right: 0; width: var(--space-4); } .thumb { position: absolute; border-radius: var(--radius-max); background-color: var(--gray-a8); touch-action: none; &:hover, &[data-dragging="true"] { background-color: var(--gray-a10); } } &[data-axis="x"] .thumb { top: var(--space-2); height: var(--space-3); } &[data-axis="y"] .thumb { left: var(--space-2); width: var(--space-3); } } /* Leaves the shared corner to neither bar */ &[data-orientation="both"] { .bar[data-axis="x"] { right: var(--space-4); } .bar[data-axis="y"] { bottom: var(--space-4); } } }