@import "../variables/variables";
@import "../mixins/private/dropdown-mixins";
@import "../mixins/private/menu-mixins";
@import "../mixins/private/token-mixins";

.menu__items,
.fake-menu__items {
    @include background-color-token(
        menu-background-color,
        color-background-primary
    );

    cursor: default; /* override text cursor */
}

span.menu,
span.fake-menu {
    display: inline-block;
    vertical-align: bottom;
}

span.menu__items[role="menu"],
span.fake-menu__items {
    display: inline-block;
}

.fake-menu__items {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.menu__item > svg.icon--16,
.fake-menu__item > svg.icon--16 {
    @include menu-menuitem-status();
}

.menu__item > svg.icon--16:last-child,
.fake-menu__item > svg.icon--16:last-child,
.fake-menu__item .badge,
.menu__item .badge {
    margin-left: var(--spacing-100);
    margin-right: var(--spacing-100);
}

a.fake-menu__item {
    @include color-token(menu-anchor-color, color-foreground-primary);

    text-decoration: none;
}

button.fake-menu__item {
    font-size: inherit;
}

button.fake-menu__item,
a.fake-menu__item,
div.menu__item[role^="menuitem"] {
    @include menu-menuitem-base(menu);
}

a.fake-menu__item:focus {
    text-decoration: underline;
}

a.fake-menu__item[aria-current="page"] svg.icon--16,
button.fake-menu__item[aria-current="page"] svg.icon--16 {
    opacity: 1;
}

a.fake-menu__item:not([href]),
button.fake-menu__item[disabled],
div.menu__item[role^="menuitem"][aria-disabled="true"] {
    @include color-token(
        menu-menuitem-disabled-foreground-color,
        color-foreground-disabled
    );

    background-color: unset;
    font-weight: unset;
}

div.menu__item[role^="menuitem"][aria-checked="true"] svg.icon--16 {
    opacity: 1;
}

a.fake-menu__item > span,
button.fake-menu__item > span,
div.menu__item[role^="menuitem"] > span {
    flex: 0 0 auto;
    text-align: left;
    white-space: nowrap;
}

a.fake-menu__item--badged,
button.fake-menu__item--badged,
div.menu__item--badged[role^="menuitem"] {
    position: relative;
}

a.fake-menu__item--badged span.badge,
button.fake-menu__item--badged span.badge,
div.menu__item--badged[role^="menuitem"] span.badge {
    padding: 1px 5px;
    position: absolute;
    top: 0;
    z-index: 1;
}

.menu__items--scroll[role="menu"] {
    overflow-y: scroll;
}

.menu__items--fix-width[role="menu"],
.fake-menu__items--fix-width {
    width: 100%;
}

.menu__items--reverse[role="menu"],
.fake-menu__items--reverse {
    right: 0;
}

.menu button.expand-btn--borderless,
.fake-menu button.expand-btn--borderless {
    background-color: transparent;
    border-color: transparent;
    padding-left: 0;
    vertical-align: initial;

    &:focus {
        outline: none;
        text-decoration: underline;
    }
}

hr.menu__separator {
    @include border-color-token(menu-separator-color, color-stroke-subtle);

    border-style: solid;
    border-width: 1px;
}

/* https://developer.paciellogroup.com/blog/2018/03/focus-visible-and-backwards-compatibility/ */
div.menu__item[role^="menuitem"]:focus:not(:focus-visible) {
    outline: none;
}
