/* theme-switcher.css — header theme picker (partials/theme_switcher.html) */

.theme-switcher {
    position: relative;
    display: flex;
    align-items: center;
}

.theme-switcher-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.theme-switcher-trigger:hover,
.theme-switcher-trigger[aria-expanded="true"] {
    color: var(--color-accent);
    background-color: var(--color-accent-soft);
    border-color: var(--color-border);
}

.theme-switcher-icon {
    width: 1.15rem;
    height: 1.15rem;
}

/* ---- Menu ---- */

.theme-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 1100;
    min-width: 15rem;
    padding: var(--space-xs);
    background-color: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.theme-menu[hidden] {
    display: none;
}

.theme-menu-heading {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.theme-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    color: var(--color-text);
    text-align: left;
    cursor: pointer;
}

.theme-menu-item:hover {
    background-color: var(--color-accent-soft);
}

.theme-menu-item[aria-checked="true"] {
    background-color: var(--color-accent-faint);
}

.theme-menu-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.theme-menu-label {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
}

.theme-menu-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.3;
}

/* The check is the non-colour signal that a row is selected, so it must
   not be the only difference a colour-blind user can see — the row also
   carries a tinted background and aria-checked. */
.theme-menu-check {
    color: var(--color-accent);
    font-size: 0.85rem;
    visibility: hidden;
}

.theme-menu-item[aria-checked="true"] .theme-menu-check {
    visibility: visible;
}

/* ---- Palette preview ---- */

/* Each swatch paints its theme's own colours from inline custom
   properties, so it previews a palette that is not currently applied. */
.theme-swatch {
    position: relative;
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background-color: var(--swatch-bg, var(--color-surface));
    overflow: hidden;
}

.theme-swatch::before,
.theme-swatch::after {
    content: "";
    position: absolute;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
}

.theme-swatch::before {
    top: 0.16rem;
    left: 0.16rem;
    background-color: var(--swatch-accent, var(--color-accent));
}

.theme-swatch::after {
    bottom: 0.16rem;
    right: 0.16rem;
    background-color: var(--swatch-accent-2, var(--color-accent-2));
}

/* "System" has no palette of its own — show both halves instead. */
.theme-swatch-system {
    background: linear-gradient(135deg, #f8f9fa 0%, #f8f9fa 50%, #0e1416 50%, #0e1416 100%);
}

.theme-swatch-system::before,
.theme-swatch-system::after {
    display: none;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
    .theme-menu {
        min-width: 12.5rem;
    }

    .theme-menu-hint {
        display: none;
    }
}
