/* ==========================================================================
   Overlay scrollbar (src/js/overlay-scrollbar.js), shared by HMOOD 2.0 and HMOOD Reviews.
   Only with a mouse or another precise pointer that can hover (the script's POINTER_QUERY; keep
   the two in step): there the native page scrollbar is hidden, so the page always has the full
   window width and never shifts, and the thumb floats over the content on a transparent track.
   Touch-first phones and tablets keep the browser's own scroll indicator. Inner scroll areas
   (menus, tables of contents) keep their own scrollbars everywhere.
   ========================================================================== */
@media (hover: hover) and (pointer: fine) {
  html {
    scrollbar-width: none;
  }
  html::-webkit-scrollbar {
    display: none;
  }
}
@media not all and (hover: hover) and (pointer: fine) {
  .oscroll {
    display: none !important;
  }
}

.oscroll {
  /* the thumb's two colours: dark over light backgrounds, light over dark and red ones. The script
     paints the thumb in pieces of these (a hard-stop gradient), split where a section boundary
     crosses it */
  --oscroll-dark: rgba(17, 17, 17, 0.5);
  --oscroll-light: rgba(255, 255, 255, 0.82);
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 190; /* above the header, menus and assistant; below the custom cursor and the page veil */
  width: 24px;
  pointer-events: none;
}
.oscroll[hidden] {
  display: none;
}

.oscroll__thumb {
  position: absolute;
  top: 0;
  right: 10px;
  width: 6px;
  border-radius: 999px;
  background-color: transparent;
  background-image: linear-gradient(var(--oscroll-dark), var(--oscroll-dark));
  opacity: 0;
  translate: 3px 0;
  touch-action: none;
  will-change: transform, opacity;
  /* fading out: unhurried */
  transition:
    opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    translate 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.2s ease;
}
/* a larger grab area than the 6 px it shows */
.oscroll__thumb::before {
  content: '';
  position: absolute;
  inset: -4px -10px -4px -8px;
}

.oscroll.is-visible .oscroll__thumb {
  opacity: 1;
  translate: 0 0;
  pointer-events: auto;
  /* coming in: quick and soft */
  transition:
    opacity 0.18s cubic-bezier(0.2, 0.7, 0.2, 1),
    translate 0.2s cubic-bezier(0.2, 0.7, 0.2, 1),
    width 0.2s ease;
}
.oscroll.is-visible .oscroll__thumb:hover,
.oscroll.is-dragging .oscroll__thumb {
  --oscroll-dark: rgba(17, 17, 17, 0.68);
  --oscroll-light: rgba(255, 255, 255, 0.96);
  width: 8px;
}

/* while dragging, the page neither selects text nor shows other cursors */
html.is-oscroll-dragging,
html.is-oscroll-dragging * {
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* a locked page (open menu or dialog) is not being scrolled */
body.is-locked > .oscroll {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .oscroll__thumb {
    translate: none;
  }
}

@media (forced-colors: active) {
  .oscroll__thumb {
    background: CanvasText !important;
  }
}

@media print {
  .oscroll {
    display: none;
  }
}
