/* Shared by the web shell and embedded editors. Match the ecommerce prompt's
   light scrollbar; leave each container's overflow and hidden-scrollbar rules intact. */
:root {
  --supercanv-scrollbar-size: 5px;
  --supercanv-scrollbar-length: 240px;
  --supercanv-scrollbar-thumb: #d4d4d4;
  --supercanv-scrollbar-hover: #bdbdbd;
}

:where(*) {
  scrollbar-width: var(--supercanv-scrollbar-width, thin);
  /* Older feature styles carry their own blue/green colours. This is the shared skin. */
  scrollbar-color: var(--supercanv-scrollbar-color, var(--supercanv-scrollbar-thumb) transparent) !important;
}

@supports selector(::-webkit-scrollbar) {
  /* Native thin/coloured scrollbars bypass WebKit's hidden arrow buttons. */
  :root {
    --supercanv-scrollbar-width: auto;
    --supercanv-scrollbar-color: auto;
  }
}

/* Ecommerce requirements, secondary tools and the portalled writing editor keep native arrows. */
:is(.ecommerce-workspace, .commerce-writer-backdrop) textarea {
  --supercanv-scrollbar-width: thin;
  --supercanv-scrollbar-color: var(--supercanv-scrollbar-thumb) transparent;
}

:where(*)::-webkit-scrollbar {
  width: var(--supercanv-scrollbar-size) !important;
  height: var(--supercanv-scrollbar-size) !important;
  background: transparent !important;
}
:where(*)::-webkit-scrollbar-track,
:where(*)::-webkit-scrollbar-corner {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
:where(*)::-webkit-scrollbar-thumb {
  min-width: 20px;
  min-height: 20px;
  border: 0 !important;
  border-radius: 999px !important;
  background: var(--supercanv-scrollbar-thumb) !important;
  background-clip: padding-box !important;
  box-shadow: none !important;
}
:where(*)::-webkit-scrollbar-thumb:hover {
  background: var(--supercanv-scrollbar-hover) !important;
}
:where(*)::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Archive/library handles use one visible length, independent of result count. */
.supercanv-scroll-content {
  scrollbar-width: none !important;
}
.supercanv-scroll-content::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
}
.supercanv-scrollbar {
  position: fixed;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  touch-action: none;
  user-select: none;
  cursor: pointer;
}
.supercanv-scrollbar[hidden] { display: none; }
.supercanv-scrollbar-thumb {
  position: absolute;
  top: 0;
  right: 0;
  border-radius: 999px;
  background: var(--supercanv-scrollbar-thumb);
  pointer-events: auto;
}
.supercanv-scrollbar[aria-orientation="horizontal"] .supercanv-scrollbar-thumb { top: auto; bottom: 0; left: 0; right: auto; }
.supercanv-scrollbar:is(:hover, :focus-visible) .supercanv-scrollbar-thumb { background: var(--supercanv-scrollbar-hover) !important; }
.supercanv-scrollbar:focus-visible { outline: 1px solid var(--supercanv-scrollbar-hover); outline-offset: 1px; border-radius: 3px; }
