/* Product gallery, purchase controls and sample share one responsive introduction. */
.single-product .cl-product-intro {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    margin-block-end: clamp(16px, 2vw, 28px);
}
.woocommerce div.product .cl-product-intro > :is(.images, .summary, .clsbp) {
    float: none;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
}
.cl-product-intro .product_title {
    overflow-wrap: anywhere;
    text-wrap: pretty;
}
.woocommerce .cl-product-intro .summary .product_title {
    margin: 0 0 8px;
    font-size: clamp(1.375rem, 2.65vw, 2.25rem);
    line-height: 1.16;
}
.woocommerce .cl-product-intro .summary :is(.cld-facts, .woocommerce-product-rating, .cld-buyprice) {
    margin: 0 0 8px;
}
.cl-product-intro .woocommerce-product-details__short-description > :last-child,
.cl-product-intro .summary > :last-child { margin-bottom: 0; }
.cl-product-intro .summary .product_meta { margin-top: 8px; padding-top: 8px; }
.cl-product-intro .summary .cl-wallet-ack { margin-block: 8px; }
.cl-product-intro .summary .cld-assure { margin-block: 8px; }
.cl-product-intro .summary .cld-readmore,
.cl-product-intro .cl-preview-link { min-height: 44px; align-content: center; margin: 0; }
.woocommerce .cl-product-intro .summary .single_add_to_cart_button {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    white-space: normal;
}
.cl-product-intro .variations { table-layout: fixed; width: 100%; }
.cl-product-intro .variations th { width: 30%; overflow-wrap: anywhere; }
.woocommerce div.product .cl-product-intro form.cart .variations select {
    width: 100%; min-width: 0; max-width: 100%; min-height: 44px; margin: 0;
}
.cl-product-intro .clsbp { scroll-margin-block-start: 4rem; }

@media (min-width: 769px) {
    .single-product .cl-product-intro {
        grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
        grid-template-rows: max-content max-content minmax(0, 1fr);
        column-gap: clamp(20px, 3vw, 44px);
    }
    .cl-product-intro:has(> .clsbp) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cl-product-intro > .images { grid-area: 1 / 1; }
    .cl-product-intro > .summary { grid-area: 1 / 2 / 4; }
    .woocommerce div.product .cl-product-intro > .clsbp { grid-area: 2 / 1; margin-top: 16px; }
    .cl-product-intro:not(:has(> .images)) > .summary { grid-column: 1 / -1; }
}

/* On small screens a single cover and the title lead into full-width controls.
   Multi-image galleries keep their native full-width slider and thumbnails. */
@media (max-width: 768px) {
    .single-product .site-content .inside-article {
        padding-inline: clamp(14px, 4vw, 24px);
        padding-block-start: 16px;
    }
    .single-product .site-main .woocommerce-breadcrumb {
        margin: 0 0 12px;
        overflow-wrap: anywhere;
    }
    .cl-product-intro { row-gap: 8px; }
    .woocommerce.single-product div.product .cl-product-intro > .images { margin: 0 !important; }
    .cl-product-intro > .summary { display: flex; flex-direction: column; gap: 8px; }
    .cl-product-intro:has(> .images):has(> .summary .product_title):not(:has(.woocommerce-product-gallery__image:nth-child(2), .flex-control-thumbs)) {
        grid-template-columns: clamp(80px, 23vw, 136px) minmax(0, 1fr);
        column-gap: clamp(12px, 3vw, 20px);
    }
    .cl-product-intro:has(> .images):has(> .summary .product_title):not(:has(.woocommerce-product-gallery__image:nth-child(2), .flex-control-thumbs)) > .summary {
        display: contents;
    }
    .cl-product-intro > .summary > *, .cl-product-intro > .clsbp { grid-column: 1 / -1; min-width: 0; }
    .cl-product-intro .cld-bundle-heading { display: contents; }
    .cl-product-intro .cld-bundle-heading > * { grid-column: 1 / -1; min-width: 0; }
    .cl-product-intro > .summary .product_title { grid-column: -2 / -1; align-self: center; }
    .cl-product-intro > .summary::before, .cl-product-intro > .summary::after { display: none; }
    .woocommerce.single-product div.product .cl-product-intro .images .woocommerce-product-gallery__wrapper {
        min-height: 0;
        margin: 0;
        padding: 5px !important;
    }
    .woocommerce.single-product div.product .cl-product-intro .images .woocommerce-product-gallery__image:first-child { min-height: 0; }
    .cl-product-intro .images:not(:has(.woocommerce-product-gallery__image:nth-child(2))) .woocommerce-product-gallery__image:first-child a {
        display: grid;
        place-items: center;
        aspect-ratio: 2 / 3;
        width: 100%;
    }
    .woocommerce.single-product div.product .cl-product-intro .images:not(:has(.woocommerce-product-gallery__image:nth-child(2), .flex-control-thumbs)) .woocommerce-product-gallery__image img:not(.zoomImg) {
        max-width: 100%;
        max-height: min(36vw, 195px);
        height: auto;
    }
    .woocommerce .cl-product-intro .summary > :is(.product_title, .cld-facts, .woocommerce-product-rating, .cld-buyprice, .woocommerce-product-details__short-description, p) { margin-block: 0; }
    .woocommerce .cl-product-intro .summary form.cart { margin: 0 !important; }
    .cl-product-intro .summary .cld-readmore { justify-self: start; align-self: start; }
    .cl-product-intro .summary .cl-wallet-ack, .cl-product-intro .summary .cld-assure { margin-block: 0; }
    .cl-product-intro .summary .variations :is(tr, th, td) { display: block; text-align: start; }
    .cl-product-intro .summary .variations th { width: auto; }
    .woocommerce div.product .cl-product-intro > .onsale {
        top: 0; left: 0; right: auto; z-index: 2;
        transform: translateY(-20%); pointer-events: none;
    }
    .cl-mobile-purchase { box-sizing: border-box; }
    .cl-product-intro .images .woocommerce-product-gallery__trigger { min-width: 44px; min-height: 44px; }
}

.cld-pdp .cld-offers { margin: 0 0 16px; }
.cld-pdp .cld-offers .cld-offer { margin: 0; }
.cld-pdp .cld-offers summary { min-height: 44px; align-content: center; }
.cld-pdp .cld-offer > span { min-width: 0; overflow-wrap: anywhere; }
.cld-pdp .cld-pagenav {
    flex-wrap: wrap;
    gap: 0 4px;
    margin: 0 0 16px;
    overflow: visible;
}
.cld-pdp .cld-pagenav a { min-height: 44px; padding-inline: 10px; }
.cld-pdp :is(.cld-tab, .cld-inside, .cld-related) { margin-bottom: clamp(20px, 3vw, 32px); }
.cld-pdp .cld-inside ol { grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.cld-pdp .cld-inside li { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; padding: 8px; }
.cld-pdp .cld-inside li img { width: 40px !important; height: 54px !important; }
.cld-pdp .cld-inside li a, .cld-pdp .cld-tab { overflow-wrap: anywhere; }
.cld-pdp .cld-tab :is(figure, img, video, iframe, input, textarea) { max-width: 100%; box-sizing: border-box; }
.cld-pdp .cld-tab pre, .cld-pdp .cld-tab .wp-block-table { overflow-x: auto; }
.single-product :is(.cld-tab.is-description, .woocommerce-Tabs-panel--description) :is(p, blockquote, ul, ol) {
    margin-block: 0 0.85em;
}
.single-product :is(.cld-tab.is-description, .woocommerce-Tabs-panel--description) :is(h2, h3, h4) {
    margin-block: 1em 0.4em;
}
.single-product :is(.cld-tab.is-description, .woocommerce-Tabs-panel--description) > :first-child { margin-top: 0; }
.single-product :is(.cld-tab.is-description, .woocommerce-Tabs-panel--description) .wp-block-spacer {
    max-height: clamp(12px, 2vw, 24px);
}
.cld-pdp .cld-related .cld-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
    gap: 12px;
}
.cld-pdp .cld-related .cld-card { display: grid; grid-template-columns: minmax(68px, 30%) minmax(0, 1fr); }
.cld-pdp .cld-related .cld-cover { aspect-ratio: auto; padding: 8px; }
.cld-pdp .cld-related .cld-cover img { max-height: 140px; }
.cld-pdp .cld-related .cld-body { min-width: 0; padding: 10px; }
.cld-pdp .cld-related .cld-foot .cld-btn { box-sizing: border-box; }

/* Woo and GeneratePress also size the gallery as a floated column. Inside
   the product grid its track already supplies that width. */
.woocommerce.single-product div.product .cl-product-intro > div.woocommerce-product-gallery.images {
    width: 100% !important;
    max-width: 100% !important;
}
.cld-bundle-payment {
    min-width: 0;
    padding: clamp(14px, 2vw, 24px);
    border: 1px solid #d6e4df;
    border-radius: 14px;
    background: #f6faf8;
    scroll-margin-top: 90px;
}
.cld-bundle-payment h2 { margin: 0 0 12px; font-size: 1.25rem; line-height: 1.25; }
.cld-bundle-payment .woocommerce-info { margin: 0 0 12px; padding-block: 10px; }
.cld-bundle-payment .cl-wallet-ack { background: #fff; }
.cld-bundle-payment .cld-assure { margin: 12px 0 0; line-height: 1.45; }
.cld-bundle-copy .cld-jump, .cld-bundle-meta > p { margin: 0; }
.cld-bundle-meta { padding-top: 10px; font-size: .9rem; }
.cld-bundle-meta a, .cld-bundle-copy .cld-jump a { color: var(--cl-purchase); }
.cld-pdp .cld-total { max-width: none; }
.cld-pdp .cld-tab.is-description { max-width: 80ch; }
.cld-pdp .is-reviews { border-top: 1px solid #d6e4df; padding-top: 20px; }
.cld-pdp .is-reviews .cl-review-filters { margin: 0 0 16px; }
.cld-pdp .is-reviews > h2 ~ #reviews .woocommerce-Reviews-title { display: none; }

@media (max-width: 768px) {
    .cl-product-intro:has(.cld-bundle-heading):not(:has(.woocommerce-product-gallery__image:nth-child(2), .flex-control-thumbs)) > .images {
        grid-area: 2 / 1 / 5; align-self: center;
    }
    .cl-product-intro .summary .cld-bundle-heading .product_title { grid-area: 1 / 1 / 2 / -1; }
    .cl-product-intro:has(> .images):not(:has(.woocommerce-product-gallery__image:nth-child(2), .flex-control-thumbs)) .cld-bundle-heading > :is(.cld-facts, .woocommerce-product-rating, .cld-buyprice) {
        grid-column: 2; margin-block: 0;
    }
}

@media (min-width: 960px) {
    /* The title and cover lead into full-width editorial copy on the left.
       Card and express controls share an independent column on the right. */
    .cld-pdp .cl-product-intro:has(.cld-bundle-payment):has(> .images):not(:has(> .clsbp)) {
        grid-template-columns: minmax(140px, .55fr) minmax(0, 1.05fr) minmax(300px, 1fr);
        grid-template-rows: max-content max-content max-content minmax(0, 1fr);
        column-gap: clamp(16px, 2vw, 28px);
    }
    .cl-product-intro:has(.cld-bundle-payment):has(> .images):not(:has(> .clsbp)) > .summary { display: contents; }
    .cld-bundle-heading { grid-area: 1 / 2; min-width: 0; }
    .cld-bundle-copy { grid-area: 2 / 1 / 3 / 3; padding-top: 14px; }
    .cld-bundle-meta { grid-area: 3 / 1 / 4 / 3; }
    .cld-bundle-payment { grid-area: 1 / 3 / 5; align-self: start; }
    .woocommerce .cl-product-intro .cld-bundle-heading .product_title { font-size: clamp(1.4rem, 2vw, 1.9rem); }
    .cld-pdp .cld-inside:has(> ol > li:last-child:nth-child(-n+6)) {
        display: grid;
        grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
        gap: 12px clamp(16px, 2vw, 28px);
        align-items: start;
    }
    .cld-pdp .cld-inside > h2 { grid-column: 1 / -1; margin-bottom: 0; }
    .cld-pdp .cld-inside:has(> ol > li:last-child:nth-child(-n+6)) > ol {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin: 0 !important;
    }
    .cld-pdp .cld-inside:has(> ol > li:nth-child(7)) > .cld-total {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px 24px;
    }
    .cld-pdp .cld-total .cld-btn { justify-self: start; }
    .cld-pdp .is-reviews #reviews:has(> #review_form_wrapper) {
        display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
        gap: 28px; align-items: start;
    }
    .cld-pdp .is-reviews #reviews::before, .cld-pdp .is-reviews #reviews::after { display: none; }
    .cld-pdp .is-reviews #reviews > :is(#comments, #review_form_wrapper) { min-width: 0; width: auto; float: none; }
}
