/* --- File: style.css --- */

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4; 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    /* Padding-top is crucial to push content below the fixed header */
    padding-top: 90px; 
}

/* --- Header Styles --- */
.main-header {
    width: 100%;
    /* Ensure these are set for visibility and shadow */
    background-color: #ffffff; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
    
    padding: 22.5px 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    box-sizing: border-box; 
    
    /* Re-establish position and layering */
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000; /* Highest Z-index to put it above all content */
}

.logo {
    height: 45px; 
    width: auto; 
    display: block; 
}

/* Header Navigation/Text Styles */
.header-nav {
    font-family: 'Inter', sans-serif; 
    font-size: 0.9em;
    color: #777; 
    text-align: right;
    white-space: nowrap;
    display: block; 
    position: static; 
}

.header-nav a {
    color: inherit; 
    text-decoration: none; 
    border-bottom: none; 
    cursor: pointer; 
    transition: color 0.2s;
}

.header-nav a:hover {
    color: #000; 
}

.back-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.back-symbol {
    font-weight: bold;
    font-size: 1.2em; 
    margin-right: 15px; 
    line-height: 1;
}

.separator {
    margin: 0 8px;
    color: #999;
}

/* --- Gallery Grid Styles --- */
.gallery-grid {
    flex-grow: 1; 
    display: grid;
    
    /* Horizontal and vertical spacing */
    gap: 10px 10px; 
    
    padding: 10px; 
    width: 100%;
    grid-template-columns: repeat(4, 1fr); 
    box-sizing: border-box;
    
    /* Fixes for vertical spacing */
    align-content: start; 
    grid-auto-flow: row dense;
}

.image-container {
    background-color: transparent; 
    padding: 0; 
    
    aspect-ratio: 4 / 3; 
    
    overflow: hidden; 
    cursor: pointer; /* Change cursor for all tiles */
    border-radius: 16px; /* The desired default border radius */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
    transition: all 0.4s ease; 
    
    /* CRITICAL for overlay: Allows the overlay to be absolutely positioned */
    position: relative; 
    margin-bottom: 0; 
    
    /* NEW: Add transition for smoother grid changes */
    transition: all 0.4s ease, grid-column 0.1s;
}

/* --- Project Overlay Styles (Home Page Feature) --- */
.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    background-color: rgba(0, 0, 0, 0.75); 
    
    display: flex;
    justify-content: center;
    align-items: center;
    
    opacity: 0; /* Start hidden */
    transition: opacity 0.3s ease;
    z-index: 10; 
    
    pointer-events: none; 
    border-radius: 16px;
}

.project-title {
    font-family: 'Inter', sans-serif; 
    color: white;
    font-size: 1.5em; /* Larger text */
    text-align: center;
    padding: 0 20px;
    line-height: 1.2;
    /* text-transform: uppercase; <--- This line has been removed */
    
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

/* ------------------------------------------------------------------ */
/* --- Hover Effects: Differentiated by Home Page vs. Filtered Page --- */
/* ------------------------------------------------------------------ */

/* 1. Base Image Zoom (Applies to ALL tiles: Home page and Filtered) */
.image-container:hover img {
    transform: scale(1.05); /* Image zoom behavior */
}

/* 2. Overlay Visibility/Text Zoom (Applies ONLY to Home Page) */
.gallery-grid.home-page-view .image-container:hover .project-overlay {
    opacity: 1; /* Make the overlay visible */
}
.gallery-grid.home-page-view .image-container:hover .project-title {
    transform: scale(1.0); /* Text zoom effect */
}

/* Default Image state */
.image-container img {
    width: 100%;
    height: 100%; 
    object-fit: cover; 
    display: block;
    transition: transform 0.3s ease; 
    border-radius: 16px; /* Image inherits round corners */
    transform: scale(1.0); /* Default transform */
}

/* ---------------------------------------------------- */
/* --- NEW FEATURE: Expanded Image State (Sub-Folder Only) --- */
/* ---------------------------------------------------- */

.image-container.expanded {
    /* Span all 4 columns */
    grid-column: 1 / -1; 
    
    /* Adjust aspect ratio to be more horizontal for full-width display */
    aspect-ratio: 16 / 9; 
    
    /* Set a minimum height to ensure visibility */
    min-height: 400px;
    
    /* Remove shadow for a cleaner look */
    box-shadow: none;
    
    /* Ensures the expanded element scrolls down far enough to be seen 
       below the fixed header (approx 90px header height + margin) */
    scroll-margin-top: 100px;
    
    cursor: zoom-out; /* Indicate that clicking again collapses it */
}

/* When expanded, remove zoom on hover for the expanded item */
.image-container.expanded:hover img {
    transform: scale(1.0);
}

/* Image inside the expanded container */
.image-container.expanded img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}


/* --- Responsive Adjustments --- */
@media (max-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    /* Expanded item spans all 3 columns */
    .image-container.expanded {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    /* Expanded item spans all 2 columns */
    .image-container.expanded {
        grid-column: 1 / -1;
    }
    .logo {
        height: 35px; 
    }
    .main-header {
        padding: 17.5px 20px; 
    }
    body {
        padding-top: 70px; 
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    /* Expanded

#project-description {
    /* Set max width to match content width for better readability */
    max-width: 1200px; 
    margin: 20px auto 0; /* Center the block and add space above/below */
    padding: 20px 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: none; /* Starts hidden, controlled by JS */
    font-size: 1.1em;
    line-height: 1.6;
    color: #333;
}

#project-description p {
    margin: 0; /* Remove default paragraph margin */
}