/* General Styles - YOUR ORIGINAL STYLES */
:root {
    --dark-bg: #1a1a2e;
    --dark-secondary: #16213e;
    --dark-tertiary: #0f3460;
    --accent-color: #e94560;
    --text-light: #e0e0e0;
    --text-dark: #cccccc;
    --border-color: #0f3460;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --pure-black: #000000; /* Added a variable for pure black */
    --header-height: 60px; /* Approximate height of your header */
    --footer-height: 90px; /* Approximate height of your footer (padding 30px top/bottom + text height) */
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

html {
    scroll-behavior: smooth;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #ff6b81;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-light);
    line-height: 1.6;
    /* Removed overflow: hidden; here unless you are actively managing it with JS */
}

/* Header - YOUR ORIGINAL STYLES */
.main-header {
    background-color: var(--dark-secondary);
    padding: 0px 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: var(--header-height); /* Ensure header has a defined height */
}

.logo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 2.2em;
    color: var(--accent-color);
    letter-spacing: 1px;
}

.main-nav ul {
    list-style: none;
    display: flex;
}

.main-nav ul li {
    margin-left: 30px;
}

.main-nav ul li a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1em;
    transition: color 0.3s ease;
    position: relative;
    padding-bottom: 5px;
}

.main-nav ul li a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.main-nav ul li a:hover::after,
.main-nav ul li a.active::after {
    width: 100%;
}

.main-nav ul li a:hover,
.main-nav ul li a.active {
    color: var(--accent-color);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    position: relative;
    z-index: 1001;
}

.hamburger {
    display: block;
    position: relative;
    width: 30px;
    height: 3px;
    background: var(--text-light);
    border-radius: 5px;
    transition: all 0.3s ease-in-out;
}

.hamburger::before, .hamburger::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 3px;
    background: var(--text-light);
    border-radius: 5px;
    transition: all 0.3s ease-in-out;
}

.hamburger::before {
    transform: translateY(-10px);
}

.hamburger::after {
    transform: translateY(10px);
}

.nav-open .hamburger {
    transform: translateX(-50px);
    background: transparent;
}

.nav-open .hamburger::before {
    transform: rotate(45deg) translate(35px, -35px);
}

.nav-open .hamburger::after {
    transform: rotate(-45deg) translate(35px, 35px);
}

/* Portfolio Hero Section - Made Smaller */
.portfolio-hero-section {
    background-color: var(--dark-bg);
    color: var(--text-light);
    padding: 20px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-height: auto;
}

.portfolio-hero-section .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.portfolio-hero-section h2 {
    font-size: 2.8em;
    margin-bottom: 15px;
    font-weight: 700;
    color: var(--accent-color);
    text-align: center;
}

.portfolio-hero-section p {
    font-size: 1.1em;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
    color: var(--text-dark);
    text-align: center;
}

---

/* NEW: Layout for Main Portfolio Content (Grid with Sidebar) */
/* Ensure this container and its child .container stretch to fill space */
.main-portfolio-content {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    padding: 60px 0;
    background-color: var(--dark-bg);
    /* Make this section take up remaining vertical space */
    flex: 1; /* Allow it to grow */
    min-height: 1px; /* Crucial for flex items to correctly calculate height */
    /* If .main-portfolio-content is NOT a direct flex child of body (or html/body with 100% height),
       you might need to ensure its parent also allows it to stretch. */
}

/* Specific container for the main portfolio layout, overriding general .container */
.main-portfolio-content .container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    max-width: 100%;
    padding: 0 0;
    flex: 1; /* Allow this inner container to grow and take available space */
    min-height: 1px; /* Crucial for flex items to correctly calculate height */
}

/* Portfolio Categories/Filter - Now a Left Sidebar */
.portfolio-categories-sidebar {
    flex: 0 0 250px;
    padding-right: 30px;
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: calc(var(--header-height) + 20px + 20px); /* Adjust based on header + hero-section padding */
    align-self: flex-start;
    /* Limit sidebar height too, allowing it to scroll independently if content is too long */
    max-height: calc(100vh - var(--header-height) - 40px - 60px); /* 100vh - header - hero-section (total padding) - main-content-top-padding */
    overflow-y: auto;
    padding-top: 20px;
    padding-bottom: 20px;
    padding-left: 20px;
}

.portfolio-categories-sidebar h3 {
    font-size: 1.6em;
    color: var(--text-light);
    margin-bottom: 25px;
    text-align: left;
    padding-left: 10px;
}

.category-filter {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.filter-btn {
    width: 100%;
    background-color: var(--dark-tertiary);
    color: var(--text-light);
    border: 2px solid var(--dark-tertiary);
    padding: 12px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease, color 0.3s ease, border-color 0.3s ease;
    text-transform: uppercase;
    text-align: left;
    box-shadow: none;
}

.filter-btn:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--pure-black);
    transform: translateX(5px);
}

.filter-btn.active {
    background-color: var(--accent-color);
    color: var(--pure-black);
    border-color: var(--accent-color);
    box-shadow: none;
    font-weight: 700;
}

/* Full Portfolio Grid - Main Content Area */
.full-portfolio-grid-wrapper {
    flex: 1; /* Allow the grid wrapper to take remaining space */
    padding-right: 20px; /* Add padding to the right of the grid */

    /* ***** CORE SCROLLING STYLES (Applies to both desktop and mobile) ***** */
    overflow-y: auto; /* Enable vertical scrolling when content overflows */
    overflow-x: hidden; /* Hide horizontal scrollbar */
    -webkit-overflow-scrolling: touch; /* Improves scrolling performance on iOS */
    padding-top: 5px; /* Optional: Add padding inside the scrollable area */
    padding-bottom: 5px; /* Optional: Add padding inside the scrollable area */
    position: relative; /* Needed for the spotlight effect */

    /* A flexible max-height is often better than a fixed height with calc() */
    max-height: calc(100vh - var(--header-height) - 40px - 60px); /* Default max height for larger screens */

    /* Optional: Style the scrollbar for a custom look (vendor-prefixed) */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: var(--accent-color) var(--dark-secondary); /* Firefox */
}

.full-portfolio-grid-wrapper::-webkit-scrollbar {
    width: 8px;
}

.full-portfolio-grid-wrapper::-webkit-scrollbar-track {
    background: var(--dark-secondary);
    border-radius: 10px;
}

.full-portfolio-grid-wrapper::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 10px;
}

.full-portfolio-grid-wrapper::-webkit-scrollbar-thumb:hover {
    background: #ff6b81;
}

.full-portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
    margin: 0;
    padding: 0;
}

.full-portfolio-item {
    background-color: var(--pure-black);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: transform 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.full-portfolio-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px var(--shadow-color);
}

.full-portfolio-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.full-portfolio-item:hover img {
    transform: scale(1.05);
}

.project-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.project-info h4 {
    font-size: 1.5em;
    margin-top: 0;
    margin-bottom: 5px;
    color: var(--accent-color);
    text-align: left;
}

.project-info p {
    font-size: 0.95em;
    color: var(--text-dark);
    margin-bottom: 15px;
    line-height: 1.5;
    text-align: left;
}

.view-project-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 1em;
    transition: color 0.3s ease, transform 0.2s ease;
}

.view-project-btn:hover {
    color: var(--accent-color);
    transform: translateX(5px);
}

.view-project-btn i {
    font-size: 1.1em;
    vertical-align: middle;
}

.full-portfolio-item .spotlight {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
    z-index: 1;
}

.full-portfolio-item:hover .spotlight {
    opacity: 1;
}

/* Responsive Adjustments for the Portfolio Page with Sidebar */
@media (max-width: 992px) {
    .main-portfolio-content .container {
        flex-direction: column;
        gap: 40px;
        padding: 0 20px; /* Re-introduce horizontal padding for smaller screens */
    }

    .portfolio-categories-sidebar {
        position: relative; /* No longer sticky on small screens */
        top: auto;
        flex: auto;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 30px;
        max-height: none; /* Let it expand to show all categories */
        overflow-y: visible; /* No scrollbar on the sidebar itself */
        padding-left: 0;
    }

    .portfolio-categories-sidebar h3 {
        text-align: center;
        padding-left: 0;
    }

    .category-filter {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .filter-btn {
        width: auto;
        text-align: center;
        padding: 12px 25px;
    }

    .filter-btn:hover {
        transform: translateY(-2px);
    }

    .full-portfolio-grid-wrapper {
        flex: auto;
        padding-right: 0; /* Remove right padding when stacked */
        /* ***** CRITICAL CHANGE FOR SCROLLABLE CONTAINER (MOBILE) ***** */
        /* Use a max-height relative to viewport on smaller screens */
        max-height: 60vh; /* This means it will take up at most 60% of the viewport height */
        /* If content is less than 60vh, it will just take the height of its content.
           If content is more, it will scroll. */
        overflow-y: auto; /* Ensure scrolling is enabled */
    }
}

@media (max-width: 768px) {
    .full-portfolio-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        padding: 0;
    }
}

@media (max-width: 480px) {
    .full-portfolio-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .full-portfolio-item img {
        height: 180px;
    }

    .project-info h4 {
        font-size: 1.4em;
    }

    .project-info p {
        font-size: 0.9em;
    }
}
/* Footer - YOUR ORIGINAL STYLES */
.main-footer {
    background-color: var(--dark-tertiary);
    color: var(--text-dark);
    text-align: center;
    padding: 30px 0;
    border-top: 1px solid var(--border-color);
    min-height: var(--footer-height); /* Give footer a defined height */
}
/* Responsive Design - YOUR ORIGINAL STYLES */
@media (max-width: 768px) {
    .main-nav {
        position: fixed;
        top: 0;
        right: 0;
        height: 100%;
        width: 70%;
        background-color: var(--dark-secondary);
        flex-direction: column;
        padding-top: 80px;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 999;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: center;
        padding: 0;
    }

    .main-nav ul li {
        margin: 20px 0;
    }

    .main-nav.nav-open {
        transform: translateX(0%);
    }

    .nav-toggle {
        display: block;
    }
}
@media (max-width: 480px) {
    .logo {
        font-size: 1.8em;
    }
}
/* --- Gallery Modal Styles --- */

.gallery-modal-overlay {
    display: none; /* Hidden by default - THIS IS THE CRITICAL CHANGE */
    position: fixed; /* Stay in place */
    z-index: 2000; /* Sit on top (higher than header and other content) */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if content is too large */
    background-color: rgba(0, 0, 0, 0.9); /* Black with opacity */
    /* REMOVED: display: flex; from here */
    justify-content: center; /* Still needed for when JS applies display:flex */
    align-items: center; /* Still needed for when JS applies display:flex */
    padding: 20px; /* Padding around the modal content */
    box-sizing: border-box;
    backdrop-filter: blur(5px); /* Optional: Adds a blur effect to the background */
    -webkit-backdrop-filter: blur(5px); /* For Safari */
}

/* Keep the rest of your CSS exactly the same */

.gallery-modal-content {
    position: relative;
    background-color: var(--dark-secondary); /* Dark background for the modal */
    margin: auto; /* Centers the modal horizontally */
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.7); /* Darker shadow for depth */
    max-width: 90%; /* Max width of the modal */
    max-height: 90vh; /* Max height to prevent content from going off screen */
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden; /* Important for containing large images without scrollbars on the modal itself */
}

.gallery-close-btn {
    color: var(--text-light);
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 2001; /* Ensure it's clickable above the image */
}

.gallery-close-btn:hover,
.gallery-close-btn:focus {
    color: var(--accent-color);
    text-decoration: none;
}

.gallery-slideshow {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%; /* Takes available height within modal-content */
    position: relative;
    margin-bottom: 15px; /* Space between image and caption */
}

.gallery-slideshow img {
    max-width: 100%; /* Ensures image doesn't overflow horizontally */
    max-height: 75vh; /* Limits image height to fit within the viewport, adjust as needed */
    object-fit: contain; /* Scales image down to fit, preserving aspect ratio */
    border-radius: 8px;
    display: block; /* Removes extra space below image */
    transition: opacity 0.5s ease-in-out; /* Smooth transition when changing slides */
}

.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black background */
    color: var(--text-light);
    border: none;
    padding: 10px 15px;
    font-size: 2em;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
    user-select: none; /* Prevents text selection when clicking rapidly */
    z-index: 1; /* Ensures buttons are above the image */
}

.gallery-nav-btn:hover {
    background-color: var(--accent-color);
    color: var(--pure-black);
}

.prev-btn {
    left: 10px;
}

.next-btn {
    right: 10px;
}

.gallery-caption {
    color: var(--text-light);
    font-size: 1.1em;
    text-align: center;
    padding: 10px 0;
    max-width: 80%; /* Limits width of caption for readability */
}

/* Responsive adjustments for gallery modal */
@media (max-width: 768px) {
    .gallery-modal-content {
        max-width: 95%;
        padding: 15px;
    }
    .gallery-slideshow img {
        max-height: 70vh; /* Adjust image height for smaller screens */
    }
    .gallery-close-btn {
        font-size: 30px;
        top: 10px;
        right: 15px;
    }
    .gallery-nav-btn {
        padding: 5px 10px;
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    .gallery-modal-content {
        max-width: 98%;
        padding: 10px;
    }
    .gallery-slideshow img {
        max-height: 65vh; /* Further adjust image height for very small screens */
    }
    .gallery-nav-btn {
        padding: 3px 8px;
        font-size: 1.2em;
    }
    .gallery-caption {
        font-size: 0.9em;
    }
}