:is(.featured-grid > .latest-rug-card, .latest-rug-card.store-rug-card) {
    box-sizing: border-box;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: clamp(6px, .65vw, 12px);
    cursor: default;
    border-radius: 8px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    transition: box-shadow 160ms ease;
}

:is(.featured-grid > .latest-rug-card, .latest-rug-card.store-rug-card):focus-within {
    outline: 2px solid #17613e;
    outline-offset: 2px;
    box-shadow: 0 4px 20px rgb(0 0 0 / 12%);
}

@media (hover: hover) and (pointer: fine) {
    :is(.featured-grid > .latest-rug-card, .latest-rug-card.store-rug-card):hover {
        color: inherit;
        box-shadow: 0 4px 20px rgb(0 0 0 / 12%);
    }
}

.latest-rug-card .latest-photo-frame {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 356 / 461;
    container-type: size;
    overflow: hidden;
    background: white;
}

.latest-rug-card a {
    color: inherit;
    cursor: pointer;
    text-decoration: none;
}

.latest-rug-card .latest-photo-link {
    display: block;
    position: relative;
    overflow: hidden;
    max-width: 100%;
    max-height: 100%;
}

.latest-photo-link img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100cqw;
    max-height: 100cqh;
}

.latest-photo-link[data-fitted] {
    width: 87%;
    height: 100%;
}

.latest-photo-link[data-fitted] img {
    position: absolute;
    max-width: none;
    max-height: none;
    object-fit: fill;
    width: var(--image-width);
    height: var(--image-height);
    left: var(--image-left);
    top: var(--image-top);
}

.latest-rug-card .featured-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.latest-rug-card .featured-details {
    margin-top: auto;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    :is(.featured-grid > .latest-rug-card, .latest-rug-card.store-rug-card) {
        transition: none;
    }
}

.home-collection-grid > .latest-rug-card {
    min-height: var(--reference-card-height, auto);
}

/* Let the collection row use the page margins before resorting to local scrolling. */
#rug-collections .home-collection-grid {
    --gap: clamp(8px, 1vw, 16px);
    --pad: clamp(6px, .65vw, 12px);
    --card: var(--reference-card-width, clamp(180px, 24vw, 320px));
    --min-card: calc(var(--rug-width, 155px) + 2 * var(--pad));
    --row: min(var(--row-space, 100%), calc(5 * var(--card) + 4 * var(--gap) + 32px));
    box-sizing: border-box;
    width: var(--row);
    max-width: none;
    margin-inline: calc((100% - var(--row)) / 2);
    display: grid;
    grid-template-columns: none;
    grid-template-rows: auto;
    grid-auto-flow: column;
    grid-auto-columns: clamp(var(--min-card), calc((100% - 4 * var(--gap)) / 5), var(--card));
    gap: var(--gap);
    padding: 16px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    direction: rtl;
}

#rug-collections .latest-photo-frame {
    height: var(--frame-height, auto);
}

#rug-collections .latest-photo-link[data-fitted] {
    width: var(--rug-width, 87%);
}

.store-rug-card[hidden] { display: none !important; }

.store-rug-card .store-card-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: stretch;
    gap: .75rem;
    padding: 1rem .15rem 0;
}
.store-card-info :is(h2, h3) {
    margin: 0;
    font: inherit;
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.65;
}
.store-rug-card .store-card-specs {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1rem;
    margin: 0;
    font-size: .85rem;
    color: #606b72;
}
.store-rug-card .store-card-price { margin-top: auto; padding-top: .65rem; }
.store-rug-card .store-card-details {
    display: block;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: .65rem;
}
.store-rug-card .similar-media { border: 0; background: white; }
.store-rug-card .similar-tray { z-index: 2; }
@media (min-width: 1200px) {
    .shop-grid > .store-rug-card {
        width: 100%;
        max-width: 19.125rem;
        justify-self: center;
    }
}
