/*
  Side menu / hamburger menu styling
 */

.menu__item-button {
    background-color: transparent;
    border: none;
}

.menu-side {
    .current-menu-ancestor {
        .menu-side__link {
            font-weight: $font-weight-bold;
        }
    }

    .current-menu-item {
        > .menu-side__parent-link,
        > .menu-side__link,
        > .menu-side__children-link {
            font-weight: $font-weight-bold;
            text-decoration: underline;
        }
    }
}

.menu__nav-header {
    gap: $spacing-xl;
    padding: $spacing-xl $spacing-xxl 0 $spacing-xxl;

    @include media-breakpoint-down(md) {
        padding: $spacing-xl rem(36px) 0 rem(36px);
    }
}

.menu__scroll-container {
    height: 100%;
    padding: $spacing-xl $spacing-xxl;
    pointer-events: none;

    @include media-breakpoint-down(md) {
        height: 100dvh;
        overflow-y: auto;
        padding: $spacing-md rem(36px) $spacing-xxl;
    }

    &::-webkit-scrollbar {
        display: none;
    }

    > ul {
        padding-left: 0;
    }

    &::after {
        background-color: $color-shade-light;
        bottom: 0;
        content: ' ';
        height: 100%;
        left: 0;
        position: fixed;
        top: 0;
        width: $side-menu-width;
        z-index: -1;

        @include media-breakpoint-down(md) {
            width: 100%;
        }
    }
}

.menu-side__item {
    @extend %menu__item;
    font-size: $font-size-lg;
    margin: $spacing-md calc(#{$spacing-lg} * -1);
    position: unset;
    width: calc(100% + $spacing-xxl);
}

.menu__scroll-container .menu-side__link {
    @extend %menu__link;
    padding: $spacing-sm $spacing-lg;
    transition: $transition-default;

    &:hover {
        font-weight: $font-weight-bold;

        &::after {
            margin-right: -$spacing-xs;
        }
    }

    &.current-menu-item,
    &.current_menu_item {
        background-color: $color-primary-light;
        border-radius: $border-radius-xl;
    }
}

.menu-item-has-children {
    .menu-side__link {
        align-items: center;
        display: flex;
        justify-content: space-between;

        &::after {
            background-color: $color-text-dark;
            content: '';
            display: inline-block;
            flex-shrink: 0;
            height: rem(24px);
            -webkit-mask-image: url('@icons/chevron.svg');
            mask-image: url('@icons/chevron.svg');
            transform: rotate(-90deg);
            transition: $transition-default;
            width: rem(24px);
        }
    }

    .sidemenu_is_open.menu-side__child-container {
        left: $side-menu-width;
        opacity: 1;
        pointer-events: unset;

        &::after {
            left: $side-menu-width;
        }

        @include media-breakpoint-down(md) {
            left: 0;
            width: 100%;

            &::after {
                left: 0;
            }
        }
    }

    .sidemenu_is_closing.menu-side__child-container {
        left: 0;
        opacity: 1;

        &::after {
            left: $side-menu-width;
            opacity: 1;
            pointer-events: unset;
        }
    }
}

.menu-side__container {
    height: 100dvh;
    left: -$side-menu-width;
    opacity: 0;
    overflow-y: auto;
    position: fixed;
    top: 0;
    transition: $transition-slow;
    width: $side-menu-width;
    z-index: $z-index-side-menu;

    @include media-breakpoint-down(md) {
        overflow-y: unset;
        padding: 0;
        width: 0;
    }
}

.menu-side__child-container {
    bottom: 0;
    display: block;
    height: 100%;
    left: -$side-menu-width;
    margin: 0;
    opacity: 0;
    padding: 145px $spacing-xxl 0 $spacing-xxl;
    pointer-events: none;
    position: absolute;
    top: 0;
    transition: $transition-slow;
    width: unset;
    z-index: -1;

    @include media-breakpoint-down(md) {
        padding: 125px rem(36px) 0 rem(36px);
        width: 0;
        z-index: 1;
    }

    &::after {
        background-color: $color-primary-light;
        border-radius: 0 $border-radius-xl $border-radius-xl 0;
        bottom: 0;
        box-shadow: 0 0 8px 0 rgba(243, 146, 0, 0.2) inset;
        content: ' ';
        height: 100%;
        left: -430px; //-$side-menu-width;
        position: fixed;
        top: 0;
        transition: $transition-slow;
        width: 430px; //$side-menu-width;
        z-index: -1;

        @include media-breakpoint-down(md) {
            border-radius: 0;
            left: 0;
            width: 100%;
        }
    }

    .menu-item {
        margin-left: 0;
    }

    .menu-side__item {
        display: block;
    }
}
@include media-breakpoint-up(md) {
    .sidemenu_is_closing {
        &::after {
            background-color: $color-primary-light;
            border-radius: 0 $border-radius-xl $border-radius-xl 0;
            bottom: 0;
            box-shadow: 0 0 8px 0 rgba(243, 146, 0, 0.2) inset;
            content: ' ';
            height: 100%;
            left: 430px; //$side-menu-width;
            opacity: 1;
            pointer-events: unset;
            position: fixed;
            top: 0;
            transition: $transition-slow;
            width: 430px; //$side-menu-width;
            z-index: -5;
        }
    }
}

.menu-side__back {
    align-items: center;
    background-color: transparent;
    border: none;
    color: $color-shade-dark;
    display: flex;
    margin-bottom: $spacing-md;
    padding: 0;

    .icon-chevron-left {
        height: rem(24px);
        left: $spacing-sm;
        position: absolute;
        transform: rotate(90deg);
        width: rem(24px);
    }
}

.menu-side__back-li {
    list-style: none;
}

.menu-side__parent-item {
    list-style: none;
    margin-bottom: $spacing-xl;

    &:last-child {
        margin-bottom: 0;
    }
}

.menu-side__parent-link {
    font-size: $font-size-md;
    font-weight: $font-weight-semi-bold;
    line-height: rem(28px);
    padding: $spacing-xs 0;
    text-decoration: none;

    &::after {
        display: none;
    }
}

.menu--children {
    display: unset;
    padding: 0;

    .menu-side__children-link {
        transition: $transition-default;
    }

    .menu-side__children-link:hover {
        font-weight: $font-weight-semi-bold;
    }
}

.menu-side__children-link {
    @extend %menu__link;
    font-size: $font-size-default;
    padding: $spacing-xs 0;

    @include media-breakpoint-down(md) {
        padding: $spacing-sm 0;
    }
}

.menu--second-level {
    flex-direction: column;
    gap: $spacing-md;
    height: unset;
    margin-top: $spacing-lg;
    padding-left: 0;

    .menu__link {
        transition: $transition-default;

        &:hover {
            font-weight: $font-weight-bold;
        }
    }
}

.menu-side__buttons {
    margin-bottom: $spacing-lg;
    margin-top: $spacing-xxl;

    .menu-side__item {
        margin: $spacing-md 0;
        width: 100%;
    }

    svg {
        transition: unset;
    }
}

.menu-side__button {
    &::after {
        display: none;
    }
}

body.menu_is_open {
    height: 100dvh;
    overflow: hidden;
    position: relative;

    &::after {
        background-color: rgba($color-shade-darkest, 0.2);
        content: '';
        inset: 0;
        position: fixed;
        z-index: $z-index-side-menu-overlay;
    }

    .menu__scroll-container {
        pointer-events: unset;
    }

    .has_side_panel.menu-side__container {
        width: calc(430px + 430px); //$side-menu-width + $side-menu-width

        &::-webkit-scrollbar {
            display: none;
        }

        @include media-breakpoint-down(md) {
            width: 100%;
        }
    }

    .menu-side__container,
    .menu-side {
        left: 0;
        opacity: 1;
        width: 430px; //$side-menu-width;

        @include media-breakpoint-down(md) {
            width: 100%;
        }
    }

    @include media-breakpoint-down(md) {
        .header__hamburger {
            display: none;
        }

        .header__hamburger-close {
            display: block;
        }
    }
}

.menu-side__contact {
    margin-top: $spacing-lg;
}

.menu-side__social-media {
    margin-top: $spacing-md;

    .socials-icons {
        gap: $spacing-sm;
    }

    .social-icon {
        height: rem(40px);
        width: rem(40px);

        > svg {
            height: rem(24px);
            width: rem(24px);
        }
    }
}
