/* ────────────────────────────────────────────────
   SMART NAVBAR – Fixed Viewport Issues
───────────────────────────────────────────────── */

/* 1. Global Layout Fix (Prevents horizontal scroll) */
html,
body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

/* 2. Base Navbar Styles */
.nav-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100vw;
    /* Force strict width limit */
    z-index: 1000;
    padding: 1.2rem 0;

    /* Transition for hide/show effect */
    transition: transform 0.5s cubic-bezier(0.694, 0.048, 0.335, 1),
        background-color 0.3s ease,
        padding 0.3s ease,
        box-shadow 0.3s ease;
    will-change: transform;

    /* FIX: Prevent internal elements from causing scroll */
    overflow: hidden;
}

/* Scrolled State (Glassmorphism) */
.nav-header.scrolled {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.8rem 0;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

/* Hidden State (Scroll Down) */
.nav-header.hidden {
    transform: translateY(-100%);
}

/* 3. Container - Fixed Padding for Mobile Safety */
.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;

    /* FIXED PADDING: Using rem instead of % prevents overflow on small screens */
    padding: 0 1.5rem;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo Styles */
.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1001;
    flex-shrink: 0;
    /* Prevents logo from squishing */
}

.nav-logo {
    font-family: 'Manrope', sans-serif;
    text-decoration: none;
    display: flex;
    align-items: baseline;
}

.logo-bold {
    font-weight: 800;
    font-size: 1.5rem;
    color: #111827;
}

.logo-light {
    font-weight: 600;
    font-size: 1.2rem;
    color: #6B7280;
}

/* 4. Desktop Menu */
.nav-menu-desktop {
    display: flex;
    align-items: center;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 2.5rem;
    margin: 0;
    padding: 0;
}

.nav-links li a {
    text-decoration: none;
    color: #111827;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s;
}

.nav-links li a:hover {
    color: var(--text-muted);
}

.nav-links li a:not(.btn-nav-cta) {
    position: relative;
    display: inline-block;
    text-decoration: none;
}

.nav-links li a:not(.btn-nav-cta)::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 100%;
    height: 2px;
    background: var(--tiger-orange);

    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.nav-links li a:not(.btn-nav-cta):hover::after {
    transform: scaleX(1);
}


/* CTA Button */
.btn-nav-cta {
    padding: 0.6rem 1.5rem;
    background-color: #111827;
    color: #fff !important;
    border-radius: 6px;
    transition: background-color 0.3s, transform 0.2s;
}

.btn-nav-cta:hover {
    background-color: var(--ash-brown);
    transform: translateY(-1px);
}

/* 5. Mobile Toggle (Hamburger) */
.mobile-menu-toggle {
    display: none;
    /* Hidden on Desktop */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1002;
    padding: 0;
    flex-shrink: 0;
    /* Prevents button from squishing */
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #111827;
    transition: all 0.3s ease;
    transform-origin: center;
}

.mobile-menu-toggle span:nth-child(1) {
    margin-bottom: 6px;
}

.mobile-menu-toggle span:nth-child(3) {
    margin-top: 6px;
}

/* Hamburger Active State (X) */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(4px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-4px) rotate(-45deg);
}

/* 6. Mobile Overlay */
.nav-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #F9FAFB;
    /* Matches your light bg */
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

/* Dark Mode Overlay Support */
[data-theme="dark"] .nav-mobile-overlay {
    background: #111827;
}

.nav-mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

.nav-mobile-links {
    list-style: none;
    padding: 0;
    text-align: center;
}

.nav-mobile-links li {
    margin-bottom: 2rem;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

/* Staggered Reveal Animation */
.nav-mobile-overlay.active .nav-mobile-links li {
    transform: translateY(0);
    opacity: 1;
}

.nav-mobile-overlay.active .nav-mobile-links li:nth-child(1) {
    transition-delay: 0.1s;
}

.nav-mobile-overlay.active .nav-mobile-links li:nth-child(2) {
    transition-delay: 0.15s;
}

.nav-mobile-overlay.active .nav-mobile-links li:nth-child(3) {
    transition-delay: 0.2s;
}

.nav-mobile-overlay.active .nav-mobile-links li:nth-child(4) {
    transition-delay: 0.25s;
}

.nav-mobile-overlay.active .nav-mobile-links li:nth-child(5) {
    transition-delay: 0.3s;
}

.nav-mobile-links a {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    text-decoration: none;
}

.mobile-footer {
    position: absolute;
    bottom: 2rem;
    text-align: center;
    color: #6B7280;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.4s ease 0.4s;
}

.nav-mobile-overlay.active .mobile-footer {
    opacity: 1;
}

/* 7. Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 20px;
    /* Reduced from 30px to ensure fit */
    width: 45px;
    height: 45px;
    background-color: #111827;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 990;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    background-color: #27AE60;
}

/* ────────────────────────────────────────────────
   RESPONSIVE LOGIC
───────────────────────────────────────────────── */

@media (max-width: 991px) {

    /* Hide Desktop Links */
    .nav-menu-desktop {
        display: none;
    }

    /* Show Hamburger */
    .mobile-menu-toggle {
        display: flex;
    }

    /* Tighten padding on mobile to prevent overflow */
    .nav-container {
        padding: 0 1rem;
    }
}