/* =========================================
   1. FOUNDATION & VARIABLES
   ========================================= */
:root {
    --bg-color: #0a0f16;
    --text-primary: #f0f4f8;
    --text-secondary: #a0aec0;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --nav-bg: rgba(10, 15, 22, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

h1 { font-size: clamp(2.5rem, 5vw, 4.5rem); line-height: 1.1; margin-bottom: 20px;}
.highlight { color: var(--accent-color); }
p { color: var(--text-secondary); margin-bottom: 30px; font-size: 1.1rem; }

/* =========================================
   2. GLOBAL LAYOUT & UTILITIES
   ========================================= */
.section-padding { padding: 100px 20px; }
.container { max-width: 1200px; margin: 0 auto; z-index: 1; }
.bg-darker { background-color: #05080c; }

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 60px;
}
.section-title span { color: var(--accent-color); }

.text-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    font-size: 1.2rem;
}

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

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 40px;
}

/* =========================================
   3. NAVIGATION
   ========================================= */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 0;
    z-index: 1000;
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
}

nav.scrolled {
    padding: 15px 0;
    background-color: var(--nav-bg);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

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

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 1px;
}
.logo span { color: var(--accent-color); }

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    transition: color 0.3s;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }

/* =========================================
   4. BUTTONS
   ========================================= */
.btn-cta, .btn-primary, .btn-secondary {
    padding: 12px 28px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.btn-cta, .btn-primary {
    background-color: var(--accent-color);
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-cta:hover, .btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

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

.btn-secondary:hover {
    background-color: var(--text-primary);
    color: var(--bg-color);
    transform: translateY(-2px);
}

.btn-text {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    margin-top: 15px;
    display: inline-block;
}
.btn-text:hover { text-decoration: underline; }

/* =========================================
   5. SECTIONS & COMPONENTS
   ========================================= */
.card, .project-card, .testimonial-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

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

.card h3, .project-card h3 { margin-bottom: 15px; font-size: 1.5rem; }
.testimonial-card p { font-style: italic; font-size: 1.1rem; }
.testimonial-card h4 { color: var(--accent-color); margin-top: 20px; }

/* =========================================
   6. HERO BACKGROUND CROSSFADE
   ========================================= */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 20px;
    position: relative;
    background: none; 
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: -1;
    opacity: 0;
    animation: fadeLoop 24s infinite;
}

.bg-1 { background-image: url('https://picsum.photos/id/0/1920/1080'); animation-delay: 0s; }
.bg-2 { background-image: url('https://picsum.photos/id/20/1920/1080'); animation-delay: 6s; }
.bg-3 { background-image: url('https://picsum.photos/id/119/1920/1080'); animation-delay: 12s; }
.bg-4 { background-image: url('https://picsum.photos/id/160/1920/1080'); animation-delay: 18s; }

@keyframes fadeLoop {
    0% { opacity: 0; transform: scale(1); }
    10% { opacity: 0.85; }
    25% { opacity: 0.85; }
    35% { opacity: 0; transform: scale(1.05); }
    100% { opacity: 0; }
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(10, 15, 22, 0.4), rgba(10, 15, 22, 0.9));
    z-index: 1;
}

.hero-content { max-width: 800px; }
.hero-buttons { display: flex; gap: 20px; justify-content: center; }

/* =========================================
   7. INFINITE MARQUEE SCROLL
   ========================================= */
.marquee-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    padding: 20px 0;
}

.marquee-container::before,
.marquee-container::after {
    content: "";
    position: absolute;
    top: 0;
    width: 150px;
    height: 100%;
    z-index: 2;
}
.marquee-container::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-color), transparent);
}
.marquee-container::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-color), transparent);
}

.marquee-track {
    display: flex;
    width: max-content;
    gap: 30px;
    animation: scrollMarquee 30s linear infinite; 
}

.marquee-track:hover {
    animation-play-state: paused;
}

.marquee-track .project-card {
    width: 400px; 
    flex-shrink: 0;
    margin: 0;
}

@keyframes scrollMarquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-50% - 15px)); } 
}

/* =========================================
   8. ANIMATIONS (ON SCROLL)
   ========================================= */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   9. FOOTER
   ========================================= */
footer {
    background-color: #020406;
    padding: 40px 20px;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 10px;
}
.footer-logo span { color: var(--accent-color); }

/* =========================================
   10. FORMS & INPUTS
   ========================================= */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-form input, 
.contact-form textarea,
.newsletter-form input {
    width: 100%;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.contact-form input:focus, 
.contact-form textarea:focus,
.newsletter-form input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
}

.newsletter-form {
    display: flex;
    flex-direction: row;
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
}

.newsletter-form input {
    flex: 1;
    border-radius: 30px; 
}

.newsletter-form button {
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 15px 35px;
    border-radius: 30px; 
}

/* =========================================
   11. PORTFOLIO TECH TAGS
   ========================================= */
.tech-stack {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
    margin-bottom: 20px;
}

.tech-tag {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 5px 12px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
    border-radius: 20px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* =========================================
   12. MOBILE RESPONSIVENESS (MEDIA QUERIES)
   ========================================= */

/* Tablets & Large Phones (768px and below) */
@media (max-width: 768px) {
    /* 1. Spacing Adjustments */
    .section-padding { padding: 60px 15px; }
    .section-title { font-size: 2rem; margin-bottom: 40px; }
    
    /* 2. Grid Overrides - Force columns to stack */
    .grid-3, .grid-2 { 
        grid-template-columns: 1fr; 
        gap: 20px;
    }

    /* 3. Navbar - Stack cleanly */
    nav { padding: 15px 0; }
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    nav .btn-cta { 
        display: none; /* Hide the top-right CTA button to save screen space */
    }

    /* 4. Hero Section */
    h1 { font-size: 2.2rem; }
    .hero-buttons { 
        flex-direction: column; 
        width: 100%;
        padding: 0 20px;
    }
    .hero-buttons a { width: 100%; }

    /* 5. Infinite Marquee */
    .marquee-track .project-card { width: 280px; } /* Shrink cards to fit screen */
    .marquee-container::before, 
    .marquee-container::after { width: 50px; } /* Shrink the fade-out edges */

    /* 6. Forms */
    /* Force the First/Last name row to stack on mobile */
    .contact-form > div { 
        flex-direction: column !important; 
        gap: 20px !important; 
    }
    
    /* Force Newsletter form to stack */
    .newsletter-form {
        flex-direction: column;
    }
    .newsletter-form button {
        width: 100%;
    }
}

/* Small Phones (480px and below) */
@media (max-width: 480px) {
    h1 { font-size: 1.8rem; }
    .nav-links { gap: 10px; font-size: 0.85rem; }
    .project-card, .card, .testimonial-card { padding: 25px; } /* Reduce card padding */
}