/* Performance: Use system fonts as fallback for faster initial render */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;700;900&family=Open+Sans:wght@300;400;700&display=swap');

:root {
    /* Color Palette */
    --color-dark-background: #0d0d0d;
    --color-dark-surface: #1a1a1a;
    --color-dark-text: #e0e0e0;
    --color-dark-primary: #8be9fd;
    --color-dark-secondary: #ff79c6;
    --color-dark-accent: #f1fa8c;

    --color-light-background: #f8f8f2;
    --color-light-surface: #ffffff;
    --color-light-text: #44475a;
    --color-light-primary: #6272a4;
    --color-light-secondary: #ff6e6e;
    --color-light-accent: #50fa7b;

    /* Glassmorphism */
    --glass-blur: 10px; /* Reduced from 15px for performance */
    --glass-background-alpha: 0.1;
    --glass-border-alpha: 0.2;

    /* Current Theme */
    --current-background: var(--color-dark-background);
    --current-text: var(--color-dark-text);
    --current-primary: var(--color-dark-primary);
    --current-secondary: var(--color-dark-secondary);
    --current-accent: var(--color-dark-accent);
    --current-surface: var(--color-dark-surface);
    --current-glass-bg: rgba(255, 255, 255, var(--glass-background-alpha));
    --current-glass-border: rgba(255, 255, 255, var(--glass-border-alpha));

    --current-primary-rgb: 139, 233, 253;
    --current-secondary-rgb: 255, 121, 198;
}

body.light-mode {
    --current-background: var(--color-light-background);
    --current-text: var(--color-light-text);
    --current-primary: var(--color-light-primary);
    --current-secondary: var(--color-light-secondary);
    --current-accent: var(--color-light-accent);
    --current-surface: var(--color-light-surface);
    --current-glass-bg: rgba(0, 0, 0, var(--glass-background-alpha));
    --current-glass-border: rgba(0, 0, 0, var(--glass-border-alpha));

    --current-primary-rgb: 98, 114, 164;
    --current-secondary-rgb: 255, 110, 110;
}

/* Accessibility: Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--current-primary);
    color: var(--current-background);
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; /* System font fallback */
    background-color: var(--current-background);
    color: var(--current-text);
    line-height: 1.6;
    transition: background-color 0.5s ease, color 0.5s ease; /* Reduced from 0.8s */
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent scroll when mobile menu is open */
body.no-scroll {
    overflow: hidden;
}

/* Optimized scrollbar */
body::-webkit-scrollbar {
    width: 8px;
}
body::-webkit-scrollbar-track {
    background: var(--current-background);
}
body::-webkit-scrollbar-thumb {
    background: var(--current-primary);
    border-radius: 4px;
}
body::-webkit-scrollbar-thumb:hover {
    background: var(--current-secondary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
    position: relative;
    z-index: 2;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 700;
    color: var(--current-primary);
    line-height: 1.2;
    margin-bottom: 1rem;
    transition: color 0.3s ease; /* Reduced from 0.5s */
}

h1 { font-size: clamp(2.5rem, 5vw, 3.8rem); font-weight: 900; letter-spacing: -1px; }
h2 { font-size: clamp(2rem, 4vw, 2.8rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }

p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

a {
    color: var(--current-accent);
    text-decoration: none;
    transition: color 0.3s ease;
}
a:hover, a:focus {
    color: var(--current-primary);
    outline: 2px solid var(--current-primary); /* Better focus indicator */
    outline-offset: 2px;
}

/* Button optimization */
.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    /* Performance: Use will-change sparingly */
}

.btn:hover, .btn:focus {
    will-change: transform;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.btn.primary {
    background-color: var(--current-primary);
    color: var(--current-background);
}
.btn.primary:hover {
    background-color: var(--current-secondary);
}

.btn.secondary {
    background-color: transparent;
    color: var(--current-accent);
    border: 1px solid var(--current-accent);
}
.btn.secondary:hover {
    background-color: var(--current-accent);
    color: var(--current-background);
}

.btn.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Layout Structure */
#app-wrapper {
    display: grid;
    grid-template-rows: 80px 1fr auto;
    grid-template-columns: 250px 1fr 250px;
    min-height: 100vh;
    background-color: var(--current-background);
}

.top-navbar {
    grid-column: 1 / -1;
    grid-row: 1;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background-color: var(--current-background);
    border-bottom: 1px solid var(--current-glass-border);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: background-color 0.3s ease;
}

.nav-left, .nav-center, .nav-right {
    display: flex;
    align-items: center;
}

.nav-left .brand-name {
    font-size: 2rem;
    font-weight: 900;
    color: var(--current-primary);
}

.main-nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.main-nav-links a {
    color: var(--current-text);
    font-weight: 500;
    font-size: 1.1rem;
    position: relative;
}

.main-nav-links a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 0%;
    height: 2px;
    background-color: var(--current-primary);
    transition: width 0.3s ease;
}

.main-nav-links a:hover::after,
.main-nav-links a:focus::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--current-text);
    transition: all 0.3s ease-in-out;
    border-radius: 1px;
}

.nav-toggle.open span:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

#main-layout {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: subgrid;
}

.left-sidebar, .right-sidebar {
    padding: 1rem 1.5rem; /* Changed from 2rem 1.5rem */
    position: sticky;
    top: 80px;
    height: calc(100vh - 80px);
    /* Removed overflow-y: auto; to disable scrolling */
    transition: background-color 0.3s ease;
}

.left-sidebar {
    grid-column: 1;
    background-color: var(--current-surface);
}

.center-content {
    grid-column: 2;
    overflow-y: auto;
    background-color: var(--current-background);
    padding: 0; /* Removed all padding */
    transition: background-color 0.3s ease;
}

.right-sidebar {
    grid-column: 3;
    background-color: var(--current-surface);
}

/* Hero Section - Optimized */
#hero {
    height: calc(100vh - 80px);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    overflow: hidden;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: linear-gradient(
        45deg,
        var(--current-primary),
        var(--current-secondary),
        var(--current-accent)
    );
    background-size: 400% 400%;
    animation: backgroundPan 20s ease infinite;
    /* Performance: Use will-change for animated elements */
    will-change: background-position;
}

@keyframes backgroundPan {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 900px;
    padding: 0 1.5rem;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

#hero h1 {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 900;
    margin-bottom: 1rem;
    color: #fff;
    text-shadow: 0 0 20px rgba(255,255,255,0.8);
    letter-spacing: 3px;
    text-transform: uppercase;
    animation: fadeInUp 1s ease-out, float 6s ease-in-out infinite;
    animation-delay: 0.2s, 1.2s;
}

#hero .tagline {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    margin-bottom: 3rem;
    color: var(--current-accent);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    animation: fadeInUp 1s ease-out, float 6s ease-in-out infinite;
    animation-delay: 0.4s, 1.4s;
}

.hero-cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Sections */
section {
    min-height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.full-viewport-section {
    min-height: calc(100vh - 80px);
}

.section-content-padded {
    padding: 6rem 0;
}

section h2 {
    font-size: clamp(2rem, 4vw, 2.8rem);
    margin-bottom: 2.5rem;
    color: var(--current-primary);
    position: relative;
}

section h2::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -10px;
    width: 80px;
    height: 3px;
    background-color: var(--current-secondary);
}

.section-description {
    font-size: 1.2rem;
    max-width: 800px;
    margin-bottom: 3rem;
    color: var(--current-text);
}

/* About Section */
.about-content-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    max-width: 1200px;
    text-align: left;
}

.about-bio p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.profile-avatar {
    width: 70%;
    height: 50%;
    object-fit: cover;
    transition: transform 0.3s ease;
    margin-bottom: 1.0rem; /* Added margin */
}

.profile-avatar:hover {
    transform: scale(1.05);
}

.profile-card {
    text-align: center; /* Center align content */
    padding: 1rem 0; /* Add padding */
}

.profile-card h3 {
    margin-bottom: 0.5rem;
}

.profile-card .role {
    color: var(--current-secondary);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.quick-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem; /* Space between links */
}

.quick-links li {
    width: 100%; /* Ensure list item takes full width */
}

.quick-links a {
    display: block;
    padding: 0.8rem 1.5rem;
    background-color: var(--current-primary);
    color: var(--current-background);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.quick-links a:hover,
.quick-links a:focus {
    background-color: var(--current-secondary);
    color: var(--current-background);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
    outline: none; /* Remove default outline, using box-shadow for focus */
}

/* Skills Section - Optimized grid */
.skills-3-column-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    width: 100%;
    text-align: left;
}

.skills-column {
    background-color: var(--current-glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--current-glass-border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.skills-column:hover {
    transform: translateY(-5px);
    will-change: transform;
}

.skills-column ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.skills-column li {
    background-color: var(--current-background);
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-size: 0.95rem;
    border: 1px solid var(--current-glass-border);
    transition: all 0.3s ease;
}

.skills-column li:hover {
    background-color: var(--current-primary);
    color: var(--current-background);
    transform: scale(1.05);
}

/* Projects - Optimized */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    width: 100%;
}

.project-card {
    background-color: var(--current-glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--current-glass-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    text-align: left;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-8px);
    will-change: transform;
}

.project-card img {
    
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-bottom: 1px solid var(--current-glass-border);
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.tech-tags span {
    background-color: var(--current-background);
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    font-size: 0.85rem;
    border: 1px solid var(--current-glass-border);
}

/* Contact Form */
.contact-form {
    display: flex;
    flex-direction: column;
    max-width: 700px;
    margin: 2rem auto;
    gap: 1.5rem;
    width: 100%;
}

.contact-form input,
.contact-form textarea {
    padding: 1rem;
    border: 1px solid var(--current-glass-border);
    border-radius: 8px;
    background-color: var(--current-glass-bg);
    color: var(--current-text);
    font-size: 1rem;
    backdrop-filter: blur(var(--glass-blur));
    font-family: inherit;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: 2px solid var(--current-primary);
    outline-offset: 2px;
}

/* Timeline - Optimized */
.timeline {
    position: relative;
    max-width: 900px;
    margin: 4rem auto;
    padding: 1rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    width: 3px;
    background-color: var(--current-primary);
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.timeline-item {
    padding: 1.5rem 2rem;
    position: relative;
    background-color: var(--current-glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--current-glass-border);
    border-radius: 12px;
    margin-bottom: 3rem;
    width: 45%;
}

.timeline-item:nth-child(odd) {
    margin-left: 0;
    margin-right: auto;
}

.timeline-item:nth-child(even) {
    margin-right: 0;
    margin-left: auto;
}

/* Custom Cursor - Optimized */
.custom-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 2px solid var(--current-primary);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    /* Performance: Use transform instead of top/left */
    will-change: transform;
}

.custom-cursor.grow {
    width: 40px;
    height: 40px;
    border-color: var(--current-secondary);
}


/* Theme toggle switch */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin-right: 1rem;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--current-primary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--current-primary);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.slider .sun-icon,
.slider .moon-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.slider .sun-icon {
    left: 7px;
    opacity: 0;
    color: #f1c40f; /* Sun color */
}

.slider .moon-icon {
    right: 7px;
    opacity: 1;
    color: #f39c12; /* Moon color */
}

input:checked + .slider .sun-icon {
    opacity: 1;
}

input:checked + .slider .moon-icon {
    opacity: 0;
}

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

.animate-initially-hidden {
    opacity: 0;
}

.animate-fade-in-up {
    animation: fadeInUp 0.7s ease-out forwards;
}

/* Footer */
footer {
    grid-column: 1 / -1;
    background-color: var(--current-surface);
    padding: 1.5rem 0;
    text-align: center;
    border-top: 1px solid var(--current-glass-border);
}

/* Responsive Design */
@media (max-width: 1024px) {
    #app-wrapper {
        grid-template-columns: 200px 1fr 200px;
    }
    
    .timeline::before {
        left: 1rem;
    }
    
    .timeline-item {
        width: calc(100% - 3rem);
        margin-left: 3rem !important;
        margin-right: 0 !important;
    }
}

@media (max-width: 768px) {
    #app-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: 60px 1fr auto;
    }
    
    .top-navbar {
        height: 60px;
        padding: 0 1rem;
    }
    
    .nav-center {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        height: calc(100vh - 60px);
        background-color: var(--current-background);
        flex-direction: column;
        justify-content: center;
        transform: translateX(-100%);
        opacity: 0;
        transition: transform 0.3s ease, opacity 0.3s ease;
        z-index: 998;
        pointer-events: none;
    }
    
    .nav-center.open {
        transform: translateX(0);
        opacity: 1;
        pointer-events: all;
    }
    
    .main-nav-links {
        flex-direction: column;
        text-align: center;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .left-sidebar, .right-sidebar {
        display: none;
    }
    
    .center-content {
        grid-column: 1;
    }
    
    .about-content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .skills-3-column-grid {
        grid-template-columns: 1fr;
    }
    
    .project-grid {
        grid-template-columns: 1fr;
    }

    .nav-right .btn,
    .nav-right .icon-btn,
    .nav-right .theme-switch {
        display: none;
    }
}

/* Print styles */
@media print {
    .top-navbar,
    .custom-cursor,
    .left-sidebar,
    .right-sidebar,
    footer {
        display: none;
    }
    
    #app-wrapper {
        grid-template-columns: 1fr;
    }
}

/* Tech Stack Slider */
.slider-container {
    overflow: hidden;
    position: relative;
    width: 100%;
}

.tech-stack-icons {
    display: flex;
    animation: slide 10s linear infinite;
}

.tech-stack-icons img {
    width: 40px;
    height: 40px;
    margin: 0 10px;
}

.slider-container:hover .tech-stack-icons {
    animation-play-state: paused;
}

@keyframes slide {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

#repo-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 300px; /* Adjust as needed */
    overflow-y: auto;
}

.repo-item {
    background-color: var(--current-glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--current-glass-border);
    border-radius: 8px;
    padding: 1rem;
    text-align: left;
    transition: all 0.3s ease;
}

.repo-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.repo-item h6 {
    margin-bottom: 0.5rem;
    font-size: 1rem; /* Adjusted font size for h6 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.repo-item h6 a {
    color: var(--current-primary);
    text-decoration: none;
}

.repo-item p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.repo-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--current-text);
}

.repo-stats p {
    font-size: 0.8rem;
    margin: 0;
}
.repo-stats span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
