/* CDO Travel Theme 0.2.0 - native WooCommerce presentation and transitional legacy grids.
 * LAB owns design tokens and rails. Products owns copy, badges, price, interactions.
 * This file supplies only the missing Woo theme structure; no vendor JS required.
 */

/* Native Woo loops (shop, category and the cdo_theme_products shortcode). */
body.cdo-theme .woocommerce ul.products,
body.cdo-theme ul.products.cdo-theme-native-grid {
    display: grid !important;
    grid-template-columns: repeat(var(--cdo-theme-grid-cols, 3), minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    clear: both !important;
}
body.cdo-theme .woocommerce ul.products::before,
body.cdo-theme .woocommerce ul.products::after { content: none !important; display: none !important; }
body.cdo-theme .woocommerce ul.products > li.product,
body.cdo-theme ul.products.cdo-theme-native-grid > li.product {
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
}

/* Native theme Woo product shell: same hooks and markup classes as Products v2.9.
 * .product.cdo-product-shell.product-item.grid continues to be styled by Products.
 */
body.cdo-theme .cdo-theme-woo-card {
    overflow: hidden;
    border: 1px solid #eae6fa;
    border-radius: 20px;
    background: #fff;
    box-shadow: none;
}
body.cdo-theme .cdo-theme-woo-card > a.woocommerce-LoopProduct-link {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}
body.cdo-theme .cdo-theme-woo-card__media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    width: 100%;
    overflow: hidden;
    flex: 0 0 auto;
    isolation: isolate;
    background: #f5f8fa;
}
body.cdo-theme .cdo-theme-woo-card__media > img,
body.cdo-theme .cdo-theme-woo-card__media > a > img,
body.cdo-theme .cdo-theme-woo-card__media .cdo-storefront-card-media-stage > img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    margin: 0 !important;
}
body.cdo-theme .cdo-theme-woo-card__body {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 16px;
}
body.cdo-theme .cdo-theme-woo-card__body > :first-child { margin-top: 0; }
body.cdo-theme .cdo-theme-woo-card__body .woocommerce-loop-product__title {
    font-size: 18px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #1f3556;
    margin: 0;
}
body.cdo-theme .cdo-theme-woo-card__body .price {
    display: block;
    width: 100%;
    margin-top: auto;
    padding-top: 14px;
    font-weight: 800;
    color: #1f3556;
}
body.cdo-theme .cdo-theme-woo-card__body .price .amount { font-weight: 800; }
body.cdo-theme .cdo-theme-woo-card > a.button {
    margin: 0 16px 16px;
    text-align: center;
    border-radius: 10px;
    background: #673ccf;
    color: #fff;
    padding: 10px 15px;
    text-decoration: none;
}
body.cdo-theme .cdo-theme-woo-card__media .onsale {
    position: absolute;
    z-index: 4;
    top: 14px;
    left: 14px;
    right: auto;
    margin: 0;
}

/* Native CDO showcase: a thin WPBakery wrapper around LAB cdo_product_grid. */
body.cdo-theme .cdo-theme-showcase { margin: 0 auto 56px; width: 100%; }
body.cdo-theme .cdo-theme-showcase__title {
    margin: 0 0 22px;
    color: var(--cdo-ds-color-heading, #00152b);
    font-size: clamp(24px, 2.6vw, 34px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.035em;
}

/* Transitional adapter for legacy Woo grids saved in old WPBakery pages.
 * Only handles their DOM while they are migrated to cdo_theme_products.
 * No NASA hooks, scripts or vendor PHP calls in the new theme.
 */
body.cdo-theme .cdo-theme-front-content .nasa-sc.products.woocommerce > .row:not(.slick-track),
body.cdo-theme .cdo-theme-front-content .products.grid > .row:not(.slick-track) {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 15px !important;
}
body.cdo-theme .cdo-theme-front-content .nasa-sc.products.woocommerce > .row > .product-warp-item,
body.cdo-theme .cdo-theme-front-content .products.grid > .row > .product-warp-item {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: stretch !important;
}
body.cdo-theme .cdo-theme-front-content .product.cdo-product-shell:not(:has(.product-item.grid)) {
    min-width: 0;
    position: relative;
    overflow: hidden;
    border: 1px solid #eae6fa;
    border-radius: 20px;
    background: #fff;
}
body.cdo-theme .cdo-theme-front-content .nasa-sc.products.woocommerce .product img,
body.cdo-theme .cdo-theme-front-content .products.grid .product img {
    max-width: 100% !important;
    display: block;
    height: auto;
}
body.cdo-theme .cdo-theme-front-content .nasa-sc.products.woocommerce .product > a > img,
body.cdo-theme .cdo-theme-front-content .products.grid .product > a > img {
    width: 100% !important;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}
body.cdo-theme .cdo-theme-front-content .product.cdo-product-shell:not(:has(.product-info-wrap)) > :is(h2, .woocommerce-loop-product__title, .price, .cdo-loop-info-text) {
    margin-left: 16px;
    margin-right: 16px;
}
/* Never allow an unmounted CDO motion video to become an enormous page-wide block. */
body.cdo-theme video[data-cdo-storefront-card-video]:not([data-cdo-card-video-mounted="1"]) {
    display: none !important;
}
body.cdo-theme .cdo-theme-front-content .nasa-sc.products.woocommerce .product video[data-cdo-storefront-card-video] {
    max-width: 100% !important;
}

/* Breakpoints, including Woo shortcodes with their own .columns-N class. */
@media (max-width: 960px) {
    body.cdo-theme .woocommerce ul.products,
    body.cdo-theme ul.products.cdo-theme-native-grid,
    body.cdo-theme .cdo-theme-front-content .nasa-sc.products.woocommerce > .row:not(.slick-track),
    body.cdo-theme .cdo-theme-front-content .products.grid > .row:not(.slick-track) {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}
@media (max-width: 620px) {
    body.cdo-theme .woocommerce ul.products,
    body.cdo-theme ul.products.cdo-theme-native-grid,
    body.cdo-theme .cdo-theme-front-content .nasa-sc.products.woocommerce > .row:not(.slick-track),
    body.cdo-theme .cdo-theme-front-content .products.grid > .row:not(.slick-track) {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 14px !important;
    }
    body.cdo-theme .cdo-theme-woo-card__body { padding: 14px; }
}
