/* ==================== MAIN CONTAINER ==================== */
.mecha-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #0f172a;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(14, 165, 233, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
        radial-gradient(#1e293b 1.5px, transparent 1.5px),
        radial-gradient(#1e293b 1.5px, transparent 1.5px);
    background-size:
        800px 800px,
        600px 600px,
        50px 50px,
        50px 50px;
    background-position:
        0 0,
        100% 100%,
        0 0,
        25px 25px;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

/* ==================== ANIMATED PERSPECTIVE GRID ==================== */
.grid-overlay {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(rgba(56, 189, 248, 0.08) 2px, transparent 2px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.08) 2px, transparent 2px),
        linear-gradient(rgba(14, 165, 233, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 165, 233, 0.03) 1px, transparent 1px);
    background-size:
        100px 100px,
        100px 100px,
        20px 20px,
        20px 20px;
    transform: perspective(800px) rotateX(60deg);
    animation: moveGrid 30s linear infinite;
    filter: blur(0.5px);
}

/* ==================== ENHANCED SCAN LINE ==================== */
.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
            transparent 0%,
            rgba(56, 189, 248, 0.03) 45%,
            rgba(56, 189, 248, 0.15) 50%,
            rgba(56, 189, 248, 0.03) 55%,
            transparent 100%);
    animation: scan 12s ease-in-out infinite;
    pointer-events: none;
}

/* ==================== CIRCUIT BOARD OVERLAY ==================== */
.circuit-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0.4;
    background-image:
        linear-gradient(90deg, transparent 48%, rgba(56, 189, 248, 0.1) 49%, rgba(56, 189, 248, 0.1) 51%, transparent 52%),
        linear-gradient(0deg, transparent 48%, rgba(56, 189, 248, 0.1) 49%, rgba(56, 189, 248, 0.1) 51%, transparent 52%);
    background-size: 200px 200px, 200px 200px;
    animation: circuitFlow 40s linear infinite;
}

/* ==================== HEXAGONAL GRID PATTERN ==================== */
.hex-grid {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0.15;
    background-image:
        repeating-linear-gradient(30deg,
            transparent,
            transparent 40px,
            rgba(56, 189, 248, 0.2) 40px,
            rgba(56, 189, 248, 0.2) 41px),
        repeating-linear-gradient(-30deg,
            transparent,
            transparent 40px,
            rgba(56, 189, 248, 0.2) 40px,
            rgba(56, 189, 248, 0.2) 41px),
        repeating-linear-gradient(90deg,
            transparent,
            transparent 40px,
            rgba(56, 189, 248, 0.2) 40px,
            rgba(56, 189, 248, 0.2) 41px);
    animation: hexShift 25s ease-in-out infinite;
}

/* ==================== DATA STREAM PARTICLES ==================== */
.data-stream {
    position: absolute;
    width: 2px;
    height: 100px;
    background: linear-gradient(to bottom, transparent, rgba(56, 189, 248, 0.8), transparent);
    top: -100px;
    animation: dataFlow 8s linear infinite;
    opacity: 0.6;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.data-stream:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
}

.data-stream:nth-child(2) {
    left: 25%;
    animation-delay: 2s;
    height: 80px;
}

.data-stream:nth-child(3) {
    left: 45%;
    animation-delay: 4s;
    height: 120px;
}

.data-stream:nth-child(4) {
    left: 65%;
    animation-delay: 1s;
    height: 90px;
}

.data-stream:nth-child(5) {
    left: 80%;
    animation-delay: 3s;
    height: 110px;
}

.data-stream:nth-child(6) {
    left: 33%;
    animation-delay: 5s;
    height: 95px;
}

.data-stream:nth-child(7) {
    left: 55%;
    animation-delay: 6s;
    height: 85px;
}

.data-stream:nth-child(8) {
    left: 90%;
    animation-delay: 7s;
    height: 105px;
}

.data-stream:nth-child(9) {
    left: 18%;
    animation-delay: 1.5s;
    height: 92px;
}

.data-stream:nth-child(10) {
    left: 72%;
    animation-delay: 4.5s;
    height: 98px;
}

/* ==================== GLOWING NODES ==================== */
.node-container {
    position: absolute;
    width: 100%;
    height: 100%;
}

.node {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(56, 189, 248, 0.9);
    border-radius: 50%;
    box-shadow:
        0 0 10px rgba(56, 189, 248, 0.8),
        0 0 20px rgba(56, 189, 248, 0.5),
        0 0 30px rgba(56, 189, 248, 0.3);
    animation: nodePulse 3s ease-in-out infinite;
}

.node::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: nodeRing 3s ease-in-out infinite;
}

.node:nth-child(1) {
    top: 20%;
    left: 15%;
    animation-delay: 0s;
}

.node:nth-child(2) {
    top: 35%;
    left: 40%;
    animation-delay: 0.5s;
}

.node:nth-child(3) {
    top: 60%;
    left: 25%;
    animation-delay: 1s;
}

.node:nth-child(4) {
    top: 45%;
    left: 70%;
    animation-delay: 1.5s;
}

.node:nth-child(5) {
    top: 75%;
    left: 60%;
    animation-delay: 2s;
}

.node:nth-child(6) {
    top: 25%;
    left: 85%;
    animation-delay: 2.5s;
}

.node:nth-child(7) {
    top: 80%;
    left: 35%;
    animation-delay: 1.2s;
}

.node:nth-child(8) {
    top: 50%;
    left: 50%;
    animation-delay: 0.8s;
}

.node:nth-child(9) {
    top: 15%;
    left: 55%;
    animation-delay: 1.8s;
}

.node:nth-child(10) {
    top: 65%;
    left: 80%;
    animation-delay: 0.3s;
}

.node:nth-child(11) {
    top: 40%;
    left: 10%;
    animation-delay: 2.2s;
}

.node:nth-child(12) {
    top: 85%;
    left: 90%;
    animation-delay: 1.4s;
}

/* ==================== FLOATING TECH ELEMENTS ==================== */
.tech-element {
    position: absolute;
    border: 1px solid rgba(56, 189, 248, 0.2);
    animation: float 20s ease-in-out infinite;
    opacity: 0.3;
}

.tech-element.square {
    width: 60px;
    height: 60px;
}

.tech-element.circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.tech-element.hex {
    width: 70px;
    height: 70px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.tech-element:nth-child(1) {
    top: 15%;
    left: 10%;
    animation-delay: 0s;
}

.tech-element:nth-child(2) {
    top: 40%;
    left: 80%;
    animation-delay: 3s;
}

.tech-element:nth-child(3) {
    top: 70%;
    left: 20%;
    animation-delay: 6s;
}

.tech-element:nth-child(4) {
    top: 25%;
    left: 60%;
    animation-delay: 9s;
}

.tech-element:nth-child(5) {
    top: 85%;
    left: 75%;
    animation-delay: 12s;
}

.tech-element:nth-child(6) {
    top: 55%;
    left: 35%;
    animation-delay: 15s;
}

.tech-element:nth-child(7) {
    top: 10%;
    left: 90%;
    animation-delay: 4s;
}

.tech-element:nth-child(8) {
    top: 75%;
    left: 50%;
    animation-delay: 8s;
}

/* ==================== CORNER BRACKETS (HUD Style) ==================== */
.hud-corner {
    position: absolute;
    width: 100px;
    height: 100px;
    opacity: 0.3;
}

.hud-corner.top-left {
    top: 20px;
    left: 20px;
    border-top: 2px solid rgba(56, 189, 248, 0.5);
    border-left: 2px solid rgba(56, 189, 248, 0.5);
}

.hud-corner.top-right {
    top: 20px;
    right: 20px;
    border-top: 2px solid rgba(56, 189, 248, 0.5);
    border-right: 2px solid rgba(56, 189, 248, 0.5);
}

.hud-corner.bottom-left {
    bottom: 20px;
    left: 20px;
    border-bottom: 2px solid rgba(56, 189, 248, 0.5);
    border-left: 2px solid rgba(56, 189, 248, 0.5);
}

.hud-corner.bottom-right {
    bottom: 20px;
    right: 20px;
    border-bottom: 2px solid rgba(56, 189, 248, 0.5);
    border-right: 2px solid rgba(56, 189, 248, 0.5);
}

/* ==================== PULSE RINGS ==================== */
.pulse-ring {
    position: absolute;
    border: 2px solid rgba(56, 189, 248, 0.4);
    border-radius: 50%;
    animation: pulseExpand 4s ease-out infinite;
}

.pulse-ring:nth-child(1) {
    top: 30%;
    left: 20%;
    width: 100px;
    height: 100px;
    animation-delay: 0s;
}

.pulse-ring:nth-child(2) {
    top: 60%;
    left: 70%;
    width: 120px;
    height: 120px;
    animation-delay: 2s;
}

.pulse-ring:nth-child(3) {
    top: 80%;
    left: 30%;
    width: 90px;
    height: 90px;
    animation-delay: 1s;
}

/* ==================== ANIMATIONS ==================== */
@keyframes moveGrid {
    0% {
        transform: perspective(800px) rotateX(60deg) translateY(0);
    }

    100% {
        transform: perspective(800px) rotateX(60deg) translateY(100px);
    }
}

@keyframes scan {

    0%,
    100% {
        transform: translateY(-100%);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translateY(200%);
    }
}

@keyframes circuitFlow {
    0% {
        background-position: 0 0, 0 0;
    }

    100% {
        background-position: 200px 200px, -200px -200px;
    }
}

@keyframes hexShift {

    0%,
    100% {
        transform: translateY(0) scale(1);
        opacity: 0.15;
    }

    50% {
        transform: translateY(-20px) scale(1.05);
        opacity: 0.25;
    }
}

@keyframes dataFlow {
    0% {
        transform: translateY(-100px);
        opacity: 0;
    }

    10% {
        opacity: 0.8;
    }

    90% {
        opacity: 0.8;
    }

    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

@keyframes nodePulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.5);
        opacity: 1;
    }
}

@keyframes nodeRing {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }

    50% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-30px) rotate(5deg);
    }

    50% {
        transform: translateY(-50px) rotate(0deg);
    }

    75% {
        transform: translateY(-30px) rotate(-5deg);
    }
}

@keyframes pulseExpand {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0.6;
    }

    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Performance optimization for reduced motion */
@media (prefers-reduced-motion: reduce) {

    .grid-overlay,
    .scan-line,
    .circuit-overlay,
    .hex-grid,
    .data-stream,
    .node,
    .tech-element,
    .pulse-ring {
        animation: none;
    }
}