/* ============================================================
   JUST WORKS STUDIOS: THEMED SCROLLBAR
   Drop-in file. Add to <head> AFTER your main stylesheet:
     <link rel="stylesheet" href="jw-scrollbar.css">

   - Horizontal side-scrolling is removed on the page.
   - Vertical scrollbar becomes a slim "bookmark ribbon" in the
     product accent colour (Fabellor amber by default).
   - Wide blocks (code, tables) keep their own scroll, styled to match.

   To follow each product's colour from docs-data.js, run this
   once when a product page is shown (JW_DOCS.fabellor.color etc.):
     document.documentElement.style.setProperty('--jw-accent', product.color);
   ============================================================ */

:root {
  --jw-accent: #e8a33d;
  --jw-track: rgba(255, 255, 255, 0.04);
  --jw-edge: rgba(255, 255, 255, 0.06);
}

/* Cream (light) theme: darker track so the ribbon is visible */
@media (prefers-color-scheme: light) {
  :root {
    --jw-track: rgba(31, 26, 23, 0.07);
    --jw-edge: rgba(31, 26, 23, 0.35);
  }
}

/* 1. No side-scrolling on the page */
html {
  overflow-x: hidden;
  max-width: 100%;
}

/* "clip" hides sideways overflow WITHOUT turning <body> into a scroll
   container, so the sticky top menu keeps sticking. */
body {
  overflow-x: clip;
  max-width: 100%;
}

/* Images and media never push the page sideways */
img,
video,
iframe {
  max-width: 100%;
}

/* 2. Themed scrollbar (Chrome, Edge, Safari, Opera) */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--jw-track);
  border-left: 1px solid var(--jw-edge);
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 8px 8px 2px 2px; /* ribbon-style: soft top, flat tail */
  background-color: var(--jw-accent);
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0) 45%,
    rgba(0, 0, 0, 0.3) 100%
  );
}

::-webkit-scrollbar-thumb:hover {
  background-color: color-mix(in srgb, var(--jw-accent) 82%, white);
}

::-webkit-scrollbar-thumb:active {
  background-color: color-mix(in srgb, var(--jw-accent) 75%, black);
}

::-webkit-scrollbar-button {
  display: none;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* 3. Firefox and any browser without ::-webkit-scrollbar */
@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--jw-accent) transparent;
  }
}
