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

nav.breadcrumbs {
    @include color-token(
        breadcrumbs-item-foreground-color,
        color-foreground-secondary
    );

    font-size: var(--font-size-small);
    height: fit-content;
    margin: 8px 0;
    min-height: 16px;
    overflow-x: scroll; /* Deprecated in 15.2.0; kept it in to support deprecated implementations; @TODO remove in 16.0.0 */
    padding: 8px;
    scrollbar-width: none; /* Deprecated in 15.2.0; kept it in to support deprecated implementations; @TODO remove in 16.0.0 */
    white-space: nowrap;
}

nav.breadcrumbs > ul {
    display: inline-block;
    margin: 0;
    min-width: 100%;
    padding: 0;
    right: 0;
}

/* On certain pages spacing in each container can vary in size even if content is the same. */
/* Force content to flex makes it all have the same size */
nav.breadcrumbs > ul > li {
    align-items: center;
    display: inline-flex;
    vertical-align: middle;
}

nav.breadcrumbs > ul > li[hidden] {
    display: none;
}

nav.breadcrumbs > ul > li svg {
    margin-left: 3px;
    margin-right: 3px;
}

nav.breadcrumbs > ul > li svg.icon--12 {
    margin-left: var(--spacing-75);
    margin-right: var(--spacing-75);
}

nav.breadcrumbs > ul > li > a {
    text-decoration: none;
}

nav.breadcrumbs > ul > li > button {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 1em;
    margin: 0;
    padding: 0;
}

nav.breadcrumbs > ul > li > a,
nav.breadcrumbs > ul > li > button {
    color: inherit;
    max-width: 168px;
    outline-offset: 5px;
    overflow: hidden;
    text-overflow: ellipsis;

    &:focus,
    &:hover {
        text-decoration: underline;
    }

    &[aria-current] {
        @include color-token(
            breadcrumbs-item-current-foreground-color,
            color-foreground-primary
        );

        text-decoration: none;
    }
}

nav.breadcrumbs > ul > li > a:focus:not(:focus-visible),
nav.breadcrumbs > ul > li > button:focus:not(:focus-visible) {
    outline: none;
}

/* Deprecated in 15.2.0; kept it in to support deprecated implementations; @TODO remove in 16.0.0 */
nav.breadcrumbs::-webkit-scrollbar {
    display: none;
}

/* Introduced modifier in 15.2.0; supports new implementations; @TODO remove in 16.0.0 and remove modifier class from markup */
nav.breadcrumbs.breadcrumb--overflow {
    overflow-x: unset;
    scrollbar-width: unset;
}

nav.breadcrumbs .fake-menu-button__button,
nav.breadcrumbs .menu-button__button {
    background-color: var(
        --icon-button-background-color,
        var(--color-background-secondary)
    );
    height: var(--spacing-300);
    min-height: var(--spacing-300);
    min-width: var(--spacing-300);
    outline-offset: 1px;
    width: var(--spacing-300);
}

nav.breadcrumbs .fake-menu-button__button svg.icon,
nav.breadcrumbs .menu-button__button svg.icon {
    @include fill-token(
        breadcrumbs-overflow-foreground-color,
        color-foreground-secondary
    );
}

nav.breadcrumbs .fake-menu-button__menu,
nav.breadcrumbs .menu-button__menu {
    font-size: var(--font-size-default);
}

[dir="rtl"] nav.breadcrumbs svg.icon--12 {
    transform: rotate(180deg);
}

@media (min-width: $_screen-size-SM) {
    nav.breadcrumbs {
        margin: 16px 0;
    }
}
