/* A fragment or skip destination needs to clear both fixed header bars. */
html:has(body.et_fixed_nav) {
    scroll-padding-top: calc(124px + var(--wp-admin--admin-bar--height, 0px));
}

@media (min-width: 981px) {
    /* The desktop logo extends below the blue navigation bar. */
    :is(body.search, body.archive, body.error404, body.single-post) #main-content > .container {
        padding-top: 86px;
    }
}

.lps-listing-heading {
    margin-bottom: 24px;
}
.lps-listing-heading h1 {
    overflow-wrap: anywhere;
}
.lps-listing-search {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 34rem;
    margin-top: 12px;
}
.lps-listing-search label {
    flex: 1 1 10rem;
    min-width: 0;
}
.lps-listing-search input[type="search"] {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid #626262;
    border-radius: 4px;
    color: #343434;
    font: inherit;
    font-size: 16px;
}
.lps-listing-search button {
    min-height: 44px;
    padding: 8px 18px;
    border: 0;
    border-radius: 4px;
    background: #1a3a7c;
    color: #fff;
    font: inherit;
    cursor: pointer;
}
.lps-listing-search :focus-visible {
    outline: 3px solid #1a3a7c;
    outline-offset: 2px;
}

.search #main-content > .container { padding-bottom: 48px; }
.lps-search-result {
    max-width: 46rem;
    padding: 0.8rem 0;
    border-top: 1px solid #d9dce1;
}
.lps-search-result .entry-title {
    padding: 0;
    font-size: clamp(18px, 2vw, 23px);
    line-height: 1.4;
}
.lps-search-result .entry-title a,
.lps-blog-pagination a,
.search .navigation.pagination a {
    color: #1a3a7c;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}
.lps-search-result p { margin-top: 6px; }
.search .navigation.pagination { padding-top: 1rem; }
.search .navigation.pagination .nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}
.search .navigation.pagination .page-numbers,
.lps-blog-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 36px;
    padding: 0 6px;
}

/* Divi draws this separator even when the listing has no sidebar. */
.search #main-content > .container::before,
:is(.archive, .error404, .single-post) #main-content > .container:not(:has(#sidebar))::before {
    display: none;
}
.calculate-your-clam .et_pb_text_inner:has(.lps-calculator-info) {
    position: relative;
}
.calculate-your-clam h4 .lps-calculator-info {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: .15em;
}
.lps-calculator-info::after,
.lps-calculator-info::before {
    content: "";
    position: absolute;
}
.lps-calculator-info::after {
    inset: 0;
    border-radius: 10px;
}
/* The calculator badge projects above the top edge of the card. */
.calculate-your-clam .et_pb_text_inner:has(.fa-calculator) .lps-calculator-info::before {
    top: -30px;
    left: 50%;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    transform: translateX(-50%);
}
.lps-calculator-info:focus-visible::after {
    outline: 3px solid #fff;
    outline-offset: -5px;
}

/* The cards and benefit lists must still draw their icons when the font CDN is unavailable. */
.fas.fa-calculator { --lps-icon: url("assets/lps-icons/calculator.svg"); }
.fas.fa-check { --lps-icon: url("assets/lps-icons/check.svg"); }
.fas.fa-check-circle { --lps-icon: url("assets/lps-icons/check-circle.svg"); }
.fas.fa-hand-point-right { --lps-icon: url("assets/lps-icons/hand-point-right.svg"); }
.fas:is(.fa-calculator, .fa-check, .fa-check-circle, .fa-hand-point-right)::before {
    content: "";
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -.125em;
    background-color: currentColor;
    -webkit-mask: var(--lps-icon) center / contain no-repeat;
    mask: var(--lps-icon) center / contain no-repeat;
}
/* Rotating while the drawer opens can cancel the transition that hides its backdrop. */
body:not(.sfm-body-pushed) #sfm-overlay-wrapper {
    visibility: hidden !important;
    pointer-events: none;
}

/* Share one bar on a short phone screen so the fixed controls leave room to read. */
@media (orientation: landscape) and (min-width: 560px) and (max-width: 980px) and (max-height: 500px) {
    html:has(body.et_fixed_nav) {
        scroll-padding-top: calc(60px + var(--wp-admin--admin-bar--height, 0px));
    }
    body.et_fixed_nav.et_show_nav.et_secondary_nav_enabled #page-container { padding-top: 54px !important; }
    body.et_fixed_nav #main-header {
        top: var(--wp-admin--admin-bar--height, 0px) !important;
        height: 54px;
        /* Divi raises this full-width layer when scrolling. Keep the contact links above it. */
        z-index: 1 !important;
    }
    #main-header .logo_container {
        display: flex;
        align-items: center;
        width: auto !important;
        height: 54px;
        margin: 0 !important;
        padding: 3px 10px !important;
        border-radius: 0;
    }
    #main-header .logo_container a { display: flex; align-items: center; height: 100%; }
    #main-header #logo { width: auto; height: 46px; max-height: 100%; }
    body.et_fixed_nav #top-header {
        inset-inline: max(24%, env(safe-area-inset-left)) max(15%, env(safe-area-inset-right));
        width: auto;
        height: 54px;
    }
    #top-header .top-head-list { display: flex; }
    #top-header .top-head-list > :is(.top-tel, .top_back) {
        display: flex;
        align-items: stretch;
        width: 50%;
        min-width: 0;
        height: 54px;
        margin: 0;
    }
    #top-header .top-head-list > li > a { width: 100%; margin: 0; }
    #top-header li.top-tel > a {
        background-color: #1a3a7c;
        color: white !important;
        font-size: clamp(16px, 2.8vw, 23px) !important;
        transition: none;
    }
    #top-header .top_back .requestacall { font-size: clamp(14px, 2vw, 18px) !important; }
    .sfm-rollback .sfm-navicon-button { margin-top: 0 !important; }
    #show.topbar-frm {
        position: fixed;
        top: calc(54px + var(--wp-admin--admin-bar--height, 0px));
        width: 100%;
    }
}

/* Wider touch tablets use the flyout menu. Allow a full tap target for each link. */
@media (min-width: 981px) and (any-pointer: coarse) {
    #mega-menu-wrap-primary-menu #mega-menu-primary-menu > li.mega-menu-flyout ul.mega-sub-menu li.mega-menu-item a.mega-menu-link {
        box-sizing: border-box;
        min-height: 44px;
        padding-block: 11px;
        font-size: 15px;
        line-height: 22px;
    }
}

/* The last level can extend below the fixed menu when browser chrome reduces tablet height. */
@media (min-width: 981px) and (max-height: 600px) and (any-pointer: coarse) {
    #mega-menu-wrap-primary-menu #mega-menu-primary-menu .mega-sub-menu ul.mega-sub-menu {
        max-height: calc(100dvh - 15rem - var(--wp-admin--admin-bar--height, 0px));
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}
