:root {
    --fgwm-navy: #07164a;
    --fgwm-navy-soft: #17265f;
    --fgwm-cream: #fffdf9;
    --fgwm-warm: #f4efe6;
    --fgwm-champagne: #e8decb;
    --fgwm-champagne-deep: #d7c9ae;
    --fgwm-line: rgba(7, 22, 74, 0.14);
    --fgwm-shadow: 0 18px 50px rgba(7, 22, 74, 0.12);
    --fgwm-height: 76px;
    --fgwm-serif: "Cormorant Garamond", "Playfair Display", "Libre Baskerville", Georgia, "Times New Roman", serif;
}

html body.fgwm-enabled {
    padding-top: var(--fgwm-height) !important;
}

html body.admin-bar.fgwm-enabled {
    padding-top: calc(var(--fgwm-height) + 32px) !important;
}

@media (max-width: 782px) {
    html body.admin-bar.fgwm-enabled {
        padding-top: calc(var(--fgwm-height) + 46px) !important;
    }
}

/* Hide the original theme header as broadly as possible without touching page content cards. */
body.fgwm-hide-theme-header #masthead,
body.fgwm-hide-theme-header .site-header,
body.fgwm-hide-theme-header header.site-header,
body.fgwm-hide-theme-header .main-navigation,
body.fgwm-hide-theme-header .menu-toggle,
body.fgwm-hide-theme-header .site-branding,
body.fgwm-hide-theme-header .wp-block-template-part:has(.wp-block-navigation),
body.fgwm-hide-theme-header .wp-block-template-part:has(header) {
    display: none !important;
}

/* Remove the extra top whitespace that many themes/page builders add above the first hero block. */
body.fgwm-enabled #page,
body.fgwm-enabled .site,
body.fgwm-enabled .site-content,
body.fgwm-enabled .content-area,
body.fgwm-enabled .site-main,
body.fgwm-enabled main,
body.fgwm-enabled article,
body.fgwm-enabled .entry-content,
body.fgwm-enabled .wp-site-blocks {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

body.fgwm-enabled .entry-content > :first-child,
body.fgwm-enabled main > :first-child,
body.fgwm-enabled .site-main > :first-child,
body.fgwm-enabled .wp-site-blocks > :first-child:not(.fgwm-bar),
body.fgwm-enabled .wp-block-cover:first-child,
body.fgwm-enabled .wp-block-video:first-child,
body.fgwm-enabled .wp-block-image:first-child,
body.fgwm-enabled .wp-block-group:first-child {
    margin-top: 0 !important;
}

.fgwm-bar,
.fgwm-bar * {
    box-sizing: border-box;
}

.fgwm-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    min-height: var(--fgwm-height);
    background: linear-gradient(90deg, rgba(255,253,249,0.98), rgba(244,239,230,0.97));
    border-bottom: 1px solid rgba(7, 22, 74, 0.10);
    box-shadow: 0 10px 35px rgba(7, 22, 74, 0.06);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    color: var(--fgwm-navy);
    font-family: var(--fgwm-serif);
}

body.admin-bar .fgwm-bar {
    top: 32px;
}

@media (max-width: 782px) {
    body.admin-bar .fgwm-bar {
        top: 46px;
    }
}

.fgwm-inner {
    width: min(1180px, calc(100% - 44px));
    min-height: var(--fgwm-height);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 26px;
}

.fgwm-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--fgwm-navy) !important;
    text-decoration: none !important;
    flex: 0 0 auto;
    min-width: 0;
}

.fgwm-brand-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 50%;
    border: 1px solid rgba(7, 22, 74, 0.10);
    background: var(--fgwm-cream);
}

.fgwm-brand-text {
    font-family: var(--fgwm-serif);
    font-weight: 700;
    font-size: clamp(24px, 2.1vw, 35px);
    letter-spacing: 0.005em;
    line-height: 1;
    white-space: nowrap;
}

.fgwm-nav-wrap {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.fgwm-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.fgwm-menu-item {
    position: relative;
    margin: 0;
}

.fgwm-top-link {
    appearance: none;
    border: 0;
    background: transparent;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 13px 14px;
    min-height: 42px;
    border-radius: 999px;
    color: rgba(7, 22, 74, 0.76) !important;
    text-decoration: none !important;
    font-family: var(--fgwm-serif);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.005em;
    cursor: pointer;
    transition: color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.fgwm-top-link:hover,
.fgwm-top-link:focus-visible,
.fgwm-menu-item.is-open > .fgwm-top-link {
    color: var(--fgwm-navy) !important;
    background: rgba(255, 253, 249, 0.76);
    outline: none;
}

.fgwm-menu-item.is-open > .fgwm-top-link {
    box-shadow: inset 0 0 0 1px rgba(7, 22, 74, 0.10);
}

.fgwm-chevron {
    transition: transform .2s ease;
}

.fgwm-menu-item.is-open .fgwm-chevron {
    transform: rotate(180deg);
}

.fgwm-submenu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 245px;
    padding: 10px;
    margin: 0;
    list-style: none;
    border: 1px solid var(--fgwm-line);
    border-radius: 20px;
    background: rgba(255, 253, 249, 0.98);
    box-shadow: var(--fgwm-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(.98);
    pointer-events: none;
    transition: opacity .18s ease, visibility .18s ease, transform .18s ease;
}

.fgwm-submenu::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 28px;
    width: 14px;
    height: 14px;
    transform: rotate(45deg);
    background: rgba(255, 253, 249, 0.98);
    border-left: 1px solid var(--fgwm-line);
    border-top: 1px solid var(--fgwm-line);
}

.fgwm-menu-item.is-open > .fgwm-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.fgwm-submenu li {
    margin: 0;
}

.fgwm-submenu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px;
    border-radius: 14px;
    color: var(--fgwm-navy) !important;
    text-decoration: none !important;
    font-family: var(--fgwm-serif);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.005em;
    transition: background .18s ease, transform .18s ease;
}

.fgwm-submenu a::after {
    content: "›";
    font-size: 18px;
    line-height: 1;
    opacity: .55;
}

.fgwm-submenu a:hover,
.fgwm-submenu a:focus-visible {
    background: rgba(232, 222, 203, 0.46);
    transform: translateX(2px);
    outline: none;
}

.fgwm-mobile-toggle {
    display: none;
    width: auto;
    height: 42px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--fgwm-navy);
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: none;
    font-family: var(--fgwm-serif);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.005em;
}

.fgwm-mobile-toggle:hover,
.fgwm-mobile-toggle:focus-visible {
    outline: none;
    color: var(--fgwm-navy-soft);
}

.fgwm-toggle-label {
    display: inline-block;
    line-height: 1;
}

.fgwm-toggle-lines {
    display: inline-flex;
    width: 22px;
    flex-direction: column;
    gap: 5px;
}

.fgwm-toggle-lines span {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .2s ease, opacity .2s ease;
}

.fgwm-bar.is-mobile-open .fgwm-toggle-lines span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.fgwm-bar.is-mobile-open .fgwm-toggle-lines span:nth-child(2) {
    opacity: 0;
}
.fgwm-bar.is-mobile-open .fgwm-toggle-lines span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 860px) {
    :root {
        --fgwm-height: 70px;
    }

    .fgwm-inner {
        width: min(100% - 28px, 1180px);
        gap: 12px;
    }

    .fgwm-brand-text {
        font-size: clamp(22px, 7vw, 28px);
        max-width: calc(100vw - 118px);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .fgwm-brand-icon {
        width: 36px;
        height: 36px;
    }

    .fgwm-mobile-toggle {
        display: inline-flex;
    }

    .fgwm-nav-wrap {
        position: fixed;
        top: var(--fgwm-height);
        left: 0;
        right: 0;
        max-height: calc(100vh - var(--fgwm-height));
        overflow: auto;
        margin: 0;
        padding: 12px 18px 18px;
        border-radius: 0 0 24px 24px;
        border: 0;
        border-top: 1px solid rgba(7, 22, 74, 0.08);
        background: linear-gradient(180deg, rgba(255,253,249,0.99), rgba(244,239,230,0.98));
        box-shadow: 0 28px 80px rgba(7, 22, 74, 0.16);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        pointer-events: none;
        transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
    }

    body.admin-bar .fgwm-nav-wrap {
        top: calc(var(--fgwm-height) + 46px);
    }

    .fgwm-bar.is-mobile-open .fgwm-nav-wrap {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    .fgwm-menu {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .fgwm-top-link {
        width: 100%;
        justify-content: space-between;
        min-height: 48px;
        padding: 15px 4px;
        border-radius: 0;
        background: transparent;
        border-bottom: 1px solid rgba(7, 22, 74, 0.12);
        color: var(--fgwm-navy) !important;
        font-size: 18px;
    }

    .fgwm-top-link:hover,
    .fgwm-top-link:focus-visible,
    .fgwm-menu-item.is-open > .fgwm-top-link {
        background: transparent;
        box-shadow: none;
    }

    .fgwm-submenu {
        position: static;
        width: 100%;
        padding: 0 0 0 12px;
        margin: 6px 0 8px 0;
        border: 0;
        border-left: 1px solid rgba(7, 22, 74, 0.18);
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
        display: none;
        transition: none;
    }

    .fgwm-submenu::before {
        display: none;
    }

    .fgwm-menu-item.is-open > .fgwm-submenu {
        display: block;
    }

    .fgwm-submenu a {
        min-height: 44px;
        padding: 12px 6px;
        border-radius: 0;
        background: transparent;
        border-bottom: 1px solid rgba(7, 22, 74, 0.08);
        font-size: 16px;
    }

    .fgwm-submenu a:hover,
    .fgwm-submenu a:focus-visible {
        background: rgba(232, 222, 203, 0.30);
        transform: none;
    }
}


/* v1.1.1 hotfixes: keep the v1.1 champagne menu, remove the mobile red focus box and tighten the space below the menu. */
.fgwm-mobile-toggle,
.fgwm-mobile-toggle:hover,
.fgwm-mobile-toggle:focus,
.fgwm-mobile-toggle:active,
.fgwm-mobile-toggle:focus-visible,
.fgwm-mobile-toggle[aria-expanded="true"] {
    outline: 0 !important;
    box-shadow: none !important;
    border-color: transparent !important;
    background: transparent !important;
    -webkit-tap-highlight-color: transparent;
}

.fgwm-mobile-toggle::-moz-focus-inner {
    border: 0 !important;
}

/* Extra reset for themes that add a top spacer/margin above the first hero/video/header block. */
body.fgwm-enabled .site-content,
body.fgwm-enabled .content-area,
body.fgwm-enabled .site-main,
body.fgwm-enabled main,
body.fgwm-enabled article,
body.fgwm-enabled .entry-content,
body.fgwm-enabled .wp-site-blocks,
body.fgwm-enabled #content,
body.fgwm-enabled #primary {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

body.fgwm-enabled .entry-content > :first-child,
body.fgwm-enabled .site-main > :first-child,
body.fgwm-enabled main > :first-child,
body.fgwm-enabled #content > :first-child,
body.fgwm-enabled .wp-site-blocks > :first-child:not(.fgwm-bar) {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

body.fgwm-enabled .entry-content > .wp-block-spacer:first-child,
body.fgwm-enabled main > .wp-block-spacer:first-child,
body.fgwm-enabled .site-main > .wp-block-spacer:first-child,
body.fgwm-enabled #content > .wp-block-spacer:first-child {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* The homepage/header media should sit directly against the custom menu. */
body.fgwm-enabled .entry-content > .wp-block-cover:first-child,
body.fgwm-enabled .entry-content > .wp-block-video:first-child,
body.fgwm-enabled .entry-content > .wp-block-image:first-child,
body.fgwm-enabled .entry-content > .wp-block-group:first-child,
body.fgwm-enabled .wp-block-cover.alignfull:first-child,
body.fgwm-enabled .wp-block-video.alignfull:first-child,
body.fgwm-enabled .wp-block-image.alignfull:first-child,
body.fgwm-enabled [class*="hero"]:first-child,
body.fgwm-enabled [class*="header"]:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Catch Themes sometimes leaves header spacing even when the visual header is hidden. */
body.fgwm-hide-theme-header .custom-header,
body.fgwm-hide-theme-header .custom-header-media,
body.fgwm-hide-theme-header .header-media,
body.fgwm-hide-theme-header .header-image,
body.fgwm-hide-theme-header .site-header-main {
    margin-top: 0 !important;
    padding-top: 0 !important;
}
