/* Variables */
:root {
    --primary-color: #4F46E5; /* Deep Indigo - Good choice! */
    --secondary-color: #E0E7FF; /* Lighter Indigo/Lavender for secondary elements */
    --accent-color: #6366F1; /* A slightly lighter shade of primary for subtle hovers/borders */
    --text-dark: #1A202C;    /* Very dark gray for main headings */
    --text-body: #374151;    /* Slightly lighter dark gray for body text */
    --text-light: #6B7280;   /* Medium gray for meta info, less prominent text */
    --bg-light: #F9FAFB;     /* Very light gray for backgrounds */
    --bg-white: #FFFFFF;     /* Pure white for cards, headers */
    --border-color: #C7D2FE; /* A soft indigo for borders */
}

/* Base Styles */
html {
    scroll-behavior: smooth; /* Smooth scrolling for anchor links */
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.7;
    color: var(--text-body);
    background-color: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden; /* Prevent horizontal scroll from elements escaping */
}

/* Utility for hiding elements visually but keeping them for screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    width: 100%; /* Ensure container always takes full width up to max-width */
}

/* Header */
.main-header {
    background-color: var(--bg-white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

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

.navbar-brand {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.3s ease, color 0.3s ease;
    z-index: 1001; /* Ensure brand is above mobile menu toggle */
}

.navbar-brand:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

.navbar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.75rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-body);
    padding: 0.6rem 0.85rem;
    transition: color 0.3s ease, background-color 0.3s ease, border-radius 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: var(--secondary-color);
    border-radius: 0.375rem;
}

/* Mobile Menu Toggle Button */
.menu-toggle {
    display: none; /* Hidden by default on desktop */
    flex-direction: column;
    justify-content: space-between;
    width: 30px; /* Width of the button */
    height: 22px; /* Height of the button */
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001; /* Ensure toggle is above mobile menu */
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 3px; /* Thickness of each bar */
    background: var(--text-dark);
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
}

/* Animations for hamburger to 'X' */
.menu-toggle.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.menu-toggle.open span:nth-child(2) {
    opacity: 0;
}
.menu-toggle.open span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}


/* Main Content Padding */
.main-content {
    padding-top: 5.5rem; /* Adjusted for fixed header */
}

/* Sections */
section {
    padding: 4rem 0;
    /* Removed min-height here to allow sections to truly fit content on mobile */
    display: flex;
    align-items: center;
    justify-content: center; /* Center content vertically and horizontally */
    flex-direction: column; /* Ensure content stacks if not specifically row on desktop */
    text-align: center; /* Default text align for sections */
}

.section-gradient {
    background: linear-gradient(to bottom right, var(--secondary-color), var(--bg-white));
}

.section-white {
    background-color: var(--bg-white);
}

.section-title {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 3.5rem;
    max-width: 90%; /* Prevent title from overflowing on very small screens */
    margin-left: auto;
    margin-right: auto;
}

/* About Section */
.about-content {
    display: flex;
    flex-direction: column; /* Default to column for mobile */
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    text-align: center;
    width: 100%; /* Ensure it uses available width */
}

.about-image-wrapper {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    width: 100%; /* Full width on mobile */
}

.profile-image {
    border-radius: 50%;
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.08);
    border: 5px solid var(--border-color);
    width: 15rem; /* Slightly smaller for mobile */
    height: 15rem; /* Maintain aspect ratio */
    object-fit: cover;
    transition: transform 0.3s ease;
}

.profile-image:hover {
    transform: scale(1.03);
}

.about-text-content {
    width: 100%;
}

.hero-title {
    font-size: 2.5rem; /* Smaller for mobile */
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 1.25rem;
    line-height: 1.2;
}

.hero-title .text-primary {
    color: var(--primary-color);
}

.hero-description {
    font-size: 1rem; /* Smaller for mobile readability */
    color: var(--text-light);
    margin-bottom: 2rem;
    max-width: 100%; /* Allow it to shrink to fit */
    padding: 0 1rem; /* Add some padding on very small screens */
    box-sizing: border-box; /* Include padding in width */
}

.contact-info {
    margin-bottom: 1.75rem;
}

.email-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--primary-color);
    border-radius: 0.6rem;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.email-link:hover {
    background-color: var(--primary-color);
    color: var(--bg-white);
    transform: translateY(-2px);
}

.social-links {
    display: flex;
    justify-content: center; /* Always center on mobile */
    gap: 1.75rem;
    margin-top: 1.75rem;
}

.social-icon {
    width: 2.2rem;
    height: 2.2rem;
    fill: var(--text-light);
    transition: fill 0.3s ease, transform 0.3s ease;
}

.social-links a:hover .social-icon {
    fill: var(--primary-color);
    transform: translateY(-3px);
}

/* Projects Section */
.projects-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: 2rem;
    width: 100%; /* Ensure grid uses full available width */
}

.project-card {
    background-color: var(--bg-white);
    border-radius: 0.875rem;
    box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.08), 0 3px 6px -1px rgba(0, 0, 0, 0.05);
    padding: 2rem; /* Slightly less padding for mobile */
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.1), 0 5px 10px -3px rgba(0, 0, 0, 0.08);
}

.project-card h3 {
    font-size: 1.5rem; /* Smaller for mobile */
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.85rem;
}

.project-card p {
    color: var(--text-light);
    margin-bottom: 1.25rem;
}

.tech-tag {
    display: inline-block;
    background-color: var(--secondary-color);
    color: var(--primary-color);
    font-size: 0.85rem; /* Smaller for mobile */
    font-weight: 600;
    padding: 0.3rem 0.75rem; /* Less padding for mobile */
    border-radius: 0.75rem;
    margin-right: 0.5rem; /* Less margin */
    margin-bottom: 0.5rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.tech-tag:hover {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

/* Skills Section */
.skills-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem; /* Slightly less gap for badges on mobile */
    max-width: 100%; /* Allow it to shrink */
    margin: 0 auto;
    padding: 0 1rem; /* Add padding to prevent overflow */
    box-sizing: border-box;
}

.skill-badge {
    background-color: var(--primary-color);
    color: var(--bg-white);
    font-size: 0.95rem; /* Smaller for mobile */
    font-weight: 500;
    padding: 0.5rem 1rem; /* Less padding for mobile */
    border-radius: 0.8rem;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.skill-badge:hover {
    transform: translateY(-4px);
    background-color: var(--accent-color);
}

/* Footer */
.site-footer {
    background-color: var(--text-dark);
    color: var(--bg-white);
    text-align: center;
    padding: 2rem 1rem; /* Less padding for mobile */
    font-size: 0.85rem; /* Smaller text for mobile */
    line-height: 1.6;
}

.site-footer p {
    margin: 0.5rem 0;
}

/* Utility / Helper Classes */
.text-primary {
    color: var(--primary-color);
}

/* ========================================================= */
/* MEDIA QUERIES                           */
/* ========================================================= */

/* Small Devices (e.g., larger phones, small tablets - 576px and up) */
@media (min-width: 576px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .hero-title {
        font-size: 2.8rem;
    }

    .hero-description {
        font-size: 1.1rem;
        padding: 0; /* Remove extra padding added for very small screens */
    }

    .profile-image {
        width: 16rem;
        height: 16rem;
    }

    .section-title {
        font-size: 3rem;
    }
}


/* Medium Devices (e.g., tablets, larger smartphones - 768px and up) */
@media (max-width: 767px) { /* Styles that apply specifically when BELOW this width (mobile-specific) */
    .navbar-nav {
        /* Mobile menu specific styles */
        display: none; /* Hide by default */
        flex-direction: column;
        position: absolute;
        top: 100%; /* Position right below the header */
        left: 0;
        width: 100%;
        background-color: var(--bg-white);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
        padding: 1rem 0;
        border-top: 1px solid var(--border-color);
        animation: slideDown 0.3s ease-out forwards;
    }

    .navbar-nav.open {
        display: flex; /* Show when open */
    }

    .navbar-nav .nav-item {
        width: 100%;
        text-align: center;
    }

    .navbar-nav .nav-link {
        display: block; /* Make links full width */
        padding: 0.8rem 1rem;
        font-size: 1.1rem;
        border-radius: 0; /* No rounded corners in menu list */
    }

    .menu-toggle {
        display: flex; /* Show hamburger menu button */
    }

    /* Adjust main content padding for when the mobile menu is open */
    body.menu-open {
        overflow: hidden; /* Prevent scrolling body when menu is open */
    }
}

/* Animation for mobile menu */
@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Medium Devices (e.g., tablets, larger smartphones - 768px and up) */
@media (min-width: 768px) {
    .main-content {
        padding-top: 5.5rem; /* Ensure consistent padding for desktop */
    }

    section {
        padding: 5rem 0; /* More generous section padding on larger screens */
    }

    .navbar-nav {
        display: flex; /* Always display on desktop */
        flex-direction: row; /* Horizontal layout */
    }

    .menu-toggle {
        display: none; /* Hide hamburger menu button on desktop */
    }

    .about-content {
        flex-direction: row; /* Horizontal layout for about content */
        text-align: left;
    }

    .about-image-wrapper {
        width: 33.333333%; /* Restore original width */
    }

    .profile-image {
        width: 17rem; /* Restore original size */
        height: 17rem;
    }

    .about-text-content {
        width: 66.666667%;
    }

    .hero-title {
        font-size: 3.2rem; /* Restore original size */
    }

    .hero-description {
        font-size: 1.15rem; /* Restore original size */
        margin-left: 0; /* Align left */
        margin-right: 0;
    }

    .social-links {
        justify-content: flex-start; /* Align left */
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns for medium screens */
    }

    .project-card {
        padding: 2.5rem; /* Restore original padding */
    }

    .project-card h3 {
        font-size: 1.65rem; /* Restore original size */
    }

    .tech-tag {
        font-size: 0.9rem; /* Restore original size */
        padding: 0.35rem 0.85rem; /* Restore original padding */
        margin-right: 0.6rem; /* Restore original margin */
        margin-bottom: 0.6rem;
    }

    .skills-container {
        gap: 0.75rem; /* Restore original gap */
        max-width: 850px; /* Restore original max-width */
        padding: 0; /* Remove extra padding */
    }

    .skill-badge {
        font-size: 1.05rem; /* Restore original size */
        padding: 0.6rem 1.2rem; /* Restore original padding */
    }

    .site-footer {
        padding: 2.5rem 0; /* Restore original padding */
        font-size: 0.9rem; /* Restore original size */
    }

    .site-footer p {
        margin: 0.6rem 0;
    }
}

/* Large Devices (e.g., desktops - 1024px and up) */
@media (min-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 columns for large screens */
    }
}