.content-actions-toggle,
.content-actions-trigger {
    display: none;
}
.content-actions-menu {
    display: contents;
}

@media (min-width: 576px) and (max-width: 767.98px),
(min-width: 576px) and (pointer: coarse) and (max-height: 500px) {
    /* Containing block for the menu; below 576px the heading is already sticky. Second condition: touch devices in landscape. */
    .app-content-heading {
        position: relative;
    }
}

@media (max-width: 767.98px),
(pointer: coarse) and (max-height: 500px) {
    .app-content-heading .content-actions:has(> .content-actions-toggle) {
        flex: none;
        overflow: visible;
    }
    .content-actions-toggle {
        display: block;
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }
    .app-content-heading .content-actions .content-actions-trigger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: relative;
        z-index: 1;
        margin: 0;
        padding-left: .25rem;
        padding-right: .25rem;
        min-width: 0;
        width: 2.25rem;
        cursor: pointer;
        user-select: none;
    }
    /* No dropdown without actions: when nothing clickable is visible at this width (e.g. only a text label, or a button with a hidden-*-down class), drop the trigger and show the content inline. */
    @media (max-width: 575.98px) {
        .app-content-heading .content-actions:not(:has(> .content-actions-menu :is(.btn, button, input[type="submit"], form):not(.hidden-xs-up, .hidden-xs-down, .hidden-sm-down, .hidden-md-down))) .content-actions-trigger {
            display: none;
        }
        .app-content-heading .content-actions:not(:has(> .content-actions-menu :is(.btn, button, input[type="submit"], form):not(.hidden-xs-up, .hidden-xs-down, .hidden-sm-down, .hidden-md-down))) .content-actions-menu {
            display: contents;
            visibility: visible;
        }
    }
    @media (min-width: 576px) and (max-width: 767.98px) {
        .app-content-heading .content-actions:not(:has(> .content-actions-menu :is(.btn, button, input[type="submit"], form):not(.hidden-xs-up, .hidden-sm-down, .hidden-md-down))) .content-actions-trigger {
            display: none;
        }
        .app-content-heading .content-actions:not(:has(> .content-actions-menu :is(.btn, button, input[type="submit"], form):not(.hidden-xs-up, .hidden-sm-down, .hidden-md-down))) .content-actions-menu {
            display: contents;
            visibility: visible;
        }
    }
    @media (min-width: 768px) and (max-width: 991.98px) {
        .app-content-heading .content-actions:not(:has(> .content-actions-menu :is(.btn, button, input[type="submit"], form):not(.hidden-xs-up, .hidden-md-down))) .content-actions-trigger {
            display: none;
        }
        .app-content-heading .content-actions:not(:has(> .content-actions-menu :is(.btn, button, input[type="submit"], form):not(.hidden-xs-up, .hidden-md-down))) .content-actions-menu {
            display: contents;
            visibility: visible;
        }
    }
    @media (min-width: 992px) {
        .app-content-heading .content-actions:not(:has(> .content-actions-menu :is(.btn, button, input[type="submit"], form):not(.hidden-xs-up))) .content-actions-trigger {
            display: none;
        }
        .app-content-heading .content-actions:not(:has(> .content-actions-menu :is(.btn, button, input[type="submit"], form):not(.hidden-xs-up))) .content-actions-menu {
            display: contents;
            visibility: visible;
        }
    }
    .content-actions-trigger::before {
        content: "";
        width: .5rem;
        height: .5rem;
        margin-top: -.25rem;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        transition: transform .35s ease;
    }
    .content-actions-toggle:checked + .content-actions-trigger::before {
        margin-top: .25rem;
        transform: rotate(-135deg);
    }
    .content-actions-toggle:focus-visible + .content-actions-trigger {
        outline: 2px solid currentColor;
        outline-offset: 2px;
    }
    .content-actions-toggle:checked + .content-actions-trigger::after {
        /* Invisible full screen layer inside the label, so tapping outside the menu closes it. */
        content: "";
        position: fixed;
        inset: 0;
        z-index: -1;
    }
    .content-actions-menu {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-between-s);
        position: absolute;
        top: 100%;
        right: var(--space-between-l);
        z-index: 2;
        min-width: 12rem;
        max-width: calc(100vw - 2 * var(--space-between-l));
        padding: var(--space-between-s);
        background-color: var(--app-content-heading-background-color);
        border: 1px solid var(--app-content-heading-border-color);
        border-radius: .25rem;
        box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
        visibility: hidden;
        opacity: 0;
        transform: translateY(-.5rem);
        transition: opacity .35s ease, transform .35s ease, visibility 0s linear .35s;
    }
    .content-actions-toggle:checked ~ .content-actions-menu {
        visibility: visible;
        opacity: 1;
        transform: none;
        transition-delay: 0s;
    }
    @media (prefers-reduced-motion: reduce) {
        .content-actions-trigger::before,
        .content-actions-menu {
            transition: none;
        }
    }
    .app-content-heading .content-actions .content-actions-menu > .btn,
    .app-content-heading .content-actions .content-actions-menu > form,
    .app-content-heading .content-actions .content-actions-menu > form .btn {
        display: block;
        width: 100%;
        margin: 0;
    }
}
