/*
 * THEME TOGGLE
 * Sun/moon switch in the navbar (public/nav-actions). Linked directly in
 * layout.html rather than @import'd through style.css — style.css's legacy
 * duplicate block sits after its own @import aggregator in source order, so
 * an @import'd rule loses any specificity tie to it. A direct <link> placed
 * after style.css's <link> avoids that entirely.
 */

.btn-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.btn-theme-toggle:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: 999px;
}

.theme-toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
    border-radius: 999px;
    background-color: var(--gray-600);
    border: 1px solid var(--border-card);
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

body.light-theme .theme-toggle-switch {
    background-color: var(--color-primary);
}

.theme-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--white);
    box-shadow: var(--shadow-premium);
    transition: transform var(--transition-speed) ease;
}

body.dark-theme .theme-toggle-thumb {
    transform: translateX(24px);
}

.theme-toggle-icon {
    font-size: 13px;
    line-height: 1;
}

.theme-toggle-sun {
    color: var(--yellow-500);
}

.theme-toggle-moon {
    color: var(--gray-700);
}

/* Only the icon matching the active theme renders inside the thumb. */
body.light-theme .theme-toggle-thumb .theme-toggle-moon,
body.dark-theme .theme-toggle-thumb .theme-toggle-sun {
    display: none;
}
