.onpage-nav {
    position: relative;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    background-color: var(--color-base-ghost-white);
    /* Mobile: taller bar per Daniel review (31px → 36px → 40px) */
    min-height: var(--spacing-10); /* O1: 40px (was spacing-9 36px) */
}

/* ==========================
   Inner Wrapper
   ========================== */

.onpage-nav__inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--spacing-3); /* 12px - approximate from Figma */
    padding: var(--spacing-2); /* 8px — arrows closer to the edges (Daniel) */
    height: var(--spacing-10); /* O1: 40px (was spacing-9 36px) */
    max-width: 950px; /* Max content width */
    margin: 0 auto; /* Center the content */
    width: 100%; /* Ensure it takes full width up to max-width */
    overflow: visible; /* Ensure content isn't clipped */
}

/* ==========================
   Navigation List
   ========================== */

.onpage-nav__list {
    display: flex;
    align-items: center;
    gap: var(--spacing-5); /* 20px - from Figma gap */
    list-style: none;
    margin: 0;
    padding: 0 var(--spacing-2); /* Add horizontal padding to prevent cutoff on both sides */
    overflow-x: auto;
    overflow-y: hidden;
    /* scroll-behavior: smooth; — Removed: jQuery handles smooth scrolling */
    flex: 1;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.onpage-nav__list::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* ==========================
   Navigation Items
   ========================== */

.onpage-nav__item {
    font-size: var(--font-size-p3-caption);
    flex-shrink: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ==========================
   Navigation Links
   ========================== */

.onpage-nav__link {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-family-paragraph);
    font-weight: var(--font-weight-medium);
    /* Mobile: 11px from Figma P3 caption */
    font-size: var(--font-size-p3-caption);
    line-height: var(--line-height-p3-caption);
    color: var(--color-default-text);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: color 250ms ease;
    position: relative;
}

.onpage-nav__link:hover {
    color: var(--color-primary);
}

/* Active link state */
.onpage-nav__item.is-active .onpage-nav__link {
    color: var(--color-primary);
    font-weight: var(--font-weight-bold) !important;
    /* Figma specifies active link is always 13px regardless of breakpoint */
    font-size: 13px !important;
    line-height: 20px !important;
}

/* ==========================
   Indicator Bar
   ========================== */

.onpage-nav__indicator {
    position: absolute;
    bottom: 0; /* A4: pinned to the nav bottom edge, full-bleed (child of .onpage-nav = 100vw) */
    left: 0;
    width: 0; /* JS sets width = page-scroll progress × viewport width */
    height: var(--border-width-thick); /* 3px from Figma, all breakpoints */
    background-color: var(--color-primary); /* #299CD8 PrimaryBlue (was --color-base-mid-gray) */
    border-radius: var(--radius-full); /* Fully rounded ends */
    transition: width 250ms ease; /* A4: width-only — bar no longer translateX under a tab */
    pointer-events: none;
    will-change: width;
    z-index: 1;
}

/* ==========================
   Arrow Buttons
   ========================== */

.onpage-nav__arrow {
    display: none; /* Hidden by default, shown by JavaScript when needed */
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    /* Decoupled width so the taller bar doesn't widen the arrows (Daniel) */
    width: auto;
    height: var(--spacing-10); /* O1: 40px, matches the bar */
    padding: 0 var(--spacing-2); /* 8px horizontal — hug the edges */
    margin: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: opacity 250ms ease;
    opacity: 1;
    z-index: 2;
}

.onpage-nav__arrow:hover {
    opacity: 0.7;
}

.onpage-nav__arrow:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Arrow icon */
.onpage-nav__arrow-icon {
    display: block;
    /* Mobile: Icon size 12x12px centered in 24px button */
    width: 12px;
    height: 12px;
    object-fit: contain;
}

/* Previous arrow (left side) */
.onpage-nav__arrow--prev {
    order: -1;
}

/* Next arrow (right side) */
.onpage-nav__arrow--next {
    order: 1;
}

/* Show arrows when JS adds the class */
.onpage-nav__arrow.is-visible {
    display: flex;
}

/* ==========================
   Tablet Styles (768px+)
   ========================== */

@media (min-width: 768px) {
    .onpage-nav {
        /* Tablet: taller bar per Figma 5586-34185 / Daniel (was 40px) */
        min-height: calc(var(--spacing-12) + 2px); /* 50px */
    }

    .onpage-nav__inner {
        justify-content: flex-start; /* Left-align navigation on tablet */
        padding: 0 var(--spacing-2); /* 8px — arrows closer to the edges (Daniel) */
        height: calc(var(--spacing-12) + 2px); /* 50px */
    }

    .onpage-nav__list {
        gap: var(--spacing-5); /* 20px maintained from mobile */
        /* Items start from left edge to prevent negative offsets when scrolling */
    }

    .onpage-nav__link {
        /* Tablet: 12px from Figma P3 caption */
        font-size: var(--font-size-p3-caption);
        line-height: var(--line-height-p3-caption);
    }

    .onpage-nav__arrow {
        /* Decoupled width; matches the taller bar (Daniel) */
        width: auto;
        height: calc(var(--spacing-12) + 2px); /* 50px */
        padding: 0 var(--spacing-2); /* 8px horizontal */
    }

    .onpage-nav__arrow-icon {
        /* Tablet: Icon size 15x15px */
        width: 12px;
        height: 12px;
    }
}

/* ==========================
   Desktop Styles (1280px+)
   ========================== */

@media (min-width: 1280px) {
    .onpage-nav {
        /* Desktop: taller bar per Figma 1457-33248 / Daniel (was 48px) */
        min-height: calc(var(--spacing-13) + 2px); /* 54px */
    }

    .onpage-nav__inner {
        justify-content: flex-start; /* Left-align navigation on desktop */
        padding: 0 var(--spacing-2); /* 8px — arrows closer to the edges (Daniel) */
        height: calc(var(--spacing-13) + 2px); /* 54px */
    }

    .onpage-nav__list {
        gap: var(--spacing-6); /* 24px - increased spacing on desktop */
        /* Items start from left edge to prevent negative offsets when scrolling */
    }

    .onpage-nav__link {
        /* Desktop: 13px from Figma P3 caption */
        font-size: var(--font-size-p3-caption);
        line-height: var(--line-height-p3-caption);
    }

    .onpage-nav__arrow {
        /* Decoupled width; matches the taller bar (Daniel) */
        width: auto;
        height: calc(var(--spacing-13) + 2px); /* 54px */
        padding: 0 var(--spacing-2); /* 8px horizontal */
    }

    .onpage-nav__arrow-icon {
        /* Desktop: Icon size 17x17px */
        width: 12px;
        height: 12px;
    }
}

/* ==========================
   Accessibility
   ========================== */

.onpage-nav__link:focus-visible,
.onpage-nav__arrow:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .onpage-nav__link,
    .onpage-nav__indicator,
    .onpage-nav__arrow {
        transition: none;
    }
}

/* ==========================
   Print Styles
   ========================== */

@media print {
    .onpage-nav {
        display: none;
    }
}
