/* MD Framework RC33 — WooCommerce single product design presets.
 * Loaded AFTER WooCommerce.css. Targets the product root directly (no extra
 * WooCommerce wrapper assumed); native variation, gallery and tab hooks stay intact.
 */
body.single-product.md-woo-single-product {
    --md-single-surface:#fff;
    --md-single-muted:#f8fafc;
    --md-single-shadow:0 18px 50px rgba(15,23,42,.09);
}
body.single-product.md-woo-single-product .md-woo-content,
body.single-product.md-woo-single-product .woocommerce {min-width:0;}
body.single-product.md-woo-single-product div.product {
    box-sizing:border-box;
    position:relative;
    display:grid!important;
    grid-template-columns:minmax(0,var(--md-single-gallery-max,420px)) minmax(0,1fr)!important;
    column-gap:clamp(20px,3.4vw,48px)!important;
    row-gap:24px!important;
    align-items:start!important;
    max-width:100%;
}
body.single-product.md-woo-single-product div.product > div.images {
    grid-column:1!important;
    grid-row:1!important;
    min-width:0!important;
    width:100%!important;
    max-width:var(--md-single-gallery-max,420px)!important;
    margin:0!important;
    padding:14px!important;
    float:none!important;
    box-sizing:border-box!important;
    border:1px solid var(--md-border,#e2e8f0);
    border-radius:20px;
    background:var(--md-single-surface);
    box-shadow:var(--md-single-shadow);
    justify-self:start;
}
body.single-product.md-woo-single-product div.product > div.summary {
    grid-column:2!important;
    grid-row:1!important;
    width:100%!important;
    min-width:0!important;
    float:none!important;
    box-sizing:border-box!important;
    margin:0!important;
    padding:clamp(20px,2.8vw,34px)!important;
    border:1px solid var(--md-border,#e2e8f0);
    border-radius:20px;
    background:#fff;
    box-shadow:var(--md-single-shadow);
}
body.single-product.md-woo-single-product div.product > span.onsale {
    position:absolute!important;
    z-index:5;
    inset-block-start:12px!important;
    inset-inline-start:12px!important;
    margin:0!important;
}
body.single-product.md-woo-single-product div.product .woocommerce-product-gallery__wrapper {
    width:100%;
    overflow:hidden;
    border-radius:14px;
    background:var(--md-single-muted);
}
body.single-product.md-woo-single-product div.product div.images .woocommerce-product-gallery__image > a {
    display:flex!important;
    align-items:center;
    justify-content:center;
    width:100%!important;
    aspect-ratio:1 / 1!important;
    height:auto!important;
    background:var(--md-single-muted);
    overflow:hidden;
    cursor:default!important;
}
/* An automatic WooCommerce image ratio remains natural rather than being
 * silently converted to square by the selected presentation. */
body.single-product.md-woo-single-product:not(.md-woo-image-square):not(.md-woo-image-portrait):not(.md-woo-image-landscape) div.product div.images .woocommerce-product-gallery__image > a {
    aspect-ratio:auto!important;
    max-height:var(--md-single-gallery-max,420px)!important;
}
body.single-product.md-woo-single-product:not(.md-woo-image-square):not(.md-woo-image-portrait):not(.md-woo-image-landscape) div.product div.images .woocommerce-product-gallery__image img {
    height:auto!important;
    max-height:var(--md-single-gallery-max,420px)!important;
}
/* Retain the existing WooCommerce aspect-ratio preference. */
body.single-product.md-woo-image-portrait div.product div.images .woocommerce-product-gallery__image > a {aspect-ratio:4 / 5!important;}
body.single-product.md-woo-image-landscape div.product div.images .woocommerce-product-gallery__image > a {aspect-ratio:4 / 3!important;}
body.single-product.md-woo-image-square div.product div.images .woocommerce-product-gallery__image > a {aspect-ratio:1 / 1!important;}
body.single-product.md-woo-single-product div.product div.images .woocommerce-product-gallery__image img {
    display:block!important;
    width:100%!important;
    height:100%!important;
    max-height:var(--md-single-gallery-max,420px)!important;
    object-fit:contain!important;
    transform:none!important;
}
body.single-product.md-woo-single-product div.product div.images .woocommerce-product-gallery__trigger,
body.single-product.md-woo-single-product div.product div.images .zoomImg {display:none!important;}
body.single-product.md-woo-single-product div.product div.images .flex-control-thumbs {
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:9px;
    padding:0!important;
    margin:12px 0 0!important;
}
body.single-product.md-woo-single-product div.product div.images .flex-control-thumbs li {
    min-width:0;
    width:100%!important;
    float:none!important;
    margin:0!important;
}
body.single-product.md-woo-single-product div.product div.images .flex-control-thumbs img {
    display:block;
    width:100%;
    height:74px;
    object-fit:contain!important;
    border-radius:10px;
}
body.single-product.md-woo-single-product div.product .summary .product_title {
    font-size:clamp(25px,2.6vw,38px)!important;
    line-height:1.25;
    margin:0 0 16px!important;
}
body.single-product.md-woo-single-product div.product .summary .price {
    display:block!important;
    margin:10px 0 20px!important;
    font-size:clamp(22px,2.3vw,30px)!important;
}
body.single-product.md-woo-single-product div.product .summary .woocommerce-product-details__short-description {
    margin:14px 0 18px;
    line-height:1.9;
}
body.single-product.md-woo-single-product div.product .summary form.cart {
    margin:20px 0 0;
    border-radius:14px;
}
/* Full-width rows: previous iterations unintentionally allowed these to form
 * additional image-sized grid cells. */
body.single-product.md-woo-single-product div.product > .woocommerce-tabs,
body.single-product.md-woo-single-product div.product > .related,
body.single-product.md-woo-single-product div.product > .upsells,
body.single-product.md-woo-single-product div.product > .wc-tabs-wrapper {
    grid-column:1 / -1!important;
    grid-row:auto!important;
    min-width:0;
    width:100%;
    box-sizing:border-box;
}
body.single-product.md-woo-single-product div.product > .woocommerce-tabs,
body.single-product.md-woo-single-product div.product > .wc-tabs-wrapper {
    margin:18px 0 0!important;
    padding:clamp(20px,3vw,36px)!important;
    background:#fff!important;
    border:1px solid var(--md-border,#e2e8f0)!important;
    border-radius:20px!important;
    box-shadow:0 20px 55px rgba(15,23,42,.12)!important;
}
body.single-product.md-woo-single-product div.product .woocommerce-tabs ul.tabs {
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin:0 0 22px!important;
    padding:0 0 14px!important;
    border-bottom:1px solid var(--md-border,#e2e8f0);
}
body.single-product.md-woo-single-product div.product .woocommerce-tabs ul.tabs::before,
body.single-product.md-woo-single-product div.product .woocommerce-tabs ul.tabs li::before,
body.single-product.md-woo-single-product div.product .woocommerce-tabs ul.tabs li::after {display:none!important;}
body.single-product.md-woo-single-product div.product .woocommerce-tabs ul.tabs li {
    border:1px solid var(--md-border,#e2e8f0)!important;
    border-radius:11px!important;
    background:var(--md-single-muted)!important;
    padding:0!important;
}
body.single-product.md-woo-single-product div.product .woocommerce-tabs ul.tabs li a {
    display:block;
    padding:12px 20px!important;
    color:var(--md-heading,#0f172a);
    font-weight:750;
}
body.single-product.md-woo-single-product div.product .woocommerce-tabs ul.tabs li.active {
    border-color:var(--md-primary)!important;
    background:var(--md-primary)!important;
}
body.single-product.md-woo-single-product div.product .woocommerce-tabs ul.tabs li.active a {color:#fff!important;}
body.single-product.md-woo-single-product div.product .woocommerce-tabs .panel {padding:0!important;margin:0!important;line-height:1.95;}
body.single-product.md-woo-single-product div.product > .related,
body.single-product.md-woo-single-product div.product > .upsells {margin:30px 0 0!important;}
/* Preset #2: dense split, more copy visible in the same viewport. */
body.single-product.md-woo-single-layout-compact div.product {
    grid-template-columns:minmax(0,min(340px,var(--md-single-gallery-max,420px))) minmax(0,1fr)!important;
    column-gap:22px!important;
}
body.single-product.md-woo-single-layout-compact div.product > div.images {
    max-width:min(340px,var(--md-single-gallery-max,420px))!important;
    padding:10px!important;
    box-shadow:0 8px 26px rgba(15,23,42,.07);
}
body.single-product.md-woo-single-layout-compact div.product > div.summary {padding:20px!important;box-shadow:0 8px 28px rgba(15,23,42,.07);}
body.single-product.md-woo-single-layout-compact div.product .summary .woocommerce-product-details__short-description {padding:10px 0;border:0;background:transparent;}
/* Preset #3: centered gallery above a full-width feature summary. */
body.single-product.md-woo-single-layout-showcase div.product {grid-template-columns:1fr!important;justify-items:center;row-gap:22px!important;}
body.single-product.md-woo-single-layout-showcase div.product > div.images {grid-column:1!important;grid-row:1!important;justify-self:center;max-width:min(480px,var(--md-single-gallery-max,420px))!important;}
body.single-product.md-woo-single-layout-showcase div.product > div.summary {grid-column:1!important;grid-row:2!important;max-width:980px;justify-self:center;}
/* Mobile: gallery and details always stack, independent of chosen preset. */
@media (max-width:900px) {
    body.single-product.md-woo-single-product div.product {
        grid-template-columns:minmax(0,1fr)!important;
        row-gap:18px!important;
    }
    body.single-product.md-woo-single-product div.product > div.images {
        grid-column:1!important;grid-row:1!important;
        justify-self:center!important;
        width:100%!important;
        max-width:min(440px,var(--md-single-gallery-max,420px))!important;
    }
    body.single-product.md-woo-single-product div.product > div.summary {
        grid-column:1!important;grid-row:2!important;
        max-width:none!important;
    }
    body.single-product.md-woo-single-product div.product > .woocommerce-tabs,
    body.single-product.md-woo-single-product div.product > .related,
    body.single-product.md-woo-single-product div.product > .upsells {grid-column:1!important;}
}
@media (max-width:600px) {
    body.single-product.md-woo-single-product div.product > div.images {padding:9px!important;border-radius:15px;}
    body.single-product.md-woo-single-product div.product > div.summary {padding:18px!important;border-radius:15px;}
    body.single-product.md-woo-single-product div.product > .woocommerce-tabs,
    body.single-product.md-woo-single-product div.product > .wc-tabs-wrapper {padding:18px!important;border-radius:15px!important;}
    body.single-product.md-woo-single-product div.product div.images .flex-control-thumbs img {height:58px;}
    body.single-product.md-woo-single-product div.product .summary .product_title {font-size:26px!important;}
    body.single-product.md-woo-mobile-buybar-enabled {padding-bottom:calc(95px + env(safe-area-inset-bottom))!important;}
    .md-woo-mobile-buybar {
        position:fixed;z-index:900;
        inset-inline:0;inset-block-end:0;
        display:flex;align-items:center;gap:14px;
        padding:12px max(16px,env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
        background:rgba(255,255,255,.97);
        border-top:1px solid var(--md-border,#e2e8f0);
        box-shadow:0 -12px 38px rgba(15,23,42,.16);
        backdrop-filter:blur(14px);
        -webkit-backdrop-filter:blur(14px);
    }
    .md-woo-mobile-buybar-price {flex:1;min-width:0;display:flex;flex-direction:column;gap:3px;}
    .md-woo-mobile-buybar-price small {font-size:11px;color:#64748b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
    .md-woo-mobile-buybar-price strong {color:var(--md-primary);font-size:18px;white-space:nowrap;}
    .md-woo-mobile-buybar-action {flex:0 0 auto;max-width:58%;min-height:49px;padding:12px 22px;border:0;border-radius:13px;background:var(--md-primary);box-shadow:0 8px 22px color-mix(in srgb,var(--md-primary) 23%,transparent);color:#fff;font:inherit;font-weight:800;cursor:pointer;}
    .md-woo-mobile-buybar-action:focus-visible {outline:3px solid var(--md-heading,#0f172a);outline-offset:2px;}
}
@media (min-width:601px) {.md-woo-mobile-buybar {display:none!important;}}
@media (prefers-reduced-motion:reduce) {body.single-product.md-woo-single-product * {scroll-behavior:auto!important;}}


/* RC32 — Natural-size main product image: dimensions independent by viewport.
 * Do not alter archive/shop cards, header/footer, or WooCommerce hooks. */
body.single-product.md-woo-single-product {
    --md-single-image-current:var(--md-single-image-desktop,260px);
    --md-single-thumb-current:var(--md-single-thumb-desktop,66px);
    --md-single-gap-current:var(--md-single-gap-desktop,16px);
    --md-single-gallery-card:calc(var(--md-single-image-current) + 38px);
}
body.single-product.md-woo-single-product div.product {
    grid-template-columns:minmax(0,var(--md-single-gallery-card)) minmax(0,1fr)!important;
    align-items:start!important;
}
body.single-product.md-woo-single-product div.product > div.images {
    width:100%!important;
    max-width:var(--md-single-gallery-card)!important;
    justify-self:center!important;
    min-width:0!important;
    padding:18px!important;
}
body.single-product.md-woo-single-product div.product div.images .woocommerce-product-gallery__wrapper,
body.single-product.md-woo-single-product div.product div.images .flex-viewport {
    width:100%;
    max-width:100%;
    height:auto;
    background:#fff;
    border-radius:12px;
}
/* Override every legacy ratio preference for the individual product photo.
 * Width + height are always proportional; max-height prevents tall images
 * from pushing thumbnails far below the fold, without cropping. */
body.single-product.md-woo-single-product div.product div.images .woocommerce-product-gallery__image > a,
body.single-product.md-woo-single-product.md-woo-image-square div.product div.images .woocommerce-product-gallery__image > a,
body.single-product.md-woo-single-product.md-woo-image-portrait div.product div.images .woocommerce-product-gallery__image > a,
body.single-product.md-woo-single-product.md-woo-image-landscape div.product div.images .woocommerce-product-gallery__image > a {
    aspect-ratio:auto!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:100%!important;
    height:auto!important;
    max-width:var(--md-single-image-current)!important;
    max-height:none!important;
    margin-inline:auto!important;
    background:transparent!important;
    overflow:visible!important;
}
body.single-product.md-woo-single-product div.product div.images .woocommerce-product-gallery__image > a img,
body.single-product.md-woo-single-product div.product div.images .woocommerce-product-gallery__image img {
    display:block!important;
    width:auto!important;
    height:auto!important;
    max-width:100%!important;
    max-height:var(--md-single-image-current)!important;
    aspect-ratio:auto!important;
    object-fit:contain!important;
    transform:none!important;
    margin-inline:auto!important;
}
/* WooCommerce FlexSlider sometimes sets image widths inline. The parent link
 * remains centered and constrained, while actual img retains natural ratio. */
body.single-product.md-woo-single-product div.product div.images .flex-control-thumbs {
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    align-items:stretch;
    gap:6px!important;
    margin:var(--md-single-gap-current) 0 0!important;
    padding:0!important;
    list-style:none!important;
    clear:both;
}
body.single-product.md-woo-single-product div.product div.images .flex-control-thumbs li {
    display:flex;
    align-items:center;
    justify-content:center;
    width:auto!important;
    min-width:0!important;
    margin:0!important;
    padding:2px;
    border-radius:12px;
    border:1px solid var(--md-border,#e2e8f0);
    background:#fff;
    overflow:hidden;
}
body.single-product.md-woo-single-product div.product div.images .flex-control-thumbs img {
    display:block!important;
    width:100%!important;
    height:var(--md-single-thumb-current)!important;
    max-height:var(--md-single-thumb-current)!important;
    object-fit:contain!important;
    border:0!important;
    border-radius:8px!important;
}
/* The tabs are one full-width card below gallery and summary, not a naked line. */
body.single-product.md-woo-single-product div.product > .woocommerce-tabs,
body.single-product.md-woo-single-product div.product > .wc-tabs-wrapper,
body.single-product.md-woo-single-product div.product .woocommerce-tabs {
    grid-column:1 / -1!important;
    min-width:0!important;
    width:100%!important;
    box-sizing:border-box!important;
    margin:24px 0 0!important;
    padding:clamp(24px,3vw,36px)!important;
    background:#fff!important;
    border:1px solid #e2e8f0!important;
    border-radius:20px!important;
    box-shadow:0 24px 65px rgba(15,23,42,.18),0 5px 16px rgba(15,23,42,.06)!important;
}
body.single-product.md-woo-single-layout-compact div.product {
    grid-template-columns:minmax(0,var(--md-single-gallery-card)) minmax(0,1fr)!important;
}
body.single-product.md-woo-single-layout-compact div.product > div.images,
body.single-product.md-woo-single-layout-showcase div.product > div.images {
    max-width:var(--md-single-gallery-card)!important;
}
@media (max-width:900px) {
    body.single-product.md-woo-single-product {
        --md-single-image-current:var(--md-single-image-mobile,220px);
        --md-single-thumb-current:var(--md-single-thumb-mobile,56px);
        --md-single-gap-current:var(--md-single-gap-mobile,12px);
    }
    body.single-product.md-woo-single-product div.product {
        grid-template-columns:minmax(0,1fr)!important;
        gap:18px!important;
    }
    body.single-product.md-woo-single-product div.product > div.images {
        grid-column:1!important;
        grid-row:1!important;
        width:100%!important;
        max-width:min(100%,var(--md-single-gallery-card))!important;
        justify-self:center!important;
        padding:12px!important;
    }
    body.single-product.md-woo-single-product div.product > div.summary {
        grid-column:1!important;
        grid-row:2!important;
    }
    body.single-product.md-woo-single-product div.product > .woocommerce-tabs,
    body.single-product.md-woo-single-product div.product > .wc-tabs-wrapper {
        padding:20px!important;
        grid-column:1!important;
    }
}
@media (max-width:600px) {
    body.single-product.md-woo-single-product div.product > div.images {padding:12px!important;}
    body.single-product.md-woo-single-product div.product > .woocommerce-tabs,
    body.single-product.md-woo-single-product div.product > .wc-tabs-wrapper {padding:18px!important;}
}

body.single-product.md-woo-single-product div.product .woocommerce-tabs ul.tabs,
body.single-product.md-woo-single-product div.product .woocommerce-tabs ul.tabs li {list-style:none!important;}


/* RC35 — FlexSlider must be able to translate its FULL slide track.
   Earlier theme rules clipped overflow on the track, hiding selected images.
   The outer .flex-viewport alone owns clipping; native Woo gallery handles slide height. */
body.single-product.md-woo-single-product .woocommerce-product-gallery .flex-viewport{
  overflow:hidden!important;
  height:auto;
}
body.single-product.md-woo-single-product .woocommerce-product-gallery .flex-viewport > .woocommerce-product-gallery__wrapper{
  overflow:visible!important;
  max-width:none!important;
  border-radius:0!important;
}
body.single-product.md-woo-single-product .woocommerce-product-gallery .flex-viewport .woocommerce-product-gallery__image{
  overflow:visible!important;
}
