html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    /* This is critical for preventing horizontal scroll issues */
    overflow-x: hidden; 
}

:root {
    --primary-color: #9f78ff;
    --background-color: #0d0d1a;
    --component-bg: rgba(26, 26, 46, 0.7);
    --text-color: #e0e0e0;
    --text-secondary: #a0a0c0;
    --border-color: rgba(159, 120, 255, 0.2);
    --shadow-color: rgba(159, 120, 255, 0.5);
}

/* --- Preloader --- */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-color);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader {
    width: 50px;
    height: 50px;
    border: 5px solid var(--component-bg);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* --- Body --- */
body {
    font-family: 'Lato', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
}

/* --- Background Layers --- */
#three-background, .aurora-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
}

#three-background { z-index: -2; }

.aurora-background {
    z-index: -3;
    background: radial-gradient(ellipse at 70% 30%, var(--primary-color) 0%, transparent 40%),
                radial-gradient(ellipse at 30% 70%, #78c0ff 0%, transparent 40%);
    opacity: 0.15;
    filter: blur(100px);
    animation: aurora 20s infinite alternate;
}

@keyframes aurora {
    from { transform: rotate(0deg) scale(1.2); }
    to { transform: rotate(360deg) scale(1.5); }
}

/* --- Navbar --- */
.navbar {
    background: rgba(13, 13, 26, 0.7);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
}

.navbar-brand, .nav-link {
    color: var(--text-color) !important;
    font-family: 'Syne', sans-serif;
}

.nav-link { position: relative; }

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: var(--primary-color);
    transition: all 0.3s ease-out;
}

.nav-link:hover::after {
    width: 100%;
    left: 0;
}

/* --- Hero Section --- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding-top: 80px; /* offset for fixed navbar */
}

.hero-content h1 {
    font-family: 'Syne', sans-serif;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
}

#role-text { color: var(--primary-color); }

.spline-container {
    height: 100%;
    min-height: 350px;
    max-height: 500px;
}

/* --- Sections --- */
.section {
    padding: 80px 0;
    position: relative;
    z-index: 2;
}

.section-title {
    font-family: 'Syne', sans-serif;
    font-size: clamp(2.5rem, 5vw, 3rem);
    margin-bottom: 40px;
    text-align: center;
}

/* --- Glass Card --- */
.glass-card {
    background: var(--component-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.glass-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 0 40px var(--shadow-color);
}

/* --- Skills --- */
.skill-category h5 {
    color: var(--primary-color);
    font-family: 'Syne', sans-serif;
}
.skill-category .skill-tag { margin-bottom: 0.5rem; } /* Adds spacing on mobile */

.skill-tag {
    background: rgba(159, 120, 255, 0.1);
    color: var(--primary-color);
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 0.9rem;
    margin: 4px;
    display: inline-block;
}

/* --- Footer --- */
footer {
    background: var(--component-bg);
    backdrop-filter: blur(10px);
    padding: 40px 0;
    text-align: center;
}

footer .social-icons a {
    color: var(--text-secondary);
    font-size: 1.8rem;
    margin: 0 15px;
    transition: color 0.3s, transform 0.3s;
}

footer .social-icons a:hover {
    color: var(--primary-color);
    transform: translateY(-5px);
}

/* --- Profile Image --- */
#profile-image-container {
    perspective: 1000px; 
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.profile-img {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transition: transform 0.4s ease-out, box-shadow 0.4s ease-out;
    animation: float-animation 6s ease-in-out infinite;
}

@keyframes float-animation {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

#profile-image-container::before {
    content: '';
    position: absolute;
    width: 310px;
    height: 310px;
    border-radius: 50%;
    z-index: -1;
    animation: glow-animation 6s ease-in-out infinite;
    background: radial-gradient(circle, rgba(138, 43, 226, 0.5) 0%, rgba(255, 105, 180, 0) 70%);
}

@keyframes glow-animation {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.7; }
}

/* --- Responsive --- */
/* This breakpoint (lg) aligns with Bootstrap's grid system */
@media (max-width: 992px) {
    .hero .row { 
        /* Reverses the order so the spline/image appears on top of the text on mobile */
        flex-direction: column-reverse; 
    }
    
    .skill-category {
        margin-bottom: 2rem;
    }
    
    .skill-category:last-child {
        margin-bottom: 0;
    }
}


/* ===================== */
/* Mobile Responsiveness */
/* ===================== */
@media (max-width: 768px) {
    /* Navbar */
    .navbar {
        padding: 0.5rem 1rem;
    }
    .navbar-brand {
        font-size: 1rem;
    }

    /* Hero Section */
    .hero {
        padding-top: 60px;
        text-align: center;
    }
    .hero .row {
        flex-direction: column-reverse !important;
    }
    .hero-content h1 {
        font-size: 2rem;
    }
    .hero p.lead {
        font-size: 1rem;
    }

    /* Profile Image */
    .profile-img {
        width: 200px;
        height: 200px;
    }
    #profile-image-container::before {
        width: 210px;
        height: 210px;
    }

    /* Section Padding */
    .section {
        padding: 50px 0;
    }
    .section-title {
        font-size: 1.8rem;
    }

    /* Skills Cards */
    .skill-category {
        margin-bottom: 1.5rem;
    }
    .skill-tag {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    /* Footer */
    footer .social-icons a {
        font-size: 1.3rem;
        margin: 0 10px;
    }
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 1.6rem;
    }
    .profile-img {
        width: 150px;
        height: 150px;
    }
    #profile-image-container::before {
        width: 160px;
        height: 160px;
    }
    .section-title {
        font-size: 1.5rem;
    }
    .glass-card {
        padding: 1.2rem;
    }
}
.hero-image-border {
    position: absolute; width: 100%; height: 100%; border-radius: 50%; z-index: 2;
}
.hero-image-border::before { /* Inner rotating border */
    content: ''; position: absolute; inset: 0; border-radius: 50%; padding: 2px;
    background: conic-gradient(from 0deg, var(--primary-color), var(--secondary-glow-color), transparent, var(--primary-color));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    animation: rotate-glow 4s linear infinite;
}
.hero-image-border::after { /* Outer breathing glow */
    content: ''; position: absolute; inset: -10px; border-radius: 50%;
    background: radial-gradient(ellipse at center, var(--primary-color) 0%, transparent 70%);
    filter: blur(20px); opacity: 0.6; z-index: 1;
    animation: breathe-glow 6s ease-in-out infinite;
}
@keyframes rotate-glow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes breathe-glow {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 0.8; }
}
@keyframes hero-float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}
/* --- NEW Hero Image Styles --- */
.hero-image-container {
    position: relative;
    width: clamp(250px, 80%, 350px);
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: hero-float 6s ease-in-out infinite;
}
.hero-image {
    width: 90%;
    height: 90%;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 3;
}
/* Disable the GPU-intensive blur effect on screens smaller than 768px */
@media (max-width: 768px) {
    .glass-card,
    .navbar {
        /* Replace the expensive blur with a simple transparent background */
        backdrop-filter: none; 
        background-color: rgba(26, 26, 46, 0.9); /* Make it less transparent to ensure text is readable */
    }
}

/* --- Additional Enhancements --- */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}   
a:hover {
    color: #ff78c0;
    text-decoration: underline;
}
button, .btn {
    background-color: var(--primary-color);
    border: none;
    color: #fff;
    transition: background-color 0.3s, transform 0.2s;
}
button:hover, .btn:hover {
    background-color: #ff78c0;
    transform: translateY(-2px);
}
button:active, .btn:active {
    transform: translateY(0);
}
input, textarea {
    background: var(--component-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    transition: border-color 0.3s;
}
input:focus, textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--background-color);
}
::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #ff78c0;
}
/* Ensure all images are responsive */
img {
    max-width: 100%;
    height: auto;
}
/* Ensure all videos are responsive */
video {
    max-width: 100%;
    height: auto;
}
/* Ensure iframes are responsive */
iframe {
    max-width: 100%;
    height: auto;
}



