/* ============================================================
   Theme chooser widget (floating palette)
   Styles for the chooser itself only — the website design is
   untouched; every colour here comes from the active palette.
   ============================================================ */

.theme-switcher {
    position: fixed;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1035;
    font-family: 'cerebri-sans-regular', -apple-system, 'Segoe UI', sans-serif;
}

/* ---------- toggle button ---------- */
.theme-switcher__toggle {
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: var(--base-color);
    color: #ffffff;
    font-size: 21px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .20);
    transition: transform .25s ease, background-color .25s ease, color .25s ease;
}

.theme-switcher__toggle:hover {
    transform: translateY(-2px) scale(1.05);
}

.theme-switcher__toggle:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 3px;
}

.theme-switcher.is-open .theme-switcher__toggle {
    background-color: var(--yellow);
    color: var(--dark-gray);
}

/* ---------- panel ---------- */
.theme-switcher__panel {
    position: absolute;
    right: 64px;
    top: 50%;
    transform: translateY(-50%);
    width: 322px;
    max-height: min(80vh, 600px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background-color: #ffffff;
    border: 1px solid var(--very-light-gray);
    border-radius: 10px;
    box-shadow: 0 26px 60px rgba(0, 0, 0, .22);
    padding: 18px 18px 14px;
    text-align: left;
}

.theme-switcher__panel[hidden] {
    display: none !important;
}

.theme-switcher__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.theme-switcher__title {
    font-size: 17px;
    line-height: 22px;
    font-weight: 600;
    color: var(--dark-gray);
}

.theme-switcher__close {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: var(--very-light-gray);
    color: var(--dark-gray);
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}

.theme-switcher__close:hover {
    background-color: var(--base-color);
    color: #ffffff;
}

.theme-switcher__close:focus-visible {
    outline: 2px solid var(--base-color);
    outline-offset: 2px;
}

.theme-switcher__hint {
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 17px;
    color: var(--medium-gray);
}

/* ---------- palette list ---------- */
.theme-switcher__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

/* divider between the signature palettes and the ColorHunt set */
.theme-switcher__group {
    margin-top: 8px;
    padding: 9px 2px 3px;
    border-top: 1px solid var(--very-light-gray);
    font-size: 11px;
    line-height: 14px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--medium-gray);
}

.theme-swatch {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border: 1px solid var(--very-light-gray);
    border-radius: 7px;
    background-color: #ffffff;
    color: var(--dark-gray);
    font-size: 13px;
    line-height: 18px;
    text-align: left;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.theme-swatch:hover {
    border-color: var(--base-color);
    background-color: var(--solitude-blue);
}

.theme-swatch:focus-visible {
    outline: 2px solid var(--base-color);
    outline-offset: 1px;
}

.theme-swatch.is-active {
    border-color: var(--base-color);
    background-color: var(--solitude-blue);
    box-shadow: inset 0 0 0 1px var(--base-color);
    font-weight: 600;
}

.theme-swatch__chips {
    flex: 0 0 auto;
    display: inline-flex;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}

.theme-swatch__chips span {
    display: block;
    width: 17px;
    height: 22px;
}

.theme-swatch__name {
    flex: 1 1 auto;
    min-width: 0;
}

.theme-swatch.is-active .theme-swatch__name::after {
    content: "\2713";
    float: right;
    color: var(--base-color);
    font-weight: 700;
}

/* ---------- footer of the panel ---------- */
.theme-switcher__foot {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--very-light-gray);
    text-align: right;
}

.theme-switcher__reset {
    padding: 0;
    border: 0;
    background: none;
    color: var(--base-color);
    font-size: 12px;
    line-height: 18px;
    text-decoration: underline;
    cursor: pointer;
}

.theme-switcher__reset:hover {
    color: var(--dark-gray);
}

.theme-switcher__reset:focus-visible {
    outline: 2px solid var(--base-color);
    outline-offset: 2px;
}

/* ---------- small screens ---------- */
@media (max-width: 575px) {
    .theme-switcher {
        right: 12px;
    }

    .theme-switcher__toggle {
        width: 46px;
        height: 46px;
        font-size: 18px;
    }

    .theme-switcher__panel {
        right: 56px;
        width: min(300px, calc(100vw - 76px));
        max-height: 72vh;
        padding: 14px;
    }
}

/* ---------- motion / print ---------- */
@media (prefers-reduced-motion: reduce) {
    .theme-switcher__toggle,
    .theme-swatch,
    .theme-switcher__close {
        transition: none;
    }

    .theme-switcher__toggle:hover {
        transform: none;
    }
}

@media print {
    .theme-switcher {
        display: none !important;
    }
}
