:root {
    --bg: #030408;
    --bg-alt: #0a0c12;
    --primary: #00d2ff;
    --secondary: #7b2fff;
    --accent: #ff2d92;
    --glass: rgba(255, 255, 255, 0.02);
    --glass-hover: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.05);
    --text: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.5);
    --glow-cyan: 0 0 40px rgba(0, 210, 255, 0.3);
    --glow-purple: 0 0 40px rgba(123, 47, 255, 0.3);
}

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

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    cursor: crosshair;
    position: relative;
}

/* Animated Gradient Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(0, 210, 255, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 80% 20%, rgba(123, 47, 255, 0.06), transparent),
        radial-gradient(ellipse 50% 30% at 60% 80%, rgba(255, 45, 146, 0.04), transparent);
    z-index: -2;
    animation: gradientShift 20s ease-in-out infinite alternate;
}

@keyframes gradientShift {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Grid Pattern Overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: -1;
    pointer-events: none;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--primary);
    color: var(--bg);
    padding: 10px 20px;
    z-index: 9999;
    text-decoration: none;
    font-weight: 700;
    transition: top 0.3s;
}

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

/* Focus Visible for Keyboard Navigation */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
}

button:focus-visible { outline-offset: 2px; }

/* Glassmorphism Layers */
.glass {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

/* Navbar */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 30px 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    background: linear-gradient(to bottom, rgba(3, 4, 8, 0.9), transparent);
    backdrop-filter: blur(10px);
}

.logo {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links { display: flex; list-style: none; gap: 40px; }
.nav-links a {
    text-decoration: none;
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: 0.4s;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--primary);
    transition: 0.3s;
}

.nav-links a:hover { color: var(--primary); }
.nav-links a:hover::after { width: 100%; }

/* Hero */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    padding-left: 10%;
    position: relative;
}

#three-container {
    position: absolute;
    inset: 0;
    z-index: -1;
}

/* Animated floating orbs */
.hero::before,
.hero::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 15s ease-in-out infinite;
}

.hero::before {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: 20%;
    right: 10%;
    animation-delay: 0s;
}

.hero::after {
    width: 300px;
    height: 300px;
    background: var(--secondary);
    bottom: 20%;
    right: 30%;
    animation-delay: -7s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

.hero-content { max-width: 800px; position: relative; z-index: 1; }
.hero h1 {
    font-size: 7rem;
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -4px;
    margin-bottom: 30px;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255,255,255,0.3);
    position: relative;
}

.hero h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.hero h1 span { color: var(--text); -webkit-text-stroke: 0; }

.hero p {
    font-size: 1rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 50px;
}

/* Cards & Sections */
section { padding: 200px 10%; }

section:nth-child(even) {
    background: linear-gradient(180deg, transparent, var(--bg-alt), transparent);
}

.section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 5px;
    color: var(--primary);
    margin-bottom: 20px;
    display: block;
    text-shadow: 0 0 20px var(--primary);
}

.section-title {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 80px;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-dim) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2px;
    background: var(--glass-border);
    position: relative;
}

.grid::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    z-index: -1;
    opacity: 0.1;
    border-radius: 2px;
}

.card {
    padding: 80px 40px;
    background: var(--bg);
    transition: 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0;
    transition: 0.4s;
}

.card:hover {
    background: var(--glass-hover);
    transform: translateY(-4px);
    box-shadow: var(--glow-cyan);
}

.card:hover::before { opacity: 1; }

.card:nth-child(2):hover { box-shadow: var(--glow-purple); }
.card:nth-child(3):hover { box-shadow: 0 0 40px rgba(255, 45, 146, 0.3); }
.card:nth-child(4):hover { box-shadow: 0 0 40px rgba(0, 210, 255, 0.2); }

.card img {
    width: 50px;
    height: 50px;
    margin-bottom: 30px;
    filter: grayscale(1) brightness(2);
    transition: 0.4s;
}

.card:hover img {
    filter: grayscale(0) brightness(1.5);
    transform: scale(1.1);
}

.card h3 { font-size: 1.5rem; margin-bottom: 20px; font-weight: 700; }
.card p { color: var(--text-dim); font-size: 0.9rem; line-height: 1.8; }

/* Work */
.projects-list { display: flex; flex-direction: column; position: relative; }

.project-row {
    padding: 60px 0;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.4s;
    text-decoration: none;
    position: relative;
}

.project-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: 0.4s;
}

.project-row:hover::before { width: 20px; }

.project-row:hover {
    padding-left: 50px;
    color: var(--primary);
    border-color: rgba(0, 210, 255, 0.3);
    background: linear-gradient(90deg, rgba(0, 210, 255, 0.05), transparent);
}

.project-row:nth-child(even):hover {
    color: var(--secondary);
    border-color: rgba(123, 47, 255, 0.3);
    background: linear-gradient(90deg, rgba(123, 47, 255, 0.05), transparent);
}

.project-row:nth-child(even):hover::before {
    background: linear-gradient(90deg, var(--secondary), var(--accent));
}

.project-row h3 {
    font-size: 2.5rem;
    color: inherit;
    transition: 0.4s;
}

.project-row:hover h3 {
    text-shadow: 0 0 30px currentColor;
}

.project-row span {
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: 0.4s;
}

.project-row:hover span { color: var(--text); }

/* Contact */
.contact-box {
    padding: 100px;
    text-align: center;
    position: relative;
}

.contact-box::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    opacity: 0.1;
    filter: blur(60px);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.1; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.15; }
}

.contact-box h2 {
    font-size: 5rem;
    font-weight: 900;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.contact-btn {
    display: inline-block;
    padding: 20px 60px;
    border: 1px solid var(--text);
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    transition: 0.4s;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.contact-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: 0.4s;
    z-index: -1;
}

.contact-btn:hover {
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 30px rgba(0, 210, 255, 0.5);
}

.contact-btn:hover::before { opacity: 1; }

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
}

.menu-toggle span {
    width: 25px;
    height: 2px;
    background: var(--text);
    transition: 0.3s;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: rotate(45deg) translate(6px, 6px); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: rotate(-45deg) translate(6px, -6px); }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .hero h1 { font-size: 4rem; }
}

@media (max-width: 768px) {
    /* Disable scanlines on mobile for performance */
    body.scanlines::after { display: none; }

    /* Hide grid pattern on small screens */
    body::after { background-size: 40px 40px; opacity: 0.5; }

    /* Smaller floating orbs for mobile */
    .hero::before { width: 200px; height: 200px; top: 10%; }
    .hero::after { width: 150px; height: 150px; bottom: 10%; }

    .menu-toggle { display: flex; }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(3, 4, 8, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 30px;
        gap: 25px;
        border-bottom: 1px solid var(--glass-border);
    }

    .nav-links.active { display: flex; }

    nav { padding: 15px 20px; }
    .logo { font-size: 1rem; }

    .hero {
        padding-left: 5%;
        padding-right: 5%;
        align-items: flex-start;
        padding-top: 120px;
        height: auto;
        min-height: 100vh;
    }

    .hero h1 {
        font-size: 2.8rem;
        letter-spacing: -2px;
        line-height: 1;
    }

    .hero h1::after { width: 60px; }

    .hero-content { max-width: 100%; }

    .hero p {
        font-size: 0.75rem;
        margin-bottom: 30px;
    }

    /* Section spacing */
    section { padding: 80px 5%; }
    section:nth-child(even) { background: transparent; }

    .section-label {
        font-size: 0.6rem;
        letter-spacing: 3px;
        padding-left: 25px;
    }

    .section-label::before {
        font-size: 2.5rem;
        top: -5px;
    }

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

    /* Cards on mobile */
    .grid {
        grid-template-columns: 1fr;
        gap: 1px;
    }

    .card {
        padding: 40px 25px;
    }

    .card:hover {
        transform: translateY(-2px);
    }

    .card img {
        width: 40px;
        height: 40px;
    }

    /* Projects on mobile */
    .project-row {
        padding: 30px 0;
        flex-wrap: wrap;
        gap: 10px;
    }

    .project-row:hover {
        padding-left: 20px;
    }

    .project-row h3 {
        font-size: 1.5rem;
        width: 100%;
    }

    .project-row span {
        font-size: 0.7rem;
    }

    /* Contact on mobile */
    .contact-box {
        padding: 60px 25px;
    }

    .contact-box h2 {
        font-size: 2.2rem;
        margin-bottom: 30px;
    }

    .contact-box::before {
        width: 200px;
        height: 200px;
    }

    .contact-btn {
        padding: 16px 40px;
        font-size: 0.9rem;
    }

    /* Footer */
    footer { padding: 30px 20px; }
}

/* Extra small devices */
@media (max-width: 375px) {
    .hero h1 { font-size: 2.2rem; }

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

    .card { padding: 35px 20px; }

    .contact-btn {
        padding: 14px 30px;
        font-size: 0.8rem;
    }
}

/* Footer */
footer {
    padding: 40px;
    text-align: center;
    border-top: 1px solid var(--glass-border);
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

/* Section Number Decoration */
.section-label {
    position: relative;
    padding-left: 30px;
}

.section-label::before {
    content: attr(data-number);
    position: absolute;
    left: 0;
    font-size: 4rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.03);
    line-height: 1;
    top: -10px;
}

/* Glowing text effect for key elements */
.glow-text {
    text-shadow: 0 0 20px var(--primary), 0 0 40px var(--primary);
}

/* Scanline effect for tech feel */
@keyframes scanline {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}

body.scanlines::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 9999;
    opacity: 0.15;
}

/* Decorative corner accents */
.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border-top: 1px solid var(--primary);
    border-left: 1px solid var(--primary);
    opacity: 0.3;
}

/* Noise texture overlay */
body.noise::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 9998;
}
