/* ============================================================
   Product Grid — Box Promo Widget
   ============================================================ */

.cbb-pg {
    /* Brand design tokens — self-contained so the widget works without app.css */
    --cbb-accent: #C85A1A;
    --cbb-bg: #FBF8F4;
    --cbb-surface: #ffffff;
    --cbb-text: #3B2F25;
    --cbb-muted: #998C7E;
    --cbb-border: #EDE8E2;
    --cbb-img-bg: #F3EDE6;

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    padding: 40px 20px;
    background: var(--cbb-bg);
}

.cbb-pg *, .cbb-pg *::before, .cbb-pg *::after { box-sizing: border-box; }

/* ── Header ────────────────────────────────────────── */

.cbb-pg-header {
    text-align: center;
    margin-bottom: 30px;
}

.cbb-pg-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--cbb-text);
    margin: 0 0 8px;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.cbb-pg-desc {
    font-size: .95rem;
    color: var(--cbb-muted);
    margin: 0 0 30px;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

/* ── Grid ──────────────────────────────────────────── */

.cbb-pg-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.cbb-pg-grid[data-columns="2"] { grid-template-columns: repeat(2, 1fr); }
.cbb-pg-grid[data-columns="3"] { grid-template-columns: repeat(3, 1fr); }
.cbb-pg-grid[data-columns="4"] { grid-template-columns: repeat(4, 1fr); }
.cbb-pg-grid[data-columns="5"] { grid-template-columns: repeat(5, 1fr); }

/* ── Card ──────────────────────────────────────────── */

.cbb-pg-card {
    background: var(--cbb-surface);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--cbb-border);
    transition: transform .2s cubic-bezier(.4,0,.2,1), box-shadow .2s;
    display: flex;
    flex-direction: column;
    animation: cbbPgFadeUp .4s cubic-bezier(.4,0,.2,1) both;
}

.cbb-pg-card:nth-child(1)  { animation-delay: .03s; }
.cbb-pg-card:nth-child(2)  { animation-delay: .06s; }
.cbb-pg-card:nth-child(3)  { animation-delay: .09s; }
.cbb-pg-card:nth-child(4)  { animation-delay: .12s; }
.cbb-pg-card:nth-child(5)  { animation-delay: .15s; }
.cbb-pg-card:nth-child(6)  { animation-delay: .18s; }
.cbb-pg-card:nth-child(7)  { animation-delay: .21s; }
.cbb-pg-card:nth-child(8)  { animation-delay: .24s; }
.cbb-pg-card:nth-child(9)  { animation-delay: .27s; }
.cbb-pg-card:nth-child(10) { animation-delay: .30s; }

.cbb-pg-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(59,47,37,.1);
}

@keyframes cbbPgFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}

/* ── Card Image ────────────────────────────────────── */

.cbb-pg-card-img-wrap {
    position: relative;
    padding-top: 100%;
    background: var(--cbb-img-bg);
    overflow: hidden;
}

.cbb-pg-card-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s cubic-bezier(.4,0,.2,1);
}

.cbb-pg-card:hover .cbb-pg-card-img {
    transform: scale(1.06);
}

/* ── + Button (inside image) ───────────────────────── */

.cbb-pg-card-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cbb-accent);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform .2s cubic-bezier(.4,0,.2,1), background .2s;
    box-shadow: 0 2px 8px rgba(200,90,26,.3);
    z-index: 2;
    line-height: 1;
}

.cbb-pg-card-btn:hover {
    transform: scale(1.12);
    background: color-mix(in srgb, var(--cbb-accent) 85%, black);
}

.cbb-pg-card-btn:active {
    transform: scale(.95);
}

.cbb-pg-card-btn:focus-visible,
.cbb-pg-view-all:focus-visible {
    outline: 2px solid var(--cbb-accent);
    outline-offset: 3px;
}

/* ── Card Info ─────────────────────────────────────── */

.cbb-pg-card-info {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.cbb-pg-card-name {
    font-size: .88rem;
    font-weight: 700;
    color: var(--cbb-text);
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cbb-pg-card-price {
    font-size: .95rem;
    font-weight: 800;
    color: var(--cbb-accent);
}

/* ── Footer / View All ─────────────────────────────── */

.cbb-pg-footer {
    text-align: center;
    margin-top: 30px;
}

.cbb-pg-view-all {
    display: inline-block;
    padding: 14px 32px;
    background: var(--cbb-accent);
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    border-radius: 12px;
    text-decoration: none;
    transition: transform .2s cubic-bezier(.4,0,.2,1), background .2s, box-shadow .2s;
    box-shadow: 0 4px 16px rgba(200,90,26,.2);
}

.cbb-pg-view-all:hover {
    transform: translateY(-2px);
    background: color-mix(in srgb, var(--cbb-accent) 85%, black);
    box-shadow: 0 6px 20px rgba(200,90,26,.3);
    color: #fff;
}

.cbb-pg-view-all:active {
    transform: scale(.98);
}

/* ── Responsive ────────────────────────────────────── */

@media (max-width: 767px) {
    .cbb-pg-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }

    .cbb-pg-title {
        font-size: 1.35rem;
    }

    .cbb-pg-desc {
        font-size: .85rem;
    }

    .cbb-pg-card-info {
        padding: 10px 10px 12px;
    }

    .cbb-pg-card-name {
        font-size: .8rem;
    }

    .cbb-pg-card-price {
        font-size: .85rem;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .cbb-pg-grid[data-columns="4"],
    .cbb-pg-grid[data-columns="5"] {
        grid-template-columns: repeat(3, 1fr);
    }
}
