/* ================= RESET + FONT ================= */
*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:'Press Start 2P', cursive;
}

:root{
    --bg:#0b0b0b;
    --text:#ffffff;
    --muted:#bbbbbb;
    --border:#222;
    --card:#111;
    --accent:#8a5cff;
    --accent-hover:#9d6fff;
    --grid:rgba(255,255,255,0.04);
    --featured-glow:rgba(138, 92, 255, 0.3);
}

body.light{
    --bg:#f5f5f5;
    --text:#111;
    --muted:#444;
    --border:#ddd;
    --card:#fff;
    --grid:rgba(0,0,0,0.06);
    --featured-glow:rgba(138, 92, 255, 0.2);
}

body{
    background:var(--bg);
    color:var(--text);
    overflow-x:hidden;
}

/* ================= GRID BACKGROUND ================= */
.grid-bg{
    position:fixed;
    inset:0;
    background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size:40px 40px;
    z-index:-1;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

/* ================= HEADER ================= */
.header{
    position:fixed;
    top:0;
    width:100%;
    padding:20px 8%;
    display:flex;
    align-items:center;
    justify-content:space-between;
    background:color-mix(in srgb, var(--bg) 95%, transparent);
    backdrop-filter: blur(10px);
    border-bottom:2px solid var(--border);
    z-index:10;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.header-right{
    display:flex;
    align-items:center;
    gap:18px;
}

.logo{
    color:var(--accent);
    font-size:14px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.logo:hover{
    transform: scale(1.1);
}

/* NAV DESKTOP */
nav{
    margin-left:auto;
    display:flex;
    align-items:center;
}

nav a{
    margin-left:25px;
    text-decoration:none;
    color:var(--muted);
    font-size:12px;
    transition: color 0.3s ease;
    position: relative;
}

nav a:hover{
    color:var(--accent);
}

nav a::after{
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
}

nav a:hover::after{
    width: 100%;
}

/* ================= THEME BUTTON ================= */
.theme-toggle{
    margin-right:20px;
    width:42px;
    height:42px;
    background:var(--card);
    color:var(--accent);
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
    font-family:'Press Start 2P', cursive;
    position:relative;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.theme-toggle:hover{
    border-color: var(--accent);
    transform: scale(1.05);
}

.theme-toggle .icon{
    position:absolute;
    font-size:18px;
    transition:.3s;
}

.theme-toggle .sun{ opacity:1; }
.theme-toggle .moon{ opacity:0; }

body.light .theme-toggle .sun{ opacity:0; }
body.light .theme-toggle .moon{ opacity:1; }

/* ================= BURGER ================= */
.burger{
    display:none;
    font-size:22px;
    cursor:pointer;
    color:var(--accent);
    transition: transform 0.3s ease;
}

.burger:hover{
    transform: rotate(90deg);
}

/* ================= MOBILE NAV ================= */
.close{
    display:none;
}

.overlay{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.7);
    display:none;
    z-index:8;
    backdrop-filter: blur(5px);
}

.overlay.active{
    display:block;
}

/* ================= PROJECTS SECTION ================= */
.projects-section{
    padding:140px 8% 80px;
    min-height: 100vh;
}

.section-header{
    text-align:center;
    margin-bottom:80px;
    position: relative;
}

.section-header h1{
    font-size:36px;
    margin-bottom:20px;
    background: linear-gradient(135deg, var(--accent), #ff6b9d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header p{
    font-size:12px;
    color:var(--muted);
    max-width:600px;
    margin:0 auto;
    line-height:1.8;
}

/* Pixel Stars Animation */
.pixel-star{
    position: absolute;
    font-size: 24px;
    color: var(--accent);
    animation: twinkle 3s ease-in-out infinite;
}

.star-1{
    top: -20px;
    left: 10%;
    animation-delay: 0s;
}

.star-2{
    top: -10px;
    right: 15%;
    animation-delay: 1s;
}

.star-3{
    top: 30px;
    right: 5%;
    animation-delay: 2s;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ================= PROJECTS GRID ================= */
.projects-grid{
    display:grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap:40px;
    margin-top:60px;
}

/* ================= PROJECT CARD ================= */
.project-card{
    background:var(--card);
    border:3px solid var(--border);
    position:relative;
    overflow:hidden;
    transition: all 0.4s ease;
    box-shadow: 8px 8px 0 rgba(0,0,0,0.2);
}

.project-card:hover{
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 12px 12px 0 var(--accent);
}

.project-card.featured{
    border-color: var(--accent);
    box-shadow: 0 0 30px var(--featured-glow);
}

.project-card.featured:hover{
    box-shadow: 0 0 40px var(--featured-glow), 12px 12px 0 var(--accent);
}

/* Card Badge */
.card-badge{
    position:absolute;
    top:15px;
    right:15px;
    background:var(--accent);
    color:#fff;
    padding:8px 16px;
    font-size:9px;
    z-index:2;
    letter-spacing: 1px;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
}

/* ================= PIXEL PETS ================= */
.card-pixel-pet{
    position:absolute;
    top:15px;
    left:15px;
    z-index:2;
    animation: petBounce 2s ease-in-out infinite;
}

@keyframes petBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* PIXEL CAT */
.pixel-cat{
    width:40px;
    height:40px;
    position:relative;
}

.cat-ear-left, .cat-ear-right{
    width:8px;
    height:8px;
    background:#8a5cff;
    position:absolute;
    top:0;
}

.cat-ear-left{ left:6px; }
.cat-ear-right{ right:6px; }

.cat-face{
    width:32px;
    height:28px;
    background:#8a5cff;
    position:absolute;
    top:6px;
    left:4px;
    border-radius: 20% 20% 40% 40%;
}

.cat-eye-left, .cat-eye-right{
    width:6px;
    height:6px;
    background:#fff;
    position:absolute;
    top:8px;
    border-radius: 50%;
}

.cat-eye-left{ left:6px; }
.cat-eye-right{ right:6px; }

.cat-nose{
    width:4px;
    height:4px;
    background:#fff;
    position:absolute;
    bottom:6px;
    left:50%;
    transform:translateX(-50%);
}

/* PIXEL DOG */
.pixel-dog{
    width:40px;
    height:40px;
    position:relative;
}

.dog-ear-left, .dog-ear-right{
    width:10px;
    height:14px;
    background:#ff9a56;
    position:absolute;
    top:2px;
}

.dog-ear-left{ left:2px; border-radius: 40% 0 0 0; }
.dog-ear-right{ right:2px; border-radius: 0 40% 0 0; }

.dog-face{
    width:32px;
    height:28px;
    background:#ff9a56;
    position:absolute;
    top:8px;
    left:4px;
    border-radius: 30%;
}

.dog-eye-left, .dog-eye-right{
    width:6px;
    height:6px;
    background:#333;
    position:absolute;
    top:6px;
    border-radius: 50%;
}

.dog-eye-left{ left:6px; }
.dog-eye-right{ right:6px; }

.dog-nose{
    width:6px;
    height:6px;
    background:#333;
    position:absolute;
    bottom:8px;
    left:50%;
    transform:translateX(-50%);
    border-radius: 50% 50% 0 0;
}

.dog-mouth{
    width:2px;
    height:4px;
    background:#333;
    position:absolute;
    bottom:4px;
    left:50%;
    transform:translateX(-50%);
}

/* PIXEL BUNNY */
.pixel-bunny{
    width:40px;
    height:44px;
    position:relative;
}

.bunny-ear-left, .bunny-ear-right{
    width:6px;
    height:20px;
    background:#ffc6ff;
    position:absolute;
    top:0;
    border-radius: 50% 50% 0 0;
}

.bunny-ear-left{ left:8px; }
.bunny-ear-right{ right:8px; }

.bunny-face{
    width:32px;
    height:26px;
    background:#ffc6ff;
    position:absolute;
    top:18px;
    left:4px;
    border-radius: 50%;
}

.bunny-eye-left, .bunny-eye-right{
    width:5px;
    height:5px;
    background:#333;
    position:absolute;
    top:6px;
    border-radius: 50%;
}

.bunny-eye-left{ left:7px; }
.bunny-eye-right{ right:7px; }

.bunny-nose{
    width:3px;
    height:3px;
    background:#ff69b4;
    position:absolute;
    bottom:8px;
    left:50%;
    transform:translateX(-50%);
    border-radius: 50%;
}

/* PIXEL FOX */
.pixel-fox{
    width:40px;
    height:40px;
    position:relative;
}

.fox-ear-left, .fox-ear-right{
    width:0;
    height:0;
    border-left:10px solid transparent;
    border-right:10px solid transparent;
    border-bottom:16px solid #ff6b35;
    position:absolute;
    top:0;
}

.fox-ear-left{ left:0; }
.fox-ear-right{ right:0; }

.fox-face{
    width:32px;
    height:28px;
    background:#ff6b35;
    position:absolute;
    top:10px;
    left:4px;
    border-radius: 40% 40% 50% 50%;
}

.fox-eye-left, .fox-eye-right{
    width:5px;
    height:5px;
    background:#fff;
    position:absolute;
    top:8px;
    border-radius: 50%;
}

.fox-eye-left{ left:7px; }
.fox-eye-right{ right:7px; }

.fox-nose{
    width:4px;
    height:4px;
    background:#333;
    position:absolute;
    bottom:8px;
    left:50%;
    transform:translateX(-50%);
}

/* PIXEL BEAR */
.pixel-bear{
    width:40px;
    height:40px;
    position:relative;
}

.bear-ear-left, .bear-ear-right{
    width:10px;
    height:10px;
    background:#8b5a3c;
    position:absolute;
    top:0;
    border-radius: 50%;
}

.bear-ear-left{ left:4px; }
.bear-ear-right{ right:4px; }

.bear-face{
    width:32px;
    height:28px;
    background:#8b5a3c;
    position:absolute;
    top:6px;
    left:4px;
    border-radius: 50%;
}

.bear-eye-left, .bear-eye-right{
    width:5px;
    height:5px;
    background:#333;
    position:absolute;
    top:8px;
    border-radius: 50%;
}

.bear-eye-left{ left:7px; }
.bear-eye-right{ right:7px; }

.bear-nose{
    width:6px;
    height:5px;
    background:#333;
    position:absolute;
    bottom:10px;
    left:50%;
    transform:translateX(-50%);
    border-radius: 50%;
}

.bear-mouth{
    width:10px;
    height:6px;
    border:2px solid #333;
    border-top:none;
    position:absolute;
    bottom:5px;
    left:50%;
    transform:translateX(-50%);
    border-radius: 0 0 50% 50%;
}

/* PIXEL PANDA */
.pixel-panda{
    width:40px;
    height:40px;
    position:relative;
}

.panda-ear-left, .panda-ear-right{
    width:10px;
    height:10px;
    background:#333;
    position:absolute;
    top:2px;
    border-radius: 50%;
}

.panda-ear-left{ left:3px; }
.panda-ear-right{ right:3px; }

.panda-face{
    width:32px;
    height:28px;
    background:#fff;
    position:absolute;
    top:8px;
    left:4px;
    border-radius: 50%;
}

.panda-eye-left, .panda-eye-right{
    width:10px;
    height:12px;
    background:#333;
    position:absolute;
    top:6px;
    border-radius: 50%;
}

.panda-eye-left{ left:4px; }
.panda-eye-right{ right:4px; }

.panda-eye-left::after, .panda-eye-right::after{
    content:'';
    width:4px;
    height:4px;
    background:#fff;
    position:absolute;
    top:3px;
    left:3px;
    border-radius: 50%;
}

.panda-nose{
    width:5px;
    height:5px;
    background:#333;
    position:absolute;
    bottom:8px;
    left:50%;
    transform:translateX(-50%);
    border-radius: 50%;
}

/* ================= CARD IMAGE ================= */
.card-image{
    width:100%;
    height:240px;
    overflow:hidden;
    border-bottom:3px solid var(--border);
}

.card-image img{
    width:100%;
    height:100%;
    object-fit:cover;
    transition: transform 0.5s ease;
    image-rendering: pixelated;
}

.project-card:hover .card-image img{
    transform: scale(1.1);
}

/* ================= CARD CONTENT ================= */
.card-content{
    padding:25px;
}

.card-content h3{
    font-size:14px;
    margin-bottom:15px;
    color:var(--text);
}

.card-content p{
    font-size:10px;
    color:var(--muted);
    line-height:1.8;
    margin-bottom:20px;
}

/* Tech Stack */
.tech-stack{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    margin-bottom:20px;
}

.tech-tag{
    background:var(--border);
    color:var(--accent);
    padding:6px 12px;
    font-size:8px;
    border:1px solid var(--accent);
}

/* Card Stats */
.card-stats{
    display:flex;
    gap:20px;
    margin-bottom:20px;
    padding:15px 0;
    border-top:2px solid var(--border);
    border-bottom:2px solid var(--border);
}

.stat{
    display:flex;
    align-items:center;
    gap:8px;
}

.stat-icon{
    font-size:14px;
}

.stat-value{
    font-size:11px;
    color:var(--muted);
}

/* Card Links */
.card-links{
    display:flex;
    gap:12px;
}

.btn-primary, .btn-secondary{
    flex:1;
    padding:12px 20px;
    font-size:9px;
    text-align:center;
    text-decoration:none;
    cursor:pointer;
    transition: all 0.3s ease;
    border:2px solid var(--accent);
    font-family:'Press Start 2P', cursive;
}

.btn-primary{
    background:var(--accent);
    color:#fff;
}

.btn-primary:hover{
    background:var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
}

.btn-secondary{
    background:transparent;
    color:var(--accent);
}

.btn-secondary:hover{
    background:var(--accent);
    color:#fff;
    transform: translateY(-2px);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
}

/* ================= RESPONSIVE ================= */
@media(max-width:900px){
    .burger{ display:block; }

    nav{
        position:fixed;
        top:0;
        right:-100%;
        height:100vh;
        width:240px;
        background:var(--card);
        flex-direction:column;
        padding-top:100px;
        transition:0.4s;
        z-index:9;
        border-left:3px solid var(--accent);
    }

    nav a{
        margin:20px;
    }

    nav.active{
        right:0;
    }

    .close{
        display:block;
        position:absolute;
        top:20px;
        right:20px;
        font-size:18px;
        cursor:pointer;
        color:var(--accent);
    }

    .projects-section{
        padding:120px 5% 60px;
    }

    .section-header h1{
        font-size:28px;
    }

    .section-header p{
        font-size:10px;
    }

    .projects-grid{
        grid-template-columns: 1fr;
        gap:30px;
    }

    .theme-toggle{
        width:36px;
        height:36px;
        margin-right:10px;
    }

    .pixel-star{
        font-size: 18px;
    }

    .card-badge{
        font-size:8px;
        padding:6px 12px;
    }
}

@media(max-width:480px){
    .section-header h1{
        font-size:22px;
    }

    .card-content h3{
        font-size:12px;
    }

    .card-content p{
        font-size:9px;
    }

    .tech-tag{
        font-size:7px;
        padding:5px 10px;
    }

    .btn-primary, .btn-secondary{
        font-size:8px;
        padding:10px 16px;
    }

    .card-stats{
        gap:15px;
    }

    .stat-value{
        font-size:10px;
    }
}