/* =============================================================
   Mega menu — OC Eye Associates
   Styles the dropdown panels produced by Glacial_Mega_Menu_Walker
   for top-level items flagged `mega-menu`. Scoped to .mega-menu /
   .mega-panel so standard dropdowns are left untouched.
   Design: contained white rounded dropdown, teal links, navy pill
   CTA buttons (mirrors the Webflow export). Colors from webflow.css.
   ============================================================= */

:root {
    --mega-link: #3a7693; /* --color-4 : dropdown link            */
    --mega-link-hover: #73b5cf; /* --color-6 : link hover          */
    --mega-btn-bg: #062c3d; /* --color-3 : navy .button.blue        */
    --mega-btn-bg-hover: #3a7693; /* --color-4 : button hover       */
    --mega-btn-color: #fff;
    --mega-panel-bg: #fff;
    --mega-radius: 10px;
    --mega-gutter: 10px; /* space between columns                   */
    --nav-height: 85px; /* navbar height -> where the panel sits    */
    --mega-bridge-h: 30px; /* invisible hover bridge above the panel */
}

/* --- The dropdown panel (contained, not full-width) ------------------ */

/* Items stay position:relative (theme default), so the caret and the
   panel's top/left/`.edge` positioning all come from the theme. We only
   widen the panel (theme default is 240px) and lay its columns in a row. */
.gl-top-level > li.mega-menu > .mega-panel {
    display: none;
    position: fixed; /* center in the window, not under the item */
    top: var(--nav-height, 85px); /* just below the fixed navbar */
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: auto;
    max-width: min(96vw, 1200px);
    padding: 15px;
    background: var(--mega-panel-bg);
    border-radius: var(--mega-radius);
    box-shadow: 0 15px 30px rgba(6, 44, 61, 0.18);
    z-index: 999;
}

/* Reveal on hover (desktop) or when toggled open (theme JS). */
.gl-top-level > li.mega-menu:hover > .mega-panel,
.gl-top-level > li.mega-menu > .mega-panel.toggled-on {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
}

/* Invisible hover bridge: the panel is centered in the window, so the cursor
   moving from a side item down to the panel would cross dead space and drop the
   :hover. This full-width strip just above the panel keeps hover continuous.
   Only rendered while the panel is displayed. */
.gl-top-level > li.mega-menu > .mega-panel::before {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 100%;
    width: 100vw;
    height: var(--mega-bridge-h, 30px);
}

/* --- Columns -------------------------------------------------------- */

.mega-panel > .mega-col {
    display: flex;
    flex-direction: column;
    width: auto;
    margin: 0 var(--mega-gutter);
    padding: 0;
    background: transparent;
    position: static;
}

.mega-panel > .mega-col:hover {
    background: transparent;
}

/* --- Links ---------------------------------------------------------- */

.mega-panel a.mega-link {
    display: block;
    width: auto;
    padding: 6px 0;
    color: var(--mega-link);
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    text-transform: none;
    text-decoration: none;
    transition: color 0.15s ease;
}

/* Cancel the theme's "highlight the whole column on hover"
   (.gl-dropdown-1 > li:hover > a), then highlight only the hovered link. */
.mega-panel > .mega-col:hover > a.mega-link {
    color: var(--mega-link);
}

.mega-panel > .mega-col > a.mega-link:hover {
    color: var(--mega-link-hover);
}

/* --- CTA pill button (.button.blue equivalent) ---------------------- */

.mega-panel a.mega-btn {
    display: inline-block;
    width: auto;
    min-width: 200px;
    margin-top: 6px;
    padding: 15px 30px;
    border: 1px solid var(--mega-btn-bg);
    border-radius: 50px;
    background: var(--mega-btn-bg);
    color: var(--mega-btn-color);
    font-weight: 400;
    line-height: 1.2;
    text-align: center;
    text-transform: none;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

.mega-panel a.mega-btn:hover {
    background: var(--mega-btn-bg-hover);
    color: var(--mega-btn-color);
}

/* --- Mobile (<= 991px): panel stacks inside the off-canvas nav ------- */

@media (max-width: 991px) {

    /* Only the toggle opens it on touch/narrow, not hover. */
    .gl-top-level > li.mega-menu:hover > .mega-panel {
        display: none;
    }

    .gl-top-level > li.mega-menu > .mega-panel {
        position: static;
        top: auto;
        left: auto;
        right: auto;
        transform: none;
        width: 100%;
        max-width: none;
        padding: 4px 0 10px 1em;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
    }

    /* No hover bridge needed in the stacked mobile menu. */
    .gl-top-level > li.mega-menu > .mega-panel::before {
        display: none;
    }

    .gl-top-level > li.mega-menu > .mega-panel.toggled-on {
        display: block;
    }

    .mega-panel > .mega-col {
        width: 100%;
        margin: 6px 0;
    }

    .mega-panel a.mega-link {
        color: var(--mobile-color, #fff);
        padding: 10px;
        white-space: normal;
    }

    .mega-panel a.mega-btn {
        min-width: 0;
        margin: 8px 10px;
    }
}
