/* ================================================================
   MEGA MENU NAVIGATION
   Palette: white / gray / brand blue
   ================================================================ */

/* ----------------------------------------------------------------
   FIXED BARS
   ---------------------------------------------------------------- */
/* The injected chrome lives inside #site-header / #site-footer mounts.
   Force the header mount into its own top-level stacking context so the
   fixed bars always paint above page content (hero overlays, animated
   sections, etc.) and stay clickable. */
#site-header {
    position: relative;
    z-index: 1100;
}

#site-footer {
    position: relative;
    z-index: 1;
}

.top-bar {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1002;
    background: transparent;
    border-bottom: 1px solid transparent;
    transition: transform 0.35s ease, opacity 0.35s ease, background 0.35s ease;
}

.top-bar.is-hidden {
    transform: translateY(-100%);
    opacity: 0;
}

.main-header {
    position: fixed !important;
    top: 45px;
    left: 0;
    right: 0;
    z-index: 1001;
    padding: 12px 0;
    background: transparent;
    border-bottom: 1px solid transparent;
    transition:
        top 0.35s ease,
        background 0.35s ease,
        border-color 0.35s ease,
        box-shadow 0.35s ease,
        padding 0.25s ease;
}

/* On scroll: stay pinned to top but keep background transparent. */
.main-header.is-scrolled {
    top: 0;
    padding: 10px 0;
    background: transparent;
    border-bottom-color: transparent;
    box-shadow: none;
}

/* Background only appears when the menu is actively used.
   NOTE: desktop mega-open must NOT move the header (no `top` change),
   otherwise the bar shifts under the cursor on hover and links become
   unclickable. Only the mobile drawer pins the header to the very top. */
.main-header.mega-open {
    background: rgba(85, 133, 181, 0.96);
    border-bottom-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 28px rgba(61, 106, 150, 0.28);
}

.main-header.mobile-menu-open {
    top: 0;
    background: rgba(85, 133, 181, 0.96);
    border-bottom-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 28px rgba(61, 106, 150, 0.28);
}

/* ----------------------------------------------------------------
   NAV SHELL
   ---------------------------------------------------------------- */
/* Keep the nav bar above the dimming backdrop so links stay clickable. */
.main-header > .container {
    position: relative;
    z-index: 3;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
}

.nav-list {
    display: flex !important;
    align-items: center;
    list-style: none;
    gap: 4px;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

/* ----------------------------------------------------------------
   LINKS
   ---------------------------------------------------------------- */
.nav-link {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    white-space: nowrap;
    font-size: 11px !important;
    letter-spacing: 0.9px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    padding: 9px 11px !important;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-link::after {
    display: none !important;
}

.nav-link:hover,
.nav-item.is-open > .nav-link,
.nav-link.active {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff !important;
}

.nav-chevron {
    width: 10px;
    height: 10px;
    opacity: 0.9;
    transition: transform 0.25s ease;
}

.nav-item.is-open > .nav-link .nav-chevron {
    transform: rotate(180deg);
}

.nav-link-cta {
    background: #ffffff !important;
    color: var(--primary-blue-dark) !important;
    border-radius: 24px !important;
    padding: 10px 18px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    margin-left: 8px;
    box-shadow: 0 3px 14px rgba(61, 106, 150, 0.2);
}

.nav-link-cta:hover {
    transform: translateY(-1px);
    background: #f4f8fc !important;
    box-shadow: 0 6px 16px rgba(61, 106, 150, 0.28);
}

/* ----------------------------------------------------------------
   DESKTOP MEGA PANELS
   ---------------------------------------------------------------- */
.mega-panels-host {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 2;
    pointer-events: none;
}

.mega-panel {
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    background: rgba(251, 253, 255, 0.98);
    border-top: 1px solid rgba(85, 133, 181, 0.25);
    border-bottom: 1px solid rgba(85, 133, 181, 0.22);
    box-shadow: 0 20px 45px rgba(61, 106, 150, 0.16);

    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    pointer-events: none;
    transition:
        opacity 0.18s ease,
        transform 0.18s ease,
        visibility 0s linear 0.18s;
}

.mega-panel.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition:
        opacity 0.18s ease,
        transform 0.18s ease,
        visibility 0s linear 0s;
}

.mega-panel-body {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 40px;
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.mega-col {
    flex: 1;
    padding-right: 20px;
    border-right: 1px solid rgba(85, 133, 181, 0.2);
}

.mega-col:last-child {
    border-right: none;
    padding-right: 0;
}

.mega-col--cta {
    flex: 0 0 230px;
}

.mega-col-heading {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--primary-blue);
    margin-bottom: 12px;
}

.mega-col-heading--sub {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(85, 133, 181, 0.18);
}

.mega-link {
    display: block;
    text-decoration: none;
    border-radius: 8px;
    padding: 7px 10px;
    margin: 2px 0;
    transition: background 0.18s ease, transform 0.18s ease;
}

.mega-link:hover {
    background: rgba(85, 133, 181, 0.1);
    transform: translateX(3px);
}

.mega-link-name {
    display: block;
    font-size: 13px;
    color: #2f4d73;
    font-weight: 500;
    line-height: 1.35;
}

.mega-link-sub {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: #6b7f98;
    line-height: 1.35;
}

.mega-feature-card {
    background: linear-gradient(135deg, rgba(85, 133, 181, 0.12) 0%, rgba(111, 160, 204, 0.08) 100%);
    border: 1px solid rgba(85, 133, 181, 0.24);
    border-radius: 14px;
    padding: 18px;
}

.mega-feature-card h4 {
    color: #2f4d73;
    font-family: var(--font-display);
    font-size: 16px;
    line-height: 1.3;
    margin-bottom: 8px;
}

.mega-feature-card p {
    color: #5f7692;
    font-size: 12px;
    line-height: 1.55;
    margin-bottom: 12px;
}

.mega-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    background: var(--primary-blue);
    color: #fff;
    padding: 9px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    transition: background 0.2s ease;
}

.mega-cta-btn:hover {
    background: var(--primary-blue-dark);
}

.mega-footer {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 40px 16px;
    border-top: 1px solid rgba(85, 133, 181, 0.18);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.mega-footer-label {
    color: #6b7f98;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.3px;
    font-weight: 700;
}

.mega-footer-link {
    text-decoration: none;
    color: var(--primary-blue-dark);
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(85, 133, 181, 0.25);
    border-radius: 16px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mega-footer-link:hover {
    background: rgba(85, 133, 181, 0.08);
}

.mega-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: rgba(85, 133, 181, 0.15);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.mega-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.2s ease;
}

/* ----------------------------------------------------------------
   HAMBURGER + MOBILE
   ---------------------------------------------------------------- */
.hamburger-menu {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 9px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
}

.hamburger-menu span {
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.hamburger-menu.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.mobile-close-btn {
    display: none;
}

.mobile-overlay {
    display: none;
}

body.menu-open {
    overflow: hidden;
}

@media (max-width: 1140px) {
    .hamburger-menu {
        display: flex;
    }

    .mobile-close-btn {
        display: flex;
        position: absolute;
        top: 14px;
        right: 14px;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        border: 1px solid #d5deea;
        background: #fff;
        color: var(--primary-blue-dark);
        align-items: center;
        justify-content: center;
        font-size: 18px;
        cursor: pointer;
        z-index: 2;
    }

    .nav-list {
        position: fixed !important;
        top: 0;
        right: -100%;
        width: min(360px, 86vw);
        height: 100dvh;
        background: #ffffff;
        border-left: 1px solid #dfe7f2;
        box-shadow: -8px 0 28px rgba(61, 106, 150, 0.15);
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start;
        gap: 0 !important;
        padding: 64px 0 26px;
        overflow-y: auto;
        transition: right 0.32s ease;
        z-index: 1003;
    }

    .nav-list.mobile-open {
        right: 0;
    }

    .nav-item {
        border-bottom: 1px solid #edf2f8;
    }

    .nav-link {
        width: 100%;
        justify-content: space-between;
        color: var(--primary-blue-dark) !important;
        font-size: 12.5px !important;
        letter-spacing: 0.6px !important;
        padding: 14px 20px !important;
        border-radius: 0;
    }

    .nav-link:hover,
    .nav-item.is-open > .nav-link,
    .nav-item.mobile-expanded > .nav-link {
        background: rgba(85, 133, 181, 0.1);
        color: var(--primary-blue-dark) !important;
    }

    .nav-link-cta {
        margin: 14px 16px 0;
        width: calc(100% - 32px);
        text-align: center;
        justify-content: center;
        border-radius: 10px !important;
        background: var(--primary-blue) !important;
        color: #fff !important;
    }

    .mega-panels-host,
    .mega-backdrop {
        display: none !important;
    }

    .mobile-accordion {
        max-height: 0;
        overflow: hidden;
        background: #f7fbff;
        transition: max-height 0.3s ease;
    }

    .nav-item.mobile-expanded .mobile-accordion {
        max-height: 650px;
    }

    .mobile-accordion-section {
        padding: 8px 0;
        border-top: 1px solid #e7eef8;
    }

    .mobile-accordion-heading {
        display: block;
        padding: 6px 20px 4px 34px;
        font-size: 9px;
        text-transform: uppercase;
        letter-spacing: 1.3px;
        color: var(--primary-blue);
        font-weight: 700;
    }

    .mobile-accordion a {
        display: block;
        text-decoration: none;
        color: #385a84;
        font-size: 13px;
        padding: 9px 20px 9px 34px;
    }

    .mobile-accordion a:hover {
        background: rgba(85, 133, 181, 0.12);
    }

    .mobile-view-all {
        font-size: 11px !important;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        font-weight: 700;
        color: var(--primary-blue-dark) !important;
        background: rgba(85, 133, 181, 0.08);
    }

    .mobile-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1000;
        background: rgba(85, 133, 181, 0.2);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0s linear 0.25s;
    }

    .mobile-overlay.is-visible {
        opacity: 1;
        visibility: visible;
        transition: opacity 0.25s ease;
    }

    .main-header {
        top: 0 !important;
        background: transparent;
        box-shadow: none;
    }

    .top-bar {
        display: none;
    }

    .main-header.mobile-menu-open {
        background: rgba(85, 133, 181, 0.96);
        border-bottom-color: rgba(255, 255, 255, 0.25);
        box-shadow: 0 8px 24px rgba(61, 106, 150, 0.22);
    }
}

@media (min-width: 1141px) {
    .mobile-accordion {
        display: none !important;
    }
}

/* ================================================================
   NAV CHROME FIXES (authoritative — loaded on every page)
   - Keep the bar transparent but legible over any hero (scrim).
   - Unify the top-bar contact links (no more blue underlines).
   - Keep the Contact Us button visible on every page, even when it
     is the active page.
   ================================================================ */

/* Subtle scrim: preserves the transparent look while guaranteeing the
   white logo, nav links and contact text stay legible over light heroes. */
.top-bar::before,
.main-header::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.top-bar::before {
    background: linear-gradient(to bottom, rgba(20, 41, 64, 0.36), rgba(20, 41, 64, 0.16));
}

.main-header::before {
    background: linear-gradient(to bottom, rgba(20, 41, 64, 0.24), rgba(20, 41, 64, 0));
}

/* When the menu paints its own solid background, drop the scrim. */
.main-header.mega-open::before,
.main-header.mobile-menu-open::before {
    background: none;
}

.top-bar > .container {
    position: relative;
    z-index: 1;
}

/* Top contact bar: address, phone and email share one clean white style. */
.top-bar,
.top-bar .contact-info,
.top-bar .address,
.top-bar .contact-item,
.top-bar .contact-info span {
    color: #ffffff !important;
}

.top-bar .icon {
    color: #ffffff;
    opacity: 0.85;
}

.top-bar a {
    color: #ffffff !important;
    text-decoration: none !important;
    transition: opacity 0.2s ease;
}

.top-bar a:hover {
    opacity: 0.72;
    text-decoration: none !important;
}

.top-bar .address,
.top-bar .contact-item {
    text-shadow: 0 1px 3px rgba(12, 28, 45, 0.4);
}

@media (min-width: 1141px) {
    .nav-link {
        text-shadow: 0 1px 3px rgba(12, 28, 45, 0.38);
    }

    /* Contact Us CTA — always readable: white pill, dark-blue text,
       defined by a soft border + shadow so it also stands out on light
       backgrounds, and immune to the .active white-text override. */
    .nav-link.nav-link-cta,
    .nav-link.nav-link-cta.active,
    .nav-link.nav-link-cta:focus {
        background: #ffffff !important;
        color: var(--primary-blue-dark, #3d6a96) !important;
        border: 1px solid rgba(85, 133, 181, 0.45);
        box-shadow: 0 4px 16px rgba(16, 40, 66, 0.30);
        text-shadow: none;
    }

    .nav-link.nav-link-cta:hover {
        background: #eef5fc !important;
        color: var(--primary-blue-dark, #3d6a96) !important;
        transform: translateY(-1px);
    }
}
