/*CUSTOM CSS */

/* === Desktop navbar pill highlight (Divi hard override) === */
@media (min-width: 981px) {
    /* 1) Nuke any LI-level background/borders the theme adds */
    #et-top-navigation nav#top-menu-nav ul#top-menu > li {
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    /* 2) Make the link size to its text so the pill can hug it */
    #et-top-navigation nav#top-menu-nav ul#top-menu > li > a {
        display: inline-block !important;
        line-height: 1.2 !important;               /* cancel the 66px-ish line-height */
        height: auto !important;
        padding: .35em .75em !important;           /* comfy pill padding */
        border-radius: 9999px !important;          /* true pill */
        background: transparent !important;
        color: inherit !important;
        text-decoration: none !important;
        box-shadow: none !important;
        border: 0 !important;
        transition: background-color .2s ease, color .2s ease !important;

        /* vertically centre inside the tall header without stretching the pill */
        margin-top: 12px !important;               /* tweak if your header is taller/shorter */
        margin-bottom: 12px !important;
    }

    /* 3) Hover/focus colour */
    #et-top-navigation nav#top-menu-nav ul#top-menu > li:hover > a,
    #et-top-navigation nav#top-menu-nav ul#top-menu > li > a:hover,
    #et-top-navigation nav#top-menu-nav ul#top-menu > li > a:focus {
        background: #ffc84b !important;            /* gold */
        color: #ff5c46 !important;                  /* coral/red */
    }

    /* 4) Keep it highlighted on the active page (and ancestors) */
    #et-top-navigation nav#top-menu-nav ul#top-menu > li.current-menu-item > a,
    #et-top-navigation nav#top-menu-nav ul#top-menu > li.current_page_item > a,
    #et-top-navigation nav#top-menu-nav ul#top-menu > li.current-menu-ancestor > a,
    #et-top-navigation nav#top-menu-nav ul#top-menu > li > a[aria-current="page"] {
        background: #ffc84b !important;
        color: #ff5c46 !important;
    }

    /* 5) Neutralise theme underlines/pseudo elements if present */
    #et-top-navigation nav#top-menu-nav ul#top-menu > li > a::before,
    #et-top-navigation nav#top-menu-nav ul#top-menu > li > a::after {
        content: none !important;
    }
}

/* Optional: smaller margins when the header shrinks on scroll (Divi fixed header) */
@media (min-width: 981px) {
    .et-fixed-header #et-top-navigation nav#top-menu-nav ul#top-menu > li > a {
        margin-top: 6px !important;
        margin-bottom: 6px !important;
    }
}
/* Kill false positives coming from WP's ancestor classes */
@media (min-width: 981px) {
    #et-top-navigation nav#top-menu-nav ul#top-menu > li.current-menu-ancestor > a {
        background: transparent !important;
        color: inherit !important;
    }


    /* Stop ancestors/parents from getting pills, even if theme targets them */
    @media (min-width: 981px) {
        body #et-top-navigation nav#top-menu-nav ul#top-menu >
        li.current-menu-ancestor > a,
        body #et-top-navigation nav#top-menu-nav ul#top-menu >
        li.current_page_parent > a,
        body #et-top-navigation nav#top-menu-nav ul#top-menu >
        li.current_page_ancestor > a,
        body #et-top-navigation nav#top-menu-nav ul#top-menu >
        li.current-menu-parent > a {
            background: transparent !important;
            color: inherit !important;
        }
        /* in case the theme draws with pseudo-elements */
        body #et-top-navigation nav#top-menu-nav ul#top-menu >
        li.current-menu-ancestor > a::before,
        body #et-top-navigation nav#top-menu-nav ul#top-menu >
        li.current_page_parent > a::before,
        body #et-top-navigation nav#top-menu-nav ul#top-menu >
        li.current_page_ancestor > a::before,
        body #et-top-navigation nav#top-menu-nav ul#top-menu >
        li.current-menu-parent > a::before,
        body #et-top-navigation nav#top-menu-nav ul#top-menu >
        li.current-menu-ancestor > a::after,
        body #et-top-navigation nav#top-menu-nav ul#top-menu >
        li.current_page_parent > a::after,
        body #et-top-navigation nav#top-menu-nav ul#top-menu >
        li.current_page_ancestor > a::after,
        body #et-top-navigation nav#top-menu-nav ul#top-menu >
        li.current-menu-parent > a::after {
            content: none !important;
        }
    }
}

