/**
 * Floating theme switcher widget.
 * Bottom-right corner, fixed. Consumes theme tokens so it adapts to whichever
 * theme + variant is currently active (dark or light).
 */

.skythemes-root {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 2147483000; /* always on top */
    font-family: inherit;
    color: var(--ink, #ededed);
}

/* ── Trigger button ────────────────────────────────────────────── */
.skythemes-trigger {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line-2, rgba(0, 0, 0, 0.16));
    background: var(--bg-1, #fff);
    color: var(--ink, #0a0a0a);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--theme-shadow-md, 0 6px 18px rgba(0, 0, 0, 0.10), 0 1px 3px rgba(0, 0, 0, 0.06));
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    padding: 0;
}
.skythemes-trigger:hover {
    transform: translateY(-2px);
    box-shadow: var(--theme-shadow-lg, 0 16px 40px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.08));
    background: var(--bg-2, #f4f4f4);
}
.skythemes-trigger:focus-visible {
    outline: 2px solid var(--theme-focus-ring, var(--accent, #ff00ae));
    outline-offset: 2px;
}
.skythemes-trigger svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}
.skythemes-trigger .skythemes-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent, #ff00ae);
    box-shadow: 0 0 0 2px var(--bg-1, #fff);
}

/* ── Panel (open state) ────────────────────────────────────────── */
.skythemes-panel {
    position: absolute;
    right: 0;
    bottom: 56px;
    width: 300px;
    max-width: calc(100vw - 40px);
    background: var(--bg-1, #fff);
    color: var(--ink, #0a0a0a);
    border: 1px solid var(--line, rgba(0, 0, 0, 0.09));
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--theme-shadow-lg, 0 16px 40px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08));
    display: none;
    flex-direction: column;
    gap: 8px;
}
.skythemes-root[data-open="true"] .skythemes-panel { display: flex; }

.skythemes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 8px;
    border-bottom: 1px solid var(--line, rgba(0, 0, 0, 0.09));
}
.skythemes-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-2, #525252);
}
.skythemes-close {
    background: transparent;
    border: 0;
    color: var(--ink-3, #888);
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.skythemes-close:hover {
    background: var(--bg-2, #f4f4f4);
    color: var(--ink, #0a0a0a);
}

/* ── Theme list ─────────────────────────────────────────────── */
.skythemes-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.skythemes-item {
    border-radius: 8px;
    border: 1px solid transparent;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    color: inherit;
    text-align: left;
    width: 100%;
}
.skythemes-item:hover {
    background: var(--theme-muted-surface, var(--bg-2, #f4f4f4));
    border-color: var(--line, rgba(0, 0, 0, 0.09));
}
.skythemes-item[aria-current="true"] {
    background: var(--theme-accent-soft, var(--bg-2, #f4f4f4));
    border-color: var(--line-2, rgba(0, 0, 0, 0.16));
}
.skythemes-item:focus-visible {
    outline: 2px solid var(--theme-focus-ring, var(--accent, #ff00ae));
    outline-offset: 1px;
}
.skythemes-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.skythemes-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink, #0a0a0a);
    line-height: 1.2;
}
.skythemes-item-blurb {
    font-size: 12px;
    color: var(--ink-3, #888);
    line-height: 1.4;
}
.skythemes-item-check {
    width: 16px;
    height: 16px;
    color: var(--accent, #ff00ae);
    visibility: hidden;
}
.skythemes-item[aria-current="true"] .skythemes-item-check { visibility: visible; }

/* Variant chips inside the active theme */
.skythemes-variants {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.skythemes-variant {
    background: transparent;
    border: 1px solid var(--line-2, rgba(0, 0, 0, 0.16));
    color: var(--ink-2, #525252);
    border-radius: 999px;
    height: 24px;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.skythemes-variant:hover {
    color: var(--ink, #0a0a0a);
    border-color: var(--ink-3, #888);
    background: var(--theme-muted-surface, transparent);
}
.skythemes-variant[aria-pressed="true"] {
    background: var(--accent, #ff00ae);
    border-color: var(--accent, #ff00ae);
    color: #fff;
}
.skythemes-variant:focus-visible {
    outline: 2px solid var(--theme-focus-ring, var(--accent, #ff00ae));
    outline-offset: 1px;
}

/* ── Footer ──────────────────────────────────────────────────── */
.skythemes-footer {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--line, rgba(0, 0, 0, 0.09));
    display: flex;
    justify-content: flex-end;
}
.skythemes-hide {
    background: transparent;
    border: 0;
    color: var(--ink-2, #525252);
    font-size: 11px;
    cursor: pointer;
    padding: 4px 8px;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: var(--line-2, rgba(0, 0, 0, 0.16));
}
.skythemes-hide:hover {
    color: var(--ink, #0a0a0a);
    text-decoration-color: currentColor;
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .skythemes-root {
        right: 12px;
        bottom: 12px;
    }
    .skythemes-trigger {
        width: 40px;
        height: 40px;
    }
    .skythemes-trigger svg {
        width: 18px;
        height: 18px;
    }
    .skythemes-panel {
        width: calc(100vw - 24px);
    }
}

/* Print: never show */
@media print {
    .skythemes-root { display: none !important; }
}
