/* ===== ThemePicker Component ===== */
/*
 * Two-channel palette picker — renders a grid of swatches, each a single disc
 * with a diagonal split: background on one side, accent on the other.
 *
 * No external margin / gap (Bingo-Template §1792). Internal grid + flex are
 * allowed per §8.7 (positioning swatches inside the component's own box).
 *
 * Each swatch is a button with role="radio"; the parent has role="radiogroup".
 * Styles are driven by per-swatch inline CSS variables so the picker stays
 * theme-agnostic. The wrapper is fully open for consumer style overrides.
 */

.ui-themepicker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 12px;
    box-sizing: border-box;
}

.ui-themepicker-swatch {
    /* Reset native button styling */
    appearance: none;
    border: none;
    background: transparent;
    padding: 4px;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    border-radius: 12px;

    /* Stack the disc + label */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.ui-themepicker-swatch:focus-visible {
    outline: 2px solid var(--meb-state-focus-ring, var(--meb-accent-info, #2879E9));
    outline-offset: 2px;
}

/* The disc — single circle painted with a 45° diagonal gradient. No stacked
   halves, no negative margins, no clip-path seam. The hard color stop at 50%
   gives a crisp diagonal line; transitions remain smooth between palettes. */
.ui-themepicker-swatch-disc {
    position: relative;
    display: block;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--meb-border-default, rgba(0, 0, 0, 0.12));
    box-sizing: border-box;
    background: linear-gradient(
        135deg,
        var(--swatch-bg) 0 50%,
        var(--swatch-accent) 50% 100%
    );
    transition: transform 150ms ease-out, border-color 150ms ease-out;
}

.ui-themepicker-swatch--selected .ui-themepicker-swatch-disc {
    transform: scale(1.08);
    border-color: var(--meb-state-focus-ring, var(--meb-accent-info, #2879E9));
}

.ui-themepicker-swatch-check {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--swatch-on-accent, #FFFFFF);
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.ui-themepicker-swatch-label {
    font-size: var(--meb-font-size-caption, 12px);
    color: var(--meb-text-default, #1E1E1E);
    text-align: center;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .ui-themepicker-swatch-disc {
        transition: none;
    }
}
