/* ---------- Shop page ---------- */
:root {
    --red: #BF2827;

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

    --cream: #F5F1EB;
    --warm-grey-light: #E7E1DB;
    --warm-grey: #D9D3CE;
    --warm-grey-dark: #BDB1AC;
}

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

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


/* ---------- Shop controls ---------- */

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

.shop-toolbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
}

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

.shop-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;
}

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

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

.availability-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;

    font-size: 0.9rem;

    cursor: pointer;
}

.availability-control input {
    width: 1rem;
    height: 1rem;

    margin: 0;

    accent-color: currentColor;
}

.shop-status-row {
    display: flex;
    justify-content: center;

    min-height: 1.5rem;

    margin-top: 0.75rem;
}

.shop-count {
    font-size: 0.85rem;

    opacity: 0.55;
}


/* ---------- Shop grid ---------- */

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

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


/* ---------- Shop product ---------- */

.shop-product {
    min-width: 0;

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

    animation: shopFadeIn 0.4s ease forwards;
}

.shop-product-link {
    display: block;

    color: inherit;
    text-decoration: none;
}

.shop-product-image {
    position: relative;

    aspect-ratio: 1 / 1;

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

    padding: 1.4rem;

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

    overflow: hidden;
}

.shop-product-image img {
    width: 100%;
    height: 100%;

    object-fit: contain;

    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
}

.shop-product-link:hover .shop-product-image img {
    transform: scale(1.02);
}

.shop-product.unavailable .shop-product-image img {
    opacity: 0.65;
}


/* ---------- Product type badge ---------- */

.shop-product-badge {
    position: absolute;
    top: 0.65rem;
    left: 0.65rem;
    z-index: 1;

    padding: 0.2rem 0.45rem;

    background: rgb(255 255 255 / 0.88);

    font-size: 0.7rem;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.shop-product-badge.type-print {
    border: 1px solid currentColor;
}

.shop-product-badge.type-other {
    border-radius: 999px;
}


/* ---------- Product information ---------- */

.shop-product-info {
    margin-top: 0.7rem;
}

.shop-product-info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
}

.shop-product-title,
.shop-product-price,
.shop-product-type,
.shop-product-availability {
    margin: 0;
}

.shop-product-title {
    min-width: 0;

    font-size: 0.95rem;
    font-weight: normal;

    overflow-wrap: anywhere;
}

.shop-product-price {
    flex-shrink: 0;

    font-size: 0.9rem;
}

.shop-product-secondary {
    margin-top: 0.15rem;

    font-size: 0.8rem;

    opacity: 0.62;
}

.shop-product-availability.availability-available {
    opacity: 1;
}

.shop-product-availability.availability-sold,
.shop-product-availability.availability-unavailable {
    font-style: italic;
}


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

.shop-product-image.image-failed {
    text-align: center;
}

.shop-product-image-fallback {
    max-width: 10rem;

    font-size: 0.85rem;

    opacity: 0.55;
}


/* ---------- Empty state ---------- */

.shop-empty {
    padding-block: 6rem;

    text-align: center;
}

.shop-empty p {
    margin: 0;

    opacity: 0.6;
}


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

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


/* ---------- Smaller desktop ---------- */

@media (max-width: 1400px) {

    .shop-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}


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

@media (max-width: 1050px) {

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

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

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


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

@media (max-width: 700px) {

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

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

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

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

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

        column-gap: 1rem;
        row-gap: 2.5rem;
    }

    .shop-product-image {
        padding: 0.8rem;
    }

    .shop-product-badge {
        top: 0.4rem;
        left: 0.4rem;

        font-size: 0.62rem;
    }

    .shop-product-info-row {
        align-items: flex-start;
    }

    .shop-product-title {
        font-size: 0.9rem;
    }

    .shop-product-price {
        font-size: 0.85rem;
    }
}


/* ---------- Very small screens ---------- */

@media (max-width: 420px) {

    .shop-grid {
        grid-template-columns: 1fr;
    }

    .shop-product-image {
        padding: 1.25rem;
    }
}


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

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

    .shop-filter-button,
    .shop-product-image img {
        transition: none;
    }

    .shop-product {
        opacity: 1;
        transform: none;

        animation: none;
    }
}

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