/* ? This value is shared by literally every part of Heliotrope */
:root {
    --galaxyTiltAngle: 30deg;
}

.dustLayer {
    position: fixed;
    inset: 0;
    z-index: 20;
    pointer-events: none;
}

#galaxyCanvas {
    width: 100%;
    height: 100%;

    /* ^ Get ready for some ansolutely fucked up math! */
    /* ? scaleY(0.82) approximates rotateX(35deg)'s foreshortening
    ? (cos(35deg) ~ 0.82) so the flat 2D dust scatter reads as lying in the
    ? same tilted plane as the 3D-tilted image, pivoted around the same
    ? point the dots are actually drawn around (IMAGE_CENTER_VMIN in
    ? galaxyIndex.js). */
    transform: rotate(var(--galaxyTiltAngle)) scaleY(0.82);
    transform-origin: 60vmin 60vmin;
}

.galaxyImageLayer {
    position: fixed;
    inset: 0;
    z-index: 25;
}

.galaxyImageWrapper {
    position: absolute;
    left: -40vmin;
    top: -40vmin;
    width: 200vmin;
    height: 200vmin;

    aspect-ratio: auto;
    border-radius: 0;

    pointer-events: auto;
    cursor: var(--cursorPointer);

    transition: transform .3s;
}

.galaxyImageWrapper:hover {
    transform: scale(1.03);
}


.galaxyOrbitBounds {
    position: absolute;
    left: -40vmin;
    top: -40vmin;
    width: 200vmin;
    height: 200vmin;

    pointer-events: none;
}

.galaxyDiagonalTilt {
    width: 100%;
    height: 100%;
    transform: rotate(var(--galaxyTiltAngle));
}

.galaxySpinInner {
    position: relative; /* ? containing block for #constellationLines/#galaxyMarkers below */
    width: 100%;
    height: 100%;

    animation: galaxySpin3D 100s linear infinite;
}

@keyframes galaxySpin3D {
    from {
        transform: perspective(2300px) rotateX(35deg) rotateZ(0deg);
    }

    to {
        transform: perspective(2300px) rotateX(35deg) rotateZ(360deg);
    }
}

.galaxySpinInner img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.galaxyImageWrapper .label {
    top: auto;
    bottom: 30%;
    left: 38%;
    transform: none;
}

.galaxyImageLayer > .planet:hover .label {
    opacity: 1;
}

#heliotrope .label {
    top: 35%;
    bottom: auto;
}

#constellationLines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

.constellationLine {
    stroke: rgba(200, 190, 255, 0.35);
    stroke-width: 0.15;
    stroke-dasharray: 1 1.5;
}

#galaxyMarkers {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
}

#galaxyMarkers > .planet:hover .label {
    opacity: 1;
}

.systemMarker {
    width: 16px;
    height: 16px;

    transform: translate(-50%, -50%);
    pointer-events: auto;
}

/* ? Keeps the label from rotating (so it remains readable!) */
.systemMarker .label {
    animation: galaxySpinCounter 100s linear infinite;
}

@keyframes galaxySpinCounter {
    from {
        transform: translateX(-50%) rotateZ(0deg);
    }

    to {
        transform: translateX(-50%) rotateZ(-360deg);
    }
}

.systemMarker.UNF {
    animation: none;
}

.systemMarker.sunMarker {
    width: 26px;
    height: 26px;

    background: radial-gradient(circle, #fff6d8 0%, #e8d45c 45%, #c96f1b 100%);
    box-shadow: 0 0 14px 6px rgba(255, 187, 0, 0.75), 0 0 28px 14px rgba(255, 153, 0, 0.35);

    animation: sunMarkerPulse 2.4s ease-in-out infinite;
}

@keyframes sunMarkerPulse {
    0%, 100% {
        box-shadow: 0 0 14px 6px rgba(255, 187, 0, 0.75), 0 0 28px 14px rgba(255, 153, 0, 0.35);
    }

    50% {
        box-shadow: 0 0 20px 8px rgba(255, 187, 0, 0.9), 0 0 38px 18px rgba(255, 153, 0, 0.5);
    }
}

/* * Inspired by No Man's Sky! */
#warpOverlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
}

#warpFlash {
    position: absolute;
    inset: 0;
    background: white;
    opacity: 0;
}

#warpOverlay.warping #warpFlash {
    animation: warpFade 1s linear forwards;
}

@keyframes warpFade {
    0% {
        opacity: 0;
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 1;
    }
}

/* ~ Planets */

.planet {
    display: block;
    aspect-ratio: 1;
    border-radius: 50%;
    position: absolute;
}

#severance {
    background: url(../assets/img/Severance.png) center/contain;
    border-radius: 0%;

    width: 40px;
    height: 40px;
    
    top: -60px;
    left: 50%;
    transform: translate(-50%, 0);
}