/* ============================================================================
   delphos-macos.css — the window layer for Delphos Code + Delphos Design.
   Window controls, floating windows, resize handles, the workbench backdrop
   behind floating windows, and the app bar. Paired with
   assets/js/delphos-macos.js (the file name is historical; the look is our own).
   ========================================================================== */

/* ── window controls: one quiet capsule, glyphs always visible ───────────── */
.dmac-lights {
    display: inline-flex; align-items: center; gap: 2px;
    margin: 0 10px 0 2px; padding: 2px;
    flex: none; position: relative; z-index: 4;
    border-radius: 9px;
    background: rgb(255 255 255 / .04);
    box-shadow: inset 0 0 0 1px var(--border-color, rgb(245 238 230 / .1));
}
body.light_mode .dmac-lights { background: rgb(0 0 0 / .025); }
.dmac-l {
    width: 24px; height: 22px; padding: 0 !important; margin: 0;
    display: grid !important; place-items: center;
    border: 0 !important; border-radius: 7px !important; cursor: pointer !important;
    background: transparent !important;
    color: var(--subheading-color, #aaa39b);
    transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}
.dmac-l svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dmac-l:hover { background: var(--secondary-hover-color, #353330) !important; color: var(--text-color, #eeeae5); }
.dmac-l.is-close:hover { background: rgb(229 83 75 / .16) !important; color: #ef6a60; }
.dmac-l.is-zoom:hover { color: var(--accent, #b7795c); }
.dmac-l:active { transform: scale(.92); }
.dmac-l:focus-visible { outline: 2px solid var(--accent-ring, rgb(183 121 92 / .45)); outline-offset: 1px; }
/* Floating: the float glyph becomes "fill the screen". */
.dmac-win.dmac-windowed .dmac-l.is-zoom svg rect { rx: 1; stroke-dasharray: 3 1.6; }
/* A window behind another one dims its controls. */
.dmac-win.dmac-windowed:not(.dmac-front) .dmac-lights { opacity: .5; }

/* The controls replace the leading back arrow; Esc still leaves. */
.dmac-win .dcode-back,
.dmac-win .ddx-back { display: none !important; }

/* ── floating windows ───────────────────────────────────────────────────── */
.dmac-win.dmac-windowed {
    /* left/top/width/height are inline; releasing right/bottom lets them win
       over the studios' `inset: 0` without !important fighting the inline box. */
    right: auto !important; bottom: auto !important;
    border-radius: 14px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgb(245 238 230 / .08),
        0 30px 90px rgb(0 0 0 / .5),
        0 8px 24px rgb(0 0 0 / .26);
}
.dmac-win.dmac-windowed.dmac-front { box-shadow: 0 0 0 1px var(--accent-ring, rgb(183 121 92 / .28)), 0 30px 90px rgb(0 0 0 / .5), 0 8px 24px rgb(0 0 0 / .26); }
body.light_mode .dmac-win.dmac-windowed {
    box-shadow: 0 0 0 1px rgb(62 54 47 / .12), 0 28px 80px rgb(40 34 28 / .22), 0 8px 22px rgb(40 34 28 / .1);
}
/* No filter/transform/backdrop-filter on the window at rest: any of them would
   become the containing block for the studios' position:fixed menus. */
.dmac-win.dmac-front { z-index: 9010 !important; }

/* resize handles (only in window mode) */
.dmac-rz { position: absolute; z-index: 60; display: none; }
.dmac-windowed > .dmac-rz { display: block; }
.dmac-rz-n, .dmac-rz-s { left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
.dmac-rz-n { top: -2px; } .dmac-rz-s { bottom: -2px; }
.dmac-rz-e, .dmac-rz-w { top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
.dmac-rz-e { right: -2px; } .dmac-rz-w { left: -2px; }
.dmac-rz-ne, .dmac-rz-nw, .dmac-rz-se, .dmac-rz-sw { width: 14px; height: 14px; }
.dmac-rz-ne { top: -2px; right: -2px; cursor: nesw-resize; }
.dmac-rz-sw { bottom: -2px; left: -2px; cursor: nesw-resize; }
.dmac-rz-nw { top: -2px; left: -2px; cursor: nwse-resize; }
.dmac-rz-se { bottom: -2px; right: -2px; cursor: nwse-resize; }

/* While a window moves or resizes, iframes (preview, Monaco workers' hosts)
   must not swallow the pointer, and nothing may be text-selected. */
body.dmac-busy { user-select: none !important; }
body.dmac-busy iframe { pointer-events: none !important; }
body.dmac-busy .dmac-win { transition: none !important; }
body[class*="dmac-resizing-n"], body[class*="dmac-resizing-s"] { cursor: ns-resize; }
body.dmac-resizing-e, body.dmac-resizing-w { cursor: ew-resize; }
body.dmac-resizing-ne, body.dmac-resizing-sw { cursor: nesw-resize !important; }
body.dmac-resizing-nw, body.dmac-resizing-se { cursor: nwse-resize !important; }

/* The title bars are the drag handle. */
.dmac-win .dcode-topbar, .dmac-win .ddx-top { cursor: default; user-select: none; }

/* ── workbench backdrop behind a floating window ────────────────────────── */
.dmac-wallpaper {
    position: fixed; inset: 0; z-index: 8990; display: none; pointer-events: none;
    background-color: #181715;
    background-image:
        radial-gradient(circle at 1px 1px, rgb(245 238 230 / .07) 1px, transparent 1.4px),
        radial-gradient(900px 600px at 50% 40%, rgb(183 121 92 / .10), transparent 70%);
    background-size: 22px 22px, 100% 100%;
}
body.light_mode .dmac-wallpaper {
    background-color: #ece8e2;
    background-image:
        radial-gradient(circle at 1px 1px, rgb(62 54 47 / .13) 1px, transparent 1.4px),
        radial-gradient(900px 600px at 50% 40%, rgb(183 121 92 / .12), transparent 70%);
}
body.dmac-desktop .dmac-wallpaper { display: block; }

/* ── the app bar ─────────────────────────────────────────────────────────
   A slim solid shelf of open apps. The app in front carries an accent bar;
   an app that is put away carries a short muted one. Closed apps are not
   listed at all. */
.dmac-dock {
    position: fixed; z-index: 9600; left: 50%; bottom: 10px;
    transform: translate(-50%, 0);
    display: none; pointer-events: none;
    transition: transform 240ms cubic-bezier(.22,.61,.36,1), opacity 200ms ease;
}
.dmac-dock.is-on { display: block; }
.dmac-dock-shelf {
    display: flex; align-items: center; gap: 4px;
    padding: 5px;
    border-radius: 14px;
    background: var(--darker-background, #252321);
    box-shadow: inset 0 0 0 1px var(--border-color, rgb(245 238 230 / .1)), 0 12px 34px rgb(0 0 0 / .34);
    pointer-events: auto;
}
body.light_mode .dmac-dock-shelf { box-shadow: inset 0 0 0 1px var(--border-color, rgb(62 54 47 / .12)), 0 12px 30px rgb(40 34 28 / .16); }
.dmac-dock-item {
    position: relative; display: grid; place-items: center;
    width: 44px; height: 44px; padding: 0;
    border: 0; border-radius: 10px; background: none; cursor: pointer; color: inherit;
    transition: background-color 140ms ease, transform 140ms ease;
}
.dmac-dock-item:hover { background: var(--secondary-hover-color, #353330); }
.dmac-dock-item:active { transform: scale(.94); }
.dmac-dock-item.is-front { background: var(--secondary-color, #2a2927); }
.dmac-dock-item:focus-visible { outline: 2px solid var(--accent-ring, rgb(183 121 92 / .45)); outline-offset: 1px; }
.dmac-dock-icon { display: block; width: 32px; height: 32px; }
.dmac-dock-icon svg { display: block; width: 100%; height: 100%; }
.dmac-dock-item.is-min .dmac-dock-icon { opacity: .78; }
.dmac-dock-item.is-min:hover .dmac-dock-icon { opacity: 1; }
.dmac-dock-dot {
    position: absolute; bottom: 1px; left: 50%; width: 6px; height: 3px; margin-left: -3px;
    border-radius: 2px; background: var(--subheading-color, #aaa39b); opacity: 0;
    transition: width 160ms ease, margin 160ms ease, background-color 160ms ease;
}
.dmac-dock-item.is-min .dmac-dock-dot { opacity: .7; }
.dmac-dock-item.is-front .dmac-dock-dot { opacity: 1; width: 16px; margin-left: -8px; background: var(--accent, #b7795c); }
.dmac-dock-tip {
    position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
    display: grid; gap: 1px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; text-align: left;
    font: 500 12px/1.3 var(--font, system-ui, -apple-system, 'Segoe UI', sans-serif);
    color: var(--text-color, #eeeae5); background: var(--darker-background, #252321);
    box-shadow: inset 0 0 0 1px var(--border-color, rgb(245 238 230 / .1)), 0 8px 22px rgb(0 0 0 / .3);
    opacity: 0; pointer-events: none; transition: opacity 120ms ease;
}
.dmac-dock-tip b { font-weight: 600; }
.dmac-dock-tip small { font-size: 11px; color: var(--subheading-color, #aaa39b); }
.dmac-dock-item:hover .dmac-dock-tip, .dmac-dock-item:focus-visible .dmac-dock-tip { opacity: 1; }

/* Over a full-screen app the bar hides below the edge until the pointer asks. */
.dmac-dock.is-autohide { transform: translate(-50%, calc(100% + 16px)); }
.dmac-dock.is-autohide.is-peek { transform: translate(-50%, 0); }

/* In chat (nothing in front) it stands on the right edge, clear of the composer. */
.dmac-dock.is-side { left: auto; right: 10px; bottom: auto; top: 50%; transform: translate(0, -50%); }
.dmac-dock.is-side .dmac-dock-shelf { flex-direction: column; }
.dmac-dock.is-side .dmac-dock-dot { bottom: auto; left: 1px; top: 50%; width: 3px; height: 6px; margin: -3px 0 0; }
.dmac-dock.is-side .dmac-dock-item.is-front .dmac-dock-dot { width: 3px; height: 16px; margin: -8px 0 0; }
.dmac-dock.is-side .dmac-dock-tip { bottom: auto; top: 50%; left: auto; right: calc(100% + 10px); transform: translateY(-50%); }

@media (max-width: 820px) { .dmac-dock, .dmac-wallpaper { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
    .dmac-dock, .dmac-dock-item, .dmac-dock-dot, .dmac-l, .dmac-win { transition: none !important; }
}
