/**
 * Shared commerce product grid card (listing A3 + PDP related/cross-sell + home featured).
 */

.dc-catalog-grid__card--commerce {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--dc-space-3);
    height: 100%;
    min-height: 0;
}

.dc-home-featured__validated-card.dc-surface-card {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--dc-space-3);
    min-width: 0;
    padding: var(--dc-space-4);
    border: 1px solid var(--dc-ceniza);
    border-radius: var(--dc-radius-card);
    background: var(--dc-blanco);
    box-shadow: var(--dc-shadow-1);
}

.dc-home-featured__grid:not(.dc-home-featured__grid--carousel) .dc-home-featured__validated-card.dc-surface-card {
    height: 100%;
}

.dc-catalog-grid__card--commerce > .dc-product-card,
.dc-home-featured__validated-card > .dc-product-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: var(--dc-space-3);
    min-height: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
    padding: 0;
    background: transparent;
}

.dc-home-featured__validated-card > .dc-product-card.dc-product-card {
    border-width: 0;
    border-style: none;
    box-shadow: none;
}

.dc-home-featured__validated-card > .dc-product-card .dc-product-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    flex: 0 0 auto;
}

.dc-home-featured__validated-card > .dc-catalog-grid__commerce {
    flex: 0 0 auto;
    margin-top: 0;
}

.dc-catalog-grid__card--commerce .dc-product-thumb,
.dc-home-featured__validated-card .dc-product-thumb {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    max-height: none;
}

.dc-catalog-grid__card--commerce .dc-product-card__footer,
.dc-home-featured__validated-card .dc-product-card__footer {
    margin-top: auto;
    flex-shrink: 0;
}

.dc-catalog-grid__card--commerce .dc-product-card__title,
.dc-home-featured__validated-card .dc-product-card__title {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    min-height: calc(2 * var(--dc-lh-h3) * 1em);
}

.dc-catalog-grid__card--commerce .dc-product-card__attrs,
.dc-home-featured__validated-card .dc-product-card__attrs {
    margin: 0;
    min-height: calc(1.4 * 1em);
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    font-size: var(--dc-size-small);
    line-height: var(--dc-lh-small);
    color: var(--dc-gris);
}

.dc-catalog-grid__card--commerce .dc-product-card__attrs[aria-hidden='true'],
.dc-home-featured__validated-card .dc-product-card__attrs[aria-hidden='true'] {
    visibility: hidden;
}

.dc-catalog-grid__card--commerce .dc-price__meta,
.dc-home-featured__validated-card .dc-price__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
    min-height: 2.75rem;
}

.dc-catalog-grid__card--commerce .dc-stock-badge,
.dc-home-featured__validated-card .dc-stock-badge {
    min-height: 1.25rem;
}

.dc-catalog-grid__card--commerce .dc-product-card__detail {
    display: none;
}

.dc-catalog-grid__commerce,
.dc-home-featured__commerce {
    display: flex;
    flex-flow: row nowrap;
    align-items: stretch;
    gap: var(--dc-space-2);
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
}

.dc-catalog-grid__commerce > .dc-catalog-grid__add,
.dc-catalog-grid__commerce > .dc-home-featured__add {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: none;
    height: 2.25rem;
    min-height: 2.25rem;
    justify-content: center;
    font-size: var(--dc-size-small);
    white-space: nowrap;
}

.dc-catalog-grid__commerce > .dc-catalog-grid__stepper {
    box-sizing: border-box;
    flex: 0 0 6.5rem;
    width: 6.5rem;
    min-width: 6.5rem;
    max-width: 6.5rem;
    height: 2.25rem;
    min-height: 2.25rem;
    padding-inline: 0.125rem;
    gap: 0;
    overflow: hidden;
    justify-content: space-between;
}

.dc-catalog-grid__commerce > .dc-catalog-grid__stepper .dc-catalog-grid__stepper-btn {
    flex: 0 0 1.625rem;
    width: 1.625rem;
    height: 1.625rem;
    min-width: 1.625rem;
    font-size: var(--dc-size-body);
}

.dc-catalog-grid__commerce > .dc-catalog-grid__stepper .dc-catalog-grid__stepper-qty {
    flex: 0 0 auto;
    min-width: 1ch;
    margin-inline-start: auto;
    font-size: var(--dc-size-small);
    font-weight: var(--dc-weight-semibold);
}

/* DS Stepper: number and unit form one group centred between the buttons, unit padded from the number. */
.dc-catalog-grid__commerce > .dc-catalog-grid__stepper .dc-catalog-grid__stepper-unit {
    flex: 0 1 auto;
    min-width: 0;
    margin-inline-end: auto;
    padding-inline-start: var(--dc-space-1);
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.625rem;
    line-height: 1;
    color: var(--dc-gris);
    white-space: nowrap;
}

.dc-catalog-listing-page.dc-catalog-a3-responsive .dc-catalog-grid__card--commerce,
.dc-product-page-cross-sell__grid .dc-catalog-grid__card--commerce,
.dc-product-page-related__grid .dc-catalog-grid__card--commerce {
    display: flex;
    flex-direction: column;
    gap: var(--dc-space-3);
    height: 100%;
    margin: 0;
    border: 1px solid var(--dc-ceniza);
    border-radius: var(--dc-radius-card);
    padding: var(--dc-space-4);
    background: var(--dc-blanco);
    box-shadow: var(--dc-shadow-1);
}

.dc-catalog-listing-page.dc-catalog-a3-responsive .dc-catalog-grid__card--commerce .dc-product-card,
.dc-product-page-cross-sell__grid .dc-catalog-grid__card--commerce .dc-product-card,
.dc-product-page-related__grid .dc-catalog-grid__card--commerce .dc-product-card {
    flex: 1 1 auto;
    height: auto;
    gap: var(--dc-space-3);
    margin: 0;
    border: 0;
    box-shadow: none;
    padding: 0;
    background: transparent;
}

.dc-product-page-cross-sell__grid .dc-catalog-grid__card--commerce .dc-product-card:hover,
.dc-product-page-related__grid .dc-catalog-grid__card--commerce .dc-product-card:hover,
.dc-product-page-cross-sell__grid .dc-catalog-grid__card--commerce .dc-product-card:focus-within,
.dc-product-page-related__grid .dc-catalog-grid__card--commerce .dc-product-card:focus-within {
    border-color: transparent;
    box-shadow: none;
    transform: none;
}

.dc-product-page-cross-sell__grid .dc-catalog-grid__card--commerce:hover,
.dc-product-page-related__grid .dc-catalog-grid__card--commerce:hover,
.dc-product-page-cross-sell__grid .dc-catalog-grid__card--commerce:focus-within,
.dc-product-page-related__grid .dc-catalog-grid__card--commerce:focus-within {
    border-color: var(--dc-ceniza);
    box-shadow: var(--dc-shadow-1);
    transform: none;
}

@media (min-width: 1200px) {
    .dc-catalog-listing-page.dc-catalog-a3-responsive .dc-catalog-grid__commerce {
        margin-top: 0;
    }
}

@media (max-width: 767px) {
    .dc-home-featured__grid--carousel .dc-home-featured__validated-card.dc-surface-card {
        gap: 0.625rem;
        padding: 0.875rem;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .dc-home-featured__grid--carousel .dc-home-featured__validated-card > .dc-product-card {
        flex: 0 0 auto;
        gap: var(--dc-space-2);
        min-height: 0;
        height: auto;
        overflow: visible;
    }

    .dc-home-featured__grid--carousel .dc-home-featured__validated-card > .dc-product-card .dc-product-card__body {
        gap: var(--dc-space-1);
    }

    .dc-home-featured__grid--carousel .dc-home-featured__validated-card .dc-product-card__title {
        min-height: 0;
        font-size: 1rem;
        line-height: var(--dc-lh-h3);
    }

    /* A1-M featured: sin línea de contenido en carrusel estrecho */
    .dc-home-featured__grid--carousel .dc-home-featured__validated-card .dc-product-card__attrs {
        display: none;
    }

    .dc-home-featured__grid--carousel .dc-home-featured__validated-card .dc-product-card__footer {
        gap: 0.375rem;
    }

    .dc-home-featured__grid--carousel .dc-home-featured__validated-card .dc-price__meta {
        min-height: 0;
        gap: 0;
    }

    .dc-home-featured__grid--carousel .dc-home-featured__validated-card > .dc-catalog-grid__commerce {
        position: relative;
        z-index: var(--dc-z-raised);
        flex-shrink: 0;
        flex-direction: column;
        align-items: stretch;
        gap: var(--dc-space-2);
        margin-block-start: 2px;
    }

    .dc-home-featured__grid--carousel
    .dc-home-featured__validated-card
    > .dc-catalog-grid__commerce
    > .dc-catalog-grid__stepper {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.1875rem;
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        max-width: none;
        height: 2.25rem;
        padding-inline: 2.25rem;
        overflow: visible;
    }

    .dc-home-featured__grid--carousel
    .dc-home-featured__validated-card
    > .dc-catalog-grid__commerce
    > .dc-catalog-grid__stepper
    .dc-catalog-grid__stepper-btn:first-child {
        position: absolute;
        inset-block: 0;
        inset-inline-start: var(--dc-space-1);
        margin-block: auto;
    }

    .dc-home-featured__grid--carousel
    .dc-home-featured__validated-card
    > .dc-catalog-grid__commerce
    > .dc-catalog-grid__stepper
    .dc-catalog-grid__stepper-btn:last-child {
        position: absolute;
        inset-block: 0;
        inset-inline-end: var(--dc-space-1);
        margin-block: auto;
    }

    .dc-home-featured__grid--carousel
    .dc-home-featured__validated-card
    > .dc-catalog-grid__commerce
    > .dc-catalog-grid__stepper
    .dc-catalog-grid__stepper-qty {
        flex: 0 0 auto;
        font-size: var(--dc-size-body-s);
    }

    .dc-home-featured__grid--carousel
    .dc-home-featured__validated-card
    > .dc-catalog-grid__commerce
    > .dc-catalog-grid__stepper
    .dc-catalog-grid__stepper-unit {
        flex: 0 0 auto;
        min-width: 0;
        overflow: visible;
        text-overflow: clip;
        font-size: var(--dc-size-caption);
    }

    .dc-home-featured__grid--carousel
    .dc-home-featured__validated-card
    > .dc-catalog-grid__commerce
    > .dc-catalog-grid__add {
        flex: 0 0 auto;
        width: 100%;
    }
}
