/* Header/Navbar styles extracted from main stylesheet */
.navbar { 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    z-index: 1000; 
    background: var(--white); 
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); 
    transition: var(--transition-normal);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.navbar.scrolled { box-shadow: var(--shadow-lg); }

.nav-wrapper { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 1rem 0;
    max-width: 100%;
    position: relative;
}

.logo { 
    display: flex; 
    align-items: center; 
    text-decoration: none;
    flex-shrink: 0;
    z-index: 1002;
    max-width: 280px;
}

.logo img { 
    height: auto;
    width: 100%;
    max-width: 280px;
    max-height: 80px;
    transition: var(--transition-fast); 
    object-fit: contain;
    display: block;
}

.logo:hover img { transform: scale(1.02); }

.nav-menu { 
    display: flex; 
    list-style: none; 
    gap: var(--spacing-md); 
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-link { 
    text-decoration: none; 
    color: var(--text-primary); 
    font-weight: 500; 
    padding: 0.5rem 1rem; 
    border-radius: var(--radius-sm); 
    transition: var(--transition-fast); 
    position: relative;
    white-space: nowrap;
}

.nav-link::after { 
    content: ''; 
    position: absolute; 
    bottom: 0; 
    left: 50%; 
    transform: translateX(-50%); 
    width: 0; 
    height: 2px; 
    background: var(--primary-color); 
    transition: width var(--transition-fast); 
}

.nav-link:hover, .nav-link.active { color: var(--primary-color); }
.nav-link:hover::after, .nav-link.active::after { width: 80%; }

.cta-nav { 
    background: linear-gradient(90deg, var(--accent-start), var(--accent-mid)); 
    color: var(--white) !important; 
    padding: 0.75rem 1.5rem; 
    border-radius: var(--radius-md); 
    box-shadow: var(--shadow-sm); 
}

.cta-nav:hover { 
    transform: translateY(-2px); 
    box-shadow: var(--shadow-md); 
}

.cta-nav::after { display: none; }

.menu-toggle { 
    display: none; 
    flex-direction: column; 
    gap: 6px; 
    background: none; 
    border: none; 
    cursor: pointer; 
    padding: 0.75rem;
    z-index: 1002;
    position: relative;
    min-width: 48px;
    min-height: 48px;
    align-items: center;
    justify-content: center;
}


.menu-toggle span { 
    display: block; 
    width: 28px; 
    height: 3px; 
    background: var(--text-primary); 
    border-radius: 3px; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* Large desktop */
@media (min-width: 1441px) {
    .logo {
        max-width: 320px;
    }
    
    .logo img {
        max-width: 320px;
        max-height: 90px;
    }
}

/* Desktop to tablet transition */
@media (max-width: 1280px) {
    .nav-menu { gap: 1.5rem; }
    .nav-link { padding: 0.5rem 0.875rem; font-size: 0.95rem; }
}

/* Tablet responsive (portrait) */
@media (max-width: 1024px) {
    .nav-menu { gap: 1rem; }
    .nav-link { padding: 0.5rem 0.75rem; font-size: 0.9rem; }
    
    .logo {
        max-width: 220px;
    }
    
    .logo img { 
        max-width: 220px;
        max-height: 70px;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .navbar { 
        padding: 0; 
    }
    
    .nav-wrapper { 
        padding: 0.625rem 0;
        min-height: 60px;
    }
    
    .logo {
        max-width: 180px;
    }
    
    .logo img { 
        max-width: 180px;
        max-height: 50px;
    }
    
    .menu-toggle { 
        display: flex;
    }
    
    /* Mobile dropdown anchored to the menu toggle (pop + slide effect) */
    .nav-menu::before { display: none; }

    .nav-menu {
        position: absolute;
        top: 100%;
        right: 1rem;
        width: min(92vw, 320px);
        background: var(--white);
        flex-direction: column;
        align-items: stretch;
        padding: 0.5rem 0;
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
        transform: translateY(-6px) scale(0.98);
        opacity: 0;
        visibility: hidden;
        transition: transform 220ms cubic-bezier(0.2, 0, 0, 1),
                    opacity 180ms ease, visibility 180ms ease;
        gap: 0;
        margin: 0;
        overflow: hidden;
        border-radius: 0.5rem;
        z-index: 1002;
    }

    .nav-menu.active {
        transform: translateY(4px) scale(1);
        opacity: 1;
        visibility: visible;
    }

    /* Fix for mobile: if body is locked with overflow:hidden the absolute
       dropdown can get clipped by ancestor overflow. Use a fixed-position
       anchored dropdown on small screens so it remains visible. */
    @media (max-width: 768px) {
        .nav-menu {
            position: fixed;
            top: var(--header-height, 60px);
            right: 1rem;
            width: min(92vw, 320px);
            box-shadow: 0 12px 36px rgba(15,23,42,0.18);
            z-index: 1200;
            /* Allow internal scrolling when menu content exceeds viewport height */
            max-height: calc(100vh - var(--header-height, 60px) - 24px);
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
        }

        .nav-menu.active {
            transform: translateY(0) scale(1);
        }
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        text-align: left;
        border-bottom: 1px solid var(--gray-100);
        border-radius: 0.375rem;
        font-size: 0.975rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .nav-link::after { display: none; }
    
    .nav-link:active {
        background: var(--gray-50);
    }
    
    .cta-nav {
        margin-top: var(--spacing-md);
        text-align: center;
        border-bottom: none;
        justify-content: center;
    }
    
    /* Hamburger animation */
    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translateY(10px);
    }
    
    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }
    
    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translateY(-10px);
    }
    
    /* No global body lock for dropdown menu; keep page scrollable */
}

/* Small mobile devices */
@media (max-width: 480px) {
    .nav-wrapper { 
        padding: 0.5rem 0;
        min-height: 56px;
    }
    
    .logo {
        max-width: 160px;
    }
    
    .logo img { 
        max-width: 160px;
        max-height: 44px;
    }
    
    .menu-toggle {
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
    }
    
    .menu-toggle span {
        width: 24px;
    }
    
    .nav-menu {
        padding: 70px var(--spacing-sm) var(--spacing-md);
    }
    
    .nav-link {
        padding: 0.875rem var(--spacing-sm);
        font-size: 0.95rem;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .logo {
        max-width: 140px;
    }
    
    .logo img {
        max-width: 140px;
        max-height: 40px;
    }
    
    .nav-wrapper {
        min-height: 52px;
    }
}
