/**
 * Reusable component styles.
 * Product and dynamic-content components will be added progressively.
 */

/* Product components — Baseframe 0.18 vertical card */
.bf-products { margin: 2rem 0; }

.bf-product {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    padding: 1rem;
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 14px;
    background: #fff;
}

.bf-product__media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 230px;
    margin-bottom: 1rem;
}

.bf-product__image-link {
    display: block;
    width: 100%;
}

.bf-product__image {
    display: block;
    width: auto;
    max-width: 100%;
    height: 220px;
    object-fit: contain;
    margin: 0 auto;
}

.bf-product__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.bf-product__title {
    display: block;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.bf-product__rating,
.bf-product__price,
.bf-product__actions {
    margin-top: .75rem;
}

.bf-product__actions {
    margin-top: auto;
    padding-top: 1rem;
}

.bf-product__reviews { margin-left: .4rem; }

.bf-visual { margin: 0; }
.bf-visual__image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 500px;
    margin: 0 auto;
}

/* Baseframe 0.17 — editorial media alignment */
.bf-content-with-visual__media {
    align-self: center;
}

/*
 * Baseframe 0.17 — AAWP product grid.
 * The renderer keeps AAWP responsible for product data/links while Baseframe
 * controls only presentation. Three products become thirds, two halves,
 * one full-width. On narrow screens every product stacks to 100%.
 */
.bf-products,
.bf-aawp-products {
    display: grid;
    grid-template-columns: repeat(var(--bf-product-columns, 1), minmax(0, 1fr));
    gap: 1.5rem;
    align-items: stretch;
}

.bf-products--3,
.bf-aawp-products--3 {
    --bf-product-columns: 3;
}

.bf-products--2,
.bf-aawp-products--2 {
    --bf-product-columns: 2;
}

.bf-products--1,
.bf-aawp-products--1 {
    --bf-product-columns: 1;
}

@media (max-width: 768px) {
    .bf-products,
    .bf-aawp-products {
        --bf-product-columns: 1;
    }
}


/* Baseframe 0.17 — count-aware AAWP loop columns */
.bf-aawp-loop {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.bf-aawp-loop--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bf-aawp-loop--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bf-aawp-loop > .bf-product {
    width: auto;
    max-width: none;
    margin: 0;
}

@media (max-width: 768px) {
    .bf-aawp-loop--2,
    .bf-aawp-loop--3 {
        grid-template-columns: 1fr;
    }
}


/* The AAWP loop owns the columns; each product card is vertical inside its cell. */
.bf-products > .bf-aawp-loop {
    width: 100%;
}

@media (max-width: 768px) {
    .bf-product {
        padding: 1rem;
    }

    .bf-product__media {
        min-height: 200px;
    }

    .bf-product__image {
        height: 190px;
    }
}
