/* ==========================================================
   KUMKANG KIND BEAUTY — CLEAN PRODUCT ARCHIVE v1.1.5

   Visual direction:
   - Bephor / Uncover inspired separated columns
   - Kumkang brand blue + dark charcoal/blue typography
   - Main image → Brand → Name → Price → Add to Cart
   - Desktop 5 | Tablet 3 | Mobile 2

   Brand palette derived from the supplied Kumkang Kind Beauty logo:
   Primary blue: #0086B9
   Dark blue:    #005A7D
   Charcoal:     #58585A
   ========================================================== */

:root {
    --kkb-blue: #0086B9;
    --kkb-blue-dark: #005A7D;
    --kkb-blue-deep: #00435E;
    --kkb-charcoal: #58585A;
    --kkb-text: #243746;
    --kkb-muted: #6F777C;
    --kkb-line: #E1E7EA;
    --kkb-sale-old: #8B9499;
}

/* ==========================================================
   PRODUCT GRID
   ========================================================== */
/* WooCommerce and legacy theme clearfixes on ul.products generate invisible
   grid items. Their ::before element consumes column 1 of the first row,
   leaving an apparent missing product. Suppress only the generated clearfix
   on catalogue grids; do not suppress any real product elements. */
body.woocommerce.archive ul.products::before,
body.woocommerce.archive ul.products::after,
body.woocommerce.archive ul.products.grid::before,
body.woocommerce.archive ul.products.grid::after,
body.woocommerce.archive ul.products.list::before,
body.woocommerce.archive ul.products.list::after {
    content: none !important;
    display: none !important;
}


body.woocommerce.archive ul.products,
body.woocommerce.archive ul.products.list,
body.woocommerce.archive ul.products.grid {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    column-gap: 0 !important;
    row-gap: 34px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

body.woocommerce.archive ul.products > li.product,
body.woocommerce.archive ul.products.list > li.product,
body.woocommerce.archive ul.products.grid > li.product {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    float: none !important;
    clear: none !important;
    margin: 0 !important;
    padding: 0 12px !important;
    list-style: none !important;
    border-right: 1px solid var(--kkb-line) !important;
    box-sizing: border-box !important;
}

/* Subtle vertical separation like the supplied reference stores. */
@media (min-width: 992px) {
    body.woocommerce.archive ul.products > li.product:nth-child(5n),
    body.woocommerce.archive ul.products.list > li.product:nth-child(5n),
    body.woocommerce.archive ul.products.grid > li.product:nth-child(5n) {
        border-right: 0 !important;
    }
}

/* ==========================================================
   DESKTOP FULL-WIDTH CATALOGUE
   Expand the five-product row close to the viewport edges
   while retaining a small, clean side margin.
   ========================================================== */
@media (min-width: 992px) {
    body.woocommerce.archive ul.products,
    body.woocommerce.archive ul.products.list,
    body.woocommerce.archive ul.products.grid {
        width: calc(100vw - 32px) !important;
        max-width: none !important;
        margin-left: calc(50% - 50vw + 16px) !important;
        margin-right: 0 !important;
    }

    body.woocommerce.archive ul.products > li.product,
    body.woocommerce.archive ul.products.list > li.product,
    body.woocommerce.archive ul.products.grid > li.product {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .kkb-product-media {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
    }
}

body.woocommerce.archive ul.products > li.product::before,
body.woocommerce.archive ul.products > li.product::after {
    display: none !important;
    content: none !important;
}

/* ==========================================================
   PRODUCT CARD
   ========================================================== */

.kkb-product-card {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-width: 0 !important;
    background: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* ==========================================================
   PRODUCT IMAGE
   ========================================================== */

.kkb-product-media {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 285px !important;
    margin: 0 0 14px !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
    box-sizing: border-box !important;
}

.kkb-product-image-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
}

.kkb-product-media img.kkb-main-product-image,
.kkb-product-media img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 auto !important;
    object-fit: contain !important;
    object-position: center !important;
    transform: scale(1.10) !important;
    transform-origin: center center !important;
}

/* Out-of-stock badge — takes priority over sale badge. */
.kkb-product-media .kkb-out-of-stock-badge {
    position: absolute !important;
    top: 8px !important;
    left: 8px !important;
    right: auto !important;
    z-index: 9 !important;
    min-width: auto !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 6px 9px !important;
    background: #D72626 !important;
    color: #FFFFFF !important;
    border: 0 !important;
    font-size: 10px !important;
    line-height: 1 !important;
    font-weight: 800 !important;
    letter-spacing: .03em !important;
    border-radius: 3px !important;
    text-transform: uppercase !important;
}

/* Sale badge in red as requested. */
.kkb-product-media .onsale {
    position: absolute !important;
    top: 8px !important;
    left: 8px !important;
    right: auto !important;
    z-index: 4 !important;
    min-width: auto !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 5px 8px !important;
    background: #ff4d2e !important;
    color: #fff !important;
    border: 0 !important;
    font-size: 10px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    border-radius: 3px !important;
}

/* ==========================================================
   PRODUCT INFORMATION
   ========================================================== */

.kkb-product-body {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    padding: 0 2px !important;
    text-align: left !important;
}

.kkb-product-brand {
    display: block !important;
    margin: 0 0 6px !important;
    padding: 0 !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
    font-weight: 600 !important;
    color: var(--kkb-charcoal) !important;
    text-align: left !important;
    text-transform: none !important;
    letter-spacing: .01em !important;
}

.kkb-product-title,
body.woocommerce.archive ul.products li.product .kkb-product-title {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    overflow: hidden !important;
    min-height: 40px !important;
    max-height: 40px !important;
    margin: 0 0 8px !important;
    padding: 0 !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
    color: var(--kkb-blue-dark) !important;
    text-align: left !important;
}

.kkb-product-title a,
body.woocommerce.archive ul.products li.product .kkb-product-title a {
    color: var(--kkb-blue-dark) !important;
    font-size: inherit !important;
    line-height: inherit !important;
    font-weight: inherit !important;
    text-decoration: none !important;
}

.kkb-product-title a:hover {
    color: var(--kkb-blue) !important;
}

/* ==========================================================
   PRICE — KES + BLACK PRICE TEXT
   ========================================================== */

.kkb-product-price,
body.woocommerce.archive ul.products li.product .kkb-product-price {
    display: block !important;
    margin: 4px 0 14px !important;
    padding: 0 !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    font-weight: 700 !important;
    color: #111111 !important;
    text-align: left !important;
}

.kkb-product-price *,
.kkb-product-price bdi,
.kkb-product-price ins,
.kkb-product-price ins *,
body.woocommerce.archive ul.products li.product .kkb-product-price * {
    color: #111111 !important;
    font-size: inherit !important;
    line-height: inherit !important;
}

.kkb-product-price .woocommerce-Price-currencySymbol {
    display: inline-block !important;
    margin-right: 4px !important;
    color: #111111 !important;
    font-weight: 700 !important;
}

.kkb-product-price del,
.kkb-product-price del *,
.kkb-product-price del bdi {
    color: var(--kkb-sale-old) !important;
    opacity: 1 !important;
    font-weight: 500 !important;
}

.kkb-product-price del {
    margin-right: 7px !important;
}

.kkb-product-price ins {
    text-decoration: none !important;
    font-weight: 700 !important;
}

/* ==========================================================
   ADD TO CART
   ========================================================== */

.kkb-product-cart {
    margin-top: auto !important;
    padding-top: 4px !important;
}

.kkb-product-cart a.button,
.kkb-product-cart .button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 10px 8px !important;
    background: var(--kkb-blue-dark) !important;
    color: #fff !important;
    border: 1px solid var(--kkb-blue-dark) !important;
    border-radius: 2px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    text-align: center !important;
    text-decoration: none !important;
    white-space: normal !important;
    box-sizing: border-box !important;
    transition: background-color .2s ease, border-color .2s ease !important;
}

.kkb-product-cart a.button:hover,
.kkb-product-cart .button:hover {
    background: var(--kkb-blue-deep) !important;
    border-color: var(--kkb-blue-deep) !important;
    color: #fff !important;
}

/* Grid-only archive: remove old theme grid/list switch. */
body.woocommerce.archive .gridlist-toggle {
    display: none !important;
}

/* ==========================================================
   TABLET — 3 COLUMNS
   ========================================================== */

@media (min-width: 768px) and (max-width: 991px) {
    body.woocommerce.archive ul.products,
    body.woocommerce.archive ul.products.list,
    body.woocommerce.archive ul.products.grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        column-gap: 0 !important;
        row-gap: 28px !important;
    }

    body.woocommerce.archive ul.products > li.product,
    body.woocommerce.archive ul.products.list > li.product,
    body.woocommerce.archive ul.products.grid > li.product {
        padding: 0 15px !important;
        border-right: 1px solid var(--kkb-line) !important;
    }

    body.woocommerce.archive ul.products > li.product:nth-child(3n),
    body.woocommerce.archive ul.products.list > li.product:nth-child(3n),
    body.woocommerce.archive ul.products.grid > li.product:nth-child(3n) {
        border-right: 0 !important;
    }

    .kkb-product-media {
        height: 245px !important;
    }
}

/* ==========================================================
   MOBILE — 2 COLUMNS
   ========================================================== */

@media (max-width: 767px) {
    body.woocommerce.archive ul.products,
    body.woocommerce.archive ul.products.list,
    body.woocommerce.archive ul.products.grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        column-gap: 0 !important;
        row-gap: 24px !important;
    }

    body.woocommerce.archive ul.products > li.product,
    body.woocommerce.archive ul.products.list > li.product,
    body.woocommerce.archive ul.products.grid > li.product {
        padding: 0 9px !important;
        border-right: 1px solid var(--kkb-line) !important;
    }

    body.woocommerce.archive ul.products > li.product:nth-child(2n),
    body.woocommerce.archive ul.products.list > li.product:nth-child(2n),
    body.woocommerce.archive ul.products.grid > li.product:nth-child(2n) {
        border-right: 0 !important;
    }

    .kkb-product-media {
        height: 195px !important;
        padding: 2px !important;
    }

    .kkb-product-brand {
        font-size: 10px !important;
    }

    .kkb-product-title,
    body.woocommerce.archive ul.products li.product .kkb-product-title {
        min-height: 34px !important;
        max-height: 34px !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
    }

    .kkb-product-price,
    body.woocommerce.archive ul.products li.product .kkb-product-price {
        font-size: 12px !important;
    }

    .kkb-product-cart a.button,
    .kkb-product-cart .button {
        min-height: 38px !important;
        font-size: 10px !important;
        padding: 8px 5px !important;
    }
}


/* ==========================================================
   v1.1.6 — PRODUCT CATEGORY BANNER
   Shows whenever a WooCommerce product category is selected.
   ========================================================== */

body.tax-product_cat .kkb-category-banner {
    --kkb-category-image: none;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    width: calc(100vw - 32px) !important;
    min-height: 250px !important;
    margin: 0 0 34px calc(50% - 50vw + 16px) !important;
    overflow: hidden !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
    isolation: isolate !important;
    background: #eaf7fb !important;
}

body.tax-product_cat .kkb-category-banner.has-image {
    color: #fff !important;
}

body.tax-product_cat .kkb-category-banner.no-image {
    color: var(--kkb-blue-deep) !important;
    background:
        radial-gradient(circle at 78% 18%, rgba(0,134,185,.12), transparent 32%),
        linear-gradient(115deg, #f4fbfe 0%, #e1f3f9 58%, #d6eef7 100%) !important;
}

.kkb-category-banner-media {
    position: absolute !important;
    inset: 0 !important;
    z-index: 0 !important;
    background-image: var(--kkb-category-image) !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    transform: scale(1.01) !important;
}

.kkb-category-banner-overlay {
    position: absolute !important;
    inset: 0 !important;
    z-index: 1 !important;
    pointer-events: none !important;
}

.kkb-category-banner.has-image .kkb-category-banner-overlay {
    background:
        linear-gradient(
            90deg,
            rgba(0, 52, 74, .90) 0%,
            rgba(0, 67, 94, .72) 38%,
            rgba(0, 67, 94, .30) 67%,
            rgba(0, 67, 94, .08) 100%
        ) !important;
}

.kkb-category-banner.no-image .kkb-category-banner-overlay {
    background: none !important;
}

.kkb-category-banner-content {
    position: relative !important;
    z-index: 2 !important;
    width: min(680px, 70%) !important;
    padding: 44px 54px !important;
    box-sizing: border-box !important;
}

.kkb-category-eyebrow {
    display: block !important;
    margin: 0 0 8px !important;
    color: #6cc3df !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
    font-weight: 800 !important;
    letter-spacing: .16em !important;
}

.kkb-category-banner.no-image .kkb-category-eyebrow {
    color: var(--kkb-blue) !important;
}

.kkb-category-banner h1 {
    margin: 0 0 10px !important;
    padding: 0 !important;
    color: inherit !important;
    font-size: clamp(30px, 4vw, 54px) !important;
    line-height: 1.04 !important;
    font-weight: 800 !important;
    letter-spacing: -.025em !important;
}

.kkb-category-banner-description,
.kkb-category-banner-description p {
    max-width: 620px !important;
    margin: 0 !important;
    color: inherit !important;
    font-size: 13px !important;
    line-height: 1.65 !important;
}

.kkb-category-banner.has-image .kkb-category-banner-description {
    color: rgba(255,255,255,.90) !important;
}

/* Hide theme/Woo category title-description duplicates where possible.
   The banner provides the category heading itself. */
body.tax-product_cat.kkb-cpg-show-category-banner .woocommerce-products-header__title.page-title {
    display: none !important;
}

body.tax-product_cat.kkb-cpg-show-category-banner .term-description {
    display: none !important;
}

@media (max-width: 991px) {
    body.tax-product_cat .kkb-category-banner {
        width: calc(100vw - 24px) !important;
        min-height: 220px !important;
        margin-left: calc(50% - 50vw + 12px) !important;
        margin-bottom: 28px !important;
    }

    .kkb-category-banner-content {
        width: min(720px, 82%) !important;
        padding: 34px 34px !important;
    }
}

@media (max-width: 767px) {
    body.tax-product_cat .kkb-category-banner {
        width: calc(100vw - 20px) !important;
        min-height: 200px !important;
        margin-left: calc(50% - 50vw + 10px) !important;
        margin-bottom: 24px !important;
    }

    .kkb-category-banner.has-image .kkb-category-banner-overlay {
        background: rgba(0, 58, 82, .68) !important;
    }

    .kkb-category-banner-content {
        width: 100% !important;
        padding: 28px 22px !important;
    }

    .kkb-category-banner h1 {
        font-size: clamp(27px, 9vw, 40px) !important;
    }

    .kkb-category-banner-description,
    .kkb-category-banner-description p {
        font-size: 12px !important;
    }
}

/* v1.2.0: Typography scoped to Kumkang product cards.
   Word-style points; no site-facing text below 8.5pt or above 16pt. */
body.woocommerce.archive ul.products .kkb-product-brand {
    font-size: 8.5pt !important;
}
body.woocommerce.archive ul.products .kkb-product-title,
body.woocommerce.archive ul.products li.product .kkb-product-title {
    font-size: 10.5pt !important;
}
body.woocommerce.archive ul.products .kkb-product-price,
body.woocommerce.archive ul.products li.product .kkb-product-price {
    font-size: 10.5pt !important;
}
body.woocommerce.archive ul.products .kkb-product-cart a.button,
body.woocommerce.archive ul.products .kkb-product-cart .button {
    font-size: 9pt !important;
}
body.woocommerce.archive ul.products .kkb-out-of-stock-badge,
body.woocommerce.archive ul.products .kkb-product-media .onsale {
    font-size: 8.5pt !important;
}
body.tax-product_cat .kkb-category-banner h1 {
    font-size: 16pt !important;
}
body.tax-product_cat .kkb-category-eyebrow,
body.tax-product_cat .kkb-category-banner-description,
body.tax-product_cat .kkb-category-banner-description p {
    font-size: 9pt !important;
}
