/* ============================================================================
   Login («Hola de nuevo»): fondo premium. Solo presentación y solo en login.php
   (body.kf-login-fx). Todo usa el color de acento de la web (--kf-accent / --kf-accent-hover,
   que siguen al plan) y animaciones de transform/opacity. Sin librerías.
   Capas, de atrás hacia delante: aurora · íconos flotantes · partículas · viñeta · contenido.
   ========================================================================== */

/* El tapiz de íconos ahora son 3 capas que flotan por separado: se quita del fondo del body */
body.kf-login-page.kf-login-fx {
    background:
        radial-gradient(ellipse 900px 520px at 50% -120px, color-mix(in srgb, var(--kf-accent) 10%, transparent), transparent 70%) no-repeat,
        #0b0b0c;
}

.kf-login-fx .fx {
    contain: strict;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    position: fixed;
    z-index: 0;
}
.kf-login-fx .auth { position: relative; z-index: 1; }

/* Contenedores con parallax (el movimiento propio de cada capa va en sus hijos) */
.kf-login-fx .fx-par {
    inset: 0;
    position: absolute;
    transform: translate3d(calc(var(--px, 0) * var(--k, 1) * 8px), calc(var(--py, 0) * var(--k, 1) * 8px), 0);
    transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* 1) Aurora: manchas muy difusas (degradado radial, más barato que filter: blur en móvil) */
.kf-login-fx .fx-aurora { opacity: 0.8; transition: opacity 0.3s ease; }
.kf-login-fx.fx-focus .fx-aurora { opacity: 1; }
.kf-login-fx .fx-blob {
    border-radius: 50%;
    position: absolute;
    will-change: transform, opacity;
}
.kf-login-fx .fx-blob--a {
    animation: fx-drift-a 26s ease-in-out infinite;
    background: radial-gradient(circle at center, var(--kf-accent) 0%, transparent 68%);
    height: 80vmax; left: -28vmax; opacity: 0.22; top: -34vmax; width: 80vmax;
}
.kf-login-fx .fx-blob--b {
    animation: fx-drift-b 30s ease-in-out infinite;
    background: radial-gradient(circle at center, var(--kf-accent-hover) 0%, transparent 68%);
    bottom: -34vmax; height: 84vmax; opacity: 0.18; right: -30vmax; width: 84vmax;
}
.kf-login-fx .fx-blob--c {
    animation: fx-drift-c 22s ease-in-out infinite;
    background: radial-gradient(circle at center, var(--kf-accent) 0%, transparent 66%);
    height: 46vmax; left: calc(50% - 23vmax); opacity: 0.12; top: calc(50% - 23vmax); width: 46vmax;
}
@keyframes fx-drift-a { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.22; } 50% { transform: translate3d(6vmax, 5vmax, 0) scale(1.12); opacity: 0.14; } }
@keyframes fx-drift-b { 0%, 100% { transform: translate3d(0, 0, 0) scale(1.05); opacity: 0.18; } 50% { transform: translate3d(-7vmax, -4vmax, 0) scale(0.92); opacity: 0.25; } }
@keyframes fx-drift-c { 0%, 100% { transform: translate3d(0, 0, 0) scale(0.95); opacity: 0.1; } 50% { transform: translate3d(-4vmax, 5vmax, 0) scale(1.15); opacity: 0.2; } }

/* 4) Íconos del fondo: las mismas figuras de antes, repartidas en 3 capas que flotan con ciclos distintos */
.kf-login-fx .fx-icons { --k: 0.6; }
.kf-login-fx .fx-ic {
    background-repeat: repeat;
    background-size: 540px;
    inset: -24px;
    position: absolute;
    will-change: transform;
}
.kf-login-fx .fx-ic--a { animation: fx-float-a 9s ease-in-out infinite; background-image: url('../img/fondo-fitness-a.svg'); }
.kf-login-fx .fx-ic--b { animation: fx-float-b 12s ease-in-out infinite; background-image: url('../img/fondo-fitness-b.svg'); }
.kf-login-fx .fx-ic--c { animation: fx-float-c 14s ease-in-out infinite; background-image: url('../img/fondo-fitness-c.svg'); }
@keyframes fx-float-a { 0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); } 50% { transform: translate3d(0, -7px, 0) rotate(0.5deg); } }
@keyframes fx-float-b { 0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); } 50% { transform: translate3d(0, 9px, 0) rotate(-0.5deg); } }
@keyframes fx-float-c { 0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); } 50% { transform: translate3d(0, -10px, 0) rotate(0.4deg); } }

/* Partículas de luz que suben muy despacio y se desvanecen */
.kf-login-fx .fx-particles { --k: 0.4; }
.kf-login-fx .fx-particles i {
    animation: fx-rise var(--d, 24s) linear var(--delay, 0s) infinite;
    background: var(--kf-accent);
    border-radius: 50%;
    bottom: -12px;
    box-shadow: 0 0 8px var(--kf-accent);
    height: var(--s, 3px);
    left: var(--x, 50%);
    opacity: 0;
    position: absolute;
    width: var(--s, 3px);
    will-change: transform, opacity;
}
@keyframes fx-rise {
    0% { opacity: 0; transform: translate3d(0, 0, 0); }
    12% { opacity: 0.34; }
    80% { opacity: 0.2; }
    100% { opacity: 0; transform: translate3d(var(--dx, 12px), -112vh, 0); }
}

/* Viñeta: los bordes se oscurecen para centrar la atención */
.kf-login-fx .fx-vignette {
    background: radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.6) 100%);
    inset: 0;
    position: absolute;
}

/* 2) Halo y sombra de la mascota */
.kf-login-fx .auth-head { position: relative; }
.kf-login-fx .login-mascot { position: relative; z-index: 1; }
.kf-login-fx .fx-halo {
    animation: fx-breathe 5s ease-in-out infinite;
    background: radial-gradient(circle at center, color-mix(in srgb, var(--kf-accent) 55%, transparent) 0%, color-mix(in srgb, var(--kf-accent) 18%, transparent) 42%, transparent 70%);
    border-radius: 50%;
    height: 240px;
    left: 50%;
    margin: -120px 0 0 -120px;
    pointer-events: none;
    position: absolute;
    top: 52px;
    width: 240px;
    will-change: transform, opacity;
}
@keyframes fx-breathe { 0%, 100% { opacity: 0.55; transform: scale(0.92); } 50% { opacity: 0.95; transform: scale(1.07); } }
.kf-login-fx .fx-shadow {
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.55) 0%, transparent 70%);
    height: 16px;
    left: 50%;
    margin-left: -50px;
    pointer-events: none;
    position: absolute;
    top: 100px;
    width: 100px;
}

/* 3) Tarjeta de cristal: se dibuja detrás, sin cambiar el ancho ni los espacios del contenido */
.kf-login-fx .fx-glass { position: relative; z-index: 0; }
.kf-login-fx .fx-glass::before {
    background: color-mix(in srgb, var(--kf-surface) 58%, transparent);
    border: 1px solid var(--kf-border-strong);
    border-radius: 24px;
    box-shadow: 0 30px 80px -28px rgba(0, 0, 0, 0.85), 0 0 70px -34px color-mix(in srgb, var(--kf-accent) 45%, transparent);
    content: "";
    inset: -22px -16px -26px;
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
    pointer-events: none;
    position: absolute;
    z-index: -1;
}
/* Borde fino de 1 px con degradado luminoso del color de acento */
.kf-login-fx .fx-glass::after {
    background: linear-gradient(135deg, color-mix(in srgb, var(--kf-accent) 75%, transparent), transparent 38%, transparent 62%, color-mix(in srgb, var(--kf-accent-hover) 55%, transparent));
    border-radius: 24px;
    content: "";
    inset: -22px -16px -26px;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    padding: 1px;
    pointer-events: none;
    position: absolute;
    z-index: -1;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .kf-login-fx .fx-glass::before { background: var(--kf-surface); }
}

/* 5) Foco de los campos: el borde se ilumina con el acento (300 ms) */
.kf-login-fx .input { transition: border-color 0.3s var(--kf-ease), box-shadow 0.3s var(--kf-ease), background-color 0.3s var(--kf-ease); }
.kf-login-fx .input:focus {
    border-color: var(--kf-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--kf-accent) 22%, transparent), 0 0 22px -6px color-mix(in srgb, var(--kf-accent) 70%, transparent);
}

/* Móvil: la tarjeta de cristal ocupa el 92 % del ancho (4 % libre a cada lado), no casi toda la pantalla.
   Su borde se dibuja 16 px por fuera del contenido, así que el contenido lleva 4vw + 16 px de margen lateral. */
@media (max-width: 600px) {
    .kf-login-fx .auth-main { padding-left: calc(4vw + 16px); padding-right: calc(4vw + 16px); }
}

/* Móvil: menos partículas (12) para cuidar la batería */
@media (max-width: 700px) {
    .kf-login-fx .fx-particles i:nth-child(n+13) { display: none; }
}

/* «Reducir movimiento»: todo queda quieto; la aurora y el halo siguen visibles, sin partículas */
@media (prefers-reduced-motion: reduce) {
    .kf-login-fx .fx *,
    .kf-login-fx .fx-halo { animation: none !important; }
    .kf-login-fx .fx-par { transform: none !important; transition: none; }
    .kf-login-fx .fx-particles { display: none; }
    .kf-login-fx .fx-halo { opacity: 0.8; }
    .kf-login-fx .input, .kf-login-fx .fx-aurora { transition: none; }
}
