/*
 * ============================================================
 * GMP Desktop Header  (v1.0.4)
 * Gym Marketing Pros, staging.gymmarketingpros.com
 * Prompt 05, AVADA-NATIVE-GLOBAL-HEADER v6.2
 * Manifests: GMP-DSM-20261110, GMP-RCM-20261111
 * Loaded by inc/site-header.php on every front-end page, with
 * assets/js/gmp-header.js (adds gmp-header--scrolled past 40px).
 *
 * Hosts (CSS Class fields):
 *  .gmp-header        Header Container (Large Screen only)
 *  .gmp-header-bar    Header Bar Column (the frosted pill)
 *  .gmp-header-logo   Logo Image Element
 *  .gmp-header-menu   Menu Element (GMP Main Menu)
 *  .gmp-mega          Mega Menu Containers (Services, Resources)
 *  .gmp-mega-stage    Services stage photo (Nested Column)
 *  .gmp-mega-title    Mega Menu display titles (Text Blocks)
 *  .gmp-mega-links    Mega Menu link lists (Text Blocks)
 *  .gmp-mega-who      Who we work with grid (Text Block)
 *  .gmp-mega-calcs    Free calculators grid (Text Block)
 *  .gmp-mega-learn    Blog and FAQs row (Text Block)
 *  .gmp-mega-more     All gym types / All integrations (Text Block)
 *  .gmp-mega-promo    Resources photo cards (Columns)
 *
 *  1. Header layer: click-through padding, overlay, pinning
 *  2. Bar: blur layer and its states (Homepage, scrolled, open)
 *  3. Bar contents: logo, button
 *  4. Main menu items, chevron, Mega Menu parents
 *  5. Mega Menu panel
 *  6. Mega Menu content
 *  7. Reduced motion
 * ============================================================
 */


/* ============================================================
 * 1. HEADER LAYER
 * The Container's padding is see-through: clicks pass to the
 * page except on the bar. Not in the Live Builder, so the
 * Container stays selectable there.
 * ============================================================ */

body:not(.fusion-builder-live) .gmp-header {
    pointer-events: none;
}

.gmp-header .gmp-header-bar {
    position: relative;
    pointer-events: auto;
}


/* ============================================================
 * 2. BAR STATES
 * Avada paints the bar from --awb-bg-color, --awb-border-radius
 * and --awb-box-shadow on the Column. Builder values are the
 * inner-page top state (Brand Black 92%) and the scrolled
 * shadow; these rules switch them per state.
 * ============================================================ */

/* Frosted glass: blur on a layer behind the bar, never on the
   Column itself (that would stop the Mega Menu panel blurring). */
.gmp-header .gmp-header-bar::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: var(--awb-border-radius);
    pointer-events: none;
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
            backdrop-filter: blur(20px) saturate(1.5);
}

/* Shadow only once scrolled past 40px (gmp-header.js). */
.gmp-header:not(.gmp-header--scrolled) .gmp-header-bar {
    --awb-box-shadow: none !important;
}

/* Homepage top state: White 6% over the hero photo. */
.home .gmp-header .gmp-header-bar {
    --awb-bg-color: hsla(var(--awb-color1-h),var(--awb-color1-s),var(--awb-color1-l),calc(var(--awb-color1-a) - 94%)) !important;
    --awb-bg-color-hover: hsla(var(--awb-color1-h),var(--awb-color1-s),var(--awb-color1-l),calc(var(--awb-color1-a) - 94%)) !important;
}

/* Scrolled: Header Glass Base 82% (Homepage 78%). */
.gmp-header.gmp-header--scrolled .gmp-header-bar {
    --awb-bg-color: hsla(var(--awb-color27-h),var(--awb-color27-s),var(--awb-color27-l),calc(var(--awb-color27-a) - 18%)) !important;
    --awb-bg-color-hover: hsla(var(--awb-color27-h),var(--awb-color27-s),var(--awb-color27-l),calc(var(--awb-color27-a) - 18%)) !important;
}

.home .gmp-header.gmp-header--scrolled .gmp-header-bar {
    --awb-bg-color: hsla(var(--awb-color27-h),var(--awb-color27-s),var(--awb-color27-l),calc(var(--awb-color27-a) - 22%)) !important;
    --awb-bg-color-hover: hsla(var(--awb-color27-h),var(--awb-color27-s),var(--awb-color27-l),calc(var(--awb-color27-a) - 22%)) !important;
}

/* Mega Menu open (pointer, keyboard focus or Avada's expanded
   class): Header Glass Base 94%, square bottom, no shadow, so
   the bar and the panel read as one surface. Last, so it wins
   over the Homepage and scrolled states. */
.gmp-header .gmp-header-bar:has(.awb-menu__main-li:hover .awb-menu__mega-wrap),
.gmp-header .gmp-header-bar:has(.awb-menu__main-li:focus-within .awb-menu__mega-wrap),
.gmp-header .gmp-header-bar:has(.awb-menu__main-li.expanded .awb-menu__mega-wrap) {
    --awb-bg-color: hsla(var(--awb-color27-h),var(--awb-color27-s),var(--awb-color27-l),calc(var(--awb-color27-a) - 6%)) !important;
    --awb-bg-color-hover: hsla(var(--awb-color27-h),var(--awb-color27-s),var(--awb-color27-l),calc(var(--awb-color27-a) - 6%)) !important;
    --awb-border-radius: 32px 32px 0 0 !important;
    --awb-box-shadow: none !important;
}


/* ============================================================
 * 3. BAR CONTENTS
 * The menu fills the space between logo and button; these two
 * keep their size.
 * ============================================================ */

.gmp-header-bar :is(.fusion-image-element, .fusion-imageframe) {
    flex-shrink: 0;
}

.gmp-header-logo img {
    display: block;
    width: 124px;
}

.gmp-header-logo a:focus-visible {
    outline: 2px solid var(--awb-color1);
    outline-offset: 3px;
}

.gmp-header-bar :is(.fusion-button-wrapper, .fusion-button.gmp-btn) {
    flex-shrink: 0;
}

/* Lifted above the gmp-btn label rule (which lets labels wrap). */
:is(.gmp-header-bar, #gmp-unused) .fusion-button.gmp-btn .fusion-button-text {
    white-space: nowrap;
}


/* ============================================================
 * 4. MAIN MENU ITEMS
 * 40px pills. Colors, padding, gap and the hover pill of plain
 * items are Menu Element fields.
 * ============================================================ */

.gmp-header-menu a.awb-menu__main-a {
    min-height: 40px;
    white-space: nowrap;
}

/* Family and weight of the main items (size, letter spacing and
   uppercase are Main Menu Typography fields). Lifted to ID level
   so it beats the Menu Element's own font rules. */
:is(.gmp-header-menu, #gmp-unused) a.awb-menu__main-a {
    font-family: var(--awb-typography3-font-family);
    font-weight: 700; /* DSM 3: typography3 Nav and Buttons, weight 700 */
}

.gmp-header-menu a.awb-menu__main-a:focus-visible {
    outline: 2px solid var(--awb-color1);
    outline-offset: 3px;
}

/* Current page keeps the resting look: no hover pill unless
   hovered or focused (Avada gives current items the Hover
   background). */
.gmp-header-menu .awb-menu__main-li:is(.current-menu-item, .current-menu-parent, .current-menu-ancestor):not(:hover):not(:focus-within) > .awb-menu__main-background-active {
    opacity: 0 !important;
}

/* Mega Menu parents (Services, Resources). The panel spans the
   bar, so these and their ancestors up to the bar are static. */
.gmp-header-menu,
.gmp-header-menu .awb-menu__main-ul,
.gmp-header-menu .awb-menu__main-li:has(.awb-menu__mega-wrap) {
    position: static !important;
}

/* Static parents cannot use Avada's hover layer (it would size
   to the bar), so their pill is drawn on the link. */
.gmp-header-menu .awb-menu__main-li:has(.awb-menu__mega-wrap) > :is(.awb-menu__main-background-default, .awb-menu__main-background-active) {
    display: none !important;
}

.gmp-header-menu .awb-menu__main-li:has(.awb-menu__mega-wrap) > a.awb-menu__main-a {
    position: relative;
    z-index: 0;
}

.gmp-header-menu .awb-menu__main-li:has(.awb-menu__mega-wrap) > a.awb-menu__main-a::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 999px;
    background-color: transparent;
    transition: background-color .25s;
}

.gmp-header-menu .awb-menu__main-li:has(.awb-menu__mega-wrap):is(:hover, :focus-within, .expanded) > a.awb-menu__main-a::before {
    background-color: hsla(var(--awb-color1-h),var(--awb-color1-s),var(--awb-color1-l),calc(var(--awb-color1-a) - 90%));
}

/* Chevron (shared --gmp-icon-chevron), 10px, 7px after the
   label, turns over while the panel is open. */
.gmp-header-menu .awb-menu__main-li:has(.awb-menu__mega-wrap) > a.awb-menu__main-a::after {
    content: "";
    flex: none;
    width: 10px;
    height: 10px;
    margin-left: 7px;
    background-color: var(--awb-color1);
    -webkit-mask: var(--gmp-icon-chevron) center / 10px 10px no-repeat;
            mask: var(--gmp-icon-chevron) center / 10px 10px no-repeat;
    transition: transform .3s;
}

.gmp-header-menu .awb-menu__main-li:has(.awb-menu__mega-wrap):is(:hover, :focus-within, .expanded) > a.awb-menu__main-a::after {
    transform: rotate(180deg);
}


/* ============================================================
 * 5. MEGA MENU PANEL
 * Hangs from the bar's bottom edge at the bar's full width.
 * Its surface (fill, border, radius, shadow) is the Mega Menu
 * Container's Builder settings; the wrap only adds the blur.
 * ============================================================ */

.gmp-header-menu .awb-menu__mega-wrap {
    top: calc(100% - 1px) !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 0 32px 32px !important;
    background: transparent !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
            backdrop-filter: blur(24px) saturate(1.5);
}

/* Bridge over the 12px between the menu item and the panel so
   the panel stays open while the pointer crosses it. */
.gmp-header-menu .awb-menu__mega-wrap::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 14px;
}

/* Keyboard: the panel opens while focus is inside its item,
   so Tab moves from Services straight into its links. */
:is(.gmp-header-menu, #gmp-unused#gmp-unused) .awb-menu__main-li:is(:focus-within, .expanded) .awb-menu__mega-wrap {
    opacity: 1 !important;
    visibility: visible !important;
}


/* ============================================================
 * 6. MEGA MENU CONTENT
 * Size, line height, letter spacing, transform and title color
 * are Text Block fields; link colors are the Container Link
 * Color (White, Hover Peach). Family and weight live here.
 * ============================================================ */

.gmp-mega :is(.gmp-mega-title, .gmp-mega-links, .gmp-mega-more) p {
    margin: 0;
}

/* Display titles: family and axes come from gmp-display. */
.gmp-mega .gmp-mega-title {
    font-weight: 900; /* DSM 3: typography1 Display Heading, weight 900 */
}

/* Photo cards: 16:8 stage photo, 240px minimum promo card. */
.gmp-mega .gmp-mega-stage {
    aspect-ratio: 16 / 8;
}

.gmp-mega .gmp-mega-promo {
    min-height: 240px;
}

/* Dark fade over the photo, under the title and button. Avada
   draws a Column's gradient beneath its background photo, so the
   fade is a layer here. padding: inherit + content-box keeps it on
   the photo whether Avada spaces the Column with margin or padding. */
.gmp-mega :is(.gmp-mega-stage, .gmp-mega-promo) {
    position: relative;
    isolation: isolate;
}

.gmp-mega :is(.gmp-mega-stage, .gmp-mega-promo)::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    box-sizing: border-box;
    padding: inherit;
    background-clip: content-box;
    border-radius: var(--awb-border-radius);
    pointer-events: none;
}

.gmp-mega .gmp-mega-stage::after {
    background-image: linear-gradient(180deg,
        hsla(var(--awb-color8-h),var(--awb-color8-s),var(--awb-color8-l),calc(var(--awb-color8-a) - 100%)) 30%,
        hsla(var(--awb-color8-h),var(--awb-color8-s),var(--awb-color8-l),calc(var(--awb-color8-a) - 15%)) 100%);
}

.gmp-mega .gmp-mega-promo::after {
    background-image: linear-gradient(180deg,
        hsla(var(--awb-color8-h),var(--awb-color8-s),var(--awb-color8-l),calc(var(--awb-color8-a) - 80%)) 0%,
        hsla(var(--awb-color8-h),var(--awb-color8-s),var(--awb-color8-l),calc(var(--awb-color8-a) - 8%)) 75%);
}

.gmp-mega :is(.gmp-mega-stage, .gmp-mega-promo) :is(.fusion-text, .fusion-button) {
    position: relative;
    z-index: 1;
}

/* Link rows. */
.gmp-mega .gmp-mega-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 10px;
    font-family: "GMP Roboto Flex", var(--awb-typography3-font-family);
    font-weight: 500; /* DSM 3: Roboto Flex weight 500 (weights the design uses) */
    text-decoration: none;
    transition: background-color .2s, color .2s;
}

.gmp-mega .gmp-mega-links a:hover {
    background-color: hsla(var(--awb-color4-h),var(--awb-color4-s),var(--awb-color4-l),calc(var(--awb-color4-a) - 86%));
}

.gmp-mega :is(.gmp-mega-links, .gmp-mega-more) a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

/* Who we work with: two columns of short links. */
.gmp-mega .gmp-mega-who {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 4px;
}

.gmp-mega .gmp-mega-who a {
    min-height: 40px;
    padding: 6px 10px;
}

/* Free calculators: two columns, label over its question. */
.gmp-mega .gmp-mega-calcs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 8px;
}

.gmp-mega .gmp-mega-calcs a {
    display: grid;
    gap: 2px;
    align-content: center;
    padding: 11px 10px;
    border-radius: 12px;
}

.gmp-mega .gmp-mega-calcs a > small {
    font-size: 13px;
    font-weight: 400; /* DSM 3: Roboto Flex helper text, weight 400 as in the design */
    line-height: 1.3;
    color: var(--awb-color13);
    display: block;
}

/* Blog and FAQs: one row under a hairline. */
.gmp-mega .gmp-mega-learn {
    display: flex;
    gap: 4px;
    padding-top: 10px;
    border-top: 1px solid hsla(var(--awb-color1-h),var(--awb-color1-s),var(--awb-color1-l),calc(var(--awb-color1-a) - 92%));
}

.gmp-mega .gmp-mega-learn a {
    padding: 11px 10px;
    border-radius: 12px;
}

/* All gym types / All integrations: Peach eyebrow links that
   turn White, the first under a hairline. Lifted to ID level to
   beat the Container Link Color. */
:is(.gmp-mega, #gmp-unused) .gmp-mega-more a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 10px 0;
    font-family: var(--awb-typography5-font-family);
    font-weight: 700; /* DSM 3: typography5 Eyebrow Label, weight 700 */
    color: var(--awb-color10);
    text-decoration: none;
    transition: color .2s;
}

:is(.gmp-mega, #gmp-unused) .gmp-mega-more a:hover {
    color: var(--awb-color1);
}

.gmp-mega .gmp-mega-more p:first-child a {
    border-top: 1px solid hsla(var(--awb-color1-h),var(--awb-color1-s),var(--awb-color1-l),calc(var(--awb-color1-a) - 92%));
}


/* ============================================================
 * 7. REDUCED MOTION
 * ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .gmp-header-menu a.awb-menu__main-a::before,
    .gmp-header-menu a.awb-menu__main-a::after,
    .gmp-mega :is(.gmp-mega-links, .gmp-mega-more) a {
        transition: none;
    }
}
