/* Scrollbar modes: native (default), auto-hide, hidden. */
:root {
  --ui-scrollbar-size: 10px;
  --ui-scrollbar-thumb: var(--ui-border-strong);
  --ui-scrollbar-track: transparent;
}

/* Native style for marked scroll containers. */
.ui-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: var(--ui-scrollbar-thumb) var(--ui-scrollbar-track);
}

.ui-scrollbar::-webkit-scrollbar {
  width: var(--ui-scrollbar-size);
  height: var(--ui-scrollbar-size);
}

.ui-scrollbar::-webkit-scrollbar-track {
  background: var(--ui-scrollbar-track);
}

.ui-scrollbar::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--ui-scrollbar-thumb);
  background-clip: content-box;
}

/* Auto: hidden while idle, visible only while scrolling. */
[data-scrollbar="auto"] .ui-scrollbar,
[data-scrollbar="auto"].ui-scrollbar {
  scrollbar-color: transparent transparent;
}

[data-scrollbar="auto"] .ui-scrollbar.is-scrolling,
[data-scrollbar="auto"].ui-scrollbar.is-scrolling {
  scrollbar-color: var(--ui-scrollbar-thumb) transparent;
}

[data-scrollbar="auto"] .ui-scrollbar::-webkit-scrollbar-thumb,
[data-scrollbar="auto"].ui-scrollbar::-webkit-scrollbar-thumb {
  background: transparent;
}

[data-scrollbar="auto"] .ui-scrollbar.is-scrolling::-webkit-scrollbar-thumb,
[data-scrollbar="auto"].ui-scrollbar.is-scrolling::-webkit-scrollbar-thumb {
  background: var(--ui-scrollbar-thumb);
  background-clip: content-box;
}

/* Hidden: only for non-essential containers. */
[data-scrollbar="hidden"] .ui-scrollbar,
[data-scrollbar="hidden"].ui-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

[data-scrollbar="hidden"] .ui-scrollbar::-webkit-scrollbar,
[data-scrollbar="hidden"].ui-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Page-level modes. */
html[data-scrollbar="auto"] {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  scrollbar-gutter: stable;
}

html[data-scrollbar="auto"].is-scrolling {
  scrollbar-color: var(--ui-scrollbar-thumb) transparent;
}

html[data-scrollbar="auto"]::-webkit-scrollbar {
  width: var(--ui-scrollbar-size);
  height: var(--ui-scrollbar-size);
}

html[data-scrollbar="auto"]::-webkit-scrollbar-track {
  background: var(--ui-scrollbar-track);
}

html[data-scrollbar="auto"]::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: transparent;
  background-clip: content-box;
}

html[data-scrollbar="auto"].is-scrolling::-webkit-scrollbar-thumb {
  background: var(--ui-scrollbar-thumb);
  background-clip: content-box;
}

html[data-scrollbar="hidden"] {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html[data-scrollbar="hidden"]::-webkit-scrollbar {
  display: none;
}
