/**
 * Shared cp-card product grid styles.
 *
 * Used by:
 *   - taxonomy-product_cat-canvas-prints.php (parent, also has inline copy)
 *   - taxonomy-product_cat-wallpapers.php   (parent, also has inline copy)
 *   - woocommerce/archive-product.php       (sub-categories via vh_render_simple_grid)
 *   - page-wishlist.php                     (AJAX-rendered cp-cards)
 *
 * Extracted from the inline <style> block of taxonomy-product_cat-canvas-prints.php
 * (lines ~119-420) so non-parent contexts get the same look without duplicating
 * the parent's hero / filters / steps / USP CSS.
 */

/* ── Shared containers ────────────────────────────────────────── */
.cp-container         { max-width: 1320px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 48px); }
.cp-container--narrow { max-width:  880px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 48px); }
.cp-container--text   { max-width:  780px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 48px); }

/* ── Grid wrapper ─────────────────────────────────────────────── */
.cp-grid-section { background: #fff; padding: 32px 0 64px; }
.cp-grid-bar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.cp-grid-bar__count { font-family: 'Onest', system-ui, sans-serif; font-size: 14px; color: #8A8A8A; }
.cp-grid-bar__sort {
    font-family: 'Onest', system-ui, sans-serif; font-size: 13px; padding: 8px 14px;
    border: 1px solid #E5E2DD; border-radius: 6px; background: #fff; color: #1A1A1A;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238A8A8A' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
    cursor: pointer;
}
.cp-grid {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px;
    transition: opacity .2s ease; scroll-margin-top: 100px;
}
.cp-grid.cp-grid--loading { opacity: 0.4; pointer-events: none; }

/* ── Product card ─────────────────────────────────────────────── */
.cp-card { display: block; text-decoration: none; color: inherit; }
.cp-card__img {
    position: relative; aspect-ratio: 1/1; overflow: hidden;
    border-radius: 8px; background: #F0EDE8;
}
.cp-card__img-bg   { width: 100%; height: 100%; transition: transform 500ms cubic-bezier(.16, 1, .3, 1); }
.cp-card__img-real {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform 500ms cubic-bezier(.16, 1, .3, 1);
}
.cp-card__img--primary { position: relative; z-index: 1; transition: transform 500ms cubic-bezier(.16, 1, .3, 1), opacity .35s ease; }
.cp-card__img--lifestyle {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    opacity: 0; z-index: 2; pointer-events: none;
    transition: opacity .35s ease, transform 500ms cubic-bezier(.16, 1, .3, 1);
}
.cp-card:hover .cp-card__img--lifestyle { opacity: 1; }
/* Only fade the primary on hover when a lifestyle image exists to swap to —
 * otherwise the card would go blank for products with fewer than 3 gallery
 * images (e.g. Recently Viewed entries without a saved lifestyle URL). */
.cp-card:has(.cp-card__img--lifestyle):hover .cp-card__img--primary { opacity: 0; }
.cp-card:hover .cp-card__img-bg,
.cp-card:hover .cp-card__img-real        { transform: scale(1.04); }
.cp-card__wish {
    position: absolute; top: 10px; right: 10px; width: 34px; height: 34px;
    background: rgba(255, 255, 255, .9); border: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: #4A4A4A; opacity: 0; transition: opacity .2s; cursor: pointer;
}
.cp-card:hover .cp-card__wish        { opacity: 1; }
.cp-card__wish.is-wishlisted         { opacity: 1; background: #FDF2F8; color: #DB2777; }
.cp-card__badge {
    position: absolute; top: 10px; left: 10px;
    font-family: 'Onest', system-ui, sans-serif;
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
    padding: 4px 10px; border-radius: 20px; background: #1A1A1A; color: #fff;
}
.cp-card__badge--new  { background: #2563EB; }
.cp-card__badge--sale { background: #D41B6B; }   /* vivid magenta — high-conversion sale signal */
.cp-card__qv {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(26, 26, 26, .85); color: #fff; text-align: center; padding: 10px;
    font-family: 'Onest', system-ui, sans-serif; font-size: 13px; font-weight: 500;
    letter-spacing: .04em; text-transform: uppercase;
    transform: translateY(100%); transition: transform 250ms cubic-bezier(.16, 1, .3, 1);
}
.cp-card:hover .cp-card__qv          { transform: translateY(0); }
.cp-card__info                       { padding: 12px 0 0; }
.cp-card__name {
    font-family: 'Onest', system-ui, sans-serif; font-size: 14px; font-weight: 500;
    color: #1A1A1A; margin-bottom: 2px; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; text-overflow: ellipsis; min-height: 2.7em;
}
.cp-card__price-prefix { font-size: .82em; font-weight: 500; color: #6B6860; margin-right: 3px; }
.cp-card__meta {
    font-family: 'Onest', system-ui, sans-serif; font-size: 12px; color: #8A8A8A; margin-bottom: 6px;
}
.cp-card__price {
    font-family: 'Onest', system-ui, sans-serif; font-size: 15px; font-weight: 700; color: #1A1A1A;
}
.cp-card__sizes {
    font-family: 'Onest', system-ui, sans-serif; font-size: 11px; color: #8A8A8A; margin-top: 4px;
}

/* ── Pagination ───────────────────────────────────────────────── */
.cp-pagination { text-align: center; margin-top: 48px; }
.cp-pagination__status {
    font-family: 'Onest', system-ui, sans-serif; font-size: 13px; color: #8A8A8A; margin-bottom: 20px;
}
.cp-pagination__pages {
    display: inline-flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center;
    padding: 0; margin: 0; list-style: none;
}
.cp-pagination__pages .page-numbers {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-width: 42px; height: 42px; padding: 0 14px;
    border: 1px solid #E5E5E5; border-radius: 10px; background: #fff;
    font-family: 'Onest', system-ui, sans-serif; font-size: 14px; font-weight: 500;
    color: #1A1A1A; text-decoration: none; cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.cp-pagination__pages a.page-numbers:hover {
    border-color: #1A1A1A; background: #FAFAFA; box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.cp-pagination__pages a.page-numbers:active        { transform: translateY(1px); }
.cp-pagination__pages a.page-numbers:focus-visible { outline: 2px solid #7c3aed; outline-offset: 2px; }
.cp-pagination__pages .page-numbers.current {
    background: #1A1A1A; border-color: #1A1A1A; color: #fff; font-weight: 600;
}
.cp-pagination__pages .page-numbers.dots {
    border: none; background: transparent; color: #8A8A8A; cursor: default;
    min-width: 24px; padding: 0 4px; letter-spacing: 1px;
}
.cp-pagination__pages .page-numbers.prev,
.cp-pagination__pages .page-numbers.next      { padding: 0 16px; }
.cp-pagination__pages .page-numbers.prev svg,
.cp-pagination__pages .page-numbers.next svg  { width: 14px; height: 14px; flex-shrink: 0; }

/* ── No results ───────────────────────────────────────────────── */
.cp-no-results    { text-align: center; padding: 64px 0; display: none; }
.cp-no-results p  { font-family: 'Onest', system-ui, sans-serif; font-size: 15px; color: #8A8A8A; }

/* ── Sub-category archive header ──────────────────────────────── */
.cp-archive h1 {
    font-family: 'Geologica', system-ui, sans-serif; font-size: 32px; font-weight: 600;
    color: #1A1A1E; margin: 0 0 4px; letter-spacing: -.02em;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1199px) {
    .cp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
    .cp-grid    { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .cp-card__qv { display: none; }
    .cp-pagination__pages                                                { gap: 6px; }
    .cp-pagination__pages .page-numbers                                  { min-width: 38px; height: 38px; font-size: 13px; padding: 0 12px; }
    .cp-pagination__pages .page-numbers.prev,
    .cp-pagination__pages .page-numbers.next                             { padding: 0 12px; }
    .cp-pagination__pages .page-numbers.prev .label,
    .cp-pagination__pages .page-numbers.next .label                      { display: none; }
}
