/* BreadcrumbSplit (public/js/ui/components/display/breadcrumb-split.mjs): a breadcrumb pill from lg up, a split button below.
   Layered, so the d-none and lg:d-flex utilities on these elements still win. */
@layer custom {
    .breadcrumb-split {
        min-width: 0;
    }

    /* The trail is one quiet pill, the size of a small button. Long names truncate, so it never wraps. */
    .breadcrumb-split .breadcrumb {
        --bs-breadcrumb-font-size: 0.875rem;
        --bs-breadcrumb-bg: var(--bs-bg-1);
        --bs-breadcrumb-border-radius: 999px;
        --bs-breadcrumb-padding-x: 0.25rem;
        --bs-breadcrumb-padding-y: 0.1875rem;
        --bs-breadcrumb-link-padding-x: 0.625rem;
        --bs-breadcrumb-link-border-radius: 999px;
        --bs-breadcrumb-link-hover-bg: var(--bs-bg-body);
        flex-wrap: nowrap;
        width: fit-content;
        max-width: 100%;
        border: 1px solid #eef0f3;
    }

    .breadcrumb-split .breadcrumb-item {
        min-width: 0;
    }

    /* The outermost crumb never truncates, and the current page gives way first: the heading below repeats it */
    .breadcrumb-split .breadcrumb-item:first-child {
        flex: none;
    }

    .breadcrumb-split .breadcrumb-item:last-child:not(:first-child) {
        flex-shrink: 8;
    }

    .breadcrumb-split .breadcrumb-divider {
        flex: none;
    }

    /* A block, not Bootstrap's flex box, so text-overflow applies */
    .breadcrumb-split .breadcrumb-link {
        display: block;
        min-height: 0;
        padding-block: 0.3125rem;
        overflow: hidden;
        font-weight: 500;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .breadcrumb-split .breadcrumb-link.active {
        font-weight: 700;
    }

    .breadcrumb-split .breadcrumb-link:hover {
        box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
    }

    /* The split button (a btn-group of the back link and the menu caret) shrinks, and the back link's name truncates */
    .breadcrumb-split .breadcrumb-split-compact,
    .breadcrumb-split .breadcrumb-split-button,
    .breadcrumb-split .breadcrumb-split-button .btn-group {
        min-width: 0;
        max-width: 100%;
    }

    /* btn-subtle leaves an open toggle's border to .btn's dark default; the split button stays borderless while its menu is open */
    .breadcrumb-split .breadcrumb-split-button .btn {
        --bs-btn-active-border-color: transparent;
    }

    .breadcrumb-split .breadcrumb-split-back {
        gap: 0.25rem;
        min-width: 0;
        font-weight: 600;
    }

    .breadcrumb-split .breadcrumb-split-back span,
    .breadcrumb-split .breadcrumb-split-current {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .breadcrumb-split .breadcrumb-split-current {
        display: block;
        font-weight: 600;
        color: var(--bs-fg-1);
    }

    /* Long names wrap inside the menu instead of running off a narrow screen */
    .breadcrumb-split .breadcrumb-split-compact .menu {
        max-width: calc(100vw - 2rem);
    }

    .breadcrumb-split .breadcrumb-split-compact .menu-item {
        white-space: normal;
    }

    .breadcrumb-split .breadcrumb-split-compact .menu-item-content {
        min-width: 0;
    }
}
