/* The media lightbox (issues #866, #1208, #1849): the smallest Military
 * Terminal window, `position: fixed` and outside `.oc-surface`, closed by
 * Esc or a backdrop click. Since #1849 it is a floating window: the body
 * takes its rectangle (left, top, width, height) inline from
 * `MediaLightbox.svelte`, a title strip moves it, the corner grip resizes
 * it, and the image fills the stage keeping its aspect ratio. Moved out of
 * sidebar-help.css so both pages (and the task manager pop-out) load one copy. */
@layer legacy {
    .sidebar-help__lightbox {
        position: fixed;
        inset: 0;
        z-index: 10600;
        background: color-mix(in srgb, var(--oc-ground-panel) 85%, transparent);
    }

    /* The child selector keeps the body placed; modal-glow.css no longer sets `position` on it. */
    .sidebar-help__lightbox > .sidebar-help__lightbox-body {
        position: absolute;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        min-width: 0;
        min-height: 0;
        overflow: hidden;
        background: var(--oc-ground-panel);
        box-shadow: inset 0 0 0 1px var(--oc-line-rule);
    }

    .sidebar-help__lightbox-body:focus-visible {
        outline: none;
    }

    /* The title strip is the shared `.modal-titlerow` (modal-titlerow.css); this bar adds its place in the column, its
     * spread and the drag handle. */
    .sidebar-help__lightbox-bar {
        flex: 0 0 auto;
        justify-content: space-between;
        gap: 10px;
        cursor: move;
        touch-action: none;
        user-select: none;
    }

    [data-help-lightbox-close] {
        flex: 0 0 auto;
    }

    .sidebar-help__lightbox-stage {
        flex: 1 1 0;
        min-height: 0;
        min-width: 0;
        padding: 8px;
        display: flex;
    }

    .sidebar-help__lightbox-img {
        display: block;
        flex: 1 1 0;
        min-width: 0;
        min-height: 0;
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    /* The title: the small tracked uppercase label in the accent. */
    .sidebar-help__lightbox-caption {
        margin: 0;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-family: var(--font-mono);
        font-size: var(--oc-fs-micro, 10px);
        letter-spacing: var(--oc-tracking-label, 0.6px);
        text-transform: uppercase;
        color: var(--oc-orange);
    }

    /* The resize grip: a square hairline corner, bottom right. */
    .sidebar-help__lightbox-grip {
        position: absolute;
        right: 0;
        bottom: 0;
        z-index: 2;
        width: 16px;
        height: 16px;
        cursor: nwse-resize;
        touch-action: none;
        background: linear-gradient(135deg, transparent 50%, var(--oc-line-rule) 50%, var(--oc-line-rule) 58%, transparent 58%, transparent 72%, var(--oc-line-rule) 72%, var(--oc-line-rule) 80%, transparent 80%);
    }

    .sidebar-help__lightbox-grip:hover {
        background-color: var(--oc-ground-hover);
    }
}
