/* =========================================
   CSS Reset & Variables
   ========================================= */
   :root {
    /* Dark Mode (Default) - True Black Layout */
    --bg-color: #000000;
    --bg-navbar: rgba(0, 0, 0, 0.85);
    --bg-light: #111111;
    --bg-lighter: #222222;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --accent: #3b82f6; /* A clean blue for both modes */
    --accent-glow: rgba(59, 130, 246, 0.25);
    --box-shadow: rgba(255, 255, 255, 0.05);

    /* Fonts */
    --font-main: 'Outfit', sans-serif;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}

body.light-mode {
    /* Light Mode */
    --bg-color: #ffffff;
    --bg-navbar: rgba(255, 255, 255, 0.9);
    --bg-light: #f3f4f6;
    --bg-lighter: #e5e7eb;
    --text-primary: #111827; /* Black text */
    --text-secondary: #4b5563;
    --accent: #2563eb; /* Darker blue accent */
    --accent-glow: rgba(37, 99, 235, 0.15);
    --box-shadow: rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    width: 100vw;
    max-width: 100vw;
}

ul {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* =========================================
   Reusable Components 
   ========================================= */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Base section padding */
.section {
    padding: 80px 0;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    font-size: clamp(1.5rem, 5vw, 2rem);
    color: var(--text-primary);
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    white-space: nowrap;
}

.section-title::after {
    content: "";
    flex: 1;
    max-width: 300px;
    height: 1px;
    background-color: var(--bg-lighter);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-align: center;
}

.btn-primary {
    background-color: transparent;
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3); /* Base strong shadow */
}

.btn-primary:hover {
    background-color: var(--accent-glow);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.6); /* Raised heavy neon hover */
}

.btn-secondary {
    background-color: var(--bg-lighter);
    color: var(--text-primary);
    box-shadow: 0 4px 15px var(--box-shadow);
}

.btn-secondary:hover {
    background-color: var(--bg-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 255, 255, 0.15); /* Strong deeper white/grey shadow */
}

/* =========================================
   Navigation
   ========================================= */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    height: 70px;
    background-color: var(--bg-navbar);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: var(--transition);
}

.navbar.scrolled {
    box-shadow: 0 10px 30px -10px var(--box-shadow);
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
    z-index: 1001; /* Stay above mobile menu */
}

.logo span {
    color: var(--text-primary);
}

.animated-logo {
    font-size: 1.6rem;
    font-weight: 700;
    display: inline-block;
    background: linear-gradient(90deg, var(--text-primary), var(--accent), #8b5cf6, var(--accent), var(--text-primary));
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: slideLogo 5s linear infinite;
}

@keyframes slideLogo {
    to { background-position: 200% center; }
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

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

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    z-index: 1001;
}

.theme-toggle:hover {
    color: var(--accent);
}

.hamburger {
    display: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 1001;
}

/* =========================================
   Hero Section
   ========================================= */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding-top: 100px;
    overflow: hidden;
}

.hero::after {
    content: "";
    position: absolute;
    bottom: -1px; /* Overlap slightly for extreme displays */
    left: 0;
    width: 100%;
    height: 18vh;
    background: linear-gradient(to top, var(--bg-color) 0%, transparent 100%);
    z-index: 3;
    pointer-events: none; /* Let clicks pass to buttons easily */
}

.hero-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    opacity: 0.85; /* Makes text pop over moving video */
    z-index: 1;
    transition: background-color 0.3s ease;
}

.hero-container {
    position: relative;
    z-index: 2;
}

.hero-content {
    max-width: 1000px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3rem;
}

.hero-text-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hero-photo-large {
    width: clamp(200px, 35vw, 360px);
    height: auto;
    object-fit: cover;
    z-index: 5;
    position: relative;
    /* Removed heavy animated filter for drastic speed improvements */
    animation: floatImage 5s ease-in-out infinite;
    filter: drop-shadow(0 15px 30px rgba(59, 130, 246, 0.4));
    will-change: transform;
}

@keyframes floatImage {
    0% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-15px) scale(1.02); }
    100% { transform: translateY(0px) scale(1); }
}

.greeting {
    color: var(--accent);
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-family: monospace;
}

.name {
    font-size: clamp(2.2rem, 6vw, 4.5rem); 
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 15px;
}

/* New Typewriter Animation for Web Developer */
.type-animation {
    font-size: clamp(1.4rem, 5vw, 3.5rem); /* Reduced minimum clamp to ensure 320px devices do not overflow */
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 30px;
    color: var(--accent);
}

.typewriter {
    display: inline-block;
    overflow: hidden; 
    border-right: 0.15em solid var(--accent); 
    white-space: nowrap; 
    letter-spacing: 0.05em; 
    animation: typing 3s steps(18, end) infinite alternate,
               blink-caret 0.8s step-end infinite;
}

@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: var(--accent); }
}

.tagline {
    font-size: clamp(1rem, 3vw, 1.2rem);
    color: var(--text-secondary);
    max-width: 500px;
    margin-bottom: 40px;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap; /* Important for very small mobile screens */
}

/* Initial load animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease-out forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-shapes {
    display: none; /* Hidden intelligently so video has priority */
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
}

.shape-1 {
    width: clamp(200px, 40vw, 400px);
    height: clamp(200px, 40vw, 400px);
    background: var(--accent-glow);
    top: 10%;
    right: -10vw;
}

.shape-2 {
    width: clamp(150px, 30vw, 300px);
    height: clamp(150px, 30vw, 300px);
    background: var(--bg-lighter);
    bottom: 10%;
    left: 20vw;
    opacity: 0.5;
}

/* =========================================
   About Section
   ========================================= */
.about-content {
    max-width: 800px;
}

.about-text p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.about-text strong {
    color: var(--accent);
    font-weight: 500;
}

/* =========================================
   Skills Section
   ========================================= */
.skills-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 3rem;
}

.skills-category h3 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 600;
}

.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.skill-pill {
    background-color: var(--bg-light);
    padding: 0.6rem 1rem;
    border-radius: 50px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

.skill-pill:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--box-shadow);
}

.skill-bars {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.skill-bar-item {
    width: 100%;
}

.skill-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.skill-info i {
    color: var(--accent);
    margin-right: 5px;
}

.progress-line {
    background: var(--bg-lighter);
    width: 100%;
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
}

.progress-line span {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 10px;
    width: 0;
    transition: width 1.5s ease-in-out;
}

/* =========================================
   Projects Section
   ========================================= */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.project-card {
    background-color: var(--bg-light);
    border-radius: 8px;
    transition: var(--transition);
    position: relative;
    top: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent image overflow clipping */
    border: 2px solid transparent; /* Restore border safely */
    box-shadow: 0 10px 20px var(--box-shadow); /* Solid baseline shadow */
    will-change: transform, box-shadow, border-color; /* Explicitly hardware accelerate these components for speed */
}

@keyframes cardHoverGlow {
    0% { 
        border-color: var(--accent); 
        /* Massively boosted bottom shadow dropping downwards */
        box-shadow: 0 20px 40px var(--box-shadow), 0 10px 20px rgba(59, 130, 246, 0.5); 
    }
    100% { 
        border-color: #8b5cf6; /* Transition pulse to violet */
        /* Increased bottom depth drop shadow drastically */
        box-shadow: 0 25px 50px var(--box-shadow), 0 15px 40px rgba(139, 92, 246, 0.8); 
    }
}

.project-card:hover {
    transform: translateY(-10px);
    animation: cardHoverGlow 3.5s infinite alternate;
}

.project-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    border-bottom: 2px solid var(--accent);
}

.project-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.project-links a {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-left: 15px;
}

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

.project-title {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.project-card:hover .project-title {
    color: var(--accent);
}

.project-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    flex-grow: 1;
}

.project-tech {
    display: flex;
    flex-wrap: wrap; /* important so long text does not overflow */
    gap: 15px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: monospace;
}

/* =========================================
   Contact Section
   ========================================= */
.contact {
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.contact .section-title {
    justify-content: center;
}
.contact .section-title::after {
    display: none;
}

.contact-desc {
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-size: 1.05rem;
}

.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: flex-start;
    text-align: left;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group input, 
.form-group textarea {
    width: 100%;
    padding: 1.2rem;
    background: var(--bg-light);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-lighter);
}

.submit-btn {
    width: 100%;
    padding: 1.2rem;
    font-size: 1.1rem;
    border-radius: 8px;
}

.contact-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.contact-card {
    background-color: var(--bg-light);
    padding: 1.5rem;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.contact-card i {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.contact-card h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.contact-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.contact-card:hover {
    transform: translateY(-5px);
    background-color: var(--bg-lighter);
}

/* =========================================
   Footer
   ========================================= */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.social-links-footer {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.social-links-footer a {
    font-size: 1.3rem;
    color: var(--text-secondary);
}

.social-links-footer a:hover {
    color: var(--accent);
    transform: translateY(-3px);
}

/* =========================================
   Responsive Media Queries
   ========================================= */

@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70vw;
        max-width: 300px;
        height: 100vh;
        background-color: var(--bg-light);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: var(--transition);
        box-shadow: -10px 0 30px -15px var(--box-shadow);
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links li {
        margin: 1.5rem 0;
    }
    
    .nav-right {
        gap: 1rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-wrapper {
        grid-template-columns: 1fr;
    }

    .hero-content {
        flex-direction: column-reverse; /* Stack image on top of text on small phones */
        align-items: center; 
        text-align: center;
        gap: 1.5rem;
    }
    .hero-photo-large {
        filter: none; /* Disable expensive drop-shadow on mobile */
        animation: none; /* Reduce battery consumption and compute on mobile */
    }
    .hero-text-wrap {
        align-items: center;
    }
    .typewriter {
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .hero-buttons a {
        width: 100%;
    }

    .section {
        padding: 60px 0;
    }
}
