/* =========================================================
   PRESTIGE BRIDGE - GLOBAL HEADER
   Single source of truth for all header styling.
   Everything is scoped under .pb-header (no !important needed).
   ========================================================= */

.pb-header,
.pb-header *,
.pb-header *::before,
.pb-header *::after { box-sizing: border-box; }

.pb-header {
    --pb-navy: #06264b;
    --pb-navy-deep: #041d3a;
    --pb-green: #078542;
    --pb-green-dark: #056d36;
    --pb-text: #19304c;
    --pb-border: rgba(6, 38, 75, .10);
    --pb-soft: #f4f8fb;

    position: relative;
    width: 100%;
    z-index: 99999;
    background: rgba(255, 255, 255, .98);
    font-family: Montserrat, Inter, "Segoe UI", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.pb-header.pb-header-sticky { position: sticky; top: 0; }
.admin-bar .pb-header.pb-header-sticky { top: 32px; }

.pb-header .pb-top-line { height: 3px; background: var(--pb-green); }

/* ---------- Layout (desktop): menu | centered logo | menu ---------- */
.pb-header .pb-header-inner {
    width: min(1380px, calc(100% - 80px));
    height: 100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 190px 1fr;
    align-items: center;
    position: relative;
    transition: height .3s ease;
}
.pb-header .pb-nav { height: 100%; display: flex; align-items: center; gap: 34px; }
.pb-header .pb-nav-left { justify-content: flex-start; }
.pb-header .pb-nav-right { justify-content: flex-end; }

/* ---------- Desktop menu ---------- */
.pb-header .pb-menu {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 34px;
    margin: 0;
    padding: 0;
}
.pb-header .pb-menu li { position: relative; margin: 0; padding: 0; list-style: none; }
.pb-header .pb-menu > li > a {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 8px 0;
    color: var(--pb-text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .25px;
    text-decoration: none;
    white-space: nowrap;
    transition: color .25s ease;
}
.pb-header .pb-menu > li > a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--pb-green);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .28s ease;
}
.pb-header .pb-menu > li > a:hover,
.pb-header .pb-menu > li > a:focus-visible,
.pb-header .pb-menu > li.current-menu-item > a,
.pb-header .pb-menu > li.current-menu-ancestor > a { color: var(--pb-green); }
.pb-header .pb-menu > li > a:hover::after,
.pb-header .pb-menu > li > a:focus-visible::after,
.pb-header .pb-menu > li.current-menu-item > a::after,
.pb-header .pb-menu > li.current-menu-ancestor > a::after { transform: scaleX(1); }

/* Dropdown arrow for items with children */
.pb-header .pb-menu > li.menu-item-has-children > a { gap: 7px; }
.pb-header .pb-menu > li.menu-item-has-children > a::before {
    content: "";
    order: 2;
    width: 5px;
    height: 5px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
}

/* Dropdown panel */
.pb-header .pb-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: -16px;
    z-index: 20;
    min-width: 230px;
    margin: 0;
    padding: 10px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--pb-border);
    border-radius: 10px;
    box-shadow: 0 18px 36px rgba(4, 29, 58, .12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.pb-header .pb-nav-right .pb-menu .sub-menu { left: auto; right: -16px; }
.pb-header .pb-menu li:hover > .sub-menu,
.pb-header .pb-menu li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}
.pb-header .pb-menu .sub-menu a {
    display: flex;
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--pb-text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .2s ease, color .2s ease;
}
.pb-header .pb-menu .sub-menu a:hover,
.pb-header .pb-menu .sub-menu a:focus-visible { background: var(--pb-soft); color: var(--pb-green); }

/* ---------- Desktop CTA ---------- */
.pb-header a.pb-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 145px;
    height: 46px;
    padding: 0 20px;
    color: #fff;
    background: var(--pb-navy);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .25s ease, transform .25s ease, box-shadow .25s ease;
}
.pb-header a.pb-cta:hover,
.pb-header a.pb-cta:focus-visible {
    color: #fff;
    background: var(--pb-green);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(7, 133, 66, .22);
}
.pb-header a.pb-cta span { font-size: 17px; line-height: 1; transition: transform .25s ease; }
.pb-header a.pb-cta:hover span { transform: translateX(3px); }

/* ---------- Logo (desktop): centered circle, hangs over the header ---------- */
.pb-header .pb-logo-wrap {
    position: relative;
    width: 190px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pb-header .pb-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    padding: 11px;
    margin: 0;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 8px 28px rgba(4, 29, 58, .09);
    text-decoration: none;
    transform: translate(-50%, -36%);
    transition: transform .35s ease, box-shadow .35s ease, width .3s ease, height .3s ease;
}
.pb-header .pb-logo::before {
    content: "";
    position: absolute;
    inset: 5px;
    border: 1px solid rgba(7, 133, 66, .18);
    border-radius: 50%;
    pointer-events: none;
}
.pb-header .pb-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}
.pb-header .pb-logo:hover {
    transform: translate(-50%, -39%);
    box-shadow: 0 12px 35px rgba(4, 29, 58, .13);
}

/* Scrolled state (desktop) */
.pb-header.scrolled .pb-header-inner { height: 75px; }
.pb-header.scrolled .pb-logo { width: 110px; height: 110px; }

/* Mobile-only parts are hidden on desktop */
.pb-header .pb-mobile-toggle,
.pb-header .pb-mobile-nav,
.pb-backdrop { display: none; }

/* =========================================================
   TABLET / SMALL DESKTOP
   ========================================================= */
@media (max-width: 1100px) and (min-width: 992px) {
    .pb-header .pb-header-inner { width: calc(100% - 50px); grid-template-columns: 1fr 160px 1fr; }
    .pb-header .pb-nav,
    .pb-header .pb-menu { gap: 21px; }
    .pb-header .pb-menu > li > a { font-size: 12px; }
    .pb-header .pb-logo-wrap { width: 160px; }
    .pb-header .pb-logo { width: 130px; height: 130px; }
    .pb-header.scrolled .pb-logo { width: 105px; height: 105px; }
    .pb-header a.pb-cta { min-width: 125px; padding: 0 14px; }
}

/* =========================================================
   MOBILE & TABLET (<= 991px)
   Logo is always exactly centered: [48px | logo (1fr) | 48px]
   ========================================================= */
@media (max-width: 991px) {

    .pb-header .pb-header-inner {
        width: 100%;
        max-width: 100%;
        height: 76px;
        padding: 0 14px;
        grid-template-columns: 48px minmax(0, 1fr) 48px;
        grid-template-rows: 1fr;
    }
    .pb-header.scrolled .pb-header-inner { height: 68px; }

    .pb-header .pb-nav { display: none; }

    .pb-header .pb-logo-wrap {
        grid-column: 2;
        grid-row: 1;
        position: static;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .pb-header .pb-logo {
        position: relative;
        top: auto;
        left: auto;
        flex: 0 0 auto;
        width: 64px;
        height: 64px;
        padding: 5px;
        margin: 0 auto;
        transform: none;
        box-shadow: 0 4px 15px rgba(4, 29, 58, .10);
    }
    .pb-header .pb-logo:hover { transform: none; }
    .pb-header.scrolled .pb-logo { width: 54px; height: 54px; padding: 4px; }

    /* ---------- Hamburger ---------- */
    .pb-header button.pb-mobile-toggle {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        margin: 0;
        padding: 0;
        color: var(--pb-navy);
        background: #fff;
        border: 1px solid var(--pb-border);
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(4, 29, 58, .07);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: background .3s ease, border-color .3s ease, box-shadow .3s ease;
    }
    .pb-header button.pb-mobile-toggle:hover,
    .pb-header button.pb-mobile-toggle:focus-visible {
        color: var(--pb-navy);
        background: #fff;
        border-color: rgba(7, 133, 66, .45);
        box-shadow: 0 4px 14px rgba(7, 133, 66, .16);
        outline: none;
    }
    .pb-header button.pb-mobile-toggle span {
        display: block;
        height: 2px;
        border-radius: 2px;
        background: var(--pb-navy);
        transition: transform .35s cubic-bezier(.65, 0, .35, 1), width .3s ease, opacity .2s ease, background .3s ease;
    }
    .pb-header button.pb-mobile-toggle span:nth-child(1),
    .pb-header button.pb-mobile-toggle span:nth-child(3) { width: 20px; }
    .pb-header button.pb-mobile-toggle span:nth-child(2) { width: 13px; background: var(--pb-green); }
    .pb-header button.pb-mobile-toggle:hover span:nth-child(2) { width: 20px; }

    /* Open state: becomes a navy button with a clean "X" */
    .pb-header.mobile-open button.pb-mobile-toggle,
    .pb-header.mobile-open button.pb-mobile-toggle:hover,
    .pb-header.mobile-open button.pb-mobile-toggle:focus-visible {
        background: var(--pb-navy);
        border-color: var(--pb-navy);
        box-shadow: 0 6px 16px rgba(6, 38, 75, .28);
    }
    .pb-header.mobile-open button.pb-mobile-toggle span { background: #fff; }
    .pb-header.mobile-open button.pb-mobile-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .pb-header.mobile-open button.pb-mobile-toggle span:nth-child(2) { width: 0; opacity: 0; }
    .pb-header.mobile-open button.pb-mobile-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* ---------- Dropdown panel ---------- */
    .pb-header .pb-mobile-nav {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        max-height: calc(100vh - 90px);
        max-height: calc(100dvh - 90px);
        overflow-y: auto;
        overscroll-behavior: contain;
        background: #fff;
        border-top: 1px solid var(--pb-border);
        border-radius: 0 0 22px 22px;
        box-shadow: 0 28px 50px rgba(4, 29, 58, .20);
        counter-reset: pbm;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-10px);
        transition: opacity .25s ease, transform .3s ease, visibility 0s linear .3s;
    }
    .pb-header.mobile-open .pb-mobile-nav {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
        transition-delay: 0s;
    }

    .pb-header .pb-mobile-inner { width: 100%; padding: 6px 22px 26px; }

    .pb-header .pb-mobile-label {
        display: block;
        padding: 14px 2px 6px;
        color: var(--pb-green);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .2em;
        text-transform: uppercase;
    }

    .pb-header .pb-mobile-menu { list-style: none; margin: 0; padding: 0; }
    .pb-header .pb-mobile-menu li { margin: 0; padding: 0; list-style: none; }
    .pb-header .pb-mobile-menu > li {
        counter-increment: pbm;
        border-bottom: 1px solid rgba(6, 38, 75, .07);
    }
    .pb-header .pb-mobile-menu a {
        position: relative;
        display: flex;
        align-items: center;
        gap: 14px;
        min-height: 54px;
        padding: 0 2px;
        color: var(--pb-navy);
        font-size: 16px;
        font-weight: 600;
        text-decoration: none;
        transition: color .2s ease, padding-left .25s ease;
    }
    .pb-header .pb-mobile-menu > li > a::before {
        content: counter(pbm, decimal-leading-zero);
        flex: 0 0 22px;
        color: var(--pb-green);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .08em;
    }
    .pb-header .pb-mobile-menu > li > a::after {
        content: "";
        width: 8px;
        height: 8px;
        margin-left: auto;
        border-top: 2px solid currentColor;
        border-right: 2px solid currentColor;
        opacity: .3;
        transform: rotate(45deg);
        transition: transform .25s ease, opacity .25s ease;
    }
    .pb-header .pb-mobile-menu > li > a:hover,
    .pb-header .pb-mobile-menu > li > a:focus-visible,
    .pb-header .pb-mobile-menu > li.current-menu-item > a,
    .pb-header .pb-mobile-menu > li.current-menu-ancestor > a {
        color: var(--pb-green);
        padding-left: 8px;
    }
    .pb-header .pb-mobile-menu > li > a:hover::after,
    .pb-header .pb-mobile-menu > li > a:focus-visible::after,
    .pb-header .pb-mobile-menu > li.current-menu-item > a::after {
        opacity: 1;
        transform: translateX(3px) rotate(45deg);
    }

    /* Sub menu items (if a menu has children) */
    .pb-header .pb-mobile-menu .sub-menu {
        list-style: none;
        margin: 0 0 10px 38px;
        padding: 0 0 0 14px;
        border-left: 2px solid rgba(7, 133, 66, .28);
    }
    .pb-header .pb-mobile-menu .sub-menu a { min-height: 42px; font-size: 14px; font-weight: 500; }
    .pb-header .pb-mobile-menu .sub-menu a:hover,
    .pb-header .pb-mobile-menu .sub-menu a:focus-visible,
    .pb-header .pb-mobile-menu .sub-menu .current-menu-item > a { color: var(--pb-green); }

    /* CTA + phone */
    .pb-header a.pb-mobile-cta {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        min-height: 52px;
        margin-top: 20px;
        padding: 0 20px;
        color: #fff;
        background: linear-gradient(135deg, var(--pb-green) 0%, var(--pb-green-dark) 100%);
        border-radius: 12px;
        box-shadow: 0 10px 22px rgba(7, 133, 66, .26);
        font-size: 15px;
        font-weight: 700;
        letter-spacing: .3px;
        text-decoration: none;
        transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
    }
    .pb-header a.pb-mobile-cta:hover,
    .pb-header a.pb-mobile-cta:focus-visible {
        color: #fff;
        background: linear-gradient(135deg, var(--pb-navy) 0%, var(--pb-navy-deep) 100%);
        box-shadow: 0 10px 22px rgba(6, 38, 75, .28);
        transform: translateY(-1px);
    }
    .pb-header a.pb-mobile-phone {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-top: 12px;
        padding: 12px 14px;
        color: var(--pb-navy);
        background: var(--pb-soft);
        border-radius: 12px;
        font-size: 15px;
        font-weight: 700;
        text-decoration: none;
    }
    .pb-header a.pb-mobile-phone svg { flex: 0 0 auto; color: var(--pb-green); }
    .pb-header a.pb-mobile-phone small {
        display: block;
        margin-bottom: 1px;
        color: #66758a;
        font-size: 10px;
        font-weight: 600;
        letter-spacing: .12em;
        text-transform: uppercase;
    }

    /* Staggered reveal */
    .pb-header .pb-mobile-menu > li,
    .pb-header a.pb-mobile-cta,
    .pb-header a.pb-mobile-phone {
        opacity: 0;
        transform: translateY(10px);
        transition: opacity .35s ease, transform .35s ease, color .2s ease, background .25s ease, box-shadow .25s ease, padding-left .25s ease;
    }
    .pb-header.mobile-open .pb-mobile-menu > li,
    .pb-header.mobile-open a.pb-mobile-cta,
    .pb-header.mobile-open a.pb-mobile-phone { opacity: 1; transform: none; }
    .pb-header.mobile-open .pb-mobile-menu > li:nth-child(1) { transition-delay: .05s; }
    .pb-header.mobile-open .pb-mobile-menu > li:nth-child(2) { transition-delay: .10s; }
    .pb-header.mobile-open .pb-mobile-menu > li:nth-child(3) { transition-delay: .15s; }
    .pb-header.mobile-open .pb-mobile-menu > li:nth-child(4) { transition-delay: .20s; }
    .pb-header.mobile-open .pb-mobile-menu > li:nth-child(n+5) { transition-delay: .24s; }
    .pb-header.mobile-open a.pb-mobile-cta { transition-delay: .28s; }
    .pb-header.mobile-open a.pb-mobile-phone { transition-delay: .32s; }

    /* ---------- Backdrop (shown only while the menu is open) ---------- */
    .pb-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 99990;
        background: rgba(4, 29, 58, .5);
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
        opacity: 0;
        visibility: hidden;
        transition: opacity .3s ease, visibility 0s linear .3s;
    }
    .pb-header.mobile-open + .pb-backdrop {
        opacity: 1;
        visibility: visible;
        transition-delay: 0s;
    }

    html.pb-menu-open { overflow: hidden; }
}

@media (max-width: 782px) {
    .admin-bar .pb-header.pb-header-sticky { top: 46px; }
}
@media (max-width: 600px) {
    .admin-bar .pb-header.pb-header-sticky { top: 0; }
}

@media (max-width: 480px) {
    .pb-header .pb-header-inner { height: 70px; padding: 0 12px; }
    .pb-header.scrolled .pb-header-inner { height: 64px; }
    .pb-header .pb-logo { width: 60px; height: 60px; padding: 4px; }
    .pb-header.scrolled .pb-logo { width: 52px; height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
    .pb-header,
    .pb-header *,
    .pb-header *::before,
    .pb-header *::after,
    .pb-backdrop { transition-duration: .01ms; transition-delay: 0s; }
}
