/* Life Ministries Mobile Menu */
/* Replaces Divi Pixel: fullscreen circle animation, elastic hamburger, collapsible sub-menus */

/* =============================================
   HAMBURGER - Elastic Animation
   ============================================= */

.lm-hamburger {
    display: inline-block;
    cursor: pointer;
    padding: 8px;
    transition-timing-function: linear;
    transition-duration: 0.15s;
    transition-property: opacity, filter;
    opacity: 0.7;
}

.lm-hamburger:hover {
    opacity: 1;
}

.lm-hamburger-box {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 14px;
}

.lm-hamburger-inner,
.lm-hamburger-inner::before,
.lm-hamburger-inner::after {
    position: absolute;
    width: 20px;
    height: 2px;
    background-color: #EABD00;
    border-radius: 2px;
    transition-timing-function: linear;
    transition-duration: 0.15s;
    transition-property: transform;
}

.lm-hamburger-inner {
    top: 1px;
    transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transition-duration: 0.275s;
}

.lm-hamburger-inner::before {
    content: '';
    display: block;
    position: absolute;
    top: 6px;
    transition: opacity 0.125s 0.275s ease;
}

.lm-hamburger-inner::after {
    content: '';
    display: block;
    position: absolute;
    top: 12px;
    transition: transform 0.275s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Active state - X */
.lm-hamburger.is-active .lm-hamburger-inner {
    transition-delay: 75ms;
    transform: translate3d(0, 6px, 0) rotate(135deg);
}

.lm-hamburger.is-active .lm-hamburger-inner::before {
    transition-delay: 0s;
    opacity: 0;
}

.lm-hamburger.is-active .lm-hamburger-inner::after {
    transition-delay: 75ms;
    transform: translate3d(0, -12px, 0) rotate(-270deg);
}

/* =============================================
   FULLSCREEN MENU - Circle grow animation
   ============================================= */

@media all and (max-width: 980px) {

    body.lm-mobile-menu-fullscreen {
        overflow-x: hidden;
    }

    /* Hide Divi's default hamburger icon (three bars) */
    .mobile_menu_bar_toggle::before,
    .mobile_menu_bar_toggle::after {
        display: none !important;
    }
    .mobile_menu_bar_toggle > span:not(.lm-hamburger) {
        display: none !important;
    }
    .mobile_menu_bar_toggle {
        font-size: 0 !important;
        line-height: 0 !important;
    }

    /* Kill Divi's blue top border and box shadow on mobile menu */
    .et_mobile_menu,
    #mobile_menu {
        border-top: none !important;
        border: none !important;
        box-shadow: none !important;
        -webkit-box-shadow: none !important;
    }

    /* ---- CIRCLE BACKGROUND ---- */
    /* Use fixed position always so it doesn't jump between absolute/fixed */
    .mobile_nav.lm-menu-circle::before {
        content: '';
        position: fixed;
        top: 0;
        right: 0;
        width: 100vmax;
        height: 100vmax;
        margin-top: calc(-50vmax + 25px);
        margin-right: calc(-50vmax + 25px);
        background: #fff;
        border-radius: 50%;
        transform: scale(0);
        transition: transform 0.6s cubic-bezier(0.79, 0.14, 0.15, 0.86);
        visibility: hidden;
        z-index: 99;
        pointer-events: none;
    }

    .mobile_nav.lm-menu-circle.opened::before {
        transform: scale(5);
        visibility: visible;
    }

    /* ---- FULLSCREEN MENU CONTAINER ---- */
    /* Always position fixed but hide when closed via opacity + pointer-events */
    body.lm-mobile-menu-fullscreen #mobile_menu {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9998;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 80px 40px 40px !important;
        overflow-y: auto;
        background: transparent !important;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    body.lm-mobile-menu-fullscreen .mobile_nav.opened #mobile_menu,
    body.lm-menu-open #mobile_menu {
        opacity: 1;
        pointer-events: auto;
    }

    /* ---- MENU ITEM ANIMATIONS ---- */
    .mobile_nav.lm-menu-circle #mobile_menu > li {
        opacity: 0;
        transform: translateY(15px);
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    /* Open: staggered fade in from top */
    .mobile_nav.lm-menu-circle.opened #mobile_menu > li {
        opacity: 1;
        transform: translateY(0);
    }

    .mobile_nav.lm-menu-circle.opened #mobile_menu > li:nth-child(1) { transition-delay: 0.15s; }
    .mobile_nav.lm-menu-circle.opened #mobile_menu > li:nth-child(2) { transition-delay: 0.2s; }
    .mobile_nav.lm-menu-circle.opened #mobile_menu > li:nth-child(3) { transition-delay: 0.25s; }
    .mobile_nav.lm-menu-circle.opened #mobile_menu > li:nth-child(4) { transition-delay: 0.3s; }
    .mobile_nav.lm-menu-circle.opened #mobile_menu > li:nth-child(5) { transition-delay: 0.35s; }
    .mobile_nav.lm-menu-circle.opened #mobile_menu > li:nth-child(6) { transition-delay: 0.4s; }

    /* Close: all items fade out together quickly */
    .mobile_nav.lm-menu-circle:not(.opened) #mobile_menu > li {
        transition-delay: 0s;
        transition-duration: 0.15s;
    }

    /* ---- MENU ITEM STYLES ---- */
    body.lm-mobile-menu-fullscreen #mobile_menu > li {
        width: 100%;
        max-width: 320px;
        margin: 6px 0;
        text-align: center;
        border: none !important;
        position: relative;
    }

    body.lm-mobile-menu-fullscreen #mobile_menu > li > a {
        display: block;
        padding: 14px 24px !important;
        background: #f0f0f0;
        border-radius: 50px;
        color: #2c3d49 !important;
        font-size: 16px;
        font-weight: 500;
        text-decoration: none;
    }

    body.lm-mobile-menu-fullscreen #mobile_menu > li.current-menu-item > a,
    body.lm-mobile-menu-fullscreen #mobile_menu > li > a:hover {
        background: #e5e5e5;
    }

    /* Prevent body scroll when menu open */
    body.lm-menu-open {
        overflow: hidden !important;
    }

    /* =============================================
       SUB-MENU COLLAPSE
       ============================================= */

    #mobile_menu .sub-menu {
        display: block !important;
        padding: 0 !important;
        margin-top: 6px;
        list-style: none !important;
        border: none !important;
        background: transparent !important;
        visibility: visible !important;
    }

    .lm-submenu-toggle {
        position: absolute;
        right: 10px;
        top: 6px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 5;
        color: #999;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.05);
    }

    .lm-submenu-toggle svg {
        width: 16px;
        height: 16px;
    }

    .lm-submenu-toggle.lm-toggle-open {
        transform: rotate(180deg);
        color: #EABD00;
    }

    #mobile_menu .sub-menu.lm-collapsed {
        max-height: 0 !important;
        overflow: hidden !important;
        opacity: 0;
        margin: 0 !important;
        transition: max-height 0.3s ease, opacity 0.2s ease;
    }

    #mobile_menu .sub-menu:not(.lm-collapsed) {
        max-height: 500px;
        opacity: 1;
        overflow: visible;
        transition: max-height 0.4s ease, opacity 0.3s ease;
    }

    #mobile_menu .sub-menu li {
        border: none !important;
        text-align: center;
        margin: 4px 0;
    }

    #mobile_menu .sub-menu li a {
        display: block;
        padding: 10px 20px !important;
        background: #f7f7f7;
        border-radius: 50px;
        color: #2c3d49 !important;
        font-size: 14px;
        font-weight: 400;
    }

    #mobile_menu .sub-menu li a:hover {
        background: #eee;
    }

    /* Close button (X) positioning */
    .mobile_menu_bar_toggle {
        z-index: 10001 !important;
        position: relative;
        padding-bottom: 0 !important;
    }

    /* Sub-menu items: match parent width and remove Divi left padding */
    #mobile_menu .sub-menu {
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }

    .et_mobile_menu li li {
        padding-left: 0 !important;
    }
}

/* =============================================
   MOBILE HEADER FIX (< 980px)
   Targeted fixes only — keeps Divi's structure intact
   ============================================= */

@media all and (max-width: 980px) {

    /* Logo — remove negative margin, make bigger */
    .logo_container #logo {
        margin-top: 0 !important;
        max-height: 80px !important;
    }

    /* Match Divi's mobile header height */
    .et_fixed_nav #main-header {
        height: 80px;
    }

    .logo_container .logo_helper {
        display: none !important;
    }

    /* Search icon — gold to match hamburger */
    #et_search_icon,
    #et_search_icon::before,
    .et_search_form_container input,
    #et-top-navigation .et-search-form input {
        color: #EABD00 !important;
    }

    /* Align search icon and hamburger on the same baseline */
    #et_top_search {
        vertical-align: top !important;
        margin-top: -5px;
        right: -28px;
    }

    .mobile_menu_bar.mobile_menu_bar_toggle {
        padding-bottom: 0 !important;
        vertical-align: top !important;
    }

    #et_mobile_nav_menu {
        vertical-align: top !important;
    }
}


