/* =========================================
   1. IMPORTS & VARIABLES
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=JetBrains+Mono:wght@400&display=swap');

:root {
    /* Colors */
    --bg-dark: #05070A;
    --bg-card: #0F1218;
    --accent-cyan: #00E1FF;
    --accent-purple: #7B2CBF;
    --text-main: #FFFFFF;
    --text-muted: #A0AABF;
    
    /* Borders & Effects */
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(15, 18, 24, 0.6);
}

/* =========================================
   2. GLOBAL RESET & BASE STYLES
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* Crucial for preventing scrollbars */
}

html, body {
    width: 100%;
    overflow-x: hidden; /* Forces no horizontal scrollbar */
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
}

ul { list-style: none; }
a { text-decoration: none; }

/* =========================================
   3. UTILITY CLASSES
   ========================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%; /* Ensure it doesn't overflow */
}

.glow-text {
    text-shadow: 0 0 20px rgba(0, 225, 255, 0.5);
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 50px;
    text-align: center;
}

/* Primary Button Styling */
.btn-primary {
    display: inline-block;
    background: linear-gradient(90deg, var(--accent-cyan), #00b8d4);
    color: #000;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 700;
    box-shadow: 0 0 20px rgba(0, 225, 255, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 225, 255, 0.6);
}

/* =========================================
   4. HEADER & NAVIGATION
   ========================================= */
header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 0;
    z-index: 1000;
    background: rgba(5, 7, 10, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* =========================================
   FORM STYLES
   ========================================= */
.form-input {
    width: 100%;
    padding: 15px;
    background: #05070A;
    border: 1px solid #333;
    color: white;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    outline: none;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}
.logo span { color: var(--accent-cyan); }

.nav-links a {
    color: var(--text-muted);
    margin-left: 30px;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.nav-links a:hover { color: var(--accent-cyan); }

/* Hamburger (hidden on desktop) */
.hamburger {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
}

.nav-cta { margin-left: 20px; color: #05070a !important }

/* =========================================
   5. HERO SECTION
   ========================================= */
.hero {
    min-height: 100vh; /* Changed to min-height for safety */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: radial-gradient(circle at 50% 50%, #1a1f2e 0%, var(--bg-dark) 70%);
    position: relative;
    padding-top: 80px; /* Offset for header */
}

/* Background Grid Effect */
.hero::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.3;
    pointer-events: none;
}

.hero-content h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 20px;
    background: -webkit-linear-gradient(#fff, #a0aabf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    color: var(--text-muted);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

/* =========================================
   6. TECH STACK BAR
   ========================================= */
.tech-stack {
    margin-top: -50px; /* Overlap hero */
    margin-bottom: 100px;
    position: relative;
    z-index: 10;
}

.tech-bar {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-wrap: wrap; /* Allows wrapping on desktop */
}

.tech-item {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    font-weight: 600;
    opacity: 0.7;
}

/* =========================================
   7. SERVICES GRID
   ========================================= */
.services { padding: 80px 0; }

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

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

.icon-box {
    width: 60px;
    height: 60px;
    background: rgba(0, 225, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    color: var(--accent-cyan);
    font-size: 1.5rem;
}

.card h3 { margin-bottom: 15px; font-size: 1.5rem; }
.card p { color: var(--text-muted); font-size: 0.95rem; }

/* =========================================
   8. PORTFOLIO SECTION
   ========================================= */
.portfolio { padding: 100px 0; }

.portfolio-item {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    margin-bottom: 60px;
}

.portfolio-img {
    flex: 1;
    height: 400px;
    background: #151921;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.portfolio-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portfolio-text {
    flex: 1;
    padding: 60px;
}
.tech-bar{
    margin-top:4rem;
}

.portfolio-text h3 { font-size: 2rem; margin-bottom: 20px; }

.tags { margin-bottom: 20px; }
.tags span {
    display: inline-block;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    margin-right: 10px;
    color: var(--accent-cyan);
}

/* =========================================
   9. FOOTER
   ========================================= */
footer {
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: 100px;
    padding: 80px 0;
    background: #020305;
}

/* =================================================================
   10. MOBILE RESPONSIVE DESIGN (FIXED & STACKED)
   ================================================================= */
@media (max-width: 768px) {
    
    /* --- Mobile Header & Nav --- */
    header {
        padding: 15px 0;
    }
    
    nav {
        align-items: center;
        position: relative;
    }

    .hamburger { display: inline-flex; align-items:center; }

    /* Hide nav-links by default on mobile, show when body.nav-open */
    .nav-links {
        display: none;
        position: absolute;
        right: 20px;
        top: 70px;

    /* Make contact grid single column on mobile */
    .contact-grid { grid-template-columns: 1fr; }
        background: rgba(5,7,10,0.98);
        padding: 18px;
        border-radius: 12px;
        border: 1px solid var(--glass-border);
        flex-direction: column;
        gap: 12px;
        min-width: 200px;
        z-index: 1200;
    }

    body.nav-open .nav-links {
        display: flex;
    }

    .nav-links a {
        margin-left: 0;
        font-size: 0.85rem;
        padding: 5px;
    }

    /* --- Mobile Hero --- */
    .hero {
        margin-top: 4rem;
        padding: 160px 0 60px; /* Increased top padding for stacked nav */
        height: auto;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
        line-height: 1.2;
    }

    /* --- Tech Stack (Stacked Layout) --- */
    .tech-stack {
        margin-top: 0;
        margin-bottom: 60px;
        padding: 0 20px;
    }

    .tech-bar {
        /* This ensures "Things below others" behavior */
        flex-direction: row; 
        flex-wrap: wrap; /* WRAP items to next line instead of scrolling */
        justify-content: center;
        padding: 20px;
        gap: 20px;
    }
    
    .tech-item {
        font-size: 0.9rem;
    }

    /* --- Mobile Cards (Stacked) --- */
    .grid-3 {
        grid-template-columns: 1fr; /* Force single column */
        gap: 30px;
    }
    
    .card {
        padding: 30px 20px;
        text-align: center;
    }
    
    .card .icon-box {
        margin: 0 auto 20px; /* Center Icon */
    }

    /* --- Mobile Portfolio (Stacked) --- */
    .portfolio-item {
        flex-direction: column; /* Image top, text bottom */
        margin-bottom: 40px;
        height: auto;
    }

    .portfolio-img {
        width: 100%;
        height: 250px;
        border-bottom: 1px solid var(--glass-border);
    }

    .portfolio-text {
        padding: 30px 20px;
        text-align: center;
    }
    
    .tags {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .tags span { margin: 0; }

    /* --- Mobile Footer (Stacked) --- */
    footer {
        text-align: center;
        padding: 60px 0 100px;
    }
    
    footer .container > div {
        display: flex;
        flex-direction: column; /* Stack footer columns */
        gap: 40px;
    }
    
    /* Center aligns specific footer elements */
    footer div:nth-child(3) {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .container{
        display: flex;
        flex-direction: column;
    }
    
    /* Extra breakpoint for small tablets / large phones where two-column form may still collapse badly */
    @media (max-width: 992px) {
        .contact-grid { grid-template-columns: 1fr; }
    }
}

/* Ensure main content sits below fixed header */
main { padding-top: 100px; }