/*
 * Money & Why Site UI v1.6.0
 */

/* Hide Privacy Policy from the top header only. */
header.wp-block-template-part a[href*="/privacy-policy"] {
    display: none !important;
}

.mayw-custom-footer {
    box-sizing: border-box;
    margin-top: 56px;
    background: #0d2847;
    color: #fff;
}

.mayw-custom-footer__inner {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 1fr 1fr 1.15fr;
    gap: 56px;
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
    padding: 46px 0 34px;
}

.mayw-footer-heading {
    margin: 0 0 18px;
    color: #fff;
    font-size: 1rem;
    line-height: 1.3;
    font-weight: 700;
}

.mayw-footer-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mayw-footer-nav a,
.mayw-footer-contact a {
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.45;
}

.mayw-footer-nav a:hover,
.mayw-footer-nav a:focus,
.mayw-footer-contact a:hover,
.mayw-footer-contact a:focus {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.mayw-footer-contact a {
    overflow-wrap: anywhere;
}

.mayw-footer-bottom {
    box-sizing: border-box;
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
    padding: 0 0 28px;
    text-align: center;
}

.mayw-footer-bottom p {
    margin: 0;
    color: #fff;
    font-size: 0.78rem;
    line-height: 1.4;
}

@media (max-width: 820px) {
    .mayw-custom-footer__inner {
        grid-template-columns: 1fr 1fr;
        gap: 36px 48px;
        width: min(720px, calc(100% - 36px));
        padding-top: 36px;
    }

    .mayw-footer-column:last-child {
        grid-column: 1 / -1;
    }

    .mayw-footer-bottom {
        width: min(720px, calc(100% - 36px));
    }
}

@media (max-width: 560px) {
    .mayw-custom-footer {
        margin-top: 42px;
    }

    .mayw-custom-footer__inner {
        display: block;
        width: calc(100% - 32px);
        padding: 30px 0 20px;
    }

    .mayw-footer-column {
        margin-bottom: 28px;
    }

    .mayw-footer-bottom {
        width: calc(100% - 32px);
        padding-bottom: 22px;
        text-align: left;
    }
}


/* v1.1 — compact Join/Login links in the top header navigation */
.wp-block-navigation .mayw-header-member-links {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 14px;
    padding-left: 14px;
    border-left: 1px solid rgba(13, 40, 71, 0.18);
    white-space: nowrap;
    font-size: 0.84rem;
    line-height: 1.2;
}

.wp-block-navigation .mayw-header-member-link,
.wp-block-navigation .mayw-header-member-name {
    color: inherit;
    text-decoration: none;
}

.wp-block-navigation .mayw-header-member-link:hover,
.wp-block-navigation .mayw-header-member-link:focus {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.wp-block-navigation .mayw-header-member-name {
    font-weight: 600;
}

.wp-block-navigation .mayw-header-member-sep {
    opacity: 0.55;
}

/* Keep the mobile header compact. */
@media (max-width: 700px) {
    .wp-block-navigation .mayw-header-member-links {
        margin-left: 8px;
        padding-left: 8px;
        gap: 5px;
        font-size: 0.8rem;
    }
}


/* v1.2 — push member controls to the far-right edge of the header row */
header.wp-block-template-part .wp-block-navigation {
    width: 100%;
}

header.wp-block-template-part .wp-block-navigation__container {
    width: 100%;
    display: flex;
    align-items: center;
}

header.wp-block-template-part .mayw-header-member-links {
    margin-left: auto !important;
    padding-left: 18px;
    border-left: 1px solid rgba(13, 40, 71, 0.18);
    flex: 0 0 auto;
}

/*
 * Keep the main site links together while the account controls occupy
 * the far-right side of the available header navigation space.
 */
header.wp-block-template-part .wp-block-navigation-item:not(.mayw-header-member-links) {
    flex: 0 0 auto;
}

/* Narrow screens: avoid squeezing the account controls off-screen. */
@media (max-width: 900px) {
    header.wp-block-template-part .mayw-header-member-links {
        margin-left: 12px !important;
        padding-left: 10px;
    }
}

/* On small/mobile layouts let the theme's responsive navigation take priority. */
@media (max-width: 700px) {
    header.wp-block-template-part .wp-block-navigation__container {
        width: auto;
    }

    header.wp-block-template-part .mayw-header-member-links {
        margin-left: 8px !important;
        padding-left: 8px;
    }
}


/* v1.3 — keep account controls on the SAME header row and pin them to the far right */
@media (min-width: 901px) {
    header.wp-block-template-part {
        position: relative;
    }

    /*
     * Remove v1.2's flow-based spacing. The account controls are taken out of
     * the nav flow so they can no longer wrap onto a second line.
     */
    header.wp-block-template-part .mayw-header-member-links {
        position: absolute !important;
        top: 50% !important;
        right: max(28px, calc((100vw - 1120px) / 2)) !important;
        transform: translateY(-50%) !important;

        margin: 0 !important;
        padding-left: 18px !important;
        border-left: 1px solid rgba(13, 40, 71, 0.18);

        display: inline-flex !important;
        align-items: center;
        gap: 6px;
        width: max-content;
        white-space: nowrap;
        z-index: 5;
    }

    /*
     * Give the normal menu enough breathing room so long labels never collide
     * with the account controls on ordinary desktop widths.
     */
    header.wp-block-template-part .wp-block-navigation {
        padding-right: 165px;
        box-sizing: border-box;
    }
}

/* Narrow laptops/tablets return to normal flow so the theme can wrap responsibly. */
@media (max-width: 900px) {
    header.wp-block-template-part .mayw-header-member-links {
        position: static !important;
        transform: none !important;
        margin-left: 10px !important;
        padding-left: 10px !important;
    }

    header.wp-block-template-part .wp-block-navigation {
        padding-right: 0;
    }
}


/* v1.4 — final desktop header alignment
 * Goal:
 * - Main navigation stays on one line.
 * - Member controls stay on the SAME line.
 * - Member controls sit at the far right with no overlap.
 * - No absolute positioning.
 */
@media (min-width: 901px) {
    header.wp-block-template-part .wp-block-navigation {
        position: static !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: none !important;
        padding-right: 0 !important;
        box-sizing: border-box;
    }

    header.wp-block-template-part .wp-block-navigation__responsive-container-content,
    header.wp-block-template-part .wp-block-navigation__container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Keep the regular menu cluster away from the logo and roughly centered. */
    header.wp-block-template-part .wp-block-navigation__container > .wp-block-navigation-item:first-child {
        margin-left: auto !important;
    }

    /* Undo every v1.3 absolute-position rule. */
    header.wp-block-template-part .mayw-header-member-links {
        position: static !important;
        inset: auto !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;

        display: inline-flex !important;
        align-items: center !important;
        flex: 0 0 auto !important;

        margin: 0 0 0 auto !important;
        padding-left: 18px !important;
        border-left: 1px solid rgba(13, 40, 71, 0.18);

        width: auto !important;
        white-space: nowrap !important;
        z-index: auto !important;
    }
}

/* Slightly tighten spacing before responsive collapse. */
@media (min-width: 901px) and (max-width: 1180px) {
    header.wp-block-template-part .wp-block-navigation__container {
        column-gap: 12px !important;
    }

    header.wp-block-template-part .mayw-header-member-links {
        padding-left: 12px !important;
        font-size: 0.8rem !important;
    }
}

/* Let the theme's mobile navigation take over cleanly. */
@media (max-width: 900px) {
    header.wp-block-template-part .wp-block-navigation {
        flex: initial !important;
        width: auto !important;
        padding-right: 0 !important;
    }

    header.wp-block-template-part .mayw-header-member-links {
        position: static !important;
        transform: none !important;
        margin-left: 8px !important;
        padding-left: 8px !important;
    }
}


/* v1.5 — exact three-zone desktop header:
 * LEFT: logo
 * CENTER: primary menu
 * RIGHT: member controls
 * All on the same vertical line.
 */
@media (min-width: 901px) {
    header.wp-block-template-part > .wp-block-group,
    header.wp-block-template-part > .wp-block-group > .wp-block-group {
        position: relative;
    }

    /*
     * Keep the native logo where the theme already places it.
     * Center the navigation against the viewport rather than against the
     * remaining space between logo and account controls.
     */
    header.wp-block-template-part .wp-block-navigation {
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;

        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 3;
    }

    header.wp-block-template-part .wp-block-navigation__responsive-container-content,
    header.wp-block-template-part .wp-block-navigation__container {
        width: auto !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 20px !important;
    }

    /*
     * v1.1 injected member controls inside the navigation HTML.
     * Keep them visually independent and pin them to the right edge of the
     * header's content area while matching the menu's vertical center.
     */
    header.wp-block-template-part .mayw-header-member-links {
        position: fixed !important;
        top: auto !important;
        right: max(28px, calc((100vw - 1120px) / 2)) !important;
        transform: none !important;

        display: inline-flex !important;
        align-items: center !important;
        gap: 7px !important;

        margin: 0 !important;
        padding-left: 18px !important;
        border-left: 1px solid rgba(13, 40, 71, 0.18);

        width: max-content !important;
        white-space: nowrap !important;
        z-index: 999;
    }

    /*
     * Use the header row's computed top via CSS custom fallback:
     * because fixed positioning is viewport-relative, align it with the
     * visible header by a stable offset for this theme.
     */
    header.wp-block-template-part .mayw-header-member-links {
        top: 48px !important;
    }
}

/* Typical 1366–1600px desktops */
@media (min-width: 901px) and (max-width: 1500px) {
    header.wp-block-template-part .wp-block-navigation__container {
        gap: 16px !important;
    }

    header.wp-block-template-part .mayw-header-member-links {
        right: 6.5vw !important;
        top: 48px !important;
        font-size: 0.82rem !important;
    }
}

/* Narrow screens: return everything to normal flow. */
@media (max-width: 900px) {
    header.wp-block-template-part .wp-block-navigation {
        position: static !important;
        transform: none !important;
        width: auto !important;
    }

    header.wp-block-template-part .mayw-header-member-links {
        position: static !important;
        top: auto !important;
        right: auto !important;
        transform: none !important;
        margin-left: 8px !important;
        padding-left: 8px !important;
    }
}


/* v1.6 — definitive three-zone header.
 * JavaScript adds .mayw-header-three-zone to the actual shared header row.
 * This overrides all earlier experimental header positioning.
 */
@media (min-width: 901px) {
    header.wp-block-template-part .mayw-header-three-zone {
        display: grid !important;
        grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr) !important;
        align-items: center !important;
        column-gap: 24px !important;
        width: 100% !important;
        position: relative !important;
    }

    header.wp-block-template-part .mayw-header-three-zone > .wp-block-site-logo,
    header.wp-block-template-part .mayw-header-three-zone > .wp-block-site-title,
    header.wp-block-template-part .mayw-header-three-zone > .wp-block-group:has(.wp-block-site-logo) {
        grid-column: 1 !important;
        justify-self: start !important;
    }

    header.wp-block-template-part .mayw-header-three-zone > .wp-block-navigation {
        grid-column: 2 !important;
        justify-self: center !important;

        position: static !important;
        inset: auto !important;
        transform: none !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: auto !important;
    }

    header.wp-block-template-part .mayw-header-three-zone .wp-block-navigation__responsive-container-content,
    header.wp-block-template-part .mayw-header-three-zone .wp-block-navigation__container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: center !important;
        width: auto !important;
        gap: 20px !important;
    }

    header.wp-block-template-part .mayw-header-member-links {
        grid-column: 3 !important;
        justify-self: end !important;
        align-self: center !important;

        position: static !important;
        inset: auto !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;

        display: inline-flex !important;
        align-items: center !important;
        gap: 7px !important;

        margin: 0 !important;
        padding-left: 18px !important;
        border-left: 1px solid rgba(13, 40, 71, 0.18);

        width: max-content !important;
        white-space: nowrap !important;
        z-index: auto !important;
        font-size: 0.84rem !important;
        line-height: 1.2 !important;
    }
}

@media (min-width: 901px) and (max-width: 1180px) {
    header.wp-block-template-part .mayw-header-three-zone {
        grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr) !important;
        column-gap: 16px !important;
    }

    header.wp-block-template-part .mayw-header-three-zone .wp-block-navigation__container {
        gap: 14px !important;
    }

    header.wp-block-template-part .mayw-header-member-links {
        padding-left: 12px !important;
        font-size: 0.8rem !important;
    }
}

/* Mobile: script leaves theme responsive navigation intact. */
@media (max-width: 900px) {
    header.wp-block-template-part .mayw-header-three-zone {
        display: flex !important;
    }

    header.wp-block-template-part .mayw-header-member-links {
        position: static !important;
        transform: none !important;
        margin-left: 8px !important;
        padding-left: 8px !important;
    }
}
