/* CSS Variables for Dark Theme with Purple Accent */
:root {
    --primary-color: #8b5cf6;      /* Main purple accent */
    --primary-dark: #7c3aed;       /* Darker purple for hovers */
    --accent-color: #a78bfa;       /* Lighter purple for secondary accents */
    --accent-dark: #8b5cf6;        /* Fallback for hovers */
    --github-purple: #6f42c1;      /* Keep GitHub vibe */
    --github-dark: #5a32a3;
    --text-color: #f0f0f0;         /* Light text */
    --text-secondary: #b0b0b0;     /* Subtle text */
    --bg-color: #0f0f0f;           /* Dark body bg */
    --card-bg: #1a1a1a;            /* Card backgrounds */
    --navbar-bg: rgba(20, 20, 20, 0.95); /* Navbar dark */
    --hero-bg: linear-gradient(135deg, #1a0a2e, #0a0a0a); /* Dark purple-to-black for starscape */
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3); /* Deeper shadows */
    --shadow-hover: 0 8px 25px rgba(139, 92, 246, 0.3); /* Purple-tinted hover shadow */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Basics */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    overflow-x: hidden; /* Smooth scrolling */
}

/* Navigation */
.navbar {
    background: var(--navbar-bg);
    backdrop-filter: blur(10px); /* Modern glass effect */
    color: #fff;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition);
}

.navbar ul {
    list-style: none;
    display: flex;
    justify-content: center;
}

.navbar li {
    margin: 0 1.5rem;
}

.navbar a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    position: relative;
    transition: var(--transition);
}

.navbar a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 50%;
    background: var(--primary-color);
    transition: var(--transition);
    transform: translateX(-50%);
}

.navbar a:hover {
    color: var(--primary-color);
}

.navbar a:hover::after {
    width: 100%;
}

/* Hero with Animated Starscape */
.hero {
    text-align: center;
    padding: 6rem 2rem;
    background: var(--hero-bg);
    color: #fff;
    position: relative;
    overflow: hidden;
    min-height: 60vh; /* Ensure space for stars */
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        /* Layer 1: Distant twinkling stars (small, slow) */
        radial-gradient(1px 1px at 20px 30px, #fff, transparent),
        radial-gradient(1px 1px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 160px 30px, #fff, transparent),
        /* Layer 2: Mid twinklers (medium, varied speed) */
        radial-gradient(1.5px 1.5px at 50px 120px, #fff, transparent),
        radial-gradient(1.5px 1.5px at 100px 160px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1.5px 1.5px at 200px 90px, #fff, transparent),
        radial-gradient(1.5px 1.5px at 250px 130px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.5px 1.5px at 300px 200px, #fff, transparent),
        /* Layer 3: Bright/near stars (larger, fast twinkle) */
        radial-gradient(2px 2px at 80px 200px, #fff, transparent),
        radial-gradient(2px 2px at 150px 250px, rgba(255,255,255,0.95), transparent),
        radial-gradient(2px 2px at 220px 300px, #fff, transparent),
        radial-gradient(2px 2px at 320px 350px, rgba(255,255,255,0.85), transparent),
        /* More stars for density - repeat pattern */
        radial-gradient(1px 1px at 10px 250px, #fff, transparent),
        radial-gradient(1px 1px at 70px 300px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 120px 350px, #fff, transparent),
        radial-gradient(1px 1px at 180px 400px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 240px 450px, #fff, transparent),
        radial-gradient(1.5px 1.5px at 300px 500px, rgba(255,255,255,0.9), transparent),
        radial-gradient(2px 2px at 50px 500px, #fff, transparent),
        /* Extend for full coverage - in real use, add more for wider viewport */
        radial-gradient(1px 1px at 400px 100px, #fff, transparent),
        radial-gradient(1.5px 1.5px at 450px 150px, rgba(255,255,255,0.7), transparent),
        radial-gradient(2px 2px at 500px 200px, #fff, transparent);
    background-repeat: repeat;
    background-size: 600px 600px; /* Tile for larger screens */
    opacity: 0.8;
    animation: starTwinkle 4s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 1;
}

@keyframes starTwinkle {
    0% { opacity: 0.6; transform: scale(1) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.1) rotate(1deg); }
    100% { opacity: 0.7; transform: scale(0.95) rotate(-1deg); }
}

/* Subtle shooting star effect - optional layer */
.hero::after {
    content: '';
    position: absolute;
    top: 20%;
    right: -20%;
    width: 2px;
    height: 60px;
    background: linear-gradient(to bottom, transparent, #fff);
    box-shadow: 0 0 10px #fff;
    animation: shootingStar 8s linear infinite;
    z-index: 2;
    pointer-events: none;
}

@keyframes shootingStar {
    0% {
        transform: translateX(-100px) translateY(-50px) rotate(-45deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateX(200px) translateY(100px) rotate(-45deg);
        opacity: 0;
    }
}

.hero > * {
    position: relative;
    z-index: 3; /* Ensure text is above stars */
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    animation: pulse 2s ease-in-out infinite; /* Subtle hero animation */
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Teaser Sections */
.teaser {
    padding: 3rem 2rem;
    text-align: center;
    background: var(--card-bg);
    margin: 2rem auto;
    max-width: 800px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.teaser:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.teaser h2 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.teaser a {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
    border-radius: 50px; /* Modern pill shape */
    font-weight: 500;
    transition: var(--transition);
}

.teaser a:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* Embed Section for GitHub */
.embed-section {
    padding: 2rem;
    background: var(--bg-color);
    text-align: center;
}

.embed-section h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.embed-container {
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--card-bg);
}

.embed-container iframe {
    display: block;
    width: 100%;
    height: 800px;
    border: none;
    transition: var(--transition);
}

.embed-container p {
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Projects & Repos Sections */
.projects-section, .repos-section {
    padding: 4rem 2rem;
    background: var(--bg-color);
}

.projects-section h2, .repos-section h2 {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--primary-color);
    font-size: 2.2rem;
    font-weight: 600;
}

.project-grid, .repo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.project-card, .repo-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.project-card::before, .repo-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transform: scaleX(0);
    transition: var(--transition);
}

.project-card:hover::before, .repo-card:hover::before {
    transform: scaleX(1);
}

.project-card:hover, .repo-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-hover);
}

.project-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.project-card:hover .project-img {
    transform: scale(1.05);
}

.project-card h3, .repo-card h3 {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.project-card p, .repo-card p {
    margin-bottom: 1.5rem;
    opacity: 0.8;
    color: var(--text-secondary);
}

.project-card a, .repo-card a {
    display: inline-block;
    margin: 0.5rem 0.5rem 0 0;
    padding: 0.6rem 1.2rem;
    background: var(--accent-color);
    color: #fff;
    text-decoration: none;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.project-card a:hover, .repo-card a:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.repo-card a:nth-child(3) { /* Style second link differently if needed */
    background: var(--github-purple);
}

.repo-card a:nth-child(3):hover {
    background: var(--github-dark);
}

.github-link {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 1rem 2rem;
    background: var(--github-purple);
    color: #fff;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--transition);
}

.github-link:hover {
    background: var(--github-dark);
    transform: translateY(-2px);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.8s ease-out forwards;
}

/* Stagger animations for grids */
.project-grid > .fade-in:nth-child(1),
.repo-grid > .fade-in:nth-child(1),
.project-grid > .project-card:nth-child(1),
.repos-section > .repo-card:nth-child(1) {
    animation-delay: 0.1s;
}

.project-grid > .fade-in:nth-child(2),
.repo-grid > .fade-in:nth-child(2),
.project-grid > .project-card:nth-child(2),
.repos-section > .repo-card:nth-child(2) {
    animation-delay: 0.2s;
}

.project-grid > .fade-in:nth-child(3),
.repo-grid > .fade-in:nth-child(3),
.project-grid > .project-card:nth-child(3),
.repos-section > .repo-card:nth-child(3) {
    animation-delay: 0.3s;
}

.project-grid > .fade-in:nth-child(4),
.repos-section > .repo-card:nth-child(4) {
    animation-delay: 0.4s;
}

.project-grid > .fade-in:nth-child(5),
.repos-section > .repo-card:nth-child(5) {
    animation-delay: 0.5s;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background: #1a1a1a;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid #333;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar ul {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .hero::before {
        background-size: 300px 300px; /* Smaller tiles on mobile */
    }
    
    .embed-container iframe {
        height: 600px; /* Shorter on mobile */
    }
    
    .project-grid, .repo-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .fade-in {
        animation-delay: 0s !important; /* No stagger on mobile */
    }
}