/* ===================================
   SRV Biosciences - 3D Molecule Animation
   Pure CSS 3D rotating molecule for hero sections
   =================================== */

/* Molecule Container */
.molecule-3d-container {
    position: absolute;
    width: 200px;
    height: 200px;
    perspective: 1000px;
    z-index: 1;
    opacity: 0.3;
    pointer-events: none;
}

/* Molecule wrapper for 3D transforms */
.molecule-3d {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    animation: rotateMolecule 20s linear infinite;
}

/* Rotation animation */
@keyframes rotateMolecule {
    0% {
        transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    }

    100% {
        transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
    }
}

/* Atom base styles */
.atom {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #60a5fa, #3b82f6, #1e40af);
    box-shadow:
        0 0 20px rgba(59, 130, 246, 0.6),
        inset 0 0 20px rgba(255, 255, 255, 0.3);
    transform-style: preserve-3d;
}

/* Central atom (largest) */
.atom-center {
    width: 60px;
    height: 60px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) translateZ(0);
}

/* Orbital atoms (smaller) */
.atom-orbit {
    width: 40px;
    height: 40px;
}

/* Position atoms in 3D space */
.atom-1 {
    left: 50%;
    top: 10%;
    transform: translate(-50%, -50%) translateZ(50px);
}

.atom-2 {
    left: 85%;
    top: 50%;
    transform: translate(-50%, -50%) translateZ(30px) rotateY(60deg);
}

.atom-3 {
    left: 50%;
    top: 85%;
    transform: translate(-50%, -50%) translateZ(-30px);
}

.atom-4 {
    left: 15%;
    top: 50%;
    transform: translate(-50%, -50%) translateZ(20px) rotateY(-60deg);
}

/* Bonds connecting atoms */
.bond {
    position: absolute;
    background: linear-gradient(90deg,
            rgba(59, 130, 246, 0.4),
            rgba(96, 165, 250, 0.6),
            rgba(59, 130, 246, 0.4));
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
    transform-style: preserve-3d;
}

/* Bond from center to top */
.bond-1 {
    width: 3px;
    height: 60px;
    left: 50%;
    top: 30%;
    transform: translate(-50%, 0) rotateX(0deg) translateZ(25px);
}

/* Bond from center to right */
.bond-2 {
    width: 3px;
    height: 60px;
    left: 67%;
    top: 50%;
    transform: translate(-50%, -50%) rotateZ(90deg) rotateY(30deg) translateZ(15px);
}

/* Bond from center to bottom */
.bond-3 {
    width: 3px;
    height: 60px;
    left: 50%;
    top: 67%;
    transform: translate(-50%, 0) rotateX(0deg) translateZ(-15px);
}

/* Bond from center to left */
.bond-4 {
    width: 3px;
    height: 60px;
    left: 33%;
    top: 50%;
    transform: translate(-50%, -50%) rotateZ(90deg) rotateY(-30deg) translateZ(10px);
}

/* Glow effect */
.molecule-3d::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 70%);
    animation: moleculePulse 3s ease-in-out infinite;
}

@keyframes moleculePulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .molecule-3d-container {
        width: 150px;
        height: 150px;
        opacity: 0.2;
    }

    .atom-center {
        width: 45px;
        height: 45px;
    }

    .atom-orbit {
        width: 30px;
        height: 30px;
    }

    .bond {
        width: 2px;
    }

    .bond-1,
    .bond-2,
    .bond-3,
    .bond-4 {
        height: 45px;
    }
}

/* Position variations for different pages */
.molecule-right {
    right: 10%;
    top: 50%;
    transform: translateY(-50%);
}

.molecule-left {
    left: 10%;
    top: 50%;
    transform: translateY(-50%);
}

/* Additional positions for multiple molecules */
.molecule-top-right {
    right: 15%;
    top: 20%;
}

.molecule-bottom-left {
    left: 8%;
    bottom: 15%;
}

.molecule-top-left {
    left: 12%;
    top: 25%;
}

.molecule-bottom-right {
    right: 12%;
    bottom: 20%;
}

.molecule-center-right {
    right: 5%;
    top: 60%;
}

.molecule-center-left {
    left: 5%;
    top: 40%;
}

/* Vary animation speeds for visual interest */
.molecule-3d.speed-slow {
    animation-duration: 25s;
}

.molecule-3d.speed-fast {
    animation-duration: 15s;
}

/* Vary sizes for depth */
.molecule-3d-container.size-small {
    width: 150px;
    height: 150px;
    opacity: 0.2;
}

.molecule-3d-container.size-large {
    width: 250px;
    height: 250px;
    opacity: 0.25;
}

@media (max-width: 1024px) {
    .molecule-right {
        right: 5%;
    }

    .molecule-left {
        left: 5%;
    }

    .molecule-top-right,
    .molecule-bottom-left,
    .molecule-top-left,
    .molecule-bottom-right,
    .molecule-center-right,
    .molecule-center-left {
        display: none;
        /* Hide extra molecules on smaller screens */
    }
}

@media (max-width: 768px) {

    .molecule-right,
    .molecule-left {
        display: none;
        /* Hide on mobile to avoid clutter */
    }
}