:root {
    --red: #BF2827;

    --dark-brown: #320F11;
    --brown: #683632;

    --cream: #F5F1EB;
    --warm-grey-light: #E7E1DB;
    --warm-grey: #D9D3CE;
    --warm-grey-dark: #BDB1AC;
}
/* ---------- Gallery page ---------- */

.gallery-page {
    width: min(100% - 4rem, 1600px);
    margin-inline: auto;

    /* Space for the fixed site header */
    padding-top: 7rem;
    padding-bottom: 6rem;
}

/* ---------- Development header ---------- */
.gallery-notice {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    color: var(--red);
}

/* ---------- Gallery header ---------- */

.gallery-header {
    margin-bottom: 2.5rem;
}


/* ---------- Filters ---------- */

.gallery-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.filter-button {
    padding: 0.4rem 0;

    border: 0;
    border-bottom: 1px solid transparent;

    background: none;
    color: inherit;

    font: inherit;

    opacity: 0.55;

    cursor: pointer;

    transition:
        opacity 0.15s ease,
        border-color 0.15s ease;
}

.filter-button:hover,
.filter-button.active {
    opacity: 1;
}

.filter-button.active {
    border-bottom-color: currentColor;
}


/* ---------- Gallery grid ---------- */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));

    column-gap: 3rem;
    row-gap: 5rem;
}


/* ---------- Individual gallery piece ---------- */

.gallery-piece {
    min-width: 0;

    opacity: 0;
    transform: translateY(10px);

    animation: galleryFadeIn 0.5s ease forwards;
}

.gallery-piece-button {
    display: block;

    width: 100%;

    margin: 0;
    padding: 0;

    border: 0;

    background: none;
    color: inherit;

    font: inherit;
    text-align: left;

    cursor: pointer;
}

/*
    Every artwork gets an equal square display area.
    The artwork itself is never cropped.
*/
.gallery-piece-image {
    aspect-ratio: 1 / 1;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 2rem;

    background-color: var(--warm-grey-light);

    overflow: hidden;
}

.gallery-piece-image img {
    width: 100%;
    height: 100%;

    object-fit: contain;

    transition: transform 0.2s ease;
}

/* Small visual response without changing layout */
.gallery-piece-button:hover .gallery-piece-image img {
    transform: scale(1.015);
}


/* ---------- Piece information ---------- */

.gallery-piece-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;

    margin-top: 0.75rem;
}

.gallery-piece-title,
.gallery-piece-date {
    margin: 0;
}

.gallery-piece-title {
    font-size: 1rem;
    font-weight: normal;
}

.gallery-piece-date {
    font-size: 0.9rem;

    white-space: nowrap;
}


/* ---------- Image failure ---------- */

.gallery-piece-image.image-failed {
    text-align: center;
}

.gallery-piece-image-fallback {
    max-width: 12rem;

    font-size: 0.9rem;

    opacity: 0.6;
}


/* ---------- Animations ---------- */

@keyframes galleryFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ---------- Tablet ---------- */

@media (max-width: 1000px) {

    .gallery-page {
        width: min(100% - 3rem, 1600px);
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));

        column-gap: 2rem;
        row-gap: 4rem;
    }
}


/* ---------- Mobile ---------- */

@media (max-width: 700px) {

    .gallery-page {
        width: min(100% - 2rem, 1600px);

        padding-top: 6rem;
        padding-bottom: 4rem;
    }

    .gallery-header {
        margin-bottom: 2rem;
    }

    .gallery-filters {
        gap: 0.5rem 1rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;

        row-gap: 3rem;
    }

    .gallery-piece-image {
        padding: 1.25rem;
    }
}


/* ---------- Reduced motion support ---------- */

@media (prefers-reduced-motion: reduce) {

    .filter-button,
    .gallery-piece-image img {
        transition: none;
    }

    .gallery-piece {
        opacity: 1;
        transform: none;

        animation: none;
    }
}

/* ---------- Gallery shop links ---------- */

.details-shop-product {
    display: block;
}

.details-shop-product + .details-shop-product {
    margin-top: 0.5rem;
}
