/* ==========================================================================
   Celestial & Neon Visual Effects
   Modular background layers for Wahid Nurcipto Portfolio & Articles
   ========================================================================== */

/* Hexagonal Neon Grid (used in Blog) */
.hex-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: linear-gradient(135deg, var(--navy, #0a192f) 0%, #0d1f3c 50%, var(--navy, #0a192f) 100%);
    pointer-events: none;
}

.hex-grid {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='52' viewBox='0 0 60 52'%3E%3Cpath d='M30 0L60 15v22L30 52 0 37V15z' fill='none' stroke='%2364ffda' stroke-width='0.3' stroke-opacity='0.15'/%3E%3C/svg%3E");
    background-size: 60px 52px;
    animation: hexFloat 30s linear infinite;
}

@keyframes hexFloat {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-60px, -52px) rotate(0deg); }
}

.runner-lines {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.runner-line {
    position: absolute;
    background: linear-gradient(90deg, transparent, var(--green, #64ffda), #00d4ff, transparent);
    height: 2px;
    width: 150px;
    filter: drop-shadow(0 0 6px var(--green, #64ffda));
    border-radius: 50%;
}

.runner-line.line-1 { top: 20%; animation: runnerMove1 16s linear infinite; }
.runner-line.line-2 { top: 45%; animation: runnerMove2 12s linear infinite -4s; }
.runner-line.line-3 { top: 70%; animation: runnerMove3 10s linear infinite -2s; }
.runner-line.line-4 { top: 85%; animation: runnerMove4 14s linear infinite -6s; }

@keyframes runnerMove1 {
    0% { left: -150px; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

@keyframes runnerMove2 {
    0% { left: 100%; opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { left: -150px; opacity: 0; }
}

@keyframes runnerMove3 {
    0% { left: -150px; opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { left: 100%; opacity: 0; }
}

@keyframes runnerMove4 {
    0% { left: 100%; opacity: 0; }
    10% { opacity: 0.7; }
    90% { opacity: 0.7; }
    100% { left: -150px; opacity: 0; }
}

.runner-line-v {
    position: absolute;
    background: linear-gradient(180deg, transparent, #ff6b9d, #c44dff, transparent);
    width: 2px;
    height: 100px;
    filter: drop-shadow(0 0 5px #c44dff);
    border-radius: 50%;
}

.runner-line-v.line-v1 { left: 25%; animation: runnerMoveV1 15s linear infinite; }
.runner-line-v.line-v2 { left: 75%; animation: runnerMoveV2 18s linear infinite -5s; }

@keyframes runnerMoveV1 {
    0% { top: -100px; opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { top: 100%; opacity: 0; }
}

@keyframes runnerMoveV2 {
    0% { top: 100%; opacity: 0; }
    10% { opacity: 0.5; }
    90% { opacity: 0.5; }
    100% { top: -100px; opacity: 0; }
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--green, #64ffda);
    border-radius: 50%;
    filter: blur(1px);
    box-shadow: 0 0 10px var(--green, #64ffda);
}

.particle:nth-child(1) { top: 15%; left: 20%; animation: particleFloat 6s ease-in-out infinite; }
.particle:nth-child(2) { top: 35%; left: 80%; animation: particleFloat 8s ease-in-out infinite; }
.particle:nth-child(3) { top: 65%; left: 15%; animation: particleFloat 7s ease-in-out infinite; }
.particle:nth-child(4) { top: 80%; left: 70%; animation: particleFloat 9s ease-in-out infinite; }
.particle:nth-child(5) { top: 50%; left: 50%; animation: particleFloat 10s ease-in-out infinite; }

@keyframes particleFloat {
    0%, 100% { transform: translate(0, 0); opacity: 0.3; }
    50% { transform: translate(15px, -20px); opacity: 0.9; }
}

/* Galaxy Night Sky Background (used in Articles) */
.galaxy-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(ellipse at bottom, #101c2e 0%, #070d17 100%);
    pointer-events: none;
}

.stars-layer-1 {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1.5px 1.5px at 20% 30%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 60% 70%, #fff, transparent),
        radial-gradient(1px 1px at 50% 50%, #fff, transparent),
        radial-gradient(1px 1px at 80% 10%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 90% 40%, #fff, transparent),
        radial-gradient(1px 1px at 33% 60%, #fff, transparent),
        radial-gradient(1px 1px at 10% 80%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 70% 20%, #fff, transparent);
    background-size: 550px 550px;
    opacity: 0.7;
    animation: starMove1 80s linear infinite;
}

.stars-layer-2 {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 40% 90%, rgba(100, 255, 218, 0.8), transparent),
        radial-gradient(1px 1px at 15% 15%, rgba(100, 255, 218, 0.8), transparent),
        radial-gradient(1.5px 1.5px at 85% 60%, rgba(100, 255, 218, 0.8), transparent),
        radial-gradient(1px 1px at 25% 40%, rgba(100, 255, 218, 0.8), transparent);
    background-size: 400px 400px;
    opacity: 0.6;
    animation: starMove2 120s linear infinite;
}

@keyframes starMove1 {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

@keyframes starMove2 {
    0% { background-position: 0% 0%; }
    100% { background-position: -100% -100%; }
}

/* Twinkle Stars */
.twinkle-star {
    position: absolute;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 6px rgba(100, 255, 218, 0.8), 0 0 12px rgba(100, 255, 218, 0.4);
}

.twinkle-star:nth-child(1) { width: 3px; height: 3px; top: 20%; left: 30%; animation: twinkle 3.5s ease-in-out infinite; }
.twinkle-star:nth-child(2) { width: 4px; height: 4px; top: 40%; left: 70%; animation: twinkle 4.2s ease-in-out infinite -1s; }
.twinkle-star:nth-child(3) { width: 3px; height: 3px; top: 60%; left: 40%; animation: twinkle 3s ease-in-out infinite -2s; }
.twinkle-star:nth-child(4) { width: 4px; height: 4px; top: 80%; left: 80%; animation: twinkle 4.8s ease-in-out infinite -1.5s; }
.twinkle-star:nth-child(5) { width: 3px; height: 3px; top: 15%; left: 60%; animation: twinkle 3.2s ease-in-out infinite -0.5s; }

@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.3); }
}

/* Shooting Stars */
.shooting-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 10px #ffffff;
}

.shooting-star::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 120px;
    height: 1.5px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.9), transparent);
    transform: translateX(-120px);
}

.shooting-star:nth-child(1) { top: 20%; left: -120px; animation: shoot1 10s linear infinite; }
.shooting-star:nth-child(2) { top: 55%; left: -120px; animation: shoot2 14s linear infinite -5s; }

@keyframes shoot1 {
    0% { left: -120px; top: 20%; opacity: 0; }
    10% { opacity: 1; }
    85% { opacity: 1; }
    100% { left: 100%; top: 32%; opacity: 0; }
}

@keyframes shoot2 {
    0% { left: -120px; top: 55%; opacity: 0; }
    10% { opacity: 1; }
    85% { opacity: 1; }
    100% { left: 100%; top: 67%; opacity: 0; }
}

/* Nebula Glow Effect */
.nebula {
    position: absolute;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(100, 255, 218, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(0, 212, 255, 0.04) 0%, transparent 40%);
    animation: nebulaFloat 40s ease-in-out infinite;
}

@keyframes nebulaFloat {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 0.9; }
}

/* Light mode overrides for Celestial components */
body.light-mode .galaxy-background,
:root:has(> head > meta[name="color-scheme"][content="light"]) .galaxy-background {
    background: radial-gradient(ellipse at bottom, #ebf4ff 0%, #f1f5f9 100%);
}

body.light-mode .stars-layer-1,
body.light-mode .stars-layer-2,
:root:has(> head > meta[name="color-scheme"][content="light"]) .stars-layer-1,
:root:has(> head > meta[name="color-scheme"][content="light"]) .stars-layer-2 {
    opacity: 0.15;
}

body.light-mode .twinkle-star,
:root:has(> head > meta[name="color-scheme"][content="light"]) .twinkle-star {
    background: #0284c7;
    box-shadow: 0 0 6px #0284c7;
}

body.light-mode .hex-background,
:root:has(> head > meta[name="color-scheme"][content="light"]) .hex-background {
    background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 50%, #f8fafc 100%);
}

body.light-mode .hex-grid,
:root:has(> head > meta[name="color-scheme"][content="light"]) .hex-grid {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='52' viewBox='0 0 60 52'%3E%3Cpath d='M30 0L60 15v22L30 52 0 37V15z' fill='none' stroke='%230d9488' stroke-width='0.3' stroke-opacity='0.12'/%3E%3C/svg%3E");
}

