/* =====================================================================
   SHIM-ME Hub — WooCommerce Single Product Page  (v0.5.2)
   Styles both the main SHIM-ME product and individual Part products.
   Scope: body.single-product
   Mirrors the design language of Product.html and Part.html.
   ===================================================================== */

/* ---- Crumbs / sub-nav bar (Part.html style) ----------------------- */

.shim-crumbs {
    background: var(--shim-bg-2);
    border-bottom: 1px solid var(--shim-line);
    padding: 14px 0;
    /* Break out of Total's div.container (max-width: 1280px) */
    width: 100vw !important;
    position: relative !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin-bottom: 0 !important;
}

.shim-crumbs__inner {
    max-width: var(--shim-container);
    margin: 0 auto;
    padding: 0 var(--shim-gutter);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.shim-crumbs__path {
    font-family: var(--shim-mono) !important;
    font-size: 11px !important;
    color: var(--shim-text-mute) !important;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.shim-crumbs__path a {
    color: var(--shim-text-dim) !important;
    text-decoration: none !important;
    transition: color 0.15s ease;
}

.shim-crumbs__path a:hover {
    color: var(--shim-red) !important;
}

.shim-crumbs__sep {
    color: var(--shim-text-mute);
    margin: 0 4px;
}

.shim-crumbs__calc {
    font-family: var(--shim-mono) !important;
    font-size: 11px !important;
    color: var(--shim-red) !important;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-decoration: none !important;
    border-bottom: 1px solid var(--shim-red);
    padding-bottom: 2px;
    white-space: nowrap;
}

.shim-crumbs__calc:hover {
    opacity: 0.8;
}

/* ---- 2-column product layout --------------------------------------- */

body.single-product div.product {
    display: grid !important;
    grid-template-columns: 1.15fr 1fr !important;
    gap: 60px !important;
    padding: 60px 0 80px !important;
    border-bottom: 1px solid var(--shim-line) !important;
    align-items: start !important;
}

/* Gallery — sticky while scrolling through the buy-box, released once the
   Additional Information / tabs section enters the viewport (via JS).
   --shim-sticky-top is set by JS to the bottom of the fixed site header so
   the gallery scrolls freely at first, then freezes just below the header —
   matching the Part.html reference behaviour (top: 90px). The 90px fallback
   is a safe default before JS has measured the actual header height. */
body.single-product .woocommerce-product-gallery {
    position: sticky !important;
    top: var( --shim-sticky-top, 90px ) !important;
    align-self: start !important;
    width: 100% !important;
}

/* JS adds this class when .woocommerce-tabs enters the viewport */
body.single-product .woocommerce-product-gallery.shim-gallery--released {
    position: relative !important;
    top: auto !important;
}

/* Tabs + related span full width below the 2-col section */
body.single-product div.product .woocommerce-tabs,
body.single-product div.product section.related,
body.single-product div.product section.upsells {
    grid-column: 1 / -1 !important;
}

/* ---- Product gallery ---------------------------------------------- */

/* Main image container — Total theme uses __wrapper, legacy WC uses
   .flex-viewport or figure.__image. Target all three. */
body.single-product .woocommerce-product-gallery__wrapper,
body.single-product .woocommerce-product-gallery .flex-viewport,
body.single-product .woocommerce-product-gallery figure.woocommerce-product-gallery__image {
    background:
        radial-gradient(ellipse at center, rgba(227,29,30,0.18), transparent 65%),
        var(--shim-bg-3) !important;
    border: 1px solid var(--shim-line) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 40px !important;
    aspect-ratio: 4 / 3 !important;
    width: 100% !important;   /* Must be explicit — aspect-ratio otherwise computes width from height */
    overflow: hidden !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* The __image div inside __wrapper has inline position:relative set by WC JS.
   It needs to fill the wrapper and center its content. */
body.single-product .woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
}

/* Product image — target wp-post-image to avoid styling the hidden zoomImg */
body.single-product .woocommerce-product-gallery .woocommerce-product-gallery__image img.wp-post-image,
body.single-product .woocommerce-product-gallery .flex-viewport img,
body.single-product .woocommerce-product-gallery figure img {
    width: 80% !important;
    height: auto !important;
    object-fit: contain !important;
    filter: drop-shadow(0 30px 50px rgba(0,0,0,0.6)) !important;
    background: transparent !important;
    display: block !important;
    margin: 0 auto !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Keep the WC zoom clone (zoomImg) hidden behind — don't interfere with it */
body.single-product .woocommerce-product-gallery img.zoomImg {
    width: auto !important;
    filter: none !important;
}

/* ---- Gallery overlay tags (Part.html style) ------------------------- */

/* Left tag — red part ID badge (e.g. "PT-01 · 4" · STAND-ALONE") */
.shim-gal__tag {
    position: absolute !important;
    top: 18px !important;
    left: 18px !important;
    z-index: 10 !important;
    background: var(--shim-red) !important;
    color: #fff !important;
    font-family: var(--shim-mono) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.16em !important;
    text-transform: uppercase !important;
    padding: 6px 10px !important;
    line-height: 1 !important;
    pointer-events: none !important;
}

/* Right tag — "PART OF · SHIM-ME SYSTEM" chip */
.shim-gal__sys-tag {
    position: absolute !important;
    top: 18px !important;
    right: 18px !important;
    z-index: 10 !important;
    font-family: var(--shim-mono) !important;
    font-size: 10px !important;
    color: var(--shim-text-dim) !important;
    letter-spacing: 0.16em !important;
    text-transform: uppercase !important;
    background: rgba(0, 0, 0, 0.5) !important;
    border: 1px solid var(--shim-line) !important;
    padding: 6px 10px !important;
    line-height: 1 !important;
    pointer-events: none !important;
}

.shim-gal__sys-tag b {
    color: var(--shim-red) !important;
    font-weight: 600 !important;
}

/* No-image placeholder */
body.single-product .woocommerce-product-gallery .woocommerce-product-gallery__image.woocommerce-product-gallery__image--placeholder {
    background: var(--shim-bg-3) !important;
    border: 1px dashed var(--shim-line-2) !important;
}

/* Thumbnail strip */
body.single-product .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 8px !important;
    margin-top: 14px !important;
    padding: 0 !important;
    list-style: none !important;
}

body.single-product .woocommerce-product-gallery .flex-control-thumbs li {
    margin: 0 !important;
}

body.single-product .woocommerce-product-gallery .flex-control-thumbs img {
    background: var(--shim-bg-3) !important;
    border: 1px solid var(--shim-line) !important;
    padding: 10px !important;
    cursor: pointer !important;
    opacity: 0.55 !important;
    transition: opacity .15s ease, border-color .15s ease !important;
    aspect-ratio: 1 !important;
    object-fit: contain !important;
    width: 100% !important;
    display: block !important;
}

body.single-product .woocommerce-product-gallery .flex-control-thumbs img:hover,
body.single-product .woocommerce-product-gallery .flex-control-thumbs img.flex-active {
    opacity: 1 !important;
    border-color: var(--shim-red) !important;
}

/* Gallery zoom icon */
body.single-product .woocommerce-product-gallery__trigger {
    background: var(--shim-bg-2) !important;
    border: 1px solid var(--shim-line) !important;
    color: var(--shim-text-mute) !important;
    border-radius: 0 !important;
}

/* ---- Buy box / Summary --------------------------------------------- */

body.single-product .summary.entry-summary {
    display: flex !important;
    flex-direction: column !important;
    /* Total theme sets float:right; width:44% on .product .summary —
       override both so the element fills its grid cell instead */
    width: 100% !important;
    float: none !important;
}

/* Product category eyebrow */
body.single-product .summary .posted_in,
body.single-product .summary .woocommerce-product-details__short-description > p:first-child {
    font-family: var(--shim-mono) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.22em !important;
    color: var(--shim-red) !important;
    margin: 0 0 10px !important;
}

/* Product title */
body.single-product .summary .product_title.entry-title {
    font-family: var(--shim-display) !important;
    font-weight: 900 !important;
    font-size: clamp(56px, 7vw, 96px) !important;
    line-height: 0.92 !important;
    letter-spacing: -0.02em !important;
    text-transform: uppercase !important;
    color: var(--shim-text) !important;
    margin: 6px 0 18px !important;
    padding: 0 !important;
}

/* Short description */
body.single-product .summary .woocommerce-product-details__short-description {
    color: var(--shim-text-dim) !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
    margin: 0 0 30px !important;
    max-width: 50ch !important;
}

body.single-product .summary .woocommerce-product-details__short-description p {
    color: var(--shim-text-dim) !important;
    margin: 0 0 12px !important;
}

/* ---- Price ---------------------------------------------------------- */

body.single-product .summary .price {
    display: flex !important;
    align-items: baseline !important;
    gap: 12px !important;
    padding: 18px 0 !important;
    border-top: 1px solid var(--shim-line) !important;
    border-bottom: 1px solid var(--shim-line) !important;
    flex-wrap: wrap !important;
    margin-bottom: 22px !important;
    background: transparent !important;
    color: var(--shim-text) !important;
}

body.single-product .summary .price .woocommerce-Price-amount.amount {
    font-family: var(--shim-display) !important;
    font-weight: 800 !important;
    font-size: 48px !important;
    color: #fff !important;
    line-height: 1 !important;
}

body.single-product .summary .price ins {
    text-decoration: none !important;
    background: transparent !important;
}

body.single-product .summary .price del {
    opacity: 1 !important;
}

body.single-product .summary .price del .amount {
    font-size: 28px !important;
    color: var(--shim-text-mute) !important;
}

/* Stock status */
body.single-product .summary .stock {
    font-family: var(--shim-mono) !important;
    font-size: 11px !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase !important;
    margin-bottom: 16px !important;
}
body.single-product .summary .in-stock  { color: #4ade80 !important; }
body.single-product .summary .out-of-stock { color: var(--shim-red) !important; }

/* ---- Variations (size selector) ------------------------------------ */

body.single-product .variations_form table.variations {
    border: none !important;
    background: transparent !important;
    width: 100% !important;
    margin-bottom: 16px !important;
    border-collapse: collapse !important;
}

body.single-product .variations_form table.variations td,
body.single-product .variations_form table.variations th {
    background: transparent !important;
    border: none !important;
    padding: 8px 0 !important;
    vertical-align: middle !important;
}

body.single-product .variations_form table.variations .label label {
    font-family: var(--shim-mono) !important;
    font-size: 11px !important;
    color: var(--shim-text-mute) !important;
    letter-spacing: 0.18em !important;
    text-transform: uppercase !important;
    width: 110px !important;
    display: block !important;
    flex-shrink: 0 !important;
}

body.single-product .variations_form .reset_variations {
    font-family: var(--shim-mono) !important;
    font-size: 10px !important;
    color: var(--shim-text-mute) !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    display: inline-block !important;
    margin-top: 6px !important;
}

body.single-product .variations_form .reset_variations:hover {
    color: var(--shim-red) !important;
}

body.single-product .woocommerce-variation-price .price {
    border: none !important;
    padding: 8px 0 !important;
    margin-bottom: 8px !important;
}

/* ---- Add to cart form --------------------------------------------- */

/* Simple product: qty + button side by side */
body.single-product .summary form.cart {
    display: flex !important;
    gap: 10px !important;
    align-items: stretch !important;
    margin: 24px 0 !important;
    flex-wrap: nowrap !important;
}

/* Variable product: variations table stacks ABOVE the qty/button row */
body.single-product .summary form.variations_form.cart {
    flex-direction: column !important;
    gap: 0 !important;
}

body.single-product .summary form.variations_form table.variations {
    width: 100% !important;
    margin-bottom: 16px !important;
}

/* The qty + add-to-cart row inside single_variation_wrap stays horizontal */
body.single-product .summary .single_variation_wrap .woocommerce-variation-add-to-cart {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100% !important;
}

body.single-product .summary .single_variation_wrap .woocommerce-variation-add-to-cart .quantity {
    flex-shrink: 0 !important;
}

body.single-product .summary .single_variation_wrap .woocommerce-variation-add-to-cart .single_add_to_cart_button {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

body.single-product .summary form.cart .quantity {
    flex-shrink: 0 !important;
}

body.single-product .summary form.cart .quantity .qty {
    background: var(--shim-bg-3) !important;
    border: 1px solid var(--shim-line-2) !important;
    color: var(--shim-text) !important;
    font-family: var(--shim-display) !important;
    font-weight: 700 !important;
    font-size: 22px !important;
    padding: 0 16px !important;
    height: 54px !important;
    width: 80px !important;
    text-align: center !important;
    border-radius: 0 !important;
}

body.single-product .summary form.cart .single_add_to_cart_button.button {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--shim-red) !important;
    border-color: var(--shim-red) !important;
    color: #fff !important;
    font-size: 15px !important;
    padding: 0 28px !important;
    height: 54px !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
}

body.single-product .summary form.cart .single_add_to_cart_button.button:hover {
    background: var(--shim-red-deep) !important;
    border-color: var(--shim-red-deep) !important;
    transform: translateY(-1px) !important;
}

/* Loading spinner */
body.single-product .summary form.cart .single_add_to_cart_button.loading {
    opacity: 0.75 !important;
}

/* ---- Product meta -------------------------------------------------- */

body.single-product .summary .product_meta {
    border-top: 1px solid var(--shim-line) !important;
    padding-top: 18px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin-top: 8px !important;
}

body.single-product .summary .product_meta > span {
    display: flex !important;
    gap: 16px !important;
    font-size: 13px !important;
    color: var(--shim-text-dim) !important;
    font-family: var(--shim-body) !important;
    align-items: center !important;
}

body.single-product .summary .product_meta > span .sku,
body.single-product .summary .product_meta > span a {
    color: var(--shim-text) !important;
    font-family: var(--shim-mono) !important;
    font-size: 12px !important;
    letter-spacing: 0.06em !important;
    text-decoration: none !important;
}

body.single-product .summary .product_meta > span a:hover {
    color: var(--shim-red) !important;
}

/* ---- Product tabs -------------------------------------------------- */

body.single-product .woocommerce-tabs {
    margin-top: 60px !important;
    padding-top: 60px !important;
    border-top: 1px solid var(--shim-line) !important;
}

body.single-product .woocommerce-tabs ul.tabs {
    display: flex !important;
    gap: 0 !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border-bottom: none !important;
    border-left: 1px solid var(--shim-line) !important;
    border-top: 1px solid var(--shim-line) !important;
}

body.single-product .woocommerce-tabs ul.tabs::before {
    display: none !important;
    border: none !important;
}

body.single-product .woocommerce-tabs ul.tabs li {
    border: none !important;
    border-right: 1px solid var(--shim-line) !important;
    border-bottom: 1px solid var(--shim-line) !important;
    border-radius: 0 !important;
    background: var(--shim-bg-2) !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.single-product .woocommerce-tabs ul.tabs li::before,
body.single-product .woocommerce-tabs ul.tabs li::after {
    display: none !important;
}

body.single-product .woocommerce-tabs ul.tabs li a {
    display: block !important;
    padding: 18px 28px !important;
    font-family: var(--shim-mono) !important;
    font-size: 11px !important;
    letter-spacing: 0.18em !important;
    text-transform: uppercase !important;
    color: var(--shim-text-mute) !important;
    border-radius: 0 !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: color .15s ease !important;
}

body.single-product .woocommerce-tabs ul.tabs li a:hover {
    color: var(--shim-text) !important;
    background: transparent !important;
}

body.single-product .woocommerce-tabs ul.tabs li.active {
    background: var(--shim-bg-3) !important;
    border-bottom-color: var(--shim-bg-3) !important;
    margin-bottom: -1px !important;
}

body.single-product .woocommerce-tabs ul.tabs li.active a {
    color: var(--shim-text) !important;
}

body.single-product .woocommerce-tabs .woocommerce-Tabs-panel {
    background: var(--shim-bg-3) !important;
    border: 1px solid var(--shim-line) !important;
    border-top: none !important;
    padding: 32px !important;
    margin: 0 !important;
}

body.single-product .woocommerce-tabs .woocommerce-Tabs-panel h2 {
    font-family: var(--shim-display) !important;
    font-weight: 700 !important;
    font-size: 28px !important;
    text-transform: uppercase !important;
    color: var(--shim-text) !important;
    margin: 0 0 20px !important;
}

body.single-product .woocommerce-tabs .woocommerce-Tabs-panel p,
body.single-product .woocommerce-tabs .woocommerce-Tabs-panel li {
    font-size: 15px !important;
    line-height: 1.65 !important;
    color: var(--shim-text-dim) !important;
}

/* Attributes tab table */
body.single-product .woocommerce-tabs .shop_attributes {
    border: none !important;
    width: 100% !important;
    border-collapse: collapse !important;
}

body.single-product .woocommerce-tabs .shop_attributes th {
    font-family: var(--shim-mono) !important;
    font-size: 10px !important;
    color: var(--shim-text-mute) !important;
    letter-spacing: 0.18em !important;
    text-transform: uppercase !important;
    padding: 12px 0 12px 0 !important;
    /* Total theme sets all 4 sides via "table th" — kill left/right too */
    border-top: none !important;
    border-right: none !important;
    border-bottom: 1px solid var(--shim-line) !important;
    border-left: none !important;
    background: transparent !important;
    width: 160px !important;
    font-weight: 500 !important;
}

body.single-product .woocommerce-tabs .shop_attributes td {
    padding: 12px 0 !important;
    /* Total theme sets all 4 sides via "table td" — kill left/right too */
    border-top: none !important;
    border-right: none !important;
    border-bottom: 1px solid var(--shim-line) !important;
    border-left: none !important;
    color: var(--shim-text) !important;
    font-family: var(--shim-display) !important;
    font-weight: 600 !important;
    font-size: 18px !important;
    text-transform: uppercase !important;
    background: transparent !important;
}

/* ---- Related / Upsell products ------------------------------------ */

body.single-product section.related,
body.single-product section.upsells {
    padding: 60px 0 !important;
    border-top: 1px solid var(--shim-line) !important;
    margin: 0 !important;
}

body.single-product section.related > h2,
body.single-product section.upsells > h2 {
    font-family: var(--shim-mono) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.22em !important;
    color: var(--shim-red) !important;
    margin: 0 0 28px !important;
    padding: 0 !important;
}

body.single-product ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 16px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.single-product ul.products li.product {
    background: var(--shim-bg-3) !important;
    border: 1px solid var(--shim-line) !important;
    display: flex !important;
    flex-direction: column !important;
    transition: border-color .15s ease !important;
    margin: 0 !important;
    padding: 0 !important;
    text-decoration: none !important;
}

body.single-product ul.products li.product:hover {
    border-color: var(--shim-red) !important;
}

body.single-product ul.products li.product a img {
    border-bottom: 1px solid var(--shim-line) !important;
    background: var(--shim-bg-2) !important;
    padding: 20px !important;
    width: 100% !important;
    object-fit: contain !important;
    aspect-ratio: 3 / 2 !important;
    display: block !important;
}

body.single-product ul.products li.product .woocommerce-loop-product__title {
    font-family: var(--shim-display) !important;
    font-weight: 700 !important;
    font-size: 22px !important;
    text-transform: uppercase !important;
    color: var(--shim-text) !important;
    margin: 16px 20px 6px !important;
    line-height: 1 !important;
    padding: 0 !important;
}

body.single-product ul.products li.product .price {
    margin: 0 20px 12px !important;
    border: none !important;
    padding: 0 !important;
    font-size: 14px !important;
}

body.single-product ul.products li.product .price .amount {
    font-family: var(--shim-display) !important;
    font-weight: 700 !important;
    font-size: 20px !important;
    color: var(--shim-text) !important;
}

body.single-product ul.products li.product .button {
    margin: auto 20px 20px !important;
    align-self: flex-start !important;
    font-size: 12px !important;
    padding: 10px 16px !important;
}

/* ---- Related / Upsell — Total theme "Select Options" hover button --- */
/* Total positions .wpex-loop-product-add-to-cart absolute inside the
   image container and slides it up on hover. We need overflow:hidden on
   the image wrapper so it clips cleanly instead of overflowing below.   */

body.single-product .products .product .wpex-loop-product-images {
    overflow: hidden !important;
    position: relative !important;
}

body.single-product .products .product .wpex-loop-product-add-to-cart {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    transform: translateY(100%) !important;
    transition: transform 0.2s ease !important;
}

body.single-product .products .product:hover .wpex-loop-product-add-to-cart {
    transform: translateY(0%) !important;
}

/* ---- Total theme utility overrides --------------------------------- */

/* Total's .wpex-border-t has no color — inherits white/bright on dark bg.
   Remap to the design token so all border-top utlity classes use our line. */
body.single-product .wpex-border-t {
    border-block-start-color: var(--shim-line) !important;
}

/* Generic block-start borders set by Total / WPBakery on description area */
body.single-product .woocommerce-tabs .woocommerce-Tabs-panel [class*="wpex-border"] {
    border-color: var(--shim-line) !important;
    opacity: 0.8 !important;
}

/* ---- Responsive ----------------------------------------------------- */

@media (max-width: 960px) {
    body.single-product div.product {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }

    body.single-product .woocommerce-product-gallery {
        position: static !important;
        top: auto !important;
    }

    body.single-product ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    body.single-product .summary .product_title.entry-title {
        font-size: clamp(44px, 10vw, 72px) !important;
    }
}

@media (max-width: 560px) {
    body.single-product ul.products {
        grid-template-columns: 1fr !important;
    }
}
