:root {
    --header-fond-switch: #18181B;
    --header-switch-boule:#FFFFFF;
}

[data-theme="light"] {
    --header-fond-switch: #FFFFFF;
    --header-switch-boule: #18181B;
}

/* ===== Theme toggle ===== */

.switch {
    position: relative;
    display: inline-block;
    width: 80px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;

    background-color: var(--header-fond-switch);
    border: 1px solid var(--accent);
    border-radius: 26px;
    box-shadow: 0 0 12px var(--ombre);
    transition:
            background-color 0.3s ease,
            border-color 0.3s ease,
            box-shadow 0.3s ease;
}

.slider::before {
    content: "";
    position: absolute;

    width: 20px;
    height: 20px;
    left: 2px;
    bottom: 2px;

    background-color: var(--header-switch-boule);
    border-radius: 50%;

    transition:
            transform 0.3s ease,
            background-color 0.3s ease;
}

.switch input:checked + .slider {
    background-color: var(--header-fond-switch);
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--ombre);
}

.switch input:checked + .slider::before {
    transform: translateX(55px);
    background-color: var(--texte);
}

.switch input:focus-visible + .slider {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.switch-text {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    line-height: 1;
    pointer-events: none;
    z-index: 2;
}

.switch-text--gauche {
    left: 4px;
    opacity: 0;
}

.switch-text--droite {
    right: 4px;
    opacity: 1;
}

.switch input:checked ~ .switch-text--gauche {
    opacity: 1;
}

.switch input:checked ~ .switch-text--droite {
    opacity: 0;
}