/*
Theme Name: Able Menu Development v2
Theme URI: https://welcometoable.co.uk/
Description: Staging-only child theme for testing optional third-level navigation. Uses the existing Able theme as its parent and leaves the parent theme untouched.
Author: Able
Template: able
Version: 0.2.0
*/

/* Optional third-level navigation */
.able-submenu-item {
    --able-submenu-colour: #6d858f;
    --able-submenu-hover: #35454a;
    position: relative;
}

.able-submenu-item--green {
    --able-submenu-colour: #56bd7f;
    --able-submenu-hover: #3b734f;
}

.able-submenu-item--blue {
    --able-submenu-colour: #69b6d0;
    --able-submenu-hover: #4a7eab;
}

.able-submenu-item--purple {
    --able-submenu-colour: #b380b6;
    --able-submenu-hover: #8b5a8e;
}

.able-submenu-parent {
    display: flex;
    align-items: stretch;
    position: relative;
}

.able-submenu-parent-link {
    flex: 1 1 auto;
    padding-right: 8px;
}

.able-submenu-toggle {
    appearance: none;
    -webkit-appearance: none;
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--able-submenu-colour);
    cursor: pointer;
    display: flex;
    flex: 0 0 38px;
    justify-content: center;
    padding: 0 12px 0 4px;
}

.able-submenu-toggle:hover {
    color: var(--able-submenu-hover);
}

.able-submenu-toggle:focus-visible,
.able-submenu-parent-link:focus-visible,
.able-submenu-link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -3px;
}

.able-submenu-chevron {
    border-bottom: 2px solid currentColor;
    border-right: 2px solid currentColor;
    display: block;
    height: 7px;
    transform: rotate(-45deg);
    transition: transform .18s ease;
    width: 7px;
}

.able-submenu-panel {
    background-color: #fff;
    border-radius: 22px;
    box-shadow: 0 0 5px #0003;
    display: none;
    font-size: 16px;
    left: calc(100% - 1px);
    max-height: calc(100vh - 120px);
    max-width: min(320px, calc(100vw - 40px));
    min-width: 240px;
    overflow-y: auto;
    padding-bottom: 12px;
    padding-top: 12px;
    position: absolute;
    top: -12px;
    z-index: 920;
}

.able-submenu-item.is-open > .able-submenu-panel,
.able-submenu-item:focus-within > .able-submenu-panel {
    display: block;
}

.able-submenu-item.opens-left > .able-submenu-panel {
    left: auto;
    right: calc(100% - 1px);
}

.able-submenu-link {
    color: var(--able-submenu-colour);
    display: block;
    padding: 10px 20px;
    text-decoration: none;
    text-decoration-color: transparent;
    text-underline-offset: 4px;
    text-underline-position: under;
    transition: color .2s;
}

.able-submenu-link:hover,
.able-submenu-link:focus {
    color: var(--able-submenu-hover);
    text-decoration: underline;
    text-decoration-color: var(--able-submenu-hover);
}

@media screen and (min-width: 992px) {
    .able-submenu-item:hover > .able-submenu-panel {
        display: block;
    }
}

@media screen and (max-width: 991px) {
    .able-submenu-item {
        position: static;
    }

    .able-submenu-parent {
        width: 100%;
    }

    .able-submenu-parent-link {
        padding-left: 50px;
        padding-right: 50px;
        text-align: center;
        width: 100%;
    }

    .able-submenu-toggle {
        bottom: 0;
        flex-basis: 44px;
        padding: 0 14px;
        position: absolute;
        right: 0;
        top: 0;
        width: 44px;
    }

    .able-submenu-chevron {
        transform: rotate(45deg);
    }

    .able-submenu-item.is-open .able-submenu-chevron {
        transform: rotate(225deg);
    }

    .able-submenu-panel,
    .able-submenu-item.opens-left > .able-submenu-panel {
        background-color: #f7f9fa;
        border-radius: 0;
        box-shadow: none;
        left: auto;
        max-height: none;
        max-width: none;
        min-width: 0;
        overflow: visible;
        padding: 4px 0 10px;
        position: static;
        right: auto;
        top: auto;
        width: 100%;
    }

    .able-submenu-item:not(.is-open) > .able-submenu-panel {
        display: none !important;
    }

    .able-submenu-item.is-open > .able-submenu-panel {
        display: block !important;
    }

    .able-submenu-link {
        font-size: 17px;
        padding: 9px 20px;
        text-align: center;
    }
}
