/* THE product card (template-parts/home-card.php): home carousels, new arrivals, category tabs, the list grid and
   related products. A white photo well in every theme, one green "Add to basket" button, equal heights in a row. */
.store-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.store-card:hover {
    border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.card-photo {
    position: relative;
    display: block;
    aspect-ratio: 1;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--photo);
    overflow: hidden;
}
.card-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.35s ease;
}
.store-card:hover .card-photo img {
    transform: scale(1.05);
}
.sale-pill {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
    font-variant-numeric: tabular-nums;
}
.card-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 14px 4px 0;
}
.card-category {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    letter-spacing: 0.05em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}
.card-title {
    min-height: 40px;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 20px;
    letter-spacing: -0.1px;
}
.card-name {
    display: -webkit-box;
    overflow: hidden;
    color: var(--ink);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}
/* The whole card opens the product; the buy row sits above this layer. */
.card-name::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}
.card-name:hover,
.store-card:hover .card-name {
    color: var(--accent-strong);
}
.card-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
}
.card-stars {
    flex: none;
    width: 70px;
    height: 13px;
    background: linear-gradient(
        90deg,
        var(--ink) var(--rating, 0%),
        color-mix(in srgb, var(--muted) 35%, var(--clear)) var(--rating, 0%)
    );
    -webkit-mask: url("../star.svg") 0 0 / 14px 13px repeat-x;
    mask: url("../star.svg") 0 0 / 14px 13px repeat-x;
}
.card-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 8px;
    padding-top: 4px;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 800;
    line-height: 24px;
    letter-spacing: -0.2px;
    font-variant-numeric: tabular-nums;
}
.card-price ins {
    order: -1;
    text-decoration: none;
}
.card-price del {
    color: var(--muted);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
}
.card-buy {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
    padding-top: 12px;
}
.store-card .card-buy .button {
    width: 100%;
    min-height: 42px;
    gap: 8px;
    padding: 10px 14px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: var(--on-fill);
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.store-card .card-buy .button:hover,
.store-card .card-buy .button:focus-visible {
    background: var(--primary-strong);
    color: var(--hover-ink);
}
.store-card .card-buy .add_to_cart_button::before {
    content: "";
    flex: none;
    width: 17px;
    height: 17px;
    background: currentColor;
    -webkit-mask: url("../basket.svg") center / contain no-repeat;
    mask: url("../basket.svg") center / contain no-repeat;
}
.store-card .card-buy .button.added::before {
    -webkit-mask-image: url("../check.svg");
    mask-image: url("../check.svg");
}
.store-card .card-buy .button.loading {
    pointer-events: none;
    opacity: 0.8;
}
.store-card .card-buy .button.loading::before {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: var(--clear);
    border-radius: 50%;
    background: var(--clear);
    -webkit-mask: none;
    mask: none;
    animation: gstore-card-spin 0.7s linear infinite;
}
@keyframes gstore-card-spin {
    to {
        transform: rotate(1turn);
    }
}
.card-buy .added_to_cart {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}
.card-buy .added_to_cart:hover {
    color: var(--accent-strong);
    text-decoration: underline;
}

/* Carousel track: native swipe with scroll-snap; home.js adds arrows and dots. */
.carousel-track {
    --cols: 5;
    --gap: 16px;
    display: grid;
    grid-auto-columns: calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
    grid-auto-flow: column;
    gap: var(--gap);
    margin: -8px -6px -24px;
    padding: 8px 6px 24px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-padding-inline: 6px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar {
    display: none;
}
.carousel-track > .store-card {
    scroll-snap-align: start;
}
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-top: 16px;
}
.carousel-dots button {
    display: grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border: 0;
    background: var(--clear);
}
.carousel-dots button::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--muted) 40%, var(--clear));
    transition: width 0.2s ease, background-color 0.2s ease;
}
.carousel-dots button:hover::before {
    background: var(--muted);
}
.carousel-dots button[aria-current="true"]::before {
    width: 24px;
    background: var(--accent);
}

@media (max-width: 1199px) {
    .carousel-track {
        --cols: 4;
    }
}
@media (max-width: 899px) {
    .carousel-track {
        --cols: 3;
    }
}
@media (max-width: 639px) {
    .store-card {
        padding: 8px;
    }
    .store-card:hover {
        transform: none;
    }
    .card-photo {
        padding: 8px;
    }
    .card-info {
        gap: 4px;
        padding: 10px 2px 0;
    }
    .card-category {
        letter-spacing: 0.03em;
    }
    .card-title {
        min-height: 38px;
        font-size: 14px;
        line-height: 19px;
    }
    .card-stars {
        width: 56px;
        height: 11px;
        -webkit-mask-size: 11.2px 11px;
        mask-size: 11.2px 11px;
    }
    .card-price {
        flex-direction: column;
        align-items: flex-start;
        min-height: 44px;
        font-size: 16px;
        line-height: 22px;
    }
    .card-price del {
        font-size: 12px;
        line-height: 18px;
    }
    .card-buy {
        padding-top: 10px;
    }
    .store-card .card-buy .button {
        min-height: 40px;
        padding: 8px 10px;
        font-size: 13px;
    }
    .carousel-track {
        --cols: 2.25;
        --gap: 10px;
        margin-inline: -12px;
        padding-inline: 12px;
        scroll-padding-inline: 12px;
    }
}
