/* CSS Custom Properties */
:root {
    --bg-primary: #0a0d12;
    --bg-secondary: #0d1117;
    --bg-tertiary: #161b22;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #00d4ff;
    --accent-hover: #39ddff;
    --border: #21262d;
    --gradient-start: #00d4ff;
    --gradient-end: #00ff88;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition: 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    cursor: url('../assets/cursors/pointer.svg'), auto;
}

/* Custom pixelated cursors */
a, button, .btn, .btn-primary, .btn-secondary, .btn-sm, .project-card, .nav-toggle, .audio-btn, .link, .logo, .nav-links a, .tech-icon, .floating-sprite, [role="button"] {
    cursor: url('../assets/cursors/hand.svg') 8 0, pointer !important;
}

a {
    color: inherit;
    text-decoration: none;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* Utility Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.highlight {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition);
    cursor: pointer;
    border: none;
}

.btn-sm {
    padding: 0.625rem 1.25rem;
    font-size: 0.85rem;
}

.btn-primary {
    background: linear-gradient(135deg, #0891b2, #0d9488);
    color: var(--text-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(8, 145, 178, 0.4);
}

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

.btn-secondary:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1rem 0;
    background: rgba(10, 10, 11, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid transparent;
    transition: all var(--transition);
}

.navbar.scrolled {
    border-bottom-color: var(--border);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition);
}

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

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all var(--transition);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 6rem 1.5rem;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    max-width: 800px;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

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

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

.hero-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 60%);
    pointer-events: none;
}

/* Sections */
.section {
    padding: 6rem 0;
}

.section-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    text-align: center;
}

.section-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    text-align: center;
    max-width: 600px;
    margin: 0 auto 3rem;
}

/* About Section */
.about {
    background: var(--bg-secondary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin: 3rem 0;
}

.stat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
}

.stat-number {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tech Stack */
.tech-stack {
    margin-top: 3rem;
    text-align: center;
}

.tech-stack-title {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
}

.tech-icons {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.tech-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.7;
    transition: all var(--transition);
}

.tech-icon:hover {
    opacity: 1;
    transform: translateY(-4px);
}

.tech-icon svg {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.2));
}

.tech-icon span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Mobile responsive for stats */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-number {
        font-size: 1.75rem;
    }

    .tech-icons {
        gap: 1.5rem;
    }

    .tech-icon svg {
        width: 36px;
        height: 36px;
    }
}

/* Projects Section */
.projects {
    background: var(--bg-secondary);
}

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

.project-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: all var(--transition);
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.project-card.featured {
    border-color: rgba(99, 102, 241, 0.3);
}

.project-image {
    height: 180px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 2rem;
    overflow: hidden;
}

/* Project-specific themed backgrounds */
.project-image.roguecraft {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    position: relative;
}

.project-image.roguecraft::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        url('../assets/images/roguecraft-icon.png'),
        radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,0.5), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 130px 80px, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 160px 30px, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 200px 60px, rgba(255,255,255,0.5), transparent),
        radial-gradient(2px 2px at 250px 90px, rgba(255,255,255,0.3), transparent);
    background-size: 120px, 4px, 4px, 2px, 4px, 2px, 2px, 4px;
    background-position: center, 20px 30px, 40px 70px, 90px 40px, 130px 80px, 160px 30px, 200px 60px, 250px 90px;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    animation: twinkle 3s ease-in-out infinite;
    filter: drop-shadow(0 0 15px rgba(255, 255, 0, 0.4));
}

.project-image.roguecraft::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(26, 26, 46, 0.6) 100%);
}

.project-image.pokemon {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 50%, #1e3a5f 100%);
    position: relative;
}

.project-image.pokemon::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        url('../assets/images/pokemon/pikachu.png'),
        url('../assets/images/pokemon/charizard.png'),
        url('../assets/images/pokemon/mewtwo.png'),
        url('../assets/images/pokemon/masterball.png');
    background-size: 64px, 64px, 64px, 48px;
    background-position: 20% 50%, 50% 30%, 80% 50%, 50% 75%;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    opacity: 0.9;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

.project-image.pokemon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(30, 58, 95, 0.7) 100%);
}

.project-image.smashtexty {
    background: linear-gradient(135deg, #0d0d0d 0%, #1a1a1a 100%);
    font-family: var(--font-mono);
    position: relative;
    overflow: hidden;
}

.project-image.smashtexty::before {
    content: '╔══════════════╗\A║  [@] vs [#]  ║\A║   FIGHT!     ║\A╚══════════════╝';
    white-space: pre;
    position: absolute;
    font-size: 0.9rem;
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00;
    letter-spacing: 1px;
    line-height: 1.4;
    animation: asciiFlicker 0.1s infinite;
}

.project-image.smashtexty::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, transparent 50%, rgba(0, 255, 0, 0.03) 50%),
        linear-gradient(0deg, transparent 50%, rgba(0, 255, 0, 0.02) 50%);
    background-size: 4px 4px, 4px 4px;
    pointer-events: none;
}

@keyframes asciiFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.95; }
}

.project-image.screenshot {
    background: linear-gradient(135deg, #1b2838 0%, #171a21 50%, #2a475e 100%);
    position: relative;
}

.project-image.screenshot::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(45deg, transparent 30%, rgba(102, 192, 244, 0.1) 50%, transparent 70%),
        repeating-linear-gradient(0deg, transparent, transparent 20px, rgba(42, 71, 94, 0.3) 20px, rgba(42, 71, 94, 0.3) 21px);
    animation: steamShine 3s ease-in-out infinite;
}

.project-image.screenshot::after {
    content: '📷 STEAM';
    font-size: 1.2rem;
    font-family: var(--font-mono);
    color: #66c0f4;
    text-shadow: 0 0 10px rgba(102, 192, 244, 0.5);
    letter-spacing: 3px;
}

@keyframes steamShine {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.project-image.typecast {
    background: linear-gradient(135deg, #2d1b4e 0%, #4a1942 50%, #1a1a2e 100%);
    background-size: cover;
    background-position: center;
    font-family: var(--font-mono);
}

.project-image.typecast::before {
    content: '';
    display: none;
}

.project-image.typecast::after {
    content: '';
    display: none;
}

@keyframes fall {
    0% { transform: translateY(-20px); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translateY(40px); opacity: 0; }
}

.project-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-content {
    padding: 1.5rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tag.ai {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(0, 255, 136, 0.2));
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.project-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.project-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.project-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.link {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition);
}

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

/* Contact Section */
.contact-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Footer */
.footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

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

/* Mobile Responsive */
@media (max-width: 900px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: var(--bg-primary);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        transition: right var(--transition);
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links a {
        font-size: 1.5rem;
    }

    .nav-toggle {
        display: flex;
        z-index: 1001;
    }

    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    .section {
        padding: 4rem 0;
    }

    .project-links {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Mobile hero adjustments */
    .hero-title {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

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

    /* Mobile project cards */
    .project-image {
        height: 160px;
    }

    .project-content {
        padding: 1rem;
    }

    .project-content h3 {
        font-size: 1.1rem;
    }

    .project-content p {
        font-size: 0.85rem;
    }

    /* Hide heavy effects on mobile for performance */
    .matrix-canvas {
        opacity: 0.3;
    }

    .parallax-bg {
        display: none;
    }

    /* Smaller floating sprites on mobile */
    .floating-sprite {
        opacity: 0.1;
    }

    /* Audio button position on mobile */
    .audio-control {
        bottom: 1rem;
        right: 1rem;
    }

    .audio-btn {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    /* Loading screen mobile */
    .loading-logo {
        font-size: 2.5rem;
        letter-spacing: 0.3em;
    }

    .loading-bar-container {
        width: 250px;
    }

    /* Touch-friendly buttons */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }

    .btn-sm {
        min-height: 40px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .stats-grid {
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .tech-icons {
        gap: 1rem;
    }

    .tech-icon svg {
        width: 32px;
        height: 32px;
    }

    .tech-icon span {
        font-size: 0.65rem;
    }

    .project-tags {
        gap: 0.3rem;
    }

    .tag {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }
}

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

@keyframes twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.hero-content {
    animation: fadeInUp 0.8s ease forwards;
}

/* Scroll animations */
.section-title,
.section-description,
.project-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.section-title.visible,
.section-description.visible,
.project-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animation for project cards */
.project-card:nth-child(1) { transition-delay: 0s; }
.project-card:nth-child(2) { transition-delay: 0.05s; }
.project-card:nth-child(3) { transition-delay: 0.1s; }
.project-card:nth-child(4) { transition-delay: 0.15s; }
.project-card:nth-child(5) { transition-delay: 0.2s; }

/* ============================================
   AUDIO CONTROL
   ============================================ */

.audio-control {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.audio-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.1);
}

.audio-btn.playing {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.2);
    animation: pulse 2s ease-in-out infinite;
}

.audio-btn.playing .audio-icon {
    color: var(--accent);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 15px rgba(99, 102, 241, 0); }
}

/* ============================================
   FLOATING SPRITES
   ============================================ */

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

.floating-sprite {
    position: absolute;
    bottom: -50px;
    animation: floatUp linear infinite;
    opacity: 0.25;
    filter: grayscale(0.3);
    transition: opacity 0.3s, transform 0.2s;
    pointer-events: auto;
}

.floating-sprite:hover {
    opacity: 0.6;
    transform: scale(1.2);
    filter: grayscale(0) brightness(1.2);
}

.floating-sprite.ascii-sprite {
    font-family: var(--font-mono);
    color: var(--accent);
    opacity: 0.2;
    text-shadow: 0 0 10px currentColor;
}

.floating-sprite.image-sprite img {
    image-rendering: pixelated;
    filter: drop-shadow(0 0 5px rgba(99, 102, 241, 0.3));
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.15;
    }
    90% {
        opacity: 0.15;
    }
    100% {
        transform: translateY(-110vh) rotate(360deg);
        opacity: 0;
    }
}

/* ============================================
   CURSOR TRAIL
   ============================================ */

.cursor-particle {
    position: fixed;
    pointer-events: none;
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 14px;
    z-index: 9999;
    animation: particleFade 1s ease-out forwards;
    text-shadow: 0 0 5px currentColor;
}

@keyframes particleFade {
    0% {
        opacity: 0.8;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px) scale(0.5);
    }
}

/* ============================================
   KONAMI CODE EASTER EGG
   ============================================ */

.konami-active {
    animation: konamiFlash 0.5s ease;
}

.konami-active .floating-sprite {
    opacity: 0.4 !important;
    animation-duration: 5s !important;
}

@keyframes konamiFlash {
    0%, 100% { filter: none; }
    25% { filter: hue-rotate(90deg); }
    50% { filter: hue-rotate(180deg); }
    75% { filter: hue-rotate(270deg); }
}

/* ============================================
   RETRO LOADING SCREEN
   ============================================ */

.loading-screen {
    position: fixed;
    inset: 0;
    background: #0a0a0b;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    font-family: var(--font-mono);
    font-size: 4rem;
    font-weight: 700;
    color: var(--accent);
    text-shadow:
        0 0 10px rgba(99, 102, 241, 0.5),
        0 0 20px rgba(99, 102, 241, 0.3),
        0 0 40px rgba(99, 102, 241, 0.2);
    letter-spacing: 0.5em;
    margin-bottom: 2rem;
    animation: logoGlow 2s ease-in-out infinite;
}

@keyframes logoGlow {
    0%, 100% { text-shadow: 0 0 10px rgba(99, 102, 241, 0.5), 0 0 20px rgba(99, 102, 241, 0.3); }
    50% { text-shadow: 0 0 20px rgba(99, 102, 241, 0.8), 0 0 40px rgba(99, 102, 241, 0.5), 0 0 60px rgba(99, 102, 241, 0.3); }
}

.loading-bar-container {
    width: 300px;
    height: 20px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 1.5rem;
    position: relative;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
    transition: width 0.1s ease;
    position: relative;
}

.loading-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 8px,
        rgba(255, 255, 255, 0.1) 8px,
        rgba(255, 255, 255, 0.1) 16px
    );
}

.loading-text {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--text-secondary);
    letter-spacing: 0.3em;
    margin-bottom: 1rem;
}

.loading-dots::after {
    content: '';
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

.loading-tip {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* ============================================
   SCANLINES EFFECT (CRT feel)
   ============================================ */

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10000;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03) 0px,
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
}

/* ============================================
   NOISE/GRAIN OVERLAY
   ============================================ */

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: grainShift 0.5s steps(10) infinite;
}

@keyframes grainShift {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-1%, -1%); }
    20% { transform: translate(1%, 1%); }
    30% { transform: translate(-1%, 1%); }
    40% { transform: translate(1%, -1%); }
    50% { transform: translate(-1%, 0); }
    60% { transform: translate(1%, 0); }
    70% { transform: translate(0, 1%); }
    80% { transform: translate(0, -1%); }
    90% { transform: translate(1%, 1%); }
}

/* ============================================
   SPRITE MINI-GAME
   ============================================ */

.sprite-score {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    background: rgba(26, 26, 29, 0.9);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--accent);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    animation: fadeInScore 0.5s ease 3s forwards;
}

@keyframes fadeInScore {
    to { opacity: 1; }
}

.score-icon {
    color: #ffd700;
    font-size: 1.2rem;
}

.score-value {
    font-weight: 700;
}

.points-popup {
    position: fixed;
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    pointer-events: none;
    z-index: 10001;
    animation: pointsFloat 1s ease-out forwards;
    transform: translate(-50%, -50%);
}

@keyframes pointsFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -100%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -150%) scale(1);
    }
}

.explosion-particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10001;
    animation: explode 0.8s ease-out forwards;
    box-shadow: 0 0 6px currentColor;
}

@keyframes explode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) scale(0);
        opacity: 0;
    }
}

.target-sprite {
    animation: targetPulse 0.5s ease-in-out infinite alternate, floatUp linear infinite !important;
}

@keyframes targetPulse {
    from { transform: scale(1); }
    to { transform: scale(1.2); }
}

/* Mobile responsive for score */
@media (max-width: 768px) {
    .sprite-score {
        bottom: 1rem;
        top: auto;
        left: 1rem;
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
}

/* ============================================
   ANIMATED GRADIENT BACKGROUND
   ============================================ */

body {
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 80%, rgba(0, 212, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 255, 136, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(0, 212, 255, 0.03) 0%, transparent 70%);
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    25% { background-position: 50% 0%; }
    50% { background-position: 100% 50%; }
    75% { background-position: 50% 100%; }
}

/* ============================================
   REDUCED MOTION (Accessibility)
   ============================================ */

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

    .matrix-canvas,
    .parallax-bg,
    .floating-sprites {
        display: none !important;
    }

    body::after {
        animation: none !important;
    }
}

/* ============================================
   PARALLAX BACKGROUND
   ============================================ */

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

.parallax-layer {
    position: absolute;
    inset: 0;
    will-change: transform;
}

.parallax-stars {
    background-image:
        radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 30% 60%, rgba(255,255,255,0.3), transparent),
        radial-gradient(2px 2px at 50% 30%, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 70% 80%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 90% 40%, rgba(255,255,255,0.3), transparent),
        radial-gradient(2px 2px at 15% 90%, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 85% 10%, rgba(255,255,255,0.35), transparent),
        radial-gradient(1px 1px at 45% 70%, rgba(255,255,255,0.25), transparent);
    animation: twinkleStars 4s ease-in-out infinite alternate;
}

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

.parallax-grid {
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.5;
}

/* ============================================
   MATRIX RAIN CANVAS
   ============================================ */

.matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.15;
}

/* ============================================
   GLITCH TEXT EFFECT
   ============================================ */

.glitch {
    position: relative;
}

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

.glitch::before {
    color: #00ff88;
    animation: glitch-1 4s infinite linear alternate-reverse;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.glitch::after {
    color: #00d4ff;
    animation: glitch-2 4s infinite linear alternate-reverse;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

@keyframes glitch-1 {
    0%, 90%, 100% { opacity: 0; transform: translate(0); }
    92% { opacity: 0.8; transform: translate(-5px, 2px); }
    94% { opacity: 0; transform: translate(0); }
    96% { opacity: 0.6; transform: translate(5px, -2px); }
    98% { opacity: 0; }
}

@keyframes glitch-2 {
    0%, 90%, 100% { opacity: 0; transform: translate(0); }
    91% { opacity: 0.6; transform: translate(5px, 2px); }
    93% { opacity: 0; transform: translate(0); }
    95% { opacity: 0.8; transform: translate(-5px, -2px); }
    97% { opacity: 0; }
}

/* ============================================
   TYPING ANIMATION
   ============================================ */

.typing-text {
    min-height: 3em;
    border-right: 2px solid var(--accent);
    animation: blink-caret 0.75s step-end infinite;
    display: inline-block;
}

.typing-text.done {
    border-right: none;
    animation: none;
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent); }
}

/* ============================================
   3D CARD TILT EFFECT
   ============================================ */

.project-card {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.project-card.tilting {
    transition: none !important;
}

.project-card .project-content,
.project-card .project-image {
    transform: translateZ(20px);
}

.project-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.1) 0%,
        transparent 50%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: 16px;
}

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

/* ============================================
   CLICK RIPPLE EFFECT
   ============================================ */

.btn {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-effect 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-effect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================================
   ENHANCED SCROLL ANIMATIONS
   ============================================ */

.section-title,
.section-description {
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

/* Slide in from different directions */
.project-card:nth-child(odd) {
    transform: translateX(-30px) translateY(20px);
}

.project-card:nth-child(even) {
    transform: translateX(30px) translateY(20px);
}

.project-card.visible {
    transform: translateX(0) translateY(0);
}

/* Scale up sections */
.section-title {
    transform: translateY(30px) scale(0.95);
}

.section-title.visible {
    transform: translateY(0) scale(1);
}

/* Fade and slide description */
.section-description {
    transform: translateY(20px);
    filter: blur(5px);
}

.section-description.visible {
    transform: translateY(0);
    filter: blur(0);
}

/* ============================================
   HOVER GLOW EFFECTS
   ============================================ */

.btn-primary {
    position: relative;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 10px;
    z-index: -1;
    opacity: 0;
    filter: blur(10px);
    transition: opacity 0.3s ease;
}

.btn-primary:hover::before {
    opacity: 0.6;
}

/* ============================================
   LOGO ANIMATION
   ============================================ */

.logo {
    transition: all 0.3s ease;
}

.logo:hover {
    text-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
    transform: scale(1.05);
}

/* ============================================
   NEW PROJECT CARD IMAGES
   ============================================ */

.project-image.fantasy-football {
    background: linear-gradient(135deg, #1a472a 0%, #2d5a3d 50%, #1a472a 100%);
    position: relative;
}

.project-image.fantasy-football::before {
    content: '🏈';
    font-size: 4rem;
    filter: drop-shadow(0 0 15px rgba(139, 69, 19, 0.6));
    animation: footballBounce 2s ease-in-out infinite;
}

.project-image.fantasy-football::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(255,255,255,0.05) 40px, rgba(255,255,255,0.05) 42px),
        radial-gradient(ellipse at center, transparent 30%, rgba(26, 71, 42, 0.8) 100%);
}

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

.project-image.car-compare {
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 50%, #1a1a2e 100%);
    position: relative;
}

.project-image.car-compare::before {
    content: '🚗';
    font-size: 4rem;
    filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.6));
    animation: carDrive 3s ease-in-out infinite;
}

.project-image.car-compare::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(0deg, rgba(50, 50, 70, 0.8) 0%, transparent 30%),
        repeating-linear-gradient(90deg, transparent, transparent 60px, rgba(255,255,255,0.03) 60px, rgba(255,255,255,0.03) 62px);
}

@keyframes carDrive {
    0%, 100% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
}

.project-image.travel-agent {
    background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 50%, #0284c7 100%);
    position: relative;
}

.project-image.travel-agent::before {
    content: '✈️';
    font-size: 4rem;
    filter: drop-shadow(0 0 15px rgba(56, 189, 248, 0.6));
    animation: planeFly 3s ease-in-out infinite;
}

.project-image.travel-agent::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.1) 0%, transparent 20%),
        radial-gradient(circle at 80% 60%, rgba(255,255,255,0.08) 0%, transparent 15%),
        radial-gradient(circle at 50% 80%, rgba(255,255,255,0.05) 0%, transparent 25%),
        linear-gradient(180deg, transparent 60%, rgba(12, 74, 110, 0.8) 100%);
}

@keyframes planeFly {
    0%, 100% { transform: translate(-5px, 5px) rotate(-5deg); }
    50% { transform: translate(5px, -5px) rotate(5deg); }
}

/* ============================================
   ASCII RAIN EFFECT
   ============================================ */

.ascii-rain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    opacity: 0.12;
}

.ascii-drop {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--accent);
    text-shadow: 0 0 5px currentColor;
    animation: asciiRainFall linear infinite;
    white-space: nowrap;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

@keyframes asciiRainFall {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}
