:root {
    --bg: #09090b;
    --surface: #111113;
    --surface-alt: #18181b;
    --surface-tag: #1f1f23;
    --border: #27272a;
    --border-hover: #7c3aed;

    --purple: #7c3aed;
    --purple-hover: #6d28d9;
    --purple-light: #a78bfa;
    --purple-accent: #8b5cf6;
    --green: #4ade80;

    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #8b8b93;
    --dot: #52525b;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Inter", sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Background layers */

#bg-canvas {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    opacity: 0.6;
}

.cursor-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 450px;
    height: 450px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.16), transparent 70%);
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
    will-change: transform;
}

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--purple), var(--purple-light));
    box-shadow: 0 0 10px var(--purple-light);
    z-index: 300;
}

@media (pointer: fine) {
    body.js-ready .cursor-glow {
        opacity: 1;
    }
}


/* Skip link */

.skip-link {
    position: absolute;
    top: -100px;
    left: 20px;
    background: var(--purple);
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    z-index: 200;
    text-decoration: none;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 20px;
}

/* Focus states */

a:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--purple-light);
    outline-offset: 3px;
    border-radius: 4px;
}


/* Navigation */

nav {
    position: sticky;
    top: 0;
    z-index: 100;

    width: 100%;
    max-width: 1200px;
    margin: auto;
    padding: 25px 30px;

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

    background: rgba(9, 9, 11, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(124, 58, 237, 0.15);
}

.logo {
    font-size: 22px;
    font-weight: 800;
}

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

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: white;
}


/* Hero */

.hero {
    min-height: 80vh;
    max-width: 1200px;
    margin: auto;
    padding: 80px 30px;

    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 60px;
}

.intro {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.hero h1 {
    font-size: 70px;
    line-height: 1;
    margin-bottom: 20px;

    background: linear-gradient(90deg, #ffffff, var(--purple-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

/* Glitch-in effect, plays once on load */

@keyframes glitch-1 {
    0%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
    20% { clip-path: inset(20% 0 60% 0); transform: translate(-4px, 2px); }
    40% { clip-path: inset(60% 0 10% 0); transform: translate(4px, -2px); }
    60% { clip-path: inset(10% 0 70% 0); transform: translate(-3px, 1px); }
    80% { clip-path: inset(80% 0 5% 0); transform: translate(3px, -1px); }
}

.glitch-in::before,
.glitch-in::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(90deg, #ffffff, var(--purple-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0.8;
}

.glitch-in::before {
    color: var(--purple-light);
    animation: glitch-1 0.5s steps(2, end) 2;
    animation-fill-mode: forwards;
}

.glitch-in::after {
    color: #4ade80;
    animation: glitch-1 0.5s steps(2, end) 2 reverse;
    animation-fill-mode: forwards;
}

@media (prefers-reduced-motion: reduce) {
    .glitch-in::before,
    .glitch-in::after {
        display: none;
    }
}

.hero h2 {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.hero-description {
    max-width: 550px;
    color: var(--text-muted);
    margin-bottom: 30px;
}


/* Buttons */

.hero-buttons,
.contact-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 22px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.3s, transform 0.3s, border-color 0.3s;
    display: inline-block;
}

.primary {
    background: var(--purple);
    color: white;
}

.primary:hover {
    background: var(--purple-hover);
    transform: translateY(-2px);
}

.secondary {
    border: 1px solid var(--border);
    color: white;
}

.secondary:hover {
    background: var(--surface-alt);
    transform: translateY(-2px);
}


/* Code Window */

.hero-card {
    display: flex;
    justify-content: center;
}

.code-window {
    width: 100%;
    max-width: 500px;

    background: rgba(17, 17, 19, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: 12px;

    overflow: hidden;

    box-shadow:
        0 20px 50px rgba(124, 58, 237, 0.2),
        0 0 0 1px rgba(124, 58, 237, 0.08) inset;
}

.window-bar {
    height: 45px;
    background: var(--surface-alt);

    display: flex;
    align-items: center;
    gap: 8px;

    padding-left: 15px;
}

.window-bar span {
    width: 12px;
    height: 12px;

    border-radius: 50%;

    background: var(--dot);
}

pre {
    padding: 25px;
    color: #d4d4d8;
    overflow-x: auto;
}

.purple {
    color: var(--purple-light);
}

.green {
    color: var(--green);
}

.cursor {
    color: var(--purple-light);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}


/* Sections */

.section {
    max-width: 1200px;
    margin: auto;
    padding: 100px 30px;
}

.section-title {
    margin-bottom: 50px;
}

.section-title p {
    color: var(--purple-accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
}

.section-title h2 {
    font-size: 40px;
    margin-top: 10px;
}


/* About */

.about-box {
    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 12px;

    padding: 35px;

    color: var(--text-secondary);

    max-width: 850px;
}


/* Cards + Projects share a common "tile" look */

.cards,
.projects {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.card,
.project {
    background: rgba(17, 17, 19, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    border: 1px solid var(--border);
    border-radius: 12px;

    padding: 30px;
    position: relative;

    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
    transform-style: preserve-3d;
    will-change: transform;
}

.card::before,
.project::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(135deg, var(--purple-light), var(--purple), transparent 60%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.card:hover,
.project:hover {
    border-color: var(--border-hover);
    box-shadow: 0 20px 40px rgba(124, 58, 237, 0.15);
}

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

@media (prefers-reduced-motion: reduce) {
    .card,
    .project {
        transform: none !important;
    }
}

.icon {
    font-size: 35px;
    margin-bottom: 20px;
}

.card h3 {
    margin-bottom: 10px;
}

.card p,
.project p {
    color: var(--text-muted);
}


/* Skills */

.skills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.skills span {
    padding: 12px 18px;

    background: var(--surface-alt);
    border: 1px solid var(--border);

    border-radius: 8px;

    color: var(--text-secondary);
}


/* Projects */

.project-top {
    color: var(--purple-accent);
    font-size: 12px;
    font-weight: bold;

    margin-bottom: 25px;
}

.project h3 {
    font-size: 22px;
    margin-bottom: 10px;
}

.project p {
    margin-bottom: 20px;
}

.tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tags span {
    font-size: 12px;

    padding: 6px 10px;

    background: var(--surface-tag);

    border-radius: 5px;

    color: var(--text-muted);
}


/* Contact */

.contact {
    text-align: center;

    padding: 120px 30px;

    background: var(--surface);

    border-top: 1px solid var(--border);
}

.contact > p {
    color: var(--purple-accent);
    font-weight: bold;
    font-size: 13px;
    letter-spacing: 2px;
}

.contact h2 {
    font-size: 45px;
    margin: 15px 0 30px;
}

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


/* Footer */

footer {
    padding: 35px 30px;

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

    max-width: 1200px;
    margin: auto;

    color: var(--text-muted);
}


/* Scroll-in animation (see script.js) */

.section.pre-animate,
.contact.pre-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}


/* Reduced motion: no animation, no cursor blink */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .cursor {
        animation: none;
    }

    .section.pre-animate,
    .contact.pre-animate {
        transition: none;
    }
}


/* Mobile */

@media (max-width: 900px) {

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

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

    .hero h1 {
        font-size: 50px;
    }

}


@media (max-width: 600px) {

    nav {
        flex-direction: column;
        gap: 20px;
    }

    .nav-links {
        gap: 15px;
        font-size: 14px;
    }

    .hero {
        padding-top: 50px;
        min-height: auto;
    }

    .hero h1 {
        font-size: 42px;
    }

    .section-title h2 {
        font-size: 32px;
    }

    .contact h2 {
        font-size: 32px;
    }

    footer {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

}
