/* =====================================================================
 * Desktop title bar inset (R1-12b, issue #2338; docs/desktop-app.md "Window chrome")
 * ---------------------------------------------------------------------
 * The Mac app hides each window's title bar and floats the traffic lights over the page. Every rule here is under
 * `html[data-desktop-chrome]`, a marker client/js/desktop-chrome.js stamps ONLY when the app's bridge lists `windowChrome`, so a
 * browser tab computes none of it (no strip, no padding, and the `var(--desktop-inset-top, 0px)` offsets other files carry
 * fall back to 0).
 *
 * ONE SHARED BAND, NOT A PATCH PER SCREEN. The page keeps its top `--desktop-inset-top` clear by padding the body, paints that
 * band as a chrome-ground strip with a hairline (the same look as the drawer it meets) and makes it the window's drag region.
 * Nothing interactive lives in the band, so drag needs no per-button exceptions there. Fixed elements that sit at `top: 0`
 * (the drawer, its rail, the notes panel, the update banner, the menu-page bar) start below the band instead, each with
 * `top: var(--desktop-inset-top, 0px)` in its own file, and `--header-h` / `--overlay-top` grow by the band (those two rules sit in
 * launchpad-host.css, beside the unlayered rules they override) so every overlay that starts under the header still does.
 *
 * The numbers are the shell's (macOS/window-chrome.js INSET): 28 px high, 78 px of lights from the left. The script replaces
 * them with the shell's answer, and sets both to 0 in full screen (`data-fullscreen`), where the lights and the band go.
 * THE POP-OUT WINDOW'S BAR IS ITS OWN STRIP: while a pop-out draws the compact bar (`.oc-topbar`) the band is not drawn (the bar
 * keeps the lights clear and is the drag region, web/src/opscenter/shell/TopBar.svelte); a wallboard pop-out has no bar and
 * keeps the band.
 * ===================================================================== */

/* In `@layer legacy`: nothing here competes with an unlayered rule (an unlayered one would beat it whatever its specificity). */
@layer legacy {
    html[data-desktop-chrome] {
        --desktop-inset-top: 28px;
        --desktop-inset-left: 78px;
    }

    html[data-desktop-chrome] body {
        padding-top: var(--desktop-inset-top);
    }

    /* THE STRIP. Under every fixed layer (z-index 0), over nothing: the body is padded clear of it. */
    html[data-desktop-chrome]::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: var(--desktop-inset-top);
        z-index: 0;
        background: var(--oc-ground-chrome);
        box-shadow: inset 0 -1px 0 0 var(--oc-line-chrome);
        -webkit-app-region: drag;
    }

    /* FULL SCREEN: no lights, so no band (the script also writes 0 into both variables). */
    html[data-desktop-chrome][data-fullscreen]::before {
        display: none;
    }

    /* A POP-OUT WITH ITS BAR: the bar is the strip. */
    html[data-popout][data-desktop-chrome].ps-topbar body {
        padding-top: 0;
    }

    html[data-popout][data-desktop-chrome].ps-topbar::before {
        display: none;
    }
}
