/* --- 0. Custom Fonts --- */
@font-face {
    font-family: 'Bitcount Grid Double';
    src: url('/assets/fonts/Delius-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap; /* Helps with loading performance */
}

/* --- 1. Theme Variables --- */
:root {
    --bg-color: #0d1117;
    --card-bg: #161b22;
    --text-color: #c9d1d9;
    --accent-color: #58a6ff;
    --secondary-text: #8b949e;
    --border-color: #30363d;
    --star-color: #ffffff;
    --sky-top: #1B2735;
    --sky-bottom: #090A0F;
    --toggle-bg: #30363d;
    --cosmic-opacity: 0.6;
}

body.light-theme {
    --bg-color: #ffffff;
    --card-bg: #f6f8fa;
    --text-color: #24292f;
    --accent-color: #0969da;
    --secondary-text: #57606a;
    --border-color: #d0d7de;
    --star-color: #0969da; 
    --sky-top: #eaf2ff;
    --sky-bottom: #ffffff;
    --toggle-bg: #d0d7de;
    --cosmic-opacity: 0.3; /* Subtle presence in light mode */
}

/* --- 2. Global Styles --- */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Delius', 'Courier New', Courier, monospace;
    margin: 0;
    line-height: 1.6;
    transition: background-color 0.5s ease, color 0.5s ease;
    overflow-x: hidden;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 10; /* Ensures text stays above cosmic objects */
}

/* --- 3. Navigation & Toggle (Remains Bold & Responsive) --- */
.top-nav {
    display: flex;
    justify-content: flex-end;
    padding: 20px 5%;
    position: sticky;
    top: 0;
    z-index: 100;
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}

.theme-switch input { display: none; }

.slider {
    background-color: var(--toggle-bg);
    bottom: 0; cursor: pointer; left: 0; position: absolute; right: 0; top: 0;
    transition: .4s; border-radius: 34px;
    display: flex; align-items: center; justify-content: space-between; padding: 0 8px;
}

.slider:before {
    background-color: var(--accent-color);
    bottom: 4px; content: ""; height: 26px; left: 4px; position: absolute;
    transition: .4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    width: 26px; border-radius: 50%; z-index: 5;
}

input:checked + .slider:before { transform: translateX(26px); }

.slider .icon {
    width: 18px; height: 18px; z-index: 2; transition: all 0.3s ease; stroke-width: 3px;
}

.slider .sun { color: #ff9d00; }
.slider .moon { color: #f1c40f; }

/* --- 4. Cosmic Background (Stars, Rocket, UFO) --- */
#stars-container {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background: radial-gradient(ellipse at bottom, var(--sky-top) 0%, var(--sky-bottom) 100%);
    transition: background 1s ease;
    overflow: hidden;
}

/* Multi-layered High-Density Stars */
#stars, #stars2, #stars3 {
    background: transparent;
    position: absolute;
    top: 0;
}

#stars {
    width: 1px; height: 1px;
    box-shadow: 446px 411px var(--star-color), 145px 1234px var(--star-color), 1200px 500px var(--star-color), 800px 100px var(--star-color), 200px 1500px var(--star-color), 1600px 50px var(--star-color), 300px 800px var(--star-color), 900px 1400px var(--star-color), 100px 100px var(--star-color), 1800px 900px var(--star-color), 500px 300px var(--star-color);
    animation: animStar 150s linear infinite;
}

#stars2 {
    width: 2px; height: 2px;
    box-shadow: 200px 300px var(--star-color), 700px 800px var(--star-color), 1000px 100px var(--star-color), 1500px 600px var(--star-color), 400px 1100px var(--star-color), 1200px 1400px var(--star-color);
    animation: animStar 100s linear infinite;
}

#stars3 {
    width: 3px; height: 3px;
    box-shadow: 500px 100px var(--star-color), 1400px 900px var(--star-color), 200px 600px var(--star-color);
    animation: animStar 70s linear infinite;
    opacity: 0.4;
}

@keyframes animStar {
    from { transform: translateY(0px); }
    to { transform: translateY(-2000px); }
}

/* Cosmic Objects Styling */
.cosmic-object {
    position: fixed;
    color: var(--accent-color);
    opacity: var(--cosmic-opacity);
    z-index: -1;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.rocket {
    bottom: -100px;
    left: -100px;
    transform: rotate(45deg);
    animation: flyRocket 20s linear infinite;
}

.ufo {
    top: 15%;
    right: -100px;
    animation: flyUFO 35s ease-in-out infinite;
}

.social-links a {
    color: var(--text-color);
    text-decoration: none;
    display: inline-flex;     /* Aligns the icon and text side-by-side */
    align-items: center;      /* Vertically centers them */
    gap: 8px;                 /* Adds perfect spacing between the icon and text */
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 0 10px;
    transition: 0.3s ease;
    background: transparent;
    font-weight: 600;
}

.social-links a:hover {
    background: var(--card-bg);
    border-color: var(--accent-color);
    transform: translateY(-2px); /* Adds a subtle lift effect on hover */
}


@keyframes flyRocket {
    0% { transform: translate(-10vw, 10vh) rotate(45deg); }
    100% { transform: translate(110vw, -110vh) rotate(45deg); }
}

@keyframes flyUFO {
    0% { transform: translateX(0); right: -100px; }
    20% { transform: translateY(50px); }
    50% { transform: translateY(-100px); right: 50vw; }
    80% { transform: translateY(30px); }
    100% { transform: translateX(0); right: 120vw; }
}

/* --- 5. Grid & Content (Updated Responsiveness) --- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-top: 20px;
}

.skill-category, .project-card {
    background: var(--card-bg);
    padding: 25px; border-radius: 12px; border: 1px solid var(--border-color);
    transition: 0.3s;
}

.reveal { opacity: 0; transform: translateY(20px); transition: 0.8s ease-out; }
.reveal.active { opacity: 1; transform: translateY(0); }

/* --- Mobile Fixes --- */
@media (max-width: 768px) {
    .container { padding: 20px 15px; }
    #typewriter { font-size: 1.4rem; min-height: 3em; }
    .social-links { 
        display: flex; 
        flex-wrap: wrap; 
        justify-content: center; 
        gap: 12px; 
    }
    .social-links a { 
        flex: 1 1 40%; 
        justify-content: center; 
        margin: 0; 
    }
    .skills-grid { grid-template-columns: 1fr; }
    .btn { width: 100%; text-align: center; }
    .rocket { animation-duration: 12s; } /* Faster on small screens */
}