/* Custom Scroll — 네이티브 바 숨김 + 레일/썸 UI */

.cs-rail {
  --cs-size: 2px;
  --cs-size-hover: 10px;
  --cs-hit: 14px;
  --cs-fade: rgba(255, 255, 255, 0.96);
  position: absolute;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  box-sizing: border-box;
}

.cs-rail.is-cs-scrolling,
.cs-rail.is-cs-hover,
.cs-rail.is-cs-dragging {
  opacity: 1;
  pointer-events: auto;
}

.cs-rail--x {
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--cs-hit);
  display: flex;
  align-items: flex-end;
}

.cs-rail--y {
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--cs-hit);
  display: flex;
  justify-content: flex-end;
}

.cs-rail--page {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--cs-hit);
  z-index: 9998;
  pointer-events: auto;
  opacity: 0;
}

.cs-rail--page.is-cs-scrolling,
.cs-rail--page.is-cs-hover,
.cs-rail--page.is-cs-dragging {
  opacity: 1;
}

.cs-thumb {
  background-color: rgba(18, 20, 22, 0.3);
  border-radius: 0;
  will-change: transform, width, height;
  transition:
    width 0.15s ease,
    height 0.15s ease,
    background-color 0.15s ease;
  flex-shrink: 0;
}

.cs-rail--y .cs-thumb {
  width: var(--cs-size);
  height: 40px;
}

.cs-rail--x .cs-thumb {
  height: var(--cs-size);
  width: 40px;
}

.cs-rail.is-cs-hover .cs-thumb,
.cs-rail.is-cs-dragging .cs-thumb {
  background-color: rgba(18, 20, 22, 0.55);
}

.cs-rail--y.is-cs-hover .cs-thumb,
.cs-rail--y.is-cs-dragging .cs-thumb {
  width: var(--cs-size-hover);
}

.cs-rail--x.is-cs-hover .cs-thumb,
.cs-rail--x.is-cs-dragging .cs-thumb {
  height: var(--cs-size-hover);
}

.cs-rail[data-cs-theme="dark"] .cs-thumb,
[data-cs-theme="dark"] > .cs-rail .cs-thumb {
  background-color: rgba(255, 255, 255, 0.3);
}

.cs-rail[data-cs-theme="dark"].is-cs-hover .cs-thumb,
.cs-rail[data-cs-theme="dark"].is-cs-dragging .cs-thumb,
[data-cs-theme="dark"] > .cs-rail.is-cs-hover .cs-thumb,
[data-cs-theme="dark"] > .cs-rail.is-cs-dragging .cs-thumb {
  background-color: rgba(255, 255, 255, 0.55);
}

.cs-shell {
  position: relative;
  --cs-fade: rgba(255, 255, 255, 0.96);
}

.cs-shell.has-more-right::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4.5rem;
  pointer-events: none;
  z-index: 5;
  background: linear-gradient(
    to left,
    var(--cs-fade) 0%,
    rgba(255, 255, 255, 0) 100%
  );
}

/* position 은 JS ensureRelative 가 static 일 때만 relative 로 지정.
   CSS 로 relative 를 강제하면 fixed 모달이 깨진다. */
.cs-rail-root {
  /* marker class only */
}

/* 네이티브 스크롤바 숨김 (커스텀 호스트 / 페이지) */
.cs-host,
.cs-page {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cs-host::-webkit-scrollbar,
.cs-page::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

html.cs-page,
html.cs-page body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html.cs-page::-webkit-scrollbar,
html.cs-page body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* 모달 열림 — 페이지 스크롤/페이지 레일 숨김 */
html.cs-modal-open,
html.cs-modal-open body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

html.cs-modal-open .cs-rail--page {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
