/* ==========================================================================
   Single product page (native WooCommerce template, themed).
   ========================================================================== */

/* .mlc-shop vertical padding is defined globally in style.css (shared by every
   WooCommerce surface). */

/* Breadcrumb */
.single-product .woocommerce-breadcrumb {
    font-size: .85rem;
    color: var(--mlc-ink-soft);
    margin-bottom: clamp(12px, 1.6vw, 18px);
}
.single-product .woocommerce-breadcrumb a { color: var(--mlc-ink-soft); }
.single-product .woocommerce-breadcrumb a:hover { color: var(--mlc-green-dark); }

/* --------------------------------------------------------------------------
   Two-column layout: gallery | summary
   -------------------------------------------------------------------------- */
.single-product div.product {
    display: grid;
    /* Image column is capped; the product-data column takes the rest (wider). */
    grid-template-columns: clamp(300px, 36%, 460px) minmax(0, 1fr);
    gap: clamp(28px, 4vw, 56px);
    align-items: start;
    margin: 0;
}

/* Gallery: WooCommerce core floats this at 48% width, which inside our grid
   column shrinks the image to ~quarter width. Force it to fill its column and
   frame it as a card. Stays put while the (taller) summary scrolls. */
.single-product div.product .woocommerce-product-gallery {
    width: 100% !important;
    float: none !important;
    margin: 0;
    /* Pin the gallery to the TOP of its (tall) grid cell, level with the title —
       otherwise it sits low in the column, leaving a gap under the breadcrumb. */
    align-self: start;
    background: var(--mlc-card-bg);
    border: 1px solid var(--mlc-line);
    border-radius: var(--mlc-radius);
    padding: clamp(14px, 2.5vw, 28px);
    box-shadow: var(--mlc-shadow);
}
/* Sticky behaviour belongs to the two-column DESKTOP layout only. In the single
   column mobile layout the gallery sits directly above the summary, so a sticky
   `top` offset would shift the (relatively-positioned) image down over the title
   that follows it — keep it off below the 860px breakpoint. */
@media (min-width: 861px) {
    .single-product div.product .woocommerce-product-gallery {
        position: sticky;
        top: calc(var(--mlc-header-height) + 20px);
    }
}
.single-product .woocommerce-product-gallery__wrapper { margin: 0; }
.single-product .woocommerce-product-gallery img {
    width: 100%;
    height: auto;
    border-radius: var(--mlc-radius-sm);
    display: block;
}
/* Zoom trigger pinned tidily inside the frame */
.single-product .woocommerce-product-gallery__trigger {
    top: clamp(18px, 3vw, 34px);
    right: clamp(18px, 3vw, 34px);
}
/* Thumbnail strip for multi-image galleries */
.single-product .flex-control-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: clamp(16px, 2vw, 24px) 0 0;
    padding: clamp(16px, 2vw, 24px) 0 0;
    border-top: 1px solid var(--mlc-line);
    list-style: none;
}
.single-product .flex-control-thumbs li { width: auto; margin: 0; }
.single-product .flex-control-thumbs img {
    width: 64px;
    border: 1px solid var(--mlc-line);
    border-radius: var(--mlc-radius-sm);
    opacity: .6;
    cursor: pointer;
    transition: opacity var(--mlc-transition);
}
.single-product .flex-control-thumbs img.flex-active,
.single-product .flex-control-thumbs img:hover { opacity: 1; }

/* --------------------------------------------------------------------------
   Summary column
   -------------------------------------------------------------------------- */
/* WooCommerce's layout stylesheet floats the summary at width:48% (a leftover
   from its old two-column float layout). Inside our CSS grid that shrinks the
   summary content to half its cell, leaving the page looking ~2/3 wide. Force
   it (and the gallery) to fill their grid columns. */
.single-product div.product .summary,
.single-product div.product .entry-summary {
    width: 100% !important;
    float: none !important;
    margin: 0;
}

.single-product .product_title {
    font-size: clamp(1.8rem, 3.6vw, 2.6rem);
    line-height: 1.12;
    margin: 0 0 14px;
}
.single-product .woocommerce-product-rating { margin: 0 0 14px; }

.single-product div.product p.price,
.single-product div.product span.price {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--mlc-green-dark);
    margin: 0 0 18px;
    display: block;
}
.single-product div.product p.price del { color: var(--mlc-ink-soft); font-weight: 400; font-size: 1.1rem; margin-right: .4em; }
.single-product div.product p.price ins { text-decoration: none; color: var(--mlc-sale); }

/* Clearpay / instalment widget — rein in its default vertical margins */
.single-product .summary square-placement,
.single-product .summary .afterpay-paragraph,
.single-product .summary [class*="clearpay"] { margin: 0 0 18px; }

/* Short description */
.single-product .woocommerce-product-details__short-description {
    color: var(--mlc-ink-soft);
    margin: 0 0 22px;
    padding: 18px 0;
    border-top: 1px solid var(--mlc-line);
    border-bottom: 1px solid var(--mlc-line);
}
.single-product .woocommerce-product-details__short-description :first-child { margin-top: 0; }
.single-product .woocommerce-product-details__short-description :last-child { margin-bottom: 0; }
.single-product .woocommerce-product-details__short-description ul { margin: 0; padding-left: 1.2em; }
.single-product .woocommerce-product-details__short-description li { margin: .25em 0; }

/* Stock status */
.single-product .stock { font-weight: 600; margin: 0 0 18px; }
.single-product .stock.out-of-stock { color: var(--mlc-sale); }
.single-product .stock.in-stock { color: var(--mlc-green-dark); }

/* --------------------------------------------------------------------------
   Variations + quantity + add to cart
   -------------------------------------------------------------------------- */
.single-product form.cart {
    margin: 0 0 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.single-product form.variations_form.cart { display: block; }
.single-product table.variations { width: 100%; margin: 0 0 16px; border-collapse: collapse; }
.single-product table.variations td,
.single-product table.variations th { padding: 8px 0; text-align: left; vertical-align: middle; }
.single-product table.variations th { width: 30%; font-weight: 600; }
.single-product table.variations select {
    width: 100%;
    padding: .7em .9em;
    border: 1px solid var(--mlc-line);
    border-radius: var(--mlc-radius-sm);
    font: inherit;
    background: #fff;
}
.single-product .woocommerce-variation-add-to-cart { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.single-product .quantity input.qty {
    width: 76px;
    padding: .8em;
    border: 1px solid var(--mlc-line);
    border-radius: var(--mlc-radius-sm);
    font: inherit;
    text-align: center;
}
.single-product form.cart .button,
.single-product .single_add_to_cart_button {
    padding: .9em 2.2em;
    border: 0;
    border-radius: 999px;
    background: var(--mlc-green);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background var(--mlc-transition), transform var(--mlc-transition);
}
.single-product .single_add_to_cart_button:hover { background: var(--mlc-green-dark); transform: translateY(-2px); }
.single-product .single_add_to_cart_button.disabled,
.single-product .single_add_to_cart_button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Meta (categories / tags / sku) */
.single-product .product_meta {
    font-size: .85rem;
    color: var(--mlc-ink-soft);
    margin: 22px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--mlc-line);
}
.single-product .product_meta > span { display: block; margin-bottom: 6px; }
.single-product .product_meta a { color: var(--mlc-green-dark); }

/* --------------------------------------------------------------------------
   Tabs (description / reviews / additional info)
   -------------------------------------------------------------------------- */
.woocommerce-tabs { grid-column: 1 / -1; margin-top: clamp(40px, 5vw, 72px); }
.woocommerce-tabs ul.tabs {
    display: flex;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    border-bottom: 1px solid var(--mlc-line);
    flex-wrap: wrap;
}
.woocommerce-tabs ul.tabs li { margin: 0; }
.woocommerce-tabs ul.tabs li a {
    display: block;
    padding: .7em 1.2em;
    font-weight: 600;
    color: var(--mlc-ink-soft);
    border-bottom: 2px solid transparent;
}
.woocommerce-tabs ul.tabs li.active a { color: var(--mlc-green-dark); border-bottom-color: var(--mlc-green); }
.woocommerce-tabs .woocommerce-Tabs-panel { max-width: 80ch; }
.woocommerce-tabs .woocommerce-Tabs-panel > h2:first-child { margin-top: 0; }

/* --------------------------------------------------------------------------
   Related / upsells
   -------------------------------------------------------------------------- */
.related.products,
.upsells.products { grid-column: 1 / -1; margin-top: clamp(40px, 5vw, 72px); }
.related.products > h2,
.upsells.products > h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: 24px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
    .single-product div.product { grid-template-columns: 1fr; }
    /* Belt-and-braces: never let a leftover sticky offset push the image over the
       title (WooCommerce core sets the gallery position:relative). */
    .single-product div.product .woocommerce-product-gallery { position: static; top: auto; }
}
