/* ==========================================================================
   Unified Homepage-Exact Liquid Glass Vertical Scroll Ruler (All 8 Projects)
   1:1 Crystal Pearl Capsule + 21 Cosine-Wave Ticks + Crisp Sliding Needle
   + Vertically Tracking Floating Chapter Caption + Light/Dark Auto-Adaptation
   ========================================================================== */

nav.case-page-toc {
  --toc-position: 0;
  --cursor-position: 0;
  position: fixed !important;
  left: 18px !important;
  top: 50% !important;
  bottom: auto !important;
  transform: translateY(-50%) !important;
  z-index: 1000 !important;
  display: block !important;
  width: 36px !important;
  height: 158px !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
  isolation: isolate;
  pointer-events: auto !important;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif !important;
  user-select: none;
  -webkit-user-select: none;
}

nav.case-page-toc .toc-rail {
  position: relative !important;
  display: block !important;
  width: 36px !important;
  height: 158px !important;
  padding: 20px 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  border-radius: 999px !important;
  outline: 0 !important;
  touch-action: none !important;
  cursor: ns-resize !important;
  backdrop-filter: blur(20px) saturate(175%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(175%) !important;
  transition: background 0.32s ease, border-color 0.32s ease, box-shadow 0.32s ease, transform 0.22s ease !important;
}

nav.case-page-toc:hover .toc-rail,
nav.case-page-toc.is-dragging .toc-rail {
  transform: scale(1.04);
}

nav.case-page-toc .toc-rail:focus-visible {
  box-shadow: 0 0 0 2px rgba(76, 110, 245, 0.45), 0 12px 28px rgba(20, 28, 56, 0.12) !important;
}

/* Light Surface: Exact Homepage Crystal Pearl Liquid Glass Capsule */
nav.case-page-toc[data-surface="light"] .toc-rail,
nav.case-page-toc:not([data-surface]) .toc-rail {
  background:
    radial-gradient(ellipse 140% 42% at 50% 18%, rgba(146, 184, 248, 0.2), transparent 70%),
    radial-gradient(ellipse 140% 38% at 50% 82%, rgba(196, 208, 246, 0.18), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(244, 248, 255, 0.66) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.94) !important;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.98),
    inset 0 -1.5px 3px rgba(120, 142, 196, 0.16),
    0 12px 28px rgba(20, 28, 56, 0.09),
    0 2px 6px rgba(20, 28, 56, 0.04) !important;
}

/* Dark / Obsidian Surface: Smoked Glass Adaptation (High-Contrast Ticks Guaranteed) */
nav.case-page-toc[data-surface="dark"] .toc-rail {
  background: linear-gradient(180deg, rgba(36, 38, 48, 0.74) 0%, rgba(18, 20, 26, 0.68) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.24) !important;
  box-shadow:
    inset 0 1.5px 2px rgba(255, 255, 255, 0.22),
    inset 0 -1px 2px rgba(0, 0, 0, 0.28),
    0 12px 30px rgba(0, 0, 0, 0.36),
    0 0 16px rgba(0, 0, 0, 0.14) !important;
}

nav.case-page-toc .toc-ticks {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: space-between !important;
  pointer-events: none !important;
}

nav.case-page-toc .toc-ticks i {
  display: block !important;
  flex-shrink: 0 !important;
  width: 5px;
  height: 1px !important;
  border-radius: 1px !important;
  pointer-events: none !important;
  transition: width 0.08s linear, opacity 0.08s linear, background-color 0.25s ease !important;
}

nav.case-page-toc[data-surface="light"] .toc-ticks i,
nav.case-page-toc:not([data-surface]) .toc-ticks i {
  background: rgba(24, 28, 42, 0.5) !important;
}

nav.case-page-toc[data-surface="dark"] .toc-ticks i {
  background: rgba(255, 255, 255, 0.78) !important;
}

/* Crisp Sliding Needle (Exact Homepage 18px x 2.2px Bar) */
nav.case-page-toc .toc-needle {
  position: absolute !important;
  top: calc(20px + var(--cursor-position, var(--toc-position, 0)) * (100% - 40px)) !important;
  left: 50% !important;
  right: auto !important;
  width: 18px !important;
  height: 2.2px !important;
  border-radius: 999px !important;
  transform: translate(-50%, -50%) !important;
  pointer-events: none !important;
  transition: background-color 0.25s ease, box-shadow 0.25s ease !important;
}

nav.case-page-toc[data-surface="light"] .toc-needle,
nav.case-page-toc:not([data-surface]) .toc-needle {
  background: #14161f !important;
  box-shadow: 0 0 8px rgba(20, 22, 31, 0.28) !important;
}

nav.case-page-toc[data-surface="dark"] .toc-needle {
  background: #ffffff !important;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.85) !important;
}

/* Floating Frosted Chapter Caption Pill Tracking Cursor/Scroll Vertically */
nav.case-page-toc .toc-caption {
  position: absolute !important;
  left: calc(100% + 12px) !important;
  top: calc(20px + var(--cursor-position, var(--toc-position, 0)) * (100% - 40px)) !important;
  transform: translateY(-50%) !important;
  border-radius: 999px !important;
  padding: 5px 12px !important;
  white-space: nowrap !important;
  font-size: 12.5px !important;
  line-height: 18px !important;
  font-weight: 500 !important;
  letter-spacing: 0.01em !important;
  pointer-events: none !important;
  opacity: 0;
  z-index: 3 !important;
  backdrop-filter: blur(18px) saturate(165%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(165%) !important;
  transition: opacity 0.18s ease, background 0.25s ease, color 0.25s ease, border-color 0.25s ease !important;
}

nav.case-page-toc[data-surface="light"] .toc-caption,
nav.case-page-toc:not([data-surface]) .toc-caption {
  background: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid rgba(24, 28, 42, 0.1) !important;
  color: #181b26 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.98), 0 8px 22px rgba(20, 28, 52, 0.1) !important;
}

nav.case-page-toc[data-surface="dark"] .toc-caption {
  background: rgba(20, 20, 24, 0.72) !important;
  border: 1px solid rgba(255, 255, 255, 0.26) !important;
  color: #ffffff !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 8px 22px rgba(0, 0, 0, 0.34) !important;
}

nav.case-page-toc:hover .toc-caption,
nav.case-page-toc:has(:focus-visible) .toc-caption,
nav.case-page-toc.is-dragging .toc-caption,
nav.case-page-toc.is-scrolling .toc-caption {
  opacity: 1 !important;
}

@media (max-width: 1024px) {
  html:not(.gaga-mobile-desktop) nav.case-page-toc {
    left: 10px !important;
  }
}

@media (max-width: 780px) {
  html:not(.gaga-mobile-desktop) nav.case-page-toc {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  nav.case-page-toc,
  nav.case-page-toc .toc-rail,
  nav.case-page-toc .toc-ticks i,
  nav.case-page-toc .toc-caption {
    transition: none !important;
  }
}


/* Mobile Landscape Touch Ergonomics: 42pt drag zone + readable chapter tooltip */
html.gaga-mobile-desktop nav.case-page-toc {
  width: 44px !important;
  height: 184px !important;
}
html.gaga-mobile-desktop nav.case-page-toc .toc-rail {
  width: 44px !important;
  height: 184px !important;
}
html.gaga-mobile-desktop nav.case-page-toc .toc-rail::before {
  content: "";
  position: absolute;
  inset: -12px -14px;
}
html.gaga-mobile-desktop nav.case-page-toc .toc-caption {
  font-size: 17px !important;
  line-height: 22px !important;
  padding: 7px 15px !important;
}
