/* Auth stage backdrop — frames the login card */

.auth-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    width: min(96vw, 44rem);
    height: min(88vh, 40rem);
    transform: translate(-50%, -50%);
    pointer-events: none;
    overflow: visible;
}

.auth-bg__halo {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at 50% 48%,
        rgba(194, 173, 130, 0.16) 0%,
        rgba(194, 173, 130, 0.06) 38%,
        transparent 68%
    );
}

.auth-bg__grid {
    position: absolute;
    inset: -8%;
    opacity: 0.7;
    mask-image: radial-gradient(ellipse 80% 75% at 50% 50%, #000 12%, transparent 76%);
}

.auth-bg__frame {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-bg__frame::before,
.auth-bg__frame::after {
    content: '';
    position: absolute;
    top: 10%;
    bottom: 10%;
    width: 1px;
    background: linear-gradient(
        180deg,
        transparent,
        rgba(233, 227, 214, 0.14) 20%,
        rgba(233, 227, 214, 0.14) 80%,
        transparent
    );
}

.auth-bg__frame::before {
    left: 22%;
}

.auth-bg__frame::after {
    right: 22%;
}

.auth-bg__rail {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
}

.auth-bg__track {
    position: relative;
    width: 2px;
    height: 84%;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(194, 173, 130, 0.5) 18%,
        rgba(194, 173, 130, 0.5) 82%,
        transparent
    );
    box-shadow: 0 0 20px rgba(194, 173, 130, 0.15);
}

.auth-bg__bead {
    position: absolute;
    top: 42%;
    left: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--fe-brass, #C2AD82);
    box-shadow:
        0 0 14px rgba(194, 173, 130, 0.75),
        0 0 28px rgba(194, 173, 130, 0.3);
    animation: auth-bead-drift 5.5s ease-in-out infinite;
}

@keyframes auth-bead-drift {
    0%, 100% { top: 34%; opacity: 0.85; }
    50% { top: 58%; opacity: 1; }
}

.auth-bg__svg {
    width: 58%;
    height: auto;
    aspect-ratio: 1;
    opacity: 0.62;
    filter: drop-shadow(0 0 2px rgba(194, 173, 130, 0.35));
}

.auth-bg .trace-path {
    stroke-dasharray: 900;
    stroke-dashoffset: 900;
    animation: auth-trace-draw 2.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-bg .trace-path:nth-child(1) { animation-delay: 0.08s; }
.auth-bg .trace-path:nth-child(2) { animation-delay: 0.18s; }
.auth-bg .trace-path:nth-child(3) { animation-delay: 0.28s; }
.auth-bg .trace-path:nth-child(4) { animation-delay: 0.36s; }
.auth-bg .trace-path:nth-child(5) { animation-delay: 0.44s; }
.auth-bg .trace-path:nth-child(6) { animation-delay: 0.52s; }
.auth-bg .trace-path:nth-child(7) { animation-delay: 0.6s; }
.auth-bg .trace-path:nth-child(8) { animation-delay: 0.68s; }

.auth-bg .auth-bg__pulse {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
    animation:
        auth-trace-draw 2.2s cubic-bezier(0.16, 1, 0.3, 1) 0.75s forwards,
        auth-node-pulse 3.5s ease-in-out 2.4s infinite;
    opacity: 0;
}

@keyframes auth-trace-draw {
    to { stroke-dashoffset: 0; }
}

@keyframes auth-node-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

@media (max-width: 768px) {
    .auth-bg {
        width: min(100vw, 28rem);
        height: min(72vh, 28rem);
    }

    .auth-bg__svg {
        width: 68%;
        opacity: 0.48;
    }

    .auth-bg__frame::before,
    .auth-bg__frame::after {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-bg .trace-path,
    .auth-bg__bead,
    .auth-bg .auth-bg__pulse {
        animation: none;
        stroke-dashoffset: 0;
        opacity: 0.85;
    }
}
