/*
 * The WPM bar on design.wpm.si.
 *
 * Injected by the host's nginx (sub_filter before </body>) and served from
 * /wpm-assets/ — Penpot itself is not modified. Penpot sizes its layouts to the
 * viewport with 100vh, so header.js rewrites those rules to leave room for the
 * bar; this file only draws the bar and the menu, and moves the page down.
 *
 * @see deploy/penpot/wpm/header.js
 * @see docs/PENPOT.md
 */

:root {
    --wpm-bar: 32px;
}

/*
 * Room for the bar is made *inside* each Penpot screen, not by moving the page.
 * Penpot places context menus from the pointer, measured from the top of the
 * window, against the screen's root element — so that root must stay at the
 * top of the window. A body margin moved every right-click menu 32px down.
 * The roots keep their full height (header.js leaves their 100vh alone) and
 * their content starts under the bar.
 */
#app > * {
    box-sizing: border-box !important;
    padding-top: var(--wpm-bar) !important;
}

#wpm-bar,
#wpm-menu,
#wpm-scrim {
    box-sizing: border-box;
    font: 500 13px/1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

#wpm-bar *,
#wpm-menu * {
    box-sizing: border-box;
}

#wpm-bar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--wpm-bar);
    z-index: 2147483000;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px 0 4px;
    background: #111113;
    color: #f4f4f5;
    border-bottom: 1px solid #27272a;
}

#wpm-bar button,
#wpm-bar a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

#wpm-bar button:hover,
#wpm-bar a:hover,
#wpm-bar button[aria-expanded="true"] {
    background: #27272a;
}

#wpm-bar button:focus-visible,
#wpm-bar a:focus-visible,
#wpm-menu a:focus-visible,
#wpm-menu button:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 1px;
}

#wpm-bar svg,
#wpm-menu svg {
    width: 16px;
    height: 16px;
    flex: none;
}

#wpm-bar .wpm-mark {
    font-weight: 700;
    letter-spacing: 0.02em;
}

#wpm-bar .wpm-app {
    color: #a1a1aa;
    font-weight: 500;
}

#wpm-bar .wpm-spacer {
    flex: 1;
    min-width: 0;
}

#wpm-bar .wpm-back {
    color: #d4d4d8;
}

#wpm-bar .wpm-icon {
    position: relative;
    justify-content: center;
    width: 28px;
    padding: 0;
    color: #d4d4d8;
}

#wpm-bar .wpm-icon svg {
    width: 17px;
    height: 17px;
}

#wpm-bar .wpm-badge {
    position: absolute;
    top: 0;
    right: -2px;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
    box-shadow: 0 0 0 2px #111113;
    pointer-events: none;
}

#wpm-bar .wpm-badge[hidden] {
    display: none !important;
}

#wpm-scrim {
    position: fixed;
    inset: var(--wpm-bar) 0 0 0;
    z-index: 2147482998;
    background: rgba(0, 0, 0, 0.35);
}

#wpm-menu {
    position: fixed;
    top: var(--wpm-bar);
    left: 0;
    bottom: 0;
    z-index: 2147482999;
    width: 260px;
    max-width: 85vw;
    display: flex;
    flex-direction: column;
    padding: 8px;
    overflow-y: auto;
    background: #18181b;
    color: #f4f4f5;
    border-right: 1px solid #27272a;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
}

#wpm-menu[hidden],
#wpm-scrim[hidden] {
    display: none !important;
}

#wpm-menu .wpm-menu-title {
    padding: 8px 10px 10px;
    color: #a1a1aa;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

#wpm-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    color: #e4e4e7;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.2;
}

#wpm-menu a:hover {
    background: #27272a;
    color: #fff;
}

#wpm-menu a svg {
    color: #a1a1aa;
}

#wpm-menu .wpm-menu-foot {
    margin-top: auto;
    padding: 10px;
    color: #71717a;
    font-size: 11px;
    line-height: 1.4;
}

@media (max-width: 480px) {
    #wpm-bar .wpm-app,
    #wpm-bar .wpm-back-label {
        display: none;
    }
}
