/* === CSS Variables (Apple Vision Pro Glassmorphism) === */
:root {
    /* Text colors adapted for dark space background */
    --primary-color: #ffffff;
    --secondary-color: #b2bec3;
    --accent-color: #3498db;
    --text-color: #dfe6e9;
    --bg-color: transparent;
    
    /* Apple Vision Pro Glass Variables */
    --card-bg: rgba(255, 255, 255, 0.08); 
    --card-border: rgba(255, 255, 255, 0.18); 
    --header-text: #a4b0be;
    --nav-bg: rgba(255, 255, 255, 0.05); 
    --timeline-line: rgba(52, 152, 219, 0.6);
}

/* === Reset & Base === */
html { scroll-behavior: smooth; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #000000; /* Pitch black space */
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* === Custom Cursor (Desktop Only) === */
@media (pointer: fine) {
    body { cursor: none; }
    .cursor-dot, .cursor-outline {
        position: fixed;
        top: 0; left: 0;
        border-radius: 50%;
        z-index: 9999;
        pointer-events: none;
        will-change: transform;
    }
    .cursor-dot {
        width: 8px; height: 8px;
        background-color: var(--accent-color);
    }
    .cursor-outline {
        width: 40px; height: 40px;
        border: 2px solid var(--accent-color);
        transition: width 0.2s, height 0.2s, background-color 0.2s;
    }
    .cursor-hover {
        width: 60px !important; height: 60px !important;
        background-color: rgba(52, 152, 219, 0.2);
    }
}

/* === Loader & Scroll Progress === */
#loader {
    position: fixed; inset: 0;
    background: #000000; z-index: 10000;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.5s ease;
}
.spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--card-border);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite; margin-top: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

#scroll-progress {
    position: fixed; top: 0; left: 0; height: 4px;
    background: var(--accent-color); width: 0%; z-index: 9998;
}

/* === Background Image & Particles === */
.bg-animations {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    
    /* Best for a realistic space background */
    background: #000 url("earth.jpg") no-repeat center center;
    background-size: 70%;
}

/* Radial blend fades the image edges beautifully into the black background */
.bg-animations::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(0,0,0,0.1) 30%, rgba(0,0,0,0.85) 100%); 
    z-index: 1; /* Ensures shadow sits over the earth */
}

#particles-container {
    position: absolute; width: 100%; height: 100%;
    z-index: 2; /* Ensures particles sit over the shadow */
}
.floating-particle {
    position: absolute;
    background: #ffffff; 
    border-radius: 50%;
    opacity: 0.5;
    animation: floatParticle linear infinite;
}
@keyframes floatParticle {
    0% { transform: translateY(0) scale(1); opacity: 0; }
    50% { opacity: 0.7; }
    100% { transform: translateY(-100px) scale(0.5); opacity: 0; }
}

/* === Navigation === */
nav {
    position: sticky; top: 0;
    background: var(--nav-bg); 
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    padding: 25px 20px; z-index: 9000;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 8px 30px rgba(0,0,0,.25), 0 0 25px rgba(52,152,219,.10); 
    border-bottom: 1px solid var(--card-border);
    transition: padding 0.3s ease; 
}
nav.scrolled {
    padding: 15px 20px;
}
.nav-brand {
    font-weight: bold; font-size: 1.2em; color: var(--accent-color);
}
.nav-links { display: flex; gap: 20px; transition: max-height 0.3s ease; }
.nav-links a {
    color: var(--text-color); text-decoration: none; font-weight: 500;
    position: relative; padding: 5px 0;
}
.nav-links a::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 2px;
    background: var(--accent-color); transition: width 0.3s;
}
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }

.hamburger {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
}

/* === Container & Sections === */
.container { max-width: 1000px; margin: 0 auto; padding: 20px; }
section { margin-bottom: 50px; scroll-margin-top: 80px; }

/* Supreme Glassmorphism applied to Sections/Cards */
section.grid-2-col > div, 
#skills, 
.timeline-content,
#contact {
    position: relative;
    overflow: hidden;
    background: var(--card-bg) !important;
    padding: 30px;
    border-radius: 16px; 
    border: 1px solid var(--card-border) !important;
    backdrop-filter: blur(10px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(10px) saturate(180%) !important;
    box-shadow: 0 8px 30px rgba(0,0,0,.25), 0 0 25px rgba(52,152,219,.10);
}

h3 { 
    color: var(--primary-color); 
    border-bottom: 2px solid var(--accent-color); 
    padding-bottom: 5px; 
    margin-top: 0; 
    display: inline-block;
    text-shadow: 0 2px 5px rgba(0,0,0,0.6);
}
h4 { color: var(--text-color); margin-bottom: 5px; font-weight: 600; }

/* === Scroll Animations === */
.anim-fade-up { opacity: 0; transform: translateY(40px); transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.anim-fade-left { opacity: 0; transform: translateX(-40px); transition: all 0.8s ease-out; }
.anim-fade-right { opacity: 0; transform: translateX(40px); transition: all 0.8s ease-out; }
.anim-zoom { opacity: 0; transform: scale(0.95); transition: all 0.6s ease-out; }
.show { opacity: 1 !important; transform: translate(0) scale(1) !important; }

/* === Header (Hero Section) === */
header {
    background: var(--card-bg); 
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    color: var(--primary-color);
    padding: 60px 20px; text-align: center; border-radius: 16px;
    margin-top: 20px; margin-bottom: 40px; position: relative; overflow: hidden;
    border: 1px solid var(--card-border);
    box-shadow: 0 8px 30px rgba(0,0,0,.25), 0 0 25px rgba(52,152,219,.10);
}
.profile-img {
    width: 150px; height: 150px; border-radius: 50%; object-fit: cover;
    border: 4px solid rgba(255,255,255,0.15); margin-bottom: 15px;
    animation: fadeInScale 0.8s ease-out forwards;
}
header h1 { 
    margin: 0; font-size: 2.8em; opacity: 0; 
    text-shadow: 0 4px 10px rgba(0,0,0,0.7);
    animation: slideUp 0.8s 0.3s ease-out forwards; 
}
.header-subtitle { 
    margin: 5px 0 15px 0; color: var(--header-text); font-size: 1.2em; 
    opacity: 0; animation: fadeIn 0.8s 0.6s forwards; 
}
.contact-info { 
    opacity: 0; animation: fadeIn 0.8s 0.9s forwards; 
}
.contact-info a { color: var(--text-color); text-decoration: none; margin: 0 10px; transition: color 0.3s; }
.contact-info a:hover { color: var(--accent-color); }

.typing-cursor {
    display: inline-block;
    width: 2px;
    background-color: var(--accent-color);
    animation: blink 0.8s infinite;
    margin-left: 2px;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes fadeInScale { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { to { opacity: 1; } }

/* === Badges & Tooltips === */
.badges-container { display: flex; flex-wrap: wrap; gap: 12px; }
.badge {
    background-color: rgba(255, 255, 255, 0.03); 
    color: var(--text-color);
    padding: 10px 18px; border-radius: 20px; font-weight: 500;
    border: 1px solid var(--card-border); 
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    transition: all 0.3s ease; position: relative; cursor: default;
}
.badge:hover { transform: scale(1.05) translateY(-3px); box-shadow: 0 5px 15px rgba(52,152,219,0.5); background-color: rgba(52, 152, 219, 0.3); border-color: var(--accent-color); color: white; }

.badge[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute; bottom: 120%; left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: rgba(0,0,0,0.85); color: #fff;
    padding: 6px 10px; border-radius: 6px; font-size: 0.75rem; white-space: nowrap;
    opacity: 0; visibility: hidden; transition: all 0.3s ease;
    z-index: 10; pointer-events: none;
}
.badge[data-tooltip]::after {
    content: ''; position: absolute; bottom: 100%; left: 50%;
    transform: translateX(-50%) translateY(10px);
    border-width: 5px; border-style: solid;
    border-color: rgba(0,0,0,0.85) transparent transparent transparent;
    opacity: 0; visibility: hidden; transition: all 0.3s ease;
    z-index: 10; pointer-events: none;
}
.badge[data-tooltip]:hover::before, .badge[data-tooltip]:hover::after {
    opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}

/* === Project Cards === */
.project-card {
    background: var(--card-bg); 
    border: 1px solid var(--card-border);
    padding: 25px; border-radius: 16px; margin-bottom: 30px;
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    box-shadow: 0 8px 30px rgba(0,0,0,.25), 0 0 25px rgba(52,152,219,.10);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative; overflow: hidden;
}
.project-card:hover {
    transform: translateY(-10px); box-shadow: 0 15px 40px rgba(0,0,0,0.7); border-color: rgba(52, 152, 219, 0.5);
}

/* Moved to ::after so it doesn't conflict with the Apple Vision subtle highlight */
.project-card::after {
    content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.05), transparent);
    transform: skewX(-25deg); transition: 0.5s; pointer-events: none;
}
.project-card:hover::after { left: 150%; }

.project-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.project-title-wrap { display: flex; align-items: center; gap: 15px; }
.app-icon { width: 60px; height: 60px; border-radius: 14px; box-shadow: 0 6px 15px rgba(0,0,0,0.5); transition: transform 0.5s; }
.project-card:hover .app-icon { transform: rotate(8deg) scale(1.1); }

/* === Apple Vision Pro Subtle Highlight === */
header::before,
section.grid-2-col > div::before,
#skills::before,
#contact::before,
.project-card::before,
.timeline-content::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        135deg,
        rgba(255,255,255,.10),
        rgba(255,255,255,.02)
    );
    pointer-events: none;
}

/* === Timeline === */
.timeline { position: relative; max-width: 800px; margin: 0 auto; padding-left: 30px; }
.timeline::before {
    content: ''; position: absolute; top: 0; left: 11px; height: 100%; width: 2px;
    background: var(--timeline-line); opacity: 0.5;
}
.timeline-item { position: relative; margin-bottom: 30px; }
.timeline-dot {
    position: absolute; left: -34px; top: 5px; width: 12px; height: 12px;
    background: var(--accent-color); border: 3px solid rgba(255,255,255,0.1); border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(52,152,219,0.2); transition: transform 0.3s;
}
.timeline-item:hover .timeline-dot { transform: scale(1.3); }

/* === Buttons & Ripple === */
.btn {
    background-color: rgba(52, 152, 219, 0.8); color: white; padding: 8px 20px;
    text-decoration: none; border-radius: 6px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 8px;
    backdrop-filter: blur(5px);
    position: relative; overflow: hidden; transition: transform 0.2s, background 0.3s; border: 1px solid rgba(255,255,255,0.1); cursor: pointer;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}
.btn:hover { background-color: #2980b9; transform: scale(1.03); }
.btn .arrow { transition: transform 0.3s; }
.btn:hover .arrow { transform: translateX(5px); }

.ripple {
    position: absolute; border-radius: 50%; transform: scale(0);
    animation: ripple-anim 0.6s linear; background-color: rgba(255, 255, 255, 0.4);
}
@keyframes ripple-anim { to { transform: scale(4); opacity: 0; } }

/* === Grid Layouts === */
.grid-2-col { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }

/* === Footer & Back to Top === */
footer { 
    text-align: center; 
    padding: 40px 20px; 
    border-top: 1px solid var(--card-border); 
    margin-top: 50px; 
    background: var(--card-bg);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
}
.social-icons { display: flex; justify-content: center; gap: 15px; margin-bottom: 20px; }
.social-icons a { 
    display: inline-block; padding: 10px; 
    background: rgba(255, 255, 255, 0.05); 
    border-radius: 50%; border: 1px solid var(--card-border); 
    transition: all 0.3s; color: var(--text-color); text-decoration: none;
}
.social-icons a:hover { transform: translateY(-5px); background: rgba(52, 152, 219, 0.5); color: white; border-color: var(--accent-color); }

#back-to-top {
    position: fixed; bottom: 30px; right: 30px; background: rgba(52, 152, 219, 0.8); color: white;
    width: 45px; height: 45px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(5px); border: 1px solid rgba(255,255,255,0.1);
    text-decoration: none; font-size: 1.2em; opacity: 0; visibility: hidden; transition: all 0.3s; z-index: 9000; box-shadow: 0 4px 15px rgba(52,152,219,0.5);
}
#back-to-top.visible { opacity: 1; visibility: visible; }
#back-to-top:hover { transform: translateY(-5px); background: #2980b9; }

/* === Mobile Responsiveness === */
@media (max-width: 768px) {
    .grid-2-col { grid-template-columns: 1fr; }
    .project-header { flex-direction: column; align-items: flex-start; gap: 15px; }
    
    .hamburger { display: block; }
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: rgba(10, 15, 30, 0.95);
        backdrop-filter: blur(10px) saturate(180%);
        -webkit-backdrop-filter: blur(10px) saturate(180%);
        padding: 20px;
        box-shadow: 0 8px 30px rgba(0,0,0,.25), 0 0 25px rgba(52,152,219,.10);
        border-bottom: 1px solid var(--card-border);
    }
    .nav-links.active { display: flex; }
}