/*
 * Shared site header (markup: scripts/site-nav.js, behaviour: /site-nav.js).
 *
 * Loaded last on every page so it settles three things the per-page
 * stylesheets disagreed on:
 *   1. Pages without the launchzone theme (generated product/blog/guide
 *      pages, the diagnostic) get the same header look as the homepage.
 *   2. Between 769px and 1100px the eight links no longer fit on one row, so
 *      "Guest Mentors" and "Book Now" wrapped onto two lines. The menu now
 *      collapses behind the menu button up to 1100px on every page.
 *   3. The menu button and Tools chevron are inline SVG, so they render on
 *      pages that do not load Font Awesome.
 */

.navbar {
    --nav-ink: var(--lz-ink, #090909);
    --nav-paper: var(--lz-paper, #f7f7f3);
    --nav-line: var(--lz-line, #d8d8d1);
    --nav-white: var(--lz-white, #ffffff);
}

/* ----- Icons ----- */
.navbar .nav-icon {
    display: block;
    width: 20px;
    height: 20px;
}

.navbar .mobile-menu-btn .nav-icon-close,
.navbar .mobile-menu-btn[aria-expanded="true"] .nav-icon-open {
    display: none;
}

.navbar .mobile-menu-btn[aria-expanded="true"] .nav-icon-close {
    display: block;
}

.navbar .nav-chevron {
    flex: none;
    transition: transform 0.15s ease;
}

.navbar .nav-dropdown.is-open .nav-chevron {
    transform: rotate(180deg);
}

@media (hover: hover) and (min-width: 1101px) {
    .navbar .nav-dropdown:hover .nav-chevron {
        transform: rotate(180deg);
    }
}

.navbar .nav-links > li > a,
.navbar .nav-dropdown-toggle {
    white-space: nowrap;
}

/* Hover bridge: the menu sits a few pixels below its button, and crossing
   that gap used to drop the hover and close the menu. */
.navbar .nav-dropdown-menu::before {
    content: "";
    position: absolute;
    top: -16px;
    right: 0;
    left: 0;
    height: 16px;
}

/* ----- Standalone look for pages without the launchzone theme ----- */
body:not(.d2q-launchzone) .navbar {
    position: sticky;
    z-index: 1100;
    top: 0;
    min-height: 66px;
    padding: 0;
    background: rgba(247, 247, 243, 0.96);
    border: 0;
    border-bottom: 1px solid var(--nav-line);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body:not(.d2q-launchzone) .navbar .nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-sizing: border-box;
    width: min(100%, 1380px);
    max-width: 1380px;
    min-height: 66px;
    margin: 0 auto;
    padding: 0 clamp(16px, 3vw, 48px);
}

body:not(.d2q-launchzone) .navbar .logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--nav-ink);
    font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.035em;
    text-decoration: none;
}

body:not(.d2q-launchzone) .navbar .logo-text {
    display: inline !important;
    color: var(--nav-ink) !important;
}

body:not(.d2q-launchzone) .navbar .logo-mark {
    display: inline-flex;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    overflow: hidden;
    border-radius: 12px;
}

body:not(.d2q-launchzone) .navbar .logo-mark-img {
    display: block;
    width: 42px;
    height: 42px;
    object-fit: cover;
}

body:not(.d2q-launchzone) .navbar .nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

body:not(.d2q-launchzone) .navbar .nav-links li {
    margin: 0;
    list-style: none;
}

body:not(.d2q-launchzone) .navbar .nav-links > li > a,
body:not(.d2q-launchzone) .navbar .nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    box-sizing: border-box;
    padding: 9px 12px;
    color: var(--nav-ink);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    font: inherit;
    font-size: 14px;
    font-weight: 550;
    text-decoration: none;
    cursor: pointer;
}

body:not(.d2q-launchzone) .navbar .nav-links > li > a:hover,
body:not(.d2q-launchzone) .navbar .nav-links > li > a[aria-current="page"],
body:not(.d2q-launchzone) .navbar .nav-dropdown-toggle:hover {
    background: var(--nav-white);
    border-color: var(--nav-line);
}

body:not(.d2q-launchzone) .navbar .nav-links .nav-cta {
    padding-inline: 18px;
    color: var(--nav-white);
    background: var(--nav-ink);
    border-color: var(--nav-ink);
}

body:not(.d2q-launchzone) .navbar .nav-dropdown {
    position: relative;
}

body:not(.d2q-launchzone) .navbar .nav-dropdown-menu {
    position: absolute;
    z-index: 1010;
    top: calc(100% + 10px);
    left: 50%;
    display: none;
    flex-direction: column;
    gap: 2px;
    min-width: 220px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--nav-paper);
    border: 1px solid var(--nav-ink);
    border-radius: 4px;
    box-shadow: 8px 8px 0 var(--nav-ink);
    transform: translateX(-50%);
}

body:not(.d2q-launchzone) .navbar .nav-dropdown.is-open .nav-dropdown-menu {
    display: flex;
}

@media (hover: hover) and (min-width: 1101px) {
    body:not(.d2q-launchzone) .navbar .nav-dropdown:hover .nav-dropdown-menu {
        display: flex;
    }
}

body:not(.d2q-launchzone) .navbar .nav-dropdown-menu a {
    display: block;
    padding: 10px 12px;
    color: var(--nav-ink);
    border-radius: 2px;
    font-size: 14px;
    text-decoration: none;
}

body:not(.d2q-launchzone) .navbar .nav-dropdown-menu a:hover {
    color: var(--nav-white);
    background: var(--nav-ink);
}

body:not(.d2q-launchzone) .navbar .nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

body:not(.d2q-launchzone) .navbar .mobile-menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--nav-ink);
    background: transparent;
    border: 1px solid var(--nav-ink);
    border-radius: 3px;
    cursor: pointer;
}

/* ----- Collapsed menu (phones and tablets, every page) ----- */
@media (max-width: 1100px) {
    body .navbar .nav-container {
        position: relative;
    }

    body .navbar .mobile-menu-btn {
        display: grid !important;
        place-items: center;
        width: 44px;
        height: 44px;
        padding: 0;
        color: var(--nav-ink) !important;
        background: transparent;
        border: 1px solid var(--nav-ink);
        border-radius: 3px;
    }

    body .navbar .nav-links {
        position: absolute !important;
        z-index: 1200;
        top: 100% !important;
        right: 0 !important;
        bottom: auto !important;
        left: 0 !important;
        display: none !important;
        flex-direction: column;
        align-items: stretch;
        gap: 0 !important;
        box-sizing: border-box;
        height: auto !important;
        max-height: calc(100dvh - 80px);
        margin: 0;
        padding: 8px clamp(16px, 3vw, 48px) 20px !important;
        overflow-y: auto;
        background: var(--nav-paper) !important;
        border: 0 !important;
        border-top: 1px solid var(--nav-line) !important;
        border-bottom: 1px solid var(--nav-ink) !important;
        border-radius: 0 !important;
        box-shadow: 0 10px 0 rgba(9, 9, 9, 0.12) !important;
    }

    body .navbar .nav-links.mobile-active {
        display: flex !important;
    }

    body .navbar .nav-links > li {
        width: 100%;
        margin: 0;
        text-align: left;
    }

    body .navbar .nav-links > li > a,
    body .navbar .nav-dropdown-toggle {
        display: flex !important;
        justify-content: space-between;
        width: 100%;
        min-height: 48px;
        padding: 12px 4px !important;
        color: var(--nav-ink) !important;
        background: transparent !important;
        border: 0 !important;
        border-bottom: 1px solid var(--nav-line) !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        line-height: 1.3;
        transform: none !important;
    }

    body .navbar .nav-links .nav-cta {
        justify-content: center;
        margin-top: 14px;
        color: var(--nav-white) !important;
        background: var(--nav-ink) !important;
        border: 1px solid var(--nav-ink) !important;
        border-radius: 4px !important;
    }

    body .navbar .nav-dropdown-menu {
        position: static !important;
        display: none !important;
        min-width: 0;
        width: 100%;
        margin: 0 0 6px;
        padding: 0 0 6px 14px !important;
        background: transparent !important;
        border: 0 !important;
        border-left: 2px solid var(--nav-line) !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        transform: none !important;
    }

    body .navbar .nav-dropdown.is-open .nav-dropdown-menu {
        display: flex !important;
        flex-direction: column;
    }

    body .navbar .nav-dropdown-menu::before {
        display: none;
    }

    body .navbar .nav-dropdown-menu a {
        display: block;
        padding: 12px 4px !important;
        color: var(--nav-ink) !important;
        background: transparent !important;
        font-size: 15px !important;
    }
}
