:root {
    /* Premium HSL Design System */
    --bg-h: 240;
    --bg-s: 10%;
    --bg-l: 2%;
    --bg-color: hsl(var(--bg-h), var(--bg-s), var(--bg-l));

    --accent-h: 185;
    --accent-s: 100%;
    --accent-l: 50%;
    --accent-color: hsl(var(--accent-h), var(--accent-s), var(--accent-l));
    --accent-glow: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.3);

    --secondary-h: 285;
    --secondary-s: 90%;
    --secondary-l: 50%;
    --secondary-color: hsl(var(--secondary-h), var(--secondary-s), var(--secondary-l));

    --text-h: 0;
    --text-s: 0%;
    --text-l: 98%;
    --text-primary: hsl(var(--text-h), var(--text-s), var(--text-l));
    --text-secondary: hsl(215, 15%, 70%);

    --glass-bg: hsla(240, 15%, 5%, 0.7);
    --glass-border: hsla(0, 0%, 100%, 0.08);

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-accent: 'Orbitron', sans-serif;
    --transition-premium: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: none;
    /* We'll use custom cursor */
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Cinematic Grain Overlay */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://grainy-gradients.vercel.app/noise.svg');
    opacity: 0.04;
    pointer-events: none;
    z-index: 9999;
    filter: contrast(150%) brightness(150%);
}

/* --- Custom Cursor --- */
.cursor-dot,
.cursor-outline {
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9999;
    transition: transform 0.1s ease-out, opacity 0.3s ease;
}

.cursor-dot {
    width: 6px;
    height: 6px;
    background-color: var(--accent-color);
}

.cursor-outline {
    width: 30px;
    height: 30px;
    border: 1px solid var(--accent-color);
    transition: all 0.2s ease-out;
}

/* --- Header & Nav --- */
header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 10%;
    z-index: 1000;
    background: linear-gradient(to bottom, rgba(5, 5, 5, 0.8), transparent);
    backdrop-filter: blur(10px);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-accent);
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 2px;
}

.logo span {
    color: var(--accent-color);
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-family: var(--font-accent);
    font-size: 0.8rem;
    text-transform: uppercase;
    transition: color 0.3s ease;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent-color);
}

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

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

/* --- Hero Section --- */
.hero-section {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 10%;
    text-align: center;
}

.grid-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 243, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    mask-image: radial-gradient(circle at center, black 30%, transparent 80%);
}

.hero-section::before {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: var(--accent-color);
    filter: blur(150px);
    opacity: 0.1;
    top: 20%;
    left: 10%;
}

.hero-section::after {
    content: '';
    position: absolute;
    width: 250px;
    height: 250px;
    background: var(--secondary-color);
    filter: blur(150px);
    opacity: 0.1;
    bottom: 20%;
    right: 10%;
}

.glitch {
    font-family: var(--font-accent);
    font-size: 6rem;
    font-weight: 900;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 5px;
    color: white;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #00fff9, 2px 2px #ff00c1;
    animation: glitch-anim2 1s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(31px, 9999px, 94px, 0);
    }

    20% {
        clip: rect(62px, 9999px, 42px, 0);
    }

    40% {
        clip: rect(16px, 9999px, 78px, 0);
    }

    60% {
        clip: rect(88px, 9999px, 22px, 0);
    }

    80% {
        clip: rect(54px, 9999px, 66px, 0);
    }

    100% {
        clip: rect(9px, 9999px, 85px, 0);
    }
}

@keyframes glitch-anim2 {
    0% {
        clip: rect(10px, 9999px, 30px, 0);
    }

    20% {
        clip: rect(40px, 9999px, 60px, 0);
    }

    40% {
        clip: rect(70px, 9999px, 90px, 0);
    }

    60% {
        clip: rect(20px, 9999px, 40px, 0);
    }

    80% {
        clip: rect(50px, 9999px, 70px, 0);
    }

    100% {
        clip: rect(80px, 9999px, 100px, 0);
    }
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

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

/* --- Buttons --- */
.btn {
    padding: 1rem 2rem;
    font-family: var(--font-accent);
    font-size: 0.85rem;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 2px;
    position: relative;
    border: none;
    background: none;
    color: white;
    cursor: none;
    transition: all 0.3s ease;
    overflow: hidden;
}

.btn-primary {
    background-color: var(--accent-color);
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-primary:hover {
    box-shadow: 0 0 35px var(--accent-color);
    transform: translateY(-2px);
}

.btn-outline {
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.btn-outline:hover {
    background-color: rgba(0, 243, 255, 0.1);
    transform: translateY(-2px);
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.scroll-indicator span {
    font-size: 0.7rem;
    font-family: var(--font-accent);
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.scroll-indicator .line {
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, var(--accent-color), transparent);
    animation: scroll-line 2s infinite;
}

@keyframes scroll-line {
    0% {
        transform: scaleY(0);
        transform-origin: top;
    }

    50% {
        transform: scaleY(1);
        transform-origin: top;
    }

    51% {
        transform: scaleY(1);
        transform-origin: bottom;
    }

    100% {
        transform: scaleY(0);
        transform-origin: bottom;
    }
}

/* --- Common Section Styles --- */
section {
    padding: 100px 10%;
    min-height: 100vh;
}

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

.section-header {
    margin-bottom: 4rem;
}

.section-tag {
    color: var(--accent-color);
    font-family: var(--font-accent);
    font-size: 0.9rem;
    display: block;
    margin-bottom: 10px;
}

h2 {
    font-family: var(--font-accent);
    font-size: 3rem;
    text-transform: uppercase;
    letter-spacing: 3px;
}

/* --- Reveal Animation --- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* --- About Section --- */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-text p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
}

.tech-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tech-item span {
    font-family: var(--font-accent);
    font-size: 0.8rem;
    margin-bottom: 8px;
    display: block;
}

.bar-bg {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    position: relative;
}

.bar {
    height: 100%;
    background: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-glow);
    border-radius: 2px;
}

.avatar-container {
    position: relative;
    width: fit-content;
    margin: 0 auto;
}

#profile-img {
    width: 100%;
    max-width: 350px;
    height: 350px;
    object-fit: cover;
    filter: grayscale(1) contrast(1.2);
    border: 1px solid var(--glass-border);
}

.frame {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 100%;
    height: 100%;
    border: 1px solid var(--accent-color);
    z-index: -1;
    transition: all 0.3s ease;
}

.avatar-container:hover .frame {
    top: 10px;
    left: 10px;
}

/* --- Project Grid --- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: var(--transition-premium);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.project-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.05), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.project-card:hover {
    transform: translateY(-12px) scale(1.02);
    border-color: var(--accent-color);
    box-shadow: 0 20px 40px -15px hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.2);
}

.project-card:hover::before {
    transform: translateX(100%);
}

.project-num {
    font-family: var(--font-accent);
    color: var(--accent-color);
    font-size: 0.8rem;
    margin-bottom: 1rem;
    display: block;
}

.project-card h3 {
    font-family: var(--font-accent);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.project-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.project-tags {
    display: flex;
    gap: 10px;
}

.project-tags span {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 4px;
    color: var(--text-secondary);
}

/* --- Contact Section --- */
.contact-container {
    max-width: 600px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.input-group {
    position: relative;
}

.input-group input,
.input-group textarea {
    width: 100%;
    background: transparent !important;
    /* Ensure background stays transparent */
    border: none;
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 0;
    color: white;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: border-color 0.3s;
    outline: none;
}

/* Fix for browser autofill background changing */
.input-group input:-webkit-autofill,
.input-group input:-webkit-autofill:hover,
.input-group input:-webkit-autofill:focus,
.input-group textarea:-webkit-autofill,
.input-group textarea:-webkit-autofill:hover,
.input-group textarea:-webkit-autofill:focus {
    -webkit-text-fill-color: white;
    -webkit-box-shadow: 0 0 0px 1000px var(--bg-color) inset;
    transition: background-color 5000s ease-in-out 0s;
}

.input-group label {
    position: absolute;
    top: 1rem;
    left: 0;
    color: var(--text-secondary);
    font-family: var(--font-accent);
    font-size: 0.8rem;
    pointer-events: none;
    transition: all 0.3s;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.input-group input:focus~label,
.input-group input:valid~label,
.input-group textarea:focus~label,
.input-group textarea:valid~label {
    top: -10px;
    color: var(--accent-color);
    font-size: 0.7rem;
}

/* --- Footer --- */
footer {
    padding: 4rem 10%;
    background: #000;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--glass-border);
    padding-top: 2rem;
}

.footer-content p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: var(--font-accent);
}

.social-links {
    display: flex;
    gap: 2rem;
}

.social-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-links a:hover {
    color: var(--accent-color);
    transform: translateY(-5px);
    text-shadow: 0 0 10px var(--accent-glow);
}



/* --- Media Queries --- */
@media (max-width: 768px) {
    .glitch {
        font-size: 3rem;
    }

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

    .hero-section {
        text-align: left;
    }

    .hero-content {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-cta {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .nav-links {
        display: none;
    }
}