@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. BULLETPROOF RESET & OVERFLOW FIX */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden; /* THE MOST IMPORTANT LINE TO PREVENT MOBILE BREAKING */
    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; }

/* Typography & Utilities */
.container { 
    width: 90%; 
    max-width: 1150px; 
    margin: 0 auto; 
}

.section { padding: 90px 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; }

/* Navigation */
.header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    background: rgba(5, 8, 16, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color); transition: 0.3s;
}
.header.scrolled { background: rgba(5, 8, 16, 0.98); 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 */
.hamburger { display: none; cursor: pointer; width: 28px; height: 20px; position: relative; z-index: 1002; }
.hamburger .bar { position: absolute; width: 100%; height: 2px; background: #fff; border-radius: 2px; transition: 0.3s; }
.hamburger .bar:nth-child(1) { top: 0; }
.hamburger .bar:nth-child(2) { top: 9px; }
.hamburger .bar:nth-child(3) { top: 18px; }
.hamburger.active .bar:nth-child(1) { transform: rotate(45deg); top: 9px; }
.hamburger.active .bar:nth-child(2) { opacity: 0; }
.hamburger.active .bar:nth-child(3) { transform: rotate(-45deg); top: 9px; }

/* Hero Section */
.hero { min-height: 100vh; display: flex; align-items: center; padding-top: 100px; }
.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: 48px; line-height: 1.2; font-weight: 800; margin-bottom: 20px; word-wrap: break-word; }
.hero-description { color: var(--text-muted); font-size: 16px; 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; }

/* Fix: Used max-width and aspect-ratio instead of fixed height to ensure fluid shrinking */
.image-wrapper { 
    width: 100%; max-width: 350px; 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; 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: 24px; 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: 30px; 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; }

/* Services Grid */
.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; }
.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; }
.service-card h3 { font-size: 20px; margin-bottom: 12px; color: #fff; }
.service-card p { color: var(--text-muted); font-size: 14px; }

/* Projects Grid */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; }
.project-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px; overflow: hidden; }
.project-img-box { position: relative; height: 200px; overflow: hidden; }
.project-img-box img, .placeholder-img { width: 100%; height: 100%; object-fit: cover; }
.placeholder-img { background: #1e293b; display: flex; align-items: center; justify-content: center; font-size: 40px; color: rgba(255,255,255,0.1); }
.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; }
.project-card:hover .project-overlay { opacity: 1; }
.project-info { padding: 20px; }
.project-info h3 { font-size: 18px; margin-bottom: 8px; color: #fff; }
.project-info p { color: var(--text-muted); font-size: 14px; }

/* 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; }

/* Crucial fix for iOS zoom bug: font-size 16px on inputs */
.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; max-width: 100%; 
}
.form-input:focus { border-color: var(--primary); background: rgba(0,0,0,0.6); }
.full-width { width: 100%; margin-bottom: 20px; max-width: 100%; }
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); }
.copyright { color: var(--text-muted); font-size: 13px; margin-top: 25px; }

/* =========================================
   BULLETPROOF RESPONSIVE MEDIA QUERIES
   ========================================= */

/* Tablets & Small Laptops (Max 992px) */
@media (max-width: 992px) {
    .hero-title { font-size: 40px; }
    .image-wrapper { max-width: 280px; }
    .about-container { grid-template-columns: 1fr; gap: 40px; }
    .about-text { text-align: center; }
    .section-title.text-center, .about-text .section-title { text-align: center; }
}

/* Mobile Devices (Max 768px) - THE ULTIMATE FIX */
@media (max-width: 768px) {
    .section { padding: 60px 0; }
    
    /* Hamburger & Mobile Nav System */
    .hamburger { display: block; }
    .nav-links { 
        position: fixed; top: 80px; right: -100%; width: 100%; height: calc(100vh - 80px); 
        background: #050810; flex-direction: column; align-items: center; justify-content: flex-start;
        padding-top: 30px; gap: 20px; transition: right 0.4s ease; border-top: 1px solid var(--border-color);
        overflow-y: auto; /* Allow scroll inside menu if needed */
    }
    .nav-links.active { right: 0; }
    .nav-link { font-size: 16px; width: 100%; text-align: center; display: block; padding: 10px 0; }
    .nav-link:not(.btn-nav)::after { display: none; } /* Hide underline on mobile */
    .btn-nav { border: none; background: transparent; padding: 10px; color: var(--primary); }

    /* Hero Fixes */
    .hero { min-height: auto; padding-top: 120px; padding-bottom: 50px; }
    .hero-container { flex-direction: column-reverse; text-align: center; gap: 30px; }
    .hero-title { font-size: 30px; margin-bottom: 15px; }
    .hero-description { font-size: 15px; margin-bottom: 25px; }
    .hero-btns { flex-direction: column; width: 100%; gap: 12px; }
    .btn { width: 100%; justify-content: center; }
    .btn-outline { margin-left: 0; }

    /* All Grids strictly to 1 column */
    .services-grid, .projects-grid, .form-row { grid-template-columns: 1fr; gap: 20px; }
    
    /* Ensure no padding bursts the screen */
    .container { width: 92%; }
    .contact-card, .skills-card { padding: 25px 15px; }
    .service-card { padding: 30px 20px; }
    
    .section-title { font-size: 26px; margin-bottom: 30px; }
}

/* Small Phones (Max 480px) */
@media (max-width: 480px) {
    .hero-title { font-size: 26px; }
    .image-wrapper { max-width: 220px; }
    .stats-grid { grid-template-columns: 1fr; gap: 10px; } /* Stack stats on very small phones */
    .footer-title { font-size: 20px; }
    .btn { font-size: 14px; padding: 12px 20px; }
}