/*
  21ZHAO Scroll Timeline & Navigation Scrollbar
  Designed with glassmorphism, adaptive theme variables, and premium micro-interactions.
*/

/* Timeline Container */
.scroll-timeline-container {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 9999;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  user-select: none;
  pointer-events: none; /* Let pointer events pass to child elements */
}

/* Timeline Track */
.scroll-timeline-track {
  position: relative;
  width: 2px;
  height: 260px;
  background: rgba(160, 176, 205, 0.16);
  border-radius: var(--radius-full, 999px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  pointer-events: auto; /* Enable mouse hover/clicks on the track area */
  padding: 6px 0;
  transition: background 0.3s ease, width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Hovering on timeline broadens the track zone for easier interaction */
.scroll-timeline-track {
  cursor: grab;
}

.scroll-timeline-track:hover {
  width: 4px;
  background: rgba(160, 176, 205, 0.3);
}

/* While dragging the timeline, force grab cursor and disable text selection */
body.timeline-dragging,
body.timeline-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Highlighted Progress line */
.scroll-timeline-progress {
  position: absolute;
  top: 0;
  width: 100%;
  background: linear-gradient(180deg, var(--color-accent-purple, #5b6cff), var(--color-accent-green, #14b8a6));
  height: 0%;
  border-radius: var(--radius-full, 999px);
  box-shadow: 0 0 8px var(--color-accent-purple, rgba(91, 108, 255, 0.5));
  pointer-events: none;
}

/* Individual node anchor dots */
.scroll-timeline-dot {
  position: relative;
  width: 8px;
  height: 8px;
  background: var(--color-text-faint, #94a3b8);
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
  transform: scale(1);
  transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1.2);
}

/* Interactive hover & active node dot style */
.scroll-timeline-track:hover .scroll-timeline-dot {
  background: var(--color-text-tertiary, #64748b);
}

.scroll-timeline-dot:hover,
.scroll-timeline-dot.active {
  background: var(--color-accent-purple, #5b6cff) !important;
  transform: scale(1.6);
  box-shadow: 0 0 10px var(--color-accent-purple, rgba(91, 108, 255, 0.6));
}

/* Active node breathing ring effect */
.scroll-timeline-dot.active::after {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border: 1px solid var(--color-accent-purple, #5b6cff);
  border-radius: 50%;
  animation: pulse-ring 2.2s cubic-bezier(0.215, 0.610, 0.355, 1) infinite;
  pointer-events: none;
}

/* Ring pulse animation keyframe */
@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 1; }
  50% { opacity: 0.5; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Glassmorphism Preview Tooltip Card */
.scroll-timeline-tooltip {
  position: absolute;
  right: 28px;
  width: 210px;
  padding: 14px 16px;
  background: var(--card-bg, rgba(255, 255, 255, 0.82));
  border: 1px solid var(--card-border, rgba(160, 176, 205, 0.24));
  border-radius: var(--radius-md, 16px);
  box-shadow: 0 10px 30px var(--card-shadow, rgba(82, 110, 168, 0.1));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateX(12px) translateY(-50%);
  pointer-events: none; /* Make sure it doesn't block mouse movements */
  transition: 
    opacity 0.25s ease, 
    transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1),
    top 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  color: var(--color-text-primary, #0f172a);
  z-index: 1;
}

.scroll-timeline-tooltip.visible {
  opacity: 1;
  transform: translateX(0) translateY(-50%);
}

.scroll-timeline-tooltip-title {
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 5px;
  letter-spacing: 0.04em;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Bullet icon in front of tooltip title */
.scroll-timeline-tooltip-title::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent-purple, #5b6cff);
  box-shadow: 0 0 4px var(--color-accent-purple, #5b6cff);
}

.scroll-timeline-tooltip-desc {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--color-text-secondary, #475569);
  font-weight: 500;
}

/* Dark theme style overrides */
:root[data-theme="dark"] .scroll-timeline-track {
  background: rgba(248, 250, 252, 0.08);
}
:root[data-theme="dark"] .scroll-timeline-track:hover {
  background: rgba(248, 250, 252, 0.15);
}
:root[data-theme="dark"] .scroll-timeline-dot {
  background: rgba(248, 250, 252, 0.25);
}
:root[data-theme="dark"] .scroll-timeline-tooltip {
  background: rgba(9, 13, 22, 0.82); /* Darker translucent glass background */
  border-color: rgba(248, 250, 252, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

/* Adaptive styles for tablet/mobile screens */
@media (max-width: 1024px) {
  .scroll-timeline-container {
    right: 12px; /* Pull closer to edge on tablet */
  }
}

@media (max-width: 768px) {
  .scroll-timeline-container {
    right: 8px; /* Closer to edge on mobile */
  }
  .scroll-timeline-track {
    height: 210px; /* Shorter track on mobile */
    background: rgba(160, 176, 205, 0.1);
  }
  .scroll-timeline-tooltip {
    right: 20px;
    width: 155px; /* Narrower tooltip card to fit portrait view */
    padding: 10px 12px;
    border-radius: 12px;
  }
  .scroll-timeline-tooltip-title {
    font-size: 0.78rem;
    margin-bottom: 3px;
  }
  .scroll-timeline-tooltip-desc {
    font-size: 0.65rem;
    line-height: 1.4;
  }
}
