.prestaspot-grid {
    display: grid;
    grid-template-columns: repeat(var(--prestaspot-columns, 4), 1fr);
    gap: 1.5rem;
    margin: 1.5rem 0;
}

@media (max-width: 782px) {
    .prestaspot-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .prestaspot-grid {
        grid-template-columns: 1fr;
    }
}

.prestaspot-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.prestaspot-card-image {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.prestaspot-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Corner ribbon, clipped by the image's overflow:hidden. Colors are set inline per-render. */
.prestaspot-card-ribbon {
    position: absolute;
    top: 14px;
    left: -34px;
    width: 130px;
    padding: 4px 0;
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transform: rotate(-45deg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Scaled down to fit the much smaller list-mode thumbnail. */
.prestaspot-list-item .prestaspot-card-ribbon {
    top: 4px;
    left: -22px;
    width: 84px;
    padding: 1px 0;
    font-size: 0.5rem;
}

/* Direct flex children of .prestaspot-card, not a shared "body" wrapper, so
   the image can sit before/between/after them depending on the layout. */
.prestaspot-card-title {
    margin: 0;
    padding: 1rem 1rem 0.25rem;
    font-size: 1.05rem;
}

.prestaspot-card-title a {
    color: inherit;
    text-decoration: none;
}

.prestaspot-card-description {
    margin: 0;
    padding: 0.5rem 1rem 0.25rem;
    color: #555;
    font-size: 0.9rem;
}

.prestaspot-card-price {
    margin: 0;
    padding: 0.5rem 1rem 0.25rem;
    font-weight: 600;
}

.prestaspot-card-stock {
    margin: 0;
    padding: 0.25rem 1rem 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.prestaspot-card-stock--in-stock {
    color: #2a8f4d;
}

.prestaspot-card-stock--out-of-stock {
    color: #d63638;
}

/* Flat fallback for the ribbon above; colors set inline per-render. */
.prestaspot-card-badge {
    display: inline-block;
    align-self: flex-start;
    margin: 0.5rem 0.5rem 0;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 3px;
}

.prestaspot-list-item > .prestaspot-card-badge {
    margin: 0;
}

.prestaspot-card-link {
    margin: 0.75rem 1rem 1rem;
    margin-top: auto;
    font-weight: 600;
    text-decoration: none;
}

/* Colors are set inline per-render (admin-configured hex, not a fixed
   palette) - this only supplies the non-color button chrome. */
.prestaspot-card-link--button {
    display: inline-block;
    padding: 0.5rem 1.1rem;
    border-radius: 4px;
    text-align: center;
    transition: filter 0.15s ease;
}

.prestaspot-card-link--button:hover,
.prestaspot-card-link--button:focus-visible {
    filter: brightness(0.9);
}

/* List view reuses the grid's element classes; only the item wrapper differs. */
.prestaspot-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.prestaspot-list-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.prestaspot-list-item .prestaspot-card-image {
    flex: 0 0 auto;
    width: 4.5rem;
    border-radius: 4px;
}

/* Name/description stack vertically inside their own column of the row,
   instead of being direct row children (which would put them side by side). */
.prestaspot-list-item-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1 1 auto;
    min-width: 0;
}

.prestaspot-list-item-text .prestaspot-card-title,
.prestaspot-list-item-text .prestaspot-card-description,
.prestaspot-list-item-text .prestaspot-card-price,
.prestaspot-list-item-text .prestaspot-card-stock {
    padding: 0;
}

/* No image and/or no text column present (e.g. name-only): the row still has
   at least the link, so it never collapses to zero height, but otherwise
   sizes itself to whatever content is there instead of a fixed card height. */
.prestaspot-list-item > .prestaspot-card-link {
    flex: 0 0 auto;
    margin: 0 0 0 auto;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .prestaspot-list-item {
        flex-wrap: wrap;
    }

    .prestaspot-list-item > .prestaspot-card-link {
        margin-left: 0;
        flex-basis: 100%;
    }
}

.prestaspot-empty {
    color: #777;
    font-style: italic;
}
