/* ================================================================
   SPACE THEME — Cosmic CSS + Three.js Canvas Integration
   The most insane theme in the portfolio
   PURE ADDITIVE — NO DELETIONS
   ================================================================ */

/* ── Space Theme Body ─────────────────────────────────────── */
body.theme-space {
    background:
        radial-gradient(ellipse at 15% 15%, rgba(88, 28, 135, 0.4), transparent 35%),
        radial-gradient(ellipse at 85% 10%, rgba(6, 182, 212, 0.25), transparent 30%),
        radial-gradient(ellipse at 50% 90%, rgba(139, 92, 246, 0.3), transparent 40%),
        radial-gradient(ellipse at 80% 70%, rgba(236, 72, 153, 0.18), transparent 30%),
        linear-gradient(180deg, #000005 0%, #03001a 30%, #06000f 65%, #000005 100%) !important;
    color: #e0d7ff !important;
    --space-purple: #a855f7;
    --space-cyan: #06b6d4;
    --space-pink: #ec4899;
    --space-gold: #f59e0b;
    --space-blue: #3b82f6;
}

/* ── Space canvas overlay ─────────────────────────────────── */
#space-threejs-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.5s ease;
}

body.theme-space #space-threejs-canvas {
    opacity: 1;
}

/* ── Space Cards ──────────────────────────────────────────── */
body.theme-space .premium-card {
    background: rgba(5, 2, 25, 0.72) !important;
    border: 1px solid rgba(139,92,246,0.35) !important;
    backdrop-filter: blur(22px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(22px) saturate(180%) !important;
    box-shadow:
        0 0 0 1px rgba(139,92,246,0.12),
        0 0 30px rgba(139,92,246,0.18),
        0 0 60px rgba(6,182,212,0.07),
        0 24px 60px rgba(0,0,0,0.7) !important;
}

body.theme-space .premium-card:hover {
    border-color: rgba(168,85,247,0.65) !important;
    box-shadow:
        0 0 0 1px rgba(168,85,247,0.3),
        0 0 50px rgba(168,85,247,0.3),
        0 0 100px rgba(6,182,212,0.15),
        0 0 150px rgba(236,72,153,0.08),
        0 28px 70px rgba(0,0,0,0.8) !important;
    transform: translateY(-8px) scale(1.01) !important;
}

/* ── Space Header ─────────────────────────────────────────── */
body.theme-space header {
    background: rgba(2, 0, 20, 0.85) !important;
    border-bottom: 1px solid rgba(139,92,246,0.3) !important;
    box-shadow:
        0 0 20px rgba(139,92,246,0.2),
        0 0 40px rgba(6,182,212,0.1),
        0 4px 30px rgba(0,0,0,0.8) !important;
}

/* Space brand name */
body.theme-space .bg-gradient-to-r.from-brand-600 {
    background: linear-gradient(90deg, #a855f7, #06b6d4, #ec4899, #a855f7) !important;
    background-size: 300% 100% !important;
    animation: space-brand-shimmer 5s linear infinite !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

@keyframes space-brand-shimmer {
    0%   { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* ── Space Neon Text ──────────────────────────────────────── */
body.theme-space .neon-glow-text,
body.theme-space #neon-quote-container {
    text-shadow:
        0 0 4px #fff,
        0 0 10px #a855f7,
        0 0 20px #a855f7,
        0 0 40px #06b6d4,
        0 0 80px #ec4899 !important;
    animation: space-text-pulse 3s ease-in-out infinite alternate !important;
}

@keyframes space-text-pulse {
    from {
        text-shadow:
            0 0 4px #fff,
            0 0 10px #a855f7,
            0 0 20px #a855f7,
            0 0 40px #06b6d4;
    }
    to {
        text-shadow:
            0 0 8px #fff,
            0 0 20px #a855f7,
            0 0 40px #06b6d4,
            0 0 80px #ec4899,
            0 0 120px #3b82f6;
    }
}

/* ── Space scrollbar ──────────────────────────────────────── */
body.theme-space ::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #a855f7, #06b6d4, #ec4899) !important;
    box-shadow: 0 0 10px rgba(168,85,247,0.9), 0 0 20px rgba(6,182,212,0.5) !important;
}

/* ── Space buttons ────────────────────────────────────────── */
body.theme-space .neon-btn {
    background: linear-gradient(135deg, rgba(88,28,135,0.8), rgba(6,182,212,0.4)) !important;
    border: 1px solid rgba(168,85,247,0.5) !important;
}

body.theme-space .neon-btn:hover {
    box-shadow:
        0 0 20px rgba(168,85,247,0.8),
        0 0 50px rgba(6,182,212,0.5),
        0 0 80px rgba(236,72,153,0.3) !important;
}

/* ── Space floating nav ───────────────────────────────────── */
body.theme-space .floating-nav {
    background: rgba(3, 0, 20, 0.9) !important;
    border: 1px solid rgba(168,85,247,0.4) !important;
    box-shadow:
        0 0 30px rgba(168,85,247,0.3),
        0 0 60px rgba(6,182,212,0.15),
        0 20px 50px rgba(0,0,0,0.8) !important;
}

body.theme-space .floating-nav-btn:hover {
    background: rgba(168,85,247,0.25) !important;
    box-shadow: 0 0 15px rgba(168,85,247,0.6) !important;
    color: #c084fc !important;
}

/* ── Space theme strip ────────────────────────────────────── */
body.theme-space .theme-strip {
    background: rgba(5, 2, 25, 0.85) !important;
    border: 1px solid rgba(168,85,247,0.3) !important;
    box-shadow: 0 0 20px rgba(168,85,247,0.15) !important;
}

/* ── Space inputs ─────────────────────────────────────────── */
body.theme-space input,
body.theme-space textarea,
body.theme-space select {
    background: rgba(4, 2, 20, 0.8) !important;
    border-color: rgba(168,85,247,0.3) !important;
    color: #e0d7ff !important;
}

body.theme-space input:focus,
body.theme-space textarea:focus {
    border-color: rgba(168,85,247,0.7) !important;
    box-shadow:
        0 0 0 2px rgba(168,85,247,0.25),
        0 0 20px rgba(168,85,247,0.35) !important;
}

/* ── Space skill bars ─────────────────────────────────────── */
body.theme-space [class*="bg-brand"],
body.theme-space [class*="bg-indigo"],
body.theme-space [class*="bg-purple"] {
    background: linear-gradient(90deg, #a855f7, #06b6d4) !important;
    box-shadow: 0 0 10px rgba(168,85,247,0.7), 0 0 20px rgba(6,182,212,0.4) !important;
}

/* ── Space profile ring ───────────────────────────────────── */
body.theme-space .rotating-neon-halo {
    box-shadow:
        0 0 30px rgba(168,85,247,0.8),
        0 0 60px rgba(6,182,212,0.5),
        0 0 100px rgba(236,72,153,0.3) !important;
}

body.theme-space .rotating-neon-halo::before {
    background: conic-gradient(
        #a855f7, #3b82f6, #06b6d4, #10b981, #ec4899, #f59e0b, #a855f7
    ) !important;
    animation: spin-border 3s linear infinite !important;
}

/* ── Space text colors ────────────────────────────────────── */
body.theme-space .text-slate-900,
body.theme-space .text-slate-800,
body.theme-space .text-slate-700 {
    color: #e0d7ff !important;
}

body.theme-space .text-slate-400,
body.theme-space .text-slate-500 {
    color: rgba(168,85,247,0.7) !important;
}

body.theme-space .text-brand-500,
body.theme-space .text-brand-600 {
    color: #c084fc !important;
    text-shadow: 0 0 8px rgba(192,132,252,0.5) !important;
}

body.theme-space .text-emerald-500 {
    color: #34d399 !important;
    text-shadow: 0 0 8px rgba(52,211,153,0.6) !important;
}

/* ── Space nav links ──────────────────────────────────────── */
body.theme-space a.text-brand-500,
body.theme-space a.text-brand-600 {
    text-shadow:
        0 0 10px rgba(168,85,247,0.9),
        0 0 25px rgba(6,182,212,0.5) !important;
}

/* ── Space mini badges ────────────────────────────────────── */
body.theme-space .mini-badge {
    background: rgba(168,85,247,0.12) !important;
    border-color: rgba(168,85,247,0.4) !important;
    color: #c084fc !important;
}

/* ── Space galaxy shimmer on cards ───────────────────────── */
@keyframes space-card-nebula {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body.theme-space .premium-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        radial-gradient(circle at var(--nebula-x, 30%) var(--nebula-y, 30%), rgba(168,85,247,0.08), transparent 50%),
        radial-gradient(circle at var(--nebula-x2, 70%) var(--nebula-y2, 70%), rgba(6,182,212,0.06), transparent 50%);
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
}

body.theme-space .premium-card:hover::before {
    opacity: 1;
}

/* ── Space asteroid belt (section separator) ──────────────── */
body.theme-space main > section {
    position: relative;
}

/* ── Space holographic borders ────────────────────────────── */
body.theme-space .premium-card {
    padding: 1px !important;
}

/* ── Space contact section ────────────────────────────────── */
body.theme-space #contact-section {
    background:
        radial-gradient(circle at 10% 10%, rgba(168,85,247,0.18), transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(6,182,212,0.15), transparent 40%),
        rgba(3, 0, 18, 0.95) !important;
    border-color: rgba(168,85,247,0.45) !important;
}

/* ── Space vault ──────────────────────────────────────────── */
body.theme-space #vault-section {
    background:
        radial-gradient(circle at 50% 0%, rgba(168,85,247,0.25), transparent 45%),
        linear-gradient(180deg, rgba(10,0,40,0.98), rgba(3,0,18,0.99)) !important;
    border-color: rgba(168,85,247,0.45) !important;
    box-shadow:
        0 0 50px rgba(168,85,247,0.25),
        0 0 100px rgba(6,182,212,0.1) !important;
}

/* ── Space selection ──────────────────────────────────────── */
body.theme-space ::selection {
    background: rgba(168,85,247,0.4) !important;
    color: #ffffff !important;
}

/* ================================================================
   SPACE STARS — Pure CSS twinkling stars overlay
   ================================================================ */

@keyframes twinkle-a {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50%       { opacity: 1; transform: scale(1.4); filter: blur(0.5px); }
}

@keyframes twinkle-b {
    0%, 100% { opacity: 0.5; }
    33%       { opacity: 0.1; }
    66%       { opacity: 0.9; filter: blur(0.3px); }
}

@keyframes twinkle-c {
    0%, 100% { opacity: 0.8; transform: scale(1.2); }
    50%       { opacity: 0.2; transform: scale(0.8); }
}

@keyframes shooting-star {
    0%   { transform: translateX(0) translateY(0) rotate(45deg); opacity: 0; }
    5%   { opacity: 1; }
    30%  { transform: translateX(-600px) translateY(300px) rotate(45deg); opacity: 0; }
    100% { transform: translateX(-600px) translateY(300px) rotate(45deg); opacity: 0; }
}

@keyframes nebula-drift {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(20px, -15px) scale(1.05); }
    66%  { transform: translate(-10px, 20px) scale(0.95); }
    100% { transform: translate(0, 0) scale(1); }
}

/* CSS Stars container */
.space-stars-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1.5s ease;
}

body.theme-space .space-stars-overlay {
    opacity: 1;
}

/* Generated stars via box-shadows (ultra performant) */
.space-stars-s {
    width: 1px;
    height: 1px;
    background: transparent;
    box-shadow:
        125px 32px #fff, 456px 78px #fff, 892px 145px #ccc,
        234px 267px #fff, 567px 312px #ddd, 789px 89px #fff,
        23px 456px #ccc, 678px 234px #fff, 345px 512px #eee,
        912px 378px #fff, 67px 189px #ddd, 456px 634px #fff,
        789px 456px #ccc, 123px 567px #fff, 890px 23px #ddd,
        234px 789px #fff, 567px 145px #ccc, 12px 345px #fff,
        678px 567px #eee, 901px 234px #fff, 345px 78px #ddd,
        789px 901px #fff, 456px 456px #ccc, 123px 123px #fff,
        678px 789px #ddd, 901px 567px #fff, 234px 901px #ccc,
        567px 678px #fff, 12px 789px #ddd, 890px 345px #fff,
        400px 100px #fff, 700px 500px #ccc, 150px 600px #fff,
        550px 250px #ddd, 850px 700px #fff, 50px 400px #ccc,
        750px 150px #fff, 300px 750px #ddd, 950px 50px #fff,
        200px 950px #ccc, 600px 400px #fff, 100px 200px #ddd;
    animation: twinkle-a 4s ease-in-out infinite;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 50%;
}

.space-stars-m {
    width: 2px;
    height: 2px;
    background: transparent;
    box-shadow:
        345px 123px #fff, 678px 456px rgba(200,180,255,0.9), 123px 789px #fff,
        456px 234px rgba(180,220,255,0.9), 789px 567px #fff, 234px 345px rgba(200,180,255,0.8),
        567px 678px #fff, 890px 123px rgba(180,220,255,0.8), 23px 234px #fff,
        456px 789px rgba(220,200,255,0.9), 789px 45px #fff, 123px 456px rgba(200,180,255,0.9),
        678px 234px #fff, 345px 567px rgba(180,220,255,0.8), 890px 789px #fff,
        234px 123px rgba(200,180,255,0.7), 567px 456px #fff, 12px 567px rgba(220,200,255,0.8),
        678px 890px rgba(180,220,255,0.9), 901px 345px #fff, 300px 600px rgba(200,180,255,0.8);
    animation: twinkle-b 6s ease-in-out infinite;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 50%;
}

.space-stars-l {
    width: 3px;
    height: 3px;
    background: transparent;
    box-shadow:
        200px 300px rgba(168,85,247,0.8), 600px 200px rgba(6,182,212,0.7),
        100px 700px rgba(236,72,153,0.7), 800px 600px rgba(245,158,11,0.7),
        400px 100px rgba(168,85,247,0.8), 700px 800px rgba(6,182,212,0.6),
        300px 500px rgba(236,72,153,0.8), 900px 300px rgba(59,130,246,0.7),
        500px 700px rgba(168,85,247,0.7), 150px 150px rgba(6,182,212,0.8);
    animation: twinkle-c 8s ease-in-out infinite;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 50%;
    filter: blur(0.5px);
}

/* Shooting star */
.space-shooting-star {
    position: absolute;
    top: 80px;
    right: 100px;
    width: 150px;
    height: 2px;
    background: linear-gradient(90deg, rgba(255,255,255,0.9), transparent);
    border-radius: 99px;
    animation: shooting-star 8s ease-in-out infinite;
    animation-delay: 3s;
    box-shadow: 0 0 8px rgba(168,85,247,0.8);
}

.space-shooting-star:nth-child(2) {
    top: 200px;
    right: 50px;
    animation-delay: 11s;
    animation-duration: 6s;
    width: 100px;
    box-shadow: 0 0 6px rgba(6,182,212,0.8);
}

.space-shooting-star:nth-child(3) {
    top: 50px;
    right: 300px;
    animation-delay: 7s;
    animation-duration: 10s;
    width: 200px;
    box-shadow: 0 0 10px rgba(236,72,153,0.8);
}

/* Nebula blobs */
.space-nebula {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
}

.space-nebula-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(88,28,135,0.4), transparent 70%);
    top: 5%;
    left: 10%;
    animation: nebula-drift 20s ease-in-out infinite;
}

.space-nebula-2 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(6,182,212,0.25), transparent 70%);
    top: 30%;
    right: 5%;
    animation: nebula-drift 25s ease-in-out infinite reverse;
    animation-delay: -8s;
}

.space-nebula-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(236,72,153,0.2), transparent 70%);
    bottom: 20%;
    left: 30%;
    animation: nebula-drift 18s ease-in-out infinite;
    animation-delay: -5s;
}

.space-nebula-4 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(245,158,11,0.15), transparent 70%);
    bottom: 5%;
    right: 20%;
    animation: nebula-drift 22s ease-in-out infinite reverse;
    animation-delay: -12s;
}

/* ── Space planet decoration ──────────────────────────────── */
.space-planet {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: nebula-drift 30s ease-in-out infinite;
}

.space-planet-1 {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 35% 35%, rgba(168,85,247,0.9), rgba(88,28,135,0.6), rgba(30,0,60,0.4));
    box-shadow: 0 0 30px rgba(168,85,247,0.5), 0 0 60px rgba(168,85,247,0.2);
    top: 8%;
    right: 15%;
    animation-duration: 40s;
}

.space-planet-1::before {
    content: '';
    position: absolute;
    width: 120%;
    height: 35%;
    border: 2px solid rgba(168,85,247,0.4);
    border-radius: 50%;
    top: 50%;
    left: -10%;
    transform: translateY(-50%) rotateX(70deg);
    box-shadow: 0 0 10px rgba(168,85,247,0.3);
}

/* ================================================================
   SPACE THEME CHIP SPECIAL STYLE
   ================================================================ */

.theme-chip[data-theme="space"] {
    background: linear-gradient(135deg, rgba(88,28,135,0.4), rgba(6,182,212,0.2)) !important;
    border-color: rgba(168,85,247,0.5) !important;
    color: #c084fc !important;
    text-shadow: 0 0 6px rgba(168,85,247,0.5) !important;
}

.theme-chip[data-theme="space"]:hover {
    box-shadow:
        0 0 15px rgba(168,85,247,0.6),
        0 0 30px rgba(6,182,212,0.3),
        0 0 50px rgba(236,72,153,0.2) !important;
    border-color: rgba(168,85,247,0.9) !important;
    transform: translateY(-3px) scale(1.08) !important;
}

.theme-chip[data-theme="space"].is-active {
    background: linear-gradient(135deg, rgba(88,28,135,0.7), rgba(6,182,212,0.4)) !important;
    box-shadow:
        0 0 20px rgba(168,85,247,0.7),
        0 0 40px rgba(6,182,212,0.3) !important;
    animation: space-chip-active 2s ease-in-out infinite !important;
}

@keyframes space-chip-active {
    0%, 100% { box-shadow: 0 0 15px rgba(168,85,247,0.6), 0 0 35px rgba(6,182,212,0.25); }
    50%       { box-shadow: 0 0 25px rgba(168,85,247,0.9), 0 0 60px rgba(6,182,212,0.45), 0 0 90px rgba(236,72,153,0.2); }
}
