/* Additional Header Navigation Fix for MPFoundation */

/* Force proper flexbox alignment for header elements */
.site-header .site-container {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

.site-header-inner-wrap {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

/* Critical fix: Ensure navigation menu items align with logo */
.header-navigation {
    height: auto !important;
    align-self: center !important;
}

.header-navigation .primary-menu-container {
    height: auto !important;
    align-self: center !important;
}

@media (min-width: 769px) {
    .header-navigation .primary-menu-container ul {
        height: auto !important;
        line-height: normal !important;
        align-items: center !important;
    }

    .header-navigation .primary-menu-container ul li {
        height: auto !important;
        align-self: center !important;
    }

    .header-navigation .primary-menu-container ul li a {
        height: auto !important;
        line-height: 1.5 !important;
        vertical-align: middle !important;
        align-self: center !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
}

/* Fix for Kadence theme specific classes */
.site-header-row-layout-standard .site-header-row-container-inner {
    display: flex !important;
    align-items: center !important;
}

.site-header-row-layout-standard .site-header-row-container-inner > * {
    align-self: center !important;
}

/* Force logo and navigation to be on same baseline */
.site-branding,
.header-navigation {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Additional responsive adjustments */
@media (min-width: 1025px) {
    .main-navigation {
        display: flex !important;
        align-items: center !important;
        align-self: center !important;
    }
    
    .main-navigation .primary-menu-container {
        display: flex !important;
        align-items: center !important;
        align-self: center !important;
    }
    
    /* Specific fix for menu alignment issue */
    .header-navigation .primary-menu-container > ul {
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
    }
}

/* ===================================================================
   LOGO ALIGNMENT FIXES
   =================================================================== */

/* ── Header container: establish a strict flex row ── */
.mpf-custom-header {
    display: block !important;
}

.mpf-header-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 80px !important;        /* fixed height gives a reliable centering context */
    min-height: 80px !important;
    padding: 0 40px !important;
    max-width: 1400px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
}

/* ── Logo wrapper: flex row, vertically centered ── */
.mpf-logo {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    flex-shrink: 0 !important;
    height: 100% !important;        /* inherit container height for centering */
}

/* ── WordPress get_custom_logo() – strips all implicit spacing ── */
.mpf-logo .custom-logo-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;      /* removes inline text-gap below img */
    border: none !important;
    text-decoration: none !important;
    flex-shrink: 0 !important;
    height: 100% !important;
}

/* WordPress sometimes wraps custom logo in a <figure> */
.mpf-logo figure,
.mpf-logo .wp-block-site-logo {
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
    height: 100% !important;
}

/* Logo image: fixed height, no implicit bottom gap */
.mpf-logo .custom-logo,
.mpf-logo img {
    display: block !important;
    height: 45px !important;
    width: auto !important;
    max-width: none !important;
    object-fit: contain !important;
    vertical-align: middle !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    /* prevent Kadence from overriding to a percentage-based width */
    flex-shrink: 0 !important;
}

/* ── Logo text link: same height as container, text centered ── */
.mpf-logo-text-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 100% !important;
    line-height: 1 !important;
    border: none !important;
    outline: none !important;
}

.mpf-logo-text-link:hover .mpf-logo-text,
.mpf-logo-text-link:focus .mpf-logo-text {
    color: #207dad !important;
}

/* ── Logo text span ── */
.mpf-logo-text {
    display: block !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    color: #1a1a1a !important;
    letter-spacing: -0.5px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    top: 0 !important;
}

/* ── Mobile nav toggle: flex-centered ── */
.mpf-mobile-menu-toggle {
    display: none !important;   /* shown via media query below */
    align-items: center !important;
    justify-content: center !important;
    align-self: center !important;
    flex-shrink: 0 !important;
}

/* ── Mobile adjustments ── */
@media (max-width: 768px) {
    .mpf-header-container {
        padding: 0 16px !important;
        height: 64px !important;
        min-height: 64px !important;
    }

    .mpf-logo {
        gap: 8px !important;
    }

    .mpf-logo .custom-logo,
    .mpf-logo img {
        height: 36px !important;
    }

    .mpf-logo-text {
        font-size: 16px !important;
        letter-spacing: 0 !important;
    }

    .mpf-mobile-menu-toggle {
        display: flex !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .mpf-header-container {
        padding: 0 24px !important;
    }

    .mpf-logo .custom-logo,
    .mpf-logo img {
        height: 40px !important;
    }

    .mpf-logo-text {
        font-size: 18px !important;
    }
}
