/* The application status bar: a small pill in the bottom right corner, not a full width bar. */
.na-statusbar {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    /* Under CoreUI's dialogs and offcanvas panels, above the page itself. */
    z-index: 1030;
    display: flex;
    justify-content: flex-end;
    font-size: .75rem;
    line-height: 1;
    /* Only the pill itself takes the mouse; the rest of the corner stays clickable. */
    pointer-events: none;

    /* Red, so the branch this build runs from is impossible to miss. Darkened a step from the
       brand's danger color: white on the lighter shades of red is too faint to read at this size. */
    --na-statusbar-bg: color-mix(in srgb, var(--cui-danger, #dc3545) 88%, black);
    --na-statusbar-fg: #fff;
}

/* The bar's parts set their own display, which would otherwise win from the hidden attribute. */
.na-statusbar [hidden] {
    display: none !important;
}

.na-statusbar-panel,
.na-statusbar-restore {
    pointer-events: auto;
    background-color: var(--na-statusbar-bg);
    color: var(--na-statusbar-fg);
    border: 1px solid color-mix(in srgb, var(--na-statusbar-bg) 75%, black);
    border-radius: 999px;
    box-shadow: 0 .125rem .5rem rgba(0, 0, 21, .25);
}

.na-statusbar-panel {
    display: flex;
    align-items: center;
    gap: .375rem;
    padding: .25rem .375rem .25rem .625rem;
    max-width: min(46rem, calc(100vw - 2rem));
}

.na-statusbar-icon {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--na-statusbar-fg);
}

.na-statusbar-branch {
    flex: 0 1 auto;
    min-width: 0;
    color: var(--na-statusbar-fg);
    font-family: var(--cui-font-monospace, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-weight: 600;
    /* A long branch name must not push the pill off the screen. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.na-statusbar-branch[hidden],
.na-statusbar-version[hidden] {
    display: none;
}

/* The version of the running build. Quieter than the branch: on an installed machine it is the only
   thing in the bar, and it should read as a label rather than compete with the application. */
.na-statusbar-version {
    color: var(--na-statusbar-fg);
    font-family: var(--cui-font-monospace, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-weight: 400;
    opacity: 0.75;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.na-statusbar-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background-color: transparent;
    color: var(--na-statusbar-fg);
    width: 1.25rem;
    height: 1.25rem;
}

.na-statusbar-button:hover:not(:disabled),
.na-statusbar-button:focus-visible {
    background-color: rgba(255, 255, 255, .2);
}

.na-statusbar-button:focus-visible,
.na-statusbar-action:focus-visible {
    /* The brand focus ring disappears against red; white reads on every shade of it. */
    outline: 2px solid var(--na-statusbar-fg);
    outline-offset: 1px;
}

.na-statusbar-button:disabled,
.na-statusbar-action:disabled {
    opacity: .6;
    cursor: default;
}

/* The handle that brings the bar back; small, but the same red so it stays easy to find. */
.na-statusbar-restore {
    width: 1.5rem;
    height: 1.5rem;
}

/* Recording context. */
.na-statusbar-divider {
    flex: 0 0 auto;
    align-self: stretch;
    width: 1px;
    margin: .0625rem .125rem;
    background-color: rgba(255, 255, 255, .35);
}

.na-statusbar-recorder,
.na-statusbar-recording-group {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: .25rem;
}

.na-statusbar-action {
    display: inline-flex;
    align-items: center;
    gap: .3125rem;
    height: 1.25rem;
    padding: 0 .5rem;
    border: 0;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, .16);
    color: var(--na-statusbar-fg);
    font: inherit;
    font-weight: 600;
    white-space: nowrap;
}

.na-statusbar-action:hover:not(:disabled),
.na-statusbar-action:focus-visible {
    background-color: rgba(255, 255, 255, .3);
}

.na-statusbar-action-icon {
    display: inline-flex;
}

.na-statusbar-rec {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: 0 .25rem 0 .125rem;
    font-family: var(--cui-font-monospace, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.na-statusbar-rec-dot {
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background-color: var(--na-statusbar-fg);
    animation: na-statusbar-pulse 1.6s ease-out infinite;
}

@keyframes na-statusbar-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .75); }
    70% { box-shadow: 0 0 0 .375rem rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* Capture and its window menu read as one button. */
.na-statusbar-split {
    display: inline-flex;
    gap: 1px;
}

.na-statusbar-split .na-statusbar-capture {
    border-radius: 999px 0 0 999px;
    padding-right: .4375rem;
}

.na-statusbar-split .na-statusbar-capture-menu {
    width: auto;
    padding: 0 .3125rem 0 .25rem;
    border-radius: 0 999px 999px 0;
    background-color: rgba(255, 255, 255, .16);
}

.na-statusbar-capture-window {
    font-weight: 500;
    opacity: .85;
}

/* Off: the picture struck through, as a muted microphone or camera reads everywhere else. */
.na-statusbar-screenshots,
.na-statusbar-narration {
    position: relative;
}

.na-statusbar-screenshots[aria-pressed="false"],
.na-statusbar-narration[aria-pressed="false"] {
    opacity: .8;
}

/* Narration on but the microphone is elsewhere (a field is being dictated into): on, not listening. */
.na-statusbar-narration[aria-pressed="true"] {
    background-color: rgba(255, 255, 255, .18);
}

.na-statusbar-narration-listening::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 999px;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, .75);
    animation: na-statusbar-pulse 1.6s ease-out infinite;
}

.na-statusbar-screenshots[aria-pressed="false"]::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 2px;
    border-radius: 1px;
    background-color: var(--na-statusbar-fg);
    box-shadow: 0 0 0 1px var(--na-statusbar-bg);
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* While minimized, the handle still says that recording goes on. */
.na-statusbar-is-recording .na-statusbar-restore {
    position: relative;
}

.na-statusbar-is-recording .na-statusbar-restore::after {
    content: "";
    position: absolute;
    top: -.1875rem;
    right: -.1875rem;
    width: .625rem;
    height: .625rem;
    border: 2px solid var(--na-statusbar-bg);
    border-radius: 50%;
    background-color: var(--na-statusbar-fg);
    animation: na-statusbar-pulse 1.6s ease-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .na-statusbar-rec-dot,
    .na-statusbar-narration-listening::after,
    .na-statusbar-is-recording .na-statusbar-restore::after {
        animation: none;
    }
}

/* The capture window menu opens above the pill, in the page's colours rather than the bar's red. */
.na-statusbar-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + .375rem);
    min-width: 12.5rem;
    padding: .25rem;
    pointer-events: auto;
    background-color: var(--cui-body-bg, #fff);
    color: var(--cui-body-color, #212631);
    border: 1px solid var(--cui-border-color, #dbdfe6);
    border-radius: .5rem;
    box-shadow: 0 .5rem 1.25rem rgba(0, 0, 21, .18);
    font-size: .8125rem;
    line-height: 1.25;
}

.na-statusbar-menu-title {
    padding: .375rem .625rem .25rem;
    color: var(--cui-secondary-color, #6b7280);
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.na-statusbar-menu-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .375rem .625rem;
    border: 0;
    border-radius: .375rem;
    background-color: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
}

.na-statusbar-menu-item:hover,
.na-statusbar-menu-item:focus-visible {
    background-color: var(--cui-tertiary-bg, #f3f4f7);
}

.na-statusbar-menu-item:focus-visible {
    outline: 2px solid var(--cui-primary, #0d6efd);
    outline-offset: -2px;
}

.na-statusbar-menu-check {
    display: inline-flex;
    width: 13px;
    color: var(--cui-primary, #0d6efd);
    visibility: hidden;
}

.na-statusbar-menu-item[aria-checked="true"] .na-statusbar-menu-check {
    visibility: visible;
}
