/* Astronomi — custom styles beyond Tailwind utilities */

html {
    scroll-behavior: smooth;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #05060f;
}

::-webkit-scrollbar-thumb {
    background: #3b2a6b;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #7c3aed;
}

/* ---------- Deep space galaxy background ---------- */
#nebulaLayer {
    background:
        radial-gradient(ellipse 60% 40% at 15% 20%, rgba(124, 58, 237, 0.28), transparent 60%),
        radial-gradient(ellipse 50% 35% at 85% 15%, rgba(34, 211, 238, 0.16), transparent 60%),
        radial-gradient(ellipse 55% 45% at 75% 80%, rgba(219, 39, 119, 0.14), transparent 60%),
        radial-gradient(ellipse 45% 40% at 25% 85%, rgba(59, 130, 246, 0.16), transparent 60%);
    filter: blur(10px);
    animation: nebula-drift 40s ease-in-out infinite alternate;
    will-change: transform;
}

/* ---------- Performance: lighter effects on phones ---------- */
@media (max-width: 640px) {
    #nebulaLayer {
        filter: blur(6px);
    }

    /* Backdrop blur is expensive on mobile GPUs; swap for a solid translucent bg */
    header.backdrop-blur-md {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background-color: rgba(5, 6, 15, 0.92);
    }

    .pov-hud-panel {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(10, 14, 31, 0.92);
    }
}

/* ---------- Respect user's reduced-motion preference ---------- */
@media (prefers-reduced-motion: reduce) {

    #nebulaLayer,
    #starfieldFar,
    #starfieldNear,
    .star,
    .sun-core,
    .orbit-spin,
    .animate-spin-slow,
    .animate-float,
    .animate-twinkle {
        animation: none !important;
    }

    * {
        scroll-behavior: auto !important;
    }
}

@keyframes nebula-drift {
    0% {
        transform: scale(1) translate(0, 0);
    }

    100% {
        transform: scale(1.08) translate(-2%, 2%);
    }
}

#starfieldFar,
#starfieldNear {
    background-repeat: repeat;
}

#starfieldFar {
    background-image:
        radial-gradient(1px 1px at 8% 15%, #ffffff 100%, transparent),
        radial-gradient(1px 1px at 22% 60%, #ffffff 100%, transparent),
        radial-gradient(1px 1px at 38% 10%, #ffffff 100%, transparent),
        radial-gradient(1px 1px at 52% 75%, #ffffff 100%, transparent),
        radial-gradient(1px 1px at 68% 32%, #ffffff 100%, transparent),
        radial-gradient(1px 1px at 82% 58%, #ffffff 100%, transparent),
        radial-gradient(1px 1px at 91% 8%, #ffffff 100%, transparent),
        radial-gradient(1px 1px at 12% 88%, #ffffff 100%, transparent),
        radial-gradient(1px 1px at 58% 4%, #ffffff 100%, transparent),
        radial-gradient(1px 1px at 30% 42%, #ffffff 100%, transparent),
        radial-gradient(1px 1px at 78% 92%, #ffffff 100%, transparent),
        radial-gradient(1px 1px at 45% 55%, #ffffff 100%, transparent);
    opacity: 0.45;
    animation: parallax-drift 120s linear infinite;
}

#starfieldNear {
    background-image:
        radial-gradient(1.5px 1.5px at 18% 25%, #ffffff 100%, transparent),
        radial-gradient(1.5px 1.5px at 33% 70%, #ffffff 100%, transparent),
        radial-gradient(1.5px 1.5px at 47% 18%, #ffffff 100%, transparent),
        radial-gradient(1.5px 1.5px at 63% 85%, #ffffff 100%, transparent),
        radial-gradient(1.5px 1.5px at 76% 40%, #ffffff 100%, transparent),
        radial-gradient(1.5px 1.5px at 88% 65%, #ffffff 100%, transparent),
        radial-gradient(1.5px 1.5px at 5% 50%, #ffffff 100%, transparent),
        radial-gradient(1.5px 1.5px at 95% 20%, #ffffff 100%, transparent);
    opacity: 0.85;
    animation: parallax-drift 70s linear infinite reverse;
}

@keyframes parallax-drift {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: -400px 300px;
    }
}

.star {
    position: absolute;
    border-radius: 50%;
    background: #fff;
    animation: twinkle-anim linear infinite;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}

@keyframes twinkle-anim {

    0%,
    100% {
        opacity: 0.15;
    }

    50% {
        opacity: 1;
    }
}

/* ---------- Shooting stars ---------- */
.shooting-star {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.9);
    opacity: 0;
    animation-name: shoot;
    animation-timing-function: ease-in;
    animation-fill-mode: forwards;
}

.shooting-star::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 110px;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.9), transparent);
    transform: translateY(-50%);
}

@keyframes shoot {
    0% {
        opacity: 0;
        transform: translate(0, 0);
    }

    5% {
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate(-320px, 220px);
    }
}

/* ---------- Orbital Solar System ---------- */
.sun-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8%;
    height: 8%;
    min-width: 28px;
    min-height: 28px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #fff7cc, #ffd35a 35%, #ff9d1f 65%, #e0620f 100%);
    box-shadow:
        0 0 25px 8px rgba(255, 190, 60, 0.55),
        0 0 60px 25px rgba(255, 140, 20, 0.35),
        0 0 110px 55px rgba(139, 92, 246, 0.18);
    z-index: 5;
    animation: sun-pulse 4s ease-in-out infinite;
}

@keyframes sun-pulse {

    0%,
    100% {
        box-shadow: 0 0 25px 8px rgba(255, 190, 60, 0.55), 0 0 60px 25px rgba(255, 140, 20, 0.35), 0 0 110px 55px rgba(139, 92, 246, 0.18);
    }

    50% {
        box-shadow: 0 0 32px 12px rgba(255, 190, 60, 0.7), 0 0 75px 32px rgba(255, 140, 20, 0.45), 0 0 130px 65px rgba(139, 92, 246, 0.25);
    }
}

.orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.orbit-spin {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    animation: orbit-rotate linear infinite;
}

@keyframes orbit-rotate {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.orbit-planet {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.orbit-planet:hover {
    filter: brightness(1.3);
    transform: translate(-50%, -50%) scale(1.35);
    z-index: 20;
}

.orbit-planet-counter-spin {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    animation: orbit-rotate linear infinite reverse;
}

/* ---------- Planet Spheres ---------- */
.sphere-mercury {
    background: radial-gradient(circle at 32% 28%, #d8cfc4, #9b8f83 45%, #5c534a 80%, #35302a);
    box-shadow: inset -6px -6px 14px rgba(0, 0, 0, 0.55), 0 0 18px rgba(200, 190, 170, 0.15);
}

.sphere-venus {
    background: radial-gradient(circle at 32% 28%, #f6e3b4, #e0b978 45%, #b6803f 80%, #7a4f24);
    box-shadow: inset -6px -6px 14px rgba(0, 0, 0, 0.5), 0 0 22px rgba(230, 190, 110, 0.25);
}

.sphere-earth {
    background: radial-gradient(circle at 32% 28%, #7fd0ff, #2f7fd6 40%, #1b4f8a 70%, #0d2a4d);
    box-shadow: inset -6px -6px 16px rgba(0, 0, 0, 0.5), 0 0 25px rgba(60, 150, 255, 0.35);
    position: relative;
    overflow: hidden;
}

.sphere-mars {
    background: radial-gradient(circle at 32% 28%, #f0a578, #c9603a 45%, #8a3a20 80%, #4f1f10);
    box-shadow: inset -6px -6px 14px rgba(0, 0, 0, 0.5), 0 0 20px rgba(210, 100, 60, 0.3);
}

.sphere-jupiter {
    background: repeating-linear-gradient(170deg,
            #e8c9a0 0px, #e8c9a0 6px,
            #c99b6a 6px, #c99b6a 12px,
            #a9724c 12px, #a9724c 18px,
            #d8ac7c 18px, #d8ac7c 24px);
    box-shadow: inset -8px -8px 18px rgba(0, 0, 0, 0.5), 0 0 30px rgba(220, 180, 130, 0.25);
}

.sphere-saturn {
    background: radial-gradient(circle at 32% 28%, #f3e2b8, #d9bc82 45%, #a9895a 80%, #6b5334);
    box-shadow: inset -6px -6px 14px rgba(0, 0, 0, 0.5), 0 0 22px rgba(220, 190, 130, 0.25);
}

.sphere-uranus {
    background: radial-gradient(circle at 32% 28%, #c9f3ee, #7fd6cf 45%, #479a94 80%, #245350);
    box-shadow: inset -6px -6px 14px rgba(0, 0, 0, 0.5), 0 0 22px rgba(120, 220, 210, 0.3);
}

.sphere-neptune {
    background: radial-gradient(circle at 32% 28%, #a3b8ff, #3d5ce0 45%, #23359b 80%, #131c5c);
    box-shadow: inset -6px -6px 14px rgba(0, 0, 0, 0.5), 0 0 25px rgba(90, 120, 240, 0.35);
}

.sphere-pluto {
    background: radial-gradient(circle at 32% 28%, #e8dcd0, #b8a596 45%, #7d6a5c 80%, #453a32);
    box-shadow: inset -6px -6px 12px rgba(0, 0, 0, 0.5), 0 0 15px rgba(200, 185, 170, 0.2);
}

/* Saturn ring decoration (small, for hero) */
.saturn-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 180%;
    height: 40%;
    border: 2px solid rgba(230, 210, 160, 0.55);
    border-radius: 50%;
    transform: translate(-50%, -50%) rotate(-18deg);
    pointer-events: none;
}

/* Bigger ring used inside modal card */
.saturn-ring-lg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 175%;
    height: 42%;
    border: 3px solid rgba(230, 210, 160, 0.6);
    border-radius: 50%;
    transform: translate(-50%, -50%) rotate(-18deg);
    pointer-events: none;
    box-shadow: 0 0 12px rgba(230, 210, 160, 0.3);
}

/* ---------- Planet Card ---------- */
.planet-card {
    position: relative;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.25rem;
    padding: 1.75rem;
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.planet-card:hover {
    transform: translateY(-6px);
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: 0 12px 40px -12px rgba(139, 92, 246, 0.45);
}

.planet-card .planet-sphere {
    width: 5.5rem;
    height: 5.5rem;
    border-radius: 50%;
    position: relative;
    margin-bottom: 1.25rem;
}

/* ---------- Criteria card check/x badges ---------- */
.badge-pass {
    color: #34d399;
}

.badge-fail {
    color: #f87171;
}

/* Modal enter animation */
#planetModal.flex {
    animation: fadeIn 0.2s ease;
}

#modalPanel {
    animation: scaleIn 0.25s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ---------- POV Space Mode HUD ---------- */
#povOverlay {
    touch-action: none;
}

#povCanvas {
    cursor: grab;
}

#povCanvas:active {
    cursor: grabbing;
}

.pov-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.6;
}

.pov-crosshair::before,
.pov-crosshair::after {
    content: '';
    position: absolute;
    background: rgba(34, 211, 238, 0.9);
}

.pov-crosshair::before {
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    transform: translateY(-50%);
}

.pov-crosshair::after {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    transform: translateX(-50%);
}

.pov-hud-panel {
    background: rgba(10, 14, 31, 0.75);
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 0.9rem;
    padding: 0.7rem 1rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.12);
}

.pov-warp-btn {
    font-size: 12px;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    padding: 6px 14px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pov-warp-btn:hover {
    color: #05060f;
    background: #22d3ee;
    border-color: #22d3ee;
    box-shadow: 0 0 16px rgba(34, 211, 238, 0.5);
}

.pov-fly-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(34, 211, 238, 0.15);
    border: 1px solid rgba(34, 211, 238, 0.45);
    color: #22d3ee;
    font-size: 18px;
    font-weight: 700;
    backdrop-filter: blur(6px);
    cursor: pointer;
    user-select: none;
}

.pov-fly-btn:active {
    background: rgba(34, 211, 238, 0.4);
}