/* Shared by app routes, native dialogs, body portals and standalone pages.
   Keep native scrolling and its full hit area; draw only a fine centre rail. */
:root {
  --terra-scroll-track: #e5dfd2;
  --terra-scroll-thumb: #859276;
  --terra-scroll-hover: #748466;
  --terra-scroll-active: #617251;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--terra-scroll-thumb) var(--terra-scroll-track);
}

/* Chromium uses the standard properties ahead of its pseudo-elements. Reset
   those here so the rounded thumb and removed arrow buttons also take effect. */
@supports selector(::-webkit-scrollbar) {
  @media (forced-colors: none) {
    * { scrollbar-width: auto; scrollbar-color: auto; }
    ::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
    ::-webkit-scrollbar-track {
      margin: 4px 0;
      border-radius: 999px;
      background: linear-gradient(var(--terra-scroll-track), var(--terra-scroll-track)) center / 2px 100% no-repeat;
    }
    ::-webkit-scrollbar-track:horizontal {
      margin: 0 4px;
      background-size: 100% 2px;
    }
    /* Stop modal rails before the rounded corners; page and inset-list rails
       keep their own full scrolling range and native thumb proportions. */
    .nature-dialog::-webkit-scrollbar-track {
      margin: 32px 0;
    }
    .nature-dialog::-webkit-scrollbar-track:horizontal {
      margin: 0 32px;
    }
    ::-webkit-scrollbar-thumb {
      min-height: 36px;
      min-width: 36px;
      border: 2px solid transparent;
      border-radius: 999px;
      background: var(--terra-scroll-thumb);
      background-clip: padding-box;
    }
    ::-webkit-scrollbar-thumb:hover { background-color: var(--terra-scroll-hover); }
    ::-webkit-scrollbar-thumb:active { background-color: var(--terra-scroll-active); }
    ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
    ::-webkit-scrollbar-corner { background: transparent; }
  }
}

@media (forced-colors: active) {
  * { scrollbar-width: auto; scrollbar-color: auto; }
}
