@use '../base/variables' as *;

// ==========================================================================
// Theme Toggle
// Pill-shaped light/dark switch shared by header and footer
// ==========================================================================

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid $color-primary-lighter;
    background: transparent;
}

.theme-toggle--footer {
    border-color: color-mix(in srgb, $color-neutral 35%, transparent);
}

.theme-toggle--light {
    border-color: color-mix(in srgb, $color-primary-lighter 60%, transparent);
}

.theme-toggle__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;

    &:hover {
        transform: scale(1.08);
    }

    &:focus-visible {
        outline: 2px solid $color-primary;
        outline-offset: 2px;
    }

    &--active {
        background-color: $color-light;
    }

    @media (max-width: #{$breakpoint-md - 1px}) {
        width: 24px;
        height: 24px;
    }
}

.theme-toggle--header .theme-toggle__btn:hover {
    background-color: color-mix(in srgb, $color-primary 10%, transparent);
}

.theme-toggle--footer .theme-toggle__btn {
    &:hover {
        background-color: color-mix(in srgb, $color-neutral 15%, transparent);
    }

    &:focus-visible {
        outline-color: $color-neutral;
    }

    &.theme-toggle__btn--active {
        background-color: color-mix(in srgb, $color-neutral 20%, transparent);
    }
}

.theme-toggle--light .theme-toggle__btn {
    &:hover {
        background-color: color-mix(in srgb, $color-primary-lighter 15%, transparent);
    }

    &:focus-visible {
        outline-color: $color-primary-lighter;
    }

    &.theme-toggle__btn--active {
        background-color: color-mix(in srgb, $color-primary-lighter 20%, transparent);
    }
}

.theme-toggle__icon {
    --icon-size: 16px;

    @media (max-width: #{$breakpoint-md - 1px}) {
        --icon-size: 14px;
    }
}

.theme-toggle__icon--sun {
    background-color: $color-primary-dark;
}

.theme-toggle__icon--snow {
    background-color: $color-primary;
}

.theme-toggle--light .theme-toggle__icon {
    background-color: $color-primary-lighter;
}
