/* --- RESET & LAYOUT --- */
body {
    font: 100% Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
    background-color: #222;
    color: #fff;
    margin: 0;
    padding: 0;
    text-align: left;
}

#layout {
    max-width: 950px;
    margin: 80px auto 40px auto; /* Added more top margin to account for fixed nav */
    padding: 0 20px;
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4, h5 {
    text-transform: uppercase;
    opacity: 0.5;
    font-weight: bold;
    color: #FFF;
    margin-top: 0;
}

h2 {
    font-size: 48px;
}

a {
    text-decoration: none;
    transition: color 0.3s ease;
}

a:link { color: #0FF; }
a:visited { color: #FF0; }
a:hover { color: #0F0; }
a:active { color: #0F0; }

/* --- NAVIGATION BAR --- */
.main-nav {
    background: #111;
    border-bottom: 1px solid #333;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    text-align: left; /* Left align by default */
}

.nav-list {
    display: flex;
    justify-content: flex-start; /* Left align items */
    list-style: none;
    margin: 0;
    padding: 0;
    width: auto; /* Auto width for left alignment */
}

.nav-item {
    position: relative;
}

.cat-link {
    display: block;
    padding: 15px 20px;
    color: #FFF;
    opacity: 0.7;
    font-weight: 700; /* Explicitly set to bold (700) for consistency */
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap; /* Prevent line breaks */
}

/* Software Style Active/Open states */
.cat-link.active-cat, 
.nav-item.open .cat-link {
    color: #0FF;
    opacity: 1;
    background: #333;
}

/* --- DROPDOWN MENU --- */
.dropdown {
    display: none; /* Hidden until .open class is added via JS */
    position: absolute;
    top: 100%;
    left: 0;
    background: #333;
    min-width: 220px;
    list-style: none;
    margin: 0;
    padding: 10px 0;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.5);
    border-top: 2px solid #0FF;
    /* Left-align dropdown content */
    text-align: left;
}

.nav-item.open .dropdown {
    display: block;
}

.dropdown li a {
    display: block;
    padding: 10px 20px; /* Perfectly aligned with cat-link text */
    color: #FFF;
    white-space: nowrap;
}

.dropdown li a:hover {
    background: #444;
    color: #0F0;
}

.dropdown li a.current-proj {
    color: #0F0;
    font-weight: bold;
}

/* --- GALLERY (Justified) --- */
.gallery {
    padding-top: 30px;
    width: 100%;
    position: relative;
}

.justified-gallery {
    display: block;
    position: relative;
    margin: 0 auto;
}

.gallery-item {
    display: block;
    position: absolute;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 4px;
}

.gallery-item:hover {
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-img {
    transform: scale(1.05);
}

/* --- FSLightbox Custom Styling --- */
/* Ensure lightbox matches our dark theme */
.fslightbox-container {
    background-color: rgba(0, 0, 0, 0.95);
}

.fslightbox-toolbar-button {
    color: white !important;
}

.fslightbox-toolbar-button:hover {
    color: #0FF !important;
}

.fslightbox-slider {
    background-color: transparent;
}

/* Fullscreen button styling */
.fslightbox-fullscreen-button {
    font-size: 20px !important;
}

/* --- RESPONSIVE / MOBILE --- */
.menu-toggle {
    display: none;
    background: rgb(0, 0, 0);
    color: #0FF; /* Changed to white to match main navigation */
    opacity: 0.7; /* Added to match .cat-link style */
    border: none;
    padding: 10px 20px;
    font-weight: 700; /* Explicitly set to bold (700) for consistency */
    cursor: pointer;
    width: 100%;
    text-align: center;
    text-transform: uppercase; /* Added to match .cat-link style */
    font-size: 24px; /* Larger than navigation links (14px) */
}

@media (max-width: 900px) {
    .gallery { column-count: 2; }
}

/* Default state: Center top-level navigation, left-align sub-navigation */
.main-nav {
    text-align: center; /* Always center top-level items by default */
}

.nav-list {
    justify-content: center; /* Center top-level items */
    width: auto;
}

/* Responsive navigation - switch to dropdown when space is limited */
@media (max-width: 400px) {
    /* Show menu toggle button at this breakpoint */
    .menu-toggle { display: block; }
    
    /* Hide nav list by default, show when menu is toggled */
    .nav-list {
        display: none;
        flex-direction: column;
    }
    
    .nav-list.show {
        display: flex;
        flex-wrap: wrap; /* Allow wrapping to multiple lines */
        justify-content: center;
    }
    
    /* Reduce padding for mobile navigation items */
    .cat-link {
        padding: 7.5px 20px; /* Reduced vertical padding by 50% */
    }
    

    
    /* Make dropdowns full width on small screens */
    .dropdown {
        position: static;
        width: 100%;
        box-shadow: none;
        border-left: 3px solid #0FF;
        border-top: none;
        background: #282828;
    }

    /* Center subnavigation in mobile mode */
    @media (max-width: 768px) {
        .dropdown {
            text-align: center; /* Center the dropdown items */
        }
        
        .dropdown li a {
            display: inline-block; /* Allow centering to work */
            width: auto; /* Reset width for proper centering */
            margin: 3px 0; /* Reduced spacing between items (50% of original) */
            padding: 10px 20px; /* Maintain consistent padding */
        }
    }
}



@media (max-width: 768px) {
    .menu-toggle { display: block; }
    
    .nav-list {
        display: none;
        flex-direction: column;
    }
    
    .nav-list.show {
        display: flex;
        flex-direction: column; /* Ensure vertical layout */
        align-items: center; /* Center items horizontally */
    }
    
    /* Reduce padding for mobile navigation items */
    .cat-link {
        padding: 7.5px 20px; /* Reduced vertical padding by 50% */
    }
    
    .dropdown {
        position: static;
        width: 100%;
        box-shadow: none;
        border-left: 3px solid #0FF;
        border-top: none;
        background: #282828;
    }
}

@media (max-width: 600px) {
    .gallery { column-count: 1; }
}
/* Custom Fullscreen Button - Styled to match baguetteBox defaults */
#custom-fs-button {
    position: fixed;
    top: 18px;      /* Standard baguetteBox top margin */
    right: 65px;    /* Positioned to the left of the 'X' button */
    width: 30px;    /* Matches default button width */
    height: 30px;   /* Matches default button height */
    
    background-color: rgba(50, 50, 50, 0.5);
    color: #ddd;    /* Default icon color */
    border: none;
    border-radius: 15%; /* Default baguetteBox radius */
    
    font-size: 2.4em;
    cursor: pointer;
    z-index: 99999;
    transition: background-color 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#custom-fs-button:hover {
    background-color: rgba(50, 50, 50, 0.9);
}

/* Hide the button when the browser is already in fullscreen mode */
:fullscreen #custom-fs-button,
:-webkit-full-screen #custom-fs-button,
:-ms-fullscreen #custom-fs-button {
    display: none !important;
}

/* Ensure button stays hidden when the lightbox itself is closed */
#baguetteBox-overlay[style*="display: none"] #custom-fs-button {
    display: none !important;
}