/* GeoAssist Pro — interruptor deslizante de modo claro / oscuro. */
.ga-theme-switch {
    --ga-switch-width: 56px;
    --ga-switch-height: 28px;
    --ga-switch-gap: 3px;
    --ga-switch-knob: calc(var(--ga-switch-height) - var(--ga-switch-gap) * 2);
    --ga-switch-ease: cubic-bezier(0.34, 1.45, 0.64, 1);
    position: relative;
    display: inline-block;
    flex: none;
    width: var(--ga-switch-width);
    height: var(--ga-switch-height);
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: linear-gradient(180deg, #dfe7f0 0%, #f3f6fa 100%);
    border: 0;
    border-radius: 999px;
    box-shadow:
        inset 0 1px 3px rgba(15, 32, 52, 0.3),
        inset 0 -1px 0 rgba(255, 255, 255, 0.7);
    cursor: pointer;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    transition:
        background 360ms ease,
        box-shadow 360ms ease;
}

.ga-theme-switch__icon {
    position: absolute;
    top: 50%;
    font-size: 13px;
    line-height: 1;
    transition:
        opacity 260ms ease,
        transform 420ms var(--ga-switch-ease);
}

.ga-theme-switch__icon--sun {
    left: 8px;
    color: #f59e0b;
    transform: translateY(-50%);
}

.ga-theme-switch__icon--moon {
    right: 8px;
    color: #fbbf24;
    opacity: 0;
    transform: translateY(-50%) rotate(-50deg) scale(0.6);
}

.ga-theme-switch__knob {
    position: absolute;
    top: var(--ga-switch-gap);
    left: var(--ga-switch-gap);
    width: var(--ga-switch-knob);
    height: var(--ga-switch-knob);
    background: radial-gradient(circle at 35% 30%, #ffffff 0%, #eef2f7 70%, #e1e7ef 100%);
    border-radius: 50%;
    box-shadow:
        0 2px 6px rgba(15, 32, 52, 0.3),
        inset 0 -1px 1px rgba(15, 32, 52, 0.08);
    transform: translateX(calc(var(--ga-switch-width) - var(--ga-switch-knob) - var(--ga-switch-gap) * 2));
    transition: transform 420ms var(--ga-switch-ease);
}

.ga-theme-switch[aria-checked="true"] {
    background: linear-gradient(180deg, #070f1b 0%, #13233a 100%);
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(255, 255, 255, 0.08);
}

.ga-theme-switch[aria-checked="true"] .ga-theme-switch__knob {
    transform: translateX(0);
}

.ga-theme-switch[aria-checked="true"] .ga-theme-switch__icon--sun {
    opacity: 0;
    transform: translateY(-50%) rotate(70deg) scale(0.6);
}

.ga-theme-switch[aria-checked="true"] .ga-theme-switch__icon--moon {
    opacity: 1;
    transform: translateY(-50%) rotate(0) scale(1);
}

.ga-theme-switch:active .ga-theme-switch__knob {
    width: calc(var(--ga-switch-knob) + 4px);
}

.ga-theme-switch[aria-checked="false"]:active .ga-theme-switch__knob {
    transform: translateX(calc(var(--ga-switch-width) - var(--ga-switch-knob) - 4px - var(--ga-switch-gap) * 2));
}

/* Área táctil de 44 px con puntero grueso sin cambiar el tamaño visual (56×28): una capa transparente
 * amplía la zona de toque; por eso el recorte del contenedor se quita (nada del interior lo supera). */
@media (pointer: coarse) {
    .ga-theme-switch {
        overflow: visible;
    }

    .ga-theme-switch::before {
        content: "";
        position: absolute;
        inset: -8px 0;
    }
}

.ga-theme-switch:focus-visible {
    outline: 2px solid var(--ga-accent-cyan, #22d3ee);
    outline-offset: 2px;
}

/* Cambio de tema con View Transitions: geoassist-theme.js anima el recorte de la vista nueva;
 * aquí se quita el fundido que el navegador aplica por defecto entre la foto vieja y la nueva. */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

@media (prefers-reduced-motion: reduce) {
    .ga-theme-switch,
    .ga-theme-switch__icon,
    .ga-theme-switch__knob {
        transition: none !important;
    }
}
