/*
 * loader_gyro.css — Spinner global "Anillos giroscópicos"
 *
 * Es el spinner que pinta blockInterface() (js/jQueryInit.js) en TODO el
 * sistema: navegación entre páginas, switchers, botones .bloqueo, AJAX.
 * Tres aros que giran a velocidades distintas y se comprimen en un eje
 * (simula un cardán 3D), un estator punteado fijo, un núcleo y nodos
 * que orbitan.
 *
 * COLOR: solo tokens del tema (admin_theme.css). Los dos tonos salen de
 * --omni-accent y de su mezcla con --omni-text-primary, que reproduce el
 * par de --omni-gradient en los dos temas (claro: índigo → índigo
 * profundo; oscuro: índigo aclarado → lavanda). Por eso este archivo NO
 * necesita nada en dark_mode.css.
 *
 * DISCO: esmerilado en claro (se ve el contenido difuminado detrás, y el
 * desenfoque le quita el ruido al fondo para que los aros se lean); SÓLIDO
 * en oscuro, donde --omni-bg-raised casi empata con el fondo de la página
 * y el esmerilado no se distingue — ahí el blur sería costo de GPU a cambio
 * de nada. El remapeo va sobre `body.dark-mode .omni-gyro` y NO sobre
 * `body.dark-mode` a secas: las variables se resuelven en el ancestro más
 * cercano, así que declararlas en el contenedor TAPA cualquier valor puesto
 * más arriba.
 *
 * Clases:
 *   .omni-gyro            contenedor (disco de 7rem, role="status")
 *   .omni-gyro-svg        el SVG, con el resplandor pulsante
 *   .omni-gyro-stator     aro fijo punteado
 *   .omni-gyro-ring-1..3  los tres aros giroscópicos
 *   .omni-gyro-core       aro interior fijo
 *   .omni-gyro-nodes      capa de nodos orbitando
 *   .omni-gyro-pivot      punto central pulsante
 *   .omni-gyro-stop-a|b   stops de los degradados (el color lo pone el CSS)
 *
 * Ejemplo: ver blockInterface() en js/jQueryInit.js.
 */

.omni-gyro {
    --gyro-size: 7rem;
    --gyro-tone-a: var(--omni-accent);
    --gyro-tone-b: color-mix(in srgb, var(--omni-accent) 60%, var(--omni-text-primary));
    --gyro-glow: color-mix(in srgb, var(--omni-accent) 45%, transparent);
    --gyro-disc: color-mix(in srgb, var(--omni-bg-raised) 55%, transparent);
    --gyro-blur: blur(10px) saturate(1.2);

    width: var(--gyro-size);
    height: var(--gyro-size);
    margin: 0 auto;
    padding: 0.5rem;
    border-radius: 50%;
    background: var(--gyro-disc);
    -webkit-backdrop-filter: var(--gyro-blur);
    backdrop-filter: var(--gyro-blur);
    border: 1px solid var(--omni-border);
    box-shadow: var(--omni-shadow-glow), inset 0 0 18px var(--omni-accent-soft);
}

body.dark-mode .omni-gyro {
    --gyro-disc: var(--omni-bg-raised);
    --gyro-blur: none;
}

.omni-gyro-svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    animation: omni-gyro-glow 3s ease-in-out infinite;
}

.omni-gyro-stop-a { stop-color: var(--gyro-tone-a); }
.omni-gyro-stop-b { stop-color: var(--gyro-tone-b); }

.omni-gyro-stator {
    stroke: var(--omni-text-muted);
    stroke-opacity: 0.45;
}

.omni-gyro-core { stroke: var(--gyro-tone-a); }

.omni-gyro-ring-3 ellipse { stroke: var(--gyro-tone-b); }

.omni-gyro-node-a { fill: var(--gyro-tone-a); }
.omni-gyro-node-b { fill: var(--gyro-tone-b); }

.omni-gyro-pivot {
    fill: var(--gyro-tone-a);
    animation: omni-gyro-pulse 2s ease-in-out infinite;
}

/* transform-origin 'center' en SVG = centro del viewBox (60,60). */
.omni-gyro-ring-1,
.omni-gyro-ring-2,
.omni-gyro-ring-3,
.omni-gyro-nodes {
    transform-origin: center;
}

.omni-gyro-ring-1 { animation: omni-gyro-ring-1 4s linear infinite; }
.omni-gyro-ring-2 { animation: omni-gyro-ring-2 6s linear infinite reverse; }
.omni-gyro-ring-3 { animation: omni-gyro-ring-3 8s linear infinite; }
.omni-gyro-nodes  { animation: omni-gyro-spin 5s linear infinite; }

@keyframes omni-gyro-ring-1 {
    0%   { transform: rotate(0deg)   scale(1, 0.42); }
    50%  { transform: rotate(180deg) scale(1, 0.95); }
    100% { transform: rotate(360deg) scale(1, 0.42); }
}

@keyframes omni-gyro-ring-2 {
    0%   { transform: rotate(60deg)  scale(0.48, 1); }
    50%  { transform: rotate(240deg) scale(0.92, 1); }
    100% { transform: rotate(420deg) scale(0.48, 1); }
}

@keyframes omni-gyro-ring-3 {
    0%   { transform: rotate(-45deg) scale(1, 0.55); }
    50%  { transform: rotate(135deg) scale(0.65, 1); }
    100% { transform: rotate(315deg) scale(1, 0.55); }
}

@keyframes omni-gyro-spin {
    to { transform: rotate(360deg); }
}

@keyframes omni-gyro-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

@keyframes omni-gyro-glow {
    0%, 100% { filter: drop-shadow(0 0 2px var(--gyro-glow)); }
    50%      { filter: drop-shadow(0 0 7px var(--gyro-glow)); }
}

/* Un loader SÍ tiene que moverse (es la señal de que algo está pasando), así
   que no se congela: se quita la deformación, el pulso y el resplandor, y
   queda solo una rotación lenta. */
@media (prefers-reduced-motion: reduce) {
    .omni-gyro-svg,
    .omni-gyro-pivot {
        animation: none;
    }
    .omni-gyro-ring-1,
    .omni-gyro-ring-2,
    .omni-gyro-ring-3 {
        animation: omni-gyro-spin 12s linear infinite;
    }
    .omni-gyro-nodes {
        animation: none;
    }
}
