/*
 * ClearURLs
 * Copyright (c) 2017-2020 Kevin Röbert
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * Stylesheet for the switch buttons.
 */
.switch {
    --height: 24px;
    --width: 50px;
    --pill-inset: 4px;
    cursor: pointer;
 }

.switch input {
    display: none;
}

.slider {
    position: relative;
    height: var(--height);
    width: var(--width);
    margin-inline-end: 8px;
    background-color: oklch(from var(--foreground) l c h / 25%);

    transition: background-color .4s;
}
.slider::after {
    position: absolute;
    content: "";
    height: calc(var(--height) - 2 * var(--pill-inset));
    width: calc(var(--height) - 2 * var(--pill-inset));
    left: var(--pill-inset);
    top: var(--pill-inset);
    background-color: var(--light);

    transition: transform .4s;
}

body.loading .slider,
body.loading .slider::after {
    transition: none;
}

/* Toggled-on state */
.switch input:checked + .slider {
    background-color: var(--red);
}
.switch input:checked + .slider::after {
    transform: translateX(calc(var(--width) - var(--height)));
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--red);
}

/* Rounded sliders */
.slider.round {
    border-radius: calc(var(--height) / 2);
}

.slider.round::after {
    border-radius: 50%;
}
