/* ===================================
   CSS Root Variables
   =================================== */

:root {
    --primary-color: #00d4ff;
    --secondary-color: #00ff88;
    --accent-color: #ff006e;
    --dark-bg: #0a0e27;
    --darker-bg: #050811;
    --card-bg: rgba(20, 28, 60, 0.6);
    --text-primary: #ffffff;
    --text-secondary: #b0b5d4;
    --border-color: rgba(0, 212, 255, 0.2);
    --gradient: linear-gradient(135deg, #00d4ff 0%, #00ff88 100%);
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ===================================
   Global Styles
   =================================== */

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

html {
    scroll-behavior: smooth;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

body.keyboard-nav *:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===================================
   Binary Background
   =================================== */

.binary-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 212, 255, 0.03) 2px,
            rgba(0, 212, 255, 0.03) 4px
        );
    background-size: 100% 100%;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: rgba(0, 212, 255, 0.05);
    z-index: -1;
    overflow: hidden;
    animation: scroll-binary 20s linear infinite;
}

.binary-bg::before {
    content: '01001001 00100000 01100001 01101101 00100000 01000001 01001001 00100000 01100100 01100101 01110110 01100101 01101100 01101111 01110000 01100101 01110010 00100000 01100001 01101110 01100100 00100000 01110000 01100001 01110011 01110011 01101001 01101111 01101110 01100001 01110100 01100101 00100000 01101001 01101110 00100000 01100011 01101100 01100101 01100001 01101110 00100000 01100011 01101111 01100100 01100101 00101110 00100000 01001001 00100000 01101100 01101001 01110110 01100101 00100000 01100001 01101110 01100100 00100000 01100010 01110010 01100101 01100001 01110100 01101000 01100101 00100000 01100010 01100001 01101110 01100001 01110010 01111001 00101110 00100000 01010000 01100001 01101110 01100100 01101001 01101100 01100001 00101110 ';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    white-space: pre-wrap;
    word-wrap: break-word;
    animation: scroll-binary-content 30s linear infinite;
}

.binary-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(10, 14, 39, 0.8) 100%);
    pointer-events: none;
}

@keyframes scroll-binary {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}

@keyframes scroll-binary-content {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}

/* ===================================
   Theme Toggle Button
   =================================== */

.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.5);
    background: rgba(0, 212, 255, 0.1);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* ===================================
   Navigation Bar
   =================================== */

.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    padding: 1rem 0;
    box-shadow: 0 4px 30px rgba(0, 212, 255, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

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

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
    font-weight: 500;
}

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

.nav-links a:hover {
    color: var(--primary-color);
}

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

/* ===================================
   Container & Layout
   =================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

section {
    padding: 6rem 0;
    position: relative;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    text-align: center;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    letter-spacing: 1px;
}

/* ===================================
   Hero Section
   =================================== */

.hero {
    padding-top: 10rem;
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-text h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 0.8s ease;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.8s ease 0.1s backwards;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
    animation: fadeInUp 0.8s ease 0.2s backwards;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease 0.3s backwards;
}

.btn {
    padding: 1rem 2rem;
    border-radius: 8px;
    border: 2px solid transparent;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--gradient);
    color: var(--darker-bg);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-secondary:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.2);
}

.social-links {
    display: flex;
    gap: 1.5rem;
    animation: fadeInUp 0.8s ease 0.4s backwards;
}

.social-icon {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    color: var(--primary-color);
    transition: var(--transition);
}

.social-icon:hover {
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-5px);
}

.social-icon svg {
    width: 24px;
    height: 24px;
}

.hero-visual {
    perspective: 1000px;
}

.floating-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    animation: float 3s ease-in-out infinite;
    box-shadow: 0 20px 60px rgba(0, 212, 255, 0.1);
}

.code-snippet {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.keyword {
    color: var(--primary-color);
    font-weight: bold;
}

.string {
    color: var(--secondary-color);
}

.comment {
    color: #6b7280;
    font-style: italic;
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   Tech Stack Section
   =================================== */

.tech-stack {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.05) 0%, rgba(0, 255, 136, 0.05) 100%);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
}

.tech-category {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.tech-category:hover {
    background: rgba(0, 212, 255, 0.08);
    border-color: var(--primary-color);
    transform: translateY(-5px);
}

.tech-category h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.tech-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tech-item {
    padding: 0.75rem 1rem;
    background: rgba(0, 255, 136, 0.05);
    border-left: 3px solid var(--secondary-color);
    border-radius: 4px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.tech-item:hover {
    background: rgba(0, 255, 136, 0.1);
    transform: translateX(5px);
}

/* ===================================
   Projects Section
   =================================== */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    opacity: 0;
    transform: translateY(20px);
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.project-card:hover::before {
    left: 100%;
}

.project-card:hover {
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.08);
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 212, 255, 0.2);
}

.project-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.project-icon {
    font-size: 2.5rem;
}

.project-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.7;
    font-size: 0.95rem;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.tech-badge {
    background: rgba(0, 255, 136, 0.1);
    color: var(--secondary-color);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    border: 1px solid rgba(0, 255, 136, 0.3);
    transition: var(--transition);
}

.tech-badge:hover {
    background: rgba(0, 255, 136, 0.2);
    border-color: var(--secondary-color);
}

.project-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    position: relative;
}

.project-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.project-link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* ===================================
   Contact Section
   =================================== */

.contact {
    background: linear-gradient(135deg, rgba(255, 0, 110, 0.05) 0%, rgba(0, 212, 255, 0.05) 100%);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.contact-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.contact-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.contact-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.contact-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient);
    z-index: -1;
    transition: left 0.3s ease;
}

.contact-btn:hover {
    border-color: var(--primary-color);
    color: var(--darker-bg);
    transform: translateY(-3px);
}

.contact-btn:hover::before {
    left: 0;
}

.contact-btn .icon {
    font-size: 1.3rem;
}

/* ===================================
   Footer
   =================================== */

.footer {
    background: rgba(5, 8, 17, 0.8);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {
    .hero-content {
        grid-template-columns: 1fr;
    }

    .hero-text h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .nav-links {
        gap: 1rem;
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .tech-grid {
        grid-template-columns: 1fr;
    }

    .contact-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .contact-btn {
        justify-content: center;
    }

    .theme-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 1rem;
    }

    .nav-links {
        gap: 0.5rem;
        font-size: 0.8rem;
    }

    .hero-text h1 {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .hero-description {
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 2rem;
    }

    .project-card {
        padding: 1.5rem;
    }

    .project-title {
        font-size: 1.2rem;
    }

    .container {
        padding: 0 1rem;
    }

    section {
        padding: 3rem 0;
    }

    .floating-card {
        padding: 1rem;
    }

    .code-snippet {
        font-size: 0.8rem;
    }
}

/* ===================================
   Print Styles
   =================================== */

@media print {
    .theme-toggle,
    .navbar,
    .footer {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    section {
        page-break-inside: avoid;
    }
}