/*
 * Collection tiles: compact grid of square collection thumbnails, shared by
 * the Collections browse page and the sub-collections of a collection page.
 */

.collection-section-heading {
    border-bottom: 1px solid var(--gsp-parchment-border);
    color: var(--gsp-evergreen);
    font-family: var(--gsp-font-heading);
    font-size: clamp(1.6rem, 1.4rem + 0.8vw, 2.1rem);
    font-weight: 600;
    margin-bottom: 1.75rem;
    padding-bottom: 0.6rem;
}

.collection-tiles {
    display: grid;
    gap: 2rem 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    margin: 0;
    padding: 0;
}

.collection-tile {
    text-align: center;
}

.collection-tile-link {
    color: var(--gsp-evergreen);
    display: block;
    text-decoration: none;
}

.collection-tile-img {
    aspect-ratio: 1 / 1;
    background: var(--gsp-parchment);
    display: block;
    overflow: hidden;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

/* Frame thumbnails so images with white backgrounds keep a visible edge. */
.collection-tile-img:not(.collection-tile-placeholder) {
    border: 1px solid var(--gsp-parchment-border);
    padding: 4px;
}

.collection-tile-img img,
.collection-tile-img .thumbnail {
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.collection-tile-link:hover .collection-tile-img,
.collection-tile-link:focus-visible .collection-tile-img {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.18);
    transform: translateY(-0.2rem);
}

/* No thumbnail: a brand-colored square with the leaf mark, as on the home page. */
.collection-tile-placeholder {
    align-items: center;
    background-color: var(--gsp-commonwealth-clay);
    background-image: url('../img/clay-leaf-pattern.png');
    background-position: center;
    background-size: 360px auto;
    display: flex;
    justify-content: center;
}

.collection-tile-placeholder::before {
    background: url('../img/GSP_Logomark_Leaf_Light_74x100.webp') center / contain no-repeat;
    content: '';
    height: 34%;
    width: 25%;
}

.collection-tile-color-1 {
    background-color: var(--gsp-evergreen);
    background-image: url('../img/evergreen-leaf-pattern.png');
}

.collection-tile-color-2 {
    background-color: var(--gsp-keystone-gold);
    background-image: url('../img/gold-leaf-pattern.png');
}

.collection-tile-color-3 {
    background-color: var(--gsp-pennsylvania-plum);
    background-image: url('../img/plum-leaf-pattern.png');
}

.collection-tile-title {
    display: block;
    font-size: 0.975rem;
    font-weight: 500;
    line-height: 1.35;
    margin-top: 0.65rem;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    text-wrap: balance;
}

.collection-tile-link:hover .collection-tile-title {
    color: var(--gsp-commonwealth-clay);
}

.collection-tile-parent {
    color: var(--gsp-text);
    display: block;
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 0.2rem;
}

.collection-tile-count {
    color: #6c757d;
    display: block;
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

@media (max-width: 575.98px) {
    .collection-tiles {
        gap: 1.5rem 1rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
