/* ============================================================
   BuildStackHub — Nav v2 (Phase 2: Navigation Restructure)
   Trade-first, 5-item nav: Trade Stacks, AI Tools, Insights,
   Premium Stack, Estimate a Job Now CTA
   ============================================================ */

/* ── Fixed nav bar ─────────────────────────────────────────── */
#mainNav,
#main-nav,
nav.nav-v2,
nav[data-nav-v2] {
    position: fixed !important;
    top: 0;
    width: 100%;
    z-index: 200;
    height: 64px;
    padding: 0 2rem;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid #e5e7eb;
    transition: box-shadow 0.2s;
    display: flex !important;
    align-items: center;
    box-sizing: border-box;
}
#mainNav.scrolled,
#main-nav.scrolled,
nav.nav-v2.scrolled { box-shadow: 0 4px 24px rgba(13,27,42,0.08); }

/* ── Inner container ─────────────────────────────────────────── */
#mainNav .nav-inner,
#main-nav .nav-inner,
nav.nav-v2 .nav-inner,
nav[data-nav-v2] .nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

/* ── Logo ─────────────────────────────────────────────────────── */
.nav-v2-logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    flex-shrink: 0;
}
.nav-v2-logo img { width: 34px; height: 34px; display: block; }
.nav-v2-logo-text {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: #0D1B2A;
    letter-spacing: -0.3px;
}
.nav-v2-logo-text span { color: #FF6D00; }

/* ── Desktop nav links ────────────────────────────────────────── */
.nav-v2-links {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    flex: 1;
}
.nav-v2-links > a {
    font-size: 0.9rem;
    font-weight: 500;
    color: #4b5563;
    text-decoration: none;
    transition: color 0.15s;
    white-space: nowrap;
}
.nav-v2-links > a:hover { color: #FF6D00; }

/* ── Trade Stacks dropdown ────────────────────────────────────── */
.nav-v2-dropdown {
    position: relative;
}
.nav-v2-dropdown-btn {
    font-size: 0.9rem;
    font-weight: 500;
    color: #4b5563;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-family: inherit;
    transition: color 0.15s;
    white-space: nowrap;
}
.nav-v2-dropdown-btn:hover,
.nav-v2-dropdown.open .nav-v2-dropdown-btn,
.nav-v2-dropdown.hover .nav-v2-dropdown-btn { color: #FF6D00; }
.nav-v2-dropdown-btn .nav-v2-chevron { transition: transform 0.2s; }
.nav-v2-dropdown:hover .nav-v2-dropdown-btn .nav-v2-chevron,
.nav-v2-dropdown.open .nav-v2-dropdown-btn .nav-v2-chevron,
.nav-v2-dropdown.hover .nav-v2-dropdown-btn .nav-v2-chevron { transform: rotate(180deg); }

/* ── Mega menu ────────────────────────────────────────────────── */
.nav-v2-mega {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(13,27,42,0.14);
    padding: 1.25rem;
    min-width: 560px;
    z-index: 300;
    /* Hover-safe show/hide: visibility+opacity with delay prevents flicker */
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: visibility 0s 0.18s, opacity 0.18s ease, transform 0.15s ease, pointer-events 0s 0.18s;
}
/* Invisible bridge fills the gap so hover chain stays unbroken */
.nav-v2-mega::before {
    content: '';
    position: absolute;
    top: -14px;
    left: 0;
    right: 0;
    height: 18px;
    background: transparent;
}
.nav-v2-dropdown:hover .nav-v2-mega,
.nav-v2-dropdown.open .nav-v2-mega,
.nav-v2-dropdown.hover .nav-v2-mega {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
    transition-delay: 0s;
}

.nav-v2-mega-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
}
.nav-v2-mega-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.15s;
}
.nav-v2-mega-item:hover { background: #f3f4f6; }
.nav-v2-mega-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.nav-v2-mega-text { flex: 1; min-width: 0; }
.nav-v2-mega-text strong {
    display: block;
    font-size: 0.84rem;
    font-weight: 700;
    color: #0D1B2A;
    margin-bottom: 0.05rem;
}
.nav-v2-mega-text span {
    font-size: 0.74rem;
    color: #6b7280;
    line-height: 1.3;
}
.nav-v2-mega-badge {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 0.12rem 0.4rem;
    border-radius: 100px;
    margin-left: auto;
    align-self: center;
    white-space: nowrap;
    flex-shrink: 0;
}
.nav-v2-badge-live  { background: rgba(22,163,74,0.12); color: #16a34a; }
.nav-v2-badge-soon  { background: rgba(107,114,128,0.10); color: #6b7280; }

/* Coming-soon items with href="#" — visually dim and non-clickable */
a.nav-v2-mega-item[href="#"] {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
}
a.nav-v2-mob-stack-item[href="#"] {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
}

/* ── Estimate CTA button ─────────────────────────────────────── */
.btn-estimate {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: #FF6D00;
    color: #fff !important;
    border: 2px solid #FF6D00;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none !important;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    flex-shrink: 0;
    font-family: inherit;
    letter-spacing: -0.1px;
    line-height: 1;
}
.btn-estimate:hover {
    background: #E05A00;
    border-color: #E05A00;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,109,0,0.3);
}

/* Right side CTA area */
.nav-v2-cta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ── Mobile hamburger ────────────────────────────────────────── */
.nav-v2-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
    background: none;
    border: none;
}
.nav-v2-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #0D1B2A;
    border-radius: 2px;
    transition: all 0.2s;
}

/* ── Mobile nav panel ────────────────────────────────────────── */
.nav-v2-mobile {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1.5rem 1.5rem;
    z-index: 199;
    flex-direction: column;
    gap: 0;
    box-shadow: 0 8px 32px rgba(13,27,42,0.10);
    max-height: calc(100vh - 64px);
    overflow-y: auto;
}
.nav-v2-mobile.open { display: flex; }

/* Mobile Trade Stacks accordion */
.nav-v2-mob-accordion {
    border-bottom: 1px solid #f3f4f6;
}
.nav-v2-mob-accordion-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    background: none;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0D1B2A;
    cursor: pointer;
    font-family: inherit;
}
.nav-v2-mob-accordion-btn .mob-chevron { transition: transform 0.2s; }
.nav-v2-mob-stacks {
    display: none;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.4rem 0 0.75rem;
}
.nav-v2-mob-stacks.open { display: flex; }

.nav-v2-mob-stack-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    color: #1f2937;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.12s;
}
.nav-v2-mob-stack-item:hover { background: #f3f4f6; }
.nav-v2-mob-stack-item strong { flex: 1; font-weight: 600; font-size: 0.86rem; }

.mob-badge-live {
    font-size: 0.58rem; font-weight: 700;
    background: rgba(22,163,74,0.12); color: #16a34a;
    padding: 0.1rem 0.35rem; border-radius: 100px; flex-shrink: 0;
}
.mob-badge-soon {
    font-size: 0.58rem; font-weight: 700;
    background: rgba(107,114,128,0.10); color: #6b7280;
    padding: 0.1rem 0.35rem; border-radius: 100px; flex-shrink: 0;
}

/* Mobile links */
.nav-v2-mob-link {
    font-size: 0.95rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
    display: block;
    transition: color 0.15s;
}
.nav-v2-mob-link:hover { color: #FF6D00; }

.nav-v2-mob-cta {
    margin-top: 1.1rem;
    display: flex !important;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

/* ── Responsive breakpoints ───────────────────────────────────── */
@media (max-width: 768px) {
    .nav-v2-links { display: none !important; }
    .nav-v2-hamburger { display: flex !important; }
    .nav-v2-cta .btn-estimate { display: none !important; }
    .nav-v2-cta-mobile { display: inline-flex !important; }
}
@media (min-width: 769px) {
    .nav-v2-cta-mobile { display: none !important; }
}

/* ── Body offset for fixed nav ───────────────────────────────── */
/* Existing pages handle their own top spacing via hero/section padding.
   New pages: add body { padding-top: 64px; } in page-level CSS. */
