:root {
  --navy: #0f172a;
  --red: #dc2626;
  --light: #f8fafc;
  --white: #ffffff;
  --gray: #e5e7eb;
  --dark-text: #334155;
  --accent: #4f5f7f;
}

.pill {
    font-family: "Inter", Arial, Helvetica, sans-serif;
}

/* Floating container - now in normal flow */
.floating-pill-container {
    position: relative; /* Changed from fixed */
    width: 100%;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: auto;
    margin: 0 auto;
    padding: 1rem 0;
    margin-block-end: 1rem; /* Reduced to 1rem */
}

/* Main nav states - these classes will be added by JS */
.floating-pill-container.main-nav-hidden {
    /* When main nav hides on mobile */
    margin-block-start: 0.5rem !important;
}

.floating-pill-container.main-nav-scrolled {
    /* When main nav is visible but scrolled */
    margin-block-start: 1rem; /* Reduced to match default */
}

.floating-pill-container.desktop-view {
    /* Desktop view */
    margin-block-start: 1rem; /* Reduced to 1rem */
}

.floating-pill-container.desktop-scrolled {
    /* Desktop scrolled past header */
    margin-block-start: 0.5rem !important; /* Reduced further */
}

.floating-pill-container.desktop-main-nav-hidden {
    /* Desktop when main nav should hide */
    margin-block-start: 0.5rem !important;
}

/* Hide state (when auto-hiding due to inactivity) */
.floating-pill-container.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    position: relative !important; /* Stay in flow but hidden */
}

/* Scroll indicators with pointer cursor */
.scroll-indicator {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease;
    z-index: 1001;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.scroll-indicator:hover {
    background: rgba(255, 255, 255, 1);
}

.scroll-indicator.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-indicator:not(.visible) {
    pointer-events: none;
}

.scroll-indicator.left {
    left: 5px;
}

.scroll-indicator.right {
    right: 5px;
}

/* Scroll indicator arrows */
.scroll-indicator::after {
    content: '';
    width: 8px;
    height: 8px;
    border: solid #64748b;
    border-width: 0 2px 2px 0;
    display: inline-block;
    transition: border-color 0.3s ease;
}

.scroll-indicator:hover::after {
    border-color: #0f172a;
}

.scroll-indicator.left::after {
    transform: rotate(135deg);
    margin-right: 2px;
}

.scroll-indicator.right::after {
    transform: rotate(-45deg);
    margin-left: 2px;
}

/* Pills nav */
.floating-pill-nav-wrapper {
    position: relative;
    width: 100%;
    max-width: 95vw;
    margin: 0 auto;
}

.floating-pill-nav {
    background: #ffffff;
    border-radius: 40px;
    padding: 12px 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    transition: all 0.3s ease;
    max-width: calc(95vw - 40px);
    opacity: 0;
    scroll-behavior: smooth;
    scroll-padding: 0 20px;
    scroll-snap-type: x proximity;
}

.floating-pill-nav::-webkit-scrollbar {
    display: none;
}

.floating-pill-nav.visible {
    opacity: 1;
}

.floating-pill-nav .pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: none;
    font-size: 1rem;
    padding: 12px 20px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #475569;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
    scroll-margin: 0 20px;
    scroll-snap-align: center;
}

.floating-pill-nav .pill:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.floating-pill-nav .pill.active {
    background: #0f172a;
    color: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.floating-pill-nav .pill:active {
    transform: scale(0.96);
}

/* Initially hide the pill nav to prevent flashing */
.floating-pill-nav {
    opacity: 0;
    transition: opacity 0.3s ease, all 0.3s ease;
}

/* When JS sets it ready, add this class */
.floating-pill-nav.visible {
    opacity: 1;
}

/* Page scroll indicator */
.page-scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--red) 0%, var(--navy) 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
    z-index: 1002; /* Above both navs */
    pointer-events: none;
}

/* Section highlight for hash navigation */
.section-highlight {
    animation: highlight-pulse 2s ease;
}

@keyframes highlight-pulse {
    0% { background-color: transparent; }
    20% { background-color: rgba(15, 23, 42, 0.1); }
    100% { background-color: transparent; }
}

/* Mobile scroll indicators and responsive pills */
@media (max-width: 1024px) {
    .scroll-indicator {
        display: flex;
        width: 36px;
        height: 36px;
    }
    
    .scroll-indicator::after {
        width: 7px;
        height: 7px;
    }

    .floating-pill-container {
        margin-block-start: 1rem; /* Reduced to 1rem */
    }
    
    .floating-pill-container.main-nav-hidden {
        margin-block-start: 0.5rem !important;
    }
    
    /* Hide desktop classes on mobile */
    .floating-pill-container.desktop-scrolled,
    .floating-pill-container.desktop-main-nav-hidden {
        margin-block-start: 1rem !important; /* Reduced to 1rem */
    }

    .floating-pill-nav {
        padding: 10px 15px;
        gap: 8px;
    }
    
    .floating-pill-nav .pill {
        font-size: 0.85rem;
        padding: 8px 12px;
        min-height: 44px;
        line-height: 1.3;
        white-space: normal;
        max-width: 120px;
        scroll-snap-align: center;
    }
}

@media (max-width: 800px) {
    /* Hide desktop classes on mobile */
    .floating-pill-container.desktop-view,
    .floating-pill-container.desktop-scrolled,
    .floating-pill-container.desktop-main-nav-hidden {
        margin-block-start: 1rem !important; /* Reduced to 1rem */
    }
}

@media (max-width: 768px) {
    .floating-pill-container {
        margin-block-start: 1rem;
    }
    
    .floating-pill-container.main-nav-hidden {
        margin-block-start: 0.5rem !important;
    }
    
    .scroll-indicator {
        width: 32px;
        height: 32px;
    }
    
    .scroll-indicator::after {
        width: 6px;
        height: 6px;
    }
    
    .floating-pill-nav {
        scroll-snap-type: x mandatory;
    }
}

@media (max-width: 480px) {
    .floating-pill-container {
        margin-block-start: 1rem;
    }
    
    .floating-pill-container.main-nav-hidden {
        margin-block-start: 0.25rem !important;
    }
    
    .scroll-indicator {
        width: 28px;
        height: 28px;
        display: none;
    }
    
    .scroll-indicator.visible {
        display: flex;
    }
    
    .floating-pill-nav .pill {
        font-size: 0.8rem;
        padding: 6px 10px;
        max-width: 100px;
        scroll-snap-align: center;
    }
}

/* When mobile nav drawer is open - hide pill nav */
.mobile-nav.open ~ .floating-pill-container {
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: 100 !important;
}

/* Desktop specific styles */
@media (min-width: 801px) {
    .floating-pill-container {
        z-index: 999; /* Below desktop nav */
    }
    
    /* On desktop, pill nav moves up to top when scrolled past header */
    .floating-pill-container.desktop-scrolled {
        margin-block-start: 0.5rem !important; /* Reduced from 1rem to 0.5rem */
    }
    
    /* When main nav should hide on desktop */
    .floating-pill-container.desktop-main-nav-hidden {
        margin-block-start: 0.5rem !important;
    }
    
    /* Hide mobile-only classes on desktop */
    .floating-pill-container.main-nav-hidden,
    .floating-pill-container.main-nav-scrolled {
        margin-block-start: 1rem !important; /* Reduced to 1rem */
    }
}