@import 'styles/_functions';

html:not(.has-scroll-init) {
  overflow: hidden;
}

html.has-scroll-smooth {
  overflow: hidden;
  overflow: clip;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

html:not(.has-scroll-smooth) {
  [data-scroll-section] {
    transform: unset !important;
  }
}

html.has-scroll-dragging {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

html.has-scroll-smooth body {
  overflow: hidden;
  overflow: clip;
}

html.has-scroll-smooth [data-scroll-container] {
  min-height: 100vh;
}

html[data-scroll-direction='horizontal'] [data-scroll-container] {
  height: 100vh;
  display: inline-block;
  white-space: nowrap;
}

html[data-scroll-direction='horizontal'] [data-scroll-section] {
  display: inline-block;
  vertical-align: top;
  white-space: nowrap;
  height: 100%;
}

.c-scrollbar {
  position: absolute;
  right: 0;
  top: 0;
  width: 10px;
  height: 100%;
  z-index: 999;
}

html[data-scroll-direction='horizontal'] .c-scrollbar {
  width: 100%;
  height: 10px;
  top: auto;
  bottom: 0;
}

.c-scrollbar_thumb {
  position: absolute;
  top: 0;
  right: 0;
  background: red;
  cursor: grab;
  width: 9px;
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 16px;
}

html.has-scroll-dragging .c-scrollbar_thumb {
  cursor: grabbing;
}

html[data-scroll-direction='horizontal'] .c-scrollbar_thumb {
  right: auto;
  bottom: 0;
}

[data-scroll-section] {
  position: relative;
}

// custom scrollbar even on native scroll
@include desktop {
  html {
    overflow: overlay;
    &::-webkit-scrollbar {
      /* This is more usable for users trying to click it. */
      background-color: rgba(0, 0, 0, 0);
      -webkit-border-radius: 100px;
      width: 10px; /* 1px wider than Lion. */
    }

    &::-webkit-scrollbar-thumb:vertical {
      /* This is the EXACT color of Mac OS scrollbars.
       Yes, I pulled out digital color meter */
      background: red;
      background-clip: padding-box;
      border: 2px solid rgba(0, 0, 0, 0);
      -webkit-border-radius: 100px;
      min-height: 10px; /* Prevent it from getting too small */
    }
  }
}
