/* Slysh Editorial - Interactive Scrubber Progress Bar with Live Dragging */

/* Desktop: Vertical Progress Track in Left Margin */
.reading-progress {
  position: fixed;
  left: max(16px, calc((100vw - var(--article-max, 1240px)) / 2 - 46px));
  top: 26vh;
  width: 4px;
  height: 48vh;
  background: #e2e8f0;
  border-radius: 9999px;
  z-index: 100;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
}

.reading-progress > span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #6366f1 0%, #4338ca 100%);
  border-radius: 9999px;
  transform: scaleY(0);
  transform-origin: top;
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.35);
  pointer-events: none;
}

/* Traveling Scrubber Thumb on Desktop */
.reading-progress-thumb {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
  z-index: 102;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
  touch-action: none;
  transition: top 0.06s linear;
}

/* Expanded invisible hit area for effortless grabbing */
.reading-progress-thumb::after {
  content: "";
  position: absolute;
  inset: -14px -12px;
  border-radius: 9999px;
  cursor: inherit;
}

.reading-progress-thumb.is-dragging {
  cursor: grabbing;
  transition: none !important;
}

.reading-progress-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.02em;
  color: #4338ca;
  background: #ffffff;
  border: 1.5px solid #c7d2fe;
  border-radius: 9999px;
  padding: 2px 6px;
  min-width: 34px;
  box-shadow: 0 3px 8px rgba(67, 56, 202, 0.16), 0 1px 2px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  pointer-events: none;
  transition: transform 0.15s ease, background-color 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.reading-progress-thumb:hover .reading-progress-pill,
.reading-progress-thumb.is-dragging .reading-progress-pill {
  transform: scale(1.12);
  background: #4338ca;
  color: #ffffff;
  border-color: #312e81;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.4);
}

/* Tablet & Mobile Layout: Horizontal Scrubber Bar at Top */
@media (max-width: 1099px) {
  .reading-progress {
    left: 0;
    top: 66px;
    width: 100%;
    height: 4px;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  .reading-progress > span {
    transform: scaleX(0);
    transform-origin: left;
    border-radius: 0;
    background: linear-gradient(90deg, #6366f1 0%, #4338ca 100%);
  }

  /* Live traveling pill directly on the progress line */
  .reading-progress-thumb {
    position: absolute;
    top: 50%;
    left: 18px;
    right: auto;
    transform: translate(-50%, -50%);
    transition: left 0.06s linear;
  }

  /* Large touch area for mobile fingers (44px height hit-box) */
  .reading-progress-thumb::after {
    inset: -18px -14px;
  }

  .reading-progress-pill {
    font-size: 10px;
    font-weight: 750;
    padding: 1.5px 6px;
    min-width: 28px;
    background: #ffffff;
    border: 1.5px solid #4338ca;
    box-shadow: 0 2px 6px rgba(67, 56, 202, 0.25);
  }
}

@media (max-width: 700px) {
  .reading-progress {
    top: 60px;
    height: 3px;
  }
}

/* Global cursor lock when scrubbing */
body.is-scrubbing-progress {
  user-select: none;
  -webkit-user-select: none;
  cursor: grabbing !important;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .reading-progress,
  .reading-progress-thumb,
  .reading-progress-pill {
    transition: none !important;
    animation: none !important;
  }
}
