@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables */
:root {
    --bg-color: #050810; 
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: #0f172a;
    --border-color: rgba(255, 255, 255, 0.1);
    --primary: #3b82f6;
    --primary-gradient: linear-gradient(135deg, #3b82f6, #a855f7);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* 1. STRICT RESET & OVERFLOW CONTROL */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    scroll-behavior: smooth;
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

html { scroll-padding-top: 80px; }
body.no-scroll { overflow: hidden; }

/* Main wrapper ensures nothing breaks horizontally */
.main-content {
    overflow-x: hidden;
    width: 100%;
}

/* Typography & Utilities */
.container { width: 90%; max-width: 1150px; margin: 0 auto; }
.section { padding: 100px 0; }
.text-center { text-align: center; }
.gradient-text { background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
span { color: var(--primary); }

.section-title { font-size: 34px; font-weight: 800; margin-bottom: 40px; word-wrap: break-word; }
.section-title span { color: var(--primary); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 28px; border-radius: 50px; font-weight: 600; font-size: 15px;
    text-decoration: none; transition: 0.3s; cursor: pointer; border: none;
    text-align: center; max-width: 100%;
}
.btn-primary { background: var(--primary-gradient); color: #fff; box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3); }
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(59, 130, 246, 0.5); }
.btn-outline { border: 2px solid var(--border-color); color: #fff; background: transparent; }
.btn-outline:hover { border-color: var(--primary); background: rgba(59, 130, 246, 0.1); transform: translateY(-3px); }
.btn-sm { padding: 10px 20px; font-size: 14px; }

/* =========================================
   HEADER & DESKTOP NAVIGATION
   ========================================= */
.header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    background: rgba(5, 8, 16, 0.8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent; transition: 0.4s ease;
}
.header.scrolled { 
    background: rgba(5, 8, 16, 0.95); 
    border-bottom: 1px solid var(--border-color); 
    box-shadow: 0 5px 25px rgba(0,0,0,0.6); 
}

.navbar { display: flex; justify-content: space-between; align-items: center; height: 80px; }
.logo { font-size: 24px; font-weight: 800; color: #fff; text-decoration: none; z-index: 1002; position: relative; }

.nav-links { display: flex; gap: 30px; list-style: none; align-items: center; margin: 0; padding: 0; }
.nav-link { 
    color: var(--text-main); text-decoration: none; font-weight: 500; 
    font-size: 15px; transition: color 0.3s; position: relative; 
}
.nav-link:not(.btn-nav)::after {
    content: ''; position: absolute; width: 0; height: 2px;
    background: var(--primary-gradient); bottom: -6px; left: 0; transition: width 0.3s ease;
}
.nav-link:not(.btn-nav):hover::after,
.nav-link.active:not(.btn-nav)::after { width: 100%; }
.nav-link.active:not(.btn-nav) { color: #fff; }

.btn-nav { padding: 10px 24px; border: 1px solid var(--border-color); border-radius: 50px; transition: 0.3s; }
.btn-nav:hover, .btn-nav.active { background: var(--primary-gradient); border-color: transparent; color: #fff; }

/* Hamburger Icon Base */
.hamburger { display: none; cursor: pointer; width: 28px; height: 22px; position: relative; z-index: 1002; }
.hamburger .bar { position: absolute; width: 100%; height: 2px; background: #fff; border-radius: 2px; transition: all 0.3s ease-in-out; left: 0; }
.hamburger .bar:nth-child(1) { top: 0; }
.hamburger .bar:nth-child(2) { top: 10px; }
.hamburger .bar:nth-child(3) { top: 20px; }

/* Hamburger to 'X' Animation */
.hamburger.active .bar:nth-child(1) { transform: rotate(45deg); top: 10px; }
.hamburger.active .bar:nth-child(2) { opacity: 0; transform: translateX(20px); }
.hamburger.active .bar:nth-child(3) { transform: rotate(-45deg); top: 10px; }


/* =========================================
   SECTIONS STYLING
   ========================================= */

/* Hero Section */
.hero { min-height: 100vh; display: flex; align-items: center; padding-top: 80px; }
.hero-container { display: flex; align-items: center; justify-content: space-between; gap: 40px; }
.hero-content { flex: 1; }
.hero-subtitle { color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 15px; font-size: 14px; display: block; }
.hero-title { font-size: 52px; line-height: 1.2; font-weight: 800; margin-bottom: 20px; word-wrap: break-word; }
.hero-description { color: var(--text-muted); font-size: 17px; margin-bottom: 30px; line-height: 1.8; }
.hero-btns { display: flex; gap: 15px; flex-wrap: wrap; }
.hero-image { flex: 1; display: flex; justify-content: center; }

.image-wrapper { 
    width: 100%; max-width: 360px; aspect-ratio: 1 / 1; 
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(168, 85, 247, 0.2)); 
    border: 1px solid var(--border-color); 
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; 
    display: flex; justify-content: center; align-items: center; 
    font-size: clamp(60px, 10vw, 100px); color: #fff; animation: morph 8s infinite ease-in-out; box-shadow: var(--shadow); 
}
@keyframes morph { 0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; } 50% { border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%; } }

/* About Section */
.about-container { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; align-items: center; }
.about-text p { color: var(--text-muted); margin-bottom: 15px; font-size: 16px; line-height: 1.8; }
.about-text strong { color: #fff; font-weight: 500; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 15px; margin-top: 30px; }
.stat-box { background: var(--card-bg); border: 1px solid var(--border-color); padding: 15px 10px; border-radius: 12px; text-align: center; }
.stat-box h3 { font-size: 26px; color: var(--primary); margin-bottom: 5px; font-weight: 800; }
.stat-box p { font-size: 12px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; margin: 0; }
.skills-card { background: var(--card-bg); border: 1px solid var(--border-color); padding: 35px; border-radius: 16px; }
.skills-card h3 { margin-bottom: 20px; font-size: 22px; }
.skills-wrapper { display: flex; flex-wrap: wrap; gap: 10px; }
.skill-pill { background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); padding: 8px 16px; border-radius: 30px; font-size: 13px; color: #cbd5e1; transition: 0.3s; }
.skill-pill:hover { background: var(--primary-gradient); color: #fff; border-color: transparent; transform: translateY(-3px); }

/* Services */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; }
.service-card { background: var(--card-bg); border: 1px solid var(--border-color); padding: 35px 25px; border-radius: 16px; text-align: center; transition: 0.4s; }
.service-card:hover { transform: translateY(-10px); border-color: rgba(59,130,246,0.5); }
.icon-box { width: 65px; height: 65px; background: rgba(59,130,246,0.1); color: var(--primary); font-size: 26px; display: flex; align-items: center; justify-content: center; border-radius: 50%; margin: 0 auto 20px; transition: 0.3s; }
.service-card:hover .icon-box { background: var(--primary-gradient); color: #fff; transform: scale(1.1); }
.service-card h3 { font-size: 20px; margin-bottom: 12px; color: #fff; }
.service-card p { color: var(--text-muted); font-size: 14px; }

/* =========================================
   PROJECTS GRID - FIXED FOR COMPACT SIZES
   ========================================= */
.projects-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); /* Strict 3 columns on desktop to prevent huge sizes */
    gap: 30px; 
}
.project-card { 
    background: var(--card-bg); 
    border: 1px solid var(--border-color); 
    border-radius: 16px; 
    overflow: hidden; 
    transition: 0.3s; 
    box-shadow: var(--shadow);
}
.project-card:hover { 
    transform: translateY(-8px); 
    border-color: rgba(168,85,247,0.4); 
}
.project-img-box { 
    position: relative; 
    height: 180px; /* Compact height for perfect aspect ratio */
    overflow: hidden; 
}
.project-img-box img, .placeholder-img { 
    width: 100%; height: 100%; object-fit: cover; transition: 0.5s; 
}
.placeholder-img { 
    background: #1e293b; display: flex; align-items: center; 
    justify-content: center; font-size: 40px; color: rgba(255,255,255,0.1); 
}
.project-card:hover .project-img-box img { transform: scale(1.05); }
.project-overlay { 
    position: absolute; inset: 0; background: rgba(5,8,16,0.85); 
    display: flex; align-items: center; justify-content: center; 
    opacity: 0; transition: 0.3s; backdrop-filter: blur(2px); 
}
.project-card:hover .project-overlay { opacity: 1; }
.project-info { padding: 20px; }
.project-info h3 { font-size: 18px; margin-bottom: 8px; color: #fff; line-height: 1.3; }
.project-info p { color: var(--text-muted); font-size: 14px; line-height: 1.5; }

/* Contact Form */
.contact-card { max-width: 700px; margin: 0 auto; background: var(--card-bg); border: 1px solid var(--border-color); padding: 35px; border-radius: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.form-input { 
    width: 100%; padding: 15px; border-radius: 8px; border: 1px solid var(--border-color); 
    background: rgba(0,0,0,0.3); color: #fff; font-family: inherit; font-size: 16px; 
    outline: none; box-sizing: border-box; 
}
.form-input:focus { border-color: var(--primary); background: rgba(0,0,0,0.6); }
.full-width { width: 100%; margin-bottom: 20px; }
button.full-width { margin-bottom: 0; border: none; font-size: 16px; font-weight: 600; padding: 15px; border-radius: 8px; }

/* Footer */
.footer { background: #020408; border-top: 1px solid var(--border-color); padding: 50px 0 25px; }
.footer-title { font-size: 24px; margin-bottom: 20px; font-weight: 800; word-wrap: break-word; }
.social-links a { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.05); color: #fff; text-decoration: none; font-size: 16px; margin: 0 5px; border: 1px solid var(--border-color); transition: 0.3s; }
.social-links a:hover { background: var(--primary-gradient); border-color: transparent; transform: translateY(-3px); }
.copyright { color: var(--text-muted); font-size: 13px; margin-top: 25px; }


/* =========================================
   RESPONSIVE DESIGN (Desktop/Tablet)
   ========================================= */
@media (max-width: 992px) {
    .hero-title { font-size: 42px; }
    .image-wrapper { max-width: 300px; }
    .about-container { grid-template-columns: 1fr; gap: 40px; }
    .about-text { text-align: center; }
    .section-title.text-center, .about-text .section-title { text-align: center; }
    
    /* Change Projects Grid to 2 columns on Tablet */
    .projects-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =========================================
   ULTRA-PREMIUM FULL-SCREEN MOBILE MENU
   ========================================= */
@media (max-width: 768px) {
    .section { padding: 70px 0; }
    
    .hamburger { display: block; }

    /* Immersive Full-Screen Menu */
    .nav-links { 
        position: fixed; 
        top: 0; 
        left: 0; 
        width: 100vw; 
        height: 100vh; 
        background: rgba(5, 8, 16, 0.96); 
        backdrop-filter: blur(20px); 
        -webkit-backdrop-filter: blur(20px);
        display: flex; 
        flex-direction: column; 
        align-items: center; 
        justify-content: center;
        gap: 35px; 
        z-index: 1001; 
        
        /* Fade-in & Scale animation */
        opacity: 0;
        visibility: hidden;
        transform: translateY(-20px) scale(0.98);
        transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    }
    
    .nav-links.active { 
        opacity: 1; 
        visibility: visible; 
        transform: translateY(0) scale(1);
    }

    .nav-link { 
        font-size: 24px; /* Large immersive typography */
        font-weight: 600; 
        width: auto; 
        text-align: center; 
        padding: 5px 20px; 
        color: #fff;
    }
    
    .nav-link:not(.btn-nav)::after { display: none; }
    .nav-link.active:not(.btn-nav) { 
        background: var(--primary-gradient); 
        -webkit-background-clip: text; 
        -webkit-text-fill-color: transparent; 
    }
    
    .btn-nav { 
        border: 1px solid var(--primary); 
        background: transparent; 
        padding: 12px 35px; 
        border-radius: 50px;
        font-size: 20px;
        margin-top: 10px;
    }

    /* Hero Fixes */
    .hero { min-height: auto; padding-top: 130px; padding-bottom: 50px; }
    .hero-container { flex-direction: column-reverse; text-align: center; gap: 30px; }
    .hero-title { font-size: 34px; margin-bottom: 15px; }
    .hero-description { font-size: 16px; margin-bottom: 25px; }
    .hero-btns { flex-direction: column; width: 100%; gap: 15px; }
    .btn { width: 100%; justify-content: center; }
    .btn-outline { margin-left: 0; }
    .image-wrapper { max-width: 260px; }

    /* Change Projects Grid to 1 column on Mobile */
    .services-grid, .projects-grid, .form-row { grid-template-columns: 1fr; gap: 20px; }
    .stats-grid { grid-template-columns: 1fr; gap: 12px; }
    
    /* Content Padding Fix */
    .container { width: 92%; }
    .contact-card, .skills-card { padding: 30px 20px; }
    .service-card { padding: 35px 20px; }
    
    .section-title { font-size: 28px; margin-bottom: 30px; }
}

/* Small Phones */
@media (max-width: 480px) {
    .hero-title { font-size: 28px; }
    .image-wrapper { max-width: 220px; }
    .footer-title { font-size: 22px; }
}