/* Header / Navigation - Fully Responsive */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100vw;
    z-index: 9999;
    background: var(--white);
    box-shadow: none;
    border-bottom: 1px solid #E5E7EB;
    box-sizing: border-box;
    overflow: visible;
    height: auto;
}

.navbar {
    width: 100%;
    max-width: 100vw;
    padding: clamp(0rem, 1vw, 0rem) 0;
    box-sizing: border-box;
    overflow: visible;
    height: auto;
}

.nav-wrapper {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: clamp(1rem, 2.5vw, 2.5rem);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
    height: auto;
}

.logo {
    justify-self: start;
    width: auto;
    max-width: 100%;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.logo img {
    height: clamp(3.5rem, 5vw, 4.5rem);
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
    display: block;
    aspect-ratio: 5 / 2;
    object-fit: contain;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: clamp(1.5rem, 3vw, 2.5rem);
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    overflow: visible;
    height: auto;
}
.nav-menu a:visited {
    font-weight: normal;
}

.nav-menu a {
    color: #0B1622;
    text-decoration: none;
    font-weight: 400;
    transition: color 0.3s;
    font-size: clamp(0.9rem, 1.2vw, 1rem);
}

.nav-menu a:hover {
    color: var(--primary-color);
    font-weight: 500 !important;
}
.nav-menu li a.active {
    font-weight: 700;
    color: var(--primary-color);
}

.nav-menu a.active {
    font-weight: 700;
    color: var(--primary-color);
}

/* Dropdown Menu */
.nav-menu .dropdown {
    position: relative;
    z-index: 10000;
}

.dropdown-link {
    pointer-events: auto;
    text-decoration: none;
    font-weight: 500 !important;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.125rem);
    left: 0;
    background-color: var(--white);
    min-width: 13.75rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.375rem);
    transition: all 0.3s ease;
    z-index: 10000;
    white-space: nowrap;
    pointer-events: none;
    overflow: visible;
    height: auto;
}

/* Show dropdown when hovering the dropdown container (main link) */
.nav-menu .dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Show dropdown when directly hovering the dropdown menu itself */
.nav-menu .dropdown .dropdown-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Keep dropdown visible when hovering either link or menu */
.nav-menu .dropdown:hover .dropdown-menu,
.nav-menu .dropdown .dropdown-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Add a class for JavaScript-controlled hover state */
.nav-menu .dropdown.dropdown-hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Keep dropdown open when on area-covered page and clicked (for click-to-open behavior) */
.nav-menu .dropdown.on-area-page.dropdown-open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Allow hover behavior on all pages, including area-covered pages */
/* Hover should work everywhere, but click-to-open is additional functionality on area pages */
.nav-menu .dropdown.on-area-page:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-menu .dropdown.on-area-page.dropdown-open:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-menu li {
    margin: 0;
    padding: 0;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: #0B1622;
    text-decoration: none;
    font-weight: 500 !important;
    transition: all 0.3s;
    font-size: clamp(0.85rem, 1.2vw, 0.95rem);
    pointer-events: auto;
    cursor: pointer;
}

.dropdown-menu a:hover {
    background-color: #F3F4F6;
    color: var(--primary-color);
    padding-left: 1.5625rem;
}

/* Ensure dropdown menu items are always clickable when visible */
.nav-menu .dropdown:hover .dropdown-menu a,
.nav-menu .dropdown .dropdown-menu:hover a,
.nav-menu .dropdown.dropdown-hover .dropdown-menu a,
.nav-menu .dropdown.on-area-page.dropdown-open .dropdown-menu a {
    pointer-events: auto;
    cursor: pointer;
}

/* About Header - White Background */
.about-page .header {
    background: rgba(255, 255, 255, 0.95);
}

.about-page .nav-menu a {
    color: var(--text-dark);
}

.about-page .nav-menu a:hover,
.about-page .nav-menu a.active {
    color: var(--primary-color);
}

/* Navbar CTA Button */
.navbar .btn-primary {
    background-color: #f48302;
    color: #ffffff;
    border-radius: 0.625rem;
    padding: 0.75rem 1.75rem;
    font-weight: 600;
    font-size: clamp(0.9rem, 1.2vw, 1rem);
    white-space: nowrap;
    border: none;
    transition: background-color 0.3s;
    /* Prevent layout shift by reserving space */
    min-width: fit-content;
    box-sizing: border-box;
    /* Prevent reflow */
    contain: layout style;
}

.navbar .btn-primary:hover {
    background-color: #e67a1f;
}

/* Hamburger Menu Button */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: clamp(1.5rem, 2.5vw, 2rem);
    height: clamp(1.5rem, 2.5vw, 2rem);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10001;
    position: relative;
}

.hamburger-menu span {
    width: 100%;
    height: 2px;
    background-color: #0B1622;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(0.375rem, 0.375rem);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(0.375rem, -0.375rem);
}

/* Responsive Header */
@media (max-width: 48rem) {
    .hamburger-menu {
        display: flex;
        order: 3;
        justify-self: end;
    }

    .navbar .container {
        padding: 0 clamp(0.5rem, 1vw, 0.75rem);
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: visible;
        max-width: 100vw;
        height: auto;
    }

    .nav-wrapper {
        grid-template-columns: auto 1fr auto;
        position: relative;
        gap: clamp(0.5rem, 1vw, 0.75rem);
        align-items: center;
        padding: 0;
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: visible;
        width: 100%;
        max-width: 100%;
        height: auto;
    }

    .logo {
        justify-self: start;
        grid-column: 1;
    }
    
    .logo img {
        height: clamp(2.5rem, 4.5vw, 3.5rem);
    }

    .navbar .btn-primary {
        order: 2;
        padding: clamp(0.4375rem, 0.875vw, 0.5625rem) clamp(0.75rem, 1.5vw, 1rem);
        font-size: clamp(0.7rem, 1.1vw, 0.8rem);
        white-space: nowrap;
        margin: 0;
        line-height: 1.2;
        justify-self: stretch;
        grid-column: 2;
        margin-right: clamp(0.5rem, 1vw, 0.75rem);
        width: 100%;
        height: 80%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .hamburger-menu {
        grid-column: 3;
        justify-self: end;
        margin-right: clamp(0.5rem, 1vw, 0.75rem);
    }

    .nav-menu {
        flex-direction: column;
        gap: 0;
        position: fixed;
        top: clamp(3.5rem, 7vw, 4.5rem);
        left: 0;
        width: 100%;
        background-color: #0B1622;
        padding: clamp(1rem, 2vw, 1.25rem);
        display: none;
        max-height: calc(100vh - clamp(3.5rem, 7vw, 4.5rem));
        overflow-y: auto;
        box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.2);
        z-index: 9998;
        order: 4;
        grid-column: 1 / -1;
        margin-top: clamp(0.5rem, 1vw, 0.75rem);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-menu li:last-child {
        border-bottom: none;
    }

    .nav-menu > li > a {
        display: block;
        padding: clamp(0.875rem, 1.75vw, 1rem) clamp(0.75rem, 1.5vw, 1rem);
        color: var(--white);
        font-size: clamp(0.95rem, 1.5vw, 1.05rem);
        width: 100%;
        text-align: left;
        font-weight: 500 !important;
    }

    .nav-menu > li > a:hover,
    .nav-menu > li > a.active {
        color: var(--primary-color);
        background-color: rgba(255, 138, 0, 0.1);
        font-weight: 500 !important;
    }

    /* Dropdown Menu on Mobile */
    .nav-menu .dropdown {
        position: static;
        width: 100%;
    }

    .dropdown-link {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: clamp(0.875rem, 1.75vw, 1rem) clamp(0.75rem, 1.5vw, 1rem);
        color: var(--white);
        font-size: clamp(0.95rem, 1.5vw, 1.05rem);
        width: 100%;
        text-align: left;
        font-weight: 500 !important;
    }

    .dropdown-link::after {
        content: '▼';
        font-size: clamp(0.75rem, 1.2vw, 0.875rem);
        transition: transform 0.3s ease;
        margin-left: 0.5rem;
    }

    .dropdown-link.active::after,
    .dropdown.open .dropdown-link::after {
        transform: rotate(180deg);
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background-color: rgba(0, 0, 0, 0.3);
        border-radius: 0;
        margin: 0;
        padding: 0;
        min-width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        pointer-events: auto;
        display: block;
    }

    .dropdown.open .dropdown-menu {
        max-height: 31.25rem;
        padding: clamp(0.5rem, 1vw, 0.75rem) 0;
    }

    .dropdown-menu li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .dropdown-menu li:last-child {
        border-bottom: none;
    }

    .dropdown-menu a {
        display: block;
        padding: clamp(0.75rem, 1.5vw, 0.875rem) clamp(1.5rem, 3vw, 2rem);
        color: rgba(255, 255, 255, 0.9);
        font-size: clamp(0.875rem, 1.4vw, 0.95rem);
        text-decoration: none;
        transition: all 0.3s;
        white-space: normal;
        font-weight: 500 !important;
    }

    .dropdown-menu a:hover {
        background-color: rgba(255, 138, 0, 0.15);
        color: var(--primary-color);
        padding-left: clamp(2rem, 4vw, 2.5rem);
    }
}

.nav-menu .dropdown-menu a {
    font-weight: 400 !important; 
}


.nav-menu .dropdown > a.dropdown-link {
    font-weight: 400 !important;
}


.nav-menu a.active,
.nav-menu li a.active {
    font-weight: 700 !important;
    color: var(--primary-color) !important;
}
