/* ===== CSS Custom Properties (Design Tokens) ===== */
:root {
    /* Color Palette - Modern Dark Theme */
    --color-bg-primary: #0a0a0f;
    --color-bg-secondary: #12121a;
    --color-bg-tertiary: #1a1a25;
    --color-bg-card: #15151f;
    --color-bg-card-hover: #1c1c28;

    --color-text-primary: #f0f0f5;
    --color-text-secondary: #a0a0b0;
    --color-text-muted: #6a6a7a;

    --color-accent-primary: #6366f1;
    --color-accent-secondary: #8b5cf6;
    --color-accent-tertiary: #ec4899;
    --color-accent-success: #10b981;
    --color-accent-warning: #f59e0b;

    /* Gradients */
    --gradient-primary: linear-gradient(
        135deg,
        var(--color-accent-primary),
        var(--color-accent-secondary)
    );
    --gradient-accent: linear-gradient(
        135deg,
        var(--color-accent-secondary),
        var(--color-accent-tertiary)
    );
    --gradient-radial: radial-gradient(
        ellipse at center,
        var(--color-bg-secondary) 0%,
        var(--color-bg-primary) 70%
    );

    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* Typography */
    --font-primary: "Space Grotesk", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", monospace;

    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
    --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
    --text-lg: clamp(1.125rem, 1rem + 0.6vw, 1.25rem);
    --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
    --text-2xl: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
    --text-3xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);
    --text-4xl: clamp(2.5rem, 2rem + 3vw, 4rem);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md:
        0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg:
        0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-xl:
        0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
    --shadow-glow-accent: 0 0 60px rgba(139, 92, 246, 0.2);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --container-max: 1200px;
    --header-height: 4rem;
}

/* ===== Reset & Base Styles ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

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

.gradient-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: var(--color-accent-primary);
    top: -200px;
    right: -200px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--color-accent-secondary);
    bottom: -150px;
    left: -150px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: var(--color-accent-tertiary);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
    opacity: 0.2;
}

@keyframes float {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -30px) scale(1.05);
    }
    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }
    75% {
        transform: translate(-30px, -20px) scale(1.02);
    }
}

/* ===== Header & Navigation ===== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--header-height);
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-lg);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    text-decoration: none;
    transition: transform var(--transition-base);
}

.logo:hover {
    transform: scale(1.02);
}

.logo-text {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
}

.logo-accent {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    list-style: none;
}

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

.nav-links a::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width var(--transition-base);
}

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

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

.github-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all var(--transition-base);
}

.github-link::after {
    display: none;
}

.github-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* ===== Hero Section ===== */
.hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: var(--space-4xl);
    max-width: var(--container-max);
    margin: 0 auto;
    padding: calc(var(--header-height) + var(--space-4xl)) var(--space-lg)
        var(--space-4xl);
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--color-accent-primary);
    width: fit-content;
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--color-accent-success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

.hero-title {
    font-size: var(--text-4xl);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.gradient-text {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    max-width: 500px;
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow:
        var(--shadow-md),
        0 0 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow:
        var(--shadow-lg),
        0 0 30px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* ===== Hero Visual (Arcade Screen) ===== */
.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.arcade-screen {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 0 8px #1a1a25,
        0 0 0 10px #2a2a35,
        var(--shadow-xl),
        0 0 100px rgba(99, 102, 241, 0.2);
}

.scanlines {
    position: absolute;
    inset: 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: 10;
}

.screen-content {
    position: absolute;
    inset: 20px;
    background: #0a0a1a;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ===== Project Carousel ===== */
.project-carousel {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    display: flex;
    flex-direction: column;
}

.carousel-slide.active {
    opacity: 1;
}

.slide-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.slide-label {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--text-xs);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.5);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    z-index: 2;
}

.slide-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Pacman Slide */
.pacman-slide {
    background: linear-gradient(135deg, #0a0a2a 0%, #1a1a3a 100%);
}

.pacman-slide .ghost {
    position: absolute;
}

.pacman-slide .ghost-1 {
    left: 15%;
    top: 30%;
}

.pacman-slide .ghost-2 {
    left: 45%;
    top: 50%;
}

.pacman-slide .ghost-3 {
    right: 15%;
    top: 35%;
}

/* Racer Slide */
.racer-slide {
    background: linear-gradient(
        180deg,
        #87ceeb 0%,
        #228b22 30%,
        #333 60%,
        #333 100%
    );
}

.racer-slide .road {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200%;
    height: 50%;
    background: #333;
    transform-origin: bottom center;
    transform: translateX(-50%) perspective(300px) rotateX(60deg);
}

.racer-slide .trees {
    position: absolute;
    top: 30%;
    width: 100%;
    display: flex;
    justify-content: space-around;
}

.racer-slide .trees span {
    width: 20px;
    height: 30px;
    background: linear-gradient(180deg, #228b22 70%, #8b4513 70%);
    clip-path: polygon(
        50% 0%,
        100% 70%,
        80% 70%,
        80% 100%,
        20% 100%,
        20% 70%,
        0% 70%
    );
    animation: treeSway 2s ease-in-out infinite;
}

.racer-slide .trees span:nth-child(2) {
    animation-delay: -0.5s;
}
.racer-slide .trees span:nth-child(3) {
    animation-delay: -1s;
}
.racer-slide .trees span:nth-child(4) {
    animation-delay: -1.5s;
}

@keyframes treeSway {
    0%,
    100% {
        transform: rotate(-2deg);
    }
    50% {
        transform: rotate(2deg);
    }
}

/* Coming Soon Slide */
.coming-soon-slide {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    flex-direction: column;
}

.coming-soon-slide .code-rain {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-around;
    padding-top: 10px;
    overflow: hidden;
}

.coming-soon-slide .code-rain span {
    font-family: var(--font-mono);
    font-size: 12px;
    color: rgba(99, 102, 241, 0.4);
    animation: codeRain 3s linear infinite;
}

.coming-soon-slide .code-rain span:nth-child(1) {
    animation-delay: 0s;
}
.coming-soon-slide .code-rain span:nth-child(2) {
    animation-delay: -0.3s;
}
.coming-soon-slide .code-rain span:nth-child(3) {
    animation-delay: -0.6s;
}
.coming-soon-slide .code-rain span:nth-child(4) {
    animation-delay: -0.9s;
}
.coming-soon-slide .code-rain span:nth-child(5) {
    animation-delay: -1.2s;
}
.coming-soon-slide .code-rain span:nth-child(6) {
    animation-delay: -1.5s;
}
.coming-soon-slide .code-rain span:nth-child(7) {
    animation-delay: -1.8s;
}
.coming-soon-slide .code-rain span:nth-child(8) {
    animation-delay: -2.1s;
}
.coming-soon-slide .code-rain span:nth-child(9) {
    animation-delay: -2.4s;
}
.coming-soon-slide .code-rain span:nth-child(10) {
    animation-delay: -2.7s;
}

@keyframes codeRain {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(200px);
        opacity: 0;
    }
}

.coming-soon-slide .question-mark {
    font-size: 3rem;
    z-index: 1;
}

/* Carousel Indicators */
.carousel-indicators {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--space-sm);
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    padding: 0;
}

.indicator:hover {
    background: rgba(255, 255, 255, 0.5);
}

.indicator.active {
    background: var(--color-accent-primary);
    box-shadow: 0 0 10px var(--color-accent-primary);
}

.pixel-art {
    position: relative;
    width: 200px;
    height: 100px;
}

.ghost {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 12px 12px 0 0;
    animation: ghostFloat 3s ease-in-out infinite;
}

.ghost::before {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 24px;
    height: 8px;
    background: inherit;
    clip-path: polygon(
        0 0,
        8px 0,
        8px 100%,
        0 100%,
        0 0,
        8px 0,
        12px 0,
        12px 100%,
        8px 100%,
        16px 0,
        16px 100%,
        24px 100%,
        24px 0
    );
}

.ghost-1 {
    background: #ff0000;
    left: 20px;
    top: 30px;
    animation-delay: 0s;
}

.ghost-2 {
    background: #00ffff;
    left: 80px;
    top: 50px;
    animation-delay: -1s;
}

.ghost-3 {
    background: #ffb8ff;
    left: 140px;
    top: 35px;
    animation-delay: -2s;
}

.pacman {
    position: absolute;
    right: 30px;
    top: 40px;
    width: 28px;
    height: 28px;
    background: #ffff00;
    border-radius: 50%;
    clip-path: polygon(100% 50%, 50% 50%, 30% 15%, 50% 50%, 30% 85%, 50% 50%);
    animation: chomp 0.3s steps(2) infinite;
}

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

@keyframes chomp {
    0% {
        clip-path: polygon(
            100% 50%,
            50% 50%,
            40% 25%,
            50% 50%,
            40% 75%,
            50% 50%
        );
    }
    100% {
        clip-path: polygon(
            100% 50%,
            50% 50%,
            50% 0%,
            50% 50%,
            50% 100%,
            50% 50%
        );
    }
}

/* ===== Section Styles ===== */
.section-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
}

.section-label {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent-primary);
    margin-bottom: var(--space-sm);
}

.section-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ===== Projects Section ===== */
.projects-section {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-4xl) var(--space-lg);
}

/* Project Categories */
.project-category {
    margin-bottom: var(--space-3xl);
}

.category-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.category-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    color: white;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-xl);
}

.projects-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}

.projects-grid.compact .project-card {
    background: var(--color-bg-card);
}

.projects-grid.compact .project-content {
    padding: var(--space-lg);
}

.projects-grid.compact .project-title {
    font-size: var(--text-base);
}

.projects-grid.compact .project-description {
    font-size: var(--text-xs);
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow-glow);
}

.project-card.featured {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
    .project-card.featured {
        grid-column: span 1;
        grid-template-columns: 1fr;
    }
}

.project-image {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-card.featured .project-image {
    aspect-ratio: auto;
    min-height: 280px;
}

.project-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-preview-image {
    object-fit: contain;
    object-position: center;
    max-width: 75%;
    max-height: 75%;
}

/* Thumbnail for non-featured cards with images */
.project-card.has-image {
    flex-direction: row;
    align-items: stretch;
}

.project-thumb {
    width: 100px;
    min-width: 100px;
    overflow: hidden;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.project-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.projects-grid.compact .project-card.has-image .project-content {
    padding: var(--space-md);
}

/* Pacman Preview Animation */
.pacman-preview {
    background: linear-gradient(135deg, #0a0a2a 0%, #1a1a3a 100%);
    position: relative;
    overflow: hidden;
}

.maze-lines {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(
            90deg,
            transparent 49%,
            rgba(33, 33, 255, 0.2) 49%,
            rgba(33, 33, 255, 0.2) 51%,
            transparent 51%
        ),
        linear-gradient(
            0deg,
            transparent 49%,
            rgba(33, 33, 255, 0.2) 49%,
            rgba(33, 33, 255, 0.2) 51%,
            transparent 51%
        );
    background-size: 40px 40px;
}

.pac-demo {
    width: 40px;
    height: 40px;
    background: #ffff00;
    border-radius: 50%;
    position: relative;
    animation:
        pacMove 4s linear infinite,
        chomp 0.3s steps(2) infinite;
    clip-path: polygon(100% 50%, 50% 50%, 40% 25%, 50% 50%, 40% 75%, 50% 50%);
}

@keyframes pacMove {
    0%,
    100% {
        transform: translateX(-80px) rotate(0deg);
    }
    25% {
        transform: translateX(80px) rotate(0deg);
    }
    26% {
        transform: translateX(80px) rotate(180deg);
    }
    50% {
        transform: translateX(-80px) rotate(180deg);
    }
    51% {
        transform: translateX(-80px) rotate(0deg);
    }
}

.dots {
    position: absolute;
    display: flex;
    gap: 30px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.dots span {
    width: 8px;
    height: 8px;
    background: #ffb8ae;
    border-radius: 50%;
    animation: dotFade 4s linear infinite;
}

.dots span:nth-child(1) {
    animation-delay: 0.3s;
}
.dots span:nth-child(2) {
    animation-delay: 0.5s;
}
.dots span:nth-child(3) {
    animation-delay: 0.7s;
}
.dots span:nth-child(4) {
    animation-delay: 0.9s;
}
.dots span:nth-child(5) {
    animation-delay: 1.1s;
}

@keyframes dotFade {
    0%,
    20%,
    100% {
        opacity: 1;
    }
    25%,
    45% {
        opacity: 0;
    }
    50%,
    70% {
        opacity: 1;
    }
    75%,
    95% {
        opacity: 0;
    }
}

/* Racer Preview Animation */
.racer-preview {
    background: linear-gradient(180deg, #1a3a1a 0%, #0a2a0a 50%, #2a2a2a 100%);
    position: relative;
    overflow: hidden;
    perspective: 300px;
}

.road {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200%;
    height: 70%;
    background: #333;
    transform-origin: bottom center;
    transform: translateX(-50%) rotateX(60deg);
}

.road-line {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 40px;
    background: white;
    animation: roadScroll 0.5s linear infinite;
}

.road-line:nth-child(1) {
    bottom: 20%;
    animation-delay: 0s;
}
.road-line:nth-child(2) {
    bottom: 50%;
    animation-delay: -0.17s;
}
.road-line:nth-child(3) {
    bottom: 80%;
    animation-delay: -0.33s;
}

@keyframes roadScroll {
    0% {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) translateY(200%);
        opacity: 0;
    }
}

.car {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 50px;
    background: linear-gradient(180deg, #ff3333 0%, #cc0000 100%);
    border-radius: 5px 5px 3px 3px;
    animation: carSway 2s ease-in-out infinite;
}

.car::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 3px;
    right: 3px;
    height: 15px;
    background: rgba(100, 200, 255, 0.5);
    border-radius: 3px;
}

@keyframes carSway {
    0%,
    100% {
        transform: translateX(-50%) rotate(-2deg);
    }
    50% {
        transform: translateX(-50%) rotate(2deg);
    }
}

/* Mystery Preview */
.mystery-preview {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    flex-direction: column;
    gap: var(--space-md);
}

.question-mark {
    font-size: 4rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.1);
    animation: questionPulse 3s ease-in-out infinite;
}

@keyframes questionPulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.2;
    }
}

.sparkles {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.sparkles span {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: sparkle 2s ease-in-out infinite;
}

.sparkles span:nth-child(1) {
    top: 20%;
    left: 30%;
    animation-delay: 0s;
}

.sparkles span:nth-child(2) {
    top: 60%;
    left: 70%;
    animation-delay: -0.7s;
}

.sparkles span:nth-child(3) {
    top: 40%;
    left: 50%;
    animation-delay: -1.4s;
}

@keyframes sparkle {
    0%,
    100% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Project Overlay */
.project-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.play-btn {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transform: scale(0.8);
    transition: transform var(--transition-spring);
    box-shadow: var(--shadow-lg);
}

.project-card:hover .play-btn {
    transform: scale(1);
}

.play-btn:hover {
    transform: scale(1.1);
}

.play-btn svg {
    margin-left: 3px;
}

/* Status Badge */
.status-badge {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.wip {
    background: rgba(245, 158, 11, 0.2);
    color: var(--color-accent-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Project Content */
.project-content {
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    flex: 1;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.tag {
    padding: var(--space-xs) var(--space-sm);
    background: rgba(99, 102, 241, 0.1);
    color: var(--color-accent-primary);
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
}

.project-title {
    font-size: var(--text-xl);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.project-description {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
}

.project-links {
    margin-top: auto;
    padding-top: var(--space-md);
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.project-link.primary {
    color: var(--color-accent-primary);
}

.project-link:hover {
    color: var(--color-text-primary);
}

.project-link svg {
    transition: transform var(--transition-fast);
}

.project-link:hover svg {
    transform: translate(2px, -2px);
}

/* ===== About Section ===== */
.about-section {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-4xl) var(--space-lg);
}

.about-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.about-text {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    line-height: 1.8;
    margin-bottom: var(--space-2xl);
}

.tech-stack {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    flex-wrap: wrap;
}

.tech-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 140px;
    transition: all var(--transition-base);
}

.tech-item:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow-glow);
}

.tech-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    color: white;
}

.tech-item span {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
}

/* ===== Footer ===== */
.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: var(--space-4xl);
}

.footer-content {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-brand p {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

.footer-links {
    display: flex;
    gap: var(--space-md);
}

.footer-links a {
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
}

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

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: var(--space-lg);
    text-align: center;
}

.footer-bottom p {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .hero {
        grid-template-columns: 1fr;
        gap: var(--space-2xl);
        text-align: center;
    }

    .hero-content {
        align-items: center;
    }

    .hero-description {
        max-width: 600px;
    }

    .hero-visual {
        order: -1;
    }

    .arcade-screen {
        max-width: 350px;
    }
}

@media (max-width: 768px) {
    .nav-links {
        gap: var(--space-md);
    }

    .nav-links span {
        display: none;
    }

    .github-link span {
        display: none;
    }

    .hero {
        min-height: auto;
        padding-top: calc(var(--header-height) + var(--space-2xl));
    }

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

    .btn {
        justify-content: center;
    }

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

    .footer-content {
        flex-direction: column;
        gap: var(--space-lg);
        text-align: center;
    }
}

@media (max-width: 480px) {
    :root {
        --space-lg: 1rem;
        --space-xl: 1.5rem;
        --space-2xl: 2rem;
        --space-3xl: 2.5rem;
        --space-4xl: 3rem;
    }

    .arcade-screen {
        max-width: 280px;
    }

    .tech-stack {
        flex-direction: column;
        align-items: center;
    }

    .tech-item {
        width: 100%;
        max-width: 200px;
    }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

:focus-visible {
    outline: 2px solid var(--color-accent-primary);
    outline-offset: 2px;
}

/* ===== Selection ===== */
::selection {
    background: var(--color-accent-primary);
    color: white;
}
