/*
 * Custom styles for the GS Gallery plugin.
 * This handles the grid layout of thumbnails for both default and directory galleries.
 */

/* =======================================
   Gallery Container Styles
   ======================================= */

/* Styles for individual member galleries (e.g., ?member=username)
   and also for the main directory listing. They will look the same for now. */
.gsgallery-container,
.gsgallery-directory-container {
    display: grid;
    /* Use the smaller thumbnail size for both for now */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px; /* Slightly more space */
    margin: 20px auto;
    padding: 10px;
    max-width: 1200px;
}


/* =======================================
   Gallery Item Styles (Shared for Default and Directory)
   ======================================= */

.gsgallery-item,
.gsgallery-directory-item {
    /* Ensure figure elements don't have default margins */
    margin: 0;
    padding: 0;
    text-align: center;
    background-color: #f8f8f8; /* Light background for items */
    border: 1px solid #eee;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 5px;
    overflow: hidden; /* Ensures image corners are rounded if figure has border-radius */
    display: flex; /* Use flexbox for vertical alignment */
    flex-direction: column;
    justify-content: space-between; /* Pushes caption to bottom if image is smaller */
    align-items: center; /* Center items horizontally within their cell */
    height: 100%; /* Ensure all items take full height in their grid cell */
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; /* Smooth hover effect */
 /* --- Add these lines to limit the container size --- */
    max-width: 300px; 
    max-height: 300px; 

}

.gsgallery-item:hover,
.gsgallery-directory-item:hover {
    transform: translateY(-3px); /* Slight lift on hover */
    box-shadow: 0 5px 10px rgba(0,0,0,0.2); /* More prominent shadow on hover */
}


/* =======================================
   Thumbnail & Link Styles (Shared)
   ======================================= */

.gsgallery-link,
.gsgallery-directory-link { /* Apply to both gallery links */
    display: flex; /* Changed to flex to help center images */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    width: 100%;
    /* The height/overflow properties will be handled by the image itself */
    overflow: hidden; /* Ensure image corners are rounded if the link has border-radius */
    box-sizing: border-box; /* Include padding/border in total dimensions */
}

/* Updated selector to target the img directly within the item for consistent styling */
.gsgallery-item img,
.gsgallery-directory-item img {
    display: block; /* Remove extra space below image */
    width: 100%; /* Take full width of its flex parent */
    height: 100%; /* Take full height of its flex parent */
    object-fit: cover; /* Cover the area, cropping if necessary (e.g., if you set a fixed height) */
    aspect-ratio: 1 / 1; /* Force square aspect ratio for thumbnails */
    border-bottom: 1px solid #eee; /* Separator between image and caption */
    transition: transform 0.2s ease-in-out; /* Smooth hover effect */
}

.gsgallery-item img:hover,
.gsgallery-directory-item img:hover {
    transform: scale(1.05); /* Slightly enlarge on hover */
}

/* =======================================
   Caption Styles (Shared & Specific for Directory)
   ======================================= */

.gsgallery-caption,
.gsgallery-directory-caption {
    font-size: 0.9em;
    color: #555;
    padding: 10px 5px;
    word-break: break-word; /* Break long words */
    width: 100%; /* Ensure caption takes full width */
    flex-grow: 1; /* Allow caption to take up remaining space if item has a height */
    display: flex; /* Use flexbox for caption to align text */
    align-items: flex-end; /* Align caption text to the bottom if there's extra space */
    justify-content: center; /* Center caption text horizontally */
}

/* Specific styling for the link *inside* directory captions */
.gsgallery-directory-caption a {
    text-decoration: none;
    color: #333; /* Default text color for the link */
    font-weight: bold;
    display: block; /* Make the entire caption text clickable */
}

.gsgallery-directory-caption a:hover {
    color: #0073aa; /* WordPress blue on hover */
    text-decoration: underline;
}

/* =======================================
   Placeholder for empty directory folders
   ======================================= */

.gsgallery-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1; /* Match thumbnail aspect ratio */
    background-color: #e9e9e9;
    color: #666;
    font-size: 1.1em;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    height: auto; /* Allow height to adjust based on aspect-ratio */
}

/* =======================================
   Empty Gallery Message Styles
   ======================================= */
.gsgallery-empty-message {
    text-align: center;
    margin: 40px auto; /* More vertical space */
    padding: 30px;
    background-color: #f9f9f9;
    border: 1px dashed #ccc; /* Dashed border for a softer look */
    border-radius: 8px;
    max-width: 600px; /* Constrain width */
    color: #666;
    font-size: 1.1em;
    line-height: 1.6;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); /* Subtle shadow */
}

.gsgallery-empty-message p {
    margin: 0; /* Remove default paragraph margin */
    font-weight: bold; /* Make the message stand out */
}

.gsgallery-empty-message strong {
    color: #333; /* Make the member name slightly darker */
}


/* ---
   Pagination Styles (Designed for Grid with consistent HTML)
   --- */

.gsgallery-pagination { /* Apply these styles to both paginations */
    display: grid;
    /* Define three equal-fraction columns. We'll use justify-self to position content within them. */
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center; /* Vertically centers content within each grid cell */
    gap: 15px; /* Space between the grid columns */
    margin: 20px auto; /* Center the pagination div itself and add vertical spacing */
    padding: 5px;
    clear: both; /* Clear floats above it, important if previous elements are floated */
    max-width: 1200px; /* Constrain width, matching the gallery container */
}

/* Style for the button links. WordPress's wp-block-button__link is often `display: inline-flex`
   or similar, but we want to ensure it behaves well within our grid cells. */
.gsgallery-pagination .wp-block-button__link {
    width: auto; /* Allows button to take its content width */
    display: inline-block; /* Ensures it respects padding/margins and doesn't take full cell width by default */
    white-space: nowrap; /* Prevent button text from wrapping onto multiple lines */
}

/* Position and align the "Previous Set" button wrapper in the first column.
   'justify-self: start;' ensures it aligns to the left edge of its grid cell. */
.gsgallery-pagination-prev-wrapper {
    grid-column: 1 / 2;
    justify-self: start;
}

/* Style for the pagination info text (e.g., "Set X of N") in the middle column.
   'justify-self: center;' ensures the text is horizontally centered within its grid cell. */
.gsgallery-pagination-info {
    grid-column: 2 / 3;
    text-align: center; /* Ensures text is centered even if its container is larger */
    font-size: 1.1em;
    font-weight: bold;
    color: #555;
    white-space: nowrap; /* Prevent "Set 1 of N" from wrapping */
    padding: 0; /* No need for padding, grid gap handles spacing */
    justify-self: center;
}

/* Position and align the 'Next' button wrapper in the third column.
   'justify-self: end;' ensures it aligns to the right edge of its grid cell. */
.gsgallery-pagination-next-wrapper{
    grid-column: 3 / 4;
    justify-self: end;
}
/* =======================================
   PhotoSwipe Base Styles (Minimal - for visibility control)
   ======================================= */

/* Basic styling for the PhotoSwipe UI, which is primarily handled by css_photoswipe.css */
/* Ensure the PhotoSwipe root element is hidden until active */
.pswp {
    display: none;
}

/* When PhotoSwipe is open, ensure it's visible */
.pswp--open {
    display: block;
}
/* =======================================
   Artist Pagination Specific Styles
   ======================================= */
.gsgallery-pagination-info .gsgallery-base-link {
    color: inherit; /* Use inherited color from parent, or set a specific color */
    display: inline-flex; /* Allows icon and text to sit nicely side-by-side */
    align-items: center; /* Vertically aligns icon and text */
    padding: 5px 8px; /* Add some padding for better click area */
    border-radius: 4px; /* Slightly rounded corners */
    text-decoration: none; /* Remove default underline */
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition for hover effects */
}

.gsgallery-pagination-info .gsgallery-base-link .dashicons {
    margin-right: 5px; /* Space between icon and text */
    font-size: 18px; /* Adjust icon size if needed */
    line-height: 1; /* Ensure icon aligns well with text */
}

.gsgallery-pagination-info .gsgallery-base-link:hover {
    background-color: rgba(0, 0, 0, 0.05); /* Subtle background on hover */
    color: #202020; /* Standard WordPress blue on hover, or your theme's link color */
    cursor: pointer; /* Indicate it's clickable */
}

/* Add a focus style for accessibility */
.gsgallery-pagination-info .gsgallery-base-link:focus {
    outline: 2px solid #e3e3e3; /* Outline for keyboard navigation */
    outline-offset: 2px;
}
/* ---
   Basic Responsiveness (Adjustments for smaller screens)
   --- */

@media (max-width: 768px) {

}

@media (max-width: 480px) {
    /* No additional changes for pagination links at this breakpoint,
       as the 768px breakpoint handles the stacking effectively. */
}
.gsgallery-custom-overlay-text {
    /* Basic Layout & Positioning */
    position: fixed; /* Stays in place relative to the viewport */
    z-index: 2147483647; /* Ensure it's on top of PhotoSwipe and everything else */
    
    /*  Positioning */
    top: 38px;   /* Distance from the top of the screen (adjust as needed) */
    left: 10px;   
    
    /* Appearance */
    color: #ffffff; /* White text */
    background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent black background */
    padding-right: 8px;
    padding-left: 8px;
     /* border-radius: 0px;Slightly rounded corners */
    font-size: 14px; /* Text size */
    text-align: left; /* Center the text inside the div */
    /* pointer-events: none; Allows clicks to pass through to the PhotoSwipe UI behind it */
    text-transform: uppercase;

    /* Optional: for animation */
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

/* Optional: If you want it to fade in/out or animate */
/* You might need to add/remove a class via JS for more complex animations */