/* ------------------- */
/* -- MAIN GALLERY STYLES -- */
/* ------------------- */

/* This file contains styles for the main gallery page (collections/index.html). */

/* Styles for the main content area of the gallery page. */
.gallery-page-content {
    /* Adds vertical padding for spacing. */
    padding: 4rem 0;
}

/* Container for the gallery content to control width and centering. */
.gallery-container {
    /* Sets a maximum width for the content. */
    max-width: 1200px;
    /* Centers the container horizontally. */
    margin: 0 auto;
    /* Adds side padding. */
    padding: 0 2rem;
}

/* Styles for the main title of the gallery page. */
.gallery-title {
    /* Sets the font size. */
    font-size: 2.8rem;
    /* Centers the title. */
    text-align: center;
    /* Adds space below the title. */
    margin-bottom: 2rem;
    /* Uses the primary accent color. */
    color: var(--primary-accent);
}

/* --- FILTER MENU --- */
/* Styles for the container of the "View By" filter menu. */
.filter-menu {
    /* Centers the filter menu. */
    text-align: center;
    /* Adds significant space below the menu before the grid starts. */
    margin-bottom: 2rem;
    padding: 0.5rem 0;
    background: none;
    box-shadow: none;
}

/* Styles for the label of the dropdown menu. */
.filter-menu label {
    /* Sets the font size. */
    font-size: 1rem;
    /* Adds space to the right of the label. */
    margin-right: 0.5rem;
    /* Makes the label text bold. */
    font-weight: 400;
    color: var(--text-color);
}

/* Styles for the dropdown select element itself. */
#view-by-select {
    /* Sets the font size. */
    font-size: 1rem;
    /* Adds padding inside the dropdown. */
    padding: 0.3rem 0.8rem;
    /* Adds a border with the secondary accent color. */
    border: 1px solid #ccc;
    /* Rounds the corners. */
    border-radius: 4px;
    /* Inherits the main font from the body. */
    font-family: inherit;
    /* Sets the background color to white. */
    background: #fff;
    /* Sets the text color. */
    color: var(--text-color);
    /* Removes any shadow from the box. */
    box-shadow: none;
    /* Removes the outline on focus. */
    outline: none;
    /* Removes the default appearance of the select element. */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* Adds a transition effect to the border color for focus state. */
    transition: border-color 0.2s;
}

/* --- SERIES GRID --- */
/* This defines the grid container for the series items. */
.series-grid {
    /* Establishes a grid layout. */
    display: grid;
    /* Creates two columns of equal width. */
    grid-template-columns: repeat(auto-fit, 220px); /* Fixed width columns to match .series-item */
    /* Sets the gap between grid items (both rows and columns). */
    gap: 3rem; /* Increased gap for better spacing */
    justify-content: center; /* Center the grid within its container */
}

/* Styles for each individual item (a linked image) in the grid. */
.series-item {
    /* Positions the item relative to its normal position. */
    position: relative;
    /* Ensures the link behaves as a block element. */
    display: block;
    /* Sets a maximum width for the item. */
    max-width: 220px;
    /* Centers the item within its grid cell. */
    margin: 0 auto;
    /* Remove extra padding if present */
    padding: 0;
    /* Removes text decoration from the link */
    text-decoration: none;
}

/* Styles for the image within a grid item. */
.series-item img {
    /* Ensures the image fills the entire width of its container. */
    width: 100%;
    /* Sets a fixed aspect ratio of 1:1 (a square). */
    aspect-ratio: 1 / 1;
    /* Ensures the image covers the entire area of the square, cropping if necessary. */
    object-fit: cover;
    /* Adds a transition effect to the transform property for a subtle zoom on hover. */
    transition: transform 0.4s ease;
    /* Sharp corners for a clean, modern look. */
    border-radius: 2px;
    /* Removes any shadow from the image. */
    box-shadow: none;
}

/* --- OVERLAY AND HOVER EFFECTS --- */
/* Styles for the overlay div that contains the series title. */
.series-overlay {
    /* Positions the overlay absolutely within its parent (.series-item). */
    position: absolute;
    /* Aligns the overlay to the top edge of the parent. */
    top: 0;
    /* Aligns the overlay to the left edge of the parent. */
    left: 0;
    /* Makes the overlay cover the entire parent. */
    width: 100%;
    height: 100%;
    /* Sets a semi-transparent black background. The '0.5' value makes it 50% transparent. */
    background-color: rgba(0, 0, 0, 0.5);
    /* Makes the overlay completely transparent by default (it will fade in on hover). */
    opacity: 0;
    /* Adds a transition effect for the opacity property, creating a fade-in/fade-out effect. */
    transition: opacity 0.4s ease;
    /* Uses flexbox to perfectly center the text within the overlay. */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Styles for the title text below the image. */
.series-title {
    /* Sets the text color with good contrast. */
    color: var(--text-color, #333);
    /* Sets the font size. */
    font-size: 1.2rem;
    /* Adds padding around the text. */
    padding: 0.75rem 0.5rem 0 0.5rem;
    /* Centers the text. */
    text-align: center;
    /* Removes default margin. */
    margin: 0;
    /* Font styling - using main site font for consistency */
    font-family: var(--main-font);
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* --- HOVER STATE --- */
/* This rule applies when the user hovers over a grid item. */
.series-item:hover .series-overlay {
    /* Fades in the overlay by making it fully opaque. */
    opacity: 1;
}

.series-item:hover img {
    /* Slightly zooms in the image on hover for a dynamic effect. */
    transform: scale(1.05);
}

/* --- THUMBNAIL STYLES --- */
/* Styles for the container of each thumbnail image. */
.series-thumb-container {
    width: 220px;
    height: 220px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none !important;
    margin: 0 auto;
    /* Rounds the corners of the container. */
    border-radius: 8px;
    /* Adds a subtle shadow for depth. */
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

/* Styles for the thumbnail image. */
.series-thumb-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0 !important;
    background: none !important;
    display: block;
}

/* Styles for the title text overlaid on the thumbnail. */
.series-thumb-title {
    background: none !important;
    box-shadow: none !important;
    color: var(--primary-accent, #005276);
    font-size: 1.3rem;
    font-family: var(--main-font);
    letter-spacing: 0.05em;
    pointer-events: auto;
    white-space: normal;
    opacity: 1;
    border-radius: 0;
    padding: 0;
    display: block;
    text-align: center;
    margin-top: 0.5em;
    font-weight: 400;
    position: static;
}

/* --- RESPONSIVE STYLES FOR GALLERY --- */
/* Media query for screens smaller than 768px (tablets). */
@media (max-width: 768px) {
    /* Changes the grid to a single column layout on smaller screens. */
    .series-grid {
        grid-template-columns: 1fr;
        width: 220px; /* Match thumbnail width */
        margin: 0 auto; /* Center the grid on mobile */
        justify-content: initial; /* Remove unnecessary centering */
    }

    /* Adjusts the title font size for mobile. */
    .gallery-title {
        font-size: 2.2rem;
    }
}

/* --- MEDIUM THUMBNAIL GRID --- */
.medium-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 220px);
    gap: 3rem;
    justify-content: center;
    margin-top: 2rem;
}
