/* === SYSTEM VARIABLES === */
:root {
    --bg-base: #030305;
    --accent-primary: #00f0ff;
    --accent-secondary: #ff0055;
    --accent-tertiary: #7000ff;
    
    --glass-bg: rgba(10, 15, 30, 0.4);
    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    
    --text-main: #e0e6ed;
    --text-muted: #8b9bb4;
    
    --font-mono: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
    --font-sans: 'Inter', 'SF Pro Display', -apple-system, sans-serif;
}

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: none; /* Custom cursor */
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100%;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-sans);
    overflow-x: hidden;
    width: 100%;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Focus styles for accessibility */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 4px;
    cursor: auto;
}

/* === CUSTOM CURSOR === */
#cursor-dot, #cursor-ring {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
}
#cursor-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: 50%;
    transition: width 0.2s, height 0.2s, background 0.2s;
    box-shadow: 0 0 10px var(--accent-primary);
}
#cursor-ring {
    width: 40px;
    height: 40px;
    border: 1px solid var(--accent-primary);
    border-radius: 50%;
    z-index: 9998;
    transition: width 0.3s, height 0.3s, border-color 0.3s, background 0.3s;
    mix-blend-mode: screen;
}

/* === BACKGROUND SYSTEM === */
#bg-container {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #111 0%, var(--bg-base) 100%);
}

.grid {
    position: absolute;
    top: 0; left: -50%; width: 200%; height: 200%;
    background-image: 
        linear-gradient(rgba(0, 240, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    transform: perspective(500px) rotateX(60deg) translateY(-100px) translateZ(-200px);
    animation: gridMove 10s linear infinite;
    opacity: 0.3;
    will-change: transform;
}

@keyframes gridMove {
    0% { transform: perspective(500px) rotateX(60deg) translateY(0) translateZ(-200px); }
    100% { transform: perspective(500px) rotateX(60deg) translateY(50px) translateZ(-200px); }
}

.aurora {
    position: absolute;
    top: 50%; left: 50%;
    width: 100%; height: 100%;
    background: conic-gradient(from 0deg at 50% 50%, 
        transparent 0deg, 
        var(--accent-primary) 90deg, 
        var(--accent-tertiary) 180deg, 
        var(--accent-secondary) 270deg, 
        transparent 360deg);
    filter: blur(120px) opacity(0.15);
    transform: translate(-50%, -50%);
    animation: rotateAurora 30s linear infinite;
    will-change: transform;
}

@keyframes rotateAurora {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* === BOOT SEQUENCE === */
#boot-screen {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 40px;
    font-family: var(--font-mono);
    color: var(--accent-primary);
    font-size: 14px;
    line-height: 1.5;
    transition: opacity 1s ease-out, visibility 1s ease-out;
}
.boot-line {
    opacity: 0;
    margin-bottom: 5px;
    text-shadow: 0 0 5px var(--accent-primary);
}

/* === LIQUID GLASS SYSTEM === */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.4s ease, box-shadow 0.4s ease;
    transform-style: preserve-3d;
}

.glass-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(125deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 40%, rgba(255,255,255,0) 100%);
    pointer-events: none;
    z-index: 1;
}

.glass-panel::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    mix-blend-mode: overlay;
    z-index: 2;
}

.glass-panel:hover::after { opacity: 1; }
.glass-panel:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 30px 60px rgba(0,0,0,0.5), 0 0 20px rgba(0, 240, 255, 0.2), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* === LAYOUT === */
main {
    opacity: 0;
    transition: opacity 1s ease;
    position: relative;
    z-index: 10;
}

section {
    min-height: 100vh;
    padding: 120px 5vw 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
}

.section-header {
    font-family: var(--font-mono);
    font-size: 2rem;
    color: #fff;
    margin-bottom: 60px;
    display: flex;
    align-items: center;
    gap: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.section-header::before {
    content: '';
    width: 60px; height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), transparent);
    display: block;
}

/* === HUD NAVIGATION === */
#hud-nav {
    position: fixed;
    top: 30px; left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    gap: 20px;
    padding: 10px 20px;
    border-radius: 40px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
}

.nav-link {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 8px 16px;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.nav-link:hover, .nav-link:focus-visible {
    color: var(--accent-primary);
    text-shadow: 0 0 8px var(--accent-primary);
}

/* === HERO SECTION === */
#hero { align-items: center; text-align: center; overflow: hidden; width: 100%; }
.hero-container { position: relative; z-index: 2; width: 100%; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 30px;
    border: 1px solid var(--accent-primary);
    background: rgba(0, 240, 255, 0.05);
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1px;
    margin-bottom: 40px;
    text-transform: uppercase;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.status-dot {
    width: 8px; height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 240, 255, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(0, 240, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 240, 255, 0); }
}

.glitch-title {
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 900;
    line-height: 1;
    margin-bottom: 20px;
    position: relative;
    text-transform: uppercase;
    letter-spacing: -2px;
    background: linear-gradient(180deg, #fff 0%, #a0aab8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    margin-bottom: 40px;
    display: flex;
    gap: 25px;
    justify-content: center;
}

.subtitle span { position: relative; letter-spacing: 1px; }
.subtitle span:not(:last-child)::after {
    content: '//';
    position: absolute;
    right: -18px;
    color: var(--accent-secondary);
    opacity: 0.6;
}

.metrics-ring {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 700px; height: 700px;
    border-radius: 50%;
    border: 1px dashed rgba(255,255,255,0.05);
    z-index: -1;
    pointer-events: none;
    animation: rotateRing 60s linear infinite;
    will-change: transform;
}

.metrics-ring::before {
    content: '';
    position: absolute;
    inset: 30px;
    border-radius: 50%;
    border: 1px solid rgba(0, 240, 255, 0.05);
    border-top-color: var(--accent-primary);
    border-bottom-color: var(--accent-secondary);
    animation: rotateRing 20s linear infinite reverse;
}

@keyframes rotateRing {
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* === ABOUT SECTION === */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.about-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
}
.about-text p { margin-bottom: 20px; }
.about-text strong { color: #fff; }

/* === PROJECTS SECTION === */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
    perspective: 1000px;
}

.project-card {
    height: auto;
    min-height: 450px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.project-content {
    transform: translateZ(40px);
    z-index: 10;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.project-year {
    font-family: var(--font-mono);
    color: var(--accent-primary);
    font-size: 13px;
    letter-spacing: 1px;
}

.project-status {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 12px;
    background: rgba(0,240,255,0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(0,240,255,0.3);
}

.project-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #fff;
    letter-spacing: -0.5px;
}

.project-desc {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 25px;
    flex-grow: 1;
}

.project-tags {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.project-tags span {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    color: var(--text-muted);
}

.project-links {
    display: flex;
    gap: 15px;
    position: relative;
    z-index: 20;
    pointer-events: auto;
}

.project-links a {
    font-family: var(--font-mono);
    font-size: 12px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.8;
    transition: opacity 0.3s, color 0.3s;
}

.project-links a:hover {
    opacity: 1;
    color: var(--accent-primary);
}

.project-hologram {
    position: absolute;
    top: 20px; left: 20px; right: 20px; bottom: 200px;
    background: radial-gradient(circle at center, rgba(0,240,255,0.1) 0%, transparent 70%);
    border: 1px solid rgba(0, 240, 255, 0.1);
    border-radius: 16px;
    transform: translateZ(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.project-card:hover .project-hologram {
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.1) inset;
}

/* === TIMELINE JOURNEY === */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 0;
}
.timeline::after {
    content: '';
    position: absolute;
    width: 2px;
    background: linear-gradient(180deg, transparent, var(--accent-primary), transparent);
    top: 0; bottom: 0; left: 50%;
    margin-left: -1px;
}
.timeline-item {
    padding: 10px 40px 40px;
    position: relative;
    width: 50%;
}
.timeline-item::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    right: -8px; top: 15px;
    background: var(--bg-base);
    border: 3px solid var(--accent-primary);
    border-radius: 50%;
    z-index: 1;
    box-shadow: 0 0 10px var(--accent-primary);
}
.left-item { left: 0; text-align: right; }
.right-item { left: 50%; }
.right-item::after { left: -8px; }

.timeline-content {
    padding: 20px;
}
.timeline-date {
    font-family: var(--font-mono);
    color: var(--accent-primary);
    font-size: 13px;
    margin-bottom: 10px;
}
.timeline-title {
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 10px;
}
.timeline-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* === RESEARCH LAB === */
.lab-grid {
    display: grid;
    grid-template-columns: 1fr 2.5fr;
    gap: 40px;
    height: 550px;
}

.lab-terminal {
    padding: 25px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: #4af626;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-color: rgba(74, 246, 38, 0.2);
}
.lab-terminal:hover {
    border-color: #4af626;
    box-shadow: 0 0 30px rgba(74, 246, 38, 0.1), inset 0 1px 0 rgba(74, 246, 38, 0.2);
}

.terminal-header {
    border-bottom: 1px solid rgba(74, 246, 38, 0.3);
    padding-bottom: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    opacity: 0.8;
}
.terminal-output {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
}
.log-line { margin-bottom: 8px; opacity: 0.8; line-height: 1.4; word-wrap: break-word; }
.log-line.warn { color: #ffb000; }
.log-line.error { color: #ff0055; }
.log-line.success { color: #00f0ff; }

.lab-modules {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    overflow-y: auto;
    padding-right: 10px;
    align-items: start;
}

.lab-module {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.module-icon {
    width: 48px; height: 48px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}
.lab-module:hover .module-icon {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
    transform: scale(1.05);
}
.module-title {
    font-family: var(--font-mono);
    font-size: 15px;
    color: #fff;
    margin-bottom: 10px;
}
.module-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* === SKILLS === */
.skills-panel {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 50px;
    padding: 50px;
}

.skill-group { margin-bottom: 40px; }
.skill-group-title {
    font-family: var(--font-mono);
    color: var(--accent-primary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
}
.skill-group-title::after {
    content: ''; flex-grow: 1; height: 1px;
    background: linear-gradient(90deg, rgba(0,240,255,0.3), transparent);
}

.skill-bar-container { margin-bottom: 20px; }
.skill-info {
    display: flex; justify-content: space-between;
    font-family: var(--font-mono); font-size: 12px;
    color: var(--text-main); margin-bottom: 10px;
}
.skill-bar {
    height: 6px; background: rgba(255,255,255,0.05);
    border-radius: 3px; overflow: hidden; position: relative;
}
.skill-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-tertiary));
    box-shadow: 0 0 10px var(--accent-primary);
    border-radius: 3px; position: relative;
    transition: width 1.5s cubic-bezier(0.1, 0.8, 0.2, 1);
}

.neural-node-container {
    position: relative; height: 100%; min-height: 400px;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px; background: rgba(0,0,0,0.3);
    overflow: hidden; box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
}
canvas#neural-net { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }

/* === CONTACT === */
.contact-container {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding: 60px;
}
.contact-title {
    font-size: 2.5rem; color: #fff; margin-bottom: 20px;
}
.contact-desc {
    color: var(--text-muted); margin-bottom: 40px; line-height: 1.6;
}
.contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 30px;
    transition: all 0.3s ease;
    cursor: none;
}
.contact-btn:hover {
    background: var(--accent-primary);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}
.social-links {
    display: flex; justify-content: center; gap: 30px; margin-top: 50px;
}
.social-links a {
    color: var(--text-muted); transition: color 0.3s ease;
}
.social-links a:hover { color: var(--accent-primary); }

/* === MOBILE MENU BUTTON === */
#mobile-menu-btn {
    display: none;
    position: fixed;
    top: 25px;
    right: 5vw;
    z-index: 2000;
    width: 50px;
    height: 50px;
    background: rgba(10, 15, 30, 0.7);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
}

#mobile-menu-btn .hamburger-line {
    width: 24px;
    height: 2px;
    background: var(--accent-primary);
    transition: all 0.3s ease;
    border-radius: 2px;
    box-shadow: 0 0 5px var(--accent-primary);
}

#mobile-menu-btn.open .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
#mobile-menu-btn.open .hamburger-line:nth-child(2) {
    opacity: 0;
}
#mobile-menu-btn.open .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* === RESPONSIVE & REDUCED MOTION === */
@media (max-width: 1100px) {
    .lab-grid, .skills-panel, .about-grid { grid-template-columns: 1fr; height: auto; }
    .neural-node-container { height: 300px; min-height: 300px; }
    .timeline::after { left: 31px; }
    .timeline-item { width: 100%; padding-left: 70px; padding-right: 20px; }
    .left-item { text-align: left; }
    .right-item { left: 0; }
    .timeline-item::after { left: 23px; right: auto; }
}

@media (max-width: 768px) {
    #mobile-menu-btn {
        display: flex;
    }
    
    #hud-nav {
        flex-direction: column;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        transform: translateY(-100%);
        border-radius: 0;
        border: none;
        background: rgba(3, 3, 5, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        justify-content: center;
        align-items: center;
        gap: 30px;
        opacity: 0;
        visibility: hidden;
        transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s;
    }
    
    #hud-nav.menu-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-link {
        font-size: 1.2rem;
        padding: 15px 30px;
    }

    .projects-grid, .lab-modules { grid-template-columns: 1fr; }
    .metrics-ring { width: 300px; height: 300px; }
    section { padding: 100px 5vw 40px; }
    
    /* Hero Section Stacking */
    .subtitle {
        flex-direction: column;
        gap: 10px;
        align-items: center;
        text-align: center;
    }
    .subtitle span::after {
        display: none;
    }
    
    /* Animation Optimizations for mobile (Preserving effects) */
    .aurora {
        filter: blur(80px) opacity(0.2);
    }
    
    /* Hide custom cursor on mobile */
    #cursor-dot, #cursor-ring { display: none; }
    * { cursor: auto !important; }

    /* Fix clickability of links inside 3D cards on mobile */
    .glass-panel {
        transform-style: flat !important;
    }
    .project-content {
        transform: none !important;
        position: relative;
        z-index: 20;
    }
    .project-links {
        position: relative;
        z-index: 30;
    }
}

@media (prefers-reduced-motion: reduce) {
    .grid, .aurora, .metrics-ring { animation: none; opacity: 0.1; }
    .tilt-card { transform: none !important; transition: none !important; }
    #cursor-dot, #cursor-ring { display: none; }
    * { cursor: auto !important; }
    html { scroll-behavior: auto; }
}
