/*
 * AxonFlow Canonical Site Header
 *
 * Self-contained styling for the unified site nav (<nav class="nav">).
 * Extracted from styles.css so the blog system (which loads only blog.css)
 * can fully style the shared header without depending on styles.css.
 *
 * Marketing pages load both styles.css and nav.css; the rules here are
 * identical to (a copy of) the nav rules in styles.css, so there is no
 * visual drift between the two surfaces.
 *
 * IMPORTANT: keep this in sync with the .nav rules in styles.css.
 */

/* CSS variable fallbacks.
 * styles.css and blog.css both define :root, but blog.css is missing
 * --gradient-primary and --shadow-lg, which the nav needs. These defaults
 * keep nav.css self-contained; a later :root (from styles.css/blog.css)
 * cascades over any it also defines, which is fine — the values match. */
:root {
    --primary: #0F766E;
    --primary-dark: #134E4A;
    --primary-light: #14B8A6;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --bg-white: #FFFFFF;
    --bg-light: #F8FAFC;
    --border: #E2E8F0;
    --gradient-primary: linear-gradient(135deg, #0F766E 0%, #14B8A6 100%);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body.mobile-menu-open {
    overflow: hidden;
    touch-action: none;
}

.nav .container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-wrapper {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: clamp(16px, 1.8vw, 28px);
    padding: 10px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(14px, 1.2vw, 24px);
    min-width: 0;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    line-height: 1.3;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    color: white !important;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-cta-mobile {
    display: none;
}

.nav-cta-desktop {
    display: inline-flex;
}

/* Dropdown Navigation */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.nav-dropdown-toggle::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.2s;
}

.nav-dropdown:hover .nav-dropdown-toggle::after {
    transform: rotate(-180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 8px 0;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
}

.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-dropdown-menu a:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s;
}

@media (max-width: 1180px) {
    .nav-wrapper {
        display: flex;
        justify-content: space-between;
        column-gap: 0;
        gap: 16px;
    }

    .nav .nav-links {
        position: fixed !important;
        top: 0 !important;
        right: max(0px, calc(100% - 100vw));
        width: min(340px, 88vw) !important;
        height: 100vh !important;
        background: white !important;
        transform: translateX(calc(100% + 32px)) !important;
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 84px 24px 40px !important;
        transition: transform 0.3s ease !important;
        box-shadow: -8px 0 24px rgba(15, 23, 42, 0.14) !important;
        z-index: 1200 !important;
        display: flex !important;
        gap: 0 !important;
        margin-left: 0 !important;
        padding-left: 24px !important;
        padding-right: 24px !important;
        overflow-y: auto;
        pointer-events: none;
        visibility: hidden;
        will-change: transform;
    }

    .nav-cta-desktop {
        display: none;
    }

    .nav-cta-mobile {
        display: inline-flex;
        width: 100%;
        border-bottom: none !important;
        padding: 12px 20px !important;
    }

    .nav-cta {
        position: static;
        right: auto;
        top: auto;
        transform: none;
        margin-top: 12px;
        text-align: center;
        justify-content: center;
    }

    .nav-links.active {
        transform: translateX(0) !important;
        pointer-events: auto;
        visibility: visible;
    }

    body.mobile-menu-open .nav {
        transform: translateY(0) !important;
    }

    .nav-links a {
        padding: 14px 0;
        border-bottom: 1px solid #e5e7eb;
        display: block;
    }

    .mobile-menu-toggle {
        display: flex;
        z-index: 1300;
        position: relative;
    }

    /* Mobile Dropdown Styles */
    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 14px 0;
        border-bottom: 1px solid #e5e7eb;
    }

    .nav-dropdown.active .nav-dropdown-toggle::after {
        transform: rotate(-180deg);
    }

    .nav-dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: 1px solid var(--border);
        border-radius: 12px;
        margin: 10px 0 14px;
        padding: 6px 16px;
        display: none;
        background: var(--bg-light);
        min-width: auto;
    }

    .nav-dropdown.active .nav-dropdown-menu {
        display: block;
    }

    .nav-dropdown-menu a {
        padding: 12px 0;
        border-bottom: 1px solid #e5e7eb;
        font-size: 15px;
    }

    .nav-dropdown-menu a:last-child {
        border-bottom: none;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

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

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

    /* Mobile overlay (injected by script.js) */
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
        z-index: 1100;
    }

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

@media (max-width: 640px) {
    .nav-wrapper {
        padding: 12px 0;
    }

    .logo img {
        height: 42px !important;
    }
}
