/* ========================================
   CSS Reset & Base Styles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --color-bg: #0f0f0f;
    --color-bg-secondary: #1a1a1a;
    --color-text: #ffffff;
    --color-text-muted: #a6a6a6;
    --color-accent: #ffffff;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 4rem;
    
    /* Layout */
    --max-width: 1920px;
    --container-width: 1200px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.4s ease;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    scroll-behavior: smooth;
    position: relative;
}

/* Animated Background */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    background-color: var(--color-bg);
}

#particleCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
    opacity: 0.5;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

/* ========================================
   Scroll to Top Button
   ======================================== */

.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background-color: var(--color-accent);
    color: var(--color-bg);
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.4);
}

.scroll-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 255, 255, 0.6);
    animation: neonPulse 1.5s ease-in-out infinite;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   Navigation
   ======================================== */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--color-bg);
    z-index: 1000;
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid var(--color-bg-secondary);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo a {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    transition: color var(--transition-fast);
}

.nav-logo a:hover {
    color: var(--color-text-muted);
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    transition: color var(--transition-fast);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-text);
    transition: width 0.3s ease;
}

.nav-link:hover {
    color: var(--color-text);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-mobile-toggle {
    display: none;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    text-transform: uppercase;
}

/* ========================================
   Hero Section
   ======================================== */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8rem 1.25rem 4rem;
    text-align: center;
    padding-top: 120px;
    position: relative;
    z-index: 1;
}

.hero-container {
    max-width: var(--container-width);
    width: 100%;
}

.hero-title {
    font-size: 8rem;
    font-weight: 500;
    letter-spacing: -0.08em;
    line-height: 1em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

.hero-subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: -0.04em;
    color: var(--color-text-muted);
}

/* ========================================
   Sections
   ======================================== */

.section-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 5rem 1.25rem;
}

.section-header {
    margin-bottom: var(--spacing-xl);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 500;
    letter-spacing: -0.08em;
    line-height: 1em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

.section-description {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    letter-spacing: -0.04em;
}

/* ========================================
   Works Section
   ======================================== */

.works-section {
    padding: 5rem 0;
    position: relative;
    z-index: 2;
}

.works-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    align-items: stretch;
}

.work-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    height: 100%;
}

/* ========================================
   Universal Glass Box Styles
   ======================================== */

.glass-box,
.work-card,
.skill-card,
.experience-item,
.education-item,
.publication-item {
    position: relative;
    border-radius: 0.5rem;
    background: rgba(26, 26, 26, 0.6) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    -moz-backdrop-filter: blur(10px) !important;
    /* Stronger pop transition */
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow 0.3s ease, 
                border-color 0.3s ease, 
                background 0.3s ease;
    border: 1px solid rgba(0, 255, 255, 0.2);
    padding: 2rem;
}

.work-card {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    padding: 0;
}

.glass-box:hover,
.work-card:hover,
.skill-card:hover,
.experience-item:hover,
.education-item:hover,
.publication-item:hover {
    border-color: rgba(0, 255, 255, 0.6);
    box-shadow: 0 10px 30px -10px rgba(0, 255, 255, 0.3),
                0 0 20px rgba(0, 255, 255, 0.1),
                inset 0 0 20px rgba(0, 255, 255, 0.05);
    transform: translateY(-8px) scale(1.03) !important;
    z-index: 10;
}

.glass-box::after,
.work-card::after,
.skill-card::after,
.experience-item::after,
.education-item::after,
.publication-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(0, 255, 255, 0.05) 50%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    border-radius: 0.5rem;
}

.glass-box:hover::after,
.work-card:hover::after,
.skill-card:hover::after,
.experience-item:hover::after,
.education-item:hover::after,
.publication-item:hover::after {
    opacity: 1;
}

/* Unified Glass Button Styles (Hero, Competitive, Contact, etc.) */
.glass-btn,
.hero-cta,
.contact-link,
.competitive-item {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.75rem 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    border: 2px solid var(--color-text);
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    color: var(--color-text);
    background: rgba(26, 26, 26, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    /* Reset any specific overrides */
    margin: 0;
    box-shadow: none;
}

.glass-btn::before,
.hero-cta::before,
.contact-link::before,
.competitive-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
    z-index: 1;
    /* Reset specific overrides */
    border-radius: 0;
    transform: none;
}

.glass-btn:hover::before,
.hero-cta:hover::before,
.contact-link:hover::before,
.competitive-item:hover::before {
    left: 100%;
    /* Reset specific overrides */
    width: 100%;
    height: 100%;
}

.glass-btn:hover,
.hero-cta:hover,
.contact-link:hover,
.competitive-item:hover {
    background-color: var(--color-text);
    color: var(--color-bg);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4),
                0 0 40px rgba(255, 255, 255, 0.2),
                0 5px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
    border-color: var(--color-text);
}



.work-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    border-radius: 0.5rem;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

.work-card:hover::before {
    opacity: 1;
    animation: glitchEffect 0.3s ease-in-out;
}

.work-image {
    aspect-ratio: 3/4;
    overflow: hidden;
    background-color: var(--color-bg-secondary);
    flex-shrink: 0;
}

.work-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.work-card:hover .work-image img {
    transform: scale(1.05);
}

.work-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.work-title {
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: -0.08em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.work-description {
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: -0.04em;
    color: var(--color-text-muted);
    line-height: 1.5;
    flex-grow: 1;
}

/* ========================================
   About Section
   ======================================== */

.about-section {
    padding: 5rem 0;
    position: relative;
}

.about-content {
    max-width: 800px;
}

.about-text {
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: 2.5rem;
    letter-spacing: -0.04em;
}

.about-skills {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.skill-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-bg-secondary);
}

.skill-label {
    font-weight: 600;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    font-size: 0.875rem;
    width: 150px;
    flex-shrink: 0;
}

.skill-value {
    font-size: 1rem;
    letter-spacing: -0.04em;
    flex: 1;
}

/* Cyberpunk hover effects for skill badges */
.software-skills span {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    border: 1px solid transparent;
}

.software-skills span:hover {
    background: var(--color-text) !important;
    color: var(--color-bg);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3),
                0 0 30px rgba(255, 255, 255, 0.1),
                0 5px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-3px) scale(1.05);
}

.software-skills span::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 4px;
}

.software-skills span:hover::before {
    opacity: 1;
}

/* Competitive programming links */
.competitive-sites a {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.competitive-sites a:hover {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2),
                0 0 25px rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
}

/* ========================================
   Contact Section
   ======================================== */

.contact-section {
    padding: 5rem 0;
    text-align: center;
    position: relative;
    z-index: 2;
}

.contact-title {
    font-size: 2.5rem;
    font-weight: 500;
    letter-spacing: -0.08em;
    line-height: 1em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

.contact-description {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    letter-spacing: -0.04em;
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* Old Contact Link Styles - Deprecated in favor of Unified Glass Button */
/*
.contact-link {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--color-text);
    border-radius: 2rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-link::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.contact-link:hover::before {
    width: 300px;
    height: 300px;
}

.contact-link:hover {
    background-color: var(--color-text);
    color: var(--color-bg);
    border-color: var(--color-text);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4),
                0 0 40px rgba(255, 255, 255, 0.2),
                0 5px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}
*/

/* Hero CTA button cyberpunk effect - Deprecated in favor of Unified Glass Button */
/*
.hero-cta {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.hero-cta:hover::before {
    left: 100%;
}

.hero-cta:hover {
    background-color: var(--color-text);
    color: var(--color-bg);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4),
                0 0 40px rgba(255, 255, 255, 0.2),
                0 5px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}
*/

/* ========================================
   Footer
   ======================================== */

.footer {
    background-color: var(--color-bg);
    padding: 2rem 1.25rem;
    border-top: 1px solid var(--color-bg-secondary);
}

.footer-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.footer-social {
    display: flex;
    gap: 1.5rem;
}

.footer-link {
    font-size: 0.9375rem;
    font-weight: 400;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    transition: all 0.3s ease;
    position: relative;
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-text);
    transition: width 0.3s ease;
}

.footer-link:hover {
    color: var(--color-text);
}

.footer-link:hover::after {
    width: 100%;
}

.footer-copyright {
    font-size: 0.9375rem;
    font-weight: 400;
    letter-spacing: -0.04em;
    text-transform: uppercase;
    color: var(--color-text);
}

/* ========================================
   Responsive Design
   ======================================== */

/* Tablet */
@media (max-width: 1199px) {
    .hero-title {
        font-size: 6.875rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .works-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* Mobile */
@media (max-width: 809px) {
    .nav-menu {
        display: none;
        position: fixed;
        top: 58px;
        left: 0;
        right: 0;
        background-color: var(--color-bg);
        flex-direction: column;
        padding: 2rem 1.25rem;
        gap: 1rem;
        border-bottom: 1px solid var(--color-bg-secondary);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-mobile-toggle {
        display: block;
    }
    
    .hero {
        min-height: 80vh;
        padding: 4rem 1.25rem 2rem;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .works-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-container {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-social {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .skill-item {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .skill-label {
        width: 100%;
    }
}

/* Very small devices */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .contact-links {
        flex-direction: column;
    }
    
    .contact-link {
        width: 100%;
        max-width: 300px;
    }
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(3rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-4rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(4rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes neonPulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.2),
                    0 0 10px rgba(255, 255, 255, 0.1),
                    inset 0 0 10px rgba(255, 255, 255, 0.05);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.4),
                    0 0 30px rgba(255, 255, 255, 0.2),
                    0 0 40px rgba(255, 255, 255, 0.1),
                    inset 0 0 20px rgba(255, 255, 255, 0.1);
    }
}

@keyframes glitchEffect {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.slide-in-left {
    animation: slideInLeft 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.slide-in-right {
    animation: slideInRight 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Initial state for animated elements */
.animate-on-scroll {
    opacity: 0;
    will-change: transform, opacity;
}

/* Smooth scrolling for all browsers */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* ========================================
   Utilities
   ======================================== */

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }
