/* =========================================================
   workspace_switch.css — floating workspace chooser.
   Loaded on the homepage only (via index.php $extraCSS).
   Uses brand.css tokens, so it theme-flips automatically.

   Two presentations, switched by .is-collapsed on .jb-ws
   (added server-side by the partial once a choice exists):

     default        UNCHOSEN — prominent centred pill (as it was)
     .is-collapsed  CHOSEN   — discreet gear, bottom-left by the
                              cookie toggle; .is-open pops the pill
   ========================================================= */

.jb-ws {
    /* Collapsed-gear placement. Nudge to sit cleanly beside the
       bottom-left cookie toggle. */
    --jb-ws-bottom: 18px;
    --jb-ws-left: 76px;

    position: fixed;
    z-index: 95;
    display: inline-flex;
    align-items: center;

    /* default = UNCHOSEN: prominent, bottom-centre */
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
}

/* ---- The gear (only shown once collapsed) ---- */
.jb-ws__gear {
    display: none;                 /* hidden in the centred/unchosen state */
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: saturate(140%) blur(10px);
    border: 1px solid var(--line);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.12);
    color: var(--jb-blue);
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 220ms var(--ease-out),
                background 180ms var(--ease-out),
                color 180ms var(--ease-out);
}
.jb-ws__gear:hover { transform: rotate(30deg); }

/* ---- The chooser pill (decoration here, used by both states) ---- */
.jb-ws__panel {
    display: inline-flex;
    align-items: center;
    padding: 8px;
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: saturate(140%) blur(10px);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
    white-space: nowrap;
}

/* ========================================================
   COLLAPSED — a choice has been made
   ======================================================== */
.jb-ws.is-collapsed {
    bottom: var(--jb-ws-bottom);
    left: var(--jb-ws-left);
    transform: none;
}
.jb-ws.is-collapsed .jb-ws__gear { display: inline-flex; }
.jb-ws.is-collapsed.is-open .jb-ws__gear {
    background: var(--ink);
    color: var(--paper);
}
.jb-ws.is-collapsed .jb-ws__panel {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px) scale(0.96);
    transform-origin: bottom left;
    transition: opacity 160ms var(--ease-out),
                transform 160ms var(--ease-out),
                visibility 0s linear 160ms;
}
.jb-ws.is-collapsed.is-open .jb-ws__panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition: opacity 160ms var(--ease-out),
                transform 160ms var(--ease-out),
                visibility 0s;
}

/* ---- Segment + options (shared) ---- */
.jb-ws__seg {
    display: inline-flex;
    gap: 4px;
    background: var(--paper-2);
    border-radius: 999px;
    padding: 3px;
}
.jb-ws__opt {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--ink-2);
    text-decoration: none;
    transition: background 180ms var(--ease-out), color 180ms var(--ease-out);
}
.jb-ws__opt:hover { color: var(--ink); }
.jb-ws__opt.is-active {
    background: var(--ink);
    color: var(--paper);
}

.jb-ws.is-applying { opacity: 0.7; pointer-events: none; }

@media (max-width: 600px) {
    .jb-ws { bottom: 16px; }                 /* centred default on mobile */
    .jb-ws.is-collapsed {
        --jb-ws-left: 66px;
        --jb-ws-bottom: 17px;
    }
    .jb-ws__opt { padding: 7px 12px; font-size: 0.62rem; }
}
@media (prefers-reduced-motion: reduce) {
    .jb-ws__gear, .jb-ws__panel, .jb-ws__opt { transition: none; }
    .jb-ws__gear:hover { transform: none; }
}
