/**
 * RMG–NexGN Software - Master Homepage Chapter Navigation & Transition Line
 * 
 * Module: SPRINT HOME-ARCH-01
 * Design System: Nominal B2B Editorial Architecture
 * Behavior: Sticky sub-header navigation at top: 72px, ScrollSpy pill tracking,
 *           smooth horizontal overflow scrolling, and zero content disruption.
 */

/* ==========================================================================
   1. MARKED TRANSITION LINE
   Visual transition anchor matching user reference drawing
   ========================================================================== */
.nx-marked-transition-line {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1320px;
  margin: 32px auto 16px auto;
  padding: 0 24px;
  box-sizing: border-box;
}

.nx-line-bar {
  flex: 1;
  height: 3px;
  background: linear-gradient(90deg, #0284c7 0%, #2563eb 50%, #0284c7 100%);
  border-radius: 4px;
  box-shadow: 0 0 14px rgba(2, 132, 199, 0.45);
  position: relative;
}

.nx-line-node {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0284c7;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 2px #0284c7, 0 2px 8px rgba(2, 132, 199, 0.5);
  flex-shrink: 0;
  z-index: 2;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.nx-line-node:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 3px #0284c7, 0 4px 12px rgba(2, 132, 199, 0.65);
}

.nx-node-start {
  margin-right: -2px;
}

.nx-node-end {
  margin-left: -2px;
}

/* ==========================================================================
   2. STICKY CHAPTER NAVIGATION WRAPPER
   Sticks directly beneath the 72px fixed header (.nom-header)
   ========================================================================== */
.nx-chapter-nav-sticky-wrap {
  position: -webkit-sticky;
  position: sticky;
  top: 72px; /* Matches --nom-header-height */
  z-index: 990;
  width: 100%;
  background: rgba(250, 250, 245, 0.96); /* Matches --nom-bg-primary with high opacity */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  border-bottom: 1px solid rgba(15, 23, 42, 0.09);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.nx-chapter-nav-container {
  display: flex;
  align-items: center;
  max-width: 1360px;
  margin: 0 auto;
  padding: 8px 16px;
  gap: 10px;
  box-sizing: border-box;
}

/* Lead "CHAPTERS" Eyebrow */
.nx-chapter-lead-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 9999px;
  flex-shrink: 0;
}

.nx-chapter-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25);
  animation: nxChapterPulse 2s infinite ease-in-out;
}

@keyframes nxChapterPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.6;
  }
}

.nx-chapter-label-text {
  font-family: var(--font-mono, 'SF Mono', Consolas, monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--nom-ink-secondary, #4a4a4a);
  text-transform: uppercase;
}

/* Scroll Arrow Buttons */
.nx-chapter-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 50%;
  color: var(--nom-ink-primary, #111111);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
}

.nx-chapter-arrow:hover:not(:disabled) {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  transform: scale(1.05);
}

.nx-chapter-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* Horizontal Track */
.nx-chapter-track {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  padding: 4px 2px;
  flex: 1;
  mask-image: linear-gradient(to right, transparent, black 12px, black calc(100% - 12px), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 12px, black calc(100% - 12px), transparent);
}

.nx-chapter-track::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Chapter Tab Links */
.nx-chapter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 9999px;
  font-family: var(--font-sans, 'Inter', -apple-system, sans-serif);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--nom-ink-secondary, #4a4a4a);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nx-tab-num {
  font-family: var(--font-mono, 'SF Mono', Consolas, monospace);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--nom-ink-muted, #737373);
  transition: color 0.2s ease;
}

.nx-tab-text {
  letter-spacing: -0.01em;
}

/* Tab Hover State */
.nx-chapter-tab:hover {
  color: var(--nom-ink-primary, #111111);
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.08);
}

/* Tab Active / Selected State */
.nx-chapter-tab.active,
.nx-chapter-tab[aria-current="true"],
.nx-chapter-tab[aria-selected="true"] {
  background: #0f172a; /* Deep graphite */
  color: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
}

.nx-chapter-tab.active .nx-tab-num,
.nx-chapter-tab[aria-current="true"] .nx-tab-num,
.nx-chapter-tab[aria-selected="true"] .nx-tab-num {
  color: #38bdf8; /* Luminous sky blue */
}

/* Focus Visible for Accessibility */
.nx-chapter-tab:focus-visible,
.nx-chapter-arrow:focus-visible {
  outline: 2px solid #0284c7;
  outline-offset: 2px;
}

/* ==========================================================================
   3. SCROLL-MARGIN-TOP OFFSET RULES
   Prevents sticky header + sticky chapter nav from overlapping section headers
   72px (header) + 54px (nav) + 18px (buffer) = 144px
   ========================================================================== */
#solutions-action,
#capabilities,
#erp-ecosystem,
#business-workflow,
#agentic-automation,
#commercial-journey,
#integrations,
#products,
#partners,
#trust,
#academy,
#locations {
  scroll-margin-top: 144px !important;
}

/* ==========================================================================
   4. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 991px) {
  .nx-chapter-nav-sticky-wrap {
    top: 72px;
  }
  .nx-chapter-lead-label {
    display: none; /* Conserve horizontal room on tablet */
  }
  .nx-chapter-nav-container {
    padding: 6px 12px;
    gap: 6px;
  }
  .nx-chapter-tab {
    padding: 5px 11px;
    font-size: 0.78rem;
  }
}

@media (max-width: 640px) {
  .nx-chapter-nav-sticky-wrap {
    top: 64px; /* On smaller mobile headers */
  }
  .nx-marked-transition-line {
    margin: 24px auto 12px auto;
    padding: 0 16px;
  }
  .nx-chapter-arrow {
    display: none; /* Pure touch-scroll on mobile */
  }
  .nx-chapter-track {
    mask-image: none;
    -webkit-mask-image: none;
    padding: 4px 0;
  }
  #solutions-action,
  #capabilities,
  #erp-ecosystem,
  #business-workflow,
  #agentic-automation,
  #commercial-journey,
  #integrations,
  #products,
  #partners,
  #trust,
  #academy,
  #locations {
    scroll-margin-top: 124px !important;
  }
}
