/* ── Product card ───────────────────────────────────────────
   Figma: 2924:30885. 308px wide in the design; fills its grid
   cell here. Hover (and keyboard focus inside) deepens the
   shadow and shows the photo arrows.
   ─────────────────────────────────────────────────────────── */

.product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
    border-radius: 12px;
    background: var(--color-white);
    box-shadow: 0 0 12px rgb(0 0 0 / 0.12);
    transition: box-shadow var(--transition);
}

.product-card:hover,
.product-card:has(:focus-visible) {
    box-shadow: 0 0 12px rgb(0 0 0 / 0.2);
}

.product-card__media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--color-grey);
}

/* With more than one photo, sideways swipes change the photo
   (product-card.js), so a row of cards doesn't scroll from here; up and
   down still scrolls the page. */
.product-card__media:has(.product-card__image + .product-card__image) {
    touch-action: pan-y;
}

.product-card__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity var(--transition);
}

.product-card__image.is-active {
    opacity: 1;
}

/* Photo arrows (the button component's carousel arrow), above the card's
   stretched link, showing on hover */
.product-card__arrow {
    position: absolute;
    z-index: 2;
    top: 50%;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity var(--transition), background-color var(--transition);
}

.product-card__arrow--prev {
    left: 14px;
}

.product-card__arrow--next {
    right: 14px;
}

.product-card:hover .product-card__arrow,
.product-card:has(:focus-visible) .product-card__arrow {
    opacity: 1;
}

/* Tablet and mobile have no hover: the arrows always show, centred on
   the photo as on desktop. */
@media (max-width: 1024px) {
    .product-card__arrow {
        opacity: 1;
    }
}

.product-card__sale {
    position: absolute;
    top: 20px;
    left: 0;
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-radius: 0 4px 4px 0;
    background: var(--color-accent);
    color: var(--color-text);
    font-weight: 700;
    line-height: 20.8px;
}

/* "per bag" under "£10 OFF" */
.product-card__sale small {
    font-size: 12px;
    font-weight: 500;
    line-height: 14px;
}

.product-card__badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 5px 14px;
    border-radius: 99px;
    background: rgb(23 106 56 / 0.8);
    color: var(--color-white);
    font-size: 14px;
    font-weight: 700;
    line-height: 20.8px;
}

.product-card__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    min-height: 133px;
    padding: 0 20px 20px;
}

.product-card__copy {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-card__title {
    font-size: 20px;
    font-weight: 600;
    line-height: 25px;
}

/* The title's link covers the whole card. */
.product-card__link::after {
    content: "";
    position: absolute;
    z-index: 1;
    inset: 0;
}

.product-card__link:focus-visible {
    outline: none;
}

.product-card:has(.product-card__link:focus-visible) {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

.product-card__summary {
    display: -webkit-box;
    overflow: hidden;
    color: var(--color-text-muted);
    line-height: 20.8px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.product-card__formats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    list-style: none;
}

.product-card__format {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 99px;
    background: var(--color-grey);
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 20px;
    white-space: nowrap;
}
