/* ==========================================================================
   NEXTGEN TECHEDGE — ARTCRAFT-INSPIRED SCROLL RULER
   Precision Editorial Measurement Ruler & Scrubbed Typographic Motion System
   ========================================================================== */

/* Ruler Container: Fixed flush along extreme right edge */
.scroll-ruler {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 36px;
  z-index: 900;
  pointer-events: none; /* Allows clicks to pass through to underlying content where empty */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  padding: 86px 0 28px 0; /* Flush right border! */
  user-select: none;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.scroll-ruler.is-ready {
  opacity: 1;
}

/* 1. Live Progress Percentage Badge (Top) */
.ruler-progress-badge {
  pointer-events: auto;
  font-family: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--brand-purple);
  background: rgba(255, 255, 255, 0.96);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(132, 38, 176, 0.22);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin-right: 4px;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s, border-color 0.2s;
}

/* 2. Track & Graduations touching right border */
.ruler-track-wrapper {
  position: relative;
  flex: 1;
  width: 100%;
  margin-right: 0;
  display: flex;
  justify-content: flex-end;
  pointer-events: auto;
}

/* Hairline vertical track line touching right border */
.ruler-line {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 1px;
  background: rgba(148, 163, 184, 0.35);
  overflow: hidden;
}

/* Glowing progress line fill */
.ruler-line-fill {
  position: absolute;
  top: 0;
  right: 0;
  width: 2px;
  height: 0%;
  background: linear-gradient(180deg, var(--brand-purple) 0%, var(--brand-fuchsia) 50%, var(--brand-coral) 100%);
  box-shadow: 0 0 8px rgba(184, 28, 140, 0.7);
  transition: height 0.05s linear;
}

/* Ruler Ticks Container */
.ruler-ticks {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 100%;
}

/* Minor, medium, major ticks flush with right edge */
.ruler-tick {
  position: absolute;
  right: 0;
  height: 1px;
  background: rgba(148, 163, 184, 0.40);
  transform: translateY(-50%);
  transition: background-color 0.2s, width 0.2s;
}

.ruler-tick.minor {
  width: 5px;
}

.ruler-tick.medium {
  width: 9px;
  background: rgba(100, 116, 139, 0.55);
}

.ruler-tick.major {
  width: 15px;
  background: rgba(71, 85, 105, 0.75);
}

.ruler-tick.active-tick {
  background: var(--brand-fuchsia);
  box-shadow: 0 0 6px rgba(184, 28, 140, 0.8);
}

/* Numbered graduations (e.g., 00, 25, 50, 75, 100) */
.ruler-grad-num {
  position: absolute;
  right: 18px;
  transform: translateY(-50%);
  font-size: 0.60rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

/* 3. Section Anchor Markers (Clickable dots on track) */
.ruler-section-marker {
  position: absolute;
  right: 1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid rgba(148, 163, 184, 0.65);
  transform: translateY(-50%);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  outline: none;
}

.ruler-section-marker:hover,
.ruler-section-marker:focus-visible {
  border-color: var(--brand-purple);
  transform: translateY(-50%) scale(1.4);
  box-shadow: 0 0 8px rgba(132, 38, 176, 0.6);
}

.ruler-section-marker.is-active {
  background: var(--brand-purple);
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(132, 38, 176, 0.9), 0 0 0 1.5px var(--brand-fuchsia);
  transform: translateY(-50%) scale(1.3);
}

/* Tooltip on marker hover */
.ruler-section-marker .marker-tooltip {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  background: #0f172a;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ruler-section-marker:hover .marker-tooltip,
.ruler-section-marker:focus-visible .marker-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(-4px);
}

/* 4. Moving Typographic Object: The Scroll-Scrubbed Section Title */
.ruler-active-label-stage {
  position: fixed;
  right: 48px; /* Positioned safely to the left of the ruler scale */
  top: 50%;
  pointer-events: none;
  z-index: 910;
  transform: translateY(-50%);
}

.ruler-moving-label {
  display: inline-block;
  white-space: nowrap;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-main);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.95) 100%);
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(132, 38, 176, 0.24);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.09), 0 0 12px rgba(132, 38, 176, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  will-change: transform, opacity;
  transform-origin: right center;
}

.ruler-moving-label .label-kicker {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--brand-fuchsia);
  display: block;
  margin-bottom: 2px;
}

.ruler-moving-label .label-title {
  background: linear-gradient(135deg, #0f172a 0%, #8426b0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

/* 5. Bottom Section List (ArtCraft Style) */
.ruler-bottom-nav {
  position: fixed;
  bottom: 46px;
  right: 38px;
  z-index: 910;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  pointer-events: auto;
  user-select: none;
}

.ruler-nav-item {
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 2px 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0.65;
}

.ruler-nav-item:hover {
  color: var(--brand-purple);
  opacity: 1;
  transform: translateX(-3px);
}

.ruler-nav-item.is-active {
  color: #0f172a;
  font-weight: 800;
  opacity: 1;
  transform: translateX(-5px);
}

.ruler-nav-item.is-active::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand-purple);
  box-shadow: 0 0 8px rgba(132, 38, 176, 0.9);
}

/* Safe right-edge gutter so homepage content never collides with the ruler */
@media (min-width: 1025px) {
  body.has-scroll-ruler .container {
    padding-right: calc(2rem + 64px);
    max-width: 1240px;
  }
}

/* Responsive Handling */
@media (max-width: 1024px) {
  .scroll-ruler {
    width: 28px;
    padding-right: 0;
  }
  .ruler-progress-badge {
    display: none;
  }
  .ruler-active-label-stage {
    display: none;
  }
  .ruler-bottom-nav {
    display: none;
  }
  .ruler-grad-num {
    display: none;
  }
  .ruler-tick.minor {
    display: none;
  }
}

@media (max-width: 768px) {
  .scroll-ruler {
    display: none !important;
  }
  .ruler-active-label-stage {
    display: none !important;
  }
  .ruler-bottom-nav {
    display: none !important;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .ruler-moving-label {
    transform: none !important;
    transition: none !important;
  }
  .ruler-line-fill {
    transition: none !important;
  }
}

/* Hide floating moving label on screens <= 1536px to prevent obscuring card content and links */
@media (max-width: 1536px) {
  .ruler-active-label-stage {
    display: none !important;
  }
}
@media (max-width: 1366px) {
  .ruler-bottom-nav {
    display: none !important;
  }
}
