/* ============================================================
   Theme switch — the light / dark / system segmented control.

   Standalone on purpose: it is shown on the three staff portals (which run on
   the phoenix tokens) and on the staff login (which runs on the public
   --color-* tokens). Every colour resolves through a chain that ends in a
   literal, so the control looks right on either stack and on a page that
   defines neither.
   ============================================================ */

.theme-switch {
    --ts-border: var(--phoenix-border, var(--color-border, #D4DDE8));
    --ts-bg: var(--phoenix-bg-muted, var(--color-surface-raised, #E9EFF6));
    --ts-fg: var(--phoenix-foreground-muted, var(--color-text-muted, #51637A));
    --ts-active-bg: var(--phoenix-primary, var(--color-primary, #123C61));
    --ts-active-fg: var(--phoenix-on-primary, var(--color-text-on-primary, #FFFFFF));
    --ts-hover-rgb: var(--phoenix-primary-rgb, var(--color-primary-rgb, 18, 60, 97));

    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--ts-border);
    background: var(--ts-bg);
    border-radius: 999px;
    flex-shrink: 0;
}

.theme-switch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ts-fg);
    line-height: 0;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

    .theme-switch-btn svg {
        width: 14px;
        height: 14px;
        display: block;
    }

    .theme-switch-btn:hover {
        background: rgba(var(--ts-hover-rgb), .12);
        color: var(--ts-active-bg);
    }

    .theme-switch-btn:focus-visible {
        outline: 2px solid var(--ts-active-bg);
        outline-offset: 1px;
    }

    .theme-switch-btn[aria-pressed="true"],
    .theme-switch-btn[aria-pressed="true"]:hover {
        background: var(--ts-active-bg);
        color: var(--ts-active-fg);
    }

@media (max-width: 575.98px) {
    .theme-switch-btn {
        width: 26px;
        height: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .theme-switch-btn {
        transition: none;
    }
}
